PageSourceSearch

https://limewire.com/build/workers/upload-entry-worker-with-sentry.worker-DN2vIHJW.js

js limewire.com collected 2026-10-01 08:34:45 UTC 1,269,373 bytes, 1,049 lines download raw bytes

1var mY=Object.defineProperty;var Dv=Ze=>{throw TypeError(Ze)};var gY=(Ze,ot,Bt)=>ot in Ze?mY(Ze,ot,{enumerable:!0,configurable:!0,writable:!0,value:Bt}):Ze[ot]=Bt;var gn=(Ze,ot,Bt)=>gY(Ze,typeof ot!="symbol"?ot+"":ot,Bt),Ov=(Ze,ot,Bt)=>ot.has(Ze)||Dv("Cannot "+Bt);var Qe=(Ze,ot,Bt)=>(Ov(Ze,ot,"read from private field"),Bt?Bt.call(Ze):ot.get(Ze)),ji=(Ze,ot,Bt)=>ot.has(Ze)?Dv("Cannot add the same private member more than once"):ot instanceof WeakSet?ot.add(Ze):ot.set(Ze,Bt),Zc=(Ze,ot,Bt,jn)=>(Ov(Ze,ot,"write to private field"),jn?jn.call(Ze,Bt):ot.set(Ze,Bt),Bt);(function(){"use strict";var Rv,Fv,Mv,Dn,Ki,li,Qs,Hs,mf,pn;const Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Ze.length;t++)ot[Ze.charCodeAt(t)]=t;const Bt=t=>{let e=t.length*.75,n=0,r,i,s,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const o=new ArrayBuffer(e),c=new Uint8Array(o);for(let u=0;u<t.length;u+=4)r=ot[t.charCodeAt(u)],i=ot[t.charCodeAt(u+1)],s=ot[t.charCodeAt(u+2)],a=ot[t.charCodeAt(u+3)],c[n++]=r<<2|i>>4,c[n++]=(i&15)<<4|s>>2,c[n++]=(s&3)<<6|a&63;return o},jn=t=>{const e=new Uint8Array(t),n=e.length;let r="";for(let i=0;i<n;i+=3)r+=Ze[e[i]>>2],r+=Ze[(e[i]&3)<<4|e[i+1]>>4],r+=Ze[(e[i+1]&15)<<2|e[i+2]>>6],r+=Ze[e[i+2]&63];return n%3===2?r=r.substring(0,r.length-1)+"=":n%3===1&&(r=r.substring(0,r.length-2)+"=="),r},Nv=t=>{if(!t)return"";let e=t.replace(/-/g,"+").replace(/_/g,"/");const n=4-e.length%4;return n!==4&&(e+="=".repeat(n)),e},di=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});if(!t||!e)throw new Error("Missing Resolvers");return{promise:n,resolve:t,reject:e}},Uv=(...t)=>{const e=t.reduce((r,i)=>r+i.length,0),n=new Uint8Array(e);return t.forEach((r,i)=>{const s=t.slice(0,i).reduce((a,o)=>a+o.length,0);n.set(r,s)}),n},eu=()=>{},$t=t=>({ok:!0,value:t}),we=t=>({ok:!1,error:t}),Lt=(t,e)=>t instanceof Error?t:typeof DOMException=="function"&&t instanceof DOMException?new Error(`DOMException: ${t.name} ${t.message}`):(typeof e=="function"?e(t):e)||new Error(`${t}`);function Lv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}class zv extends Error{constructor(e){super(`Local database lost store ${e}, reloading the page.`),this.name="LocalDatabaseReloadScheduledError"}}const Qv="rxdb_id_mismatch";class Hv extends Error{constructor(e){super(`Data Synchronization Error. Please reload the page. (${Qv})`),this.serverMessage=e}}var gf={exports:{}},ve={};/**
2 * @license React
3 * react.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and 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 WA;function Wv(){if(WA)return ve;WA=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),f=Symbol.iterator;function h(B){return B===null||typeof B!="object"?null:(B=f&&B[f]||B["@@iterator"],typeof B=="function"?B:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p=Object.assign,g={};function A(B,L,K){this.props=B,this.context=L,this.refs=g,this.updater=K||m}A.prototype.isReactComponent={},A.prototype.setState=function(B,L){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,L,"setState")},A.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function y(){}y.prototype=A.prototype;function w(B,L,K){this.props=B,this.context=L,this.refs=g,this.updater=K||m}var E=w.prototype=new y;E.constructor=w,p(E,A.prototype),E.isPureReactComponent=!0;var S=Array.isArray;function k(){}var T={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function _(B,L,K){var q=K.ref;return{$$typeof:t,type:B,key:L,ref:q!==void 0?q:null,props:K}}function x(B,L){return _(B.type,L,B.props)}function P(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function v(B){var L={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(K){return L[K]})}var M=/\/+/g;function D(B,L){return typeof B=="object"&&B!==null&&B.key!=null?v(""+B.key):L.toString(36)}function O(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(k,k):(B.status="pending",B.then(function(L){B.status==="pending"&&(B.status="fulfilled",B.value=L)},function(L){B.status==="pending"&&(B.status="rejected",B.reason=L)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function N(B,L,K,q,ne){var fe=typeof B;(fe==="undefined"||fe==="boolean")&&(B=null);var Ae=!1;if(B===null)Ae=!0;else switch(fe){case"bigint":case"string":case"number":Ae=!0;break;case"object":switch(B.$$typeof){case t:case e:Ae=!0;break;case l:return Ae=B._init,N(Ae(B._payload),L,K,q,ne)}}if(Ae)return ne=ne(B),Ae=q===""?"."+D(B,0):q,S(ne)?(K="",Ae!=null&&(K=Ae.replace(M,"$&/")+"/"),N(ne,L,K,"",function($e){return $e}
vendor: 4,245 bytes, line 9
9)):ne!=null&&(P(ne)&&(ne=x(ne,K+(ne.key==null||B&&B.key===ne.key?"":(""+ne.key).replace(M,"$&/")+"/")+Ae)),L.push(ne)),1;Ae=0;var ie=q===""?".":q+":";if(S(B))for(var ye=0;ye<B.length;ye++)q=B[ye],fe=ie+D(q,ye),Ae+=N(q,L,K,fe,ne);else if(ye=h(B),typeof ye=="function")for(B=ye.call(B),ye=0;!(q=B.next()).done;)q=q.value,fe=ie+D(q,ye++),Ae+=N(q,L,K,fe,ne);else if(fe==="object"){if(typeof B.then=="function")return N(O(B),L,K,q,ne);throw L=String(B),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return Ae}function Q(B,L,K){if(B==null)return B;var q=[],ne=0;return N(B,q,"","",function(fe){return L.call(K,fe,ne++)}),q}function G(B){if(B._status===-1){var L=B._result;L=L(),L.then(function(K){(B._status===0||B._status===-1)&&(B._status=1,B._result=K)},function(K){(B._status===0||B._status===-1)&&(B._status=2,B._result=K)}),B._status===-1&&(B._status=0,B._result=L)}if(B._status===1)return B._result.default;throw B._result}var V=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},Z={map:Q,forEach:function(B,L,K){Q(B,function(){L.apply(this,arguments)},K)},count:function(B){var L=0;return Q(B,function(){L++}),L},toArray:function(B){return Q(B,function(L){return L})||[]},only:function(B){if(!P(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return ve.Activity=d,ve.Children=Z,ve.Component=A,ve.Fragment=n,ve.Profiler=i,ve.PureComponent=w,ve.StrictMode=r,ve.Suspense=c,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,ve.__COMPILER_RUNTIME={__proto__:null,c:function(B){return T.H.useMemoCache(B)}},ve.cache=function(B){return function(){return B.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(B,L,K){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var q=p({},B.props),ne=B.key;if(L!=null)for(fe in L.key!==void 0&&(ne=""+L.key),L)!C.call(L,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&L.ref===void 0||(q[fe]=L[fe]);var fe=arguments.length-2;if(fe===1)q.children=K;else if(1<fe){for(var Ae=Array(fe),ie=0;ie<fe;ie++)Ae[ie]=arguments[ie+2];q.children=Ae}return _(B.type,ne,q)},ve.createContext=function(B){return B={$$typeof:a,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:s,_context:B},B},ve.createElement=function(B,L,K){var q,ne={},fe=null;if(L!=null)for(q in L.key!==void 0&&(fe=""+L.key),L)C.call(L,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(ne[q]=L[q]);var Ae=arguments.length-2;if(Ae===1)ne.children=K;else if(1<Ae){for(var ie=Array(Ae),ye=0;ye<Ae;ye++)ie[ye]=arguments[ye+2];ne.children=ie}if(B&&B.defaultProps)for(q in Ae=B.defaultProps,Ae)ne[q]===void 0&&(ne[q]=Ae[q]);return _(B,fe,ne)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(B){return{$$typeof:o,render:B}},ve.isValidElement=P,ve.lazy=function(B){return{$$typeof:l,_payload:{_status:-1,_result:B},_init:G}},ve.memo=function(B,L){return{$$typeof:u,type:B,compare:L===void 0?null:L}},ve.startTransition=function(B){var L=T.T,K={};T.T=K;try{var q=B(),ne=T.S;ne!==null&&ne(K,q),typeof q=="object"&&q!==null&&typeof q.then=="function"&&q.then(k,V)}catch(fe){V(fe)}finally{L!==null&&K.types!==null&&(L.types=K.types),T.T=L}},ve.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},ve.use=function(B){return T.H.use(B)},ve.useActionState=function(B,L,K){return T.H.useActionState(B,L,K)},ve.useCallback=function(B,L){return T.H.useCallback(B,L)},ve.useContext=function(B){return T.H.useContext(B)},ve.useDebugValue=function(){},ve.useDeferredValue=function(B,L){return T.H.useDeferredValue(B,L)},ve.useEffect=function(B,L){return T.H.useEffect(B,L)}
9,ve.useEffectEvent=function(B){return T.H.useEffectEvent(B)},ve.useId=function(){return T.H.useId()},ve.useImperativeHandle=function(B,L,K){return T.H.useImperativeHandle(B,L,K)},ve.useInsertionEffect=function(B,L){return T.H.useInsertionEffect(B,L)},ve.useLayoutEffect=function(B,L){return T.H.useLayoutEffect(B,L)},ve.useMemo=function(B,L){return T.H.useMemo(B,L)},ve.useOptimistic=function(B,L){return T.H.useOptimistic(B,L)},ve.useReducer=function(B,L,K){return T.H.useReducer(B,L,K)},ve.useRef=function(B){return T.H.useRef(B)},ve.useState=function(B){return T.H.useState(B)},ve.useSyncExternalStore=function(B,L,K){return T.H.useSyncExternalStore(B,L,K)},ve.useTransition=function(){return T.H.useTransition()},ve.version="19.2.4",ve}var VA;function Vv(){return VA||(VA=1,gf.exports=Wv()),gf.exports}var zt=Vv();const Gv=t=>`lmwr_client_id_${new URL(t).host.replace(/[^a-zA-Z0-9]/g,"")}`,qv=t=>{const n=document.cookie.split(";").reduce((r,i)=>{const[s,a]=i.trim().split("=").map(decodeURIComponent);return Object.assign(r,{[s]:a})},{})[Gv(t)];if(n)return n},Yv={enabled:!0,attachStacktrace:!1,tracesSampleRate:0,sampleRate:.1,sendDefaultPii:!0}
9,Kv=[{upToSeconds:10,label:"under_10s"},{upToSeconds:60,label:"under_1m"},{upToSeconds:600,label:"under_10m"},{upToSeconds:3600,label:"under_1h"}],jv=t=>t.startsWith("provided userIds")?"user":t.startsWith("provided clientIds")?"device":"unknown",$v=(t,e)=>e?e===t?"matches_page":"differs_from_page":"missing",Xv=t=>{var e;return((e=Kv.find(({upToSeconds:n})=>t<n))==null?void 0:e.label)??"over_1h"},Jv=(t,e,n,r,i)=>({mismatch_side:jv(t.serverMessage),client_id_cookie:$v(e,n),page_age:Xv(r),tab_visibility:i}),Zv=/https?:\/\/.*limewire\.com/,e1=(t,e)=>{const{dsnUrl:n,environment:r,release:i,replayId:s,apiBaseUrl:a}=e,{init:o,captureConsoleIntegration:c,replayIntegration:u,setTag:l}=t;o({...Yv,dsn:n,environment:r,integrations:[c({levels:s?["log","info","warn","error","debug","assert"]:["error"]}),...s?[u({maskAllText:!1,blockAllMedia:!1,networkDetailAllowUrls:["limewire"],beforeAddRecordingEvent:d=>{let f="";try{f=d.data.payload.op}catch{}return f.startsWith("resource")?f==="resource.fetch"||f==="resource.xhr"?d:null:d}})]:[]],release:i,allowUrls:[Zv],replaysSessionSampleRate:s?1:0,replaysOnErrorSampleRate:s?1:0,ignoreErrors:["Load failed","Failed to fetch","ResizeObserver loop completed with undelivered notifications","Expected fetch controller:","play() failed because the user didn't interact with the document first","The request failed and the interceptors did not return an alternative response","React PDF Kit is unable to render on this browser.","Paper Shaders: WebGL is not supported in this browser"],beforeSend(d,f){var h,m;try{const{originalException:p}=f;if(p instanceof zv)return null;if(p instanceof Hv){const g=(m=(h=d.contexts)==null?void 0:h.page)==null?void 0:m.clientId;d.tags={...d.tags,...Jv(p,typeof g=="string"?g:void 0,a&&qv(a),performance.now()/1e3,document.visibilityState)}}if((p instanceof DOMException||p instanceof TypeError)&&(p.name==="AbortError"||p.message.startsWith("AbortError")))return null}catch{}return d}}),s&&setTimeout(()=>{l("Replay Session ID",s),console.log(`Sentry Replay Session ID: ${s}.`)},1e3)};(t=>{const e=async n=>{const{data:r}=n;switch(r.type){case"sentryWorkerInit":{try{r.clientParams&&e1(await Promise.resolve().then(function(){return U8}),r.clientParams)}catch(i){console.error("Sentry Worker Error",i)}await(t==null?void 0:t()),self.postMessage({type:"sentryWorkerInit",id:r.id}),self.removeEventListener("message",e);break}}};self.addEventListener("message",e)})(async()=>{await Promise.resolve().then(function(){return yW})});const ae=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Te=globalThis,kr="9.47.1";function Ir(){return Ao(Te),Te}function Ao(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||kr,e[kr]=e[kr]||{}}function yo(t,e,n=Te){const r=n.__SENTRY__=n.__SENTRY__||{},i=r[kr]=r[kr]||{};return i[t]||(i[t]=e())}const Af=["debug","info","warn","error","log","assert","trace"],t1="Sentry Logger ",tu={};function fi(t){if(!("console"in Te))return t();const e=Te.console,n={},r=Object.keys(tu);r.forEach(i=>{const s=tu[i];n[i]=e[i],e[i]=s});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}function n1(){wf().enabled=!0}function r1(){wf().enabled=!1}function GA(){return wf().enabled}function i1(...t){yf("log",...t)}function s1(...t){yf("warn",...t)}function a1(...t){yf("error",...t)}function yf(t,...e){ae&&GA()&&fi(()=>{Te.console[t](`${t1}[${t}]:`,...e)})}function wf(){return ae?yo("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const W={enable:n1,disable:r1,isEnabled:GA,log:i1,warn:s1,error:a1},qA=50,fr="?",YA=/\(error: (.*)\)/,KA=/captureMessage|captureException/;function jA(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const s=[],a=n.split(`
10`);for(let o=r;o<a.length;o++){const c=a[o];if(c.length>1024)continue;const u=YA.test(c)?c.replace(YA,"$1"):c;if(!u.match(/\S*Error: /)){for(const l of e){const d=l(u);if(d){s.push(d);break}}if(s.length>=qA+i)break}}return c1(s.slice(i))}}function o1(t){return Array.isArray(t)?jA(...t):t}function c1(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(nu(e).function||"")&&e.pop(),e.reverse(),KA.test(nu(e).function||"")&&(e.pop(),KA.test(nu(e).function||"")&&e.pop()),e.slice(0,qA).map(n=>({...n,filename:n.filename||nu(e).filename,function:n.function||fr}))}function nu(t){return t[t.length-1]||{}}const bf="<anonymous>";function Cr(t){try{return!t||typeof t!="function"?bf:t.name||bf}catch{return bf}}function Ef(t){const e=t.exception;if(e){const n=[];
vendor: 14,569 bytes, lines 10-13
10try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const ru={},$A={};function hi(t,e){ru[t]=ru[t]||[],ru[t].push(e)}function pi(t,e){if(!$A[t]){$A[t]=!0;try{e()}catch(n){ae&&W.error(`Error while instrumenting ${t}`,n)}}}function On(t,e){const n=t&&ru[t];if(n)for(const r of n)try{r(e)}catch(i){ae&&W.error(`Error while triggering instrumentation handler.
11Type: ${t}
12Name: ${Cr(r)}
13Error:`,i)}}let Sf=null;function XA(t){const e="error";hi(e,t),pi(e,u1)}function u1(){Sf=Te.onerror,Te.onerror=function(t,e,n,r,i){return On("error",{column:r,error:i,line:n,msg:t,url:e}),Sf?Sf.apply(this,arguments):!1},Te.onerror.__SENTRY_INSTRUMENTED__=!0}let _f=null;function JA(t){const e="unhandledrejection";hi(e,t),pi(e,l1)}function l1(){_f=Te.onunhandledrejection,Te.onunhandledrejection=function(t){return On("unhandledrejection",t),_f?_f.apply(this,arguments):!0},Te.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const ZA=Object.prototype.toString;function xr(t){switch(ZA.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Br(t,Error)}}function Vs(t,e){return ZA.call(t)===`[object ${e}]`}function ey(t){return Vs(t,"ErrorEvent")}function ty(t){return Vs(t,"DOMError")}function d1(t){return Vs(t,"DOMException")}function $n(t){return Vs(t,"String")}function iu(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Gs(t){return t===null||iu(t)||typeof t!="object"&&typeof t!="function"}function vr(t){return Vs(t,"Object")}function su(t){return typeof Event<"u"&&Br(t,Event)}function f1(t){return typeof Element<"u"&&Br(t,Element)}function h1(t){return Vs(t,"RegExp")}function wo(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function p1(t){return vr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Br(t,e){try{return t instanceof e}catch{return!1}}function ny(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function ry(t){return typeof Request<"u"&&Br(t,Request)}const Tf=Te,m1=80;function Nn(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let s=0,a=0;const o=" > ",c=o.length;let u;const l=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||m1;for(;n&&s++<r&&(u=g1(n,l),!(u==="html"||s>1&&a+i.length*c+u.length>=d));)i.push(u),a+=u.length,n=n.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function g1(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(Tf.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e!=null&&e.length?e.filter(a=>n.getAttribute(a)).map(a=>[a,n.getAttribute(a)]):null;if(i!=null&&i.length)i.forEach(a=>{r.push(`[${a[0]}="${a[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const a=n.className;if(a&&$n(a)){const o=a.split(/\s+/);for(const c of o)r.push(`.${c}`)}}const s=["aria-label","type","name","title","alt"];for(const a of s){const o=n.getAttribute(a);o&&r.push(`[${a}="${o}"]`)}return r.join("")}function $i(){try{return Tf.document.location.href}catch{return""}}function iy(t){if(!Tf.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function qs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function kf(t,e){let n=t;const r=n.length;if(r<=150)return n;e>r&&(e=r);let i=Math.max(e-60,0);i<5&&(i=0);let s=Math.min(i+140,r);return s>r-5&&(s=r),s===r&&(i=Math.max(s-140,0)),n=n.slice(i,s),i>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function au(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{ny(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function A1(t,e,n=!1){return $n(t)?h1(e)?e.test(t):$n(e)?n?t===e:t.includes(e):!1:!1}function Xn(t,e=[],n=!1){return e.some(r=>A1(t,r,n))}function on(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const i=n(r);typeof i=="function"&&sy(i,r);try{t[e]=i}catch{ae&&W.log(`Failed to replace method "${e}" in object`,t)}}function cn(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{ae&&W.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function sy(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,cn(t,"__sentry_original__",e)}catch{}}function If(t){return t.__sentry_original__}function ay(t){if(xr(t))return{message:t.message,name:t.name,stack:t.stack,...cy(t)};if(su(t)){const e={type:t.type,target:oy(t.target),currentTarget:oy(t.currentTarget),...cy(t)};return typeof CustomEvent<"u"&&Br(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function oy(t){try{return f1(t)?Nn(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function cy(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function y1(t,e=40){const n=Object.keys(ay(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return qs(r,e);for(let i=n.length;i>0;i--){const s=n.slice(0,i).join(", ");if(!(s.length>e))return i===n.length?s:qs(s,e)}return""}function w1(){const t=Te;return t.crypto||t.msCrypto}function un(t=w1()){let e=()=>Math.random()*16;try{if(t!=null&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t!=null&&t.getRandomValues&&(e=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(e()&15)>>n/4).toString(16))}function uy(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function Xi(t){const{message:e,event_id:n}=t;if(e)return e;const r=uy(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Cf(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function mi(t,e){const n=uy(t);if(!n)return;const r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...e},e&&"data"in e){const s={...i==null?void 0:i.data,...e.data};n.mechanism.data=s}}function b1(t,e,n=5){if(e.lineno===void 0)return;const r=t.length,i=Math.max(Math.min(r-1,e.lineno-1),0);e.pre_context=t.slice(Math.max(0,i-n),i).map(a=>kf(a,0));const s=Math.min(r-1,i);e.context_line=kf(t[s],e.colno||0),e.post_context=t.slice(Math.min(i+1,r),i+1+n).map(a=>kf(a,0))}function ly(t){if(E1(t))return!0;try{cn(t,"__sentry_captured__",!0)}catch{}return!1}function E1(t){try{return t.__sentry_captured__}catch{}}const dy=1e3;function Ji(){return Date.now()/dy}function S1(){const{performance:t}=Te;if(!(t!=null&&t.now)||!t.timeOrigin)return Ji;const e=t.timeOrigin;return()=>(e+t.now())/dy}let fy;function mt(){return(fy??(fy=S1()))()}let xf;function _1(){var l;const{performance:t}=Te;if(!(t!=null&&t.now))return[void 0,"none"];const e=3600*1e3,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=i<e,a=(l=t.timing)==null?void 0:l.navigationStart,c=typeof a=="number"?Math.abs(a+n-r):e,u=c<e;return s||u?i<=c?[t.timeOrigin,"timeOrigin"]:[a,"navigationStart"]:[r,"dateNow"]}function nn(){return xf||(xf=_1()),xf[0]}function T1(t){const e=mt(),n={sid:un(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>I1(n)};return t&&Ys(n,t),n}function Ys(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||mt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:un()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function k1(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Ys(t,n)}function I1(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function bo(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=bo(r[i],e[i],n-1));return r}function Pr(){return un()}function Eo(){return un().substring(16)}const vf="_sentrySpan";function Zi(t,e){e?cn(t,vf,e):delete t[vf]}function So(t){return t[vf]}const C1=100;class Jn{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Pr(),sampleRand:Math.random()}}clone(){const e=new Jn;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},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,Zi(e,So(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&&Ys(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},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,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,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 n=typeof e=="function"?e(this):e,r=n instanceof Jn?n.getScopeData():vr(n)?e:void 0,{tags:i,extra:s,user:a,contexts:o,level:c,fingerprint:u=[],propagationContext:l}=r||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...o},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),u.length&&(this._fingerprint=u),l&&(this._propagationContext=l),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,Zi(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Pr(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var s;const r=typeof n=="number"?n:C1;if(r<=0)return this;const i={timestamp:Ji(),...e,message:e.message?qs(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(s=this._client)==null||s.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,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:So(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=bo(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||un();if(!this._client)return ae&&W.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,...n,event_id:r},this),r}captureMessage(e,n,r){const i=(r==null?void 0:r.event_id)||un();if(!this._client)return ae&&W.warn("No client configured on scope - will not capture message!"),i;const s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:i},this),i}captureEvent(e,n){const r=(n==null?void 0:n.event_id)||un();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(ae&&W.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEac
13h(e=>{e(this)}),this._notifyingListeners=!1)}}function x1(){return yo("defaultCurrentScope",()=>new Jn)}function v1(){return yo("defaultIsolationScope",()=>new Jn)}class B1{constructor(e,n){let r;e?r=e:r=new Jn;let i;n?i=n:i=new Jn,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return wo(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(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 Ks(){const t=Ir(),e=Ao(t);return e.stack=e.stack||new B1(x1(),v1())}function P1(t){return Ks().withScope(t)}function R1(t,e){const n=Ks();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function hy(t){return Ks().withScope(()=>t(Ks().getIsolationScope()))}function F1(){return{withIsolationScope:hy,withScope:P1,withSetScope:R1,withSetIsolationScope:(t,e)=>hy(e),getCurrentScope:()=>Ks().getScope(),getIsolationScope:()=>Ks().getIsolationScope()}}function gi(t){const e=Ao(t);return e.acs?e.acs:F1()}function Be(){const t=Ir();return gi(t).getCurrentScope()}function Qt(){const t=Ir();return gi(t).getIsolationScope()}function _o(){return yo("globalScope",()=>new Jn)}function An(...t){const e=Ir(),n=gi(e);if(t.length===2){const[r,i]=t;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(t[0])}function M1(...t){const e=Ir(),n=gi(e);if(t.length===2){const[r,i]=t;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(t[0])}function le(){return Be().getClient()}function py(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,s={trace_id:n,span_id:i||Eo()};return r&&(s.parent_span_id=r),s}const et="sentry.source",ou="sentry.sample_rate",my="sentry.previous_trace_sample_rate",Pt="sentry.op",Ne="sentry.origin",cu="sentry.idle_span_finish_reason",To="sentry.measurement_unit",ko="sentry.measurement_value",Bf="sentry.custom_span_name",Pf="sentry.profile_id",js="sentry.exclusive_time",D1="http.request.method",O1="url.full",N1="sentry.link.type",U1=0,Rf=1,Tt=2;function gy(t){if(t<400&&t>=100)return{code:Rf};if(t>=400&&t<500)switch(t){case 401:return{code:Tt,message:"unauthenticated"};case 403:return{code:Tt,message:"permission_denied"};case 404:return{code:Tt,message:"not_found"};case 409:return{code:Tt,message:"already_exists"};case 413:return{code:Tt,message:"failed_precondition"};case 429:return{code:Tt,message:"resource_exhausted"};case 499:return{code:Tt,message:"cancelled"};default:return{code:Tt,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:Tt,message:"unimplemented"};case 503:return{code:Tt,message:"unavailable"};case 504:return{code:Tt,message:"deadline_exceeded"};default:return{code:Tt,message:"internal_error"}}return{code:Tt,message:"unknown_error"}}function Io(t,e){t.setAttribute("http.response.status_code",e);const n=gy(e);n.message!=="unknown_error"&&t.setStatus(n)}const Ay="_sentryScope",yy="_sentryIsolationScope";function L1(t,e,n){t&&(cn(t,yy,n),cn(t,Ay,e))}function uu(t){return{scope:t[Ay],isolationScope:t[yy]}}const Ff="sentry-",z1=/^sentry-/,Q1=8192;function wy(t){const e=H1(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,s])=>{if(i.match(z1)){const a=i.slice(Ff.length);r[a]=s}return r},{});if(Object.keys(n).length>0)return n}function by(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,i])=>(i&&(n[`${Ff}${r}`]=i),n),{});return W1(e)}function H1(t){if(!(!t||!$n(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=Ey(n);return Object.entries(r).forEach(([i,s])=>{e[i]=s}),e},{}):Ey(t)}function Ey(t){return t.split(",").map(e=>e.split("=").map(n=>{try{return decodeURIComponent(n.trim())}catch{return}})).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function W1(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],i)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,a=i===0?s:`${e},${s}`;return a.length>Q1?(ae&&W.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):a},"")}function es(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const Sy=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function V1(t){if(!t)return;const e=t.match(Sy);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function _y(t,e){const n=V1(t),r=wy(e);if(!(n!=null&&n.traceId))return{traceId:Pr(),sampleRand:Math.random()};const i=G1(n,r);r&&(r.sample_rand=i.toString());const{traceId:s,parentSpanId:a,parentSampled:o}=n;return{traceId:s,parentSpanId:a,sampled:o,dsc:r||{},sampleRand:i}}function Ty(t=Pr(),e=Eo(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function G1(t,e){const n=es(e==null?void 0:e.sample_rand);if(n!==void 0)return n;const r=es(e==null?void 0:e.sample_rate);return r&&(t==null?void 0:t.parentSampled)!==void 0?t.parentSampled?Math.random()*r:r+Math.random()*(1-r):Math.random()}const ky=0,Mf=1;let Iy=!1;function q1(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:i,parent_span_id:s,status:a,origin:o,links:c}=ke(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:i,status:a,origin:o,links:c}}function Cy(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:ke(t).parent_span_id,s=uu(t).scope,a=r?(s==null?void 0:s.getPropagationContext().propagationSpanId)||Eo():e;return{parent_span_id:i,span_id:a,trace_id:n}}function xy(t){const{traceId:e,spanId:n}=t.spanContext(),r=ns(t);return Ty(e,n,r)}function vy(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...i},attributes:s})=>({span_id:e,trace_id:n,sampled:r===Mf,attributes:s,...i}))}function ts(t){return typeof t=="number"?By(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?By(t.getTime()):mt()}function By(t){return t>9999999999?t/1e3:t}function ke(t){var r;if(K1(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(Y1(t)){const{attributes:i,startTime:s,name:a,endTime:o,status:c,links:u}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(r=t.parentSpanContext)==null?void 0:r.spanId:void 0;return{span_id:e,trace_id:n,data:i,description:a,parent_span_id:l,start_timestamp:ts(s),timestamp:ts(o)||void 0,status:Py(c),op:i[Pt],origin:i[Ne],links:vy(u)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Y1(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function K1(t){return typeof t.getSpanJSON=="function"}function ns(t){const{traceFlags:e}=t.spanContext();return e===Mf}function Py(t){if(!(!t||t.code===U1))return t.code===Rf?"ok":t.message||"unknown_error"}const rs="_sentryChildSpans",Df="_sentryRootSpan";function Ry(t,e){const n=t[Df]||t;cn(e,Df,n),t[rs]?t[rs].add(e):cn(t,rs,new Set([e]))}function j1(t,e){t[rs]&&t[rs].delete(e)}function Co(t){const e=new Set;function n(r){if(!e.has(r)&&ns(r)){e.add(r);const i=r[rs]?Array.from(r[rs]):[];for(const s of i)n(s)}}return n(t),Array.from(e)}function kt(t){return t[Df]||t}function gt(){const t=Ir(),e=gi(t);return e.getActiveSpan?e.getActiveSpan():So(Be())}function Of(){Iy||(fi(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Iy=!0)}function $1(t,e){t.updateName(e),t.setAttributes({[et]:"custom",[Bf]:e})}let Fy=!1;function My(){if(Fy)return;function t(){const e=gt(),n=e&&kt(e);
vendor: 3,458 bytes, line 13
13if(n){const r="internal_error";ae&&W.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:Tt,message:r})}}t.tag="sentry_tracingErrorCallback",Fy=!0,XA(t),JA(t)}function Ai(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=t||((n=le())==null?void 0:n.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const lu="production",X1=/^o(\d+)\./,J1=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Z1(t){return t==="http"||t==="https"}function is(t,e=!1){const{host:n,path:r,pass:i,port:s,projectId:a,protocol:o,publicKey:c}=t;return`${o}://${c}${e&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${a}`}function Dy(t){const e=J1.exec(t);if(!e){fi(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,i="",s="",a="",o=""]=e.slice(1);let c="",u=o;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const d=u.match(/^\d+/);d&&(u=d[0])}return Oy({host:s,pass:i,path:c,projectId:u,port:a,protocol:n,publicKey:r})}function Oy(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function eB(t){if(!ae)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(a=>t[a]?!1:(W.error(`Invalid Sentry Dsn: ${a} missing`),!0))?!1:n.match(/^\d+$/)?Z1(r)?e&&isNaN(parseInt(e,10))?(W.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(W.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(W.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function tB(t){const e=t.match(X1);return e==null?void 0:e[1]}function Ny(t){const e=typeof t=="string"?Dy(t):Oy(t);if(!(!e||!eB(e)))return e}const Uy="_frozenDsc";function du(t,e){cn(t,Uy,e)}function Ly(t,e){const n=e.getOptions(),{publicKey:r,host:i}=e.getDsn()||{};let s;n.orgId?s=String(n.orgId):i&&(s=tB(i));const a={environment:n.environment||lu,release:n.release,public_key:r,trace_id:t,org_id:s};return e.emit("createDsc",a),a}function Nf(t,e){const n=e.getPropagationContext();return n.dsc||Ly(n.traceId,t)}function Zn(t){var m;const e=le();if(!e)return{};const n=kt(t),r=ke(n),i=r.data,s=n.spanContext().traceState,a=(s==null?void 0:s.get("sentry.sample_rate"))??i[ou]??i[my];function o(p){return(typeof a=="number"||typeof a=="string")&&(p.sample_rate=`${a}`),p}const c=n[Uy];if(c)return o(c);const u=s==null?void 0:s.get("sentry.dsc"),l=u&&wy(u);if(l)return o(l);const d=Ly(t.spanContext().traceId,e),f=i[et],h=r.description;return f!=="url"&&h&&(d.transaction=h),Ai()&&(d.sampled=String(ns(n)),d.sample_rand=(s==null?void 0:s.get("sentry.sample_rand"))??((m=uu(n).scope)==null?void 0:m.getPropagationContext().sampleRand.toString())),o(d),e.emit("createDsc",d,n),d}function nB(t){const e=Zn(t);return by(e)}class Rr{constructor(e={}){this._traceId=e.traceId||Pr(),this._spanId=e.spanId||Eo()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:ky}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}function _n(t,e=100,n=1/0){try{return Uf("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function zy(t,e=3,n=100*1024){const r=_n(t,e);return aB(r)>n?zy(t,e-1,n):r}function Uf(t,e,n=1/0,r=1/0,i=oB()){const[s,a]=i;
13if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const o=rB(t,e);if(!o.startsWith("[object "))return o;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return o.replace("object ","");if(s(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const h=u.toJSON();return Uf("",h,c-1,r,i)}catch{}const l=Array.isArray(e)?[]:{};let d=0;const f=ay(e);for(const h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(d>=r){l[h]="[MaxProperties ~]";break}const m=f[h];l[h]=Uf(h,m,c-1,r,i),d++}return a(e),l}function rB(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(ny(e))return"[VueViewModel]";if(p1(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Cr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=iB(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function iB(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function sB(t){return~-encodeURI(t).split(/%..|./).length}function aB(t){return sB(JSON.stringify(t))}function oB(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function Fr(t,e=[]){return[t,e]}function cB(t,e){const[n,r]=t;return[n,[...r,e]]}function ss(t,e){const n=t[1];for(const r of n){const i=r[0].type;if(e(r,i))return!0}return!1}function Qy(t,e){return ss(t,(n,r)=>e.includes(r))}function fu(t){const e=Ao(Te);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function uB(t){const e=Ao(Te);return e.decodePolyfill?e.decodePolyfill(t):new TextDecoder().decode(t)}function hu(t){const[e,n]=t;let r=JSON.stringify(e);function i(s){typeof r=="string"?r=typeof s=="string"?r+s:[fu(r),s]:r.push(typeof s=="string"?fu(s):s)}for(const s of n){const[a,o]=s;if(i(`
14${JSON.stringify(a)}
15`),typeof o=="string"||o instanceof Uint8Array)i(o);else{let c;try{c=JSON.stringify(o)}catch{c=JSON.stringify(_n(o))}i(c)}}return typeof r=="string"?r:lB(r)}function lB(t){const e=t.reduce((i,s)=>i+s.length,0),n=new Uint8Array(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}function dB(t){let e=typeof t=="string"?fu(t):t;function n(a){const o=e.subarray(0,a);return e=e.subarray(a+1),o}function r(){let a=e.indexOf(10);return a<0&&(a=e.length),JSON.parse(uB(n(a)))}const i=r(),s=[];for(;e.length;){const a=r(),o=typeof a.length=="number"?a.length:void 0;s.push([a,o?n(o):r()])}return[i,s]}function fB(t){return[{type:"span"},t]}function hB(t){const e=typeof t.data=="string"?fu(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const pB={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Hy(t){return pB[t]}function Lf(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Wy(t,e,n,r){var s;const i=(s=t.sdkProcessingMetadata)==null?void 0:s.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:is(r)},...i&&{trace:i}}}function mB(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function gB(t,e,n,r){const i=Lf(n),s={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:is(e)}},a="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Fr(s,[a])}function AB(t,e,n,r){const i=Lf(n),s=t.type&&t.type!=="replay_event"?t.type:"event";mB(t,n==null?void 0:n.sdk);const a=Wy(t,i,r,e);return delete t.sdkProcessingMetadata,Fr(a,[[{type:s},t]])}function yB(t,e){function n(l){return!!l.trace_id&&!!l.public_key}const r=Zn(t[0]),i=e==null?void 0:e.getDsn(),s=e==null?void 0:e.getOptions().tunnel,a={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&i&&{dsn:is(i)}},o=e==null?void 0:e.getOptions().beforeSendSpan,c=o?l=>{const d=ke(l),f=o(d);return f||(Of(),d)}:ke,u=[];for(const l of t){const d=c(l);d&&u.push(fB(d))}return Fr(a,u)}function wB(t){if(!ae)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=ke(t),{spanId:i}=t.spanContext(),s=ns(t),a=kt(t),o=a===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${o?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${i}`];
15if(r&&u.push(`parent ID: ${r}`),!o){const{op:l,description:d}=ke(a);u.push(`root ID: ${a.spanContext().spanId}`),l&&u.push(`root op: ${l}`),d&&u.push(`root description: ${d}`)}W.log(`${c}
16  ${u.join(`
17  `)}`)}function bB(t){if(!ae)return;const{description:e="< unknown name >",op:n="< unknown op >"}=ke(t),{spanId:r}=t.spanContext(),s=kt(t)===t,a=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;W.log(a)}function Vy(t,e,n,r=gt()){const i=r&&kt(r);i&&(ae&&W.log(`[Measurement] Setting measurement on root span: ${t} = ${e} ${n}`),i.addEvent(t,{[ko]:e,[To]:n}))}function Gy(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const r=n.attributes||{},i=r[To],s=r[ko];typeof i=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:i})}),e}const qy=1e3;class pu{constructor(e={}){this._traceId=e.traceId||Pr(),this._spanId=e.spanId||Eo(),this._startTime=e.startTimestamp||mt(),this._links=e.links,this._attributes={},this.setAttributes({[Ne]:"manual",[Pt]: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._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?Mf:ky}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=ts(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(et,"custom"),this}end(e){this._endTime||(this._endTime=ts(e),bB(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[Pt],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Py(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Ne],profile_id:this._attributes[Pf],exclusive_time:this._attributes[js],measurements:Gy(this._events),is_segment:this._isStandaloneSpan&&kt(this)===this||void 0,segment_id:this._isStandaloneSpan?kt(this).spanContext().spanId:void 0,links:vy(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){ae&&W.log("[Tracing] Adding an event to span:",e);const i=Yy(n)?n:r||mt(),s=Yy(n)?{}:n||{},a={name:e,time:ts(i),attributes:s};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=le();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===kt(this)))return;if(this._isStandaloneSpan){this._sampled?SB(yB([this],e)):(ae&&W.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}const r=this._convertSpanToTransaction();r&&(uu(this).scope||Be()).captureEvent(r)}_convertSpanToTransaction(){var l;if(!Ky(ke(this)))return;this._name||(ae&&W.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=uu(this),r=(l=e==null?void 0:e.getScopeData().sdkProcessingMetadata)==null?void 0:l.normalizedRequest;if(this._sampled!==!0)return;const s=Co(this).filter(d=>d!==this&&!EB(d)).map(d=>ke(d)).filter(Ky),a=this._attributes[et];delete this._attributes[Bf],s.forEach(d=>{delete d.data[Bf]});const o={contexts:{trace:q1(this)},spans:s.length>qy?s.sort((d,f)=>d.start_timestamp-f.start_timestamp).slice(0,qy):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Zn(this)},request:r,...a&&{transaction_info:{source:a}}},c=Gy(this._events);return c&&Object.keys(c).length&&(ae&&W.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),o.measurements=c),o}}function Yy(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function Ky(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function EB(t){return t instanceof pu&&t.isStandaloneSpan()}function SB(t){const e=le();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function jy(t,e,n=()=>{}){let r;try{r=t()}catch(i){throw e(i),n(),i}return _B(r,e,n)}function _B(t,e,n){return wo(t)?t.then(r=>(n(),r),r=>{throw e(r),n(),r}):(n(),t)}function TB(t,e,n){if(!Ai(t))return[!1];let r,i;typeof t.tracesSampler=="function"?(i=t.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 t.tracesSampleRate<"u"&&(i=t.tracesSampleRate,r=!0);const s=es(i);if(s===void 0)return ae&&W.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 ae&&W.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];const a=n<s;return a||ae&&W.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[a,s,r]}const mu="__SENTRY_SUPPRESS_TRACING__";function gu(t,e){const n=xo();if(n.startSpan)return n.startSpan(t,e);const r=Qf(t),{forceTransaction:i,parentSpan:s,scope:a}=t,o=a==null?void 0:a.clone();return An(o,()=>Xy(s)(()=>{const u=Be(),l=Hf(u,s),f=t.onlyIfParent&&!l?new Rr:zf({parentSpan:l,spanArguments:r,forceTransaction:i,scope:u});return Zi(u,f),jy(()=>e(f),()=>{const{status:h}=ke(f);f.isRecording()&&(!h||h==="ok")&&f.setStatus({code:Tt,message:"internal_error"})},()=>{f.end()})}))}function kB(t,e){const n=xo();if(n.startSpanManual)return n.startSpanManual(t,e);const r=Qf(t),{forceTransaction:i,parentSpan:s,scope:a}=t,o=a==null?void 0:a.clone();return An(o,()=>Xy(s)(()=>{const u=Be(),l=Hf(u,s),f=t.onlyIfParent&&!l?new Rr:zf({parentSpan:l,spanArguments:r,forceTransaction:i,scope:u});return Zi(u,f),jy(()=>e(f,()=>f.end()),()=>{const{status:h}=ke(f);f.isRecording()&&(!h||h==="ok")&&f.setStatus({code:Tt,message:"internal_error"})})}))}function Un(t){const e=xo();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=Qf(t),{forceTransaction:r,parentSpan:i}=t;return(t.scope?a=>An(t.scope,a):i!==void 0?a=>as(i,a):a=>a())(()=>{const a=Be(),o=Hf(a,i);return t.onlyIfParent&&!o?new Rr:zf({parentSpan:o,spanArguments:n,forceTransaction:r,scope:a})})}const IB=(t,e)=>{const n=Ir(),r=gi(n);if(r.continueTrace)return r.continueTrace(t,e);const{sentryTrace:i,baggage:s}=t;return An(a=>{const o=_y(i,s);return a.setPropagationContext(o),e()})};function as(t,e){const n=xo();return n.withActiveSpan?n.withActiveSpan(t,e):An(r=>(Zi(r,t||void 0),e(r)))}function CB(t){const e=xo();return e.suppressTracing?e.suppressTracing(t):An(n=>
17{n.setSDKProcessingMetadata({[mu]:!0});const r=t();return n.setSDKProcessingMetadata({[mu]:void 0}),r})}function xB(t){return An(e=>(e.setPropagationContext({traceId:Pr(),sampleRand:Math.random()}),ae&&W.log(`Starting a new trace with id ${e.getPropagationContext().traceId}`),as(null,t)))}function zf({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Ai()){const a=new Rr;if(n||!t){const o={sampled:"false",sample_rate:"0",transaction:e.name,...Zn(a)};du(a,o)}return a}const i=Qt();let s;if(t&&!n)s=vB(t,r,e),Ry(t,s);else if(t){const a=Zn(t),{traceId:o,spanId:c}=t.spanContext(),u=ns(t);s=$y({traceId:o,parentSpanId:c,...e},r,u),du(s,a)}else{const{traceId:a,dsc:o,parentSpanId:c,sampled:u}={...i.getPropagationContext(),...r.getPropagationContext()};s=$y({traceId:a,parentSpanId:c,...e},r,u),o&&du(s,o)}return wB(s),L1(s,r,i),s}function Qf(t){const n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){const r={...n};return r.startTimestamp=ts(t.startTime),delete r.startTime,r}return n}function xo(){const t=Ir();return gi(t)}function $y(t,e,n){var m;const r=le(),i=(r==null?void 0:r.getOptions())||{},{name:s=""}=t,a={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r==null||r.emit("beforeSampling",a,{decision:!1});const o=a.parentSampled??n,c=a.spanAttributes,u=e.getPropagationContext(),[l,d,f]=e.getScopeData().sdkProcessingMetadata[mu]?[!1]:TB(i,{name:s,parentSampled:o,attributes:c,parentSampleRate:es((m=u.dsc)==null?void 0:m.sample_rate)},u.sampleRand),h=new pu({...t,attributes:{[et]:"custom",[ou]:d!==void 0&&f?d:void 0,...c},sampled:l});return!l&&r&&(ae&&W.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",h),h}function vB(t,e,n){const{spanId:r,traceId:i}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[mu]?!1:ns(t),a=s?new pu({...n,parentSpanId:r,traceId:i,sampled:s}):new Rr({traceId:i});Ry(t,a);const o=le();return o&&(o.emit("spanStart",a),n.endTimestamp&&o.emit("spanEnd",a)),a}function Hf(t,e){if(e)return e;if(e===null)return;const n=So(t);if(!n)return;const r=le();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?kt(n):n}function Xy(t){return t!==void 0?e=>as(t,e):e=>e()}const Au={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},BB="heartbeatFailed",PB="idleTimeout",RB="finalTimeout",FB="externalFinish";function Jy(t,e={}){const n=new Map;let r=!1,i,s=FB,a=!e.disableAutoFinish;const o=[],{idleTimeout:c=Au.idleTimeout,finalTimeout:u=Au.finalTimeout,childSpanTimeout:l=Au.childSpanTimeout,beforeSpanEnd:d}=e,f=le();if(!f||!Ai()){const k=new Rr,T={sample_rate:"0",sampled:"false",...Zn(k)};return du(k,T),k}const h=Be(),m=gt(),p=MB(t);p.end=new Proxy(p.end,{apply(k,T,C){if(d&&d(p),T instanceof Rr)return;const[_,...x]=C,P=_||mt(),v=ts(P),M=Co(p).filter(G=>G!==p);if(!M.length)return S(v),Reflect.apply(k,T,[v,...x]);const D=M.map(G=>ke(G).timestamp).filter(G=>!!G),O=D.length?Math.max(...D):void 0,N=ke(p).start_timestamp,Q=Math.min(N?N+u/1e3:1/0,Math.max(N||-1/0,Math.min(v,O||1/0)));return S(Q),Reflect.apply(k,T,[Q,...x])}});function g(){i&&(clearTimeout(i),i=void 0)}function A(k){g(),i=setTimeout(()=>{!r&&n.size===0&&a&&(s=PB,p.end(k))},c)}function y(k){i=setTimeout(()=>{!r&&a&&(s=BB,p.end(k))},l)}function w(k){g(),n.set(k,!0);const T=mt();y(T+l/1e3)}function E(k){if(n.has(k)&&n.delete(k),n.size===0){const T=mt();A(T+c/1e3)}}function S(k){r=!0,n.clear(),o.forEach(v=>v()),Zi(h,m);const T=ke(p),{start_timestamp:C}=T;if(!C)return;T.data[cu]||p.setAttribute(cu,s),W.log(`[Tracing] Idle span "${T.op}" finished`);const x=Co(p).filter(v=>v!==p);let P=0;x.forEach(v=>{v.isRecording()&&(v.setStatus({code:Tt,message:"cancelled"}),v.end(k),ae&&W.log("[Tracing] Cancelling span since span ended early",JSON.stringify(v,void 0,2)));const M=ke(v),{timestamp:D=0,start_timestamp:O=0}=M,N=O<=k,Q=(u+c)/1e3,G=D-O<=Q;if(ae){const V=JSON.stringify(v,void 0,2);N?G||W.log("[Tracing] Discarding span since it finished after idle span final timeout",V):W.log("[Tracing] Discarding span since it happened after idle span was finished",V)}(!G||!N)&&(j1(p,v),P++)}),P>0&&p.setAttribute("sentry.idle_span_discarded_spans",P)}return o.push(f.on("spanStart",k=>{if(r||k===p||ke(k).timestamp||k instanceof pu&&k.isStandaloneSpan())return;Co(p).includes(k)&&w(k.spanContext().spanId)})),o.push(f.on("spanEnd",k=>{r||E(k.spanContext().spanId)})),o.push(f.on("idleSpanEnableAutoFinish",k=>{k===p&&(a=!0,A(),n.size&&y())})),e.disableAutoFinish||A(),setTimeout(()=>{r||(p.setStatus({code:Tt,message:"deadline_exceeded"}),s=RB,p.end())},u),p}function MB(t){const e=Un(t);
vendor: 4,444 bytes, line 17
17return Zi(Be(),e),ae&&W.log("[Tracing] Started span is an idle span"),e}const Wf=0,Zy=1,ew=2;function Mr(t){return new yi(e=>{e(t)})}function yu(t){return new yi((e,n)=>{n(t)})}class yi{constructor(e){this._state=Wf,this._handlers=[],this._runExecutor(e)}then(e,n){return new yi((r,i)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(a){i(a)}},s=>{if(!n)i(s);else try{r(n(s))}catch(a){i(a)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new yi((n,r)=>{let i,s;return this.then(a=>{s=!1,i=a,e&&e()},a=>{s=!0,i=a,e&&e()}).then(()=>{if(s){r(i);return}n(i)})})}_executeHandlers(){if(this._state===Wf)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Zy&&n[1](this._value),this._state===ew&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(s,a)=>{if(this._state===Wf){if(wo(a)){a.then(r,i);return}this._state=s,this._value=a,this._executeHandlers()}},r=s=>{n(Zy,s)},i=s=>{n(ew,s)};try{e(r,i)}catch(s){i(s)}}}function Vf(t,e,n,r=0){return new yi((i,s)=>{const a=t[r];if(e===null||typeof a!="function")i(e);else{const o=a({...e},n);ae&&a.id&&o===null&&W.log(`Event processor "${a.id}" dropped event`),wo(o)?o.then(c=>Vf(t,c,n,r+1).then(i)).then(null,s):Vf(t,o,n,r+1).then(i).then(null,s)}})}function DB(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=e;OB(t,e),r&&LB(t,r),zB(t,n),NB(t,i),UB(t,s)}function wu(t,e){const{extra:n,tags:r,user:i,contexts:s,level:a,sdkProcessingMetadata:o,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:d,propagationContext:f,transactionName:h,span:m}=e;bu(t,"extra",n),bu(t,"tags",r),bu(t,"user",i),bu(t,"contexts",s),t.sdkProcessingMetadata=bo(t.sdkProcessingMetadata,o,2),a&&(t.level=a),h&&(t.transactionName=h),m&&(t.span=m),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),l.length&&(t.eventProcessors=[...t.eventProcessors,...l]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...f}}function bu(t,e,n){t[e]=bo(t[e],n,1)}function OB(t,e){const{extra:n,tags:r,user:i,contexts:s,level:a,transactionName:o}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),a&&(t.level=a),o&&t.type!=="transaction"&&(t.transaction=o)}function NB(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function UB(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function LB(t,e){t.contexts={trace:Cy(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Zn(e),...t.sdkProcessingMetadata};const n=kt(e),r=ke(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function zB(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}let Eu,tw,Su;function nw(t){const e=Te._sentryDebugIds;if(!e)return{};const n=Object.keys(e);return Su&&n.length===tw||(tw=n.length,Su=n.reduce((r,i)=>{Eu||(Eu={});const s=Eu[i];if(s)r[s[0]]=s[1];else{const a=t(i);for(let o=a.length-1;o>=0;o--){const c=a[o],u=c==null?void 0:c.filename,l=e[i];if(u&&l){r[u]=l,Eu[i]=[u,l];break}}}return r},{})),Su}function QB(t,e){const n=nw(t);if(!n)return[];const r=[];for(const i of e)i&&n[i]&&r.push({type:"sourcemap",code_file:i,debug_id:n[i]});return r}function rw(t,e,n,r,i,s){const{normalizeDepth:a=3,normalizeMaxBreadth:o=1e3}=t,c={...e,event_id:e.event_id||n.event_id||un(),timestamp:e.timestamp||Ji()},u=n.integrations||t.integrations.map(g=>g.name);HB(c,t),GB(c,u),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&WB(c,t.stackParser);const l=YB(r,n.captureContext);n.mechanism&&mi(c,n.mechanism);const d=i?i.getEventProcessors():[],f=_o().getScopeData();if(s){const g=s.getScopeData();wu(f,g)}if(l){const g=l.getScopeData();wu(f,g)}const h=[...n.attachments||[],...f.attachments];h.length&&(n.attachments=h),DB(c,f);const m=[...d,...f.eventProcessors];return Vf(m,c,n).then(g=>(g&&VB(g),typeof a=="number"&&a>0?qB(g,a,o):g))}function HB(t,e){const{environment:n,release:r,dist:i,maxValueLength:s=250}=e;t.environment=t.environment||n||lu,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i);const a=t.request;a!=null&&a.url&&(a.url=qs(a.url,s))}function WB(t,e){var r,i;const n=nw(e);
17(i=(r=t.exception)==null?void 0:r.values)==null||i.forEach(s=>{var a,o;(o=(a=s.stacktrace)==null?void 0:a.frames)==null||o.forEach(c=>{c.filename&&(c.debug_id=n[c.filename])})})}function VB(t){var r,i;const e={};if((i=(r=t.exception)==null?void 0:r.values)==null||i.forEach(s=>{var a,o;(o=(a=s.stacktrace)==null?void 0:a.frames)==null||o.forEach(c=>{c.debug_id&&(c.abs_path?e[c.abs_path]=c.debug_id:c.filename&&(e[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([s,a])=>{n.push({type:"sourcemap",code_file:s,debug_id:a})})}function GB(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function qB(t,e,n){var i,s;if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(a=>({...a,...a.data&&{data:_n(a.data,e,n)}}))},...t.user&&{user:_n(t.user,e,n)},...t.contexts&&{contexts:_n(t.contexts,e,n)},...t.extra&&{extra:_n(t.extra,e,n)}};return(i=t.contexts)!=null&&i.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=_n(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(a=>({...a,...a.data&&{data:_n(a.data,e,n)}}))),(s=t.contexts)!=null&&s.flags&&r.contexts&&(r.contexts.flags=_n(t.contexts.flags,3,n)),r}function YB(t,e){if(!e)return t;const n=t?t.clone():new Jn;return n.update(e),n}function KB(t){if(t)return jB(t)?{captureContext:t}:XB(t)?{captureContext:t}:t}function jB(t){return t instanceof Jn||typeof t=="function"}const $B=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function XB(t){return Object.keys(t).some(e=>$B.includes(e))}function Dr(t,e){return Be().captureException(t,KB(e))}function _u(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return Be().captureMessage(t,n,r)}function vo(t,e){return Be().captureEvent(t,e)}function Gf(t,e){Qt().setContext(t,e)}function JB(t){Qt().setExtras(t)}function ZB(t,e){Qt().setExtra(t,e)}function eP(t){Qt().setTags(t)}function tP(t,e){Qt().setTag(t,e)}function nP(t){Qt().setUser(t)}function iw(){return Qt().lastEventId()}async function rP(t){const e=le();return e?e.flush(t):(ae&&W.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function iP(t){const e=le();return e?e.close(t):(ae&&W.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function sP(){return!!le()}function sw(){const t=le();return(t==null?void 0:t.getOptions().enabled)!==!1&&!!(t!=null&&t.getTransport())}function aw(t){Qt().addEventProcessor(t)}function qf(t){const e=Qt(),n=Be(),{userAgent:r}=Te.navigator||{},i=T1({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),s=e.getSession();return(s==null?void 0:s.status)==="ok"&&Ys(s,{status:"exited"}),Yf(),e.setSession(i),i}function Yf(){const t=Qt(),n=Be().getSession()||t.getSession();n&&k1(n),ow(),t.setSession()}function ow(){const t=Qt(),e=le(),n=t.getSession();n&&e&&e.captureSession(n)}function Kf(t=!1){if(t){Yf();return}ow()}const aP="7";function cw(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function oP(t){return`${cw(t)}${t.projectId}/envelope/`}function cP(t,e){const n={sentry_version:aP};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function uw(t,e,n){return e||`${oP(t)}?${cP(t,n)}`}function uP(t,e){const n=Ny(t);if(!n)return"";const r=`${cw(n)}embed/error-page/`;let i=`dsn=${is(n)}`;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 lw=[];function lP(t){const e={};return t.forEach(n=>{const{name:r}=n,i=e[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function dP(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(i=>
vendor: 9,577 bytes, lines 17-18
17{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const i=n(e);r=Array.isArray(i)?i:[i]}else r=e;return lP(r)}function fP(t,e){const n={};return e.forEach(r=>{r&&fw(t,r,n)}),n}function dw(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function fw(t,e,n){if(n[e.name]){ae&&W.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,lw.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),lw.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>r(i,s,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((s,a)=>r(s,a,t),{id:e.name});t.addEventProcessor(i)}ae&&W.log(`Integration installed: ${e.name}`)}function jf(t){const e=le();if(!e){ae&&W.warn(`Cannot add integration "${t.name}" because no SDK Client is available.`);return}e.addIntegration(t)}function yY(t){return t}function hP(t,e,n){const r=[{type:"client_report"},{timestamp:Ji(),discarded_events:t}];return Fr(e?{dsn:e}:{},[r])}function hw(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function pP(t){var c;const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:s,data:a,op:o}=((c=t.contexts)==null?void 0:c.trace)??{};return{data:a??{},description:t.transaction,op:o,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:a==null?void 0:a[Pf],exclusive_time:a==null?void 0:a[js],measurements:t.measurements,is_segment:!0}}function mP(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[Pf]:t.profile_id},...t.exclusive_time&&{[js]:t.exclusive_time}}}},measurements:t.measurements}}const pw="Not capturing exception because it's already been captured.",mw="Discarded session because of missing or non-string release",gw=Symbol.for("SentryInternalError"),Aw=Symbol.for("SentryDoNotSendEventError");function Tu(t){return{message:t,[gw]:!0}}function $f(t){return{message:t,[Aw]:!0}}function yw(t){return!!t&&typeof t=="object"&&gw in t}function ww(t){return!!t&&typeof t=="object"&&Aw in t}class gP{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Ny(e.dsn):ae&&W.warn("No DSN provided, client will not send events."),this._dsn){const n=uw(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:n})}}captureException(e,n,r){const i=un();if(ly(e))return ae&&W.log(pw),i;const s={event_id:i,...n};return this._process(this.eventFromException(e,s).then(a=>this._captureEvent(a,s,r))),s.event_id}captureMessage(e,n,r,i){const s={event_id:un(),...r},a=iu(e)?e:String(e),o=Gs(e)?this.eventFromMessage(a,n,s):this.eventFromException(e,s);return this._process(o.then(c=>this._captureEvent(c,s,i))),s.event_id}captureEvent(e,n,r){const i=un();if(n!=null&&n.originalException&&ly(n.originalException))return ae&&W.log(pw),i;const s={event_id:i,...n},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,c=a.capturedSpanIsolationScope;return this._process(this._captureEvent(e,s,o||r,c)),s.event_id}captureSession(e){this.sendSession(e),Ys(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):Mr(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}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]}addIntegration(e){const n=this._integrations[e.name];fw(this,e,this._integrations),n||dw(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=AB(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=cB(r,hB(s));const i=this.sendEnvelope(r);i&&i.then(s=>this.emit("afterSendEvent",e,s),null)}sendSession(e){const{release:n,environment:r=lu}=this._options;if("aggregates"in e){const s=e.attrs||{};if(!s.release&&!n){ae&&W.warn(mw);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){ae&&W.warn(mw);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const i=gB(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const i=`${e}:${n}`;ae&&W.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const i=r.indexOf(n);i>-1&&r.splice(i,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(ae&&W.error("Error while sending envelope:",n),n)):(ae&&W.error("Transport disabled"),Mr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=fP(this,e),dw(this,e)}_updateSessionFromEvent(e,n){var c;let r=n.level==="fatal",i=!1;const s=(c=n.exception)==null?void 0:c.values;if(s){i=!0;for(const u of s){const l=u.mechanism;if((l==null?void 0:l.handled)===!1){r=!0;break}}}const a=e.status==="ok";(a&&e.errors===0||a&&r)&&(Ys(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new yi(n=>{let r=0;const i=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),n(!0)):(r+=i,e&&r>=e&&(clearInterval(s),n(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,i){const s=this.getOptions(),a=Object.keys(this._integrations);return!n.integrations&&(a!=null&&a.length)&&(n.integrations=a),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),rw(s,e,n,r,this,i).then(o=>{if(o===null)return o;this.emit("postprocessEvent",o,n),o.contexts={trace:py(r),...o.contexts};const c=Nf(this,r);return o.sdkProcessingMetadata={dynamicSamplingContext:c,...o.sdkProcessingMetadata},o})}_captureEvent(e,n={},r=Be(),i=Qt()){return ae&&Xf(e)&&W.log(`Captured error event \`${hw(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,i).then(s=>s.event_id,s=>{ae&&(ww(s)?W.log(s.message):yw(s)?W.warn(s.message):W.warn(s))})}_processEvent(e,n,r,i){const s=this.getOptions(),{sampleRate:a}=s,o=bw(e),c=Xf(e),u=e.type||"error",l=`before send for type \`${u}\``,d=typeof a>"u"?void 0:es(a);if(c&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error"),yu($f(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));const f=u==="replay_event"?"replay":u;return this._prepareEvent(e,n,r,i).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",f),$f("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return h;const p=yP(this,s,h,n);return AP(p,l)}).then(h=>{var g;if(h===null){if(this.recordDroppedEvent("before_send",f),o){const y=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",y)}throw $f(`${l} returned \`null\`, will not send event.`)}const m=r.getSession()||i.getSession();if(c&&m&&this._updateSessionFromEvent(m,h),o){const A=((g=h.sdkProcessingMetadata)==null?void 0:g.spanCountBeforeProcessing)||0,y=h.spans?h.spans.length:0,w=A-y;w>0&&this.recordDroppedEvent("before_send","span",w)}const p=h.transaction_info;if(o&&p&&h.transaction!==e.transaction){const A="custom";h.transaction_info={...p,source:A}}return this.sendEvent(h,n),h}).then(null,h=>{throw ww(h)||yw(h)?h:(this.captureException(h,{data:{__sentry__:!0},originalException:h}),Tu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
18Reason: ${h}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,s]=n.split(":");return{reason:i,category:s,quantity:r}})}_flushOutcomes(){ae&&W.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){ae&&W.log("No outcomes to send");return}if(!this._dsn){ae&&W.log("No dsn provided, will not send outcomes");return}ae&&W.log("Sending outcomes:",e);const n=hP(e,this._options.tunnel&&is(this._dsn));this.sendEnvelope(n)}}function AP(t,e){const n=`${e} must return \`null\` or a valid event.`;if(wo(t))return t.then(r=>{if(!vr(r)&&r!==null)throw Tu(n);return r},r=>{throw Tu(`${e} rejected with ${r}`)});if(!vr(t)&&t!==null)throw Tu(n);return t}function yP(t,e,n,r){const{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:a}=e;let o=n;if(Xf(o)&&i)return i(o,r);
18if(bw(o)){if(a){const c=a(pP(o));if(c?o=bo(n,mP(c)):Of(),o.spans){const u=[];for(const l of o.spans){const d=a(l);d?u.push(d):(Of(),u.push(l))}o.spans=u}}if(s){if(o.spans){const c=o.spans.length;o.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return s(o,r)}}return o}function Xf(t){return t.type===void 0}function bw(t){return t.type==="transaction"}function wP(t,e){return e?An(e,()=>{const n=gt(),r=n?Cy(n):py(e);return[n?Zn(n):Nf(t,e),r]}):[void 0,void 0]}const bP={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function EP(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function SP(t,e,n,r){const i={};return e!=null&&e.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(i.dsn=is(r)),Fr(i,[EP(t)])}const _P=100;function TP(t){switch(typeof t){case"number":return Number.isInteger(t)?{value:t,type:"integer"}:{value:t,type:"double"};case"boolean":return{value:t,type:"boolean"};case"string":return{value:t,type:"string"};default:{let e="";try{e=JSON.stringify(t)??""}catch{}return{value:e,type:"string"}}}}function wi(t,e,n,r=!0){n&&(!t[e]||r)&&(t[e]=n)}function kP(t,e){const n=Zf(),r=Ew(t);r===void 0?n.set(t,[e]):r.length>=_P?(ku(t,r),n.set(t,[e])):n.set(t,[...r,e])}function Jf(t,e=le(),n=Be(),r=kP){var P;if(!e){ae&&W.warn("No client available to capture log.");return}const{release:i,environment:s,enableLogs:a,beforeSendLog:o,_experiments:c}=e.getOptions();if(!(a??(c==null?void 0:c.enableLogs))){ae&&W.warn("logging option not enabled, log will not be captured.");return}const l=o??(c==null?void 0:c.beforeSendLog),[,d]=wP(e,n),f={...t.attributes},{user:{id:h,email:m,username:p}}=IP(n);wi(f,"user.id",h,!1),wi(f,"user.email",m,!1),wi(f,"user.name",p,!1),wi(f,"sentry.release",i),wi(f,"sentry.environment",s);const{name:g,version:A}=((P=e.getSdkMetadata())==null?void 0:P.sdk)??{};wi(f,"sentry.sdk.name",g),wi(f,"sentry.sdk.version",A);const y=t.message;if(iu(y)){const{__sentry_template_string__:v,__sentry_template_values__:M=[]}=y;f["sentry.message.template"]=v,M.forEach((D,O)=>{f[`sentry.message.parameter.${O}`]=D})}const w=So(n);wi(f,"sentry.trace.parent_span_id",w==null?void 0:w.spanContext().spanId);const E={...t,attributes:f};e.emit("beforeCaptureLog",E);const S=l?fi(()=>l(E)):E;if(!S){e.recordDroppedEvent("before_send","log_item",1),ae&&W.warn("beforeSendLog returned null, log will not be captured.");return}const{level:k,message:T,attributes:C={},severityNumber:_}=S,x={timestamp:mt(),level:k,body:T,trace_id:d==null?void 0:d.trace_id,severity_number:_??bP[k],attributes:Object.keys(C).reduce((v,M)=>(v[M]=TP(C[M]),v),{})};r(e,x),e.emit("afterCaptureLog",S)}function ku(t,e){const n=e??Ew(t)??[];if(n.length===0)return;const r=t.getOptions(),i=SP(n,r._metadata,r.tunnel,t.getDsn());Zf().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function Ew(t){return Zf().get(t)}function IP(t){const e=_o().getScopeData();return wu(e,Qt().getScopeData()),wu(e,t.getScopeData()),e}function Zf(){return yo("clientToLogBufferMap",()=>new WeakMap)}function CP(t,e){e.debug===!0&&(ae?W.enable():fi(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Be().update(e.initialScope);const r=new t(e);return Sw(r),r.init(),r}function Sw(t){Be().setClient(t)}const _w=Symbol.for("SentryBufferFullError");function xP(t){const e=[];function n(){return t===void 0||e.length<t}function r(a){return e.splice(e.indexOf(a),1)[0]||Promise.resolve(void 0)}function i(a){if(!n())return yu(_w);const o=a();return e.indexOf(o)===-1&&e.push(o),o.then(()=>r(o)).then(null,()=>r(o).then(null,()=>{})),o}function s(a){return new yi((o,c)=>{let u=e.length;if(!u)return o(!0);const l=setTimeout(()=>{a&&a>0&&o(!1)},a);e.forEach(d=>{Mr(d).then(()=>{--u||(clearTimeout(l),o(!0))},c)})})}return{$:e,add:i,drain:s}}const vP=60*1e3;function Tw(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?vP:r-e}function BP(t,e){return t[e]||t.all||0}function kw(t,e,n=Date.now()){return BP(t,e)>n}function Iw(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},s=n==null?void 0:n["x-sentry-rate-limits"],a=n==null?void 0:n["retry-after"];if(s)for(const o of s.trim().split(",")){const[c,u,,,l]=o.split(":",5),d=parseInt(c,10),f=(isNaN(d)?60:d)*1e3;if(!u)i.all=r+f;else for(const h of u.split(";"))h==="metric_bucket"?(!l||l.split(";").includes("custom"))&&(i[h]=r+f):i[h]=r+f}else a?i.all=r+Tw(a,r):e===429&&(i.all=r+60*1e3);return i}const PP=64;function Cw(t,e,n=xP(t.bufferSize||PP)){let r={};const i=a=>n.drain(a);function s(a){const o=[];if(ss(a,(d,f)=>{const h=Hy(f);kw(r,h)?t.recordDroppedEvent("ratelimit_backoff",h):o.push(d)}),o.length===0)return Mr({});const c=Fr(a[0],o),u=d=>{ss(c,(f,h)=>{t.recordDroppedEvent(d,Hy(h))})},l=()=>e({body:hu(c)}).then(d=>(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&ae&&W.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=Iw(r,d),d),d=>{throw u("network_error"),ae&&W.error("Encountered error running transport request:",d),d});return n.add(l).then(d=>d,d=>{if(d===_w)return ae&&W.error("Skipped sending event because buffer is full."),u("queue_overflow"),Mr({});throw d})}return{send:s,flush:i}}const eh=100,th=5e3,RP=36e5;function FP(t){function e(...n){ae&&W.log("[Offline]:",...n)}return n=>{const r=t(n);if(!n.createStore)throw new Error("No `createStore` function was provided");const i=n.createStore(n);let s=th,a;function o(d,f,h){return Qy(d,["client_report"])?!1:n.shouldStore?n.shouldStore(d,f,h):!0}function c(d){a&&clearTimeout(a),a=setTimeout(async()=>{a=void 0;const f=await i.shift();f&&(e("Attempting to send previously queued event"),f[0].sent_at=new Date().toISOString(),l(f,!0).catch(h=>{e("Failed to retry sending",h)}))},d),typeof a!="number"&&a.unref&&a.unref()}function u(){a||(c(s),s=Math.min(s*2,RP))}async function l(d,f=!1){var h,m;if(!f&&Qy(d,["replay_event","replay_recording"]))return await i.push(d),c(eh),{};
18try{if(n.shouldSend&&await n.shouldSend(d)===!1)throw new Error("Envelope not sent because `shouldSend` callback returned false");const p=await r.send(d);let g=eh;if(p){if((h=p.headers)!=null&&h["retry-after"])g=Tw(p.headers["retry-after"]);else if((m=p.headers)!=null&&m["x-sentry-rate-limits"])g=6e4;else if((p.statusCode||0)>=400)return p}return c(g),s=th,p}catch(p){if(await o(d,p,s))return f?await i.unshift(d):await i.push(d),u(),e("Error sending. Event queued.",p),{};throw p}}return n.flushAtStartup&&u(),{send:l,flush:d=>(d===void 0&&(s=th,c(eh)),r.flush(d))}}}function xw(t,e){let n;return ss(t,(r,i)=>(e.includes(i)&&(n=Array.isArray(r)?r[1]:void 0),!!n)),n}function MP(t,e){return n=>{const r=t(n);return{...r,send:async i=>{const s=xw(i,["event","transaction","profile","replay_event"]);return s&&(s.release=e),r.send(i)}}}}function DP(t,e){return Fr(e?{...t[0],dsn:e}:t[0],t[1])}function OP(t,e){return n=>{const r=t(n),i=new Map;function s(c,u){const l=u?`${c}:${u}`:c;let d=i.get(l);if(!d){const f=Dy(c);if(!f)return;const h=uw(f,n.tunnel);d=u?MP(t,u)({...n,url:h}):t({...n,url:h}),i.set(l,d)}return[c,d]}async function a(c){function u(h){const m=h!=null&&h.length?h:["event"];return xw(c,m)}const l=e({envelope:c,getEvent:u}).map(h=>typeof h=="string"?s(h,void 0):s(h.dsn,h.release)).filter(h=>!!h),d=l.length?l:[["",r]];return(await Promise.all(d.map(([h,m])=>m.send(DP(c,h)))))[0]}async function o(c){const u=[...i.values(),r];return(await Promise.all(u.map(d=>d.flush(c)))).every(d=>d)}return{send:a,flush:o}}}function vw(t,e){const n=e==null?void 0:e.getDsn(),r=e==null?void 0:e.getOptions().tunnel;return UP(t,n)||NP(t,r)}function NP(t,e){return e?Bw(t)===Bw(e):!1}function UP(t,e){return e?t.includes(e.host):!1}function Bw(t){return t[t.length-1]==="/"?t.slice(0,-1):t}function Pw(t,...e){const n=new String(String.raw(t,...e));return n.__sentry_template_string__=t.join("\0").replace(/%/g,"%%").replace(/\0/g,"%s"),n.__sentry_template_values__=e,n}const LP=Pw;function zP(t){var e;((e=t.user)==null?void 0:e.ip_address)===void 0&&(t.user={...t.user,ip_address:"{{auto}}"})}function QP(t){var e;"aggregates"in t?((e=t.attrs)==null?void 0:e.ip_address)===void 0&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function nh(t,e,n=[e],r="npm"){const i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(s=>({name:`${r}:@sentry/${s}`,version:kr})),version:kr}),t._metadata=i}function rh(t={}){const e=t.client||le();if(!sw()||!e)return{};const n=Ir(),r=gi(n);if(r.getTraceData)return r.getTraceData(t);const i=t.scope||Be(),s=t.span||gt(),a=s?xy(s):HP(i),o=s?Zn(s):Nf(e,i),c=by(o);return Sy.test(a)?{"sentry-trace":a,baggage:c}:(W.warn("Invalid sentry-trace data. Cannot generate trace data"),{})}function HP(t){const{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Ty(e,r,n)}function WP(t,e,n){let r,i,s;const a=n!=null&&n.maxWait?Math.max(n.maxWait,e):0,o=(n==null?void 0:n.setTimeoutImpl)||setTimeout;function c(){return u(),r=t(),r}function u(){i!==void 0&&clearTimeout(i),s!==void 0&&clearTimeout(s),i=s=void 0}function l(){return i!==void 0||s!==void 0?c():r}function d(){return i&&clearTimeout(i),i=o(c,e),a&&s===void 0&&(s=o(c,a)),r}return d.cancel=u,d.flush=l,d}const VP=100;function er(t,e){const n=le(),r=Qt();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:s=VP}=n.getOptions();if(s<=0)return;const o={timestamp:Ji(),...t},c=i?fi(()=>i(o,e)):o;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}let Rw;const GP="FunctionToString",Fw=new WeakMap,Mw=(()=>({name:GP,setupOnce(){Rw=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=If(this),n=Fw.has(le())&&e!==void 0?e:this;return Rw.apply(n,t)}}catch{}},setup(t){Fw.set(t,!0)}})),qP=[/^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. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],YP="EventFilters",Dw=(t={})=>{let e;return{name:YP,setup(n){const r=n.getOptions();e=Nw(t,r)},processEvent(n,r,i){if(!e){const s=i.getOptions();e=Nw(t,s)}return KP(n,e)?null:n}}},Ow=((t={})=>({...Dw(t),name:"InboundFilters"}));function Nw(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:qP],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function KP(t,e){if(t.type){if(t.type==="transaction"&&$P(t,e.ignoreTransactions))return ae&&W.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
19Event: ${Xi(t)}`),!0}else{if(jP(t,e.ignoreErrors))return ae&&W.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
20Event: ${Xi(t)}`),!0;if(eR(t))return ae&&W.warn(`Event dropped due to not having an error message, error type or stacktrace.
21Event: ${Xi(t)}`),!0;if(XP(t,e.denyUrls))return ae&&W.warn(`Event dropped due to being matched by \`denyUrls\` option.
22Event: ${Xi(t)}.
23Url: ${Iu(t)}`),!0;if(!JP(t,e.allowUrls))return ae&&W.warn(`Event dropped due to not being matched by \`allowUrls\` option.
24Event: ${Xi(t)}.
25Url: ${Iu(t)}`),!0}return!1}function jP(t,e){return e!=null&&e.length?hw(t).some(n=>Xn(n,e)):!1}function $P(t,e){if(!(e!=null&&e.length))return!1;const n=t.transaction;return n?Xn(n,e):!1}function XP(t,e){if(!(e!=null&&e.length))return!1;const n=Iu(t);return n?Xn(n,e):!1}function JP(t,e){if(!(e!=null&&e.length))return!0;const n=Iu(t);return n?Xn(n,e):!0}function ZP(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Iu(t){var e,n;try{const r=[...((e=t.exception)==null?void 0:e.values)??[]].reverse().find(s=>{var a,o,c;return((a=s.mechanism)==null?void 0:a.parent_id)===void 0&&((c=(o=s.stacktrace)==null?void 0:o.frames)==null?void 0:c.length)}),i=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return i?ZP(i):null}catch{return ae&&W.error(`Cannot extract url for event ${Xi(t)}`),null}}function eR(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)!=null&&n.length?!t.message&&!t.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function tR(t,e,n,r,i,s){var o;if(!((o=i.exception)!=null&&o.values)||!s||!Br(s.originalException,Error))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=ih(t,e,r,s.originalException,n,i.exception.values,a,0))}function ih(t,e,n,r,i,s,a,o){if(s.length>=n+1)return s;let c=[...s];if(Br(r[i],Error)){Uw(a,o);const u=t(e,r[i]),l=c.length;Lw(u,i,l,o),c=ih(t,e,n,r[i],i,[u,...c],u,l)}
25return Array.isArray(r.errors)&&r.errors.forEach((u,l)=>{if(Br(u,Error)){Uw(a,o);const d=t(e,u),f=c.length;Lw(d,`errors[${l}]`,f,o),c=ih(t,e,n,u,i,[d,...c],d,f)}}),c}function Uw(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Lw(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}const zw=new Map,Qw=new Set;function nR(t){if(Te._sentryModuleMetadata)for(const e of Object.keys(Te._sentryModuleMetadata)){const n=Te._sentryModuleMetadata[e];if(Qw.has(e))continue;Qw.add(e);const r=t(e);for(const i of r.reverse())if(i.filename){zw.set(i.filename,n);break}}}function rR(t,e){return nR(t),zw.get(e)}function Hw(t,e){try{e.exception.values.forEach(n=>{if(n.stacktrace)for(const r of n.stacktrace.frames||[]){if(!r.filename||r.module_metadata)continue;const i=rR(t,r.filename);i&&(r.module_metadata=i)}})}catch{}}function Ww(t){try{t.exception.values.forEach(e=>{if(e.stacktrace)for(const n of e.stacktrace.frames||[])delete n.module_metadata})}catch{}}const iR=()=>({name:"ModuleMetadata",setup(t){t.on("beforeEnvelope",e=>{ss(e,(n,r)=>{if(r==="event"){const i=Array.isArray(n)?n[1]:void 0;i&&(Ww(i),n[1]=i)}})}),t.on("applyFrameMetadata",e=>{if(e.type)return;const n=t.getOptions().stackParser;Hw(n,e)})}});function sh(t){const e="console";hi(e,t),pi(e,sR)}function sR(){"console"in Te&&Af.forEach(function(t){t in Te.console&&on(Te.console,t,function(e){return tu[t]=e,function(...n){On("console",{args:n,level:t});const i=tu[t];i==null||i.apply(Te.console,n)}})})}function ah(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const aR="CaptureConsole",oR=((t={})=>{const e=t.levels||Af,n=t.handled??!0;return{name:aR,setup(r){"console"in Te&&sh(({args:i,level:s})=>{le()!==r||!e.includes(s)||cR(i,s,n)})}}});function cR(t,e,n){const r={level:ah(e),extra:{arguments:t}};An(i=>{if(i.addEventProcessor(o=>(o.logger="console",mi(o,{handled:n,type:"console"}),o)),e==="assert"){if(!t[0]){const o=`Assertion failed: ${au(t.slice(1)," ")||"console.assert"}`;i.setExtra("arguments",t.slice(1)),_u(o,r)}return}const s=t.find(o=>o instanceof Error);if(s){Dr(s,r);return}const a=au(t," ");_u(a,r)})}const uR="Dedupe",Vw=(()=>{let t;return{name:uR,processEvent(e){if(e.type)return e;try{if(lR(e,t))return ae&&W.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}});function lR(t,e){return e?!!(dR(t,e)||fR(t,e)):!1}function dR(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!qw(t,e)||!Gw(t,e))}function fR(t,e){const n=Yw(e),r=Yw(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!qw(t,e)||!Gw(t,e))}function Gw(t,e){let n=Ef(t),r=Ef(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){const s=r[i],a=n[i];if(s.filename!==a.filename||s.lineno!==a.lineno||s.colno!==a.colno||s.function!==a.function)return!1}return!0}function qw(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function Yw(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}const hR="ExtraErrorData",pR=((t={})=>{const{depth:e=3,captureErrorCause:n=!0}=t;return{name:hR,processEvent(r,i,s){const{maxValueLength:a=250}=s.getOptions();return mR(r,i,e,n,a)}}});function mR(t,e={},n,r,i){if(!e.originalException||!xr(e.originalException))return t;const s=e.originalException.name||e.originalException.constructor.name,a=gR(e.originalException,r,i);if(a){const o={...t.contexts},c=_n(a,n);return vr(c)&&(cn(c,"__sentry_skip_normalization__",!0),o[s]=c),{...t,contexts:o}}return t}function gR(t,e,n){try{const r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],i={};for(const s of Object.keys(t)){if(r.indexOf(s)!==-1)continue;const a=t[s];i[s]=xr(a)||typeof a=="string"?qs(`${a}`,n):a}if(e&&t.cause!==void 0&&(i.cause=xr(t.cause)?t.cause.toString():t.cause),typeof t.toJSON=="function"){const s=t.toJSON();for(const a of Object.keys(s)){const o=s[a];i[a]=xr(o)?o.toString():o}}return i}catch(r){ae&&W.error("Unable to extract extra data from the Error object:",r)}return null}function AR(t,e){let n=0;for(let r=t.length-1;r>=0;r--){const i=t[r];
25i==="."?t.splice(r,1):i===".."?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}const yR=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function wR(t){const e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=yR.exec(e);return n?n.slice(1):[]}function Kw(...t){let e="",n=!1;for(let r=t.length-1;r>=-1&&!n;r--){const i=r>=0?t[r]:"/";i&&(e=`${i}/${e}`,n=i.charAt(0)==="/")}return e=AR(e.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+e||"."}function jw(t){let e=0;for(;e<t.length&&t[e]==="";e++);let n=t.length-1;for(;n>=0&&t[n]==="";n--);return e>n?[]:t.slice(e,n-e+1)}function bR(t,e){t=Kw(t).slice(1),e=Kw(e).slice(1);const n=jw(t.split("/")),r=jw(e.split("/")),i=Math.min(n.length,r.length);let s=i;for(let o=0;o<i;o++)if(n[o]!==r[o]){s=o;break}let a=[];for(let o=s;o<n.length;o++)a.push("..");return a=a.concat(r.slice(s)),a.join("/")}function ER(t,e){return wR(t)[2]||""}const SR="RewriteFrames",_R=(t={})=>{const e=t.root,n=t.prefix||"app:///",r="window"in Te&&!!Te.window,i=t.iteratee||TR({isBrowser:r,root:e,prefix:n});function s(o){try{return{...o,exception:{...o.exception,values:o.exception.values.map(c=>({...c,...c.stacktrace&&{stacktrace:a(c.stacktrace)}}))}}}catch{return o}}function a(o){var c;return{...o,frames:(c=o==null?void 0:o.frames)==null?void 0:c.map(u=>i(u))}}return{name:SR,processEvent(o){let c=o;return o.exception&&Array.isArray(o.exception.values)&&(c=s(c)),c}}};function TR({isBrowser:t,root:e,prefix:n}){return r=>{if(!r.filename)return r;const i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),s=/^\//.test(r.filename);if(t){if(e){const a=r.filename;a.indexOf(e)===0&&(r.filename=a.replace(e,n))}}else if(i||s){const a=i?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,o=e?bR(e,a):ER(a);r.filename=`${n}${o}`}return r}}const kR=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],IR=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],CR={eq:"eq",neq:"neq",gt:"gt",gte:"gte",lt:"lt",lte:"lte",like:"like","like(all)":"likeAllOf","like(any)":"likeAnyOf",ilike:"ilike","ilike(all)":"ilikeAllOf","ilike(any)":"ilikeAnyOf",is:"is",in:"in",cs:"contains",cd:"containedBy",sr:"rangeGt",nxl:"rangeGte",sl:"rangeLt",nxr:"rangeLte",adj:"rangeAdjacent",ov:"overlaps",fts:"",plfts:"plain",phfts:"phrase",wfts:"websearch",not:"not"},$w=["select","insert","upsert","update","delete"];function Cu(t){try{t.__SENTRY_INSTRUMENTED__=!0}catch{}}function xu(t){try{return t.__SENTRY_INSTRUMENTED__}catch{return!1}}function xR(t,e={}){var n;switch(t){case"GET":return"select";case"POST":return(n=e.Prefer)!=null&&n.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function vR(t,e){if(e===""||e==="*")return"select(*)";if(t==="select")return`select(${e})`;if(t==="or"||t.endsWith(".or"))return`${t}${e}`;const[n,...r]=e.split(".");let i;return n!=null&&n.startsWith("fts")?i="textSearch":n!=null&&n.startsWith("plfts")?i="textSearch[plain]":n!=null&&n.startsWith("phfts")?i="textSearch[phrase]":n!=null&&n.startsWith("wfts")?i="textSearch[websearch]":i=n&&CR[n]||"filter",`${i}(${t}, ${r.join(".")})`}function Xw(t,e=!1){return new Proxy(t,{apply(n,r,i){return gu({name:`auth ${e?"(admin) ":""}${t.name}`,attributes:{[Ne]:"auto.db.supabase",[Pt]:"db","db.system":"postgresql","db.operation":`auth.${e?"admin.":""}${t.name}`}},s=>Reflect.apply(n,r,i).then(a=>(a&&typeof a=="object"&&"error"in a&&a.error?(s.setStatus({code:Tt}),Dr(a.error,{mechanism:{handled:!1}})):s.setStatus({code:Rf}),s.end(),a)).catch(a=>{throw s.setStatus({code:Tt}),s.end(),Dr(a,{mechanism:{handled:!1}}),a}).then(...i))}})}function BR(t){const e=t.auth;if(!(!e||xu(t.auth))){for(const n of kR){const r=e[n];r&&typeof t.auth[n]=="function"&&(t.auth[n]=Xw(r))}for(const n of IR){const r=e.admin[n];r&&typeof t.auth.admin[n]=="function"&&(t.auth.admin[n]=Xw(r,!0))}Cu(t.auth)}}function PR(t){xu(t.prototype.from)||(t.prototype.from=new Proxy(t.prototype.from,{apply(e,n,r){const i=Reflect.apply(e,n,r),s=i.constructor;return FR(s),i}}),Cu(t.prototype.from))}function RR(t){xu(t.prototype.then)||(t.prototype.then=new Proxy(t.prototype.then,{apply(e,n,r){var h;const i=$w,s=n,a=xR(s.method,s.headers);if(!i.includes(a)||!((h=s==null?void 0:s.url)!=null&&h.pathname)||typeof s.url.pathname!="string")return Reflect.apply(e,n,r);const o=s.url.pathname.split("/"),c=o.length>0?o[o.length-1]:"",u=[];
25for(const[m,p]of s.url.searchParams.entries())u.push(vR(m,p));const l=Object.create(null);if(vr(s.body))for(const[m,p]of Object.entries(s.body))l[m]=p;const d=`${a==="select"?"":`${a}${l?"(...) ":""}`}${u.join(" ")} from(${c})`,f={"db.table":c,"db.schema":s.schema,"db.url":s.url.origin,"db.sdk":s.headers["X-Client-Info"],"db.system":"postgresql","db.operation":a,[Ne]:"auto.db.supabase",[Pt]:"db"};return u.length&&(f["db.query"]=u),Object.keys(l).length&&(f["db.body"]=l),gu({name:d,attributes:f},m=>Reflect.apply(e,n,[]).then(p=>{if(m&&(p&&typeof p=="object"&&"status"in p&&Io(m,p.status||500),m.end()),p.error){const y=new Error(p.error.message);p.error.code&&(y.code=p.error.code),p.error.details&&(y.details=p.error.details);const w={};u.length&&(w.query=u),Object.keys(l).length&&(w.body=l),Dr(y,{contexts:{supabase:w}})}const g={type:"supabase",category:`db.${a}`,message:d},A={};return u.length&&(A.query=u),Object.keys(l).length&&(A.body=l),Object.keys(A).length&&(g.data=A),er(g),p},p=>{throw m&&(Io(m,500),m.end()),p}).then(...r))}}),Cu(t.prototype.then))}function FR(t){for(const e of $w)xu(t.prototype[e])||(t.prototype[e]=new Proxy(t.prototype[e],{apply(n,r,i){const s=Reflect.apply(n,r,i),a=s.constructor;return ae&&W.log(`Instrumenting ${e} operation's PostgRESTFilterBuilder`),RR(a),s}}),Cu(t.prototype[e]))}const Jw=t=>{if(!t){ae&&W.warn("Supabase integration was not installed because no Supabase client was provided.");return}const e=t.constructor===Function?t:t.constructor;PR(e),BR(t)},MR="Supabase",DR=(t=>({setupOnce(){Jw(t)},name:MR})),OR=t=>DR(t.supabaseClient),NR=10,UR="ZodErrors";function LR(t){return xr(t)&&t.name==="ZodError"&&Array.isArray(t.issues)}function zR(t){return{...t,path:"path"in t&&Array.isArray(t.path)?t.path.join("."):void 0,keys:"keys"in t?JSON.stringify(t.keys):void 0,unionErrors:"unionErrors"in t?JSON.stringify(t.unionErrors):void 0}}function QR(t){return t.map(e=>typeof e=="number"?"<array>":e).join(".")}function HR(t){const e=new Set;for(const r of t.issues){const i=QR(r.path);i.length>0&&e.add(i)}const n=Array.from(e);if(n.length===0){let r="variable";if(t.issues.length>0){const i=t.issues[0];i!==void 0&&"expected"in i&&typeof i.expected=="string"&&(r=i.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${qs(n.join(", "),100)}`}function WR(t,e=!1,n,r){var i;if(!((i=n.exception)!=null&&i.values)||!r.originalException||!LR(r.originalException)||r.originalException.issues.length===0)return n;try{const a=(e?r.originalException.issues:r.originalException.issues.slice(0,t)).map(zR);return e&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:a})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:HR(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":a.slice(0,t)}}}catch(s){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:s instanceof Error?`${s.name}: ${s.message}
26${s.stack}`:"unknown"}}}}}const VR=((t={})=>{const e=t.limit??NR;return{name:UR,processEvent(n,r){return WR(e,t.saveZodIssuesAsAttachment,n,r)}}}),GR=t=>({name:"ThirdPartyErrorsFilter",setup(e){e.on("beforeEnvelope",n=>{ss(n,(r,i)=>{if(i==="event"){const s=Array.isArray(r)?r[1]:void 0;s&&(Ww(s),r[1]=s)}})}),e.on("applyFrameMetadata",n=>{if(n.type)return;const r=e.getOptions().stackParser;Hw(r,n)})},processEvent(e){const n=qR(e);if(n){const r=t.behaviour==="drop-error-if-contains-third-party-frames"||t.behaviour==="apply-tag-if-contains-third-party-frames"?"some":"every";if(n[r](s=>!s.some(a=>t.filterKeys.includes(a)))){if(t.behaviour==="drop-error-if-contains-third-party-frames"||t.behaviour==="drop-error-if-exclusively-contains-third-party-frames")return null;e.tags={...e.tags,third_party_code:!0}}}return e}});function qR(t){const e=Ef(t);if(e)return e.filter(n=>!!n.filename).map(n=>n.module_metadata?Object.keys(n.module_metadata).filter(r=>r.startsWith(Zw)).map(r=>r.slice(Zw.length)):[])}const Zw="_sentryBundlerPluginAppKey:",YR=100,KR=10,vu="flag.evaluation.";function Bo(t){const n=Be().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(t.contexts===void 0&&(t.contexts={}),t.contexts.flags={values:[...r]}),t}function $s(t,e,n=YR){const r=Be().getScopeData().contexts;r.flags||(r.flags={values:[]});const i=r.flags.values;jR(i,t,e,n)}function jR(t,e,n,r){if(typeof n!="boolean")return;if(t.length>
26r){ae&&W.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}const i=t.findIndex(s=>s.flag===e);i!==-1&&t.splice(i,1),t.length===r&&t.shift(),t.push({flag:e,result:n})}function Xs(t,e,n=KR){if(typeof e!="boolean")return;const r=gt();if(!r)return;const i=ke(r).data;if(`${vu}${t}`in i){r.setAttribute(`${vu}${t}`,e);return}Object.keys(i).filter(a=>a.startsWith(vu)).length<n&&r.setAttribute(`${vu}${t}`,e)}const $R=()=>({name:"FeatureFlags",processEvent(t,e,n){return Bo(t)},addFeatureFlag(t,e){$s(t,e),Xs(t,e)}}),XR="thismessage:/";function eb(t){return"isRelative"in t}function tb(t,e){const n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=n?XR:void 0;try{if("canParse"in URL&&!URL.canParse(t,r))return;const i=new URL(t,r);return n?{isRelative:n,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function JR(t){if(eb(t))return t.pathname;const e=new URL(t);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 os(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function nb(t){return t.split(/[?#]/,1)[0]}function ZR(t,e,n,r,i="auto.http.browser"){if(!t.fetchData)return;const{method:s,url:a}=t.fetchData,o=Ai()&&e(a);if(t.endTimestamp&&o){const d=t.fetchData.__span;if(!d)return;const f=r[d];f&&(tF(f,t),delete r[d]);return}const c=!!gt(),u=o&&c?Un(rF(a,s,i)):new Rr;if(t.fetchData.__span=u.spanContext().spanId,r[u.spanContext().spanId]=u,n(t.fetchData.url)){const d=t.args[0],f=t.args[1]||{},h=eF(d,f,Ai()&&c?u:void 0);h&&(t.args[1]=f,f.headers=h)}const l=le();if(l){const d={input:t.args,response:t.response,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp};l.emit("beforeOutgoingRequestSpan",u,d)}return u}function eF(t,e,n){const r=rh({span:n}),i=r["sentry-trace"],s=r.baggage;if(!i)return;const a=e.headers||(ry(t)?t.headers:void 0);if(a)if(nF(a)){const o=new Headers(a);if(o.get("sentry-trace")||o.set("sentry-trace",i),s){const c=o.get("baggage");c?Bu(c)||o.set("baggage",`${c},${s}`):o.set("baggage",s)}return o}else if(Array.isArray(a)){const o=[...a];a.find(u=>u[0]==="sentry-trace")||o.push(["sentry-trace",i]);const c=a.find(u=>u[0]==="baggage"&&Bu(u[1]));return s&&!c&&o.push(["baggage",s]),o}else{const o="sentry-trace"in a?a["sentry-trace"]:void 0,c="baggage"in a?a.baggage:void 0,u=c?Array.isArray(c)?[...c]:[c]:[],l=c&&(Array.isArray(c)?c.find(d=>Bu(d)):Bu(c));return s&&!l&&u.push(s),{...a,"sentry-trace":o??i,baggage:u.length>0?u.join(","):void 0}}else return{...r}}function tF(t,e){var n,r;if(e.response){Io(t,e.response.status);const i=(r=(n=e.response)==null?void 0:n.headers)==null?void 0:r.get("content-length");if(i){const s=parseInt(i);s>0&&t.setAttribute("http.response_content_length",s)}}else e.error&&t.setStatus({code:Tt,message:"internal_error"});t.end()}function Bu(t){return t.split(",").some(e=>e.trim().startsWith(Ff))}function nF(t){return typeof Headers<"u"&&Br(t,Headers)}function rF(t,e,n){const r=tb(t);return{name:r?`${e} ${JR(r)}`:e,attributes:iF(t,r,e,n)}}function iF(t,e,n,r){const i={url:t,type:"fetch","http.method":n,[Ne]:r,[Pt]:"http.client"};return e&&(eb(e)||(i["http.url"]=e.href,i["server.address"]=e.host),e.search&&(i["http.query"]=e.search),e.hash&&(i["http.fragment"]=e.hash)),i}function rb(t,e={},n=Be()){const{message:r,name:i,email:s,url:a,source:o,associatedEventId:c,tags:u}=t,l={contexts:{feedback:{contact_email:s,name:i,message:r,url:a,source:o,associated_event_id:c}},type:"feedback",level:"info",tags:u},d=(n==null?void 0:n.getClient())||le();return d&&d.emit("beforeSendFeedback",l,e),n.captureEvent(l,e)}const sF="ConsoleLogs",ib={[Ne]:"auto.console.logging"},aF=((t={})=>{const e=t.levels||Af;return{name:sF,setup(n){const{enableLogs:r,_experiments:i,normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=n.getOptions();if(!(r??(i==null?void 0:i.enableLogs))){ae&&W.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}sh(({args:c,level:u})=>
26{if(le()!==n||!e.includes(u))return;if(u==="assert"){if(!c[0]){const d=c.slice(1),f=d.length>0?`Assertion failed: ${sb(d,s,a)}`:"Assertion failed";Jf({level:"error",message:f,attributes:ib})}return}const l=u==="log";Jf({level:l?"info":u,message:sb(c,s,a),severityNumber:l?10:void 0,attributes:ib})})}}});function sb(t,e,n){return"util"in Te&&typeof Te.util.format=="function"?Te.util.format(...t):oF(t,e,n)}function oF(t,e,n){return t.map(r=>Gs(r)?String(r):JSON.stringify(_n(r,e,n))).join(" ")}function ab(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const Js=Te;function cF(){return"history"in Js&&!!Js.history}function uF(){if(!("fetch"in Js))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function oh(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function ob(){var n;if(typeof EdgeRuntime=="string")return!0;if(!uF())return!1;if(oh(Js.fetch))return!0;let t=!1;const e=Js.document;if(e&&typeof e.createElement=="function")try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(t=oh(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){ae&&W.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function lF(){return"ReportingObserver"in Js}function ch(t,e){const n="fetch";hi(n,t),pi(n,()=>cb(void 0,e))}function dF(t){const e="fetch-body-resolved";hi(e,t),pi(e,()=>cb(hF))}function cb(t,e=!1){e&&!ob()||on(Te,"fetch",function(n){return function(...r){const i=new Error,{method:s,url:a}=pF(r),o={args:r,fetchData:{method:s,url:a},startTimestamp:mt()*1e3,virtualError:i,headers:mF(r)};return t||On("fetch",{...o}),n.apply(Te,r).then(async c=>(t?t(c):On("fetch",{...o,endTimestamp:mt()*1e3,response:c}),c),c=>{if(On("fetch",{...o,endTimestamp:mt()*1e3,error:c}),xr(c)&&c.stack===void 0&&(c.stack=i.stack,cn(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const u=new URL(o.fetchData.url);c.message=`${c.message} (${u.host})`}catch{}throw c})}})}async function fF(t,e){if(t!=null&&t.body){const n=t.body,r=n.getReader(),i=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let s=!0;for(;s;){let a;try{a=setTimeout(()=>{n.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(),n.cancel().then(null,()=>{})}}function hF(t){let e;try{e=t.clone()}catch{return}fF(e,()=>{On("fetch-body-resolved",{endTimestamp:mt()*1e3,response:t})})}function uh(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ub(t){return typeof t=="string"?t:t?uh(t,"url")?t.url:t.toString?t.toString():"":""}function pF(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:ub(n),method:uh(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:ub(e),method:uh(e,"method")?String(e.method).toUpperCase():"GET"}}function mF(t){const[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(ry(e))return new Headers(e.headers)}catch{}}function gF(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function AF(){return"npm"}function lh(){return!gF()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function dh(){return typeof window<"u"&&(!lh()||yF())}function yF(){const t=Te.process;return(t==null?void 0:t.type)==="renderer"}const lb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,tr=Te,it=tr.document,Po=tr.navigator,db="Report a Bug",wF="Cancel",bF="Send Bug Report",EF="Confirm",SF="Report a Bug",_F="[email protected]",TF="Email",kF="What's the bug? What did you expect?",IF="Description",CF="Your Name",xF="Name",vF="Thank you for your report!",BF="(required)",PF="Add a screenshot",RF="Remove screenshot",FF="widget",MF="api",DF=5e3,fb=(t,e={includeReplay:!0})=>{if(!t.message)throw new Error("Unable to submit feedback with empty message");const n=le();if(!n)throw new Error("No client setup, cannot send feedback.");t.tags&&Object.keys(t.tags).length&&Be().setTags(t.tags);const r=rb({source:MF,url:$i(),...t},e);return new Promise((i,s)=>{const a=setTimeout(()=>s("Unable to determine if Feedback was correctly sent."),3e4),o=n.on("afterSendEvent",(c,u)=>{if(c.event_id===r)return clearTimeout(a),o(),u&&typeof u.statusCode=="number"&&u.statusCode>=200&&u.statusCode<300?i(r):u&&typeof u.statusCode=="number"&&u.statusCode===0?s("Unable to send Feedback. This is because of network issues, or because you are using an ad-blocker."):u&&typeof u.statusCode=="number"&&u.statusCode===403?s("Unable to send Feedback. This could be because this domain is not in your list of allowed domains."):s("Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker")})})},Pu=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function OF(){return!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(Po.userAgent)||/Macintosh/i.test(Po.userAgent)&&Po.maxTouchPoints&&Po.maxTouchPoints>1||!isSecureContext)}function Ru(t,e){return{...t,...e,tags:{...t.tags,...e.tags},onFormOpen:()=>{var n,r;(n=e.onFormOpen)==null||n.call(e),(r=t.onFormOpen)==null||r.call(t)},onFormClose:()=>{var n,r;(n=e.onFormClose)==null||n.call(e),(r=t.onFormClose)==null||r.call(t)},onSubmitSuccess:(n,r)=>{var i,s;(i=e.onSubmitSuccess)==null||i.call(e,n,r),(s=t.onSubmitSuccess)==null||s.call(t,n,r)},onSubmitError:n=>{var r,i;(r=e.onSubmitError)==null||r.call(e,n),(i=t.onSubmitError)==null||i.call(t,n)},onFormSubmitted:()=>{var n,r;(n=e.onFormSubmitted)==null||n.call(e),(r=t.onFormSubmitted)==null||r.call(t)},themeDark:{...t.themeDark,...e.themeDark},themeLight:{...t.themeLight,...e.themeLight}}}function NF(t){const e=it.createElement("style");return e.textContent=`
27.widget__actor {
28  position: fixed;
29  z-index: var(--z-index);
30  margin: var(--page-margin);
31  inset: var(--actor-inset);
32
33  display: flex;
34  align-items: center;
35  gap: 8px;
36  padding: 16px;
37
38  font-family: inherit;
39  font-size: var(--font-size);
40  font-weight: 600;
41  line-height: 1.14em;
42  text-decoration: none;
43
44  background: var(--actor-background, var(--background));
45  border-radius: var(--actor-border-radius, 1.7em/50%);
46  border: var(--actor-border, var(--border));
47  box-shadow: var(--actor-box-shadow, var(--box-shadow));
48  color: var(--actor-color, var(--foreground));
49  fill: var(--actor-color, var(--foreground));
50  cursor: pointer;
51  opacity: 1;
52  transition: transform 0.2s ease-in-out;
53  transform: translate(0, 0) scale(1);
54}
55.widget__actor[aria-hidden="true"] {
56  opacity: 0;
57  pointer-events: none;
58  visibility: hidden;
59  transform: translate(0, 16px) scale(0.98);
60}
61
62.widget__actor:hover {
63  background: var(--actor-hover-background, var(--background));
64  filter: var(--interactive-filter);
65}
66
67.widget__actor svg {
68  width: 1.14em;
69  height: 1.14em;
70}
71
72@media (max-width: 600px) {
73  .widget__actor span {
74    display: none;
75  }
76}
77`,t&&e.setAttribute("nonce",t),e}function Tn(t,e){return Object.entries(e).forEach(([n,r])=>{t.setAttributeNS(null,n,r)}),t}const Zs=20,UF="http://www.w3.org/2000/svg";function LF(){const t=o=>tr.document.createElementNS(UF,o),e=Tn(t("svg"),{width:`${Zs}`,height:`${Zs}`,viewBox:`0 0 ${Zs} ${Zs}`,fill:"var(--actor-color, var(--foreground))"}),n=Tn(t("g"),{clipPath:"url(#clip0_57_80)"}),r=Tn(t("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z"});e.appendChild(n).appendChild(r);const i=t("defs"),s=Tn(t("clipPath"),{id:"clip0_57_80"}),a=Tn(t("rect"),{width:`${Zs}`,height:`${Zs}`,fill:"white"});return s.appendChild(a),i.appendChild(s),e.appendChild(i).appendChild(s).appendChild(a),e}function zF({triggerLabel:t,triggerAriaLabel:e,shadow:n,styleNonce:r}){const i=it.createElement("button");if(i.type="button",i.className="widget__actor",i.ariaHidden="false",i.ariaLabel=e||t||db,i.appendChild(LF()),t){const a=it.createElement("span");a.appendChild(it.createTextNode(t)),i.appendChild(a)}const s=NF(r);return{el:i,appendToDom(){n.appendChild(s),n.appendChild(i)},removeFromDom(){i.remove(),s.remove()},show(){i.ariaHidden="false"},hide(){i.ariaHidden="true"}}}const hb="rgba(88, 74, 192, 1)",QF={foreground:"#2b2233",background:"#ffffff",accentForeground:"white",accentBackgroun
77d:hb,successColor:"#268d75",errorColor:"#df3338",border:"1.5px solid rgba(41, 35, 47, 0.13)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(95%)"},pb={foreground:"#ebe6ef",background:"#29232f",accentForeground:"white",accentBackground:hb,successColor:"#2da98c",errorColor:"#f55459",border:"1.5px solid rgba(235, 230, 239, 0.15)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(150%)"};function mb(t){return`
78  --foreground: ${t.foreground};
79  --background: ${t.background};
80  --accent-foreground: ${t.accentForeground};
81  --accent-background: ${t.accentBackground};
82  --success-color: ${t.successColor};
83  --error-color: ${t.errorColor};
84  --border: ${t.border};
85  --box-shadow: ${t.boxShadow};
86  --outline: ${t.outline};
87  --interactive-filter: ${t.interactiveFilter};
88  `}function HF({colorScheme:t,themeDark:e,themeLight:n,styleNonce:r}){const i=it.createElement("style");return i.textContent=`
89:host {
90  --font-family: system-ui, 'Helvetica Neue', Arial, sans-serif;
91  --font-size: 14px;
92  --z-index: 100000;
93
94  --page-margin: 16px;
95  --inset: auto 0 0 auto;
96  --actor-inset: var(--inset);
97
98  font-family: var(--font-family);
99  font-size: var(--font-size);
100
101  ${t!=="system"?"color-scheme: only light;":""}
102
103  ${mb(t==="dark"?{...pb,...e}:{...QF,...n})}
104}
105
106${t==="system"?`
107@media (prefers-color-scheme: dark) {
108  :host {
109    ${mb({...pb,...e})}
110  }
111}`:""}
112}
113`,r&&i.setAttribute("nonce",r),i}const gb=({lazyLoadIntegration:t,getModalIntegration:e,getScreenshotIntegration:n})=>(({id:i="sentry-feedback",autoInject:s=!0,showBranding:a=!0,isEmailRequired:o=!1,isNameRequired:c=!1,showEmail:u=!0,showName:l=!0,enableScreenshot:d=!0,useSentryUser:f={email:"email",name:"username"},tags:h,styleNonce:m,scriptNonce:p,colorScheme:g="system",themeLight:A={},themeDark:y={},addScreenshotButtonLabel:w=PF,cancelButtonLabel:E=wF,confirmButtonLabel:S=EF,emailLabel:k=TF,emailPlaceholder:T=_F,formTitle:C=SF,isRequiredLabel:_=BF,messageLabel:x=IF,messagePlaceholder:P=kF,nameLabel:v=xF,namePlaceholder:M=CF,removeScreenshotButtonLabel:D=RF,submitButtonLabel:O=bF,successMessageText:N=vF,triggerLabel:Q=db,triggerAriaLabel:G="",onFormOpen:V,onFormClose:Z,onSubmitSuccess:B,onSubmitError:L,onFormSubmitted:K}={})=>{const q={id:i,autoInject:s,showBranding:a,isEmailRequired:o,isNameRequired:c,showEmail:u,showName:l,enableScreenshot:d,useSentryUser:f,tags:h,styleNonce:m,scriptNonce:p,colorScheme:g,themeDark:y,themeLight:A,triggerLabel:Q,triggerAriaLabel:G,cancelButtonLabel:E,submitButtonLabel:O,confirmButtonLabel:S,formTitle:C,emailLabel:k,emailPlaceholder:T,messageLabel:x,messagePlaceholder:P,nameLabel:v,namePlaceholder:M,successMessageText:N,isRequiredLabel:_,addScreenshotButtonLabel:w,removeScreenshotButtonLabel:D,onFormClose:Z,onFormOpen:V,onSubmitError:L,onSubmitSuccess:B,onFormSubmitted:K};let ne=null,fe=[];const Ae=ge=>{if(!ne){const xe=it.createElement("div");xe.id=String(ge.id),it.body.appendChild(xe),ne=xe.attachShadow({mode:"open"}),ne.appendChild(HF(ge))}return ne},ie=async ge=>{const xe=ge.enableScreenshot&&OF();let We,be;try{We=(e?e():await t("feedbackModalIntegration",p))(),jf(We)}catch{throw Pu&&W.error("[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`."),new Error("[Feedback] Missing feedback modal integration!")}try{const H=xe?n?n():await t("feedbackScreenshotIntegration",p):void 0;H&&(be=H(),jf(be))}catch{Pu&&W.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.")}const I=We.createDialog({options:{...ge,onFormClose:()=>{var H;I==null||I.close(),(H=ge.onFormClose)==null||H.call(ge)},onFormSubmitted:()=>{var H;I==null||I.close(),(H=ge.onFormSubmitted)==null||H.call(ge)}},screenshotIntegration:be,sendFeedback:fb,shadow:Ae(ge)});return I},ye=(ge,xe={})=>{const We=Ru(q,xe),be=typeof ge=="string"?it.querySelector(ge):typeof ge.addEventListener=="function"?ge:null;if(!be)throw Pu&&W.error("[Feedback] Unable to attach to target element"),new Error("Unable to attach to target element");let I=null;const H=async()=>{I||(I=await ie({...We,onFormSubmitted:()=>{var U;I==null||I.removeFromDom(),(U=We.onFormSubmitted)==null||U.call(We)}})),I.appendToDom(),I.open()};be.addEventListener("click",H);const F=()=>{fe=fe.filter(U=>U!==F),I==null||I.removeFromDom(),I=null,be.removeEventListener("click",H)};return fe.push(F),F},$e=(ge={})=>{const xe=Ru(q,ge),We=Ae(xe),be=zF({triggerLabel:xe.triggerLabel,triggerAriaLabel:xe.triggerAriaLabel,shadow:We,styleNonce:m});return ye(be.el,{...xe,onFormOpen(){be.hide()},onFormClose(){be.show()},onFormSubmitted(){be.show()}}),be};return{name:"Feedback",setupOnce(){!dh()||!q.autoInject||(it.readyState==="loading"?it.addEventListener("DOMContentLoaded",()=>$e().appendToDom()):$e().appendToDom())},attachTo:ye,createWidget(ge={}){const xe=$e(Ru(q,ge));return xe.appendToDom(),xe},async createForm(ge={}){return ie(Ru(q,ge))},remove(){var ge;ne&&((ge=ne.parentElement)==null||ge.remove(),ne=null),fe.forEach(xe=>xe()),fe=[]}}});function WF(){const t=le();return t==null?void 0:t.getIntegrationByName("Feedback")}var Fu,st,Ab,cs,yb,wb,fh,Ro={},hh=[],VF=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ph=Array.isArray;function bi(t,e){for(var n in e)t[n]=e[n];return t}function bb(t){var e=t.parentNode;e&&e.removeChild(t)}function Ue(t,e,n){var r,i,s,a={};for(s in e)s=="key"?r=e[s]:s=="ref"?i=e[s]:a[s]=e[s];if(arguments.length>2&&(a.children=arguments.length>3?Fu.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)a[s]===void 0&&(a[s]=t.defaultProps[s]);return Mu(t,a,r,i,null)}function Mu(t,e,n,r,i){var s={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Ab,__i:-1,__u:0};return i==null&&st.vnode!=null&&st.vnode(s),s}function Fo(t){return t.children}function Du(t,e){this.props=t,this.context=e}function ea(t,e){if(e==null)return t.__?ea(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?ea(t):null}function GF(t,e,n){var r,i=t.__v,s=i.__e,a=t.__P;if(a)return(r=bi({},i)).__v=i.__v+1,st.vnode&&st.vnode(r),mh(a,r,i,t.__n,a.ownerSVGElement!==void 0,32&i.__u?[s]:null,e,s??ea(i),!!(32&i.__u),n),r.__.__k[r.__i]=r,r.__d=void 0,r.__e!=s&&Eb(r),r}function Eb(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Eb(t)}}function Sb(t){(!t.__d&&(t.__d=!0)&&cs.push(t)&&!Ou.__r++||yb!==st.debounceRendering)&&((yb=st.debounceRendering)||wb)(Ou)}function Ou(){var t,e,n,r=[],i=[];for(cs.sort(fh);t=cs.shift();)t.__d&&(n=cs.length,e=GF(t,r,i)||e,n===0||cs.length>n?(gh(r,e,i),i.length=r.length=0,e=void 0,cs.sort(fh)):e&&st.__c&&st.__c(e,hh));e&&gh(r,e,i),Ou.__r=0}function _b(t,e,n,r,i,s,a,o,c,u,l){var d,f,h,m,p,g=r&&r.__k||hh,A=e.length;for(n.__d=c,qF(n,e,g),c=n.__d,d=0;d<A;d++)(h=n.__k[d])!=null&&typeof h!="boolean"&&typeof h!="function"&&(f=h.__i===-1?Ro:g[h.__i]||Ro,h.__i=d,mh(t,h,f,i,s,a,o,c,u,l),m=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Ah(f.ref,null,h),l.push(h.ref,h.__c||m,h)),p==null&&m!=null&&(p=m),65536&h.__u||f.__k===h.__k?c=Tb(h,c,t):typeof h.type=="function"&&h.__d!==void 0?c=h.__d:m&&(c=m.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=c,n.__e=p}function qF(t,e,n){var r,i,s,a,o,c=e.length,u=n.length,l=u,d=0;for(t.__k=[],r=0;r<c;r++)(i=t.__k[r]=(i=e[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?Mu(null,i,null,null,i):ph(i)?Mu(Fo,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?Mu(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=t,i.__b=t.__b+1,o=YF(i,n,a=r+d,l),i.__i=o,s=null,o!==-1&&(l--,(s=n[o])&&(s.__u|=131072)),s==null||s.__v===null?(o==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):o!==a&&(o===a+1?d++:o>a?l>
vendor: 2,332 bytes, line 113
113c-a?d+=o-a:d--:d=o<a&&o==a-1?o-a:0,o!==r+d&&(i.__u|=65536))):(s=n[r])&&s.key==null&&s.__e&&(s.__e==t.__d&&(t.__d=ea(s)),yh(s,s,!1),n[r]=null,l--);if(l)for(r=0;r<u;r++)(s=n[r])!=null&&(131072&s.__u)==0&&(s.__e==t.__d&&(t.__d=ea(s)),yh(s,s))}function Tb(t,e,n){var r,i;if(typeof t.type=="function"){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=Tb(r[i],e,n));return e}t.__e!=e&&(n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType===8);return e}function YF(t,e,n,r){var i=t.key,s=t.type,a=n-1,o=n+1,c=e[n];if(c===null||c&&i==c.key&&s===c.type)return n;if(r>(c!=null&&(131072&c.__u)==0?1:0))for(;a>=0||o<e.length;){if(a>=0){if((c=e[a])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return a;a--}if(o<e.length){if((c=e[o])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return o;o++}}return-1}function kb(t,e,n){e[0]==="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||VF.test(e)?n:n+"px"}function Nu(t,e,n,r,i){var s;e:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||kb(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||kb(t.style,e,n[e])}else if(e[0]==="o"&&e[1]==="n")s=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?r?n.u=r.u:(n.u=Date.now(),t.addEventListener(e,s?Cb:Ib,s)):t.removeEventListener(e,s?Cb:Ib,s);else{if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!=="-"?t.removeAttribute(e):t.setAttribute(e,n))}}function Ib(t){if(this.l){var e=this.l[t.type+!1];if(t.t){if(t.t<=e.u)return}else t.t=Date.now();return e(st.event?st.event(t):t)}}function Cb(t){if(this.l)return this.l[t.type+!0](st.event?st.event(t):t)}function mh(t,e,n,r,i,s,a,o,c,u){var l,d,f,h,m,p,g,A,y,w,E,S,k,T,C,_=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),s=[o=e.__e=n.__e]),(l=st.__b)&&l(e);e:if(typeof _=="function")try{if(A=e.props,y=(l=_.contextType)&&r[l.__c],w=l?y?y.props.value:l.__:r,n.__c?g=(d=e.__c=n.__c).__=d.__E:("prototype"in _&&_.prototype.render?e.__c=d=new _(A,w
vendor: 4,760 bytes, line 113
113):(e.__c=d=new Du(A,w),d.constructor=_,d.render=jF),y&&y.sub(d),d.props=A,d.state||(d.state={}),d.context=w,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),d.__s==null&&(d.__s=d.state),_.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=bi({},d.__s)),bi(d.__s,_.getDerivedStateFromProps(A,d.__s))),h=d.props,m=d.state,d.__v=e,f)_.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(_.getDerivedStateFromProps==null&&A!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(A,w),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(A,d.__s,w)===!1||e.__v===n.__v)){for(e.__v!==n.__v&&(d.props=A,d.state=d.__s,d.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function(x){x&&(x.__=e)}),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(A,d.__s,w),d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,m,p)})}if(d.context=w,d.props=A,d.__P=t,d.__e=!1,S=st.__r,k=0,"prototype"in _&&_.prototype.render){for(d.state=d.__s,d.__d=!1,S&&S(e),l=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do d.__d=!1,S&&S(e),l=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++k<25);d.state=d.__s,d.getChildContext!=null&&(r=bi(bi({},r),d.getChildContext())),f||d.getSnapshotBeforeUpdate==null||(p=d.getSnapshotBeforeUpdate(h,m)),_b(t,ph(C=l!=null&&l.type===Fo&&l.key==null?l.props.children:l)?C:[C],e,n,r,i,s,a,o,c,u),d.base=e.__e,e.__u&=-161,d.__h.length&&a.push(d),g&&(d.__E=d.__=null)}catch(x){e.__v=null,c||s!=null?(e.__e=o,e.__u|=c?160:32,s[s.indexOf(o)]=null):(e.__e=n.__e,e.__k=n.__k),st.__e(x,e,n)}else s==null&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=KF(n.__e,e,n,r,i,s,a,c,u);(l=st.diffed)&&l(e)}function gh(t,e,n){for(var r=0;r<n.length;r++)Ah(n[r],n[++r],n[++r]);st.__c&&st.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){st.__e(s,i.__v)}})}function KF(t,e,n,r,i,s,a,o,c){var u,l,d,f,h,m,p,g=n.props,A=e.props,y=e.type;if(y==="svg"&&(i=!0),s!=null){for(u=0;u<s.length;u++)if((h=s[u])&&"setAttribute"in h==!!y&&(y?h.localName===y:h.nodeType===3)){t=h,s[u]=null;break}}if(t==null){if(y===null)return document.createTextNode(A);t=i?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,A.is&&A),s=null,o=!1}if(y===null)g===A||o&&t.data===A||(t.data=A);else{if(s=s&&Fu.call(t.childNodes),g=n.props||Ro,!o&&s!=null)for(g={},u=0;u<t.attributes.length;u++)g[(h=t.attributes[u]).name]=h.value;for(u in g)h=g[u],u=="children"||(u=="dangerouslySetInnerHTML"?d=h:u==="key"||u in A||Nu(t,u,null,h,i));for(u in A)h=A[u],u=="children"?f=h:u=="dangerouslySetInnerHTML"?l=h:u=="value"?m=h:u=="checked"?p=h:u==="key"||o&&typeof h!="function"||g[u]===h||Nu(t,u,h,g[u],i);if(l)o||d&&(l.__html===d.__html||l.__html===t.innerHTML)||(t.innerHTML=l.__html),e.__k=[];else if(d&&(t.innerHTML=""),_b(t,ph(f)?f:[f],e,n,r,i&&y!=="foreignObject",s,a,s?s[0]:n.__k&&ea(n,0),o,c),s!=null)for(u=s.length;u--;)s[u]!=null&&bb(s[u]);o||(u="value",m!==void 0&&(m!==t[u]||y==="progress"&&!m||y==="option"&&m!==g[u])&&Nu(t,u,m,g[u],!1),u="checked",p!==void 0&&p!==t[u]&&Nu(t,u,p,g[u],!1))}return t}function Ah(t,e,n){try{typeof t=="function"?t(e):t.current=e}catch(r){st.__e(r,n)}}function yh(t,e,n){var r,i;if(st.unmount&&st.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||Ah(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){st.__e(s,e)}r.base=r.__P=null,t.__c=void 0}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&yh(r[i],e,n||typeof t.type!="function");n||t.__e==null||bb(t.__e),t.__=t.__e=t.__d=void 0}function jF(t,e,n){return this.constructor(t,n)}function $F(t,e,n){var r,i,s,a;st.__&&st.__(t,e),i=(r=!1)?null:e.__k,s=[],a=[],mh(e,t=e.__k=Ue(Fo,null,[t]),i||Ro,Ro,e.ownerSVGElement!==void 0,i?null:e.firstChild?Fu.call(e.childNodes):null,s,i?i.__e:e.firstChild,r,a),t.__d=void 0,gh(s,t,a)}Fu=hh.slice,st={__e:function(t,e,n,r){for(var i,s,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(o){t=o}throw t}},Ab=0,Du.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=bi({},this.state),typeof t=="function"&&(t=t(bi({},n),this.props)),t&&bi(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),Sb(this))},Du.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Sb(this))},Du.prototype.render=Fo,cs=[],wb=typeof Promise=="function"?Promise.prototype.then.bind(Prom
113ise.resolve()):setTimeout,fh=function(t,e){return t.__v.__b-e.__v.__b},Ou.__r=0;var Or,at,wh,xb,ta=0,vb=[],Uu=[],St=st,Bb=St.__b,Pb=St.__r,Rb=St.diffed,Fb=St.__c,Mb=St.unmount,Db=St.__;function us(t,e){St.__h&&St.__h(at,t,ta||e),ta=0;var n=at.__H||(at.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({__V:Uu}),n.__[t]}function ls(t){return ta=1,Ob(Lb,t)}function Ob(t,e,n){var r=us(Or++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Lb(void 0,e),function(o){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,o);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=at,!at.u)){var i=function(o,c,u){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(f){return!!f.__c});if(l.every(function(f){return!f.__N}))return!s||s.call(this,o,c,u);var d=!1;return l.forEach(function(f){if(f.__N){var h=f.__[0];f.__=f.__N,f.__N=void 0,h!==f.__[0]&&(d=!0)}}),!(!d&&r.__c.props===o)&&(!s||s.call(this,o,c,u))};at.u=!0;var s=at.shouldComponentUpdate,a=at.componentWillUpdate;at.componentWillUpdate=function(o,c,u){if(this.__e){var l=s;s=void 0,i(o,c,u),s=l}a&&a.call(this,o,c,u)},at.shouldComponentUpdate=i}return r.__N||r.__}function XF(t,e){var n=us(Or++,3);!St.__s&&Eh(n.__H,e)&&(n.__=t,n.i=e,at.__H.__h.push(n))}function Nb(t,e){var n=us(Or++,4);!St.__s&&Eh(n.__H,e)&&(n.__=t,n.i=e,at.__h.push(n))}function JF(t){return ta=5,Mo(function(){return{current:t}},[])}function ZF(t,e,n){ta=6,Nb(function(){return typeof t=="function"?(t(e()),function(){return t(null)}):t?(t.current=e(),function(){return t.current=null}):void 0},n==null?n:n.concat(t))}function Mo(t,e){var n=us(Or++,7);return Eh(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function na(t,e){return ta=8,Mo(function(){return t},e)}function eM(t){var e=at.context[t.__c],n=us(Or++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(at)),e.props.value):t.__}function tM(t,e){St.useDebugValue&&St.useDebugValue(e?e(t):t)}function nM(t){var e=us(Or++,10),n=ls();return e.__=t,at.componentDidCatch||(at.componentDidCatch=function(r,i){e.__&&e.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function rM(){var t=us(Or++,11);if(!t.__){for(var e=at.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var n=e.__m||(e.__m=[0,0]);t.__="P"+n[0]+"-"+n[1]++}return t.__}function iM(){for(var t;t=vb.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Lu),t.__H.__h.forEach(bh),t.__H.__h=[]}catch(e){t.__H.__h=[],St.__e(e,t.__v)}}St.__b=function(t){at=null,Bb&&Bb(t)},St.__=function(t,e){e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Db&&Db(t,e)},St.__r=function(t){Pb&&Pb(t),Or=0;var e=(at=t.__c).__H;e&&(wh===at?(e.__h=[],at.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=Uu,n.__N=n.i=void 0})):(e.__h.forEach(Lu),e.__h.forEach(bh),e.__h=[],Or=0)),wh=at},St.diffed=function(t){Rb&&Rb(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(vb.push(e)!==1&&xb===St.requestAnimationFrame||((xb=St.requestAnimationFrame)||sM)(iM)),e.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==Uu&&(n.__=n.__V),n.i=void 0,n.__V=Uu})),wh=at=null},St.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Lu),n.__h=n.__h.filter(function(r){return!r.__||bh(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],St.__e(r,n.__v)}}),Fb&&Fb(t,e)},St.unmount=function(t){Mb&&Mb(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Lu(r)}catch(i){e=i}}),n.__H=void 0,e&&St.__e(e,n.__v))};var Ub=typeof requestAnimationFrame=="function";function sM(t){var e,n=function(){clearTimeout(r),Ub&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);Ub&&(e=requestAnimationFrame(n))}function Lu(t){var e=at,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),at=e}function bh(t){var e=at;t.__c=t.__(),at=e}function Eh(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Lb(t,e){return typeof e=="function"?e(t):e}const aM=Object.defineProperty({__proto__:null,useCallback:na,useContext:eM,useDebugValue:tM,useEffect:XF,useErrorBoundary:nM,useId:rM,useImperativeHandle:ZF,useLayoutEffect:Nb,useMemo:Mo,useReducer:Ob,useRef:JF,useState:ls},Symbol.toStringTag,{value:"Module"}),oM="http://www.w3.org/2000/svg";function cM(){const t=r=>it.createElementNS(oM,r),e=Tn(t("svg"),{width:"32",height:"30",viewBox:"0 0 72 66",fill:"inherit"}),n=Tn(t("path"),{transform:"translate(11, 11)",d:"M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"});return e.appendChild(n),e}function uM({options:t}){const e=Mo(()=>({__html:cM().outerHTML}),[]);return Ue("h2",{class:"dialog__header"},Ue("span",{class:"dialog__title"},t.formTitle),t.showBranding?Ue("a",{class:"brand-link",target:"_blank",href:"https://sentry.io/welcome/",title:"Powered by Sentry",rel:"noopener noreferrer",dangerouslySetInnerHTML:e}):null)}function lM(t,e){const n=[];return e.isNameRequired&&!t.name&&n.push(e.nameLabel),e.isEmailRequired&&!t.email&&n.push(e.emailLabel),t.message||n.push(e.messageLabel),n}function Sh(t,e){const n=t.get(e);return typeof n=="string"?n.trim():""}function dM({options:t,defaultEmail:e,defaultName:n,onFormClose:r,onSubmit:i,onSubmitSuccess:s,onSubmitError:a,showEmail
113:o,showName:c,screenshotInput:u}){const{tags:l,addScreenshotButtonLabel:d,removeScreenshotButtonLabel:f,cancelButtonLabel:h,emailLabel:m,emailPlaceholder:p,isEmailRequired:g,isNameRequired:A,messageLabel:y,messagePlaceholder:w,nameLabel:E,namePlaceholder:S,submitButtonLabel:k,isRequiredLabel:T}=t,[C,_]=ls(!1),[x,P]=ls(null),[v,M]=ls(!1),D=u==null?void 0:u.input,[O,N]=ls(null),Q=na(Z=>{N(Z),M(!1)},[]),G=na(Z=>{const B=lM(Z,{emailLabel:m,isEmailRequired:g,isNameRequired:A,messageLabel:y,nameLabel:E});return B.length>0?P(`Please enter in the following required fields: ${B.join(", ")}`):P(null),B.length===0},[m,g,A,y,E]),V=na(async Z=>{_(!0);try{if(Z.preventDefault(),!(Z.target instanceof HTMLFormElement))return;const B=new FormData(Z.target),L=await(u&&v?u.value():void 0),K={name:Sh(B,"name"),email:Sh(B,"email"),message:Sh(B,"message"),attachments:L?[L]:void 0};if(!G(K))return;try{const q=await i({name:K.name,email:K.email,message:K.message,source:FF,tags:l},{attachments:K.attachments});s(K,q)}catch(q){Pu&&W.error(q),P(q),a(q)}}finally{_(!1)}},[u&&v,s,a]);return Ue("form",{class:"form",onSubmit:V},D&&v?Ue(D,{onError:Q}):null,Ue("fieldset",{class:"form__right","data-sentry-feedback":!0,disabled:C},Ue("div",{class:"form__top"},x?Ue("div",{class:"form__error-container"},x):null,c?Ue("label",{for:"name",class:"form__label"},Ue(_h,{label:E,isRequiredLabel:T,isRequired:A}),Ue("input",{class:"form__input",defaultValue:n,id:"name",name:"name",placeholder:S,required:A,type:"text"})):Ue("input",{"aria-hidden":!0,value:n,name:"name",type:"hidden"}),o?Ue("label",{for:"email",class:"form__label"},Ue(_h,{label:m,isRequiredLabel:T,isRequired:g}),Ue("input",{class:"form__input",defaultValue:e,id:"email",name:"email",placeholder:p,required:g,type:"email"})):Ue("input",{"aria-hidden":!0,value:e,name:"email",type:"hidden"}),Ue("label",{for:"message",class:"form__label"},Ue(_h,{label:y,isRequiredLabel:T,isRequired:!0}),Ue("textarea",{autoFocus:!0,class:"form__input form__input--textarea",id:"message",name:"message",placeholder:w,required:!0,rows:5})),D?Ue("label",{for:"screenshot",class:"form__label"},Ue("button",{class:"btn btn--default",disabled:C,type:"button",onClick:()=>{N(null),M(Z=>!Z)}},v?f:d),O?Ue("div",{class:"form__error-container"},O.message):null):null),Ue("div",{class:"btn-group"},Ue("button",{class:"btn btn--primary",disabled:C,type:"submit"},k),Ue("button",{class:"btn btn--default",disabled:C,type:"button",onClick:r},h))))}function _h({label:t,isRequired:e,isRequiredLabel:n}){return Ue("span",{class:"form__label__text"},t,e&&Ue("span",{class:"form__label__text--required"},n))}const zu=16,zb=17,fM="http://www.w3.org/2000/svg";function hM(){const t=c=>tr.document.createElementNS(fM,c),e=Tn(t("svg"),{width:`${zu}`,height:`${zb}`,viewBox:`0 0 ${zu} ${zb}`,fill:"inherit"}),n=Tn(t("g"),{clipPath:"url(#clip0_57_156)"}),r=Tn(t("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z"}),i=Tn(t("path"),{d:"M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 
11310.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z"});e.appendChild(n).append(i,r);const s=t("defs"),a=Tn(t("clipPath"),{id:"clip0_57_156"}),o=Tn(t("rect"),{width:`${zu}`,height:`${zu}`,fill:"white",transform:"translate(0 0.5)"});return a.appendChild(o),s.appendChild(a),e.appendChild(s).appendChild(a).appendChild(o),e}function pM({open:t,onFormSubmitted:e,...n}){const r=n.options,i=Mo(()=>({__html:hM().outerHTML}),[]),[s,a]=ls(null),o=na(()=>{s&&(clearTimeout(s),a(null)),e()},[s]),c=na((u,l)=>{n.onSubmitSuccess(u,l),a(setTimeout(()=>{e(),a(null)},DF))},[e]);return Ue(Fo,null,s?Ue("div",{class:"success__position",onClick:o},Ue("div",{class:"success__content"},r.successMessageText,Ue("span",{class:"success__icon",dangerouslySetInnerHTML:i}))):Ue("dialog",{class:"dialog",onClick:r.onFormClose,open:t},Ue("div",{class:"dialog__position"},Ue("div",{class:"dialog__content",onClick:u=>{u.stopPropagation()}},Ue(uM,{options:r}),Ue(dM,{...n,onSubmitSuccess:c})))))}const mM=`
114.dialog {
115  position: fixed;
116  z-index: var(--z-index);
117  margin: 0;
118  inset: 0;
119
120  display: flex;
121  align-items: center;
122  justify-content: center;
123  padding: 0;
124  height: 100vh;
125  width: 100vw;
126
127  color: var(--dialog-color, var(--foreground));
128  fill: var(--dialog-color, var(--foreground));
129  line-height: 1.75em;
130
131  background-color: rgba(0, 0, 0, 0.05);
132  border: none;
133  inset: 0;
134  opacity: 1;
135  transition: opacity 0.2s ease-in-out;
136}
137
138.dialog__position {
139  position: fixed;
140  z-index: var(--z-index);
141  inset: var(--dialog-inset);
142  padding: var(--page-margin);
143  display: flex;
144  max-height: calc(100vh - (2 * var(--page-margin)));
145}
146@media (max-width: 600px) {
147  .dialog__position {
148    inset: var(--page-margin);
149    padding: 0;
150  }
151}
152
153.dialog__position:has(.editor) {
154  inset: var(--page-margin);
155  padding: 0;
156}
157
158.dialog:not([open]) {
159  opacity: 0;
160  pointer-events: none;
161  visibility: hidden;
162}
163.dialog:not([open]) .dialog__content {
164  transform: translate(0, -16px) scale(0.98);
165}
166
167.dialog__content {
168  display: flex;
169  flex-direction: column;
170  gap: 16px;
171  padding: var(--dialog-padding, 24px);
172  max-width: 100%;
173  width: 100%;
174  max-height: 100%;
175  overflow: auto;
176
177  background: var(--dialog-background, var(--background));
178  border-radius: var(--dialog-border-radius, 20px);
179  border: var(--dialog-border, var(--border));
180  box-shadow: var(--dialog-box-shadow, var(--box-shadow));
181  transform: translate(0, 0) scale(1);
182  transition: transform 0.2s ease-in-out;
183}
184
185`,gM=`
186.dialog__header {
187  display: flex;
188  gap: 4px;
189  justify-content: space-between;
190  font-weight: var(--dialog-header-weight, 600);
191  margin: 0;
192}
193.dialog__title {
194  align-self: center;
195  width: var(--form-width, 272px);
196}
197
198@media (max-width: 600px) {
199  .dialog__title {
200    width: auto;
201  }
202}
203
204.dialog__position:has(.editor) .dialog__title {
205  width: auto;
206}
207
208
209.brand-link {
210  display: inline-flex;
211}
212.brand-link:focus-visible {
213  outline: var(--outline);
214}
215`,AM=`
216.form {
217  display: flex;
218  overflow: auto;
219  flex-direction: row;
220  gap: 16px;
221  flex: 1 0;
222}
223
224.form fieldset {
225  border: none;
226  margin: 0;
227  padding: 0;
228}
229
230.form__right {
231  flex: 0 0 auto;
232  display: flex;
233  overflow: auto;
234  flex-direction: column;
235  justify-content: space-between;
236  gap: 20px;
237  width: var(--form-width, 100%);
238}
239
240.dialog__position:has(.editor) .form__right {
241  width: var(--form-width, 272px);
242}
243
244.form__top {
245  display: flex;
246  flex-direction: column;
247  gap: 8px;
248}
249
250.form__error-container {
251  color: var(--error-color);
252  fill: var(--error-color);
253}
254
255.form__label {
256  display: flex;
257  flex-direction: column;
258  gap: 4px;
259  margin: 0px;
260}
261
262.form__label__text {
263  display: flex;
264  gap: 4px;
265  align-items: center;
266}
267
268.form__label__text--required {
269  font-size: 0.85em;
270}
271
272.form__input {
273  font-family: inherit;
274  line-height: inherit;
275  background: transparent;
276  box-sizing: border-box;
277  border: var(--input-border, var(--border));
278  border-radius: var(--input-border-radius, 6px);
279  color: var(--input-color, inherit);
280  fill: var(--input-color, inherit);
281  font-size: var(--input-font-size, inherit);
282  font-weight: var(--input-font-weight, 500);
283  padding: 6px 12px;
284}
285
286.form__input::placeholder {
287  opacity: 0.65;
288  color: var(--input-placeholder-color, inherit);
289  filter: var(--interactive-filter);
290}
291
292.form__input:focus-visible {
293  outline: var(--input-focus-outline, var(--outline));
294}
295
296.form__input--textarea {
297  font-family: inherit;
298  resize: vertical;
299}
300
301.error {
302  color: var(--error-color);
303  fill: var(--error-color);
304}
305`,yM=`
306.btn-group {
307  display: grid;
308  gap: 8px;
309}
310
311.btn {
312  line-height: inherit;
313  border: var(--button-border, var(--border));
314  border-radius: var(--button-border-radius, 6px);
315  cursor: pointer;
316  font-family: inherit;
317  font-size: var(--button-font-size, inherit);
318  font-weight: var(--button-font-weight, 600);
319  padding: var(--button-padding, 6px 16px);
320}
321.btn[disabled] {
322  opacity: 0.6;
323  pointer-events: none;
324}
325
326.btn--primary {
327  color: var(--button-primary-color, var(--accent-foreground));
328  fill: var(--button-primary-color, var(--accent-foreground));
329  background: var(--button-primary-background, var(--accent-background));
330  border: var(--button-primary-border, var(--border));
331  border-radius: var(--button-primary-border-radius, 6px);
332  font-weight: var(--button-primary-font-weight, 500);
333}
334.btn--primary:hover {
335  color: var(--button-primary-hover-color, var(--accent-foreground));
336  fill: var(--button-primary-hover-color, var(--accent-foreground));
337  background: var(--button-primary-hover-background, var(--accent-background));
338  filter: var(--interactive-filter);
339}
340.btn--primary:focus-visible {
341  background: var(--button-primary-hover-background, var(--accent-background));
342  filter: var(--interactive-filter);
343  outline: var(--button-primary-focus-outline, var(--outline));
344}
345
346.btn--default {
347  color: var(--button-color, var(--foreground));
348  fill: var(--button-color, var(--foreground));
349  background: var(--button-background, var(--background));
350  border: var(--button-border, var(--border));
351  border-radius: var(--button-border-radius, 6px);
352  font-weight: var(--button-font-weight, 500);
353}
354.btn--default:hover {
355  color: var(--button-color, var(--foreground));
356  fill: var(--button-color, var(--foreground));
357  background: var(--button-hover-background, var(--background));
358  filter: var(--interactive-filter);
359}
360.btn--default:focus-visible {
361  background: var(--button-hover-background, var(--background));
362  filter: var(--interactive-filter);
363  outline: var(--button-focus-outline, var(--outline));
364}
365`,wM=`
366.success__position {
367  position: fixed;
368  inset: var(--dialog-inset);
369  padding: var(--page-margin);
370  z-index: var(--z-index);
371}
372.success__content {
373  background: var(--success-background, var(--background));
374  border: var(--success-border, var(--border));
375  border-radius: var(--success-border-radius, 1.7em/50%);
376  box-shadow: var(--success-box-shadow, var(--box-shadow));
377  font-weight: var(--success-font-weight, 600);
378  color: var(--success-color);
379  fill: var(--success-color);
380  padding: 12px 24px;
381  line-height: 1.75em;
382
383  display: grid;
384  align-items: center;
385  grid-auto-flow: column;
386  gap: 6px;
387  cursor: default;
388}
389
390.success__icon {
391  display: flex;
392}
393`;function bM(t){const e=it.createElement("style");return e.textContent=`
394:host {
395  --dialog-inset: var(--inset);
396}
397
398${mM}
399${gM}
400${AM}
401${yM}
402${wM}
403`,t&&e.setAttribute("nonce",t),e}function EM(){const t=Be().getUser(),e=Qt().getUser(),n=_o().getUser();return t&&Object.keys(t).length?t:e&&Object.keys(e).length?e:n}const SM=(()=>({name:"FeedbackModal",setupOnce(){},createDialog:({options:t,screenshotIntegration:e,sendFeedback:n,shadow:r})=>{const i=r,s=t.useSentryUser,a=EM(),o=it.createElement("div"),c=bM(t.styleNonce);let u="";const l={get el(){return o},appendToDom(){!i.contains(c)&&!i.contains(o)&&(i.appendChild(c),i.appendChild(o))},removeFromDom(){o.remove(),c.remove(),it.body.style.overflow=u},open(){var h,m;f(!0),(h=t.onFormOpen)==null||h.call(t),(m=le())==null||m.emit("openFeedbackWidget"),u=it.body.style.overflow,it.body.style.overflow="hidden"},close(){f(!1),it.body.style.overflow=u}},d=e==null?void 0:e.createInput({h:Ue,hooks:aM,dialog:l,options:t}),f=h=>{$F(Ue(pM,{options:t,screenshotInput:d,showName:t.showName||t.isNameRequired,showEmail:t.showEmail||t.isEmailRequired,defaultName:s&&(a==null?void 0:a[s.name])||"",defaultEmail:s&&(a==null?void 0:a[s.email])||"",onFormClose:()=>{var m;f(!1),(m=t.onFormClose)==null||m.call(t)},onSubmit:n,onSubmitSuccess:(m,p)=>{var g;f(!1),(g=t.onSubmitSuccess)==null||g.call(t,m,p)},onSubmitError:m=>{var p;(p=t.onSubmitError)==null||p.call(t,m)},onFormSubmitted:()=>{var m;(m=t.onFormSubmitted)==null||m.call(t)},open:h}),o)};return l}}));function _M({h:t}){return function(){return t("svg",{"data-test-id":"icon-close",viewBox:"0 0 16 16",fill:"#2B2233",height:"25px",width:"25px"},t("circle",{r:"7",cx:"8",cy:"8",fill:"white"}),t("path",{strokeWidth:"1.5",d:"M8,16a8,8,0,1,1,8-8A8,8,0,0,1,8,16ZM8,1.53A6.47,6.47,0,1,0,14.47,8,6.47,6.47,0,0,0,8,1.53Z"}),t("path",{strokeWidth:"1.5",d:"M5.34,11.41a.71.71,0,0,1-.53-.22.74.74,0,0,1,0-1.06l5.32-5.32a.75.75,0,0,1,1.06,1.06L5.87,11.19A.74.74,0,0,1,5.34,11.41Z"}),t("path",{strokeWidth:"1.5",d:"M10.66,11.41a.74.74,0,0,1-.53-.22L4.81,5.87A.75.75,0,0,1,5.87,4.81l5.32,5.32a.74.74,0,0,1,0,1.06A.71.71,0,0,1,10.66,11.41Z"}))}}function TM(t){const e=it.createElement("style"),n="#1A141F",r="#302735";return e.textContent=`
404.editor {
405  display: flex;
406  flex-grow: 1;
407  flex-direction: column;
408}
409
410.editor__image-container {
411  justify-items: center;
412  padding: 15px;
413  position: relative;
414  height: 100%;
415  border-radius: var(--menu-border-radius, 6px);
416
417  background-color: ${n};
418  background-image: repeating-linear-gradient(
419      -145deg,
420      transparent,
421      transparent 8px,
422      ${n} 8px,
423      ${n} 11px
424    ),
425    repeating-linear-gradient(
426      -45deg,
427      transparent,
428      transparent 15px,
429      ${r} 15px,
430      ${r} 16px
431    );
432}
433
434.editor__canvas-container {
435  width: 100%;
436  height: 100%;
437  position: relative;
438  display: flex;
439  align-items: center;
440  justify-content: center;
441}
442
443.editor__canvas-container > * {
444  object-fit: contain;
445  position: absolute;
446}
447
448.editor__tool-container {
449  padding-top: 8px;
450  display: flex;
451  justify-content: center;
452}
453
454.editor__tool-bar {
455  display: flex;
456  gap: 8px;
457}
458
459.editor__tool {
460  display: flex;
461  padding: 8px 12px;
462  justify-content: center;
463  align-items: center;
464  border: var(--button-border, var(--border));
465  border-radius: var(--button-border-radius, 6px);
466  background: var(--button-background, var(--background));
467  color: var(--button-color, var(--foreground));
468}
469
470.editor__tool--active {
471  background: var(--button-primary-background, var(--accent-background));
472  color: var(--button-primary-color, var(--accent-foreground));
473}
474
475.editor__rect {
476  position: absolute;
477  z-index: 2;
478}
479
480.editor__rect button {
481  opacity: 0;
482  position: absolute;
483  top: -12px;
484  right: -12px;
485  cursor: pointer;
486  padding: 0;
487  z-index: 3;
488  border: none;
489  background: none;
490}
491
492.editor__rect:hover button {
493  opacity: 1;
494}
495`,t&&e.setAttribute("nonce",t),e}function kM({h:t}){return function({action:n,setAction:r}){return t("div",{class:"editor__tool-container"},t("div",{class:"editor__tool-bar"},t("button",{type:"button",class:`editor__tool ${n==="highlight"?"editor__tool--active":""}`,onClick:()=>{r(n==="highlight"?"":"highlight")}},"Highlight"),t("button",{type:"button",class:`editor__tool ${n==="hide"?"editor__tool--active":""}`,onClick:()=>{r(n==="hide"?"":"hide")}},"Hide")))}}function IM({hooks:t}){function e(){const[n,r]=t.useState(tr.devicePixelRatio??1);return t.useEffect(()=>{const i=()=>{r(tr.devicePixelRatio)},s=matchMedia(`(resolution: ${tr.devicePixelRatio}dppx)`);
495return s.addEventListener("change",i),()=>{s.removeEventListener("change",i)}},[]),n}return function({onBeforeScreenshot:r,onScreenshot:i,onAfterScreenshot:s,onError:a}){const o=e();t.useEffect(()=>{(async()=>{r();const u=await Po.mediaDevices.getDisplayMedia({video:{width:tr.innerWidth*o,height:tr.innerHeight*o},audio:!1,monitorTypeSurfaces:"exclude",preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"}),l=it.createElement("video");await new Promise((d,f)=>{l.srcObject=u,l.onloadedmetadata=()=>{i(l,o),u.getTracks().forEach(h=>h.stop()),d()},l.play().catch(f)}),s()})().catch(a)},[])}}function CM(t,e,n){switch(t.type){case"highlight":{e.shadowColor="rgba(0, 0, 0, 0.7)",e.shadowBlur=50,e.fillStyle=n,e.fillRect(t.x-1,t.y-1,t.w+2,t.h+2),e.clearRect(t.x,t.y,t.w,t.h);break}case"hide":e.fillStyle="rgb(0, 0, 0)",e.fillRect(t.x,t.y,t.w,t.h);break}}function Ei(t,e,n){if(!t)return;const r=t.getContext("2d",e);r&&n(t,r)}function Th(t,e){Ei(t,{alpha:!0},(n,r)=>{r.drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height)})}function kh(t,e,n){Ei(t,{alpha:!0},(r,i)=>{n.length&&(i.fillStyle="rgba(0, 0, 0, 0.25)",i.fillRect(0,0,r.width,r.height)),n.forEach(s=>{CM(s,i,e)})})}function xM({h:t,hooks:e,outputBuffer:n,dialog:r,options:i}){const s=IM({hooks:e}),a=kM({h:t}),o=_M({h:t}),c={__html:TM(i.styleNonce).innerText},u=r.el.style,l=({screenshot:d})=>{const[f,h]=e.useState("highlight"),[m,p]=e.useState([]),g=e.useRef(null),A=e.useRef(null),y=e.useRef(null),w=e.useRef(null),[E,S]=e.useState(1),k=e.useMemo(()=>{const v=it.getElementById(i.id);if(!v)return"white";const M=getComputedStyle(v);return M.getPropertyValue("--button-primary-background")||M.getPropertyValue("--accent-background")},[i.id]);e.useLayoutEffect(()=>{const v=()=>{const M=g.current;M&&(Ei(d.canvas,{alpha:!1},D=>{const O=Math.min(M.clientWidth/D.width,M.clientHeight/D.height);S(O)}),(M.clientHeight===0||M.clientWidth===0)&&setTimeout(v,0))};return v(),tr.addEventListener("resize",v),()=>{tr.removeEventListener("resize",v)}},[d]);const T=e.useCallback((v,M)=>{Ei(v,{alpha:!0},(D,O)=>{O.scale(M,M),D.width=d.canvas.width,D.height=d.canvas.height})},[d]);e.useEffect(()=>{T(A.current,d.dpi),Th(A.current,d.canvas)},[d]),e.useEffect(()=>{T(y.current,d.dpi),Ei(y.current,{alpha:!0},(v,M)=>{M.clearRect(0,0,v.width,v.height)}),kh(y.current,k,m)},[m,k]),e.useEffect(()=>{T(n,d.dpi),Th(n,d.canvas),Ei(it.createElement("canvas"),{alpha:!0},(v,M)=>{M.scale(d.dpi,d.dpi),v.width=d.canvas.width,v.height=d.canvas.height,kh(v,k,m),Th(n,v)})},[m,d,k]);const C=v=>{if(!f||!w.current)return;const M=w.current.getBoundingClientRect(),D={type:f,x:v.offsetX/E,y:v.offsetY/E},O=(G,V)=>{const Z=(V.clientX-M.x)/E,B=(V.clientY-M.y)/E;return{type:G.type,x:Math.min(G.x,Z),y:Math.min(G.y,B),w:Math.abs(Z-G.x),h:Math.abs(B-G.y)}},N=G=>{Ei(y.current,{alpha:!0},(V,Z)=>{Z.clearRect(0,0,V.width,V.height)}),kh(y.current,k,[...m,O(D,G)])},Q=G=>{const V=O(D,G);V.w*E>=1&&V.h*E>=1&&p(Z=>[...Z,V]),it.removeEventListener("mousemove",N),it.removeEventListener("mouseup",Q)};it.addEventListener("mousemove",N),it.addEventListener("mouseup",Q)},_=e.useCallback(v=>M=>{M.preventDefault(),M.stopPropagation(),p(D=>{const O=[...D];return O.splice(v,1),O})},[]),x={width:`${d.canvas.width*E}px`,height:`${d.canvas.height*E}px`},P=v=>{v.stopPropagation()};return t("div",{class:"editor"},t("style",{nonce:i.styleNonce,dangerouslySetInnerHTML:c}),t("div",{class:"editor__image-container"},t("div",{class:"editor__canvas-container",ref:g},t("canvas",{ref:A,id:"background",style:x}),t("canvas",{ref:y,id:"foreground",style:x}),t("div",{ref:w,onMouseDown:C,style:x},m.map((v,M)=>t("div",{key:M,class:"editor__rect",style:{top:`${v.y*E}px`,left:`${v.x*E}px`,width:`${v.w*E}px`,height:`${v.h*E}px`}},t("button",{"aria-label":"Remove",onClick:_(M),onMouseDown:P,onMouseUp:P,type:"button"},t(o,null))))))),t(a,{action:f,setAction:h}))};return function({onError:f}){const[h,m]=e.useState();return s({onBeforeScreenshot:e.useCallback(()=>{u.display="none"},[]),onScreenshot:e.useCallback((p,g)=>{Ei(it.createElement("canvas"),{alpha:!1},(A,y)=>{y.scale(g,g),A.width=p.videoWidth,A.height=p.videoHeight,y.drawImage(p,0,0,A.width,A.height),m({canvas:A,dpi:g})}),n.width=p.videoWidth,n.height=p.videoHeight},[]),onAfterScreenshot:e.useCallback(()=>{u.display="block"},[]),onError:e.useCallback(p=>{u.display="block",f(p)},[])}),h?t(l,{screenshot:h}):t("div",null)}}const vM=(()=>({name:"FeedbackScreenshot",setupOnce(){},createInput:({h:t,hooks:e,dialog:n,options:r})=>{const i=it.createElement("canvas");return{input:xM({h:t,hooks:e,outputBuffer:i,dialog:n,options:r}),value:async()=>{const s=await new Promise(a=>{i.toBlob(a,"image/png")});if(s)return{data:new Uint8Array(await s.arrayBuffer()),filename:"screenshot.png",contentType:"application/png"}}}}})),he=Te;let Ih=0;function Qb(){return Ih>0}function BM(){Ih++,setTimeout(()=>{Ih--})}function ra(t,e={}){function n(i){return typeof i=="function"}if(!n(t))return t;try{const i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(If(t))return t}catch{return t}const r=function(...i){try{const s=i.map(a=>ra(a,e));return t.apply(this,s)}catch(s){throw BM(),An(a=>{a.addEventProcessor(o=>(e.mechanism&&(Cf(o,void 0),mi(o,e.mechanism)),o.extra={...o.extra,arguments:i},o)),Dr(s)}),s}};try{for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch{}sy(r,t),cn(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function Ch(){const t=$i(),{referrer:e}=he.document||{},{userAgent:n}=he.navigator||{},r={...e&&{Referer:e},...n&&{"User-Agent":n}};return{url:t,headers:r}}const PM={replayIntegration:"replay",replayCanvasIntegration:"replay-canvas",feedbackIntegration:"feedback",feedbackModalIntegration:"feedback-modal",feedbackScreenshotIntegration:"feedback-screenshot",captureConsoleIntegration:"captureconsole",contextLinesIntegration:"contextlines",linkedErrorsIntegration:"linkederrors",dedupeIntegration:"dedupe",extraErrorDataIntegration:"extraerrordata",graphqlClientIntegration:"graphqlclient",httpClientIntegration:"httpclient",reportingObserverIntegration:"reportingobserver",rewriteFramesIntegration:"rewriteframes",browserProfilingIntegration:"browserprofiling",moduleMetadataIntegration:"modulemetadata"},Hb=he;async function Wb(t,e){const n=PM[t],r=Hb.Sentry=Hb.Sentry||{};if(!n)throw new Error(`Cannot lazy load integration: ${t}`);const i=r[t];if(typeof i=="function"&&!("_isShim"in i))return i;const s=RM(n),a=he.document.createElement("script");
495a.src=s,a.crossOrigin="anonymous",a.referrerPolicy="strict-origin",e&&a.setAttribute("nonce",e);const o=new Promise((d,f)=>{a.addEventListener("load",()=>d()),a.addEventListener("error",f)}),c=he.document.currentScript,u=he.document.body||he.document.head||(c==null?void 0:c.parentElement);if(u)u.appendChild(a);else throw new Error(`Could not find parent element to insert lazy-loaded ${t} script`);try{await o}catch{throw new Error(`Error when loading integration: ${t}`)}const l=r[t];if(typeof l!="function")throw new Error(`Could not load integration: ${t}`);return l}function RM(t){var r;const e=le(),n=((r=e==null?void 0:e.getOptions())==null?void 0:r.cdnBaseUrl)||"https://browser.sentry-cdn.com";return new URL(`/${kr}/${t}.min.js`,n).toString()}const FM=gb({lazyLoadIntegration:Wb}),Vb=gb({getModalIntegration:()=>SM,getScreenshotIntegration:()=>vM});function ia(t,e,n,r){Jf({level:t,message:e,attributes:n,severityNumber:r})}function MM(t,e){ia("trace",t,e)}function DM(t,e){ia("debug",t,e)}function OM(t,e){ia("info",t,e)}function NM(t,e){ia("warn",t,e)}function UM(t,e){ia("error",t,e)}function LM(t,e){ia("fatal",t,e)}var zM=Object.freeze({__proto__:null,debug:DM,error:UM,fatal:LM,fmt:LP,info:OM,trace:MM,warn:NM});function Qu(t,e){const n=vh(t,e),r={type:GM(e),value:qM(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function QM(t,e,n,r){const i=le(),s=i==null?void 0:i.getOptions().normalizeDepth,a=jM(e),o={__serialized__:zy(e,s)};if(a)return{exception:{values:[Qu(t,a)]},extra:o};const c={exception:{values:[{type:su(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:YM(e,{isUnhandledRejection:r})}]},extra:o};if(n){const u=vh(t,n);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function xh(t,e){return{exception:{values:[Qu(t,e)]}}}function vh(t,e){const n=e.stacktrace||e.stack||"",r=WM(e),i=VM(e);try{return t(n,r,i)}catch{}return[]}const HM=/Minified React error #\d+;/i;function WM(t){return t&&HM.test(t.message)?1:0}function VM(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Gb(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function GM(t){const e=t==null?void 0:t.name;return!e&&Gb(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function qM(t){const e=t==null?void 0:t.message;return Gb(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function qb(t,e,n,r){const i=(n==null?void 0:n.syntheticException)||void 0,s=Bh(t,e,i,r);return mi(s),s.level="error",n!=null&&n.event_id&&(s.event_id=n.event_id),Mr(s)}function Yb(t,e,n="info",r,i){const s=(r==null?void 0:r.syntheticException)||void 0,a=Ph(t,e,s,i);return a.level=n,r!=null&&r.event_id&&(a.event_id=r.event_id),Mr(a)}function Bh(t,e,n,r,i){let s;if(ey(e)&&e.error)return xh(t,e.error);if(ty(e)||d1(e)){const a=e;if("stack"in e)s=xh(t,e);else{const o=a.name||(ty(a)?"DOMError":"DOMException"),c=a.message?`${o}: ${a.message}`:o;s=Ph(t,c,n,r),Cf(s,c)}return"code"in a&&(s.tags={...s.tags,"DOMException.code":`${a.code}`}),s}return xr(e)?xh(t,e):vr(e)||su(e)?(s=QM(t,e,n,i),mi(s,{synthetic:!0}),s):(s=Ph(t,e,n,r),Cf(s,`${e}`),mi(s,{synthetic:!0}),s)}function Ph(t,e,n,r){const i={};if(r&&n){const s=vh(t,n);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]}),mi(i,{synthetic:!0})}if(iu(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 YM(t,{isUnhandledRejection:e}){const n=y1(t),r=e?"promise rejection":"exception";return ey(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:su(t)?`Event \`${KM(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function KM(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function jM(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}const $M=5e3;class Kb extends gP{constructor(e){const n=XM(e),r=he.SENTRY_SDK_SOURCE||AF();nh(n,"browser",["browser"],r),super(n);const{sendDefaultPii:i,sendClientReports:s,enableLogs:a,_experiments:o}=this._options,c=a??(o==null?void 0:o.enableLogs);he.document&&(s||c)&&he.document.addEventListener("visibilitychange",()=>{he.document.visibilityState==="hidden"&&(s&&this._flushOutcomes(),c&&ku(this))}),c&&(this.on("flush",()=>{ku(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{ku(this)},$M)})),i&&(this.on("postprocessEvent",zP),this.on("beforeSendSession",QP))}eventFromException(e,n){return qb(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return Yb(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,i)}}function XM(t){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=he.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...t}}const sa=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ie=Te,JM=(t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good",aa=(t,e,n,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=JM(e.value,n),t(e)))}},ZM=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,Do=(t=!0)=>{var n,r;const e=(r=(n=Ie.performance)==null?void 0:n.getEntriesByType)==null?void 0:r.call(n,"navigation")[0];if(!t||e&&e.responseStart>0&&e.responseStart<performance.now())return e},oa=()=>{const t=Do();return(t==null?void 0:t.activationStart)??0},ca=(t,e=-1)=>{var s,a;const n=Do();let r="navigate";return n&&((s=Ie.document)!=null&&s.prerendering||oa()>0?r="prerender":(a=Ie.document)!=null&&a.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:t,value:e,rating:"good",delta:0,entries:[],id:ZM(),navigationType:r}},Rh=new WeakMap;function Fh(t,e){return Rh.get(t)||Rh.set(t,new e),Rh.get(t)}class Hu{constructor(){Hu.prototype.__init.call(this),Hu.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(e){var i;if(e.hadRecentInput)return;const n=this._sessionEntries[0],r=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this._sessionValue+=e.value,this._sessionEntries.push(e)):(this._sessionValue=e.value,this._sessionEntries=[e]),(i=this._onAfterProcessingUnexpectedShift)==null||i.call(this,e)}}const ds=(t,e,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const r=new PerformanceObserver(i=>{Promise.resolve().then(()=>{e(i.getEntries())})});return r.observe({type:t,buffered:!0,...n}),r}}catch{}},Wu=t=>{let e=!1;return()=>{e||(t(),e=!0)}};let Oo=-1;const eD=()=>{var t,e;return((t=Ie.document)==null?void 0:t.visibilityState)==="hidden"&&!((e=Ie.document)!=null&&e.prerendering)?0:1/0},Vu=t=>{Ie.document.visibilityState==="hidden"&&Oo>-1&&(Oo=t.type==="visibilitychange"?t.timeStamp:0,nD())},tD=()=>{addEventListener("visibilitychange",Vu,!0),addEventListener("prerenderingchange",Vu,!0)},nD=()=>{removeEventListener("visibilitychange",Vu,!0),removeEventListener("prerenderingchange",Vu,!0)},Gu=()=>{var t;if(Ie.document&&Oo<0){const e=oa();Oo=(Ie.document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").filter(r=>r.name==="hidden"&&r.startTime>e)[0])==null?void 0:t.startTime)??eD(),tD()}return{get firstHiddenTime(){return Oo}}},No=t=>{var e;(e=Ie.document)!=null&&e.prerendering?addEventListener("prerenderingchange",()=>t(),!0):t()},rD=[1800,3e3],iD=(t,e={})=>{No(()=>{const n=Gu(),r=ca("FCP");let i;const a=ds("paint",o=>{for(const c of o)c.name==="first-contentful-paint"&&(a.disconnect(),c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-oa(),0
495),r.entries.push(c),i(!0)))});a&&(i=aa(t,r,rD,e.reportAllChanges))})},sD=[.1,.25],aD=(t,e={})=>{iD(Wu(()=>{var o,c;const n=ca("CLS",0);let r;const i=Fh(e,Hu),s=u=>{for(const l of u)i._processEntry(l);i._sessionValue>n.value&&(n.value=i._sessionValue,n.entries=i._sessionEntries,r())},a=ds("layout-shift",s);a&&(r=aa(t,n,sD,e.reportAllChanges),(o=Ie.document)==null||o.addEventListener("visibilitychange",()=>{var u;((u=Ie.document)==null?void 0:u.visibilityState)==="hidden"&&(s(a.takeRecords()),r(!0))}),(c=Ie==null?void 0:Ie.setTimeout)==null||c.call(Ie,r))}))},qu=t=>{const e=n=>{var r;(n.type==="pagehide"||((r=Ie.document)==null?void 0:r.visibilityState)==="hidden")&&t(n)};Ie.document&&(addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0))},oD=[100,300],cD=(t,e={})=>{No(()=>{const n=Gu(),r=ca("FID");let i;const s=c=>{c.startTime<n.firstHiddenTime&&(r.value=c.processingStart-c.startTime,r.entries.push(c),i(!0))},a=c=>{c.forEach(s)},o=ds("first-input",a);i=aa(t,r,oD,e.reportAllChanges),o&&qu(Wu(()=>{a(o.takeRecords()),o.disconnect()}))})};let jb=0,Mh=1/0,Yu=0;const uD=t=>{t.forEach(e=>{e.interactionId&&(Mh=Math.min(Mh,e.interactionId),Yu=Math.max(Yu,e.interactionId),jb=Yu?(Yu-Mh)/7+1:0)})};let Dh;const $b=()=>Dh?jb:performance.interactionCount||0,lD=()=>{"interactionCount"in performance||Dh||(Dh=ds("event",uD,{type:"event",buffered:!0,durationThreshold:0}))},Oh=10;let Xb=0;const dD=()=>$b()-Xb;class Ku{constructor(){Ku.prototype.__init.call(this),Ku.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){Xb=$b(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const e=Math.min(this._longestInteractionList.length-1,Math.floor(dD()/50));return this._longestInteractionList[e]}_processEntry(e){var i,s;if((i=this._onBeforeProcessingEntry)==null||i.call(this,e),!(e.interactionId||e.entryType==="first-input"))return;const n=this._longestInteractionList.at(-1);let r=this._longestInteractionMap.get(e.interactionId);if(r||this._longestInteractionList.length<Oh||e.duration>n._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((a,o)=>o._latency-a._latency),this._longestInteractionList.length>Oh){const a=this._longestInteractionList.splice(Oh);for(const o of a)this._longestInteractionMap.delete(o.id)}(s=this._onAfterProcessingINPCandidate)==null||s.call(this,r)}}}const Jb=t=>{var n;const e=Ie.requestIdleCallback||Ie.setTimeout;((n=Ie.document)==null?void 0:n.visibilityState)==="hidden"?t():(t=Wu(t),e(t),qu(t))},fD=[200,500],hD=40,pD=(t,e={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&No(()=>{lD();const n=ca("INP");let r;const i=Fh(e,Ku),s=o=>{Jb(()=>{for(const u of o)i._processEntry(u);const c=i._estimateP98LongestInteraction();c&&c._latency!==n.value&&(n.value=c._latency,n.entries=c.entries,r())})},a=ds("event",s,{durationThreshold:e.durationThreshold??hD});r=aa(t,n,fD,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),qu(()=>{s(a.takeRecords()),r(!0)}))})};class mD{_processEntry(e){var n;(n=this._onBeforeProcessingEntry)==null||n.call(this,e)}}const gD=[2500,4e3],AD=(t,e={})=>{No(()=>{const n=Gu(),r=ca("LCP");let i;const s=Fh(e,mD),a=c=>{e.reportAllChanges||(c=c.slice(-1));for(const u of c)s._processEntry(u),u.startTime<n.firstHiddenTime&&(r.value=Math.max(u.startTime-oa(),0),r.entries=[u],i())},o=ds("largest-contentful-paint",a);if(o){i=aa(t,r,gD,e.reportAllChanges);const c=Wu(()=>{a(o.takeRecords()),o.disconnect(),i(!0)});for(const u of["keydown","click","visibilitychange"])Ie.document&&addEventListener(u,()=>Jb(c),{capture:!0,once:!0})}})},yD=[800,1800],Nh=t=>{var e,n;(e=Ie.document)!=null&&e.prerendering?No(()=>Nh(t)):((n=Ie.document)==null?void 0:n.readyState)!=="complete"?addEventListener("load",()=>Nh(t),!0):setTimeout(t)},wD=(t,e={})=>{const n=ca("TTFB"),r=aa(t,n,yD,e.reportAllChanges);Nh(()=>{const i=Do();i&&(n.value=Math.max(i.responseStart-oa(),0),n.entries=[i],r(!0))})},Uo={},ju={};let Zb,e0,t0,n0,r0;function Uh(t,e=!1){return Lo("cls",t,ED,Zb,e)}function Lh(t,e=!1){return Lo("lcp",t,_D,t0,e)}
495function i0(t){return Lo("fid",t,SD,e0)}function bD(t){return Lo("ttfb",t,TD,n0)}function s0(t){return Lo("inp",t,kD,r0)}function fs(t,e){return a0(t,e),ju[t]||(ID(t),ju[t]=!0),o0(t,e)}function ua(t,e){const n=Uo[t];if(n!=null&&n.length)for(const r of n)try{r(e)}catch(i){sa&&W.error(`Error while triggering instrumentation handler.
496Type: ${t}
497Name: ${Cr(r)}
498Error:`,i)}}function ED(){return aD(t=>{ua("cls",{metric:t}),Zb=t},{reportAllChanges:!0})}function SD(){return cD(t=>{ua("fid",{metric:t}),e0=t})}function _D(){return AD(t=>{ua("lcp",{metric:t}),t0=t},{reportAllChanges:!0})}function TD(){return wD(t=>{ua("ttfb",{metric:t}),n0=t})}function kD(){return pD(t=>{ua("inp",{metric:t}),r0=t})}function Lo(t,e,n,r,i=!1){a0(t,e);let s;return ju[t]||(s=n(),ju[t]=!0),r&&e({metric:r}),o0(t,e,i?s:void 0)}function ID(t){const e={};t==="event"&&(e.durationThreshold=0),ds(t,n=>{ua(t,{entries:n})},e)}function a0(t,e){Uo[t]=Uo[t]||[],Uo[t].push(e)}function o0(t,e,n){return()=>{n&&n();const r=Uo[t];if(!r)return;const i=r.indexOf(e);i!==-1&&r.splice(i,1)}}function CD(t){return"duration"in t}function zh(t){return typeof t=="number"&&isFinite(t)}function Nr(t,e,n,{...r}){const i=ke(t).start_timestamp;return i&&i>e&&typeof t.updateStartTime=="function"&&t.updateStartTime(e),as(t,()=>{const s=Un({startTime:e,...r});return s&&s.end(n),s})}function Qh(t){var g;const e=le();if(!e)return;const{name:n,transaction:r,attributes:i,startTime:s}=t,{release:a,environment:o,sendDefaultPii:c}=e.getOptions(),u=e.getIntegrationByName("Replay"),l=u==null?void 0:u.getReplayId(),d=Be(),f=d.getUser(),h=f!==void 0?f.email||f.id||f.ip_address:void 0;let m;try{m=d.getScopeData().contexts.profile.profile_id}catch{}const p={release:a,environment:o,user:h||void 0,profile_id:m||void 0,replay_id:l||void 0,transaction:r,"user_agent.original":(g=Ie.navigator)==null?void 0:g.userAgent,"client.address":c?"{{auto}}":void 0,...i};return Un({name:n,attributes:p,startTime:s,experimental:{standalone:!0}})}function $u(){return Ie.addEventListener&&Ie.performance}function ft(t){return t/1e3}function c0(t){let e="unknown",n="unknown",r="";for(const i of t){if(i==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(i))){e=r==="h"?"http":r,n=t.split(r)[1];break}r+=i}return r===t&&(e=r),{name:e,version:n}}function u0(t){try{return PerformanceObserver.supportedEntryTypes.includes(t)}catch{return!1}}function l0(t,e){let n,r=!1;function i(o){!r&&n&&e(o,n),r=!0}qu(()=>{i("pagehide")});const s=t.on("beforeStartNavigationSpan",(o,c)=>{c!=null&&c.isRedirect||(i("navigation"),s==null||s(),a==null||a())}),a=t.on("afterStartPageLoadSpan",o=>{n=o.spanContext().spanId,a==null||a()})}function xD(t){let e=0,n;if(!u0("layout-shift"))return;const r=Uh(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(e=i.value,n=s)},!0);l0(t,(i,s)=>{vD(e,n,s,i),r()})}function vD(t,e,n,r){var u;sa&&W.log(`Sending CLS span (${t})`);const i=ft((nn()||0)+((e==null?void 0:e.startTime)||0)),s=Be().getScopeData().transactionName,a=e?Nn((u=e.sources[0])==null?void 0:u.node):"Layout shift",o={[Ne]:"auto.http.browser.cls",[Pt]:"ui.webvital.cls",[js]:(e==null?void 0:e.duration)||0,"sentry.pageload.span_id":n,"sentry.report_event":r};e!=null&&e.sources&&e.sources.forEach((l,d)=>{o[`cls.source.${d+1}`]=Nn(l.node)});const c=Qh({name:a,transaction:s,attributes:o,startTime:i});c&&(c.addEvent("cls",{[To]:"",[ko]:t}),c.end(i))}function BD(t){let e=0,n;if(!u0("largest-contentful-paint"))return;const r=Lh(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(e=i.value,n=s)},!0);l0(t,(i,s)=>{PD(e,n,s,i),r()})}function PD(t,e,n,r){sa&&W.log(`Sending LCP span (${t})`);const i=ft((nn()||0)+((e==null?void 0:e.startTime)||0)),s=Be().getScopeData().transactionName,a=e?Nn(e.element):"Largest contentful paint",o={[Ne]:"auto.http.browser.lcp",[Pt]:"ui.webvital.lcp",[js]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};e&&(e.element&&(o["lcp.element"]=Nn(e.element)),e.id&&(o["lcp.id"]=e.id),e.url&&(o["lcp.url"]=e.url.trim().slice(0,200)),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 c=Qh({name:a,transaction:s,attributes:o,startTime:i});c&&(c.addEvent("lcp",{[To]:"millisecond",[ko]:t}),c.end(i))}const RD=2147483647;let d0=0,Xt={},yn,la;function FD({recordClsStandaloneSpans:t,recordLcpStandaloneSpans:e,client:n}){const r=$u();if(r&&nn()){r.mark&&Ie.performance.mark("sentry-tracing-init");const i=LD(),s=e?BD(n):UD(),a=zD(),o=t?xD(n):ND();return()=>{i(),s==null||s(),a(),o==null||o()}}return()=>{}}function MD(){fs("longtask",({entries:t})=>{const e=gt();if(!e)return;const{op:n,start_timestamp:r}=ke(e);for(const i of t){const s=ft(nn()+i.startTime),a=ft(i.duration);n==="navigation"&&r&&s<r||Nr(e,s,s+a,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[Ne]:"auto.ui.browser.metrics"}})}})}function DD(){new PerformanceObserver(e=>{const n=gt();if(n)for(const r of e.getEntries()){if(!r.scripts[0])continue;const i=ft(nn()+r.startTime),{start_timestamp:s,op:a}=ke(n);if(a==="navigation"&&s&&i<s)continue;const o=ft(r.duration),c={[Ne]:"auto.ui.browser.metrics"},u=r.scripts[0],{invoker:l,invokerType:d,sourceURL:f,sourceFunctionName:h,sourceCharPosition:m}=u;c["browser.script.invoker"]=l,c["browser.script.invoker_type"]=d,f&&(c["code.filepath"]=f),h&&(c["code.function"]=h),m!==-1&&(c["browser.script.source_char_position"]=m),Nr(n,i,i+o,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:c})}}).observe({type:"long-animation-frame",buffered:!0})}function OD(){fs("event",({entries:t})=>{const e=gt();if(e){for(const n of t)if(n.name==="click"){const r=ft(nn()+n.startTime),i=ft(n.duration),s={name:Nn(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[Ne]:"auto.ui.browser.metrics"}},a=iy(n.target);a&&(s.attributes["ui.component_name"]=a),Nr(e,r,r+i,s)}}})}function ND(){return Uh(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Xt.cls={value:t.value,unit:""},la=e)},!0)}function UD(){return Lh(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Xt.lcp={value:t.value,unit:"millisecond"},yn=e)},!0)}function LD(){return i0(({metric:t})=>{const e=t.entries[t.entries.length-1];if(!e)return;const n=ft(nn()),r=ft(e.startTime);
498Xt.fid={value:t.value,unit:"millisecond"},Xt["mark.fid"]={value:n+r,unit:"second"}})}function zD(){return bD(({metric:t})=>{t.entries[t.entries.length-1]&&(Xt.ttfb={value:t.value,unit:"millisecond"})})}function QD(t,e){const n=$u(),r=nn();if(!(n!=null&&n.getEntries)||!r)return;const i=ft(r),s=n.getEntries(),{op:a,start_timestamp:o}=ke(t);if(s.slice(d0).forEach(c=>{const u=ft(c.startTime),l=ft(Math.max(0,c.duration));if(!(a==="navigation"&&o&&i+u<o))switch(c.entryType){case"navigation":{VD(t,c,i);break}case"mark":case"paint":case"measure":{HD(t,c,u,l,i,e.ignorePerformanceApiSpans);const d=Gu(),f=c.startTime<d.firstHiddenTime;c.name==="first-paint"&&f&&(Xt.fp={value:c.startTime,unit:"millisecond"}),c.name==="first-contentful-paint"&&f&&(Xt.fcp={value:c.startTime,unit:"millisecond"});break}case"resource":{YD(t,c,c.name,u,l,i,e.ignoreResourceSpans);break}}}),d0=Math.max(s.length-1,0),KD(t),a==="pageload"){$D(Xt);const c=Xt["mark.fid"];c&&Xt.fid&&(Nr(t,c.value,c.value+ft(Xt.fid.value),{name:"first input delay",op:"ui.action",attributes:{[Ne]:"auto.ui.browser.metrics"}}),delete Xt["mark.fid"]),e.recordClsOnPageloadSpan||delete Xt.cls,e.recordLcpOnPageloadSpan||delete Xt.lcp,Object.entries(Xt).forEach(([u,l])=>{Vy(u,l.value,l.unit)}),t.setAttribute("performance.timeOrigin",i),t.setAttribute("performance.activationStart",oa()),jD(t,e)}yn=void 0,la=void 0,Xt={}}function HD(t,e,n,r,i,s){if(["mark","measure"].includes(e.entryType)&&Xn(e.name,s))return;const a=Do(!1),o=ft(a?a.requestStart:0),c=i+Math.max(n,o),u=i+n,l=u+r,d={[Ne]:"auto.resource.browser.metrics"};c!==u&&(d["sentry.browser.measure_happened_before_request"]=!0,d["sentry.browser.measure_start_time"]=c),WD(d,e),c<=l&&Nr(t,c,l,{name:e.name,op:e.entryType,attributes:d})}function WD(t,e){try{const n=e.detail;if(!n)return;if(typeof n=="object"){for(const[r,i]of Object.entries(n))if(i&&Gs(i))t[`sentry.browser.measure.detail.${r}`]=i;else if(i!==void 0)try{t[`sentry.browser.measure.detail.${r}`]=JSON.stringify(i)}catch{}return}if(Gs(n)){t["sentry.browser.measure.detail"]=n;return}try{t["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function VD(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Xu(t,e,r,n)}),Xu(t,e,"secureConnection",n,"TLS/SSL"),Xu(t,e,"fetch",n,"cache"),Xu(t,e,"domainLookup",n,"DNS"),qD(t,e,n)}function Xu(t,e,n,r,i=n){const s=GD(n),a=e[s],o=e[`${n}Start`];!o||!a||Nr(t,r+ft(o),r+ft(a),{op:`browser.${i}`,name:e.name,attributes:{[Ne]:"auto.ui.browser.metrics",...n==="redirect"&&e.redirectCount!=null?{"http.redirect_count":e.redirectCount}:{}}})}function GD(t){return t==="secureConnection"?"connectEnd":t==="fetch"?"domainLookupStart":`${t}End`}function qD(t,e,n){const r=n+ft(e.requestStart),i=n+ft(e.responseEnd),s=n+ft(e.responseStart);e.responseEnd&&(Nr(t,r,i,{op:"browser.request",name:e.name,attributes:{[Ne]:"auto.ui.browser.metrics"}}),Nr(t,s,i,{op:"browser.response",name:e.name,attributes:{[Ne]:"auto.ui.browser.metrics"}}))}function YD(t,e,n,r,i,s,a){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const o=e.initiatorType?`resource.${e.initiatorType}`:"resource.other";if(a!=null&&a.includes(o))return;const c=os(n),u={[Ne]:"auto.resource.browser.metrics"};Hh(u,e,"transferSize","http.response_transfer_size"),Hh(u,e,"encodedBodySize","http.response_content_length"),Hh(u,e,"decodedBodySize","http.decoded_response_content_length");const l=e.deliveryType;l!=null&&(u["http.response_delivery_type"]=l);const d=e.renderBlockingStatus;if(d&&(u["resource.render_blocking_status"]=d),c.protocol&&(u["url.scheme"]=c.protocol.split(":").pop()),c.host&&(u["server.address"]=c.host),u["url.same_origin"]=n.includes(Ie.location.origin),e.nextHopProtocol!=null){const{name:m,version:p}=c0(e.nextHopProtocol);u["network.protocol.name"]=m,u["network.protocol.version"]=p}const f=s+r,h=f+i;Nr(t,f,h,{name:n.replace(Ie.location.origin,""),op:o,attributes:u})}function KD(t){const e=Ie.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&t.setAttribute("connectionType",n.type),zh(n.rtt)&&(Xt["connection.rtt"]={value:n.rtt,unit:"millisecond"})),zh(e.deviceMemory)&&t.setAttribute("deviceMemory",`${e.deviceMemory} GB`),zh(e.hardwareConcurrency)&&t.setAttribute("hardwareConcurrency",String(e.hardwareConcurrency))}function jD(t,e){yn&&e.recordLcpOnPageloadSpan&&(yn.element&&t.setAttribute("lcp.element",Nn(yn.element)),yn.id&&t.setAttribute("lcp.id",yn.id),yn.url&&t.setAttribute("lcp.url",yn.url.trim().slice(0,200)),yn.loadTime!=null&&t.setAttribute("lcp.loadTime",yn.loadTime),yn.renderTime!=null&&t.setAttribute("lcp.renderTime",yn.renderTime),t.setAttribute("lcp.size",yn.size)),la!=null&&la.sources&&e.recordClsOnPageloadSpan&&la.sources.forEac
498h((n,r)=>t.setAttribute(`cls.source.${r+1}`,Nn(n.node)))}function Hh(t,e,n,r){const i=e[n];i!=null&&i<RD&&(t[r]=i)}function $D(t){const e=Do(!1);if(!e)return;const{responseStart:n,requestStart:r}=e;r<=n&&(t["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}function XD(){return $u()&&nn()?fs("element",JD):()=>{}}const JD=({entries:t})=>{const e=gt(),n=e?kt(e):void 0,r=n?ke(n).description:Be().getScopeData().transactionName;t.forEach(i=>{var h,m;const s=i;if(!s.identifier)return;const a=s.name,o=s.renderTime,c=s.loadTime,[u,l]=c?[ft(c),"load-time"]:o?[ft(o),"render-time"]:[mt(),"entry-emission"],d=a==="image-paint"?ft(Math.max(0,(o??0)-(c??0))):0,f={[Ne]:"auto.ui.browser.elementtiming",[Pt]:"ui.elementtiming",[et]:"component","sentry.span_start_time_source":l,"sentry.transaction_name":r,"element.id":s.id,"element.type":((m=(h=s.element)==null?void 0:h.tagName)==null?void 0:m.toLowerCase())||"unknown","element.size":s.naturalWidth&&s.naturalHeight?`${s.naturalWidth}x${s.naturalHeight}`:void 0,"element.render_time":o,"element.load_time":c,"element.url":s.url||void 0,"element.identifier":s.identifier,"element.paint_type":a};gu({name:`element[${s.identifier}]`,attributes:f,startTime:u,onlyIfParent:!0},p=>{p.end(u+d)})})},ZD=1e3;let f0,Wh,Vh;function h0(t){hi("dom",t),pi("dom",e2)}function e2(){if(!Ie.document)return;const t=On.bind(null,"dom"),e=p0(t,!0);Ie.document.addEventListener("click",e,!1),Ie.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{var s,a;const i=(s=Ie[n])==null?void 0:s.prototype;(a=i==null?void 0:i.hasOwnProperty)!=null&&a.call(i,"addEventListener")&&(on(i,"addEventListener",function(o){return function(c,u,l){if(c==="click"||c=="keypress")try{const d=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},f=d[c]=d[c]||{refCount:0};if(!f.handler){const h=p0(t);f.handler=h,o.call(this,c,h,l)}f.refCount++}catch{}return o.call(this,c,u,l)}}),on(i,"removeEventListener",function(o){return function(c,u,l){if(c==="click"||c=="keypress")try{const d=this.__sentry_instrumentation_handlers__||{},f=d[c];f&&(f.refCount--,f.refCount<=0&&(o.call(this,c,f.handler,l),f.handler=void 0,delete d[c]),Object.keys(d).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,c,u,l)}}))})}function t2(t){if(t.type!==Wh)return!1;try{if(!t.target||t.target._sentryId!==Vh)return!1}catch{}return!0}function n2(t,e){return t!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function p0(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=r2(n);if(n2(n.type,r))return;cn(n,"_sentryCaptured",!0),r&&!r._sentryId&&cn(r,"_sentryId",un());
498const i=n.type==="keypress"?"input":n.type;t2(n)||(t({event:n,name:i,global:e}),Wh=n.type,Vh=r?r._sentryId:void 0),clearTimeout(f0),f0=Ie.setTimeout(()=>{Vh=void 0,Wh=void 0},ZD)}}function r2(t){try{return t.target}catch{return null}}let Ju;function Zu(t){const e="history";hi(e,t),pi(e,i2)}function i2(){if(Ie.addEventListener("popstate",()=>{const e=Ie.location.href,n=Ju;if(Ju=e,n===e)return;On("history",{from:n,to:e})}),!cF())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const i=Ju,s=s2(String(r));if(Ju=s,i===s)return e.apply(this,n);On("history",{from:i,to:s})}return e.apply(this,n)}}on(Ie.history,"pushState",t),on(Ie.history,"replaceState",t)}function s2(t){try{return new URL(t,Ie.location.origin).toString()}catch{return t}}const el={};function Gh(t){const e=el[t];if(e)return e;let n=Ie[t];if(oh(n))return el[t]=n.bind(Ie);const r=Ie.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!=null&&s[t]&&(n=s[t]),r.head.removeChild(i)}catch(i){sa&&W.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return n&&(el[t]=n.bind(Ie))}function m0(t){el[t]=void 0}function zo(...t){return Gh("setTimeout")(...t)}const Ur="__sentry_xhr_v3__";function qh(t){hi("xhr",t),pi("xhr",a2)}function a2(){if(!Ie.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,s=mt()*1e3,a=$n(r[0])?r[0].toUpperCase():void 0,o=o2(r[1]);if(!a||!o)return e.apply(n,r);n[Ur]={method:a,url:o,request_headers:{}},a==="POST"&&o.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const c=()=>{const u=n[Ur];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const l={endTimestamp:mt()*1e3,startTimestamp:s,xhr:n,virtualError:i};On("xhr",l)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,l,d){return c(),u.apply(l,d)}}):n.addEventListener("readystatechange",c),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,l,d){const[f,h]=d,m=l[Ur];return m&&$n(f)&&$n(h)&&(m.request_headers[f.toLowerCase()]=h),u.apply(l,d)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[Ur];if(!i)return e.apply(n,r);r[0]!==void 0&&(i.body=r[0]);const s={startTimestamp:mt()*1e3,xhr:n};return On("xhr",s),e.apply(n,r)}})}function o2(t){if($n(t))return t;try{return t.toString()}catch{}}function g0(t){return new URLSearchParams(t).toString()}function tl(t,e=W){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[g0(t)];if(!t)return[void 0]}catch(n){return sa&&e.error(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return sa&&e.log("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Yh(t=[]){if(!(t.length!==2||typeof t[1]!="object"))return t[1].body}const Kh=[],nl=new Map,c2=60;function u2(){if($u()&&nn()){const e=l2();return()=>{e()}}return()=>{}}const A0={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 l2(){return s0(d2)}const d2=({metric:t})=>{if(t.value==null)return;const e=ft(t.value);if(e>c2)return;const n=t.entries.find(m=>m.duration===t.value&&A0[m.name]);if(!n)return;const{interactionId:r}=n,i=A0[n.name],s=ft(nn()+n.startTime),a=gt(),o=a?kt(a):void 0,u=(r!=null?nl.get(r):void 0)||o,l=u?ke(u).description:Be().getScopeData().transactionName,d=Nn(n.target),f={[Ne]:"auto.http.browser.inp",[Pt]:`ui.interaction.${i}`,[js]:n.duration},h=Qh({name:d,transaction:l,attributes:f,startTime:s});h&&(h.addEvent("inp",{[To]:"millisecond",[ko]:t.value}),h.end(s+e))};function f2(){const t=({entries:e})=>{const n=gt(),r=n&&kt(n);e.forEach(i=>
498{if(!CD(i)||!r)return;const s=i.interactionId;if(s!=null&&!nl.has(s)){if(Kh.length>10){const a=Kh.shift();nl.delete(a)}Kh.push(s),nl.set(s,r)}})};fs("event",t),fs("first-input",t)}function jh(t,e=Gh("fetch")){let n=0,r=0;function i(s){const a=s.body.length;n+=a,r++;const o={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return m0("fetch"),yu("No fetch implementation available");try{return e(t.url,o).then(c=>(n-=a,r--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return m0("fetch"),n-=a,r--,yu(c)}}return Cw(t,i)}const h2=10,p2=20,m2=30,g2=40,A2=50;function da(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?fr:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const y2=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,w2=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,b2=/\((\S*)(?::(\d+))(?::(\d+))\)/,y0=[m2,t=>{const e=y2.exec(t);if(e){const[,r,i,s]=e;return da(r,fr,+i,+s)}const n=w2.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const a=b2.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}const[i,s]=S0(n[1]||fr,n[2]);return da(s,i,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],E2=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,S2=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,w0=[A2,t=>{const e=E2.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const s=S2.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]||fr;return[i,r]=S0(i,r),da(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}],_2=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,T2=[g2,t=>{const e=_2.exec(t);return e?da(e[2],e[1]||fr,+e[3],e[4]?+e[4]:void 0):void 0}],k2=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,I2=[h2,t=>{const e=k2.exec(t);return e?da(e[2],e[3]||fr,+e[1]):void 0}],C2=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,x2=[p2,t=>{const e=C2.exec(t);return e?da(e[5],e[3]||e[4]||fr,+e[1],+e[2]):void 0}],b0=[y0,w0],E0=jA(...b0),S0=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:fr,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};function v2(t,{metadata:e,tunnel:n,dsn:r}){const i={event_id:t.event_id,sent_at:new Date().toISOString(),...(e==null?void 0:e.sdk)&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:is(r)}},s=B2(t);return Fr(i,[s])}function B2(t){return[{type:"user_report"},t]}const Le=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rl=1024,P2="Breadcrumbs",_0=((t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:P2,setup(n){e.console&&sh(M2(n)),e.dom&&h0(F2(n,e.dom)),e.xhr&&qh(D2(n)),e.fetch&&ch(O2(n)),e.history&&Zu(N2(n)),e.sentry&&n.on("beforeSendEvent",R2(n))}}});function R2(t){return function(n){le()===t&&er({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Xi(n)},{event:n})}}function F2(t,e){return function(r){if(le()!==t)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>rl&&(Le&&W.warn(`\`dom.maxStringLength\` cannot exceed ${rl}, but a value of ${o} was configured. Sentry will use ${rl} instead.`),o=rl),typeof a=="string"&&(a=[a]);try{const u=r.event,l=U2(u)?u.target:u;i=Nn(l,{keyAttrs:a,maxStringLength:o}),s=iy(l)}catch{i="<unknown>"}if(i.length===0)return;const c={category:`ui.${r.name}`,message:i};s&&(c.data={"ui.component_name":s}),er(c,{event:r.event,name:r.name,global:r.global})}}function M2(t){return function(n){if(le()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:ah(n.level),message:au(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${au(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;er(r,{input:n.args,level:n.level})}}function D2(t){return function(n){if(le()!==t)return;const{startTimestamp:r,endTimestamp:i}=n,s=n.xhr[Ur];if(!r||!i||!s)return;const{method:a,url:o,status_code:c,body:u}=s,l={method:a,url:o,status_code:c},d={xhr:n.xhr,input:u,startTimestamp:r,endTimestamp:i},f={category:"xhr",data:l,type:"http",level:ab(c)};t.emit("beforeOutgoingRequestBreadcrumb",f,d),er(f,d)}}function O2(t){return function(n){if(le()!==t)return;const{startTimestamp:r,endTimestamp:i}=n;
vendor: 5,015 bytes, line 498
498if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const s=n.fetchData,a={data:n.error,input:n.args,startTimestamp:r,endTimestamp:i},o={category:"fetch",data:s,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",o,a),er(o,a)}else{const s=n.response,a={...n.fetchData,status_code:s==null?void 0:s.status};n.fetchData.request_body_size,n.fetchData.response_body_size,s==null||s.status;const o={input:n.args,response:s,startTimestamp:r,endTimestamp:i},c={category:"fetch",data:a,type:"http",level:ab(a.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,o),er(c,o)}}}function N2(t){return function(n){if(le()!==t)return;let r=n.from,i=n.to;const s=os(he.location.href);let a=r?os(r):void 0;const o=os(i);a!=null&&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),er({category:"navigation",data:{from:r,to:i}})}}function U2(t){return!!t&&!!t.target}const L2=["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"],z2="BrowserApiErrors",T0=((t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:z2,setupOnce(){e.setTimeout&&on(he,"setTimeout",k0),e.setInterval&&on(he,"setInterval",k0),e.requestAnimationFrame&&on(he,"requestAnimationFrame",Q2),e.XMLHttpRequest&&"XMLHttpRequest"in he&&on(XMLHttpRequest.prototype,"send",H2);const n=e.eventTarget;n&&(Array.isArray(n)?n:L2).forEach(i=>W2(i,e))}}});function k0(t){return function(...e){const n=e[0];return e[0]=ra(n,{mechanism:{data:{function:Cr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Q2(t){return function(e){return t.apply(this,[ra(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Cr(t)},handled:!1,type:"instrument"}})])}}function H2(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&on(n,i,function(s){const a={mechanism:{data:{function:i,handler:Cr(s)},handled:!1,type:"instrument"}},o=If(s);return o&&(a.mechanism.data.handler=Cr(o)),ra(s,a)})}),t.apply(this,e)}}function W2(t,e){var i,s;const r=(i=he[t])==null?void 0:i.prototype;(s=r==null?void 0:r.hasOwnProperty)!=null&&s.call(r,"addEventListener")&&(on(r,"addEventListener",function(a){return function(o,c,u){try{V2(c)&&(c.handleEvent=ra(c.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Cr(c),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&G2(this,o,c),a.apply(this,[o,ra(c,{mechanism:{data:{function:"addEventListener",handler:Cr(c),target:t},handled:!1,type:"instrument"}}),u])}}),on(r,"removeEventListener",function(a){return function(o,c,u){try{const l=c.__sentry_wrapped__;l&&a.call(this,o,l,u)}catch{}return a.call(this,o,c,u)}}))}function V2(t){return typeof t.handleEvent=="function"}function G2(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}const I0=()=>({name:"BrowserSession",setupOnce(){if(typeof he.document>"u"){Le&&W.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}qf({ignoreDuration:!0}),Kf(),Zu(({from:t,to:e})=>{t!==void 0&&t!==e&&(qf({ignoreDuration:!0}),Kf())})}}),q2="GlobalHandlers",C0=((t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:q2,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(Y2(n),x0("onerror")),e.onunhandledrejection&&(K2(n),x0("onunhandledrejection"))}}});function Y2(t){XA(e=>{const{stackParser:n,attachStacktrace:r}=v0();if(le()!==t||Qb())return;const{msg:i,url:s,line:a,column:o,error:c}=e,u=X2(Bh(n,c||i,void 0,r,!1),s,a,o);u.level="error",vo(u,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function K2(t){JA(e=>{const{stackParser:n,attachStacktrace:r}=v0();if(le()!==t||Qb())return;const i=j2(e),s=Gs(i)?$2(i):Bh(n,i,void 0,r,!0);s.level="error",vo(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function j2(t){if(Gs(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function $2(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function X2(t,e,n,r){const i=t.exception=t.exception||{},s=i.values=i.values||[],a=s[0]=s[0]||{},o=a.stacktrace=a.stacktrace||{},c=o.frames=o.frames||[],u=r,l=n,d=$n(e)&&e.length>0?e:$i();
498return c.length===0&&c.push({colno:u,filename:d,function:fr,in_app:!0,lineno:l}),t}function x0(t){Le&&W.log(`Global Handler attached: ${t}`)}function v0(){const t=le();return(t==null?void 0:t.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const B0=()=>({name:"HttpContext",preprocessEvent(t){var r;if(!he.navigator&&!he.location&&!he.document)return;const e=Ch(),n={...e.headers,...(r=t.request)==null?void 0:r.headers};t.request={...e,...t.request,headers:n}}}),J2="cause",Z2=5,e4="LinkedErrors",P0=((t={})=>{const e=t.limit||Z2,n=t.key||J2;return{name:e4,preprocessEvent(r,i,s){const a=s.getOptions();tR(Qu,a.stackParser,n,e,r,i)}}});function t4(){return n4()?(Le&&fi(()=>{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 n4(){var s;if(typeof he.window>"u")return!1;const t=he;if(t.nw)return!1;const e=t.chrome||t.browser;if(!((s=e==null?void 0:e.runtime)!=null&&s.id))return!1;const n=$i(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(he===he.top&&r.some(a=>n.startsWith(`${a}://`)))}function R0(t){return[Ow(),Mw(),T0(),_0(),C0(),P0(),Vw(),B0(),I0()]}function r4(t={}){const e=!t.skipBrowserExtensionCheck&&t4(),n={...t,enabled:e?!1:t.enabled,stackParser:o1(t.stackParser||E0),integrations:dP({integrations:t.integrations,defaultIntegrations:t.defaultIntegrations==null?R0():t.defaultIntegrations}),transport:t.transport||jh};return CP(Kb,n)}function i4(){}function s4(t){t()}function $h(t={}){const e=he.document,n=(e==null?void 0:e.head)||(e==null?void 0:e.body);if(!n){Le&&W.error("[showReportDialog] Global document not defined");return}const r=Be(),i=le(),s=i==null?void 0:i.getDsn();if(!s){Le&&W.error("[showReportDialog] DSN not configured");return}const a={...t,user:{...r.getUser(),...t.user},eventId:t.eventId||iw()},o=he.document.createElement("script");o.async=!0,o.crossOrigin="anonymous",o.src=uP(s,a);const{onLoad:c,onClose:u}=a;if(c&&(o.onload=c),u){const l=d=>{if(d.data==="__sentry_reportdialog_closed__")try{u()}finally{he.removeEventListener("message",l)}};he.addEventListener("message",l)}n.appendChild(o)}const a4=Te,o4="ReportingObserver",F0=new WeakMap,c4=((t={})=>{const e=t.types||["crash","deprecation","intervention"];function n(r){if(F0.has(le()))for(const i of r)An(s=>{s.setExtra("url",i.url);const a=`ReportingObserver [${i.type}]`;let o="No details available";if(i.body){const c={};for(const u in i.body)c[u]=i.body[u];if(s.setExtra("body",c),i.type==="crash"){const u=i.body;o=[u.crashId||"",u.reason||""].join(" ").trim()||o}else o=i.body.message||o}_u(`${a}: ${o}`)})}return{name:o4,setupOnce(){if(!lF())return;new a4.ReportingObserver(n,{buffered:!0,types:e}).observe()},setup(r){F0.set(r,!0)}}}),u4="HttpClient",l4=((t={})=>{const e={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...t};return{name:u4,setup(n){y4(n,e),w4(n,e)}}});function d4(t,e,n,r,i){if(O0(t,n.status,n.url)){const s=b4(e,r);let a,o,c,u;U0()&&([a,c]=M0("Cookie",s),[o,u]=M0("Set-Cookie",n));const l=N0({url:s.url,method:s.method,status:n.status,requestHeaders:a,responseHeaders:o,requestCookies:c,responseCookies:u,error:i});vo(l)}}function M0(t,e){const n=p4(e.headers);let r;try{const i=n[t]||n[t.toLowerCase()]||void 0;i&&(r=D0(i))}catch{}return[n,r]}function f4(t,e,n,r,i){if(O0(t,e.status,e.responseURL)){let s,a,o;if(U0()){try{const u=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0;u&&(a=D0(u))}catch{}try{o=m4(e)}catch{}s=r}const c=N0({url:e.responseURL,method:n,status:e.status,requestHeaders:s,responseHeaders:o,responseCookies:a,error:i});vo(c)}}function h4(t){if(t){const e=t["Content-Length"]||t["content-length"];if(e)return parseInt(e,10)}}function D0(t){return t.split("; ").reduce((e,n)=>{const[r,i]=n.split("=");return r&&i&&(e[r]=i),e},{})}function p4(t){const e={};return t.forEach((n,r)=>{e[r]=n}),e}function m4(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
499`).reduce((n,r)=>{const[i,s]=r.split(": ");return i&&s&&(n[i]=s),n},{}):{}}function g4(t,e){return t.some(n=>typeof n=="string"?e.includes(n):n.test(e))}function A4(t,e){return t.some(n=>typeof n=="number"?n===e:e>=n[0]&&e<=n[1])}function y4(t,e){ob()&&ch(n=>{if(le()!==t)return;const{response:r,args:i,error:s,virtualError:a}=n,[o,c]=i;r&&d4(e,o,r,c,s||a)},!1)}function w4(t,e){"XMLHttpRequest"in Te&&qh(n=>{if(le()!==t)return;const{error:r,virtualError:i}=n,s=n.xhr,a=s[Ur];if(!a)return;const{method:o,request_headers:c}=a;try{f4(e,s,o,c,r||i)}catch(u){Le&&W.warn("Error while extracting response event form XHR response",u)}})}function O0(t,e,n){return A4(t.failedRequestStatusCodes,e)&&g4(t.failedRequestTargets,n)&&!vw(n,le())}function N0(t){const e=le(),n=e&&t.error&&t.error instanceof Error?t.error.stack:void 0,r=n&&e?e.getOptions().stackParser(n,0,1):void 0,i=`HTTP Client Error with status code: ${t.status}`,s={message:i,exception:{values:[{type:"Error",value:i,stacktrace:r?{frames:r}:void 0}]},request:{url:t.url,method:t.method,headers:t.requestHeaders,cookies:t.requestCookies},contexts:{response:{status_code:t.status,headers:t.responseHeaders,cookies:t.responseCookies,body_size:h4(t.responseHeaders)}}};return mi(s,{type:"http.client",handled:!1}),s}function b4(t,e){return!e&&t instanceof Request||t instanceof Request&&t.bodyUsed?t:new Request
499(t,e)}function U0(){const t=le();return t?!!t.getOptions().sendDefaultPii:!1}const Xh=Te,E4=7,S4="ContextLines",_4=((t={})=>{const e=t.frameContextLines!=null?t.frameContextLines:E4;return{name:S4,processEvent(n){return T4(n,e)}}});function T4(t,e){var o;const n=Xh.document,r=Xh.location&&nb(Xh.location.href);if(!n||!r)return t;const i=(o=t.exception)==null?void 0:o.values;if(!(i!=null&&i.length))return t;const s=n.documentElement.innerHTML;if(!s)return t;const a=["<!DOCTYPE html>","<html>",...s.split(`
500`),"</html>"];return i.forEach(c=>{const u=c.stacktrace;u!=null&&u.frames&&(u.frames=u.frames.map(l=>k4(l,a,r,e)))}),t}function k4(t,e,n,r){return t.filename!==n||!t.lineno||!e.length||b1(e,t,r),t}const I4="GraphQLClient",C4=(t=>({name:I4,setup(e){x4(e,t),v4(e,t)}}));function x4(t,e){t.on("beforeOutgoingRequestSpan",(n,r)=>{const s=ke(n).data||{};if(!(s[Pt]==="http.client"))return;const c=s[O1]||s["http.url"],u=s[D1]||s["http.method"];if(!$n(c)||!$n(u))return;const{endpoints:l}=e,d=Xn(c,l),f=z0(r);if(d&&f){const h=Q0(f);if(h){const m=L0(h);n.updateName(`${u} ${c} (${m})`),n.setAttribute("graphql.document",f)}}})}function v4(t,e){t.on("beforeOutgoingRequestBreadcrumb",(n,r)=>{const{category:i,type:s,data:a}=n;if(s==="http"&&(i==="fetch"||i==="xhr")){const l=a==null?void 0:a.url,{endpoints:d}=e,f=Xn(l,d),h=z0(r);if(f&&a&&h){const m=Q0(h);if(!a.graphql&&m){const p=L0(m);a["graphql.document"]=m.query,a["graphql.operation"]=p}}}})}function L0(t){const{query:e,operationName:n}=t,{operationName:r=n,operationType:i}=B4(e);return r?`${i} ${r}`:`${i}`}function z0(t){const e="xhr"in t;let n;if(e){const r=t.xhr[Ur];n=r&&tl(r.body)[0]}else{const r=Yh(t.input);n=tl(r)[0]}return n}function B4(t){const e=/^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/,n=/^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/,r=t.match(e);if(r)return{operationType:r[1],operationName:r[2]};const i=t.match(n);return i?{operationType:i[1],operationName:void 0}:{operationType:void 0,operationName:void 0}}function Q0(t){let e;try{const n=JSON.parse(t);!!n.query&&(e=n)}finally{return e}}const P4=C4,ct=Te,Jh="sentryReplaySession",R4="replay_event",Zh="Unable to send Replay",F4=3e5,M4=9e5,D4=5e3,O4=5500,N4=6e4,U4=5e3,L4=3,H0=15e4,il=5e3,z4=3e3,Q4=300,ep=2e7,H4=4999,W4=15e3,W0=36e5;var V4=Object.defineProperty,G4=(t,e,n)=>e in t?V4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,V0=(t,e,n)=>G4(t,typeof e!="symbol"?e+"":e,n),Ot=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(Ot||{});function q4(t){return t.nodeType===t.ELEMENT_NODE}function Qo(t){const e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function Ho(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function Y4(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function K4(t){const{cssText:e}=t;if(e.split('"').length<3)return e;const n=["@import",`url(${JSON.stringify(t.href)})`];return t.layerName===""?n.push("layer"):t.layerName&&n.push(`layer(${t.layerName})`),t.supportsText&&n.push(`supports(${t.supportsText})`),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}function sl(t){try{const e=t.rules||t.cssRules;return e?Y4(Array.from(e,G0).join("")):null}catch{return null}}function j4(t){let e="";for(let n=0;n<t.style.length;n++){const r=t.style,i=r[n],s=r.getPropertyPriority(i);e+=`${i}:${r.getPropertyValue(i)}${s?" !important":""};`}return`${t.selectorText} { ${e} }`}function G0(t){let e;if(X4(t))try{e=sl(t.styleSheet)||K4(t)}catch{}else if(J4(t)){let n=t.cssText;const r=t.selectorText.includes(":"),i=typeof t.style.all=="string"&&t.style.all;if(i&&(n=j4(t)),r&&(n=$4(n)),r||i)return n}return e||t.cssText}function $4(t){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function X4(t){return"styleSheet"in t}function J4(t){return"selectorText"in t}let q0=class{constructor(){V0(this,"idNodeMap",new Map),V0(this,"nodeMetaMap",new WeakMap)}getId(e){var r;return e?((r=this.getMeta(e))==null?void 0:r.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 n=this.getId(e);
500this.idNodeMap.delete(n),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,n){const r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)}replace(e,n){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Z4(){return new q0}function al({maskInputOptions:t,tagName:e,type:n}){return e==="OPTION"&&(e="SELECT"),!!(t[e.toLowerCase()]||n&&t[n]||n==="password"||e==="INPUT"&&!n&&t.text)}function Wo({isMasked:t,element:e,value:n,maskInputFn:r}){let i=n||"";return t?(r&&(i=r(i,e)),"*".repeat(i.length)):i}function fa(t){return t.toLowerCase()}function tp(t){return t.toUpperCase()}const Y0="__rrweb_original__";function eO(t){const e=t.getContext("2d");if(!e)return!0;const n=50;for(let r=0;r<t.width;r+=n)for(let i=0;i<t.height;i+=n){const s=e.getImageData,a=Y0 in s?s[Y0]:s;if(new Uint32Array(a.call(e,r,i,Math.min(n,t.width-r),Math.min(n,t.height-i)).data.buffer).some(c=>c!==0))return!1}return!0}function np(t){const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?fa(e):null}function ol(t,e,n){return e==="INPUT"&&(n==="radio"||n==="checkbox")?t.getAttribute("value")||"":t.value}function K0(t,e){let n;try{n=new URL(t,e??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r);return(i==null?void 0:i[1])??null}const j0={};function $0(t){const e=j0[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return j0[t]=r.bind(window)}function rp(...t){return $0("setTimeout")(...t)}function X0(...t){return $0("clearTimeout")(...t)}function J0(t){try{return t.contentDocument}catch{}}let tO=1;const nO=new RegExp("[^a-z0-9-_:]"),Vo=-2;function ip(){return tO++}function rO(t){if(t instanceof HTMLFormElement)return"form";const e=fa(t.tagName);return nO.test(e)?"div":e}function iO(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}let ha,Z0;const sO=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,aO=/^(?:[a-z+]+:)?\/\//i,oO=/^www\..*/i,cO=/^(data:)([^,]*),(.*)/i;function cl(t,e){return(t||"").replace(sO,(n,r,i,s,a,o)=>{const c=i||a||o,u=r||s||"";if(!c)return n;if(aO.test(c)||oO.test(c))return`url(${u}${c}${u})`;if(cO.test(c))return`url(${u}${c}${u})`;if(c[0]==="/")return`url(${u}${iO(e)+c}${u})`;const l=e.split("/"),d=c.split("/");l.pop();for(const f of d)f!=="."&&(f===".."?l.pop():l.push(f));return`url(${u}${l.join("/")}${u})`})}const uO=/^[^ \t\n\r\u000c]+/,lO=/^[, \t\n\r\u000c]+/;function dO(t,e){if(e.trim()==="")return e;let n=0;function r(s){let a;const o=s.exec(e.substring(n));return o?(a=o[0],n+=a.length,a):""}const i=[];for(;r(lO),!(n>=e.length);){let s=r(uO);if(s.slice(-1)===",")s=pa(t,s.substring(0,s.length-1)),i.push(s);else{let a="";s=pa(t,s);let o=!1;for(;;){const c=e.charAt(n);if(c===""){i.push((s+a).trim());break}else if(o)c===")"&&(o=!1);else if(c===","){n+=1,i.push((s+a).trim());break}else c==="("&&(o=!0);a+=c,n+=1}}}return i.join(", ")}const eE=new WeakMap;function pa(t,e){return!e||e.trim()===""?e:ul(t,e)}function fO(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function ul(t,e){let n=eE.get(t);if(n||(n=t.createElement("a"),eE.set(t,n)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return n.setAttribute("href",e),n.href}function tE(t,e,n,r,i,s){return r&&(n==="src"||n==="href"&&!(e==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(e==="table"||e==="td"||e==="th")?pa(t,r):n==="srcset"?dO(t,r):n==="style"?cl(r,ul(t)):e==="object"&&n==="data"?pa(t,r):typeof s=="function"?s(n,r,i):r)}
500function nE(t,e,n){return(t==="video"||t==="audio")&&e==="autoplay"}function hO(t,e,n,r){try{if(r&&t.matches(r))return!1;if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;){const s=t.classList[i];if(e.test(s))return!0}if(n)return t.matches(n)}catch{}return!1}function pO(t,e){for(let n=t.classList.length;n--;){const r=t.classList[n];if(e.test(r))return!0}return!1}function hs(t,e,n=1/0,r=0){return!t||t.nodeType!==t.ELEMENT_NODE||r>n?-1:e(t)?r:hs(t.parentNode,e,n,r+1)}function ma(t,e){return n=>{const r=n;if(r===null)return!1;try{if(t){if(typeof t=="string"){if(r.matches(`.${t}`))return!0}else if(pO(r,t))return!0}return!!(e&&r.matches(e))}catch{return!1}}}function ga(t,e,n,r,i,s){try{const a=t.nodeType===t.ELEMENT_NODE?t:t.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,c=-1;if(s){if(c=hs(a,ma(r,i)),c<0)return!0;o=hs(a,ma(e,n),c>=0?c:1/0)}else{if(o=hs(a,ma(e,n)),o<0)return!1;c=hs(a,ma(r,i),o>=0?o:1/0)}return o>=0?c>=0?o<=c:!0:c>=0?!1:!!s}catch{}return!!s}function mO(t,e,n){const r=t.contentWindow;if(!r)return;let i=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const o=rp(()=>{i||(e(),i=!0)},n);t.addEventListener("load",()=>{X0(o),i=!0,e()});return}const a="about:blank";if(r.location.href!==a||t.src===a||t.src==="")return rp(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}function gO(t,e,n){let r=!1,i;try{i=t.sheet}catch{return}if(i)return;const s=rp(()=>{r||(e(),r=!0)},n);t.addEventListener("load",()=>{X0(s),r=!0,e()})}function AO(t,e){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskAttributeFn:c,maskTextClass:u,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:f,inlineStylesheet:h,maskInputOptions:m={},maskTextFn:p,maskInputFn:g,dataURLOptions:A={},inlineImages:y,recordCanvas:w,keepIframeSrcFn:E,newlyAddedElement:S=!1}=e,k=yO(n,r);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:Ot.Document,childNodes:[],compatMode:t.compatMode}:{type:Ot.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Ot.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:k};case t.ELEMENT_NODE:return bO(t,{doc:n,blockClass:i,blockSelector:s,unblockSelector:a,inlineStylesheet:h,maskAttributeFn:c,maskInputOptions:m,maskInputFn:g,dataURLOptions:A,inlineImages:y,recordCanvas:w,keepIframeSrcFn:E,newlyAddedElement:S,rootId:k,maskTextClass:u,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:f});case t.TEXT_NODE:return wO(t,{doc:n,maskAllText:o,maskTextClass:u,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:f,maskTextFn:p,maskInputOptions:m,maskInputFn:g,rootId:k});case t.CDATA_SECTION_NODE:return{type:Ot.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return{type:Ot.Comment,textContent:t.textContent||"",rootId:k};default:return!1}}function yO(t,e){if(!e.hasNode(t))return;const n=e.getId(t);return n===1?void 0:n}function wO(t,e){var A;const{maskAllText:n,maskTextClass:r,unmaskTextClass:i,maskTextSelector:s,unmaskTextSelector:a,maskTextFn:o,maskInputOptions:c,maskInputFn:u,rootId:l}=e,d=t.parentNode&&t.parentNode.tagName;let f=t.textContent;const h=d==="STYLE"?!0:void 0,m=d==="SCRIPT"?!0:void 0,p=d==="TEXTAREA"?!0:void 0;if(h&&f){try{t.nextSibling||t.previousSibling||(A=t.parentNode.sheet)!=null&&A.cssRules&&(f=sl(t.parentNode.sheet))}catch(y){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${y}`,t)}f=cl(f,ul(e.doc))}m&&(f="SCRIPT_PLACEHOLDER");const g=ga(t,r,s,i,a,n);if(!h&&!m&&!p&&f&&g&&(f=o?o(f,t.parentElement):f.replace(/[\S]/g,"*")),p&&f&&(c.textarea||g)&&(f=u?u(f,t.parentNode):f.replace(/[\S]/g,"*")),d==="OPTION"&&f){const y=al({type:null,tagName:d,maskInputOptions:c});f=Wo({isMasked:ga(t,r,s,i,a,y),element:t,value:f,maskInputFn:u})}return{type:Ot.Text,textContent:f||"",isStyle:h,rootId:l}}function bO(t,e){const{doc:n,blockClass:r,blockSelector:i,unblockSelector:s,inlineStylesheet:a,maskInputOptions:o={},maskAttributeFn:c,maskInputFn:u,dataURLOptions:l={},inlineImages:d,recordCanvas:f,keepIframeSrcFn:h,newlyAddedElement:m=!1,rootId:p,maskTextClass:g,unmaskTextClass:A,maskTextSelector:y,unmaskTextSelector:w}=e,E=hO(t,r,i,s),S=rO(t);let k={};const T=t.attributes.length;for(let _=0;_<T;_++){const x=t.attributes[_];x.name&&!nE(S,x.name,x.value)&&(k[x.name]=tE(n,S,fa(x.name),x.value,t,c))}if(S==="link"&&a){const _=Array.from(n.styleSheets).find(P=>P.href===t.href);let x=null;_&&(x=sl(_)),x&&(k.rel=null,k.href=null,k.crossorigin=null,k._cssText=cl(x,_.href))}if(S==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const _=sl(t.sheet);_&&(k._cssText=cl(_,ul(n)))}if(S==="input"||S==="textarea"||S==="select"||S==="option"){const _=t,x=np(_),P=ol(_,tp(S),x),v=_.checked;if(x!=="submit"&&x!=="button"&&P){const M=ga(_,g,y,A,w,al({type:x,tagName:tp(S),maskInputOptions:o}));k.value=Wo({isMasked:M,element:_,value:P,maskInputFn:u})}v&&(k.checked=v)}if(S==="option"&&(t.selected&&!o.select?k.selected=!0:delete k.selected),S==="canvas"&&f){if(t.__context==="2d")eO(t)||(k.rr_dataURL=t.toDataURL(l.type,l.quality));else if(!("__context"in t)){const _=t.toDataURL(l.type,l.quality),x=n.createElement("canvas");x.width=t.width,x.height=t.height;const P=x.toDataURL(l.type,l.quality);_!==P&&(k.rr_dataURL=_)}}if(S==="img"&&d){ha||(ha=n.createElement("canvas"),Z0=ha.getContext("2d"));const _=t,x=_.currentSrc||_.getAttribute("src")||"<unknown-src>",P=_.crossOrigin,v=()=>{_.removeEventListener("load",v);
vendor: 3,183 bytes, line 500
500try{ha.width=_.naturalWidth,ha.height=_.naturalHeight,Z0.drawImage(_,0,0),k.rr_dataURL=ha.toDataURL(l.type,l.quality)}catch(M){if(_.crossOrigin!=="anonymous"){_.crossOrigin="anonymous",_.complete&&_.naturalWidth!==0?v():_.addEventListener("load",v);return}else console.warn(`Cannot inline img src=${x}! Error: ${M}`)}_.crossOrigin==="anonymous"&&(P?k.crossOrigin=P:_.removeAttribute("crossorigin"))};_.complete&&_.naturalWidth!==0?v():_.addEventListener("load",v)}if((S==="audio"||S==="video")&&(k.rr_mediaState=t.paused?"paused":"played",k.rr_mediaCurrentTime=t.currentTime),m||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),E){const{width:_,height:x}=t.getBoundingClientRect();k={class:k.class,rr_width:`${_}px`,rr_height:`${x}px`}}S==="iframe"&&!h(k.src)&&(!E&&!J0(t)&&(k.rr_src=k.src),delete k.src);let C;try{customElements.get(S)&&(C=!0)}catch{}return{type:Ot.Element,tagName:S,attributes:k,childNodes:[],isSVG:fO(t)||void 0,needBlock:E,rootId:p,isCustom:C}}function ut(t){return t==null?"":t.toLowerCase()}function EO(t,e){if(e.comment&&t.type===Ot.Comment)return!0;if(t.type===Ot.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"||t.attributes.rel==="modulepreload")||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&K0(t.attributes.href)==="js"))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(ut(t.attributes.name).match(/^msapplication-tile(image|color)$/)||ut(t.attributes.name)==="application-name"||ut(t.attributes.rel)==="icon"||ut(t.attributes.rel)==="apple-touch-icon"||ut(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&ut(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ut(t.attributes.property).match(/^(og|twitter|fb):/)||ut(t.attributes.name).match(/^(og|twitter):/)||ut(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ut(t.attributes.name)==="robots"||ut(t.attributes.name)==="googlebot"||ut(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ut(t.attributes.name)==="author"||ut(t.attributes.name)==="generator"||ut(t.attributes.name)==="framework"||ut(t.attributes.name)==="publisher"||ut(t.attributes.name)==="progid"||ut(t.attributes.property).match(/^article:/)||ut(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ut(t.attributes.name)==="google-site-verification"||ut(t.attributes.name)==="yandex-verification"||ut(t.attributes.name)==="csrf-token"||ut(t.attributes.name)==="p:domain_verify"||ut(t.attributes.name)==="verify-v1"||ut(t.attributes.name)==="verification"||ut(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Aa(t,e){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:f=!1,inlineStylesheet:h=!0,maskInputOptions:m={},maskAttributeFn:p,maskTextFn:g,maskInputFn:A,slimDOMOptions:y,dataURLOptions:w={}
500,inlineImages:E=!1,recordCanvas:S=!1,onSerialize:k,onIframeLoad:T,iframeLoadTimeout:C=5e3,onBlockedImageLoad:_,onStylesheetLoad:x,stylesheetLoadTimeout:P=5e3,keepIframeSrcFn:v=()=>!1,newlyAddedElement:M=!1}=e;let{preserveWhiteSpace:D=!0}=e;const O=AO(t,{doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:o,unblockSelector:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,inlineStylesheet:h,maskInputOptions:m,maskAttributeFn:p,maskTextFn:g,maskInputFn:A,dataURLOptions:w,inlineImages:E,recordCanvas:S,keepIframeSrcFn:v,newlyAddedElement:M});if(!O)return console.warn(t,"not serialized"),null;let N;r.hasNode(t)?N=r.getId(t):EO(O,y)||!D&&O.type===Ot.Text&&!O.isStyle&&!O.textContent.replace(/^\s+|\s+$/gm,"").length?N=Vo:N=ip();const Q=Object.assign(O,{id:N});if(r.add(t,Q),N===Vo)return null;k&&k(t);let G=!f;if(Q.type===Ot.Element){G=G&&!Q.needBlock;const V=t.shadowRoot;V&&Ho(V)&&(Q.isShadowHost=!0)}if((Q.type===Ot.Document||Q.type===Ot.Element)&&G){y.headWhitespace&&Q.type===Ot.Element&&Q.tagName==="head"&&(D=!1);const V={doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:o,unblockSelector:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:f,inlineStylesheet:h,maskInputOptions:m,maskAttributeFn:p,maskTextFn:g,maskInputFn:A,slimDOMOptions:y,dataURLOptions:w,inlineImages:E,recordCanvas:S,preserveWhiteSpace:D,onSerialize:k,onIframeLoad:T,iframeLoadTimeout:C,onBlockedImageLoad:_,onStylesheetLoad:x,stylesheetLoadTimeout:P,keepIframeSrcFn:v},Z=t.childNodes?Array.from(t.childNodes):[];for(const B of Z){const L=Aa(B,V);L&&Q.childNodes.push(L)}if(q4(t)&&t.shadowRoot)for(const B of Array.from(t.shadowRoot.childNodes)){const L=Aa(B,V);L&&(Ho(t.shadowRoot)&&(L.isShadow=!0),Q.childNodes.push(L))}}if(t.parentNode&&Qo(t.parentNode)&&Ho(t.parentNode)&&(Q.isShadow=!0),Q.type===Ot.Element&&Q.tagName==="iframe"&&!Q.needBlock&&mO(t,()=>{const V=J0(t);if(V&&T){const Z=Aa(V,{doc:V,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:h,maskInputOptions:m,maskAttributeFn:p,maskTextFn:g,maskInputFn:A,slimDOMOptions:y,dataURLOptions:w,inlineImages:E,recordCanvas:S,preserveWhiteSpace:D,onSerialize:k,onIframeLoad:T,iframeLoadTimeout:C,onStylesheetLoad:x,stylesheetLoadTimeout:P,keepIframeSrcFn:v});Z&&T(t,Z)}},C),Q.type===Ot.Element&&Q.tagName==="img"&&!t.complete&&Q.needBlock){const V=t,Z=()=>{if(V.isConnected&&!V.complete&&_)try{const B=V.getBoundingClientRect();B.width>0&&B.height>0&&_(V,Q,B)}catch{}V.removeEventListener("load",Z)};V.isConnected&&V.addEventListener("load",Z)}return Q.type===Ot.Element&&Q.tagName==="link"&&typeof Q.attributes.rel=="string"&&(Q.attributes.rel==="stylesheet"||Q.attributes.rel==="preload"&&typeof Q.attributes.href=="string"&&K0(Q.attributes.href)==="css")&&gO(t,()=>{if(x){const V=Aa(t,{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:h,maskInputOptions:m,maskAttributeFn:p,maskTextFn:g,maskInputFn:A,slimDOMOptions:y,dataURLOptions:w,inlineImages:E,recordCanvas:S,preserveWhiteSpace:D,onSerialize:k,onIframeLoad:T,iframeLoadTimeout:C,onStylesheetLoad:x,stylesheetLoadTimeout:P,keepIframeSrcFn:v});V&&x(t,V)}},P),Q.type===Ot.Element&&delete Q.needBlock,Q}function SO(t,e){const{mirror:n=new q0,blockClass:r="rr-block",blockSelector:i=null,unblockSelector:s=null,maskAllText:a=!1,maskTextClass:o="rr-mask",unmaskTextClass:c=null,maskTextSelector:u=null,unmaskTextSelector:l=null,inlineStylesheet:d=!0,inlineImages:f=!1,recordCanvas:h=!1,maskAllInputs:m=!1,maskAttributeFn:p,maskTextFn:g,maskInputFn:A,slimDOM:y=!1,dataURLOptions:w,preserveWhiteSpace:E,onSerialize:S,onIframeLoad:k,iframeLoadTimeout:T,onBlockedImageLoad:C,onStylesheetLoad:_,stylesheetLoadTimeout:x,keepIframeSrcFn:P=()=>!1}=e||{};return Aa(t,{doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,maskAllText:a,maskTextClass:o,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions: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}:m===!1?{}:m,maskAttributeFn:p,maskTextFn:g,maskInputFn:A,slimDOMOptions:y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}
500:y===!1?{}:y,dataURLOptions:w,inlineImages:f,recordCanvas:h,preserveWhiteSpace:E,onSerialize:S,onIframeLoad:k,iframeLoadTimeout:T,onBlockedImageLoad:C,onStylesheetLoad:_,stylesheetLoadTimeout:x,keepIframeSrcFn:P,newlyAddedElement:!1})}function ln(t,e,n=document){const r={capture:!0,passive:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}const ya=`Please stop import mirror directly. Instead of that,\r
501now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
502or you can use record.mirror to access the mirror instance during recording.`;let rE={map:{},getId(){return console.error(ya),-1},getNode(){return console.error(ya),null},removeNodeFromMap(){console.error(ya)},has(){return console.error(ya),!1},reset(){console.error(ya)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(rE=new Proxy(rE,{get(t,e,n){return e==="map"&&console.error(ya),Reflect.get(t,e,n)}}));function Go(t,e,n={}){let r=null,i=0;return function(...s){const a=Date.now();!i&&n.leading===!1&&(i=a);const o=e-(a-i),c=this;o<=0||o>e?(r&&(vO(r),r=null),i=a,t.apply(c,s)):!r&&n.trailing!==!1&&(r=dl(()=>{i=n.leading===!1?0:Date.now(),r=null,t.apply(c,s)},o))}}function iE(t,e,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(a){dl(()=>{n.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>iE(t,e,s||{},!0)}function sp(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}let ll=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ll=()=>new Date().getTime());function sE(t){var n,r,i,s,a,o;const e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:(e==null?void 0:e.documentElement.scrollLeft)||((r=(n=e==null?void 0:e.body)==null?void 0:n.parentElement)==null?void 0:r.scrollLeft)||((i=e==null?void 0:e.body)==null?void 0:i.scrollLeft)||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:(e==null?void 0:e.documentElement.scrollTop)||((a=(s=e==null?void 0:e.body)==null?void 0:s.parentElement)==null?void 0:a.scrollTop)||((o=e==null?void 0:e.body)==null?void 0:o.scrollTop)||0}}function aE(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function oE(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function cE(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function kn(t,e,n,r,i){if(!t)return!1;const s=cE(t);if(!s)return!1;const a=ma(e,n);if(!i){const u=r&&s.matches(r);return a(s)&&!u}const o=hs(s,a);let c=-1;return o<0?!1:(r&&(c=hs(s,ma(null,r))),o>-1&&c<0?!0:o<c)}function _O(t,e){return e.getId(t)!==-1}function ap(t,e){return e.getId(t)===Vo}function uE(t,e){if(Qo(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?uE(t.parentNode,e):!0:!0}function op(t){return!!t.changedTouches}function TO(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function lE(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function dE(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function cp(t){return!!(t!=null&&t.shadowRoot)}class kO{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,n){if(this.has(e))return this.getId(e);let r;return n===void 0?r=this.id++:r=n,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 fE(t){var n,r;let e=null;return((r=(n=t.getRootNode)==null?void 0:n.call(t))==null?void 0:r.no
502deType)===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function IO(t){let e=t,n;for(;n=fE(e);)e=n;return e}function CO(t){const e=t.ownerDocument;if(!e)return!1;const n=IO(t);return e.contains(n)}function hE(t){const e=t.ownerDocument;return e?e.contains(t)||CO(t):!1}const pE={};function up(t){const e=pE[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return pE[t]=r.bind(window)}function xO(...t){return up("requestAnimationFrame")(...t)}function dl(...t){return up("setTimeout")(...t)}function vO(...t){return up("clearTimeout")(...t)}var ze=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(ze||{}),Ce=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(Ce||{}),dn=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(dn||{}),Lr=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Lr||{}),wa=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(wa||{});function lp(t){try{return t.contentDocument}catch{}}function BO(t){try{return t.contentWindow}catch{}}function mE(t){return"__ln"in t}class PO{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 n=this.head;for(let r=0;r<e;r++)n=(n==null?void 0:n.next)||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&mE(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&mE(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){const n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const gE=(t,e)=>`${t}@${e}`;class RO{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=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Set,r=new PO,i=c=>{let u=c,l=Vo;for(;l===Vo;)u=u&&u.nextSibling,l=u&&this.mirror.getId(u);return l},s=c=>{if(!c.parentNode||!hE(c))return;const u=Qo(c.parentNode)?this.mirror.getId(fE(c)):this.mirror.getId(c.parentNode),l=i(c);if(u===-1||l===-1)return r.addNode(c);const d=Aa(c,{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.inl
502ineStylesheet,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=>{lE(f,this.mirror)&&!kn(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(f),dE(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),cp(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,h)=>{kn(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(f,h),f.contentWindow&&this.canvasManager.addWindow(f.contentWindow),this.shadowDomManager.observeAttachShadow(f))},onStylesheetLoad:(f,h)=>{this.stylesheetManager.attachLinkElement(f,h)},onBlockedImageLoad:(f,h,{width:m,height:p})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:h.id,attributes:{style:{width:`${m}px`,height:`${p}px`}}}]})}});d&&(e.push({parentId:u,nextId:l,node:d}),n.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)AE(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!yE(this.droppedSet,c)&&!AE(this.removes,c,this.mirror)||yE(this.movedSet,c)?s(c):this.droppedSet.add(c);let a=null;for(;r.length;){let c=null;if(a){const u=this.mirror.getId(a.value.parentNode),l=i(a.value);u!==-1&&l!==-1&&(c=a)}if(!c){let u=r.tail;for(;u;){const l=u;if(u=u.previous,l){const d=this.mirror.getId(l.value.parentNode);if(i(l.value)===-1)continue;if(d!==-1){c=l;break}else{const h=l.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const m=h.parentNode.host;if(this.mirror.getId(m)!==-1){c=l;break}}}}}}if(!c){for(;r.head;)r.removeNode(r.head.value);break}a=c.previous,r.removeNode(c.value),s(c.value)}const o={texts:this.texts.map(c=>({id:this.mirror.getId(c.node),value:c.value})).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:u}=c;if(typeof u.style=="string"){const l=JSON.stringify(c.styleDiff),d=JSON.stringify(c._unchangedStyles);l.length<u.style.length&&(l+d).split("var(").length===u.style.split("var(").length&&(u.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:u}}).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.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(!ap(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!kn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:ga(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,cE(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const a=np(n),o=n.tagName;i=ol(n,o,a);const c=al({maskInputOptions:this.maskInputOptions,tagName:o,type:a}),u=ga(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);i=Wo({isMasked:u,element:n,value:i,maskInputFn:this.maskInputFn})}if(kn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||i===e.oldValue)return;let s=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!lp(n))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"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!nE(n.tagName,r)&&(s.attributes[r]=tE(this.doc,fa(n.tagName),fa(r),i,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const o of Array.from(n.style)){const c=n.style.getPropertyValue(o),u=n.style.getPropertyPriority(o);c!==a.style.getPropertyValue(o)||u!==a.style.getPropertyPriority(o)?u===""?s.styleDiff[o]=c:s.styleDiff[o]=[c,u]:s._unchangedStyles[o]=[c,u]}for(const o of Array.from(a.style))n.style.getPropertyValue(o)===""&&(s.styleDiff[o]=!1)}break}
vendor: 9,463 bytes, line 502
502case"childList":{if(kn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),i=Qo(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);kn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||ap(n,this.mirror)||!_O(n,this.mirror)||(this.addedSet.has(n)?(dp(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||uE(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[gE(r,i)]?dp(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:Qo(e.target)&&Ho(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(ap(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[gE(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);kn(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes&&e.childNodes.forEach(r=>this.genAdds(r)),cp(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"].forEach(n=>{this[n]=e[n]})}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 dp(t,e){var n;t.delete(e),(n=e.childNodes)==null||n.forEach(r=>dp(t,r))}function AE(t,e,n){return t.length===0?!1:FO(t,e,n)}function FO(t,e,n){let r=e.parentNode;for(;r;){const i=n.getId(r);if(t.some(s=>s.id===i))return!0;r=r.parentNode}return!1}function yE(t,e){return t.size===0?!1:wE(t,e)}function wE(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:wE(t,n):!1}let qo;function MO(t){qo=t}function DO(){qo=void 0}const qe=t=>qo?(...n)=>{try{return t(...n)}catch(r){if(qo&&qo(r)===!0)return()=>{};throw r}}:t,ba=[];function Yo(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function bE(t,e){var a,o;const n=new RO;ba.push(n),n.init(t);let r=window.MutationObserver||window.__rrMutationObserver;const i=(o=(a=window==null?void 0:window.Zone)==null?void 0:a.__symbol__)==null?void 0:o.call(a,"MutationObserver");i&&window[i]&&(r=window[i]);const s=new r(qe(c=>{t.onMutation&&t.onMutation(c)===!1||n.processMutations.bind(n)(c)}));return s.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function OO({mousemoveCb:t,sampling:e,doc:n,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 c=Go(qe(d=>{const f=Date.now()-o;t(a.map(h=>(h.timeOffset-=f,h)),d),a=[],o=null}),s),u=qe(Go(qe(d=>{const f=Yo(d),{clientX:h,clientY:m}=op(d)?d.changedTouches[0]:d;o||(o=ll()),a.push({x:h,y:m,id:r.getId(f),timeOffset:ll()-o}),c(typeof DragEvent<"u"&&d instanceof DragEvent?Ce.Drag:d instanceof MouseEvent?Ce.MouseMove:Ce.TouchMove)}),i,{trailing:!1})),l=[ln("mousemove",u,n),ln("touchmove",u,n),ln("drag",u,n)];return qe(()=>{l.forEach(d=>d())})}function NO({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const o=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,c=[];let u=null;const l=d=>f=>{const h=Yo(f);if(kn(h,r,i,s,!0))return;let m=null,p=d;if("pointerType"in f){switch(f.pointerType){case"mouse":m=Lr.Mouse;break;case"touch":m=Lr.Touch;break;case"pen":m=Lr.Pen;break}m===Lr.Touch?dn[d]===dn.MouseDown?p="TouchStart":dn[d]===dn.MouseUp&&(p="TouchEnd"):Lr.Pen}else op(f)&&(m=Lr.Touch);m!==null?(u=m,(p.startsWith("Touch")&&m===Lr.Touch||p.startsWith("Mouse")&&m===Lr.Mouse)&&(m=null)):dn[d]===dn.Click&&(m=u,u=null);const g=op(f)?f.changedTouches[0]:f;if(!g)return;const A=n.getId(h),{clientX:y,clientY:w}=g;qe(t)({type:dn[p],id:A,x:y,y:w,...m!==null&&{pointerType:m}})};return Object.keys(dn).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&o[d]!==!1).forEach(d=>{let f=fa(d);const h=l(d);if(window.PointerEvent)switch(dn[d]){case dn.MouseDown:case dn.MouseUp:f=f.replace("mouse","pointer");break;case dn.TouchStart:case dn.TouchEnd:return}c.push(ln(f,h,e))}),qe(()=>{c.forEach(d=>d())})}function EE({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:a}){const o=qe(Go(qe(c=>{const u=Yo(c);if(!u||kn(u,r,i,s,!0))return;const l=n.getId(u);if(u===e&&e.defaultView){const d=sE(e.defaultView);t({id:l,x:d.left,y:d.top})}else t({id:l,x:u.scrollLeft,y:u.scrollTop})}),a.scroll||100));return ln("scroll",o,e)}function UO({viewportResizeCb:t},{win:e}){let n=-1,r=-1;const i=qe(Go(qe(()=>{const s=aE(),a=oE();(n!==s||r!==a)&&(t({width:Number(a),height:Number(s)}),n=s,r=a)}),200));return ln("resize",i,e)}const LO=["INPUT","TEXTAREA","SELECT"],SE=new WeakMap;function zO({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,ignoreClass:a,ignoreSelector:o,maskInputOptions:c,maskInputFn:u,sampling:l,userTriggeredOnInput:d,maskTextClass:f,unmaskTextClass:h,maskTextSelector:m,unmaskTextSelector:p}){function g(T){let C=Yo(T);const _=T.isTrusted,x=C&&tp(C.tagName);if(x==="OPTION"&&(C=C.parentElement),!C||!x||LO.indexOf(x)<0||kn(C,r,i,s,!0))return;const P=C;if(P.classList.contains(a)||o&&P.matches(o))return;const v=np(C);let M=ol(P,x,v),D=!1;const O=al({maskInputOptions:c,tagName:x,type:v}),N=ga(C,f,m,h,p,O);(v==="radio"||v==="checkbox")&&(D=C.checked),M=Wo({isMasked:N,element:C,value:M,maskInputFn:u}),A(C,d?{text:M,isChecked:D,userTriggered:_}:{text:M,isChecked:D});const Q=C.name;v==="radio"&&Q&&D&&e.querySelectorAll(`input[type="radio"][name="${Q}"]`).forEach(G=>{if(G!==C){const V=Wo({isMasked:N,element:G,value:ol(G,x,v),maskInputFn:u});A(G,d?{text:V,isChecked:!D,userTriggered:!1}:{text:V,isChecked:!D})}})}function A(T,C){const _=SE.get(T);if(!_||_.text!==C.text||_.isChecked!==C.isChecked){SE.set(T,C);const x=n.getId(T);qe(t)({...C,id:x})}}const w=(l.input==="last"?["change"]:["input","change"]).map(T=>ln(T,qe(g),e)),E=e.defaultView;if(!E)return()=>{w.forEach(T=>T())};const S=E.Object.getOwnPropertyDescriptor(E.HTMLInputElement.prototype,"value"),k=[[E.HTMLInputElement.prototype,"value"],[E.HTMLInputElement.prototype,"checked"],[E.HTMLSelectElement.prototype,"value"],[E.HTMLTextAreaElement.prototype,"value"],[E.HTMLSelectElement.prototype,"selectedIndex"],[E.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&w.push(...k.map(T=>iE(T[0],T[1],{set(){qe(g)({target:this,isTrusted:!1})}},!1,E))),qe(()=>{w.forEach(T=>T())})}function fl(t){const e=[];function n(r,i){if(hl("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||hl("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||hl("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||hl("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 n(t,e)}function Si(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function QO({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:qe((l,d,f)=>{const[h,m]=f,{id:p,styleId:g}=Si(d,e,n.styleMirror);return(p&&p!==-1||g&&g!==-1)&&t({id:p,styleId:g,adds:[{rule:h,index:m}]}),l.apply(d,f)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:qe((l,d,f)=>{const[h]=f,{id:m,styleId:p}=Si(d,e,n.styleMirror);return(m&&m!==-1||p&&p!==-1)&&t({id:m,styleId:p,removes:[{index:h}]}),l.apply(d,f)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:qe((l,d,f)=>{const[h]=f,{id:m,styleId:p}=Si(d,e,n.styleMirror);return(m&&m!==-1||p&&p!==-1)&&t({id:m,styleId:p,replace:h}),l.apply(d,f)})}));let o;r.CSSStyleSheet.prototype.replaceSync&&(o=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(o,{apply:qe((l,d,f)=>{const[h]=f,{id:m,styleId:p}=Si(d,e,n.styleMirror);return(m&&m!==-1||p&&p!==-1)&&t({id:m,styleId:p,replaceSync:h}),l.apply(d,f)})}));const c={};pl("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(pl("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),pl("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),pl("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const u={};
vendor: 11,559 bytes, line 502
502return Object.entries(c).forEach(([l,d])=>{u[l]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[l].insertRule,{apply:qe((f,h,m)=>{const[p,g]=m,{id:A,styleId:y}=Si(h.parentStyleSheet,e,n.styleMirror);return(A&&A!==-1||y&&y!==-1)&&t({id:A,styleId:y,adds:[{rule:p,index:[...fl(h),g||0]}]}),f.apply(h,m)})}),d.prototype.deleteRule=new Proxy(u[l].deleteRule,{apply:qe((f,h,m)=>{const[p]=m,{id:g,styleId:A}=Si(h.parentStyleSheet,e,n.styleMirror);return(g&&g!==-1||A&&A!==-1)&&t({id:g,styleId:A,removes:[{index:[...fl(h),p]}]}),f.apply(h,m)})})}),qe(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=s,a&&(r.CSSStyleSheet.prototype.replace=a),o&&(r.CSSStyleSheet.prototype.replaceSync=o),Object.entries(c).forEach(([l,d])=>{d.prototype.insertRule=u[l].insertRule,d.prototype.deleteRule=u[l].deleteRule})})}function _E({mirror:t,stylesheetManager:e},n){var a,o,c;let r=null;n.nodeName==="#document"?r=t.getId(n):r=t.getId(n.host);const i=n.nodeName==="#document"?(a=n.defaultView)==null?void 0:a.Document:(c=(o=n.ownerDocument)==null?void 0:o.defaultView)==null?void 0:c.ShadowRoot,s=i!=null&&i.prototype?Object.getOwnPropertyDescriptor(i==null?void 0:i.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!i||!s?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){var u;return(u=s.get)==null?void 0:u.call(this)},set(u){var d;const l=(d=s.set)==null?void 0:d.call(this,u);if(r!==null&&r!==-1)try{e.adoptStyleSheets(u,r)}catch{}return l}}),qe(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function HO({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:qe((o,c,u)=>{var p;const[l,d,f]=u;if(n.has(l))return s.apply(c,[l,d,f]);const{id:h,styleId:m}=Si((p=c.parentRule)==null?void 0:p.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||m&&m!==-1)&&t({id:h,styleId:m,set:{property:l,value:d,priority:f},index:fl(c.parentRule)}),o.apply(c,u)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:qe((o,c,u)=>{var h;const[l]=u;if(n.has(l))return a.apply(c,[l]);const{id:d,styleId:f}=Si((h=c.parentRule)==null?void 0:h.parentStyleSheet,e,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&t({id:d,styleId:f,remove:{property:l},index:fl(c.parentRule)}),o.apply(c,u)})}),qe(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=a})}function WO({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:r,mirror:i,sampling:s,doc:a}){const o=qe(u=>Go(qe(l=>{const d=Yo(l);if(!d||kn(d,e,n,r,!0))return;const{currentTime:f,volume:h,muted:m,playbackRate:p}=d;t({type:u,id:i.getId(d),currentTime:f,volume:h,muted:m,playbackRate:p})}),s.media||500)),c=[ln("play",o(wa.Play),a),ln("pause",o(wa.Pause),a),ln("seeked",o(wa.Seeked),a),ln("volumechange",o(wa.VolumeChange),a),ln("ratechange",o(wa.RateChange),a)];return qe(()=>{c.forEach(u=>u())})}function VO({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,s=n.FontFace;n.FontFace=function(c,u,l){const d=new s(c,u,l);return i.set(d,{family:c,buffer:typeof u!="string",descriptors:l,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=sp(e.fonts,"add",function(o){return function(c){return dl(qe(()=>{const u=i.get(c);u&&(t(u),i.delete(c))}),0),o.apply(this,[c])}});return r.push(()=>{n.FontFace=s}),r.push(a),qe(()=>{r.forEach(o=>o())})}function GO(t){const{doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,selectionCb:a}=t;let o=!0;const c=qe(()=>{const u=e.getSelection();if(!u||o&&(u!=null&&u.isCollapsed))return;o=u.isCollapsed||!1;const l=[],d=u.rangeCount||0;for(let f=0;f<d;f++){const h=u.getRangeAt(f),{startContainer:m,startOffset:p,endContainer:g,endOffset:A}=h;kn(m,r,i,s,!0)||kn(g,r,i,s,!0)||l.push({start:n.getId(m),startOffset:p,end:n.getId(g),endOffset:A})}a({ranges:l})});return c(),ln("selectionchange",c)}function qO({doc:t,customElementCb:e}){const n=t.defaultView;return!n||!n.customElements?()=>{}:sp(n.customElements,"define",function(i){return function(s,a,o){try{e({define:{name:s}})}catch{}return i.apply(this,[s,a,o])}})}function YO(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let r;t.recordDOM&&(r=bE(t,t.doc));const i=OO(t),s=NO(t),a=EE(t),o=UO(t,{win:n}),c=zO(t),u=WO(t);let l=()=>{},d=()=>{},f=()=>{},h=()=>{};t.recordDOM&&(l=QO(t,{win:n}),d=_E(t,t.doc),f=HO(t,{win:n}),t.collectFonts&&(h=VO(t)));const m=GO(t),p=qO(t),g=[];for(const A of t.plugins)g.push(A.observer(A.callback,n,A.options));return qe(()=>{ba.forEach(A=>A.reset()),r==null||r.disconnect(),i(),s(),a(),o(),c(),u(),l(),d(),f(),h(),m(),p(),g.forEach(A=>A())})}function hl(t){return typeof window[t]<"u"}function pl(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class fp{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,r,i){const s=r||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let o=s.get(n);return o||(o=this.generateIdFn(),s.set(n,o),a.set(o,n)),o}getIds(e,n){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return n.map(s=>this.getId(e,s,r,i))}getRemoteId(e,n,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;const s=i.get(n);return s||-1}getRemoteIds(e,n){const r=this.getRemoteIdToIdMap(e);return n.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 n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}class KO{constructor(){this.crossOriginIframeMirror=new fp(ip),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class jO{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new fp(ip),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new fp(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),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){var i,s;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((i=e.contentWindow)==null||i.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,e);const r=lp(e);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(e){const n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(e,n){var r;switch(n.type){case ze.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);const i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:ze.IncrementalSnapshot,data:{source:Ce.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ze.Meta:case ze.Load:case ze.DomContentLoaded:return!1;case ze.Plugin:return n;case ze.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case ze.IncrementalSnapshot:switch(n.data.source){case Ce.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(i.node,s)}),n.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),n;case Ce.Drag:case Ce.TouchMove:case Ce.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),n;case Ce.ViewportResize:return!1;case Ce.MediaInteraction:case Ce.MouseInteraction:case Ce.Scroll:case Ce.CanvasMutation:case Ce.Input:return this.replaceIds(n.data,e,["id"]),n;case Ce.StyleSheetRule:case Ce.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case Ce.Font:return n;case Ce.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),n;case Ce.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),(r=n.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),n}}return!1}replace(e,n,r,i){for(const s of i)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=e.getIds(r,n[s]):n[s]=e.getId(r,n[s]));return n}replaceIds(e,n,r){return this.replace(this.crossOriginIframeMirror,e,n,r)}replaceStyleIds(e,n,r){return this.replace(this.crossOriginIframeStyleMirror,e,n,r)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(e,n){e.type!==Ot.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class $O{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class XO{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,n){if(!Ho(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const r=bE({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(EE({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),dl(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(_E({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const n=lp(e),r=BO(e);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(e,n){const r=this;this.restoreHandlers.push(sp(e.prototype,"attachShadow",function(i){return function(s){const a=i.call(this,s);return this.shadowRoot&&hE(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}
502reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}for(var TE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",JO=typeof Uint8Array>"u"?[]:new Uint8Array(256),ml=0;ml<TE.length;ml++)JO[TE.charCodeAt(ml)]=ml;class kE{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class ZO{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new kO,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;const r={id:n,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,c)=>({rule:G0(o),index:c}))})),r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class eN{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,n){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==n)}add(e,n){this.active||(this.active=!0,xO(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}destroy(){}}let It,gl;try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=((Rv=t.contentWindow)==null?void 0:Rv.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}const nr=Z4();function zr(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:s=null,unblockSelector:a=null,ignoreClass:o="rr-ignore",ignoreSelector:c=null,maskAllText:u=!1,maskTextClass:l="rr-mask",unmaskTextClass:d=null,maskTextSelector:f=null,unmaskTextSelector:h=null,inlineStylesheet:m=!0,maskAllInputs:p,maskInputOptions:g,slimDOMOptions:A,maskAttributeFn:y,maskInputFn:w,maskTextFn:E,maxCanvasSize:S=null,packFn:k,sampling:T={},dataURLOptions:C={},mousemoveWait:_,recordDOM:x=!0,recordCanvas:P=!1,recordCrossOriginIframes:v=!1,recordAfter:M=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:D=!1,collectFonts:O=!1,inlineImages:N=!1,plugins:Q,keepIframeSrcFn:G=()=>!1,ignoreCSSAttributes:V=new Set([]),errorHandler:Z,onMutation:B,getCanvasManager:L}=t;MO(Z);const K=v?window.parent===window:!0;let q=!1;if(!K)try{window.parent.document&&(q=!1)}catch{q=!0}if(K&&!e)throw new Error("emit function is required");if(!K&&!q)return()=>{};_!==void 0&&T.mousemove===void 0&&(T.mousemove=_),nr.reset();const ne=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,radio:!0,checkbox:!0}:g!==void 0?g:{},fe=A===!0||A==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:A==="all",headMetaDescKeywords:A==="all"}:A||{};TO();let Ae,ie=0;const ye=z=>{for(const X of Q||[])X.eventProcessor&&(z=X.eventProcessor(z));return k&&!q&&(z=k(z)),z};It=(z,X)=>{var re;const Y=z;if(Y.timestamp=ll(),(re=ba[0])!=null&&re.isFrozen()&&Y.type!==ze.FullSnapshot&&!(Y.type===ze.IncrementalSnapshot&&Y.data.source===Ce.Mutation)&&ba.forEach(se=>se.unfreeze()),K)e==null||e(ye(Y),X);else if(q){const se={type:"rrweb",event:ye(Y),origin:window.location.origin,isCheckout:X};window.parent.postMessage(se,"*")}if(Y.type===ze.FullSnapshot)Ae=Y,ie=0;else if(Y.type===ze.IncrementalSnapshot){if(Y.data.source===Ce.Mutation&&Y.data.isAttachIframe)return;ie++;const se=r&&ie>=r,oe=n&&Ae&&Y.timestamp-Ae.timestamp>n;(se||oe)&&$(!0)}};const $e=z=>{It({type:ze.IncrementalSnapshot,data:{source:Ce.Mutation,...z}})},ge=z=>
502It({type:ze.IncrementalSnapshot,data:{source:Ce.Scroll,...z}}),xe=z=>It({type:ze.IncrementalSnapshot,data:{source:Ce.CanvasMutation,...z}}),We=z=>It({type:ze.IncrementalSnapshot,data:{source:Ce.AdoptedStyleSheet,...z}}),be=new ZO({mutationCb:$e,adoptedStyleSheetCb:We}),I=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new KO:new jO({mirror:nr,mutationCb:$e,stylesheetManager:be,recordCrossOriginIframes:v,wrappedEmit:It});for(const z of Q||[])z.getMirror&&z.getMirror({nodeMirror:nr,crossOriginIframeMirror:I.crossOriginIframeMirror,crossOriginIframeStyleMirror:I.crossOriginIframeStyleMirror});const H=new eN,F=nN(L,{mirror:nr,win:window,mutationCb:z=>It({type:ze.IncrementalSnapshot,data:{source:Ce.CanvasMutation,...z}}),recordCanvas:P,blockClass:i,blockSelector:s,unblockSelector:a,maxCanvasSize:S,sampling:T.canvas,dataURLOptions:C,errorHandler:Z}),U=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new $O:new XO({mutationCb:$e,scrollCb:ge,bypassOptions:{onMutation:B,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:u,maskTextClass:l,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:m,maskInputOptions:ne,dataURLOptions:C,maskAttributeFn:y,maskTextFn:E,maskInputFn:w,recordCanvas:P,inlineImages:N,sampling:T,slimDOMOptions:fe,iframeManager:I,stylesheetManager:be,canvasManager:F,keepIframeSrcFn:G,processedNodeManager:H},mirror:nr}),$=(z=!1)=>{if(!x)return;It({type:ze.Meta,data:{href:window.location.href,width:oE(),height:aE()}},z),be.reset(),U.init(),ba.forEach(Y=>Y.lock());const X=SO(document,{mirror:nr,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:u,maskTextClass:l,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:m,maskAllInputs:ne,maskAttributeFn:y,maskInputFn:w,maskTextFn:E,slimDOM:fe,dataURLOptions:C,recordCanvas:P,inlineImages:N,onSerialize:Y=>{lE(Y,nr)&&I.addIframe(Y),dE(Y,nr)&&be.trackLinkElement(Y),cp(Y)&&U.addShadowRoot(Y.shadowRoot,document)},onIframeLoad:(Y,re)=>{I.attachIframe(Y,re),Y.contentWindow&&F.addWindow(Y.contentWindow),U.observeAttachShadow(Y)},onStylesheetLoad:(Y,re)=>{be.attachLinkElement(Y,re)},onBlockedImageLoad:(Y,re,{width:se,height:oe})=>{$e({adds:[],removes:[],texts:[],attributes:[{id:re.id,attributes:{style:{width:`${se}px`,height:`${oe}px`}}}]})},keepIframeSrcFn:G});if(!X)return console.warn("Failed to snapshot the document");It({type:ze.FullSnapshot,data:{node:X,initialOffset:sE(window)}}),ba.forEach(Y=>Y.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,nr.getId(document))};gl=$;try{const z=[],X=re=>{var se;return qe(YO)({onMutation:B,mutationCb:$e,mousemoveCb:(oe,Ke)=>It({type:ze.IncrementalSnapshot,data:{source:Ke,positions:oe}}),mouseInteractionCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.MouseInteraction,...oe}}),scrollCb:ge,viewportResizeCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.ViewportResize,...oe}}),inputCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.Input,...oe}}),mediaInteractionCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.MediaInteraction,...oe}}),styleSheetRuleCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.StyleSheetRule,...oe}}),styleDeclarationCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.StyleDeclaration,...oe}}),canvasMutationCb:xe,fontCb:oe=>It({type:ze.IncrementalSnapshot,data:{source:Ce.Font,...oe}}),selectionCb:oe=>{It({type:ze.IncrementalSnapshot,data:{source:Ce.Selection,...oe}})},customElementCb:oe=>{It({type:ze.IncrementalSnapshot,data:{source:Ce.CustomElement,...oe}})},blockClass:i,ignoreClass:o,ignoreSelector:c,maskAllText:u,maskTextClass:l,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:h,maskInputOptions:ne,inlineStylesheet:m,sampling:T,recordDOM:x,recordCanvas:P,inlineImages:N,userTriggeredOnInput:D,collectFonts:O,doc:re,maskAttributeFn:y,maskInputFn:w,maskTextFn:E,keepIframeSrcFn:G,blockSelector:s,unblockSelector:a,slimDOMOptions:fe,dataURLOptions:C,mirror:nr,iframeManager:I,stylesheetManager:be,shadowDomManager:U,processedNodeManager:H,canvasManager:F,ignoreCSSAttributes:V,plugins:((se=Q==null?void 0:Q.filter(oe=>oe.observer))==null?void 0:se.map(oe=>({observer:oe.observer,options:oe.options,callback:Ke=>It({type:ze.Plugin,data:{plugin:oe.name,payload:Ke}})}
502)))||[]},{})};I.addLoadListener(re=>{try{z.push(X(re.contentDocument))}catch(se){console.warn(se)}});const Y=()=>{$(),z.push(X(document))};return document.readyState==="interactive"||document.readyState==="complete"?Y():(z.push(ln("DOMContentLoaded",()=>{It({type:ze.DomContentLoaded,data:{}}),M==="DOMContentLoaded"&&Y()})),z.push(ln("load",()=>{It({type:ze.Load,data:{}}),M==="load"&&Y()},window))),()=>{z.forEach(re=>re()),H.destroy(),gl=void 0,DO()}}catch(z){console.warn(z)}}function tN(t){if(!gl)throw new Error("please take full snapshot after start recording");gl(t)}zr.mirror=nr,zr.takeFullSnapshot=tN;function nN(t,e){try{return t?t(e):new kE}catch{return console.warn("Unable to initialize CanvasManager"),new kE}}var IE;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(IE||(IE={}));const rN=3,iN=5;function hp(t){return t>9999999999?t:t*1e3}function pp(t){return t>9999999999?t/1e3:t}function Ko(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:ze.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:_n(e,10,1e3)}}),e.category==="console")))}const sN="button,a";function CE(t){return t.closest(sN)||t}function xE(t){const e=vE(t);return!e||!(e instanceof Element)?e:CE(e)}function vE(t){return aN(t)?t.target:t}function aN(t){return typeof t=="object"&&!!t&&"target"in t}let _i;function oN(t){return _i||(_i=[],cN()),_i.push(t),()=>{const e=_i?_i.indexOf(t):-1;e>-1&&_i.splice(e,1)}}function cN(){on(ct,"open",function(t){return function(...e){if(_i)try{_i.forEach(n=>n())}catch{}return t.apply(ct,e)}})}const uN=new Set([Ce.Mutation,Ce.StyleSheetRule,Ce.StyleDeclaration,Ce.AdoptedStyleSheet,Ce.CanvasMutation,Ce.Selection,Ce.MediaInteraction]);function lN(t,e,n){t.handleClick(e,n)}class dN{constructor(e,n,r=Ko){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const e=oN(()=>{this._lastMutation=BE()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(hN(n,this._ignoreSelector)||!pN(e))return;const r={timestamp:pp(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};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=pp(e)}registerScroll(e=Date.now()){this._lastScroll=pp(e)}registerClick(e){const n=CE(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){const e=[],n=BE();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<=n&&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 n=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 c=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,u=c<this._timeout*1e3?"mutation":"timeout",l={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.slowClickDetected",data:{...o.data,url:ct.location.href,route:n.getCurrentRoute(),timeAfterClickMs:c,endReason:u,clickCount:a||1}};this._addBreadcrumbEvent(n,l);return}if(a>1){const c={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.multiClick",data:{...o.data,url:ct.location.href,route:n.getCurrentRoute(),clickCount:a,metric:!0}};this._addBreadcrumbEvent(n,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=zo(()=>this._checkClicks(),1e3)}}const fN=["A","BUTTON","INPUT"];function hN(t,e){return!!(!fN.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function pN(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function BE(){return Date.now()/1e3}function mN(t,e){try{if(!gN(e))return;const{source:n}=e.data;if(uN.has(n)&&t.registerMutation(e.timestamp),n===Ce.Scroll&&t.registerScroll(e.timestamp),AN(e)){const{type:r,id:i}=e.data,s=zr.mirror.getNode(i);s instanceof HTMLElement&&r===dn.Click&&t.registerClick(s)}}catch{}}function gN(t){return t.type===rN}function AN(t){return t.data.source===Ce.MouseInteraction}function hr(t){return{timestamp:Date.now()/1e3,type:"default",...t}}var mp=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(mp||{});const yN=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function wN(t){const e={};!t["data-sentry-component"]&&t["data-sentry-element"]&&(t["data-sentry-component"]=t["data-sentry-element"]);for(const n in t)if(yN.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),e[r]=t[n]}return e}const bN=t=>e=>{if(!t.isEnabled())return;const n=EN(e);if(!n)return;const r=e.name==="click",i=r?e.event:void 0;r&&t.clickDetector&&(i!=null&&i.target)&&!i.altKey&&!i.metaKey&&!i.ctrlKey&&!i.shiftKey&&lN(t.clickDetector,n,xE(e.event)),Ko(t,n)};function PE(t,e){const n=zr.mirror.getId(t),r=n&&zr.mirror.getNode(n),i=r&&zr.mirror.getMeta(r),s=i&&_N(i)?i:null;return{message:e,data:s?{nodeId:n,node:{id:n,tagName:s.tagName,textContent:Array.from(s.childNodes).map(a=>
502a.type===mp.Text&&a.textContent).filter(Boolean).map(a=>a.trim()).join(""),attributes:wN(s.attributes)}}:{}}}function EN(t){const{target:e,message:n}=SN(t);return hr({category:`ui.${t.name}`,...PE(e,n)})}function SN(t){const e=t.name==="click";let n,r=null;try{r=e?xE(t.event):vE(t.event),n=Nn(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function _N(t){return t.type===mp.Element}function TN(t,e){if(!t.isEnabled())return;t.updateUserActivity();const n=kN(e);n&&Ko(t,n)}function kN(t){const{metaKey:e,shiftKey:n,ctrlKey:r,altKey:i,key:s,target:a}=t;if(!a||IN(a)||!s)return null;const o=e||r||i,c=s.length===1;if(!o&&c)return null;const u=Nn(a,{maxStringLength:200})||"<unknown>",l=PE(a,u);return hr({category:"ui.keyDown",message:u,data:{...l.data,metaKey:e,shiftKey:n,ctrlKey:r,altKey:i,key:s}})}function IN(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}const CN={resource:RN,paint:BN,navigation:PN};function Al(t,e){return({metric:n})=>void e.replayPerformanceEntries.push(t(n))}function xN(t){return t.map(vN).filter(Boolean)}function vN(t){const e=CN[t.entryType];return e?e(t):null}function Ea(t){return((nn()||ct.performance.timeOrigin)+t)/1e3}function BN(t){const{duration:e,entryType:n,name:r,startTime:i}=t,s=Ea(i);return{type:n,name:r,start:s,end:s+e,data:void 0}}function PN(t){const{entryType:e,name:n,decodedBodySize:r,duration:i,domComplete:s,encodedBodySize:a,domContentLoadedEventStart:o,domContentLoadedEventEnd:c,domInteractive:u,loadEventStart:l,loadEventEnd:d,redirectCount:f,startTime:h,transferSize:m,type:p}=t;return i===0?null:{type:`${e}.${p}`,start:Ea(h),end:Ea(s),name:n,data:{size:m,decodedBodySize:r,encodedBodySize:a,duration:i,domInteractive:u,domContentLoadedEventStart:o,domContentLoadedEventEnd:c,loadEventStart:l,loadEventEnd:d,domComplete:s,redirectCount:f}}}function RN(t){const{entryType:e,initiatorType:n,name:r,responseEnd:i,startTime:s,decodedBodySize:a,encodedBodySize:o,responseStatus:c,transferSize:u}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${e}.${n}`,start:Ea(s),end:Ea(i),name:r,data:{size:u,statusCode:c,decodedBodySize:a,encodedBodySize:o}}}function FN(t){const e=t.entries[t.entries.length-1],n=e!=null&&e.element?[e.element]:void 0;return yl(t,"largest-contentful-paint",n)}function MN(t){return t.sources!==void 0}function DN(t){const e=[],n=[];for(const r of t.entries)if(MN(r)){const i=[];for(const s of r.sources)if(s.node){n.push(s.node);const a=zr.mirror.getId(s.node);a&&i.push(a)}e.push({value:r.value,nodeIds:i.length?i:void 0})}return yl(t,"cumulative-layout-shift",n,e)}function ON(t){const e=t.entries[t.entries.length-1],n=e!=null&&e.target?[e.target]:void 0;return yl(t,"first-input-delay",n)}function NN(t){const e=t.entries[t.entries.length-1],n=e!=null&&e.target?[e.target]:void 0;return yl(t,"interaction-to-next-paint",n)}function yl(t,e,n,r){const i=t.value,s=t.rating,a=Ea(i);return{type:"web-vital",name:e,start:a,end:a,data:{value:i,size:i,rating:s,nodeIds:n?n.map(o=>zr.mirror.getId(o)):void 0,attributions:r}}}function UN(t){function e(i){t.performanceEntries.includes(i)||t.performanceEntries.push(i)}function n({entries:i}){i.forEach(e)}const r=[];return["navigation","paint","resource"].forEach(i=>{r.push(fs(i,n))}),r.push(Lh(Al(FN,t)),Uh(Al(DN,t)),i0(Al(ON,t)),s0(Al(NN,t))),()=>{r.forEach(i=>i())}}const Ee=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,LN='
vendor: 10,329 bytes, line 502
502var 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});
502';function zN(){const t=new Blob([LN]);return URL.createObjectURL(t)}const RE=["log","warn","error"],wl="[Replay] ";function gp(t,e="info"){er({category:"console",data:{logger:"replay"},level:e,message:`${wl}${t}`},{level:e})}function QN(){let t=!1,e=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{t=!!r.captureExceptions,e=!!r.traceInternals}};return Ee?(RE.forEach(r=>{n[r]=(...i)=>{W[r](wl,...i),e&&gp(i.join(""),ah(r))}}),n.exception=(r,...i)=>{i.length&&n.error&&n.error(...i),W.error(wl,r),t?Dr(r):e&&gp(r,"error")},n.infoTick=(...r)=>{W.log(wl,...r),e&&setTimeout(()=>gp(r[0]),0)}):RE.forEach(r=>{n[r]=()=>{}}),n}const Se=QN();class Ap extends Error{constructor(){super(`Event buffer exceeded maximum size of ${ep}.`)}}class FE{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 n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>ep)throw new Ap;this.events.push(e)}finish(){return new Promise(e=>{const n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(n=>n.timestamp).sort()[0];return e?hp(e):null}}class HN{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?e():n()},{once:!0}),this._worker.addEventListener("error",r=>{n(r)},{once:!0})}),this._ensureReadyPromise)}destroy(){Ee&&Se.log("Destroying compression worker"),this._worker.terminate()}postMessage(e,n){const r=this._getAndIncrementId();return new Promise((i,s)=>{const a=({data:o})=>{const c=o;if(c.method===e&&c.id===r){if(this._worker.removeEventListener("message",a),!c.success){Ee&&Se.error("Error in compression worker: ",c.response),s(new Error("Error in compression worker"));return}i(c.response)}};this._worker.addEventListener("message",a),this._worker.postMessage({id:r,method:e,arg:n})})}_getAndIncrementId(){return this._id++}}class WN{constructor(e){this._worker=new HN(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 n=hp(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const r=JSON.stringify(e);return this._totalSize+=r.length,this._totalSize>ep?Promise.reject(new Ap):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{Ee&&Se.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 VN{constructor(e){this._fallback=new FE,this._compression=new WN(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=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){Ee&&Se.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:n,waitForCheckout:r}=this._fallback,i=[];for(const s of e)i.push(this._compression.addEvent(s));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(i),this._fallback.clear()}catch(s){Ee&&Se.exception(s,"Failed to add events when switching buffers.")}}}function GN({useCompression:t,workerUrl:e}){if(t&&window.Worker){const n=qN(e);if(n)return n}return Ee&&Se.log("Using simple buffer"),new FE}function qN(t){try{const e=t||YN();if(!e)return;Ee&&Se.log(`Using compression worker${t?` from ${t}`:""}`);const n=new Worker(e);return new VN(n)}catch(e){Ee&&Se.exception(e,"Failed to create compression worker")}}function YN(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?zN():""}function yp(){try{return"sessionStorage"in ct&&!!ct.sessionStorage}catch{return!1}}function KN(t){jN(),t.session=void 0}function jN(){if(yp())try{ct.sessionStorage.removeItem(Jh)}catch{}}function ME(t){return t===void 0?!1:Math.random()<t}function wp(t){if(yp())try{ct.sessionStorage.setItem(Jh,JSON.stringify(t))}catch{}}function DE(t){const e=Date.now(),n=t.id||un(),r=t.started||e,i=t.lastActivity||e,s=t.segmentId||0,a=t.sampled,o=t.previousSessionId;return{id:n,started:r,lastActivity:i,segmentId:s,sampled:a,previousSessionId:o}}function $N(t,e){return ME(t)?"session":e?"buffer":!1}function OE({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:r}={}){const i=$N(t,e),s=DE({sampled:i,previousSessionId:r});return n&&wp(s),s}function XN(){if(!yp())return null;try{const t=ct.sessionStorage.getItem(Jh);if(!t)return null;const e=JSON.parse(t);return Ee&&Se.infoTick("Loading existing session"),DE(e)}catch{return null}}function bp(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function NE(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:r=Date.now()}){return bp(t.started,e,r)||bp(t.lastActivity,n,r)}function UE(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!NE(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function Ep({sessionIdleExpire:t,maxReplayDuration:e,previousSessionId:n},r){const i=r.stickySession&&XN();return i?UE(i,{sessionIdleExpire:t,maxReplayDuration:e})?(Ee&&Se.infoTick("Session in sessionStorage is expired, creating new one..."),OE(r,{previousSessionId:i.id})):i:(Ee&&Se.infoTick("Creating new session"),OE(r,{previousSessionId:n}))}function JN(t){return t.type===ze.Custom}function Sp(t,e,n){return zE(t,e)?(LE(t,e,n),!0):!1}function ZN(t,e,n){return zE(t,e)?LE(t,e,n):Promise.resolve(null)}async function LE(t,e,n){const{eventBuffer:r}=t;if(!r||r.waitForCheckout&&!n)return null;const i=t.recordingMode==="buffer";
502try{n&&i&&r.clear(),n&&(r.hasCheckout=!0,r.waitForCheckout=!1);const s=t.getOptions(),a=eU(e,s.beforeAddRecordingEvent);return a?await r.addEvent(a):void 0}catch(s){const a=s&&s instanceof Ap,o=a?"addEventSizeExceeded":"addEvent";if(a&&i)return r.clear(),r.waitForCheckout=!0,null;t.handleException(s),await t.stop({reason:o});const c=le();c&&c.recordDroppedEvent("internal_sdk_error","replay")}}function zE(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;const n=hp(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(Ee&&Se.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function eU(t,e){try{if(typeof e=="function"&&JN(t))return e(t)}catch(n){return Ee&&Se.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return t}function _p(t){return!t.type}function Tp(t){return t.type==="transaction"}function tU(t){return t.type==="replay_event"}function QE(t){return t.type==="feedback"}function nU(t){return(e,n)=>{if(!t.isEnabled()||!_p(e)&&!Tp(e))return;const r=n==null?void 0:n.statusCode;if(!(!r||r<200||r>=300)){if(Tp(e)){rU(t,e);return}iU(t,e)}}}function rU(t,e){var r,i;const n=t.getContext();(i=(r=e.contexts)==null?void 0:r.trace)!=null&&i.trace_id&&n.traceIds.size<100&&n.traceIds.add(e.contexts.trace.trace_id)}function iU(t,e){const n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!e.tags||!e.tags.replayId)return;const{beforeErrorSampling:r}=t.getOptions();typeof r=="function"&&!r(e)||zo(async()=>{try{await t.sendBufferedReplayOrFlush()}catch(i){t.handleException(i)}})}function sU(t){return e=>{!t.isEnabled()||!_p(e)||aU(t,e)}}function aU(t,e){var r,i,s;const n=(s=(i=(r=e.exception)==null?void 0:r.values)==null?void 0:i[0])==null?void 0:s.value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const a=hr({category:"replay.hydrate-error",data:{url:$i()}});Ko(t,a)}}function oU(t){const e=le();e&&e.on("beforeAddBreadcrumb",n=>cU(t,n))}function cU(t,e){if(!t.isEnabled()||!HE(e))return;const n=uU(e);n&&Ko(t,n)}function uU(t){return!HE(t)||["fetch","xhr","sentry.event","sentry.transaction"].includes(t.category)||t.category.startsWith("ui.")?null:t.category==="console"?lU(t):hr(t)}function lU(t){var i;const e=(i=t.data)==null?void 0:i.arguments;if(!Array.isArray(e)||e.length===0)return hr(t);let n=!1;const r=e.map(s=>{if(!s)return s;if(typeof s=="string")return s.length>il?(n=!0,`${s.slice(0,il)}…`):s;if(typeof s=="object")try{const a=_n(s,7);return JSON.stringify(a).length>il?(n=!0,`${JSON.stringify(a,null,2).slice(0,il)}…`):a}catch{}return s});return hr({...t,data:{...t.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function HE(t){return!!t.category}function dU(t,e){var n,r,i;return t.type||!((r=(n=t.exception)==null?void 0:n.values)!=null&&r.length)?!1:!!((i=e.originalException)!=null&&i.__rrweb__)}function WE(){const t=Be().getPropagationContext().dsc;t&&delete t.replay_id;const e=gt();if(e){const n=Zn(e);delete n.replay_id}}function fU(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:ze.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 hU(t,e){return t.recordingMode!=="buffer"||e.message===Zh||!e.exception||e.type?!1:ME(t.getOptions().errorSampleRate)}function pU(t){return Object.assign((e,n)=>!t.isEnabled()||t.isPaused()?e:tU(e)?(delete e.breadcrumbs,e):!_p(e)&&!Tp(e)&&!QE(e)?e:t.checkAndHandleExpiredSession()?QE(e)?(t.flush(),e.contexts.feedback.replay_id=t.getSessionId(),fU(t,e),e):dU(e,n)&&!t.getOptions()._experiments.captureExceptions?(Ee&&Se.log("Ignoring error from rrweb internals",e),null):((hU(t,e)||t.recordingMode==="session")&&(e.tags={...e.tags,replayId:t.getSessionId()}),e):(WE(),e),{id:"Replay"})}function bl(t,e){return e.map(({type:n,start:r,end:i,name:s,data:a})=>{const o=t.throttledAddEvent({type:ze.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:s,startTimestamp:r,endTimestamp:i,data:a}}});
502return typeof o=="string"?Promise.resolve(null):o})}function mU(t){const{from:e,to:n}=t,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:e}}}function gU(t){return e=>{if(!t.isEnabled())return;const n=mU(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(bl(t,[n]),!1)))}}function AU(t,e){return Ee&&t.getOptions()._experiments.traceInternals?!1:vw(e,le())}function VE(t,e){t.isEnabled()&&e!==null&&(AU(t,e.name)||t.addUpdate(()=>(bl(t,[e]),!0)))}function El(t){if(!t)return;const e=new TextEncoder;try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){const n=g0(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function GE(t){if(!t)return;const e=parseInt(t,10);return isNaN(e)?void 0:e}function Sl(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};const n={...t._meta},r=n.warnings||[];return n.warnings=[...r,e],t._meta=n,t}function qE(t,e){if(!e)return null;const{startTimestamp:n,endTimestamp:r,url:i,method:s,statusCode:a,request:o,response:c}=e;return{type:t,start:n/1e3,end:r/1e3,name:i,data:{method:s,statusCode:a,request:o,response:c}}}function jo(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function Ti(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};const r={headers:t,size:e},{body:i,warnings:s}=yU(n);return r.body=i,s!=null&&s.length&&(r._meta={warnings:s}),r}function kp(t,e){return Object.entries(t).reduce((n,[r,i])=>{const s=r.toLowerCase();return e.includes(s)&&t[r]&&(n[s]=i),n},{})}function yU(t){if(!t||typeof t!="string")return{body:t};const e=t.length>H0,n=wU(t);if(e){const r=t.slice(0,H0);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function wU(t){const e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function _l(t,e){const n=bU(t);return Xn(n,e)}function bU(t,e=ct.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(ct.location.origin))return t;const n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;const r=n.href;return!t.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function EU(t,e,n){try{const r=await _U(t,e,n),i=qE("resource.fetch",r);VE(n.replay,i)}catch(r){Ee&&Se.exception(r,"Failed to capture fetch breadcrumb")}}function SU(t,e){const{input:n,response:r}=e,i=n?Yh(n):void 0,s=El(i),a=r?GE(r.headers.get("content-length")):void 0;s!==void 0&&(t.data.request_body_size=s),a!==void 0&&(t.data.response_body_size=a)}async function _U(t,e,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r}=e,{url:a,method:o,status_code:c=0,request_body_size:u,response_body_size:l}=t.data,d=_l(a,n.networkDetailAllowUrls)&&!_l(a,n.networkDetailDenyUrls),f=d?TU(n,e.input,u):jo(u),h=await kU(d,n,e.response,l);return{startTimestamp:i,endTimestamp:s,url:a,method:o,statusCode:c,request:f,response:h}}function TU({networkCaptureBodies:t,networkRequestHeaders:e},n,r){const i=n?xU(n,e):{};if(!t)return Ti(i,r,void 0);const s=Yh(n),[a,o]=tl(s,Se),c=Ti(i,r,a);return o?Sl(c,o):c}async function kU(t,{networkCaptureBodies:e,networkResponseHeaders:n},r,i){if(!t&&i!==void 0)return jo(i);const s=r?YE(r.headers,n):{};if(!r||!e&&i!==void 0)return Ti(s,i,void 0);const[a,o]=await CU(r),c=IU(a,{networkCaptureBodies:e,responseBodySize:i,captureDetails:t,headers:s});return o?Sl(c,o):c}function IU(t,{networkCaptureBodies:e,responseBodySize:n,captureDetails:r,headers:i}){try{const s=t!=null&&t.length&&n===void 0?El(t):n;return r?e?Ti(i,s,t):Ti(i,s,void 0):jo(s)}catch(s){return Ee&&Se.exception(s,"Failed to serialize response body"),Ti(i,n,void 0)}}async function CU(t){const e=vU(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await BU(e)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(Ee&&Se.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(Ee&&Se.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function YE(t,e){const n={};return e.forEach(r=>{t.get(r)&&(n[r]=t.get(r))}),n}
502function xU(t,e){return t.length===1&&typeof t[0]!="string"?KE(t[0],e):t.length===2?KE(t[1],e):{}}function KE(t,e){if(!t)return{};const n=t.headers;return n?n instanceof Headers?YE(n,e):Array.isArray(n)?{}:kp(n,e):{}}function vU(t){try{return t.clone()}catch(e){Ee&&Se.exception(e,"Failed to clone response body")}}function BU(t){return new Promise((e,n)=>{const r=zo(()=>n(new Error("Timeout while trying to read response body")),500);PU(t).then(i=>e(i),i=>n(i)).finally(()=>clearTimeout(r))})}async function PU(t){return await t.text()}async function RU(t,e,n){try{const r=MU(t,e,n),i=qE("resource.xhr",r);VE(n.replay,i)}catch(r){Ee&&Se.exception(r,"Failed to capture xhr breadcrumb")}}function FU(t,e){const{xhr:n,input:r}=e;if(!n)return;const i=El(r),s=n.getResponseHeader("content-length")?GE(n.getResponseHeader("content-length")):UU(n.response,n.responseType);i!==void 0&&(t.data.request_body_size=i),s!==void 0&&(t.data.response_body_size=s)}function MU(t,e,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r,input:a,xhr:o}=e,{url:c,method:u,status_code:l=0,request_body_size:d,response_body_size:f}=t.data;if(!c)return null;if(!o||!_l(c,n.networkDetailAllowUrls)||_l(c,n.networkDetailDenyUrls)){const k=jo(d),T=jo(f);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:l,request:k,response:T}}const h=o[Ur],m=h?kp(h.request_headers,n.networkRequestHeaders):{},p=kp(DU(o),n.networkResponseHeaders),[g,A]=n.networkCaptureBodies?tl(a,Se):[void 0],[y,w]=n.networkCaptureBodies?OU(o):[void 0],E=Ti(m,d,g),S=Ti(p,f,y);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:l,request:A?Sl(E,A):E,response:w?Sl(S,w):S}}function DU(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
503`).reduce((n,r)=>{const[i,s]=r.split(": ");return s&&(n[i.toLowerCase()]=s),n},{}):{}}function OU(t){const e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return NU(t.response,t.responseType)}catch(n){e.push(n)}return Ee&&Se.warn("Failed to get xhr response body",...e),[void 0]}function NU(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&t&&typeof t=="object")return[JSON.stringify(t)];if(!t)return[void 0]}catch(n){return Ee&&Se.exception(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return Ee&&Se.log("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function UU(t,e){try{const n=e==="json"&&t&&typeof t=="object"?JSON.stringify(t):t;return El(n)}catch{return}}function LU(t){const e=le();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:a}=t.getOptions(),o={replay:t,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:a};e&&e.on("beforeAddBreadcrumb",(c,u)=>zU(o,c,u))}catch{}}function zU(t,e,n){if(e.data)try{QU(e)&&WU(n)&&(FU(e,n),RU(e,n,t)),HU(e)&&VU(n)&&(SU(e,n),EU(e,n,t))}catch(r){Ee&&Se.exception(r,"Error when enriching network breadcrumb")}}function QU(t){return t.category==="xhr"}function HU(t){return t.category==="fetch"}function WU(t){return t==null?void 0:t.xhr}function VU(t){return t==null?void 0:t.response}function GU(t){const e=le();h0(bN(t)),Zu(gU(t)),oU(t),LU(t);const n=pU(t);aw(n),e&&(e.on("beforeSendEvent",sU(t)),e.on("afterSendEvent",nU(t)),e.on("createDsc",r=>{const i=t.getSessionId();i&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(r.replay_id=i)}),e.on("spanStart",r=>{t.lastActiveSpan=r}),e.on("spanEnd",r=>{t.lastActiveSpan=r}),e.on("beforeSendFeedback",async(r,i)=>{var a;const s=t.getSessionId();i!=null&&i.includeReplay&&t.isEnabled()&&s&&((a=r.contexts)!=null&&a.feedback)&&(r.contexts.feedback.source==="api"&&await t.sendBufferedReplayOrFlush(),r.contexts.feedback.replay_id=s)}),e.on("openFeedbackWidget",async()=>{await t.sendBufferedReplayOrFlush()}))}async function qU(t){try{return Promise.all(bl(t,[YU(ct.performance.memory)]))}catch{return[]}}function YU(t){const{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}=t,i=Date.now()/1e3;return{type:"memory",name:"memory",start:i,end:i,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}}}}function KU(t,e,n){return WP(t,e,{...n,setTimeoutImpl:zo})}const Ln=Te.navigator;function jU(){return/iPhone|iPad|iPod/i.test((Ln==null?void 0:Ln.userAgent)??"")||/Macintosh/i.test((Ln==null?void 0:Ln.userAgent)??"")&&(Ln!=null&&Ln.maxTouchPoints)&&(Ln==null?void 0:Ln.maxTouchPoints)>1?{sampling:{mousemove:!1}}:{}}function $U(t){let e=!1;return(n,r)=>{if(!t.checkAndHandleExpiredSession()){Ee&&Se.warn("Received replay event after session expired.");return}const i=r||!e;e=!0,t.clickDetector&&mN(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&i&&t.setInitialState(),!Sp(t,n,i))return!0;
503if(!i)return!1;const s=t.session;if(JU(t,i),t.recordingMode==="buffer"&&s&&t.eventBuffer){const a=t.eventBuffer.getEarliestTimestamp();a&&(Ee&&Se.log(`Updating session start time to earliest event in buffer to ${new Date(a)}`),s.started=a,t.getOptions().stickySession&&wp(s))}return s!=null&&s.previousSessionId||t.recordingMode==="session"&&t.flush(),!0})}}function XU(t){const e=t.getOptions();return{type:ze.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function JU(t,e){!e||!t.session||t.session.segmentId!==0||Sp(t,XU(t),!1)}function ZU(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function eL(t,e,n,r){return Fr(Wy(t,Lf(t),r,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function tL({recordingData:t,headers:e}){let n;const r=`${JSON.stringify(e)}
504`;if(typeof t=="string")n=`${r}${t}`;else{const s=new TextEncoder().encode(r);n=new Uint8Array(s.length+t.length),n.set(s),n.set(t,s.length)}return n}async function nL({client:t,scope:e,replayId:n,event:r}){const i=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,s={event_id:n,integrations:i};t.emit("preprocessEvent",r,s);const a=await rw(t.getOptions(),r,s,e,t,Qt());if(!a)return null;t.emit("postprocessEvent",a,s),a.platform=a.platform||"javascript";const o=t.getSdkMetadata(),{name:c,version:u}=(o==null?void 0:o.sdk)||{};return a.sdk={...a.sdk,name:c||"sentry.javascript.unknown",version:u||"0.0.0"},a}async function rL({recordingData:t,replayId:e,segmentId:n,eventContext:r,timestamp:i,session:s}){const a=tL({recordingData:t,headers:{segment_id:n}}),{urls:o,errorIds:c,traceIds:u,initialTimestamp:l}=r,d=le(),f=Be(),h=d==null?void 0:d.getTransport(),m=d==null?void 0:d.getDsn();if(!d||!h||!m||!s.sampled)return Mr({});const p={type:R4,replay_start_timestamp:l/1e3,timestamp:i/1e3,error_ids:c,trace_ids:u,urls:o,replay_id:e,segment_id:n,replay_type:s.sampled},g=await nL({scope:f,client:d,replayId:e,event:p});if(!g)return d.recordDroppedEvent("event_processor","replay"),Ee&&Se.log("An event processor returned `null`, will not send event."),Mr({});delete g.sdkProcessingMetadata;const A=eL(g,a,m,d.getOptions().tunnel);let y;try{y=await h.send(A)}catch(E){const S=new Error(Zh);try{S.cause=E}catch{}throw S}if(typeof y.statusCode=="number"&&(y.statusCode<200||y.statusCode>=300))throw new jE(y.statusCode);const w=Iw({},y);if(kw(w,"replay"))throw new Ip(w);return y}
504class jE extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class Ip extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function $E(t,e={count:0,interval:U4}){const{recordingData:n,onError:r}=t;if(n.length)try{return await rL(t),!0}catch(i){if(i instanceof jE||i instanceof Ip)throw i;if(Gf("Replays",{_retryCount:e.count}),r&&r(i),e.count>=L4){const s=new Error(`${Zh} - max retries exceeded`);try{s.cause=i}catch{}throw s}return e.interval*=++e.count,new Promise((s,a)=>{zo(async()=>{try{await $E(t,e),s(!0)}catch(o){a(o)}},e.interval)})}}const XE="__THROTTLED",iL="__SKIPPED";function sL(t,e,n){const r=new Map,i=o=>{const c=o-n;r.forEach((u,l)=>{l<c&&r.delete(l)})},s=()=>[...r.values()].reduce((o,c)=>o+c,0);let a=!1;return(...o)=>{const c=Math.floor(Date.now()/1e3);if(i(c),s()>=e){const l=a;return a=!0,l?iL:XE}a=!1;const u=r.get(c)||0;return r.set(c,u+1),t(...o)}}class aL{constructor({options:e,recordingOptions:n}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:F4,sessionIdleExpire:M4},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=KU(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=sL((a,o)=>ZN(this,a,o),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:i}=this.getOptions(),s=r?{threshold:Math.min(z4,r),timeout:r,scrollTimeout:Q4,ignoreSelector:i?i.join(","):""}:void 0;if(s&&(this.clickDetector=new dN(this,s)),Ee){const a=e._experiments;Se.setConfig({captureExceptions:!!a.captureExceptions,traceInternals:!!a.traceInternals})}this._handleVisibilityChange=()=>{ct.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{const a=hr({category:"ui.blur"});this._doChangeToBackgroundTasks(a)},this._handleWindowFocus=()=>{const a=hr({category:"ui.focus"});this._doChangeToForegroundTasks(a)},this._handleKeyboardEvent=a=>{TN(this,a)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){Ee&&Se.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:n,sessionSampleRate:r}=this._options,i=n<=0&&r<=0;if(this._requiresManualStart=i,!i){if(this._initializeSessionForSampling(e),!this.session){Ee&&Se.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",Ee&&Se.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){Ee&&Se.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){Ee&&Se.log("Buffering is in progress, call `flush()` to save the replay");return}Ee&&Se.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=Ep({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){Ee&&Se.log("Buffering is in progress, call `flush()` to save the replay");return}Ee&&Se.infoTick("Starting replay in buffer mode");const e=Ep({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=zr({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:N4}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:$U(this),...jU(),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:n}={}){var r;if(this._isEnabled){this._isEnabled=!1,this.recordingMode="buffer";try{Ee&&Se.log(`Stopping Replay${n?` triggered by ${n}`:""}`),WE(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),(r=this.eventBuffer)==null||r.destroy(),this.eventBuffer=null,KN(this)}catch(i){this.handleException(i)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),Ee&&Se.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),Ee&&Se.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();Ee&&Se.log("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!e||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const n=e();this.recordingMode==="buffer"||!this._isEnabled||n!==!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(){var e;return(e=this.session)==null?void 0:e.id}
504checkAndHandleExpiredSession(){if(this._lastActivity&&bp(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${ct.location.pathname}${ct.location.hash}${ct.location.search}`,n=`${ct.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){const r=this._throttledAddEvent(e,n);if(r===XE){const i=hr({category:"replay.throttled"});this.addUpdate(()=>!Sp(this,{type:iN,timestamp:i.timestamp||0,data:{tag:"breadcrumb",payload:i,metric:!0}}))}return r}getCurrentRoute(){const e=this.lastActiveSpan||gt(),n=e&&kt(e),i=(n&&ke(n).data||{})[et];if(!(!n||!i||!["route","custom"].includes(i)))return ke(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=GN({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(e){const n=this._options.errorSampleRate>0,r=Ep({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;const e=this.session;return UE(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{ct.document.addEventListener("visibilitychange",this._handleVisibilityChange),ct.addEventListener("blur",this._handleWindowBlur),ct.addEventListener("focus",this._handleWindowFocus),ct.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(GU(this),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=UN(this)}_removeListeners(){try{ct.document.removeEventListener("visibilitychange",this._handleVisibilityChange),ct.removeEventListener("blur",this._handleWindowBlur),ct.removeEventListener("focus",this._handleWindowFocus),ct.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}_doChangeToBackgroundTasks(e){!this.session||NE(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush())}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){Ee&&Se.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:ze.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=xN(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const n=this._context.initialTimestamp/1e3;e=e.filter(r=>r.start>=n)}return Promise.all(bl(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:n}=this;if(!e||!n||this._requiresManualStart||e.segmentId)return;const r=n.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}
504_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){var n;const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){Ee&&Se.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!!((n=this.eventBuffer)!=null&&n.hasEvents)&&(await qU(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const r=Date.now();if(r-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const i=this._popEventContext(),s=this.session.segmentId++;this._maybeSaveSession();const a=await this.eventBuffer.finish();await $E({replayId:e,recordingData:a,segmentId:s,eventContext:i,session:this.session,timestamp:r,onError:o=>this.handleException(o)})}catch(r){this.handleException(r),this.stop({reason:"sendReplay"});const i=le();if(i){const s=r instanceof Ip?"ratelimit_backoff":"send_error";i.recordDroppedEvent(s,"replay")}}}async _flush({force:e=!1}={}){if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){Ee&&Se.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,i=Date.now()-n;this._debouncedFlush.cancel();const s=i<this._options.minReplayDuration,a=i>this._options.maxReplayDuration+5e3;if(s||a){Ee&&Se.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&&Ee&&Se.log("Flushing initial segment without checkout.");const c=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,c&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&wp(this.session)}_onMutationHandler(e){const{ignoreMutations:n}=this._options._experiments;if(n!=null&&n.length&&e.some(o=>{const c=ZU(o.target),u=n.join(",");return c==null?void 0:c.matches(u)}))return!1;const r=e.length,i=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,a=i&&r>i;
504if(r>s||a){const o=hr({category:"replay.mutations",data:{count:r,limit:a}});this._createCustomBreadcrumb(o)}return a?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}function $o(t,e){return[...t,...e].join(",")}function oL({mask:t,unmask:e,block:n,unblock:r,ignore:i}){const s=["base","iframe[srcdoc]:not([src])"],a=$o(t,[".sentry-mask","[data-sentry-mask]"]),o=$o(e,[]);return{maskTextSelector:a,unmaskTextSelector:o,blockSelector:$o(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:$o(r,[]),ignoreSelector:$o(i,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function cL({el:t,key:e,maskAttributes:n,maskAllText:r,privacyOptions:i,value:s}){return!r||i.unmaskTextSelector&&t.matches(i.unmaskTextSelector)?s:n.includes(e)||e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"")?s.replace(/[\S]/g,"*"):s}const JE='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',uL=["content-length","content-type","accept"];let ZE=!1;const lL=(t=>new dL(t));class dL{constructor({flushMinDelay:e=D4,flushMaxDelay:n=O4,minReplayDuration:r=H4,maxReplayDuration:i=W0,stickySession:s=!0,useCompression:a=!0,workerUrl:o,_experiments:c={},maskAllText:u=!0,maskAllInputs:l=!0,blockAllMedia:d=!0,mutationBreadcrumbLimit:f=750,mutationLimit:h=1e4,slowClickTimeout:m=7e3,slowClickIgnoreSelectors:p=[],networkDetailAllowUrls:g=[],networkDetailDenyUrls:A=[],networkCaptureBodies:y=!0,networkRequestHeaders:w=[],networkResponseHeaders:E=[],mask:S=[],maskAttributes:k=["title","placeholder","aria-label"],unmask:T=[],block:C=[],unblock:_=[],ignore:x=[],maskFn:P,beforeAddRecordingEvent:v,beforeErrorSampling:M,onError:D}={}){this.name="Replay";const O=oL({mask:S,unmask:T,block:C,unblock:_,ignore:x});if(this._recordingOptions={maskAllInputs:l,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:P,maskInputFn:P,maskAttributeFn:(N,Q,G)=>cL({maskAttributes:k,maskAllText:u,privacyOptions:O,key:N,value:Q,el:G}),...O,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:N=>{try{N.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!c.recordCrossOriginIframes},this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(r,W4),maxReplayDuration:Math.min(i,W0),stickySession:s,useCompression:a,workerUrl:o,blockAllMedia:d,maskAllInputs:l,maskAllText:u,mutationBreadcrumbLimit:f,mutationLimit:h,slowClickTimeout:m,slowClickIgnoreSelectors:p,networkDetailAllowUrls:g,networkDetailDenyUrls:A,networkCaptureBodies:y,networkRequestHeaders:eS(w),networkResponseHeaders:eS(E),beforeAddRecordingEvent:v,beforeErrorSampling:M,onError:D,_experiments:c},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${JE}`:JE),this._isInitialized&&dh())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return ZE}set _isInitialized(e){ZE=e}afterAllSetup(e){!dh()||this._replay||(this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(){var e;if((e=this._replay)!=null&&e.isEnabled())return this._replay.getSessionId()}getRecordingMode(){var e;if((e=this._replay)!=null&&e.isEnabled())return this._replay.recordingMode}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const n=fL(this._initialOptions,e);this._replay=new aL({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const n=e.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}function fL(t,e){const n=e.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...t},i=es(n.replaysSessionSampleRate),s=es(n.replaysOnErrorSampleRate);return i==null&&s==null&&fi(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),i!=null&&(r.sessionSampleRate=i),s!=null&&(r.errorSampleRate=s),r}function eS(t){return[...uL,...t.map(e=>e.toLowerCase())]}function hL(){const t=le();return t==null?void 0:t.getIntegrationByName("Replay")}var pL=Object.defineProperty,mL=(t,e,n)=>e in t?pL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,tS=(t,e,n)=>mL(t,typeof e!="symbol"?e+"":e,n);
504class gL{constructor(){tS(this,"idNodeMap",new Map),tS(this,"nodeMetaMap",new WeakMap)}getId(e){var r;return e?((r=this.getMeta(e))==null?void 0:r.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 n=this.getId(e);this.idNodeMap.delete(n),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,n){const r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)}replace(e,n){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function AL(){return new gL}function yL(t,e){for(let n=t.classList.length;n--;){const r=t.classList[n];if(e.test(r))return!0}return!1}function Cp(t,e,n=1/0,r=0){return!t||t.nodeType!==t.ELEMENT_NODE||r>n?-1:e(t)?r:Cp(t.parentNode,e,n,r+1)}function nS(t,e){return n=>{const r=n;if(r===null)return!1;try{if(t){if(typeof t=="string"){if(r.matches(`.${t}`))return!0}else if(yL(r,t))return!0}return!!(e&&r.matches(e))}catch{return!1}}}const Sa=`Please stop import mirror directly. Instead of that,\r
505now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
506or you can use record.mirror to access the mirror instance during recording.`;let rS={map:{},getId(){return console.error(Sa),-1},getNode(){return console.error(Sa),null},removeNodeFromMap(){console.error(Sa)},has(){return console.error(Sa),!1},reset(){console.error(Sa)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(rS=new Proxy(rS,{get(t,e,n){return e==="map"&&console.error(Sa),Reflect.get(t,e,n)}}));function xp(t,e,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(a){aS(()=>{n.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>xp(t,e,s||{},!0)}function vp(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}Date.now().toString();function wL(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function Tl(t,e,n,r,i){if(!t)return!1;const s=wL(t);if(!s)return!1;const a=nS(e,n),o=Cp(s,a);let c=-1;return o<0?!1:(r&&(c=Cp(s,nS(null,r))),o>-1&&c<0?!0:o<c)}const iS={};function sS(t){const e=iS[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return iS[t]=r.bind(window)}function ps(...t){return sS("requestAnimationFrame")(...t)}function aS(...t){return sS("setTimeout")(...t)}var _a=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(_a||{});let kl;function bL(t){kl=t}const Bp=t=>kl?(...n)=>{try{return t(...n)}catch(r){if(kl&&kl(r)===!0)return()=>{};throw r}}:t;for(var Ta="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",EL=typeof Uint8Array>"u"?[]:new Uint8Array(256),Il=0;Il<Ta.length;Il++)EL[Ta.charCodeAt(Il)]=Il;var SL=function(t){var e=new Uint8Array(t),n,r=e.length,i="";for(n=0;n<r;n+=3)i+=Ta[e[n]>>2],i+=Ta[(e[n]&3)<<4|e[n+1]>>4],i+=Ta[(e[n+1]&15)<<2|e[n+2]>>6],i+=Ta[e[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const oS=new Map;function _L(t,e){let n=oS.get(t);return n||(n=new Map,oS.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}const cS=(t,e,n)=>{if(!t||!(lS(t,e)||typeof t=="object"))return;const r=t.constructor.name,i=_L(n,r);let s=i.indexOf(t);return s===-1&&(s=i.length,i.push(t)),s};function Cl(t,e,n){if(t instanceof Array)return t.map(r=>Cl(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){const r=t.constructor.name,i=SL(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Cl(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const r=t.constructor.name,{src:i}=t;return{rr_type:r,src:i}}else if(t instanceof HTMLCanvasElement){const r="HTMLImageElement",i=t.toDataURL();return{rr_type:r,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[Cl(t.data,e,
506n),t.width,t.height]};if(lS(t,e)||typeof t=="object"){const r=t.constructor.name,i=cS(t,e,n);return{rr_type:r,index:i}}}}return t}const uS=(t,e,n)=>t.map(r=>Cl(r,e,n)),lS=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>t instanceof e[i]);function TL(t,e,n,r,i){const s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of a)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const c=vp(e.CanvasRenderingContext2D.prototype,o,function(u){return function(...l){return Tl(this.canvas,n,r,i,!0)||aS(()=>{const d=uS(l,e,this);t(this.canvas,{type:_a["2D"],property:o,args:d})},0),u.apply(this,l)}});s.push(c)}catch{const c=xp(e.CanvasRenderingContext2D.prototype,o,{set(u){t(this.canvas,{type:_a["2D"],property:o,args:[u],setter:!0})}});s.push(c)}return()=>{s.forEach(o=>o())}}function kL(t){return t==="experimental-webgl"?"webgl":t}function dS(t,e,n,r,i){const s=[];try{const a=vp(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(c,...u){if(!Tl(this,e,n,r,!0)){const l=kL(c);if("__context"in this||(this.__context=l),i&&["webgl","webgl2"].includes(l))if(u[0]&&typeof u[0]=="object"){const d=u[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else u.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[c,...u])}});s.push(a)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(a=>a())}}function fS(t,e,n,r,i,s,a,o){const c=[],u=Object.getOwnPropertyNames(t);for(const l of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof t[l]!="function")continue;const d=vp(t,l,function(f){return function(...h){const m=f.apply(this,h);if(cS(m,o,this),"tagName"in this.canvas&&!Tl(this.canvas,r,i,s,!0)){const p=uS(h,o,this),g={type:e,property:l,args:p};n(this.canvas,g)}return m}});c.push(d)}catch{const d=xp(t,l,{set(f){n(this.canvas,{type:e,property:l,args:[f],setter:!0})}});c.push(d)}return c}function IL(t,e,n,r,i,s){const a=[];return a.push(...fS(e.WebGLRenderingContext.prototype,_a.WebGL,t,n,r,i,s,e)),typeof e.WebGL2RenderingContext<"u"&&a.push(...fS(e.WebGL2RenderingContext.prototype,_a.WebGL2,t,n,r,i,s,e)),()=>{a.forEach(o=>o())}}const CL='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function xL(){const t=new Blob([CL]);return URL.createObjectURL(t)}class vL{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(o,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(o)||this.pendingCanvasMutations.set(o,[]),this.pendingCanvasMutations.get(o).push(c)};const{enableManualSnapshot:n,sampling:r="all",win:i,recordCanvas:s,errorHandler:a}=e;e.sampling=r,this.mutationCb=e.mutationCb,this.mirror=e.mirror,this.options=e,a&&bL(a),(s&&typeof r=="number"||n)&&(this.worker=this.initFPSWorker()),this.addWindow(i),!n&&Bp(()=>{s&&r==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),s&&typeof r=="number"&&this.initCanvasFPSObserver()})()}reset(){var e;
506this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(n=>{try{n()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,(e=this.worker)==null||e.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(e){const{sampling:n="all",blockClass:r,blockSelector:i,unblockSelector:s,recordCanvas:a,enableManualSnapshot:o}=this.options;if(!this.windowsSet.has(e)){if(o){this.windowsSet.add(e),this.windows.push(new WeakRef(e));return}Bp(()=>{if(a&&n==="all"&&this.initCanvasMutationObserver(e,r,i,s),a&&typeof n=="number"){const c=dS(e,r,i,s,!0);this.restoreHandlers.push(()=>{c()})}})(),this.windowsSet.add(e),this.windows.push(new WeakRef(e))}}addShadowRoot(e){this.shadowDoms.add(new WeakRef(e))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(e,n){if(n!=null&&n.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,e);return}ps(r=>this.takeSnapsh
506ot(r,!0,e))}initFPSWorker(){const e=new Worker(xL());return e.onmessage=n=>{const r=n.data,{id:i}=r;if(this.snapshotInProgressMap.set(i,!1),!("base64"in r))return;const{base64:s,type:a,width:o,height:c}=r;this.mutationCb({id:i,type:_a["2D"],commands:[{property:"clearRect",args:[0,0,o,c]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:a}]},0,0,o,c]}]})},e}initCanvasFPSObserver(){let e;if(!this.windows.length&&!this.shadowDoms.size)return;const n=r=>{this.takeSnapshot(r,!1),e=ps(n)};e=ps(n),this.restoreHandlers.push(()=>{e&&cancelAnimationFrame(e)})}initCanvasMutationObserver(e,n,r,i){const s=dS(e,n,r,i,!1),a=TL(this.processMutation.bind(this),e,n,r,i),o=IL(this.processMutation.bind(this),e,n,r,i,this.mirror);this.restoreHandlers.push(()=>{s(),a(),o()})}getCanvasElements(e,n,r){const i=[],s=a=>{a.querySelectorAll("canvas").forEach(o=>{Tl(o,e,n,r)||i.push(o)})};for(const a of this.windows){const o=a.deref();let c;try{c=o&&o.document}catch{}c&&s(c)}for(const a of this.shadowDoms){const o=a.deref();o&&s(o)}return i}takeSnapshot(e,n,r){const{sampling:i,blockClass:s,blockSelector:a,unblockSelector:o,dataURLOptions:c,maxCanvasSize:u}=this.options,d=1e3/(i==="all"?2:i||2);return this.lastSnapshotTime&&e-this.lastSnapshotTime<d?!1:(this.lastSnapshotTime=e,(r?[r]:this.getCanvasElements(s,a,o)).forEach(m=>{var g;const p=this.mirror.getId(m);if(!(!this.mirror.hasNode(m)||!m.width||!m.height||this.snapshotInProgressMap.get(p))){if(this.snapshotInProgressMap.set(p,!0),!n&&["webgl","webgl2"].includes(m.__context)){const A=m.getContext(m.__context);((g=A==null?void 0:A.getContextAttributes())==null?void 0:g.preserveDrawingBuffer)===!1&&A.clear(A.COLOR_BUFFER_BIT)}createImageBitmap(m).then(A=>{var y;(y=this.worker)==null||y.postMessage({id:p,bitmap:A,width:m.width,height:m.height,dataURLOptions:c,maxCanvasSize:u},[A])}).catch(A=>{Bp(()=>{throw this.snapshotInProgressMap.delete(p),A})()})}}),!0)}startPendingCanvasMutationFlusher(){ps(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=n=>{this.rafStamps.latestId=n,ps(e)};ps(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),ps(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||n===-1)return;const i=r.map(a=>{const{type:o,...c}=a;return c}),{type:s}=r[0];this.mutationCb({id:n,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=((Fv=t.contentWindow)==null?void 0:Fv.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}AL();var hS;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(hS||(hS={}));const pS={low:{sampling:{canvas:1},dataURLOptions:{type:"image/webp",quality:.25}},medium:{sampling:{canvas:2},dataURLOptions:{type:"image/webp",quality:.4}},high:{sampling:{canvas:4},dataURLOptions:{type:"image/webp",quality:.5}}},BL="ReplayCanvas",xl=1280,PL=((t={})=>{const[e,n]=t.maxCanvasSize||[],r={quality:t.quality||"medium",enableManualSnapshot:t.enableManualSnapshot,maxCanvasSize:[e?Math.min(e,xl):xl,n?Math.min(n,xl):xl]};let i;const s=new Promise(a=>i=a);return{name:BL,getOptions(){const{quality:a,enableManualSnapshot:o,maxCanvasSize:c}=r;return{enableManualSnapshot:o,recordCanvas:!0,getCanvasManager:u=>{const l=new vL({...u,enableManualSnapshot:o,maxCanvasSize:c,errorHandler:d=>{try{typeof d=="object"&&(d.__rrweb__=!0)}catch{}}});return i(l),l},...pS[a]||pS.medium}},async snapshot(a,o){(await s).snapshot(a,o)}}});function pr(t=0){return((nn()||performance.timeOrigin)+t)/1e3}function RL(t){const e=[];if(t.nextHopProtocol!=null){const{name:n,version:r}=c0(t.nextHopProtocol);e.push(["network.protocol.version",r],["network.protocol.name",n])}return nn()?[...e,["http.request.redirect_start",pr(t.redirectStart)],["http.request.fetch_start",pr(t.fetchStart)],["http.request.domain_lookup_start",pr(t.domainLookupStart)],["http.request.domain_lookup_end",pr(t.domainLookupEnd)],["http.request.connect_start",pr(t.connectStart)],["http.request.secure_connection_start",pr(t.secureConnectionStart)],["http.request.connection_end",pr(t.connectEnd)],["http.request.request_start",pr(t.requestStart)],["http.request.response_start",pr(t.responseStart)],["http.request.response_end",pr(t.responseEnd)]]:e}const mS=new WeakMap,Pp=new Map,Rp={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function gS(t,e){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:s,enableHTTPTimings:a,tracePropagationTargets:o,onRequestSpanStart:c}={...Rp,...e},u=typeof s=="function"?s:f=>!0,l=f=>ML(f,o),d={};n&&(t.addEventProcessor(f=>(f.type==="transaction"&&f.spans&&f.spans.forEach(h=>{if(h.op==="http.client"){const m=Pp.get(h.span_id);m&&(h.timestamp=m/1e3,Pp.delete(h.span_id))}}),f)),i&&dF(f=>{if(f.response){const h=mS.get(f.response);h&&f.endTimestamp&&Pp.set(h,f.endTimestamp)}}),ch(f=>{const h=ZR(f,u,l,d);if(f.response&&f.fetchData.__span&&mS.set(f.response,f.fetchData.__span),h){const m=yS(f.fetchData.url),p=m?os(m).host:void 0;h.setAttributes({"http.url":m,"server.address":p}),a&&AS(h),c==null||c(h,{headers:f.headers})}})),r&&qh(f=>{var m;const h=DL(f,u,l,d);if(h){a&&AS(h);let p;try{p=new Headers((m=f.xhr.__sentry_xhr_v3__)==null?void 0:m.request_headers)}catch{}c==null||c(h,{headers:p})}})}function FL(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function AS(t){const{url:e}=ke(t).data;if(!e||typeof e!="string")return;const n=fs("resource",({entries:r})=>{r.forEach(i=>
506{FL(i)&&i.name.endsWith(e)&&(RL(i).forEach(a=>t.setAttribute(...a)),setTimeout(n))})})}function ML(t,e){const n=$i();if(n){let r,i;try{r=new URL(t,n),i=new URL(n).origin}catch{return!1}const s=r.origin===i;return e?Xn(r.toString(),e)||s&&Xn(r.pathname,e):s}else{const r=!!t.match(/^\/(?!\/)/);return e?Xn(t,e):r}}function DL(t,e,n,r){const i=t.xhr,s=i==null?void 0:i[Ur];if(!i||i.__sentry_own_request__||!s)return;const{url:a,method:o}=s,c=Ai()&&e(a);if(t.endTimestamp&&c){const p=i.__sentry_xhr_span_id__;if(!p)return;const g=r[p];g&&s.status_code!==void 0&&(Io(g,s.status_code),g.end(),delete r[p]);return}const u=yS(a),l=os(u||a),d=nb(a),f=!!gt(),h=c&&f?Un({name:`${o} ${d}`,attributes:{url:a,type:"xhr","http.method":o,"http.url":u,"server.address":l==null?void 0:l.host,[Ne]:"auto.http.browser",[Pt]:"http.client",...(l==null?void 0:l.search)&&{"http.query":l==null?void 0:l.search},...(l==null?void 0:l.hash)&&{"http.fragment":l==null?void 0:l.hash}}}):new Rr;i.__sentry_xhr_span_id__=h.spanContext().spanId,r[i.__sentry_xhr_span_id__]=h,n(a)&&OL(i,Ai()&&f?h:void 0);const m=le();return m&&m.emit("beforeOutgoingRequestSpan",h,t),h}function OL(t,e){const{"sentry-trace":n,baggage:r}=rh({span:e});n&&NL(t,n,r)}function NL(t,e,n){var i;const r=(i=t.__sentry_xhr_v3__)==null?void 0:i.request_headers;if(!(r!=null&&r["sentry-trace"]))try{if(t.setRequestHeader("sentry-trace",e),n){const s=r==null?void 0:r.baggage;(!s||!UL(s))&&t.setRequestHeader("baggage",n)}}catch{}}function UL(t){return t.split(",").some(e=>e.trim().startsWith("sentry-"))}function yS(t){try{return new URL(t,he.location.origin).href}catch{return}}function LL(){he.document?he.document.addEventListener("visibilitychange",()=>{const t=gt();if(!t)return;const e=kt(t);if(he.document.hidden&&e){const n="cancelled",{op:r,status:i}=ke(e);Le&&W.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),i||e.setStatus({code:Tt,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):Le&&W.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const zL=3600,wS="sentry_previous_trace",QL="sentry.previous_trace";function HL(t,{linkPreviousTrace:e,consistentTraceSampling:n}){const r=e==="session-storage";let i=r?GL():void 0;t.on("spanStart",a=>{if(kt(a)!==a)return;const o=Be().getPropagationContext();i=WL(i,a,o),r&&VL(i)});let s=!0;n&&t.on("beforeSampling",a=>{if(!i)return;const o=Be(),c=o.getPropagationContext();if(s&&c.parentSpanId){s=!1;return}o.setPropagationContext({...c,dsc:{...c.dsc,sample_rate:String(i.sampleRate),sampled:String(Fp(i.spanContext))},sampleRand:i.sampleRand}),a.parentSampled=Fp(i.spanContext),a.parentSampleRate=i.sampleRate,a.spanAttributes={...a.spanAttributes,[my]:i.sampleRate}})}function WL(t,e,n){const r=ke(e);function i(){var o,c;try{return Number((o=n.dsc)==null?void 0:o.sample_rate)??Number((c=r.data)==null?void 0:c[ou])}catch{return 0}}const s={spanContext:e.spanContext(),startTimestamp:r.start_timestamp,sampleRate:i(),sampleRand:n.sampleRand};if(!t)return s;const a=t.spanContext;return a.traceId===r.trace_id?t:(Date.now()/1e3-t.startTimestamp<=zL&&(Le&&W.log(`Adding previous_trace ${a} link to span ${{op:r.op,...e.spanContext()}}`),e.addLink({context:a,attributes:{[N1]:"previous_trace"}}),e.setAttribute(QL,`${a.traceId}-${a.spanId}-${Fp(a)?1:0}`)),s)}function VL(t){try{he.sessionStorage.setItem(wS,JSON.stringify(t))}catch(e){Le&&W.warn("Could not store previous trace in sessionStorage",e)}}function GL(){var t;try{const e=(t=he.sessionStorage)==null?void 0:t.getItem(wS);return JSON.parse(e)}catch{return}}function Fp(t){return t.traceFlags===1}const qL="BrowserTracing",YL={...Au,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,enableElementTiming:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,_experiments:{},...Rp},ka=((t={})=>{const e={name:void 0,source:void 0},n=he.document,{enableInp:r,enableElementTiming:i,enableLongTask:s,enableLongAnimationFrame:a,_experiments:{enableInteractions:o,enableStandaloneClsSpans:c,enableStandaloneLcpSpans:u},beforeStartSpan:l,idleTimeout:d,finalTimeout:f,childSpanTimeout:h,markBackgroun
506dSpan:m,traceFetch:p,traceXHR:g,trackFetchStreamPerformance:A,shouldCreateSpanForRequest:y,enableHTTPTimings:w,ignoreResourceSpans:E,ignorePerformanceApiSpans:S,instrumentPageLoad:k,instrumentNavigation:T,detectRedirects:C,linkPreviousTrace:_,consistentTraceSampling:x,onRequestSpanStart:P}={...YL,...t};let v,M;function D(O,N,Q=!0){const G=N.op==="pageload",V=l?l(N):N,Z=V.attributes||{};if(N.name!==V.name&&(Z[et]="custom",V.attributes=Z),!Q){const K=Ji();Un({...V,startTime:K}).end(K);return}e.name=V.name,e.source=Z[et];const B=Jy(V,{idleTimeout:d,finalTimeout:f,childSpanTimeout:h,disableAutoFinish:G,beforeSpanEnd:K=>{v==null||v(),QD(K,{recordClsOnPageloadSpan:!c,recordLcpOnPageloadSpan:!u,ignoreResourceSpans:E,ignorePerformanceApiSpans:S}),SS(O,void 0);const q=Be(),ne=q.getPropagationContext();q.setPropagationContext({...ne,traceId:B.spanContext().traceId,sampled:ns(B),dsc:Zn(K)})}});SS(O,B);function L(){n&&["interactive","complete"].includes(n.readyState)&&O.emit("idleSpanEnableAutoFinish",B)}G&&n&&(n.addEventListener("readystatechange",()=>{L()}),L())}return{name:qL,setup(O){if(My(),v=FD({recordClsStandaloneSpans:c||!1,recordLcpStandaloneSpans:u||!1,client:O}),r&&u2(),i&&XD(),a&&Te.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?DD():s&&MD(),o&&OD(),C&&n){const Q=()=>{M=mt()};addEventListener("click",Q,{capture:!0}),addEventListener("keydown",Q,{capture:!0,passive:!0})}function N(){const Q=Xo(O);Q&&!ke(Q).timestamp&&(Le&&W.log(`[Tracing] Finishing current active span with op: ${ke(Q).op}`),Q.setAttribute(cu,"cancelled"),Q.end())}O.on("startNavigationSpan",(Q,G)=>{if(le()!==O)return;if(G!=null&&G.isRedirect){Le&&W.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),D(O,{op:"navigation.redirect",...Q},!1);return}N(),Qt().setPropagationContext({traceId:Pr(),sampleRand:Math.random()});const V=Be();V.setPropagationContext({traceId:Pr(),sampleRand:Math.random()}),V.setSDKProcessingMetadata({normalizedRequest:void 0}),D(O,{op:"navigation",...Q})}),O.on("startPageLoadSpan",(Q,G={})=>{if(le()!==O)return;N();const V=G.sentryTrace||bS("sentry-trace"),Z=G.baggage||bS("baggage"),B=_y(V,Z),L=Be();L.setPropagationContext(B),L.setSDKProcessingMetadata({normalizedRequest:Ch()}),D(O,{op:"pageload",...Q})})},afterAllSetup(O){let N=$i();if(_!=="off"&&HL(O,{linkPreviousTrace:_,consistentTraceSampling:x}),he.location){if(k){const Q=nn();ms(O,{name:he.location.pathname,startTime:Q?Q/1e3:void 0,attributes:{[et]:"url",[Ne]:"auto.pageload.browser"}})}T&&Zu(({to:Q,from:G})=>{if(G===void 0&&(N==null?void 0:N.indexOf(Q))!==-1){N=void 0;return}N=void 0;const V=tb(Q),Z=Xo(O),B=Z&&C&&jL(Z,M);gs(O,{name:(V==null?void 0:V.pathname)||he.location.pathname,attributes:{[et]:"url",[Ne]:"auto.navigation.browser"}},{url:Q,isRedirect:B})})}m&&LL(),o&&KL(O,d,f,h,e),r&&f2(),gS(O,{traceFetch:p,traceXHR:g,trackFetchStreamPerformance:A,tracePropagationTargets:O.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:y,enableHTTPTimings:w,onRequestSpanStart:P})}}});function ms(t,e,n){t.emit("startPageLoadSpan",e,n),Be().setTransactionName(e.name);const r=Xo(t);return r&&t.emit("afterStartPageLoadSpan",r),r}function gs(t,e,n){const{url:r,isRedirect:i}=n||{};t.emit("beforeStartNavigationSpan",e,{isRedirect:i}),t.emit("startNavigationSpan",e,{isRedirect:i});const s=Be();return s.setTransactionName(e.name),r&&!i&&s.setSDKProcessingMetadata({normalizedRequest:{...Ch(),url:r}}),Xo(t)}function bS(t){const e=he.document,n=e==null?void 0:e.querySelector(`meta[name=${t}]`);return(n==null?void 0:n.getAttribute("content"))||void 0}function KL(t,e,n,r,i){const s=he.document;let a;const o=()=>{const c="ui.action.click",u=Xo(t);if(u){const l=ke(u).op;if(["navigation","pageload"].includes(l)){Le&&W.warn(`[Tracing] Did not create ${c} span because a pageload or navigation span is in progress.`);return}}if(a&&(a.setAttribute(cu,"interactionInterrupted"),a.end(),a=void 0),!i.name){Le&&W.warn(`[Tracing] Did not create ${c} transaction because _latestRouteName is missing.`);return}a=Jy({name:i.name,op:c,attributes:{[et]:i.source||"url"}},{idleTimeout:e,finalTimeout:n,childSpanTimeout:r})};s&&addEventListener("click",o,{capture:!0})}const ES="_sentry_idleSpan";function Xo(t){return t[ES]}function SS(t,e){cn(t,ES,e)}const _S=.3;function jL(t,e){const n=ke(t),r=Ji(),i=n.start_timestamp;return!(r-i>_S||e&&r-e<=_S)}
506function Ia(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function $L(t,e){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(e);const r=Ia(n);return i=>r.then(s=>i(s.transaction(e,"readwrite").objectStore(e)))}function Mp(t){return Ia(t.getAllKeys())}function XL(t,e,n){return t(r=>Mp(r).then(i=>{if(!(i.length>=n))return r.put(e,Math.max(...i,0)+1),Ia(r.transaction)}))}function JL(t,e,n){return t(r=>Mp(r).then(i=>{if(!(i.length>=n))return r.put(e,Math.min(...i,0)-1),Ia(r.transaction)}))}function ZL(t){return t(e=>Mp(e).then(n=>{const r=n[0];if(r!=null)return Ia(e.get(r)).then(i=>(e.delete(r),Ia(e.transaction).then(()=>i)))}))}function e3(t){let e;function n(){return e==null&&(e=$L(t.dbName||"sentry-offline",t.storeName||"queue")),e}return{push:async r=>{try{const i=await hu(r);await XL(n(),i,t.maxQueueSize||30)}catch{}},unshift:async r=>{try{const i=await hu(r);await JL(n(),i,t.maxQueueSize||30)}catch{}},shift:async()=>{try{const r=await ZL(n());if(r)return dB(r)}catch{}}}}function t3(t){return e=>{const n=t({...e,createStore:e3});return he.addEventListener("online",async r=>{await n.flush()}),n}}function n3(t=jh){return t3(FP(t))}const TS=1e6,vl=String(0),r3="main",zn=he.navigator;let kS="",IS="",CS="",Dp=(zn==null?void 0:zn.userAgent)||"",xS="";const i3=(zn==null?void 0:zn.language)||((Mv=zn==null?void 0:zn.languages)==null?void 0:Mv[0])||"";function s3(t){return typeof t=="object"&&t!==null&&"getHighEntropyValues"in t}const vS=zn==null?void 0:zn.userAgentData;s3(vS)&&vS.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(t=>{var e;if(kS=t.platform||"",CS=t.architecture||"",xS=t.model||"",IS=t.platformVersion||"",(e=t.fullVersionList)!=null&&e.length){const n=t.fullVersionList[t.fullVersionList.length-1];Dp=`${n.brand} ${n.version}`}}).catch(t=>{});function a3(t){return!("thread_metadata"in t)}function o3(t){return a3(t)?l3(t):t}function c3(t){var n,r;const e=(r=(n=t.contexts)==null?void 0:n.trace)==null?void 0:r.trace_id;return typeof e=="string"&&e.length!==32&&Le&&W.log(`[Profiling] Invalid traceId: ${e} on profiled event`),typeof e!="string"?"":e}function u3(t,e,n,r){if(r.type!=="transaction")throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");if(n==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);const i=c3(r),s=o3(n),a=e||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:mt()*1e3),o=typeof r.timestamp=="number"?r.timestamp*1e3:mt()*1e3;return{event_id:t,timestamp:new Date(a).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||lu,runtime:{name:"javascript",version:he.navigator.userAgent},os:{name:kS,version:IS,build_number:Dp},device:{locale:i3,model:xS,manufacturer:Dp,architecture:CS,is_emulator:!1},debug_meta:{images:h3(n.resources)},profile:s,transactions:[{name:r.transaction||"",id:r.event_id||un(),trace_id:i,active_thread_id:vl,relative_start_ns:"0",relative_end_ns:((o-a)*1e6).toFixed(0)}]}}function BS(t){return ke(t).op==="pageload"}function l3(t){let e,n=0;const r={samples:[],stacks:[],frames:[],thread_metadata:{[vl]:{name:r3}}},i=t.samples[0];if(!i)return r;const s=i.timestamp,a=nn(),o=typeof performance.timeOrigin=="number"?performance.timeOrigin:a||0,c=o-(a||o);return t.samples.forEach((u,l)=>{if(u.stackId===void 0){e===void 0&&(e=n,r.stacks[e]=[],n++),r.samples[l]={elapsed_since_start_ns:((u.timestamp+c-s)*TS).toFixed(0),stack_id:e,thread_id:vl};return}let d=t.stacks[u.stackId];const f=[];for(;d;){f.push(d.frameId);const m=t.frames[d.frameId];m&&r.frames[d.frameId]===void 0&&(r.frames[d.frameId]={function:m.name,abs_path:typeof m.resourceId=="number"?t.resources[m.resourceId]:void 0,lineno:m.line,colno:m.column}),d=d.parentId===void 0?void 0:t.stacks[d.parentId]}const h={elapsed_since_start_ns:((u.timestamp+c-s)*TS).toFixed(0),stack_id:n,thread_id:vl};r.stacks[n]=f,r.samples[l]=h,n++}),r}function d3(t,e){if(!e.length)return t;for(const n of e)t[1].push([{type:"profile"},n]);return t}function f3(t){const e=[];return ss(t,(n,r)=>{var i,s;if(r==="transaction")for(let a=1;a<n.length;a++){const o=n[a];(s=(i=o==null?void 0:o.contexts)==null?void 0:i.profile)!=null&&s.profile_id&&e.push(n[a])}}),e}function h3(t){const e=le(),n=e==null?void 0:e.getOptions(),r=n==null?void 0:n.stackParser;return r?QB(r,t):[]}function p3(t){return typeof t!="number"&&typeof t!="boolean"||typeof t=="number"&&isNaN(t)?(Le&&W.warn(`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`),!1):t===!0||t===!1?!0:t<0||t>1?(Le&&W.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${t}.`),!1):!0}function m3(t){return t.samples.length<2?(Le&&W.log("[Profiling] Discarding profile because it c
506ontains less than 2 samples"),!1):t.frames.length?!0:(Le&&W.log("[Profiling] Discarding profile because it contains no frames"),!1)}let PS=!1;const RS=3e4;function g3(t){return typeof t=="function"}function A3(){const t=he.Profiler;if(!g3(t)){Le&&W.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}const e=10,n=Math.floor(RS/e);try{return new t({sampleInterval:e,maxBufferSize:n})}catch{Le&&(W.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."),W.log("[Profiling] Disabling profiling for current user session.")),PS=!0}}function FS(t){if(PS)return Le&&W.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!t.isRecording())return Le&&W.log("[Profiling] Discarding profile because transaction was not sampled."),!1;const e=le(),n=e==null?void 0:e.getOptions();if(!n)return Le&&W.log("[Profiling] Profiling disabled, no options found."),!1;const r=n.profilesSampleRate;return p3(r)?r?(r===!0?!0:Math.random()<r)?!0:(Le&&W.log(`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(r)})`),!1):(Le&&W.log("[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"),!1):(Le&&W.warn("[Profiling] Discarding profile because of invalid sample rate."),!1)}function y3(t,e,n,r){return m3(n)?u3(t,e,n,r):null}const As=new Map;function w3(){return As.size}function b3(t){const e=As.get(t);return e&&As.delete(t),e}function E3(t,e){if(As.set(t,e),As.size>30){const n=As.keys().next().value;As.delete(n)}}function MS(t){let e;BS(t)&&(e=mt()*1e3);const n=A3();if(!n)return;Le&&W.log(`[Profiling] started profiling span: ${ke(t).description}`);const r=un();Be().setContext("profile",{profile_id:r,start_timestamp:e});async function i(){if(t&&n)return n.stop().then(c=>{if(s&&(he.clearTimeout(s),s=void 0),Le&&W.log(`[Profiling] stopped profiling of span: ${ke(t).description}`),!c){Le&&W.log(`[Profiling] profiler returned null profile for: ${ke(t).description}`,"this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started");return}E3(r,c)}).catch(c=>{Le&&W.log("[Profiling] error while stopping profiler:",c)})}let s=he.setTimeout(()=>{Le&&W.log("[Profiling] max profile duration elapsed, stopping profiling for:",ke(t).description),i()},RS);const a=t.end.bind(t);function o(){return t?(i().then(()=>{a()},()=>{a()}),t):a()}t.end=o}const S3="BrowserProfiling",_3=(()=>({name:S3,setup(t){const e=gt(),n=e&&kt(e);n&&BS(n)&&FS(n)&&MS(n),t.on("spanStart",r=>{r===kt(r)&&FS(r)&&MS(r)}),t.on("beforeEnvelope",r=>{var a,o;if(!w3())return;const i=f3(r);if(!i.length)return;const s=[];for(const c of i){const u=c==null?void 0:c.contexts,l=(a=u==null?void 0:u.profile)==null?void 0:a.profile_id,d=(o=u==null?void 0:u.profile)==null?void 0:o.start_timestamp;if(typeof l!="string"){Le&&W.log("[Profiling] cannot find profile for a span without a profile context");continue}if(!l){Le&&W.log("[Profiling] cannot find profile for a span without a profile context");continue}u!=null&&u.profile&&delete u.profile;const f=b3(l);if(!f){Le&&W.log(`[Profiling] Could not retrieve profile for span: ${l}`);continue}const h=y3(l,d,f,c);h&&s.push(h)}d3(r,s)})}})),T3="SpotlightBrowser",k3=((t={})=>{const e=t.sidecarUrl||"http://localhost:8969/stream";return{name:T3,setup:()=>{Le&&W.log("Using Sidecar URL",e)},processEvent:n=>x3(n)?null:n,afterAllSetup:n=>{I3(n,e)}}});function I3(t,e){const n=Gh("fetch");let r=0;t.on("beforeEnvelope",i=>{if(r>3){W.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",r);return}n(e,{method:"POST",body:hu(i),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(s=>{s.status>=200&&s.status<400&&(r=0)},s=>{r++,W.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",s)})})}const C3=k3;function x3(t){var e;return!!(t.type==="transaction"&&t.spans&&((e=t.contexts)!=null&&e.trace)&&t.contexts.trace.op==="ui.action.click"&&t.spans.some(({description:n})=>n==null?void 0:n.includes("#sentry-spotlight")))}const v3=()=>({name:"LaunchDarkly",processEvent(t,e,n){return Bo(t)}});function B3(){return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:(t,e,n)=>{$s(t,e.value),Xs(t,e.value)}}}const P3=()=>({name:"OpenFeature",processEvent(t,e,n){return Bo(t)}});class R3{after(e,n){$s(n.flagKey,n.value),Xs(n.flagKey,n.value)}
506error(e,n,r){$s(e.flagKey,e.defaultValue),Xs(e.flagKey,e.defaultValue)}}const F3=({featureFlagClientClass:t})=>({name:"Unleash",setupOnce(){const e=t.prototype;on(e,"isEnabled",M3)},processEvent(e,n,r){return Bo(e)}});function M3(t){return function(...e){const n=e[0],r=t.apply(this,e);return typeof n=="string"&&typeof r=="boolean"?($s(n,r),Xs(n,r)):Le&&W.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${n} (${typeof n}), result: ${r} (${typeof r})`),r}}const D3=({featureFlagClient:t})=>({name:"Statsig",setup(e){t.on("gate_evaluation",n=>{$s(n.gate.name,n.gate.value),Xs(n.gate.name,n.gate.value)})},processEvent(e,n,r){return Bo(e)}});async function O3(){const t=le();if(!t)return"no-client-active";if(!t.getDsn())return"no-dsn-configured";try{await fetch("https://o447951.ingest.sentry.io/api/4509632503087104/envelope/?sentry_version=7&sentry_key=c1dfb07d783ad5325c245c1fd3725390&sentry_client=sentry.javascript.browser%2F1.33.7",{body:"{}",method:"POST",mode:"cors",credentials:"omit"})}catch{return"sentry-unreachable"}}const N3="WebWorker",U3=({worker:t})=>({name:N3,setupOnce:()=>{(Array.isArray(t)?t:[t]).forEach(e=>DS(e))},addWorker:e=>DS(e)});function DS(t){t.addEventListener("message",e=>{z3(e.data)&&(e.stopImmediatePropagation(),Le&&W.log("Sentry debugId web worker message received",e.data),he._sentryDebugIds={...e.data._sentryDebugIds,...he._sentryDebugIds})})}function L3({self:t}){t.postMessage({_sentryMessage:!0,_sentryDebugIds:t._sentryDebugIds??void 0})}function z3(t){return vr(t)&&t._sentryMessage===!0&&"_sentryDebugIds"in t&&(vr(t._sentryDebugIds)||t._sentryDebugIds===void 0)}function Q3(t){const e={...t};return nh(e,"react"),Gf("react",{version:zt.version}),r4(e)}function H3(t){const e=t.match(/^([^.]+)/);return e!==null&&parseInt(e[0])>=17}function W3(t,e){const n=new WeakSet;function r(i,s){if(!n.has(i)){if(i.cause)return n.add(i),r(i.cause,s);i.cause=s}}r(t,e)}function Op(t,{componentStack:e},n){if(H3(zt.version)&&xr(t)&&e){const r=new Error(t.message);r.name=`React ErrorBoundary ${t.name}`,r.stack=e,W3(t,r)}return An(r=>(r.setContext("react",{componentStack:e}),Dr(t,n)))}function V3(t){return(e,n)=>{const r=Op(e,n);t&&t(e,n,r)}}const OS="ui.react.render",G3="ui.react.update",NS="ui.react.mount";var Np={exports:{}},Xe={};/** @license React v16.13.1
507 * react-is.production.min.js
508 *
509 * Copyright (c) Facebook, Inc. and its affiliates.
510 *
511 * This source code is licensed under the MIT license found in the
512 * LICENSE file in the root directory of this source tree.
513 */var US;function q3(){if(US)return Xe;US=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,i=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,a=t?Symbol.for("react.provider"):60109,o=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,l=t?Symbol.for("react.forward_ref"):60112,d=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,h=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,p=t?Symbol.for("react.block"):60121,g=t?Symbol.for("react.fundamental"):60117,A=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function w(S){if(typeof S=="object"&&S!==null){var k=S.$$typeof;switch(k){case e:switch(S=S.type,S){case c:case u:case r:case s:case i:case d:return S;default:switch(S=S&&S.$$typeof,S){case o:case l:case m:case h:case a:return S;default:return k}}case n:return k}}}function E(S){return w(S)===u}return Xe.AsyncMode=c,Xe.ConcurrentMode=u,Xe.ContextConsumer=o,Xe.ContextProvider=a,Xe.Element=e,Xe.ForwardRef=l,Xe.Fragment=r,Xe.Lazy=m,Xe.Memo=h,Xe.Portal=n,Xe.Profiler=s,Xe.StrictMode=i,Xe.Suspense=d,Xe.isAsyncMode=function(S){return E(S)||w(S)===c},Xe.isConcurrentMode=E,Xe.isContextConsumer=function(S){return w(S)===o},Xe.isContextProvider=function(S){return w(S)===a},Xe.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===e},Xe.isForwardRef=function(S){return w(S)===l},Xe.isFragment=function(S){return w(S)===r},Xe.isLazy=function(S){return w(S)===m},Xe.isMemo=function(S){return w(S)===h},Xe.isPortal=function(S){return w(S)===n},Xe.isProfiler=function(S){return w(S)===s},Xe.isStrictMode=function(S){return w(S)===i},Xe.isSuspense=function(S){return w(S)===d},Xe.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===u||S===s||S===i||S===d||S===f||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===h||S.$$typeof===a||S.$$typeof===o||S.$$typeof===l||S.$$typeof===g||S.$$typeof===A||S.$$typeof===y||S.$$typeof===p)},Xe.typeOf=w,Xe}var LS;function Y3(){return LS||(LS=1,Np.exports=q3()),Np.exports}var Up,zS;function K3(){if(zS)return Up;zS=1;var t=Y3(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[t.ForwardRef]=r,s[t.Memo]=i;function a(m){return t.isMemo(m)?i:s[m.$$typeof]||e}var o=Object.defineProperty,c=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,l=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,f=Object.prototype;function h(m,p,g){if(typeof p!="string"){if(f){var A=d(p);A&&A!==f&&h(m,A,g)}var y=c(p);u&&(y=y.concat(u(p)));for(var w=a(m),E=a(p),S=0;S<y.length;++S){var k=y[S];if(!n[k]&&!(g&&g[k])&&!(E&&E[k])&&!(w&&w[k])){var T=l(p,k);try{o(m,k,T)}catch{}}}}return m}return Up=h,Up}var j3=K3(),QS=Lv(j3),$3=Object.freeze({__proto__:null,default:QS});const Bl=QS||$3,X3="unknown";class Lp extends zt.Component{constructor(e){super(e);const{name:n,disabled:r=!1}=this.props;r||(this._mountSpan=Un({name:`<${n}>`,onlyIfParent:!0,op:NS,attributes:{[Ne]:"auto.ui.react.profiler","ui.component_name":n}}))}componentDidMount(){this._mountSpan&&this._mountSpan.end()}shouldComponentUpdate({updateProps:e,includeUpdates:n=!0}){if(n&&this._mountSpan&&e!==this.props.updateProps){const r=Object.keys(e).filter(i=>e[i]!==this.props.updateProps[i]);if(r.length>0){const i=mt();this._updateSpan=as(this._mountSpan,()=>Un({name:`<${this.props.name}>`,onlyIfParent:!0,op:G3,startTime:i,attributes:{[Ne]:"auto.ui.react.profiler","ui.component_name":this.props.name,"ui.react.changed_props":r}}))}}return!0}componentDidUpdate(){this._updateSpan&&(this._updateSpan.end(),this._updateSpan=void 0)}componentWillUnmount(){const e=mt(),{name:n,includeRender:r=!0}=this.props;if(this._mountSpan&&r){const i=ke(this._mountSpan).timestamp;as(this._mountSpan,()=>{const s=Un({onlyIfParent:!0,name:`<${n}>`,op:OS,startTime:i,attributes:{[Ne]:"auto.ui.react.profiler","ui.component_name":n}});s&&s.end(e)})}}render(){return this.props.children}}Object.assign(Lp,{defaultProps:{disabled:!1,includeRender:!0,includeUpdates:!0}});function J3(t,e){const n=(e==null?void 0:e.name)||t.displayName||t.name||X3,r=i=>zt.createElement(Lp,{...e,name:n,updateProps:i},zt.createElement(t,{...i}));return r.displayName=`profiler(${n})`,Bl(r,t),r}function Z3(t,e={disabled:!1,hasRenderSpan:!0}
513){const[n]=zt.useState(()=>{if(!(e!=null&&e.disabled))return Un({name:`<${t}>`,onlyIfParent:!0,op:NS,attributes:{[Ne]:"auto.ui.react.profiler","ui.component_name":t}})});zt.useEffect(()=>(n&&n.end(),()=>{if(n&&e.hasRenderSpan){const r=ke(n).timestamp,i=mt(),s=Un({name:`<${t}>`,onlyIfParent:!0,op:OS,startTime:r,attributes:{[Ne]:"auto.ui.react.profiler","ui.component_name":t}});s&&s.end(i)}}),[])}const Jo=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,e8="unknown",zp={componentStack:null,error:null,eventId:null};class HS extends zt.Component{constructor(e){super(e),this.state=zp,this._openFallbackReportDialog=!0;const n=le();n&&e.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=n.on("afterSendEvent",r=>{!r.type&&this._lastEventId&&r.event_id===this._lastEventId&&$h({...e.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(e,n){const{componentStack:r}=n,{beforeCapture:i,onError:s,showDialog:a,dialogOptions:o}=this.props;An(c=>{i&&i(c,e,r);const u=this.props.handled!=null?this.props.handled:!!this.props.fallback,l=Op(e,n,{mechanism:{handled:u}});s&&s(e,r,l),a&&(this._lastEventId=l,this._openFallbackReportDialog&&$h({...o,eventId:l})),this.setState({error:e,componentStack:r,eventId:l})})}componentDidMount(){const{onMount:e}=this.props;e&&e()}componentWillUnmount(){const{error:e,componentStack:n,eventId:r}=this.state,{onUnmount:i}=this.props;i&&(this.state===zp?i(null,null,null):i(e,n,r)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){const{onReset:e}=this.props,{error:n,componentStack:r,eventId:i}=this.state;e&&e(n,r,i),this.setState(zp)}render(){const{fallback:e,children:n}=this.props,r=this.state;if(r.componentStack===null)return typeof n=="function"?n():n;const i=typeof e=="function"?zt.createElement(e,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):e;return zt.isValidElement(i)?i:(e&&Jo&&W.warn("fallback did not produce a valid ReactElement"),null)}}function t8(t,e){const n=t.displayName||t.name||e8,r=i=>zt.createElement(HS,{...e},zt.createElement(t,{...i}));return r.displayName=`errorBoundary(${n})`,Bl(r,t),r}const n8="redux.action",r8="info",i8={attachReduxState:!0,actionTransformer:t=>t,stateTransformer:t=>t||null};function s8(t){const e={...i8,...t};return n=>(r,i)=>{e.attachReduxState&&_o().addEventProcessor((o,c)=>{try{o.type===void 0&&o.contexts.state.state.type==="redux"&&(c.attachments=[...c.attachments||[],{filename:"redux_state.json",data:JSON.stringify(o.contexts.state.state.value)}])}catch{}return o});function s(o){return(c,u)=>{const l=o(c,u),d=Be(),f=e.actionTransformer(u);typeof f<"u"&&f!==null&&er({category:n8,data:f,type:r8});const h=e.stateTransformer(l);
513if(typeof h<"u"&&h!==null){const p=le(),g=p==null?void 0:p.getOptions(),A=(g==null?void 0:g.normalizeDepth)||3,y={state:{type:"redux",value:h}};cn(y,"__sentry_override_normalization_depth__",3+A),d.setContext("state",y)}else d.setContext("state",null);const{configureScopeWithState:m}=e;return typeof m=="function"&&m(d,l),l}}const a=n(s(r),i);return a.replaceReducer=new Proxy(a.replaceReducer,{apply:function(o,c,u){o.apply(c,[s(u[0])])}}),a}}function a8(t){const e=ka({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,match:i,instrumentPageLoad:s=!0,instrumentNavigation:a=!0}=t;return{...e,afterAllSetup(o){e.afterAllSetup(o),s&&he.location&&WS(r,he.location,i,(c,u="url")=>{ms(o,{name:c,attributes:{[Pt]:"pageload",[Ne]:"auto.pageload.react.reactrouter_v3",[et]:u}})}),a&&n.listen&&n.listen(c=>{(c.action==="PUSH"||c.action==="POP")&&WS(r,c,i,(u,l="url")=>{gs(o,{name:u,attributes:{[Pt]:"navigation",[Ne]:"auto.navigation.react.reactrouter_v3",[et]:l}})})})}}}function WS(t,e,n,r){let i=e.pathname;n({location:e,routes:t},(s,a,o)=>{if(s||!o)return r(i);const c=o8(o.routes||[]);return c.length===0||c==="/*"?r(i):(i=c,r(i,"route"))})}function o8(t){var r;if(!Array.isArray(t)||t.length===0)return"";const e=t.filter(i=>!!i.path);let n=-1;for(let i=e.length-1;i>=0;i--)if((r=e[i].path)!=null&&r.startsWith("/")){n=i;break}return e.slice(n).reduce((i,{path:s})=>{const a=i==="/"||i===""?s:`/${s}`;return`${i}${a}`},"")}function c8(t,e={}){const n=t,r=ka({...e,instrumentNavigation:!1,instrumentPageLoad:!1}),{instrumentPageLoad:i=!0,instrumentNavigation:s=!0}=e;return{...r,afterAllSetup(a){r.afterAllSetup(a);const o=he.location;if(i&&o){const c=n.matchRoutes(o.pathname,n.options.parseSearch(o.search),{preload:!1,throwOnError:!1}),u=c[c.length-1];ms(a,{name:u?u.routeId:o.pathname,attributes:{[Pt]:"pageload",[Ne]:"auto.pageload.react.tanstack_router",[et]:u?"route":"url",...VS(u)}})}s&&n.subscribe("onBeforeNavigate",c=>{var m;if(c.toLocation.state===((m=c.fromLocation)==null?void 0:m.state))return;const u=n.matchRoutes(c.toLocation.pathname,c.toLocation.search,{preload:!1,throwOnError:!1}),l=u[u.length-1],d=he.location,f=gs(a,{name:l?l.routeId:d.pathname,attributes:{[Pt]:"navigation",[Ne]:"auto.navigation.react.tanstack_router",[et]:l?"route":"url"}}),h=n.subscribe("onResolved",p=>{if(h(),f){const g=n.matchRoutes(p.toLocation.pathname,p.toLocation.search,{preload:!1,throwOnError:!1}),A=g[g.length-1];A&&(f.updateName(A.routeId),f.setAttribute(et,"route"),f.setAttributes(VS(A)))}})})}}}function VS(t){if(!t)return{};const e={};return Object.entries(t.params).forEach(([n,r])=>{e[`url.path.params.${n}`]=r,e[`url.path.parameter.${n}`]=r,e[`params.${n}`]=r}),e}function u8(t){const e=ka({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:i,instrumentPageLoad:s=!0,instrumentNavigation:a=!0}=t;return{...e,afterAllSetup(o){e.afterAllSetup(o),GS(o,s,a,n,"reactrouter_v4",r,i)}}}function l8(t){const e=ka({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:i,instrumentPageLoad:s=!0,instrumentNavigation:a=!0}=t;return{...e,afterAllSetup(o){e.afterAllSetup(o),GS(o,s,a,n,"reactrouter_v5",r,i)}}}function GS(t,e,n,r,i,s=[],a){function o(){if(r.location)return r.location.pathname;if(he.location)return he.location.pathname}function c(u){if(s.length===0||!a)return[u,"url"];const l=qS(s,u,a);for(const d of l)if(d.match.isExact)return[d.match.path,"route"];return[u,"url"]}if(e){const u=o();if(u){const[l,d]=c(u);ms(t,{name:l,attributes:{[Pt]:"pageload",[Ne]:`auto.pageload.react.${i}`,[et]:d}})}}n&&r.listen&&r.listen((u,l)=>{if(l&&(l==="PUSH"||l==="POP")){const[d,f]=c(u.pathname);gs(t,{name:d,attributes:{[Pt]:"navigation",[Ne]:`auto.navigation.react.${i}`,[et]:f}})}})}function qS(t,e,n,r=[]){return t.some(i=>{const s=i.path?n(e,i):r.length?r[r.length-1].match:d8(e);return s&&(r.push({route:i,match:s}),i.routes&&qS(i.routes,e,n,r)),!!s}),r}function d8(t){return{path:"/",url:"/",params:{},isExact:t==="/"}}function f8(t){const e=t.displayName||t.name,n=r=>{var i;if((i=r==null?void 0:r.computedMatch)!=null&&i.isExact){const s=r.computedMatch.path,a=h8();Be().setTransactionName(s),a&&(a.updateName(s),a.setAttribute(et,"route"))}return zt.createElement(t,{...r})};return n.displayName=`sentryRoute(${e})`,Bl(n,t),n}function h8(){const t=gt(),e=t&&kt(t);if(!e)return;const n=ke(e).op;return n==="navigation"||n==="pageload"?e:void 0}let ki,Ii,Ci,Pl,mr,Ca=!1;const YS=new WeakSet,gr=new Set;function KS(t,e){return!ki||!Ii||!Ci||!mr?(Jo&&W.warn(`reactRouterV${e}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`),t):function(n,r){Fl(n);const i=t(n,r),s=r==null?void 0:r.basename,a=Dl();return i.state.historyAction==="POP"&&a&&Ml(a,i.state.location,n,void 0,s,Array.from(gr)),i.subscribe(o=>{(o.historyAction==="PUSH"||o.historyAction==="POP")&&(o.navigation.state!=="idle"?requestAnimationFrame(()=>{Zo({location:o.location,routes:n,navigationType:o.historyAction,version:e,basename:s,allRoutes:Array.from(gr)})}):Zo({location:o.location,routes:n,navigationType:o.historyAction,version:e,basename:s,allRoutes:Array.from(gr)}))}),i}}function jS(t,e){return!ki||!Ii||!Ci||!mr?(Jo&&W.warn(`reactRouterV${e}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`),t):function(n,r){Fl(n);const i=t(n,r),s=r==null?void 0:r.basename,a=Dl();let o;const c=r==null?void 0:r.initialEntries,u=r==null?void 0:r.initialIndex,l=c&&c.length===1,d=u!==void 0&&c&&c[u];o=l?c[0]:d?c[u]:void 0;
513const f=o?typeof o=="string"?{pathname:o}:o:i.state.location;return i.state.historyAction==="POP"&&a&&Ml(a,f,n,void 0,s,Array.from(gr)),i.subscribe(h=>{const m=h.location;(h.historyAction==="PUSH"||h.historyAction==="POP")&&Zo({location:m,routes:n,navigationType:h.historyAction,version:e,basename:s,allRoutes:Array.from(gr)})}),i}}function $S(t,e){const n=ka({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:i,useNavigationType:s,createRoutesFromChildren:a,matchRoutes:o,stripBasename:c,instrumentPageLoad:u=!0,instrumentNavigation:l=!0}=t;return{...n,setup(d){n.setup(d),ki=r,Ii=i,Ci=s,mr=o,Pl=a,Ca=c||!1},afterAllSetup(d){var h;n.afterAllSetup(d);const f=(h=he.location)==null?void 0:h.pathname;u&&f&&ms(d,{name:f,attributes:{[et]:"url",[Pt]:"pageload",[Ne]:`auto.pageload.react.reactrouter_v${e}`}}),l&&YS.add(d)}}}function XS(t,e){if(!ki||!Ii||!Ci||!mr)return Jo&&W.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."),t;const n=r=>{const i=zt.useRef(!0),{routes:s,locationArg:a}=r,o=t(s,a),c=Ii(),u=Ci(),l=typeof a=="string"||a!=null&&a.pathname?a:c;return ki(()=>{const d=typeof l=="string"?{pathname:l}:l;i.current?(Fl(s),Ml(Dl(),d,s,void 0,void 0,Array.from(gr)),i.current=!1):Zo({location:d,routes:s,navigationType:u,version:e,allRoutes:Array.from(gr)})},[u,l]),o};return(r,i)=>zt.createElement(n,{routes:r,locationArg:i})}function Zo(t){const{location:e,routes:n,navigationType:r,version:i,matches:s,basename:a,allRoutes:o}=t,c=Array.isArray(s)?s:mr(n,e,a),u=le();if(!(!u||!YS.has(u))&&(r==="PUSH"||r==="POP")&&c){let l,d="url";const f=e_(e,o||n);f&&(l=ec(Qp(o||n,e)),d="route"),(!f||!l)&&([l,d]=n_(n,e,c,a));const h=gt();h&&ke(h).op==="navigation"?(h==null||h.updateName(l),h==null||h.setAttribute(et,d)):gs(u,{name:l,attributes:{[et]:d,[Pt]:"navigation",[Ne]:`auto.navigation.react.reactrouter_v${i}`}})}}function Rl(t,e){if(!e||e==="/"||!t.toLowerCase().startsWith(e.toLowerCase()))return t;const n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?t:t.slice(n)||"/"}function p8(t,e,n){const r=t||Ca?Rl(e,n):e;return[r[r.length-1]==="/"||r.slice(-2)==="/*"?r.slice(0,-1):r,"route"]}function JS(t){return t.endsWith("*")}function ZS(t,e){var n;return JS(t)&&!!((n=e.route.children)!=null&&n.length)||!1}function m8(t){var e;return!!(!t.children&&t.element&&((e=t.path)!=null&&e.endsWith("/*")))}function e_(t,e){const n=mr(e,t);if(n){for(const r of n)if(m8(r.route)&&A8(r))return!0}return!1}function Fl(t){t.forEach(e=>{t_(e).forEach(r=>{gr.add(r)})})}function t_(t,e=new Set){return e.has(t)||(e.add(t),t.children&&!t.index&&t.children.forEach(n=>{t_(n,e).forEach(i=>{e.add(i)})})),e}function g8(t){return y8(t.route.path||"")}function A8(t){return t.params["*"]||""}function y8(t){return t[t.length-1]==="*"?t.slice(0,-1):t}function xa(t){return t[t.length-1]==="/"?t.slice(0,-1):t}function ec(t){return t[0]==="/"?t:`/${t}`}function Qp(t,e){const n=mr(t,e);if(!n||n.length===0)return"";for(const r of n)if(r.route.path&&r.route.path!=="*"){const i=g8(r),s=Rl(e.pathname,ec(r.pathnameBase));return e.pathname===s?xa(s):xa(xa(i||"")+ec(Qp(t.filter(a=>a!==r.route),{pathname:s})))}return""}function n_(t,e,n,r=""){if(!t||t.length===0)return[Ca?Rl(e.pathname,r):e.pathname,"url"];let i="";if(n)for(const a of n){const o=a.route;if(o){if(o.index)return p8(i,a.pathname,r);const c=o.path;if(c&&!ZS(c,a)){const u=c[0]==="/"||i[i.length-1]==="/"?c:`/${c}`;if(i=xa(i)+ec(u),xa(e.pathname)===xa(r+a.pathname))return i_(i)!==i_(a.pathname)&&!JS(i)?[(Ca?"":r)+u,"route"]:(ZS(i,a)&&(i=i.slice(0,-1)),[(Ca?"":r)+i,"route"])}}}return[Ca?Rl(e.pathname,r):e.pathname||"/","url"]}function Ml(t,e,n,r,i,s){const a=Array.isArray(r)?r:mr(s||n,e,i);if(a){let o,c="url";const u=e_(e,s||n);u&&(o=ec(Qp(s||n,e)),c="route"),(!u||!o)&&([o,c]=n_(n,e,a,i)),Be().setTransactionName(o||"/"),t&&(t.updateName(o),t.setAttribute(et,c))}}function r_(t,e){if(!ki||!Ii||!Ci||!Pl||!mr)return Jo&&W.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
514      useEffect: ${ki}. useLocation: ${Ii}. useNavigationType: ${Ci}.
515      createRoutesFromChildren: ${Pl}. matchRoutes: ${mr}.`),t;const n=r=>{const i=zt.useRef(!0),s=Ii(),a=Ci();return ki(()=>{const o=Pl(r.children);i.current?(Fl(o),Ml(Dl(),s,o,void 0,void 0,Array.from(gr)),i.current=!1):Zo({location:s,routes:o,navigationType:a,version:e,allRoutes:Array.from(gr)})},[s,a]),zt.createElement(t,{...r})};return Bl(n,t),n}function Dl(){const t=gt(),e=t?kt(t):void 0;if(!e)return;const n=ke(e).op;return n==="navigation"||n==="pageload"?e:void 0}function i_(t){return t.split(/\\?\//).filter(e=>e.length>0&&e!==",").length}function w8(t){return $S(t,"6")}function b8(t){return XS(t,"6")}
515function E8(t){return KS(t,"6")}function S8(t){return jS(t,"6")}function _8(t){return r_(t,"6")}function T8(t){return $S(t,"7")}function k8(t){return r_(t,"7")}function I8(t){return KS(t,"7")}function C8(t){return jS(t,"7")}function x8(t){return XS(t,"7")}function v8(t){const e={...t,environment:t.environment||"production"};return nh(e,"remix",["remix","react"]),Q3(e)}function B8(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function P8(t){if(!(B8(t)||lh()||!(t instanceof Error)))return Dr(t,{mechanism:{type:"instrument",handled:!1,data:{function:"ReactError"}}})}let tc,Ol,Nl,Hp;function R8(){if(he.location)return he.location.pathname}function F8(t){const e=R8();if(!e)return;const n={name:e,op:"pageload",attributes:{[Ne]:"auto.pageload.remix",[et]:"url"}};ms(t,n)}function M8(t){const e=t[t.length-1],n=le();if(!n||!e)return;const r={name:e.id,op:"navigation",attributes:{[Ne]:"auto.navigation.remix",[et]:"route"}};gs(n,r)}function D8(t,e,n,r,i){return a=>{if(s_({useEffect:e,useLocation:n,useMatches:r,instrumentNavigation:i||!0}),!tc||!Ol||!Nl)return lb&&!lh()&&W.warn("Remix SDK was unable to wrap your root because of one or more missing parameters."),zt.createElement(t,{...a});let o=!1;const c=Ol(),u=Nl();return tc(()=>{const l=u&&u[u.length-1];if(l){const d=l.id;Be().setTransactionName(d);const f=gt();if(f){const h=kt(f);h&&(h.updateName(d),h.setAttribute(et,"route"))}}o=!0},[]),tc(()=>{const l=gt();if(o){l&&l.end();return}Hp&&(u!=null&&u.length)&&(l&&l.end(),M8(u))},[c]),o=!1,zt.createElement(t,{...a})}}function s_({useEffect:t,useLocation:e,useMatches:n,instrumentNavigation:r}){tc=t||tc,Ol=e||Ol,Nl=n||Nl,Hp=r??Hp}function O8(t){const{instrumentPageLoad:e=!0,instrumentNavigation:n=!0,useEffect:r,useLocation:i,useMatches:s}=t;s_({useEffect:r,useLocation:i,useMatches:s,instrumentNavigation:n});const a=ka({...t,instrumentPageLoad:!1,instrumentNavigation:!1});return{...a,afterAllSetup(o){a.afterAllSetup(o),e&&F8(o)}}}async function N8(t,e,n){lb&&W.warn("`captureRemixServerException` is a server-only function and should not be called in the browser. This function is a no-op in the browser environment.")}var U8=Object.freeze({__proto__:null,BrowserClient:Kb,ErrorBoundary:HS,OpenFeatureIntegrationHook:R3,Profiler:Lp,SDK_VERSION:kr,SEMANTIC_ATTRIBUTE_SENTRY_OP:Pt,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:Ne,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:ou,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:et,Scope:Jn,WINDOW:he,addBreadcrumb:er,addEventProcessor:aw,addIntegration:jf,breadcrumbsIntegration:_0,browserApiErrorsIntegration:T0,browserProfilingIntegration:_3,browserSessionIntegration:I0,browserTracingIntegration:O8,buildLaunchDarklyFlagUsedHandler:B3,captureConsoleIntegration:oR,captureEvent:vo,captureException:Dr,captureFeedback:rb,captureMessage:_u,captureReactException:Op,captureRemixErrorBoundaryError:P8,captureRemixServerException:N8,captureSession:Kf,chromeStackLineParser:y0,close:iP,consoleLoggingIntegration:aF,contextLinesIntegration:_4,continueTrace:IB,createReduxEnhancer:s8,createTransport:Cw,createUserFeedbackEnvelope:v2,dedupeIntegration:Vw,defaultRequestInstrumentationOptions:Rp,defaultStackLineParsers:b0,defaultStackParser:E0,diagnoseSdkConnectivity:O3,endSession:Yf,eventFiltersIntegration:Dw,eventFromException:qb,eventFromMessage:Yb,exceptionFromError:Qu,extraErrorDataIntegration:pR,featureFlagsIntegration:$R,feedbackAsyncIntegration:FM,feedbackIntegration:Vb,feedbackSyncIntegration:Vb,flush:rP,forceLoad:i4,functionToStringIntegration:Mw,geckoStackLineParser:w0,getActiveSpan:gt,getClient:le,getCurrentScope:Be,getDefaultIntegrations:R0,getFeedback:WF,getGlobalScope:_o,getIsolationScope:Qt,getReplay:hL,getRootSpan:kt,getSpanDescendants:Co,getSpanStatusFromHttpCode:gy,getTraceData:rh,globalHandlersIntegration:C0,graphqlClientIntegration:P4,httpClientIntegration:l4,httpContextIntegration:B0,inboundFiltersIntegration:Ow,init:v8,instrumentOutgoingRequests:gS,instrumentSupabaseClient:Jw,isEnabled:sw,isInitialized:sP,lastEventId:iw,launchDarklyIntegration:v3,lazyLoadIntegration:Wb,linkedErrorsIntegration:P0,logger:zM,makeBrowserOfflineTransport:n3,makeFetchTransport:jh,makeMultiplexedTransport:OP,moduleMetadataIntegration:iR,onLoad:s4,openFeatureIntegration:P3,opera10StackLineParser:I2,opera11StackLineParser:x2,parameterize:Pw,reactErrorHandler:V3,reactRouterV3BrowserTracingIntegration:a8,reactRouterV4BrowserTracingIntegration:u8,reactRouterV5BrowserTracingIntegration:l8,reactRouterV6BrowserTracingIntegration:w8,reactRouterV7BrowserTracingIntegration:T8,registerSpanErrorInstrumentation:My,registerWebWorker:L3,replayCanvasIntegration:PL,replayIntegration:lL,reportingObserverIntegration:c4,rewriteFramesIntegration:_R,sendFeedback:fb,setContext:Gf,setCurrentClient:Sw,setExtra:ZB,setExtras:JB,setHttpStatus:Io,setMeasurement:Vy,setTag:tP,setTags:eP,setUser:nP,showReportDialog:$h,spanToBaggageHeader:nB,spanToJSON:ke,spanToTraceHeader:xy,spotlightBrowserIntegration:C3,startBrowserTracingNavigationSpan:gs,startBrowserTracingPageLoadSpan:ms,startInactiveSpan:Un,startNewTrace:xB,startSession:qf,startSpan:gu,
515startSpanManual:kB,statsigIntegration:D3,supabaseIntegration:OR,suppressTracing:CB,tanstackRouterBrowserTracingIntegration:c8,thirdPartyErrorFilterIntegration:GR,unleashIntegration:F3,updateSpanName:$1,useProfiler:Z3,webWorkerIntegration:U3,winjsStackLineParser:T2,withActiveSpan:as,withErrorBoundary:t8,withIsolationScope:M1,withProfiler:J3,withScope:An,withSentry:D8,withSentryReactRouterV6Routing:_8,withSentryReactRouterV7Routing:k8,withSentryRouting:f8,wrapCreateBrowserRouterV6:E8,wrapCreateBrowserRouterV7:I8,wrapCreateMemoryRouterV6:S8,wrapCreateMemoryRouterV7:C8,wrapUseRoutesV6:b8,wrapUseRoutesV7:x8,zodErrorsIntegration:VR});const L8=t=>{const{baseDelay:e=250,minDelay:n=0,maxDelay:r=1/0,maxRetryCount:i=1/0}=t||{};return s=>{if(!(s>i-1))return Math.max(n,Math.min(r,s&&e*Math.pow(2,s-1)))}},Wp=new WeakMap,nc=(t,...e)=>{const n=e.filter(i=>i instanceof AbortSignal);if(!n.length)return;const r=Wp.get(t)||new WeakSet;Wp.set(t,r);for(const i of n){if(t.signal.aborted)break;if(r.has(i))continue;const s=()=>{t.abort(i.reason),i.removeEventListener("abort",s),Wp.delete(t),r.delete(i)};i.aborted?s():(r.add(i),i.addEventListener("abort",s))}},a_=(...t)=>{const e=t.filter(r=>r instanceof AbortSignal);if(!e.length)return;if(typeof AbortSignal.any=="function")return AbortSignal.any(e);const n=new AbortController;return nc(n,...e),n.signal};class Qr extends Error{constructor(e,n){super(e.message),this.underlyingError=e,this.response=n}}const o_=async(t,e)=>typeof t=="function"?t(e):t,Vp=async(t,e,n)=>{if(typeof t=="number")return t;if(typeof t=="function")return t==null?void 0:t(e,n);if(Array.isArray(t))return t[e]},z8=t=>{if(typeof t=="string")return t;if(t instanceof URL)return t.href;if(t instanceof Request)return t.url;throw new Error("Couldn't get url from input")},Q8=(t,e)=>{const{init:n,inspect:r,retry:i,timeout:s}=e||{},{promise:a,resolve:o}=di(),c=new AbortController,u=h=>{o(h),d!==null&&clearTimeout(d),c.signal.aborted||c.abort(h)},l=async h=>{const m=h&&!h.ok&&h.error||null,p=await o_(n,m)||{};nc(c,p.signal);const g=await fetch(t,{...p}).then($t);return await(r==null?void 0:r(g.value,m))||g};let d=null,f=0;return s&&(d=setTimeout(()=>u(we(new Qr(new Error(`The extended-fetch timeout of ${s}ms has been exceeded`)))),s)),c.signal.addEventListener("abort",()=>{const{reason:h}=c.signal;u(we(new Qr(Lt(h,new Error(`Extended-fetch aborted: ${h}`)))))}),(async()=>{let h=null;try{for(;!c.signal.aborted&&(h=await l(h).catch(g=>we(new Qr(Lt(g,new Error(`Extended-fetch fetch error: ${g}`))))),!h.ok);){const m=await Vp(i,f,h.error).catch(()=>null);if(typeof m!="number")break;const p=Math.max(0,m);p&&await new Promise(g=>setTimeout(g,p)),f++}u(h||we(new Qr(new Error("No extended-fetch result"))))}catch(m){u(we(new Qr(new Error(`Extended-fetch error: ${m}`))))}})(),a},Ul=(...t)=>{const e={};for(const n of t){if(!n)continue;const r=new Headers(n);for(const[i,s]of r.entries())e[i]=s}return e},c_=t=>t instanceof TypeError,H8=t=>new TypeError(Lt(t).message),W8=t=>{const{onStalled:e,timeout:n}=t;let r=null;const i=()=>{r!==null&&(clearTimeout(r),r=null)};return{extend:()=>{n&&(i(),r=setTimeout(()=>{e==null||e(),i()},n))},clear:i}},Gp=t=>!!t&&t.status>=400&&t.status<500,V8=(t,e,n,r)=>{const{body:i=null,headers:s={},method:a="GET",responseType:o,signal:c,withCredentials:u=!1,progressStall:l=0}=e||{},{promise:d,resolve:f}=di();try{const h=new XMLHttpRequest,{extend:m,clear:p}=W8({timeout:l,onStalled:()=>{h.abort(),g(we(new Qn(new Error(`XHR Stalled. (${(l/1e3).toFixed(2)} seconds)`),h)))}}),g=y=>{p(),f(y)},A=()=>g(we(new Qn(new DOMException("Aborted","AbortError"))));{const{onAbort:y,onError:w,onLoad:E,onLoadEnd:S,onLoadStart:k,onProgress:T,onTimeout:C}=n||{};y&&h.addEventListener("abort",_=>{y(_)}),w&&h.addEventListener("error",_=>{w(_)}),E&&h.addEventListener("load",_=>{E(_)}),S&&h.addEventListener("loadend",_=>{S(_)}),k&&h.addEventListener("loadstart",_=>{k(_)}),T&&h.addEventListener("progress",_=>{T(_)}),C&&h.addEventListener("timeout",_=>{C(_)})}{const{onAbort:y,onError:w,onLoad:E,onLoadEnd:S,onLoadStart:k,onProgress:T,onTimeout:C}=r||{};y&&h.upload.addEventListener("abort",_=>{y(_)}),w&&h.upload.addEventListener("error",_=>{w(_)}),E&&h.upload.addEventListener("load",_=>{E(_)}),S&&h.upload.addEventListener("loadend",_=>{S(_)}),k&&h.upload.addEventListener("loadstart",_=>{k(_)}),T&&h.upload.addEventListener("progress",_=>{T(_)}),C&&h.upload.addEventListener("timeout",_=>{C(_)})}if(c){const y=()=>{h.abort(),c.removeEventListener("abort",y),A()};c.aborted?y():c.addEventListener("abort",y)}l&&(h.addEventListener("progress",m),h.upload.addEventListener("progress",m)),h.addEventListener("load",()=>{g($t(h))}),h.addEventListener("error",()=>{g(we(new Qn(new Error("XHR Error"))))}),h.addEventListener("timeout",()=>{g(we(new Qn(new Error("XHR Timeout"))))});
515try{h.open(a,t,!0),s&&new Headers(s).forEach((w,E)=>{h.setRequestHeader(E,w)}),h.withCredentials=u,o&&(h.responseType=o),h.send(i)}catch(y){g(we(new Qn(Lt(y,new Error(`XHR open / send error: ${y}`)))))}}catch(h){f(we(new Qn(Lt(h,new Error(`XHR error: ${h}`)))))}return d};class Qn extends Error{constructor(e,n){super(e.message),this.underlyingError=e,this.xhr=n}}const G8=async(t,e)=>typeof t=="function"?t(e):t,q8=async(t,e,n)=>{if(typeof t=="number")return t;if(typeof t=="function")return t==null?void 0:t(e,n);if(Array.isArray(t))return t[e]},Y8=async(t,e)=>{const{init:n,inspect:r,retry:i,timeout:s,downloadCallbacks:a,uploadCallbacks:o}=e||{},{promise:c,resolve:u}=di(),l=new AbortController,d=p=>{u(p),h!==null&&clearTimeout(h),l.signal.aborted||l.abort(p)},f=async p=>{const g=p&&!p.ok&&p.error||null,A=await G8(n,g)||{};nc(l,A.signal);const y=await V8(t,{...A},a,o);return y.ok&&await(r==null?void 0:r(y.value,g))||y};let h=null,m=0;return s&&(h=setTimeout(()=>d(we(new Qn(new Error(`The xhr-fetch timeout of ${s}ms has been exceeded`)))),s)),l.signal.addEventListener("abort",()=>{const{reason:p}=l.signal;d(we(new Qn(Lt(p,new Error(`Xhr-fetch aborted: ${p}`)))))}),(async()=>{let p=null;try{for(;!l.signal.aborted&&(p=await f(p).catch(y=>we(new Qn(Lt(y,new Error(`Xhr-fetch error: ${y}`))))),!p.ok);){const g=await q8(i,m,p.error).catch(()=>null);if(typeof g!="number")break;const A=Math.max(0,g);A&&await new Promise(y=>setTimeout(y,A)),m++}d(p||we(new Qn(new Error("No xhr-fetch result"))))}catch(g){d(we(new Qn(new Error(`Xhr-fetch error: ${g}`))))}})(),c},K8=t=>{try{const{response:e}=t;if(e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||e instanceof ArrayBuffer||e instanceof ReadableStream||typeof e=="string")return e}catch{}return null},j8=t=>{const e={};try{t.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(i=>{const s=i.split(": "),a=s.shift(),o=s.join(": ");a&&(e[a]=o)})}catch{}return e},$8=t=>{try{if(t instanceof Blob||t instanceof FormData||t instanceof URLSearchParams||t instanceof ArrayBuffer||typeof t=="string")return t}catch{}return null},X8=t=>{try{return new Response(K8(t),{headers:j8(t),status:t.status,statusText:t.statusText})}catch{return new Response(null)}},u_=t=>{const{xhr:e}=t,n=e&&e.status!==0?t.underlyingError:H8(t.underlyingError.message);return new Qr(n,e?X8(e):void 0)},J8=async(t,e)=>{const n=await o_(t,e?u_(e):null)||{};return{body:$8(n.body),headers:n.headers,method:n.method,signal:n.signal,withCredentials:n.credentials!=="omit"}},Z8=async(t,e,n)=>await Vp(t,e,u_(n));class Hr extends Error{constructor(e,n,r){super(e),this.message=e,this.code=n,this.response=r}}const ez=t=>!!t&&typeof t=="object"&&typeof t.code=="string"&&typeof t.error=="string"&&Object.keys(t).length===2,Ll=async t=>t.json().then(e=>{if(ez(e)){const n=e.code==="undefined"?"Undefined Error":e.code;return new Hr(e.error,n,t)}return new Hr(t.statusText,`Status: ${t.status} | Data: ${JSON.stringify(e)}`,t)}).catch(e=>new Hr(`Error: ${Lt(e).message}`,`Status: ${t.status}`,t)),zl=t=>t.then($t).catch(e=>{if(e instanceof Response)return Ll(e).then(we);if(e instanceof Error){const n=e.response;return n instanceof Response?Ll(n).then(we):we(new Hr(e.message,`Error: ${e.name}`))}return we(new Hr(`${String(e)}`,"Unexpected Error"))}),tz="http://backend.limewire.localhost".replace(/\/+$/,"");let nz=class{constructor(e={}){this.configuration=e}set config(e){this.configuration=e}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:tz}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||l_}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return typeof e=="function"?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return typeof e=="function"?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}};function l_(t,e=""){return Object.keys(t).map(n=>d_(n,t[n],e)).filter(n=>n.length>0).join("&")}function d_(t,e,n=""){const r=n+(n.length?`[${t}]`:t);if(e instanceof Array){const i=e.map(s=>encodeURIComponent(String(s))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(e instanceof Set){const i=Array.from(e);return d_(t,i,n)}return e instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(e.toISOString())}`:e instanceof Object?l_(e,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(e))}`}const rz=["csrf_invalid"],iz=[403],sz="x-csrf-token",az=async t=>{if(t.ok||!iz.includes(t.status))return!1;const e=await Ll(t.clone());return qp(e)&&e},qp=t=>t instanceof Hr&&rz.includes(t.code),oz=["invalid_access_token","invali
515d_refresh_token"],cz=[401],uz="authorization",lz=async t=>{if(t.ok||!cz.includes(t.status))return!1;const e=await Ll(t.clone());return dz(e)&&e},dz=t=>t instanceof Hr&&oz.includes(t.code),f_={credentials:"include"},fz=[t=>qp(t.underlyingError)],h_=async(t,e,n)=>(typeof t=="function"?await t(e||"",n):t)||{},p_=(t,...e)=>{const{post:n,pre:r,init:i,inspect:s}=t||{},a=[r,...e.map(({pre:l})=>l)],o=[n,...e.map(({post:l})=>l)],c=[i,...e.map(({init:l})=>l)],u=[s,...e.map(({inspect:l})=>l)];return{...t,async pre(l){let d=l;for(const f of a)typeof f=="function"&&(d=await f(d)||d);return d},async post(l,d){let f=l;for(const h of o)typeof h=="function"&&(f=await h(f,d)||f);return f},async init(l,d){let f=d||{};for(const h of c){const m=await h_(h,l,f);f={...f,...m,signal:a_(f.signal,m.signal),headers:Ul(f.headers,m.headers)}}return f},async inspect(l,d){let f=$t(l);for(const h of u)if(typeof h=="function"){if(!f.ok)break;f=await h(f.value,d)||f}return f}}},hz=(t,e,...n)=>{const{retry:r,timeout:i,authFetcher:s,csrfFetcher:a}=e,{init:o,inspect:c}=p_({basePath:"",...e},...n);return{timeout:i,retry:(u,l)=>{if(!r)return;const{response:d}=l,f=!!fz.some(h=>h(l));if(!(Gp(d)&&!f))return Vp(r,u,l)},init:async u=>{const l=await o(t),d=s&&await s.getAuthToken(),f=a&&(qp(u==null?void 0:u.underlyingError)?await a.getFetchedCsrfToken():await a.getCsrfToken()||await a.getFetchedCsrfToken());return{...f_,...l,headers:Ul(l.headers,!!d&&{[uz]:`Bearer ${d}`},!!f&&{[sz]:f})}},inspect:async(u,l)=>{const d=await c(u,l);if(!d.ok)return we(d.error);const{value:f}=d;if(f.status>=200&&f.status<300)return d;const h=s&&await lz(f);if(h)return await s.invalidateAuthToken({response:f,error:h}),we(new Qr(h,f));const m=a&&await az(f);return m?(await a.invalidateCsrfToken({response:f,error:m}),we(new Qr(m,f))):we(new Qr(new Error(`Response returned an error code: ${f.status}`),f))}}},Yp=(t,e,...n)=>{const{basePath:r}=e,{pre:i,post:s}=p_(e,...n),a=new nz({basePath:r,async fetchApi(c,u){const l=await i(c);let d=new Request(l);const f=await Q8(l,hz(l,{...e,init:u},{init:f_},e,{init(m,p){d=new Request(m,p||{})}})),h=await s(f,d);if(!h.ok){const{response:m}=h.error;if(m)return m;throw h.error}return h.value}});return new t(a)},pz="http://backend.limewire.localhost".replace(/\/+$/,"");class mz{constructor(e={}){this.configuration=e}set config(e){this.configuration=e}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:pz}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||m_}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return typeof e=="function"?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return typeof e=="function"?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const gz=new mz,pf=class pf{constructor(e=gz){this.configuration=e,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const a of this.middleware)a.pre&&(i=await a.pre({fetch:this.fetchApi,...i})||i);let s;try{s=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(a){for(const o of this.middleware)o.onError&&(s=await o.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:a,response:s?s.clone():void 0})||s);if(s===void 0)throw a instanceof Error?new bz(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(s=await a.post({fetch:this.fetchApi,url:i.url,init:i.init,response:s.clone()})||s);return s},this.middleware=e.middleware}withMiddleware(...e){const n=this.clone();return n.middleware=n.middleware.concat(...e),n}withPreMiddleware(...e){const n=e.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...e){const n=e.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(e){return e?pf.jsonRegex.test(e):!1}async request(e,n){const{url:r,init:i}=await this.createFetchParams(e,n),s=await this.fetchApi(r,i);if(s&&s.status>=200&&s.status<300)return s;throw new wz(s,"Response returned an error code")}async createFetchParams(e,n){let r=this.configuration.basePath+e.path;e.query!==void 0&&Object.keys(e.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(e.query));const i=Object.assign({},this.configuration.headers,e.headers);
515Object.keys(i).forEach(l=>i[l]===void 0?delete i[l]:{});const s=typeof n=="function"?n:async()=>n,a={method:e.method,headers:i,body:e.body,credentials:this.configuration.credentials},o={...a,...await s({init:a,context:e})};let c;yz(o.body)||o.body instanceof URLSearchParams||Az(o.body)?c=o.body:this.isJsonMime(i["Content-Type"])?c=JSON.stringify(o.body):c=o.body;const u={...o,body:c};return{url:r,init:u}}clone(){const e=this.constructor,n=new e(this.configuration);return n.middleware=this.middleware.slice(),n}};pf.jsonRegex=new RegExp("^(:?application/json|[^;/ 	]+/[^;/ 	]+[+]json)[ 	]*(:?;.*)?$","i");let Ql=pf;function Az(t){return typeof Blob<"u"&&t instanceof Blob}function yz(t){return typeof FormData<"u"&&t instanceof FormData}class wz extends Error{constructor(e,n){super(n),this.response=e,this.name="ResponseError"}}class bz extends Error{constructor(e,n){super(n),this.cause=e,this.name="FetchError"}}class Wr extends Error{constructor(e,n){super(n),this.field=e,this.name="RequiredError"}}function m_(t,e=""){return Object.keys(t).map(n=>g_(n,t[n],e)).filter(n=>n.length>0).join("&")}function g_(t,e,n=""){const r=n+(n.length?`[${t}]`:t);if(e instanceof Array){const i=e.map(s=>encodeURIComponent(String(s))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(e instanceof Set){const i=Array.from(e);return g_(t,i,n)}return e instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(e.toISOString())}`:e instanceof Object?m_(e,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(e))}`}class va{constructor(e,n=r=>r){this.raw=e,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class A_{constructor(e){this.raw=e}async value(){}}function Ez(t){return t==null?t:{encryptedPrivateKey:t.encryptedPrivateKey,encryptedByKeyType:t.encryptedByKeyType,encryptedByKeyId:t.encryptedByKeyId}}function Sz(t){return _z(t)}function _z(t,e){return t==null?t:{eTag:t.ETag,partNumber:t.PartNumber,size:t.Size==null?void 0:t.Size}}function Tz(t){return t==null?t:{ETag:t.eTag,PartNumber:t.partNumber,Size:t.size}}function kz(t){return Iz(t)}function Iz(t,e){return t==null?t:{method:t.method,url:t.url}}function LY(t){return t}function zY(t){return t}function Kp(t){return t==null?t:{time:t.time,increment:t.increment}}function Cz(t){return t==null?t:{parts:t.parts.map(Tz)}}function xz(t){return vz(t)}function vz(t,e){return t==null?t:{resultS3Url:t.resultS3Url}}function QY(t){return t}function HY(t){return t}function Bz(t){return t==null?t:{id:t.id,mediaType:t.mediaType,type:t.type}}function WY(t){return t}function VY(t){return t}function y_(t){return t==null?t:{id:t.id,originalSharingBucketId:t.originalSharingBucketId,s3Status:t.s3Status,itemType:t.itemType,mediaType:t.mediaType,size:t.size,nameEncrypted:t.nameEncrypted,sha1Encrypted:t.sha1Encrypted,baseFileEncryptionKeyId:t.baseFileEncryptionKeyId,ephemeralPublicKey:t.ephemeralPublicKey,metadata:t.metadata,previews:t.previews==null?void 0:t.previews.map(Bz),nsfw:t.nsfw,createdDate:t.createdDate.toISOString(),lastModifiedTimestamp:Kp(t.lastModifiedTimestamp),deleted:t.deleted}}function Pz(t){return Rz(t)}function Rz(t,e){return t==null?t:{uploadId:t.uploadId,key:t.key}}function Fz(t){return Mz(t)}function Mz(t,e){return t==null?t:{method:t.method,url:t.url,resultS3Url:t.resultS3Url}}function Dz(t){return t==null?t:{id:t.id,ownerId:t.ownerId,clientDeviceId:t.clientDeviceId,ownerNick:t.ownerNick,sharingStatus:t.sharingStatus,sharingPermission:t.sharingPermission,sharingId:t.sharingId,primaryEncryptionKeyId:t.primaryEncryptionKeyId,contentItemIds:t.contentItemIds,totalFileSize:t.totalFileSize,name:t.name,createdDate:t.createdDate.toISOString(),lastModifiedTimestamp:Kp(t.lastModifiedTimestamp),deleted:t.deleted,expiresAt:t.expiresAt==null?null:t.expiresAt.toISOString(),downloadCounter:t.downloadCounter,publicDownloadCounter:t.publicDownloadCounter,pinned:t.pinned}}function Oz(t){return t==null?t:{id:t.id,publicKey:t.publicKey,privateKeys:t.privateKeys.map(Ez),encryptedPassphrase:t.encryptedPassphrase,passphraseWrappedPrivateKey:t.passphraseWrappedPrivateKey,deleted:t.deleted,createdDate:t.createdDate.toISOString(),lastModifiedTimestamp:Kp(t.lastModifiedTimestamp)}}function w_(t){return t==null?t:{sharingBucket:Dz(t.sharingBucket),contentItem:y_(t.contentItem),fileEncryptionKey:Oz(t.fileEncryptionKey),metadataId:t.metadataId}}function Nz(t){return t==null?t:{logEventType:t.logEventType,sharingBucketId:t.sharingBucketId,startedAt:t.startedAt.toISOString(),finishedAt:t.finishedAt.toISOString(),size:t.size}}function Uz(t){return t==null?t:{sharingBucketId:t.sharingBucketId,contentItem:y_(t.contentItem)}}function Lz(t){return zz(t)}function zz(t,e){return t==null?t:{sharingBucketId:t.sharingBucketId,contentItemId:t.contentItemId}}function Qz(t){return Hz(t)}function Hz(t,e){return t==null?t:{parts:t.parts.map(Sz)}}function Wz(t){return t==null?t:{logEventType:t.logEventType,sharingBucketId:t.sharingBucketId,startedAt:t.startedAt.toISOString(),finishedAt:t.finishedAt.toISOString(),size:t.size}}function Vz(t){if(t==null)return t;switch(t.logEventType){case"DownloadLogEvent":return Nz(t);case"UploadLogEvent":return Wz(t);default:throw new Error(`No variant of LogEventRequestInner exists with 'logEventType=${t.logEventType}'`)}}class Gz extends Ql{async logEventRaw(e,n){const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/logs",method:"POST",headers:i,query:r,body:e.logEventRequestInner.map(Vz)},n);return new A_(s)}async logEvent(e={},n){await this.logEventRaw(e,n)}}class b_ extends Ql{async abortUploadRaw(e,n){if(e.uploadId==null)throw new Wr("uploadId",'Required parameter "uploadId" was null or undefined when calling abortUpload().');
515if(e.key==null)throw new Wr("key",'Required parameter "key" was null or undefined when calling abortUpload().');const r={};e.key!=null&&(r.key=e.key);const i={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload/s3/multipart/{uploadId}".replace("{uploadId}",encodeURIComponent(String(e.uploadId))),method:"DELETE",headers:i,query:r},n);return new A_(s)}async abortUpload(e,n){await this.abortUploadRaw(e,n)}async completeMultipartUploadRaw(e,n){if(e.uploadId==null)throw new Wr("uploadId",'Required parameter "uploadId" was null or undefined when calling completeMultipartUpload().');if(e.key==null)throw new Wr("key",'Required parameter "key" was null or undefined when calling completeMultipartUpload().');const r={};e.key!=null&&(r.key=e.key);const i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload/s3/multipart/{uploadId}/complete".replace("{uploadId}",encodeURIComponent(String(e.uploadId))),method:"POST",headers:i,query:r,body:Cz(e.completeMultipartUploadRequest)},n);return new va(s,a=>xz(a))}async completeMultipartUpload(e,n){return await(await this.completeMultipartUploadRaw(e,n)).value()}async createMultipartFileUploadRaw(e,n){const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload/s3/multipart",method:"POST",headers:i,query:r,body:w_(e.createUploadRequest)},n);return new va(s,a=>Pz(a))}async createMultipartFileUpload(e={},n){return await(await this.createMultipartFileUploadRaw(e,n)).value()}async createSingleFileUploadRaw(e,n){const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload/s3/single",method:"POST",headers:i,query:r,body:w_(e.createUploadRequest)},n);return new va(s,a=>Fz(a))}async createSingleFileUpload(e={},n){return await(await this.createSingleFileUploadRaw(e,n)).value()}async finishContentItemRaw(e,n){const r={},i={};if(i["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload",method:"POST",headers:i,query:r,body:Uz(e.finishUploadRequest)},n);return new va(s,a=>Lz(a))}async finishContentItem(e={},n){return await(await this.finishContentItemRaw(e,n)).value()}async listPartsRaw(e,n){if(e.uploadId==null)throw new Wr("uploadId",'Required parameter "uploadId" was null or undefined when calling listParts().');if(e.key==null)throw new Wr("key",'Required parameter "key" was null or undefined when calling listParts().');const r={};e.key!=null&&(r.key=e.key);const i={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload/s3/multipart/{uploadId}".replace("{uploadId}",encodeURIComponent(String(e.uploadId))),method:"GET",headers:i,query:r},n);return new va(s,a=>Qz(a))}async listParts(e,n){return await(await this.listPartsRaw(e,n)).value()}async signPartRaw(e,n){if(e.uploadId==null)throw new Wr("uploadId",'Required parameter "uploadId" was null or undefined when calling signPart().');if(e.key==null)throw new Wr("key",'Required parameter "key" was null or undefined when calling signPart().');if(e.partNumber==null)throw new Wr("partNumber",'Required parameter "partNumber" was null or undefined when calling signPart().');const r={};e.key!=null&&(r.key=e.key);const i={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,o=await a("jwt",[]);o&&(i.Authorization=`Bearer ${o}`)}const s=await this.request({path:"/sharing/upload/s3/multipart/{uploadId}/{partNumber}".replace("{uploadId}",encodeURIComponent(String(e.uploadId))).replace("{partNumber}",encodeURIComponent(String(e.partNumber))),method:"GET",headers:i,query:r},n);return new va(s,a=>kz(a))}async signPart(e,n){return await(await this.signPartRaw(e,n)).value(
515)}}const At=4294967295,je=65535,Ar=255,jp=8,$p=9,E_=0,S_=99,__=67324752,Xp=134695760,T_=Xp,Jp=33639248,k_=101010256,Zp=101075792,I_=117853008,Vr=22,rc=20,ic=56,qz=Vr+rc+ic,C_=12,x_=20,Hl=4,em=1,v_=39169,B_=10,P_=1,tm=21589,Yz=28789,Kz=25461,R_=6534,F_=30837,M_=30805,nm=1,jz=6,$z=2,Xz=4,Jz=6,rm=8,im=2048,Wl=16,sm=1,am=2,om=4,cm=32,D_=61440,sc=16384,ac=73,Vl=420,Gl=2048,ql=1024,Yl=512,Zz=20,O_=45,N_=51,Kl="/",ys=30,um=10,Ba=14,Pa=18,U_=new Date(2107,11,31),L_=new Date(1980,0,1),te=void 0,oc=1/0,xi="undefined",vi="function",e6="object",t6=64;let z_=2;try{typeof navigator!=xi&&navigator.hardwareConcurrency&&(z_=navigator.hardwareConcurrency)}catch{}const n6={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:64*1024,maxWorkers:z_,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=xi&&CompressionStream,DecompressionStream:typeof DecompressionStream!=xi&&DecompressionStream},Q_=Object.assign({},n6);function H_(){return Q_}function W_(t){return Math.max(t.chunkSize,t6)}function jl(t){const{baseURI:e,chunkSize:n,maxWorkers:r,terminateWorkerTimeout:i,useCompressionStream:s,useWebWorkers:a,CompressionStream:o,DecompressionStream:c,CompressionStreamZlib:u,DecompressionStreamZlib:l,workerURI:d,wasmURI:f}=t;Hn("baseURI",e),Hn("wasmURI",f),Hn("workerURI",d),Hn("chunkSize",n),Hn("maxWorkers",r),Hn("terminateWorkerTimeout",i),Hn("useCompressionStream",s),Hn("useWebWorkers",a),Hn("CompressionStream",o),Hn("DecompressionStream",c),Hn("CompressionStreamZlib",u),Hn("DecompressionStreamZlib",l)}function Hn(t,e){e!==te&&(Q_[t]=e)}function r6(t){const e=
vendor: 17,348 bytes, lines 515-516
515`(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:i,Uint32Array:c,Int32Array:a,Map:h,DataView:f,Promise:l,TextEncoder:u,crypto:w,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:S}=self,b=void 0,v="undefined",k="function",z=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;z[t]=e}class C{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,s=0|t.length;s>n;n++)e=e>>>8^z[255&(e^t[n])];this.t=e}get(){return~this.t}}class A extends d{constructor(){let t;const e=new C;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new f(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}const x={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=x.o(n);return 32===s?t.concat(e):x.i(e,s,0|n,t.slice(0,t.length-1))},h(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+x.o(n)},l(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=x.u(e,t[n-1]&2147483648>>e-1,1)),t},u:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>s.round(t/1099511627776)||32,i(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=x.o(r);return s.push(x.u(e+o&31,e+o>32?n:s.pop(),1)),s}},I={bytes:{p(t){const e=x.h(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(x.u(8*(3&n),s)),e}}},R=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.v=[1518500249,1859775393,2400959708,3395469782],t?(e.k=t.k.slice(0),e.C=t.C.slice(0),e.A=t.A):e.reset()}reset(){const t=this;return t.k=t.S.slice(0),t.C=[],t.A=0,t}update(t){const e=this;"string"==typeof t&&(t=I.I.m(t));const n=e.C=x.concat(e.C,t),s=e.A,o=e.A=s+x.h(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new c(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}P(){const t=this;let e=t.C;const n=t.k;e=x.concat(e,[x.u(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.A/4294967296)),e.push(0|t.A);e.length;)t.R(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}V(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.k,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let i=r[0],c=r[1],a=r[2],h=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.V(5,i)+n.U(t,c,a,h)+f+o[t]+n.v[s.floor(t/20)]|0;f=h,h=a,a=n.V(30,c),c=i,i=e}r[0]=r[0]+i|0,r[1]=r[1]+c|0,r[2]=r[2]+a|0,r[3]=r[3]+h|0,r[4]=r[4]+f|0}},P={getRandomValues(t){const e=new c(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,o=0;o<t.length;o+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[o/4]=4294967296*t()|0}return t}},U={importKey:t=>new U.M(I.bytes.m(t)),_(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let i,c,a,h,l;const u=new ArrayBuffer(o),w=new f(u);let p=0;const d=x;for(e=I.bytes.m(e),l=1;(o||1)>p;l++){for(i=c=t.encrypt(d.concat(e,[l])),a=1;n>a;a++)for(c=t.encrypt(c),h=0;h<c.length;h++)i[h]^=c[h];for(a=0;(o||1)>p&&a<i.length;a++)w.setInt32(p,i[a]),p+=4}return u.slice(0,s/8)},M:class{constructor(t){const e=this,n=e.B=R,s=[[],[]];e.D=[new n,new n];const r=e.D[0].blockSize/32;t.length>r&&(t=(new n).update(t).P());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.D[0].update(s[0]),e.D[1].update(s[1]),e.W=new n(e.D[0])}reset(){const t=this;t.W=new t.B(t.D[0]),t.K=!1}update(t){this.K=!0,this.W.update(t)}digest(){const t=this,e=t.W.P(),n=new t.B(t.D[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.K)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},V=typeof w!=v&&typeof w.getRandomValues==k,M="Invalid password",_="Invalid signature",B="zipjs-abort-check-password";function D(t){return V?w.getRandomValues(t):P.getRandomValues(t)}const W=16,K={name:"PBKDF2"},E=e.assign({hash:{name:"HMAC"}},K),L=e.assign({iterations:1e3,hash:{name:"SHA-1"}},K),O=["deriveBits"],T=[8,12,16],j=[16,24,32],H=10,Z=[0,0,0,0],F=typeof w!=v,N=F&&w.subtle,q=F&&typeof N!=v,G=I.bytes,J=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.O();const n=e.L[0][4],s=e.L[1],o=t.length;let i,c,a,h=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.v=[c=t.slice(0),a=[]],i=o;4*o+28>i;i++){let t=c[i-1];(i%o===0||8===o&&i%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],i%o===0&&(t=t<<8^t>>>24^h<<24,h=h<<1^283*(h>>7))),c[i]=c[i-o]^t}for(let t=0;i;t++,i--){const e=c[3&t?i:i-4];a[t]=4>=i||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.T(t,0)}decrypt(t){return this.T(t,1)}O(){const t=this.L[0],e=this.L[1],n=t[4],s=e[4],r=[],o=[];let i,c,a,h;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let f=i=0;!n[f];f^=c||1,i=o[i]||1){let o=i^i<<1^i<<2^i<<3^i<<4;o=o>>8^255&o^99,n[f]=o,s[o]=f,h=r[a=r[c=r[f]]];let l=16843009*h^65537*a^257*c^16843008*f,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=u=u<<24^u>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}T(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.v[e],s=n.length/4-2,o=[0,0,0,0],i=this.L[e],c=i[0],a=i[1],h=i[2],f=i[3],l=i[4];let u,w,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],S=4;for(let t=0;s>t;t++)u=c[d>>>24]^a[y>>16&255]^h[m>>8&255]^f[255&g]^n[S],w=c[y>>>24]^a[m>>16&255]^h[g>>8&255]^f[255&d]^n[S+1],p=c[m>>>24]^a[g>>16&255]^h[d>>8&255]^f[255&y]^n[S+2],g=c[g>>>24]^a[d>>16&255]^h[y>>8&255]^f[255&m]^n[S+3],S+=4,d=u,y=w,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&g]^n[S++],u=d,d=y,y=m,m=g,g=u;return o}},Q=class{constructor(t,e){this.j=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.j,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=x.h(e);for(let r=0;s>r;r+=4){this.q(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return x.l(e,r)}},X=U.M;let Y=F&&q&&typeof N.importKey==k,$=F&&q&&typeof N.deriveBits==k;class tt extends d{constructor({password:t,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:c}){super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),signed:s,J:i-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:i,G:a,ready:h}=n;s?(await(async(t,e,n,s)=>{const o=await st(t,e,n,it(s,0,T[e])),i=it(s,T[e]);if(o[0]!=i[0]||o[1]!=i[1])throw new r(M)})(n,i,s,it(t,0,T[i]+2)),t=it(t,T[i]+2),c?e.error(new r(B)):a()):await h;const f=new o(t.length-H-(t.length-H)%W);e.enqueue(nt(n,t,f,0,H,!0))},async flush(t){const{signed:e,X:n,Y:s,pending:i,ready:c}=this;if(s&&n){await c;const a=it(i,0,i.length-H),h=it(i,i.length-H);let f=new o;if(a.length){const t=at(G,a);s.update(t);const e=n.update(t);f=ct(G,e)}if(e){const t=it(ct(G,s.digest()),0,H);for(let e=0;H>e;e++)if(t[e]!=h[e])throw new r(_)}t.enqueue(f)}}})}}class et extends d{constructor({password:t,rawPassword:n,encryptionStrength:s}){let r;super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),J:s-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:r,G:i,ready:c}=n;let a=new o;s?(a=await(async(t,e,n)=>{const s=D(new o(T[e]));return ot(s,await st(t,e,n,s))})(n,r,s),i()):await c;const h=new o(a.length+t.length-t.length%W);h.set(a,0),e.enqueue(nt(n,t,h,a.length,0))},async flush(t){const{X:e,Y:n,pending:s,ready:i}=this;if(n&&e){await i;let c=new o;if(s.length){const t=e.update(at(G,s));n.update(t),c=ct(G,t)}r.signature=ct(G,n.digest()).slice(0,H),t.enqueue(ot(c,r.signature))}}}),r=this}}function nt(t,e,n,s,r,i){const{X:c,Y:a,pending:h}=t,f=e.length-r;let l;for(h.length&&(e=ot(h,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,f-f%W)),l=0;f-W>=l;l+=W){const t=at(G,it(e,l,l+W));i&&a.update(t);const r=c.update(t);i||a.update(r),n.set(ct(G,r),l+s)}return t.pending=it(e,l),n}async function st(n,s,r,i){n.password=null;const c=await(async(t,e,n,s,r)=>{if(!Y)return U.importKey(e);try{return await N.importKey("raw",e,n,!1,r)}catch{return Y=!1,U.importKey(e)}})(0,r,E,0,O),a=await(async(t,e,n)=>{if(!$)return U._(e,t.salt,L.iterations,n);try{return await N.deriveBits(t,e,n)}catch{return $=!1,U._(e,t.salt,L.iterations,n)}})(e.assign({salt:i},L),c,8*(2*j[s]+2)),h=new o(a),f=at(G,it(h,0,j[s])),l=at(G,it(h,j[s],2*j[s])),u=it(h,2*j[s]);return e.assign(n,{keys:{key:f,$:l,passwordVerification:u},X:new Q(new J(f),t.from(Z)),Y:new X(l)}),u}function rt(t,e){return e===b?(t=>{if(typeof u==v){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function ot(t,e){let n=t;return t.length+e.length&&(n=new o(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function it(t,e,n){return t.subarray(e,n)}function ct(t,e){return t.p(e)}function at(t,e){return t.m(e)}class ht extends d{constructor({password:t,passwordVerification:n,checkPasswordOnly:s}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;if(n.password){const e=lt(n,t.subarray(0,12));if(n.password=null,e.at(-1)!=n.passwordVerification)throw new r(M);t=t.subarray(12)}s?e.error(new r(B)):e.enqueue(lt(n,t))}})}}class ft extends d{constructor({password:t,passwordVerification:n}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;let s,r;if(n.password){n.password=null;const e=D(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(ut(n,e),0),r=12}else s=new o(t.length),r=0;s.set(ut(n,t),r),e.enqueue(s)}})}}function lt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,n[s]);return n}function ut(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,e[s]);return n}function wt(t,n){const s=[305419896,591751049,878082192];e.assign(t,{keys:s,tt:new C(s[0]),et:new C(s[2])});for(let e=0;e<n.length;e++)pt(t,n.charCodeAt(e))}function pt(t,e){let[n,r,o]=t.keys;t.tt.append([e]),n=~t.tt.get(),r=mt(s.imul(mt(r+yt(n)),134775813)+1),t.et.append([r>>>24]),o=~t.et.get(),t.keys=[n,r,o]}function dt(t){const e=2|t.keys[2];return yt(s.imul(e,1^e)>>>8)}function yt(t){return 255&t}function mt(t){return 4294967295&t}class gt extends d{constructor(t,{chunkSize:e,nt:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:i,zipCrypto:c,signed:a,level:h}=t,l=this;let u,w,p=super.readable;o&&!c||!a||(u=new A,p=kt(p,u)),r&&(p=vt(p,i,{level:h,chunkSize:e},s,n,s)),o&&(c?p=kt(p,new ft(t)):(w=new et(t),p=kt(p,w))),bt(l,p,()=>{let t;o&&!c&&(t=w.signature),o&&!c||!a||(t=new f(u.value.buffer).getUint32(0)),l.signature=t})}}class St extends d{constructor(t,{chunkSize:e,st:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:i,signed:c,signature:a,compressed:h,useCompressionStream:l,rt:u}=t;let w,p,d=super.readable;i&&(o?d=kt(d,new ht(t)):(p=new tt(t),d=kt(d,p))),h&&(d=vt(d,l,{chunkSize:e,rt:u},s,n,s)),i&&!o||!c||(w=new A,d=kt(d,w)),bt(this,d,()=>{if((!i||o)&&c){const t=new f(w.value.buffer);if(a!=t.getUint32(0,!1))throw new r(_)}})}}function bt(t,n,s){n=kt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function vt(t,e,n,s,r,o){const i=e&&s?s:r||o,c=n.rt?"deflate64-raw":"deflate-raw";try{t=kt(t,new i(c,n))}catch(s){if(!e)throw s;if(r)t=kt(t,new r(c,n));else{if(!o)throw s;t=kt(t,new o(c,n))}}return t}function kt(t,e){return t.pipeThrough(e)}const zt="data",Ct="close";class At extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let i;o.startsWith("deflate")?i=gt:o.startsWith("inflate")&&(i=St),s.outputSize=0;let c=0;const a=new i(t,n),h=super.readable,f=new d({transform(t,e){t&&t.length&&(c+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:c})}}),l=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==b&&s.outputSize>t.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:t}=a;e.assign(s,{signature:t,inputSize:c})}});e.defineProperty(s,"readable",{get:()=>h.pipeThrough(f).pipeThrough(a).pipeThrough(l)})}}class xt extends d{constructor(t){let e;super({transform:function n(s,r){if(e){const t=new o(e.length+s.length);t.set(e),t.set(s,e.length),s=t,e=null}s.length>t?(r.enqueue(s.slice(0,t)),n(s.slice(t),r)):e=s},flush(t){e&&e.length&&t.enqueue(e)}})}}const It=new h,Rt=new h;let Pt,Ut,Vt,Mt,_t,Bt=0;async function Dt(t){try{const{options:e,config:s}=t;if(!e.useCompressionStream)try{await self.initModule(t.config)}catch{e.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},o=t.readable||new y({async pull(t){const e=new l(t=>It.set(Bt,t));Wt({type:"pull",messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},r),i=t.writable||new m({async write(t){let e;const s=new l(t=>e=t);Rt.set(Bt,e),Wt({type:zt,value:t,messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER,await s}},r),c=new At(e,s);Pt=new AbortController;const{signal:a}=Pt;await o.pipeThrough(c).pipeThrough(new xt(s.chunkSize)).pipeTo(i,{signal:a,preventClose:!0,preventAbort:!0}),await i.getWriter().close();const{signature:h,inputSize:f,outputSize:u}=c;Wt({type:Ct,result:{signature:h,inputSize:f,outputSize:u}})}catch(t){t.outputSize=0,Kt(t)}}function Wt(t){let{value:e}=t;if(e)if(e.length)try{e=new o(e),t.value=e.buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t)}function Kt(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:i}=t;p({error:{message:e,stack:n,code:s,name:o,outputSize:i}})}function Et(t,e,n={}){const i="number"==typeof n.level?n.level:-1,c="number"==typeof n.ot?n.ot:65536,a="number"==typeof n.it?n.it:65536;return new d({start(){let n;if(this.ct=Vt(c),this.in=Vt(a),this.it=a,this.ht=new o(c),t?(this.ft=Ut.deflate_process,this.lt=Ut.deflate_last_consumed,this.ut=Ut.deflate_end,this.wt=Ut.deflate_new(),n="gzip"===e?Ut.deflate_init_gzip(this.wt,i):"deflate-raw"===e?Ut.deflate_init_raw(this.wt,i):Ut.deflate_init(this.wt,i)):"deflate64-raw"===e?(this.ft=Ut.inflate9_process,this.lt=Ut.inflate9_last_consumed,this.ut=Ut.inflate9_end,this.wt=Ut.inflate9_new(),n=Ut.inflate9_init_raw(this.wt)):(this.ft=Ut.inflate_process,this.lt=Ut.inflate_last_consumed,this.ut=Ut.inflate_end,this.wt=Ut.inflate_new(),n="deflate-raw"===e?Ut.inflate_init_raw(this.wt):"gzip"===e?Ut.inflate_init_gzip(this.wt):Ut.inflate_init(this.wt)),0!==n)throw new r("init failed:"+n)},transform(e,n){try{const i=e,a=new o(_t.buffer),h=this.ft,f=this.lt,l=this.ct,u=this.ht;let w=0;for(;w<i.length;){const e=s.min(i.length-w,32768);this.in&&this.it>=e||(this.in&&Mt&&Mt(this.in),this.in=Vt(e),this.it=e),a.set(i.subarray(w,w+e),this.in);const o=h(this.wt,this.in,e,l,c,0),p=16777215&o;if(p&&(u.set(a.subarray(l,l+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=f(this.wt);if(0===d)break;w+=d}}catch(t){this.ut&&this.wt&&this.ut(this.wt),this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct),n.error(t)}},flush(e){try{const n=new o(_t.buffer),s=this.ft,i=this.ct,a=this.ht;for(;;){const o=s(this.wt,0,0,i,c,4),h=16777215&o,f=o>>24&255;if(!t){const t=128&f?f-256:f;if(0>t)throw new r("process error:"+t)}if(h&&(a.set(n.subarray(i,i+h),0),e.enqueue(a.slice(0,h))),1===f||0===h)break}}catch(t){e.error(t)}finally{if(this.ut&&this.wt){const t=this.ut(this.wt);0!==t&&e.error(new r("end error:"+t))}this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct)}}})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&Dt(t),e==zt){const t=It.get(n);It.delete(n),t({value:new o(s),done:r})}if("ack"==e){const t=Rt.get(n);Rt.delete(n),t()}e==Ct&&Pt.abort()}catch(t){Kt(t)}});class Lt{constructor(t="deflate",e){return Et(!0,t,e)}}class Ot{constructor(t="deflate",e){return Et(!1,t,e)}}let Tt=!1;self.initModule=async t=>{try{const e=await(async(t,{baseURI:e})=>{if(!Tt){let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(Ut=t,({malloc:Vt,free:Mt,memory:_t}=Ut),"function"!=typeof Vt||"function"!=typeof Mt||!_t)throw Ut=Vt=Mt=_t=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),Tt=!0}})(t.wasmURI,t);return t.nt=Lt,t.st=Ot,e}catch{}}});
516`
516;t({workerURI:n=>{const r="text/javascript";if(n){const i=new Blob([e],{type:r});return URL.createObjectURL(i)}return"data:"+r+","+encodeURIComponent(e)}})}const V_=[];for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e&1?e=e>>>1^3988292384:e=e>>>1;V_[t]=e}class $l{constructor(e){this.crc=e||-1}append(e){let n=this.crc|0;for(let r=0,i=e.length|0;r<i;r++)n=n>>>8^V_[(n^e[r])&255];this.crc=n}get(){return~this.crc}}class G_ extends TransformStream{constructor(){let e;const n=new $l;super({transform(r,i){n.append(r),i.enqueue(r)},flush(){const r=new Uint8Array(4);new DataView(r.buffer).setUint32(0,n.get()),e.value=r}}),e=this}}function Xl(t){if(typeof TextEncoder==xi){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}else return new TextEncoder().encode(t)}const fn={concat(t,e){if(t.length===0||e.length===0)return t.concat(e);const n=t[t.length-1],r=fn.getPartial(n);return r===32?t.concat(e):fn._shiftRight(e,r,n|0,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(e===0)return 0;const n=t[e-1];return(e-1)*32+fn.getPartial(n)},clamp(t,e){if(t.length*32<e)return t;t=t.slice(0,Math.ceil(e/32));const n=t.length;return e=e&31,n>0&&e&&(t[n-1]=fn.partial(e,t[n-1]&2147483648>>e-1,1)),t},partial(t,e,n){return t===32?e:(n?e|0:e<<32-t)+t*1099511627776},getPartial(t){return Math.round(t/1099511627776)||32},_shiftRight(t,e,n,r){for(r===void 0&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(e===0)return r.concat(t);for(let a=0;a<t.length;a++)r.push(n|t[a]>>>e),n=t[a]<<32-e;const i=t.length?t[t.length-1]:0,s=fn.getPartial(i);return r.push(fn.partial(e+s&31,e+s>32?n:r.pop(),1)),r}},Jl={bytes:{fromBits(t){const n=fn.bitLength(t)/8,r=new Uint8Array(n);let i;for(let s=0;s<n;s++)(s&3)===0&&(i=t[s/4]),r[s]=i>>>24,i<<=8;return r},toBits(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],(n&3)===3&&(e.push(r),r=0);return n&3&&e.push(fn.partial(8*(n&3),r)),e}}},q_={};q_.sha1=class{constructor(t){const e=this;e.blockSize=512,e._init=[1732584193,4023233417,2562383102,271733878,3285377520],e._key=[1518500249,1859775393,2400959708,3395469782],t?(e._h=t._h.slice(0),e._buffer=t._buffer.slice(0),e._length=t._length):e.reset()}reset(){const t=this;return t._h=t._init.slice(0),t._buffer=[],t._length=0,t}update(t){const e=this;typeof t=="string"&&(t=Jl.utf8String.toBits(t));const n=e._buffer=fn.concat(e._buffer,t),r=e._length,i=e._length=r+fn.bitLength(t);if(i>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const s=new Uint32Array(n);let a=0;for(let o=e.blockSize+r-(e.blockSize+r&e.blockSize-1);o<=i;o+=e.blockSize)e._block(s.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}finalize(){const t=this;let e=t._buffer;const n=t._h;e=fn.concat(e,[fn.partial(1,1)]);for(let r=e.length+2;r&15;r++)e.push(0);for(e.push(Math.floor(t._length/4294967296)),e.push(t._length|0);e.length;)t._block(e.splice(0,16));return t.reset(),n}_f(t,e,n,r){if(t<=19)return e&n|~e&r;if(t<=39)return e^n^r;if(t<=59)return e&n|e&r|n&r;if(t<=79)return e^n^r}_S(t,e){return e<<t|e>>>32-t}_block(t){const e=this,n=e._h,r=Array(80);for(let u=0;u<16;u++)r[u]=t[u];let i=n[0],s=n[1],a=n[2],o=n[3],c=n[4];for(let u=0;u<=79;u++){u>=16&&(r[u]=e._S(1,r[u-3]^r[u-8]^r[u-14]^r[u-16]));const l=e._S(5,i)+e._f(u,s,a,o)+c+r[u]+e._key[Math.floor(u/20)]|0;c=o,o=a,a=e._S(30,s),s=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+s|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+c|0}};const Y_={};Y_.aes=class{constructor(t){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const n=e._tables[0][4],r=e._tables[1],i=t.length;let s,a,o,c=1;if(i!==4&&i!==6&&i!==8)throw new Error("invalid aes key size");for(e._key=[a=t.slice(0),o=[]],s=i;s<4*i+28;s++){let u=a[s-1];(s%i===0||i===8&&s%i===4)&&(u=n[u>>>24]<<24^n[u>>16&255]<<16^n[u>>8&255]<<8^n[u&255],s%i===0&&(u=u<<8^u>>>24^c<<24,c=c<<1^(c>>7)*283)),a[s]=a[s-i]^u}for(let u=0;s;u++,s--){const l=a[u&3?s:s-4];s<=4||u<4?o[u]=l:o[u]=r[0][n[l>>>24]]^r[1][n[l>>16&255]]^r[2][n[l>>8&255]]^r[3][n[l&255]]}}encrypt(t){return this._crypt(t,0)}decrypt(t){return this._crypt(t,1)}_precompute(){const t=this._tables[0],e=this._tables[1],n=t[4],r=e[4],i=[],s=[];let a,o,c,u;for(let l=0;l<256;l++)s[(i[l]=l<<1^(l>>7)*283)^l]=l;for(let l=a=0;!n[l];l^=o||1,a=s[a]||1){let d=a^a<<1^a<<2^a<<3^a<<4;d=d>>8^d&255^99,n[l]=d,r[d]=l,u=i[c=i[o=i[l]]];let f=u*16843009^c*65537^o*257^l*16843008,h=i[d]*257^d*16843008;for(let m=0;m<4;m++)t[m][l]=h=h<<24^h>>>8,e[m][d]=f=f<<24^f>>>8}for(let l=0;l<5;l++)t[l]=t[l].slice(0),e[l]=e[l].slice(0)}_crypt(t,e){if(t.length!==4)throw new Error("invalid aes block size");const n=this._key[e],r=n.length/4-2,i=[0,0,0,0],s=this._tables[e],a=s[0],o=s[1],c=s[2],u=s[3],l=s[4];let d=t[0]^n[0],f=t[e?3:1]^n[1],h=t[2]^n[2],m=t[e?1:3]^n[3],p=4,g,A,y;for(let w=0;w<r;w++)g=a[d>>>24]^o[f>>16&255]^c[h>>8&255]^u[m&255]^n[p],A=a[f>>>24]^o[h>>16&255]^c[m>>8&255]^u[d&255]^n[p+1],y=a[h>>>24]^o[m>>16&255]^c[d>>8&255]^u[f&255]^n[p+2],m=a[m>>
516>24]^o[d>>16&255]^c[f>>8&255]^u[h&255]^n[p+3],p+=4,d=g,f=A,h=y;for(let w=0;w<4;w++)i[e?3&-w:w]=l[d>>>24]<<24^l[f>>16&255]<<16^l[h>>8&255]<<8^l[m&255]^n[p++],g=d,d=f,f=h,h=m,m=g;return i}};const i6={getRandomValues(t){const e=new Uint32Array(t.buffer),n=r=>{let i=987654321;const s=4294967295;return function(){return i=36969*(i&65535)+(i>>16)&s,r=18e3*(r&65535)+(r>>16)&s,(((i<<16)+r&s)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let r=0,i;r<t.length;r+=4){const s=n((i||Math.random())*4294967296);i=s()*987654071,e[r/4]=s()*4294967296|0}return t}},K_={};K_.ctrGladman=class{constructor(t,e){this._prf=t,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(t){return this.calculate(this._prf,t,this._iv)}incWord(t){if((t>>24&255)===255){let e=t>>16&255,n=t>>8&255,r=t&255;e===255?(e=0,n===255?(n=0,r===255?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}incCounter(t){(t[0]=this.incWord(t[0]))===0&&(t[1]=this.incWord(t[1]))}calculate(t,e,n){let r;if(!(r=e.length))return[];const i=fn.bitLength(e);for(let s=0;s<r;s+=4){this.incCounter(n);const a=t.encrypt(n);e[s]^=a[0],e[s+1]^=a[1],e[s+2]^=a[2],e[s+3]^=a[3]}return fn.clamp(e,i)}};const ws={importKey(t){return new ws.hmacSha1(Jl.bytes.toBits(t))},pbkdf2(t,e,n,r){if(n=n||1e4,r<0||n<0)throw new Error("invalid params to pbkdf2");const i=(r>>5)+1<<2;let s,a,o,c,u;const l=new ArrayBuffer(i),d=new DataView(l);let f=0;const h=fn;for(e=Jl.bytes.toBits(e),u=1;f<(i||1);u++){for(s=a=t.encrypt(h.concat(e,[u])),o=1;o<n;o++)for(a=t.encrypt(a),c=0;c<a.length;c++)s[c]^=a[c];for(o=0;f<(i||1)&&o<s.length;o++)d.setInt32(f,s[o]),f+=4}return l.slice(0,r/8)}};ws.hmacSha1=class{constructor(t){const e=this,n=e._hash=q_.sha1,r=[[],[]];e._baseHash=[new n,new n];const i=e._baseHash[0].blockSize/32;t.length>i&&(t=new n().update(t).finalize());for(let s=0;s<i;s++)r[0][s]=t[s]^909522486,r[1][s]=t[s]^1549556828;e._baseHash[0].update(r[0]),e._baseHash[1].update(r[1]),e._resultHash=new n(e._baseHash[0])}reset(){const t=this;t._resultHash=new t._hash(t._baseHash[0]),t._updated=!1}update(t){const e=this;e._updated=!0,e._resultHash.update(t)}digest(){const t=this,e=t._resultHash.finalize(),n=new t._hash(t._baseHash[1]).update(e).finalize();return t.reset(),n}encrypt(t){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}};const s6=typeof crypto!=xi&&typeof crypto.getRandomValues==vi,j_="Invalid password",$_="Invalid signature",lm="zipjs-abort-check-password";function X_(t){return s6?crypto.getRandomValues(t):i6.getRandomValues(t)}const Ra=16,a6="raw",J_={name:"PBKDF2"},o6={name:"HMAC"},c6="SHA-1",u6=Object.assign({hash:o6},J_),dm=Object.assign({iterations:1e3,hash:{name:c6}},J_),l6=["deriveBits"],cc=[8,12,16],uc=[16,24,32],Bi=10,d6=[0,0,0,0],Zl=typeof crypto!=xi,lc=Zl&&crypto.subtle,Z_=Zl&&typeof lc!=xi,yr=Jl.bytes,f6=Y_.aes,h6=K_.ctrGladman,p6=ws.hmacSha1;let eT=Zl&&Z_&&typeof lc.importKey==vi,tT=Zl&&Z_&&typeof lc.deriveBits==vi;class m6 extends TransformStream{constructor({password:e,rawPassword:n,signed:r,encryptionStrength:i,checkPasswordOnly:s}){super({start(){Object.assign(this,{ready:new Promise(a=>this.resolveReady=a),password:iT(e,n),signed:r,strength:i-1,pending:new Uint8Array})},async transform(a,o){const c=this,{password:u,strength:l,resolveReady:d,ready:f}=c;u?(await A6(c,l,u,Wn(a,0,cc[l]+2)),a=Wn(a,cc[l]+2),s?o.error(new Error(lm)):d()):await f;const h=new Uint8Array(a.length-Bi-(a.length-Bi)%Ra);o.enqueue(nT(c,a,h,0,Bi,!0))},async flush(a){const{signed:o,ctr:c,hmac:u,pending:l,ready:d}=this;if(u&&c){await d;const f=Wn(l,0,l.length-Bi),h=Wn(l,l.length-Bi);let m=new Uint8Array;
516if(f.length){const p=fc(yr,f);u.update(p);const g=c.update(p);m=dc(yr,g)}if(o){const p=Wn(dc(yr,u.digest()),0,Bi);for(let g=0;g<Bi;g++)if(p[g]!=h[g])throw new Error($_)}a.enqueue(m)}}})}}class g6 extends TransformStream{constructor({password:e,rawPassword:n,encryptionStrength:r}){let i;super({start(){Object.assign(this,{ready:new Promise(s=>this.resolveReady=s),password:iT(e,n),strength:r-1,pending:new Uint8Array})},async transform(s,a){const o=this,{password:c,strength:u,resolveReady:l,ready:d}=o;let f=new Uint8Array;c?(f=await y6(o,u,c),l()):await d;const h=new Uint8Array(f.length+s.length-s.length%Ra);h.set(f,0),a.enqueue(nT(o,s,h,f.length,0))},async flush(s){const{ctr:a,hmac:o,pending:c,ready:u}=this;if(o&&a){await u;let l=new Uint8Array;if(c.length){const d=a.update(fc(yr,c));o.update(d),l=dc(yr,d)}i.signature=dc(yr,o.digest()).slice(0,Bi),s.enqueue(fm(l,i.signature))}}}),i=this}}function nT(t,e,n,r,i,s){const{ctr:a,hmac:o,pending:c}=t,u=e.length-i;c.length&&(e=fm(c,e),n=E6(n,u-u%Ra));let l;for(l=0;l<=u-Ra;l+=Ra){const d=fc(yr,Wn(e,l,l+Ra));s&&o.update(d);const f=a.update(d);s||o.update(f),n.set(dc(yr,f),l+r)}return t.pending=Wn(e,l),n}async function A6(t,e,n,r){const i=await rT(t,e,n,Wn(r,0,cc[e])),s=Wn(r,cc[e]);if(i[0]!=s[0]||i[1]!=s[1])throw new Error(j_)}async function y6(t,e,n){const r=X_(new Uint8Array(cc[e])),i=await rT(t,e,n,r);return fm(r,i)}async function rT(t,e,n,r){t.password=null;const i=await w6(a6,n,u6,!1,l6),s=await b6(Object.assign({salt:r},dm),i,8*(uc[e]*2+2)),a=new Uint8Array(s),o=fc(yr,Wn(a,0,uc[e])),c=fc(yr,Wn(a,uc[e],uc[e]*2)),u=Wn(a,uc[e]*2);return Object.assign(t,{keys:{key:o,authentication:c,passwordVerification:u},ctr:new h6(new f6(o),Array.from(d6)),hmac:new p6(c)}),u}async function w6(t,e,n,r,i){if(eT)try{return await lc.importKey(t,e,n,r,i)}catch{return eT=!1,ws.importKey(e)}else return ws.importKey(e)}async function b6(t,e,n){if(tT)try{return await lc.deriveBits(t,e,n)}catch{return tT=!1,ws.pbkdf2(e,t.salt,dm.iterations,n)}else return ws.pbkdf2(e,t.salt,dm.iterations,n)}function iT(t,e){return e===te?Xl(t):e}function fm(t,e){let n=t;return t.length+e.length&&(n=new Uint8Array(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function E6(t,e){if(e&&e>t.length){const n=t;t=new Uint8Array(e),t.set(n,0)}return t}function Wn(t,e,n){return t.subarray(e,n)}function dc(t,e){return t.fromBits(e)}function fc(t,e){return t.toBits(e)}const hc=12;class S6 extends TransformStream{constructor({password:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){Object.assign(this,{password:e,passwordVerification:n}),oT(this,e)},transform(i,s){const a=this;if(a.password){const o=sT(a,i.subarray(0,hc));if(a.password=null,o.at(-1)!=a.passwordVerification)throw new Error(j_);i=i.subarray(hc)}r?s.error(new Error(lm)):s.enqueue(sT(a,i))}})}}class _6 extends TransformStream{constructor({password:e,passwordVerification:n}){super({start(){Object.assign(this,{password:e,passwordVerification:n}),oT(this,e)},transform(r,i){const s=this;let a,o;if(s.password){s.password=null;const c=X_(new Uint8Array(hc));c[hc-1]=s.passwordVerification,a=new Uint8Array(r.length+c.length),a.set(aT(s,c),0),o=hc}else a=new Uint8Array(r.length),o=0;a.set(aT(s,r),o),i.enqueue(a)}})}}function sT(t,e){const n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=cT(t)^e[r],hm(t,n[r]);return n}function aT(t,e){const n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=cT(t)^e[r],hm(t,e[r]);return n}function oT(t,e){const n=[305419896,591751049,878082192];Object.assign(t,{keys:n,crcKey0:new $l(n[0]),crcKey2:new $l(n[2])});for(let r=0;r<e.length;r++)hm(t,e.charCodeAt(r))}function hm(t,e){let[n,r,i]=t.keys;
516t.crcKey0.append([e]),n=~t.crcKey0.get(),r=lT(Math.imul(lT(r+uT(n)),134775813)+1),t.crcKey2.append([r>>>24]),i=~t.crcKey2.get(),t.keys=[n,r,i]}function cT(t){const e=t.keys[2]|2;return uT(Math.imul(e,e^1)>>>8)}function uT(t){return t&255}function lT(t){return t&4294967295}const dT="Invalid uncompressed size",T6="deflate-raw",k6="deflate64-raw";class I6 extends TransformStream{constructor(e,{chunkSize:n,CompressionStreamZlib:r,CompressionStream:i}){super({});const{compressed:s,encrypted:a,useCompressionStream:o,zipCrypto:c,signed:u,level:l}=e,d=this;let f,h,m=super.readable;(!a||c)&&u&&(f=new G_,m=wr(m,f)),s&&(m=hT(m,o,{level:l,chunkSize:n},i,r,i)),a&&(c?m=wr(m,new _6(e)):(h=new g6(e),m=wr(m,h))),fT(d,m,()=>{let p;a&&!c&&(p=h.signature),(!a||c)&&u&&(p=new DataView(f.value.buffer).getUint32(0)),d.signature=p})}}class C6 extends TransformStream{constructor(e,{chunkSize:n,DecompressionStreamZlib:r,DecompressionStream:i}){super({});const{zipCrypto:s,encrypted:a,signed:o,signature:c,compressed:u,useCompressionStream:l,deflate64:d}=e;let f,h,m=super.readable;a&&(s?m=wr(m,new S6(e)):(h=new m6(e),m=wr(m,h))),u&&(m=hT(m,l,{chunkSize:n,deflate64:d},i,r,i)),(!a||s)&&o&&(f=new G_,m=wr(m,f)),fT(this,m,()=>{if((!a||s)&&o){const p=new DataView(f.value.buffer);if(c!=p.getUint32(0,!1))throw new Error($_)}})}}function fT(t,e,n){e=wr(e,new TransformStream({flush:n})),Object.defineProperty(t,"readable",{get(){return e}})}function hT(t,e,n,r,i,s){const a=e&&r?r:i||s,o=n.deflate64?k6:T6;try{t=wr(t,new a(o,n))}
516catch(c){if(e)if(i)t=wr(t,new i(o,n));else if(s)t=wr(t,new s(o,n));else throw c;else throw c}return t}function wr(t,e){return t.pipeThrough(e)}const x6="message",v6="start",B6="pull",pT="data",P6="ack",mT="close",gT="deflate",AT="inflate";class R6 extends TransformStream{constructor(e,n){super({});const r=this,{codecType:i}=e;let s;i.startsWith(gT)?s=I6:i.startsWith(AT)&&(s=C6),r.outputSize=0;let a=0;const o=new s(e,n),c=super.readable,u=new TransformStream({transform(d,f){d&&d.length&&(a+=d.length,f.enqueue(d))},flush(){Object.assign(r,{inputSize:a})}}),l=new TransformStream({transform(d,f){if(d&&d.length&&(f.enqueue(d),r.outputSize+=d.length,e.outputSize!==te&&r.outputSize>e.outputSize))throw new Error(dT)},flush(){const{signature:d}=o;Object.assign(r,{signature:d,inputSize:a})}});Object.defineProperty(r,"readable",{get(){return c.pipeThrough(u).pipeThrough(o).pipeThrough(l)}})}}class F6 extends TransformStream{constructor(e){let n;super({transform:r,flush(i){n&&n.length&&i.enqueue(n)}});function r(i,s){if(n){const a=new Uint8Array(n.length+i.length);a.set(n),a.set(i,n.length),i=a,n=null}i.length>e?(s.enqueue(i.slice(0,e)),r(i.slice(e),s)):n=i}}}const yT={type:"module"};let ed,pm,wT,mm=!0;try{mm=typeof structuredClone==vi&&structuredClone(new DOMException("","AbortError")).code!==te}catch{}let bT=()=>{};function M6({initModule:t}){bT=t}class gm{constructor(e,{readable:n,writable:r},{options:i,config:s,streamOptions:a,useWebWorkers:o,transferStreams:c,workerURI:u},l){const{signal:d}=a;return Object.assign(e,{busy:!0,readable:n.pipeThrough(new F6(s.chunkSize)).pipeThrough(new D6(a),{signal:d}),writable:r,options:Object.assign({},i),workerURI:u,transferStreams:c,terminate(){return new Promise(f=>{const{worker:h,busy:m}=e;h?(m?e.resolveTerminated=f:(h.terminate(),f()),e.interface=null):f()})},onTaskFinished(){const{resolveTerminated:f}=e;f&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),f()),e.busy=!1,l(e)}}),ed===te&&(ed=typeof Worker!=xi),(o&&ed?O6:ET)(e,s)}}class D6 extends TransformStream{constructor({onstart:e,onprogress:n,size:r,onend:i}){let s=0;super({async start(){e&&await Am(e,r)},async transform(a,o){s+=a.length,n&&await Am(n,s,r),o.enqueue(a)},async flush(){i&&await Am(i,s)}})}}async function Am(t,...e){try{await t(...e)}catch{}}function ET(t,e){return{run:()=>N6(t,e)}}function O6(t,e){const{baseURI:n,chunkSize:r}=e;let{wasmURI:i}=e;if(!t.interface){typeof i==vi&&(i=i());let s;try{s=td(t.workerURI,n,t)}catch{return ed=!1,ET(t,e)}Object.assign(t,{worker:s,interface:{run:()=>U6(t,{chunkSize:r,wasmURI:i,baseURI:n})}})}return t.interface}async function N6({options:t,readable:e,writable:n,onTaskFinished:r},i){let s;try{if(!t.useCompressionStream)try{await bT(i)}catch{t.useCompressionStream=!0}s=new R6(t,i),await e.pipeThrough(s).pipeTo(n,{preventClose:!0,preventAbort:!0});const{signature:a,inputSize:o,outputSize:c}=s;return{signature:a,inputSize:o,outputSize:c}}catch(a){throw s&&(a.outputSize=s.outputSize),a}finally{r()}}async function U6(t,e){let n,r;const i=new Promise((d,f)=>{n=d,r=f});Object.assign(t,{reader:null,writer:null,resolveResult:n,rejectResult:r,result:i});const{readable:s,options:a}=t,{writable:o,closed:c}=L6(t.writable),u=nd({type:v6,options:a,config:e,readable:s,writable:o},t);u||Object.assign(t,{reader:s.getReader(),writer:o.getWriter()});const l=await i;return u||await o.getWriter().close(),await c,l}function L6(t){const{writable:e,readable:n}=new TransformStream,r=n.pipeTo(t,{preventClose:!0});return{writable:e,closed:r}}function td(t,e,n,r,i=!0){let s,a,o;if(pm===te){const c=typeof t==vi;c?a=t(i):a=t;const u=a.startsWith("data:"),l=a.startsWith("blob:");if(u||l){r===te&&(r=!1),r&&(o=yT);try{s=new Worker(a,o)}catch(d){if(l)try{URL.revokeObjectURL(a)}catch{}if(c&&l)return td(t,e,n,r,!1);if(r)throw d;return td(t,e,n,!0,!1)}}else{r===te&&(r=!0),r&&(o=yT);try{a=new URL(a,e)}catch{}try{s=new Worker(a,o)}catch(d){if(r)throw d;return td(t,e,n,!1,i)}}pm=a,wT=o}else s=new Worker(pm,wT);return s.addEventListener(x6,c=>z6(c,n)),s}function nd(t,{worker:e,writer:n,onTaskFinished:r,transferStreams:i}
vendor: 4,992 bytes, line 516
516){try{const{value:s,readable:a,writable:o}=t,c=[];if(s&&(t.value=s,c.push(t.value.buffer)),i&&mm?(a&&c.push(a),o&&c.push(o)):t.readable=t.writable=null,c.length)try{return e.postMessage(t,c),!0}catch{mm=!1,t.readable=t.writable=null,e.postMessage(t)}else e.postMessage(t)}catch(s){throw n&&n.releaseLock(),r(),s}}async function z6({data:t},e){const{type:n,value:r,messageId:i,result:s,error:a}=t,{reader:o,writer:c,resolveResult:u,rejectResult:l,onTaskFinished:d}=e;try{if(a){const{message:h,stack:m,code:p,name:g,outputSize:A}=a,y=new Error(h);Object.assign(y,{stack:m,code:p,name:g,outputSize:A}),f(y)}else{if(n==B6){const{value:h,done:m}=await o.read();nd({type:pT,value:h,done:m,messageId:i},e)}n==pT&&(await c.ready,await c.write(new Uint8Array(r)),nd({type:P6,messageId:i},e)),n==mT&&f(null,s)}}catch(h){nd({type:mT,messageId:i},e),f(h)}function f(h,m){h?l(h):u(m),c&&c.releaseLock(),d()}}let bs=[];const ym=[];let ST=0;async function _T(t,e){const{options:n,config:r}=e,{transferStreams:i,useWebWorkers:s,useCompressionStream:a,compressed:o,signed:c,encrypted:u}=n,{workerURI:l,maxWorkers:d}=r;e.transferStreams=i||i===te;const f=!o&&!c&&!u&&!e.transferStreams;return e.useWebWorkers=!f&&(s||s===te&&r.useWebWorkers),e.workerURI=e.useWebWorkers&&l?l:te,n.useCompressionStream=a||a===te&&r.useCompressionStream,(await h()).run();async function h(){const p=bs.find(g=>!g.busy);if(p)return TT(p),new gm(p,t,e,m);if(bs.length<d){const g={indexWorker:ST};return ST++,bs.push(g),new gm(g,t,e,m)}else return new Promise(g=>ym.push({resolve:g,stream:t,workerOptions:e}))}function m(p){if(ym.length){const[{resolve:g,stream:A,workerOptions:y}]=ym.splice(0,1);g(new gm(p,A,y,m))}else p.worker?(TT(p),Q6(p,e)):bs=bs.filter(g=>g!=p)}}function Q6(t,e){const{config:n}=e,{terminateWorkerTimeout:r}=n;Number.isFinite(r)&&r>=0&&(t.terminated?t.terminated=!1:t.terminateTimeout=setTimeout(async()=>{bs=bs.filter(i=>i!=t);try{await t.terminate()}catch{}},r))}function TT(t){const{terminateTimeout:e}=t;e&&(clearTimeout(e),t.terminateTimeout=null)}const H6="Writer iterator completed too soon",W6=64*1024,V6="writable";class kT{constructor(){this.size=0}init(){this.initialized=!0}}let IT=class extends kT{get readable(){const e=this,{chunkSize:n=W6}=e,r=new ReadableStream({start(){this.chunkOffset=0},async pull(i){const{offset:s=0,size:a,diskNumberStart:o}=r,{chunkOffset:c}=this,u=a===te?n:Math.min(n,a-c),l=await Jt(e,s+c,u,o);i.enqueue(l),c+n>a||a===te&&!l.length&&u?i.close():this.chunkOffset+=n}});return r}};class G6 extends IT{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,n){const r=this,i=e+n;let a=await(e||i<r.size?r.blob.slice(e,i):r.blob).arrayBuffer();return a.byteLength>n&&(a=a.slice(e,i)),new Uint8Array(a)}}class q6 extends IT{constructor(e){super(),this.readers=e}async init(){const e=this,{readers:n}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(n.map(async(r,i)=>{await r.init(),i!=n.length-1&&(e.lastDiskOffset+=r.size),e.size+=r.size})),super.init()}async readUint8Array(e,n,r=0){const i=this,{readers:s}=this;let a,o=r;o==-1&&(o=s.length-1);let c=e;for(;s[o]&&c>=s[o].size;)c-=s[o].size,o++;const u=s[o];if(u){const l=u.size;if(c+n<=l)a=await Jt(u,c,n);else{const d=l-c;a=new Uint8Array(n);const f=await Jt(u,c,d);a.set(f,0);const h=await i.readUint8Array(e+d,n-d,r);a.set(h,d),f.length+h.length<n&&(a=a.subarray(0,f.length+h.length))}}else a=new Uint8Array;return i.lastDiskNumber=Math.max(o,i.lastDiskNumber),a}}class CT extends kT{constructor(e,n=4294967295){super();const r=this;Object.assign(r,{diskNumber:0,diskOffset:0,size:0,maxSize:n,availableSize:n});let i,s,a;const o=new WritableStream({async write(l){const{availableSize:d}=r;if(a)l.length>=d?(await c(l.subarray(0,d)),await u(),r.diskOffset+=i.size,r.diskNumber++,a=null,await this.write(l.subarray(d))):await c(l);else{const{value:f,done:h}=await e.next();if(h&&!f)throw new Error(H6);i=f,i.size=0,i.maxSize&&(r.maxSize=i.maxSize),r.availableSize=r.maxSize,await Pi(i),s=f.writable,a=s.getWriter(),await this.write(l)}},async close(){await a.ready,await u()}});Object.defineProperty(r,V6,{get(){return o}});async function c(l){const d=l.length;d&&(await a.ready,await a.write(l),i.size+=d,r.size+=d,r.availableSize-=d)}async function u(){await a.close()}}}class wm{constructor(e){return Array.isArray(e)&&(e=new q6(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class xT{constructor(e){return e.writable===te&&typeof e.next==vi&&(e=new CT(e)),e instanceof WritableStream&&(e={writable:e}),e.size===te&&(e.size=0),e instanceof CT||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:oc,maxSize:oc}),e}}async function Pi(t,e){if(t.init&&!t.initialized)await t.init(e);else return Promise.resolve()}function Jt(t,e,n,r){return t.readUint8Array(e,n,r)}const vT="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}
516~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),Y6=vT.length==256;function K6(t){if(Y6){let e="";for(let n=0;n<t.length;n++)e+=vT[t[n]];return e}else return new TextDecoder().decode(t)}function rd(t,e){return e&&e.trim().toLowerCase()=="cp437"?K6(t):new TextDecoder(e).decode(t)}const BT="filename",PT="rawFilename",bm="comment",RT="rawComment",Em="uncompressedSize",FT="compressedSize",MT="offset",DT="diskNumberStart",id="lastModDate",Sm="rawLastModDate",_m="lastAccessDate",j6="rawLastAccessDate",Tm="creationDate",OT="rawCreationDate",NT="internalFileAttributes",UT="externalFileAttributes",LT="msdosAttributesRaw",zT="msdosAttributes",QT="msDosCompatible",km="zip64",HT="encrypted",WT="version",VT="versionMadeBy",GT="zipCrypto",sd="directory",qT="executable",YT="compressionMethod",KT="signature",jT="extraField",$6="extraFieldInfoZip",X6="extraFieldUnix",$T="uid",XT="gid",JT="unixMode",ZT="setuid",ek="setgid",tk="sticky",J6=[BT,PT,Em,FT,id,Sm,bm,RT,_m,Tm,OT,MT,DT,NT,UT,LT,zT,QT,km,HT,WT,VT,GT,sd,qT,YT,KT,jT,X6,$6,$T,XT,JT,ZT,ek,tk,"bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class ad{constructor(e){J6.forEach(n=>this[n]=e[n])}}const Z6="filenameEncoding",eQ="commentEncoding",tQ="decodeText",nQ="extractPrependedData",rQ="extractAppendedData",nk="password",rk="rawPassword",ik="passThrough",sk="signal",iQ="checkPasswordOnly",sQ="checkOverlappingEntryOnly",aQ="checkOverlappingEntry",oQ="checkSignature",ak="useWebWorkers",ok="useCompressionStream",ck="transferStreams",uk="preventClose",cQ="encryptionStrength",uQ="extendedTimestamp",lQ="keepOrder",dQ="level",fQ="bufferedWrite",hQ="createTempStream",pQ="dataDescriptorSignature",mQ="useUnicodeFileNames",gQ="dataDescriptor",AQ="supportZip64SplitFile",yQ="encodeText",lk="offset",dk="usdz",wQ="unixExtraFieldType",Im="File format is not recognized",bQ="End of central directory not found",EQ="End of Zip64 central directory locator not found",SQ="Central directory header not found",_Q="Local file header not found",TQ="Zip64 extra field not found",kQ="File contains encrypted entry",IQ="Encryption method not supported",fk="Compression method not supported",hk="Split zip file",CQ="Overlapping entry found",pk="utf-8",xQ="UTF8",mk="cp437",vQ=[[Em,At],[FT,At],[MT,At],[DT,je]],BQ={[je]:{getValue:ht,bytes:4},[At]:{getValue:Fa,bytes:8}};class PQ{constructor(e,n={}){Object.assign(this,{reader:new wm(e),options:n,config:H_(),readRanges:[]})}async*getEntriesGenerator(e={}){const n=this;let{reader:r}=n;const{config:i}=n;if(await Pi(r),(r.size===te||!r.readUint8Array)&&(r=new G6(await new Response(r.readable).blob()),await Pi(r)),r.size<Vr)throw new Error(Im);r.chunkSize=W_(i);const s=await UQ(r,k_,r.size,Vr,je*16);if(!s){const x=await Jt(r,0,4),P=pt(x);throw ht(P)==Xp?new Error(hk):new Error(bQ)}const a=pt(s);let o=ht(a,12),c=ht(a,16);const u=s.offset,l=Gt(a,20),d=u+Vr+l;let f=Gt(a,4);const h=r.lastDiskNumber||0;let m=Gt(a,6),p=Gt(a,8),g=0,A=0;if(c==At||o==At||p==je||m==je){const x=await Jt(r,s.offset-rc,rc),P=pt(x);if(ht(P,0)==I_){c=Fa(P,8);let v=await Jt(r,c,ic,-1),M=pt(v);const D=s.offset-rc-ic;if(ht(M,0)!=Zp&&c!=D){const O=c;c=D,c>O&&(g=c-O),v=await Jt(r,c,ic,-1),M=pt(v)}if(ht(M,0)!=Zp)throw new Error(EQ);f==je&&(f=ht(M,16)),m==je&&(m=ht(M,20)),p==je&&(p=Fa(M,32)),o==At&&(o=Fa(M,40)),c-=o}}if(c>=r.size&&(g=r.size-c-o-Vr,c=r.size-o-Vr),h!=f)throw new Error(hk);if(c<0)throw new Error(Im);let y=0,w=await Jt(r,c,o,m),E=pt(w);if(o){const x=s.offset-o;if(ht(E,y)!=Jp&&c!=x){const P=c;c=x,c>P&&(g+=c-P),w=await Jt(r,c,o,m),E=pt(w)}}const S=s.offset-c-(r.lastDiskOffset||0);if(o!=S&&S>=0&&(o=S,w=await Jt(r,c,o,m),E=pt(w)),c<0||c>=r.size)throw new Error(Im);const k=Zt(n,e,Z6),T=Zt(n,e,eQ);for(let x=0;x<p;x++){const P=new RQ(r,i,n.options);if(ht(E,y)!=Jp)throw new Error(SQ);gk(P,E,y+6);const v=!!P.bitFlag.languageEncodingFlag,M=y+46,D=M+P.filenameLength,O=D+P.extraFieldLength,N=Gt(E,y+4),Q=N>>8==0,G=N>>8==3,V=w.subarray(M,D),Z=Gt(E,y+32),B=O+Z,L=w.subarray(O,B),K=v,q=v,ne=ht(E,y+38),fe=ne&Ar,Ae={readOnly:!!(fe&sm),hidden:!!(fe&am),system:!!(fe&om),directory:!!(fe&Wl),archive:!!(fe&cm)},ie=ht(E,y+42)+g,ye=Zt(n,e,tQ)||rd,$e=K?pk:k||mk,ge=q?pk:T||mk;let xe=ye(V,$e);xe===te&&(xe=rd(V,$e));let We=ye(L,ge);We===te&&(We=rd(L,ge)),Object.assign(P,{versionMadeBy:N,msDosCompatible:Q,compressedSize:0,uncompressedSize:0,commentLength:Z,offset:ie,diskNumberStart:Gt(E,y+34),internalFileAttributes:Gt(E,y+36),externalFileAttributes:ne,msdosAttributesRaw:fe,msdosAttributes:Ae,rawFilename:V,filenameUTF8:K,commentUTF8:q,rawExtraField:w.subarray(D,O),rawComment:L,filename:xe,comment:We}),A=Math.max(ie,A),Ak(P,P,E,y+6);const be=P.externalFileAttributes>>16&je;P.unixMode===te&&(be&(Vl|ac|sc))!=0&&(P.unixMode=be);const I=!!(P.unixMode&Gl),H=!!(P.unixMode&ql),F=!!(P.unixMode&Yl),U=P.unixMode!==te?(P.unixMode&ac)!=0:G&&(be&ac)!=0,$=P.unixMode!==te&&(P.unixMode&D_)==sc,z=(be&D_)==sc;Object.assign(P,{setuid:I,setgid:H,sticky:F,unixExternalUpper:be,internalFileAttribute:P.internalFileAttributes,externalFileAttribute:P.externalFileAttributes,executable:U,directory:$||z||Q&&Ae.directory||xe.endsWith(Kl)&&!P.uncompressedSize,zipCrypto:P.encrypted&&!P.extraFieldAES});const X=new ad(P);X.getData=(re,se)=>P.getData(re,X,n.readRanges,se),X.arrayBuffer=async re=>{const se=new TransformStream,[oe]=await Promise.all([new Response(se.readable).arrayBuffer(),P.getData(se,X,n.readRanges,re)]);return oe},y=B;const{onprogress:Y}=e;if(Y)try{await Y(x+1,p,new ad(P))}catch{}yield X}const C=Zt(n,e,nQ),_=Zt(n,e,rQ);return C&&(n.prependedData=A>0?await Jt(r,0,A):new Uint8Array),n.comment=l?await Jt(r,u+Vr,l):new Uint8Array,_&&(n.appendedData=d<r.size?await Jt(r,d,r.size-d):new Uint8Array),!0}async getEntries(e={}){const n=[];for await(const r of this.getEntriesGenerator(e))n.push(r);return n}async close(){}}class RQ{constructor(e,n,r){Object.assign(this,{reader:e,config:n,options:r})}async getData(e,n,r,i={}){const s=this,{reader:a,offset:o,diskNumberStart:c,extraFieldAES:u,extraFieldZip64:l,compressionMethod:d,config:f,bitFlag:h,signature:m,rawLastModDate:p,uncompressedSize:g,compressedSize:A}=s,{dataDescriptor:y}=h,w=n.localDirectory={},E=await Jt(a,o,ys,c),S=pt(E);let k=Zt(s,i,nk),T=Zt(s,i,rk);const C=Zt(s,i,ik);if(k=k&&k.length&&k,T=T&&T.length&&T,u&&u.originalCompressionMethod!=S_)throw new Error(fk);if(d!=E_&&d!=jp&&d!=$p&&!C)throw new Error(fk);if(ht(S,0)!=__)throw new Error(_Q);gk(w,S,4);const{extraFieldLength:_,filenameLength:x,lastAccessDate:P,creationDate:v}=w;w.rawExtraField=_?await Jt(a,o+ys+x,_,c):new Uint8Array,Ak(s,w,S,4,!0),Object.assign(n,{lastAccessDate:P,creationDate:v});const M=s.encrypted&&w.encrypted&&!C,D=M&&!u;if(C||(n.zipCrypto=D),M){if(!D&&u.strength===te)throw new Error(IQ);if(!k&&!T)throw new Error(kQ)}const O=o+ys+x+_,N=A,Q=a.readable;Object.assign(Q,{diskNumberStart:c,offset:O,size:N});const G=Zt(s,i,sk),V=Zt(s,i,iQ);let Z=Zt(s,i,aQ);const B=Zt(s,i,sQ);B&&(Z=!0);const{onstart:L,onprogress:K,onend:q}=i,ne=d==$p;let fe=Zt(s,i,ok);ne&&(fe=!1);
516const Ae={options:{codecType:AT,password:k,rawPassword:T,zipCrypto:D,encryptionStrength:u&&u.strength,signed:Zt(s,i,oQ)&&!C,passwordVerification:D&&(y?p>>>8&Ar:m>>>24&Ar),outputSize:C?A:g,signature:m,compressed:d!=0&&!C,encrypted:s.encrypted&&!C,useWebWorkers:Zt(s,i,ak),useCompressionStream:fe,transferStreams:Zt(s,i,ck),deflate64:ne,checkPasswordOnly:V},config:f,streamOptions:{signal:G,size:N,onstart:L,onprogress:K,onend:q}};Z&&await NQ({reader:a,fileEntry:n,offset:o,diskNumberStart:c,signature:m,compressedSize:A,uncompressedSize:g,dataOffset:O,dataDescriptor:y||w.bitFlag.dataDescriptor,extraFieldZip64:l||w.extraFieldZip64,readRanges:r});let ie;try{if(!B){V&&(e=new WritableStream),e=new xT(e),await Pi(e,C?A:g),{writable:ie}=e;const{outputSize:ye}=await _T({readable:Q,writable:ie},Ae);if(e.size+=ye,ye!=(C?A:g))throw new Error(dT)}}catch(ye){if(ye.outputSize!==te&&(e.size+=ye.outputSize),!V||ye.message!=lm)throw ye}finally{!Zt(s,i,uk)&&ie&&!ie.locked&&await ie.getWriter().close()}return V||B?te:e.getData?e.getData():ie}}function gk(t,e,n){const r=t.rawBitFlag=Gt(e,n+2),i=(r&nm)==nm,s=ht(e,n+6);Object.assign(t,{encrypted:i,version:Gt(e,n),bitFlag:{level:(r&jz)>>1,dataDescriptor:(r&rm)==rm,languageEncodingFlag:(r&im)==im},rawLastModDate:s,lastModDate:LQ(s),filenameLength:Gt(e,n+22),extraFieldLength:Gt(e,n+24)})}function Ak(t,e,n,r,i){const{rawExtraField:s}=e,a=e.extraField=new Map,o=pt(new Uint8Array(s));let c=0;try{for(;c<s.length;){const y=Gt(o,c),w=Gt(o,c+2);a.set(y,{type:y,data:s.slice(c+4,c+4+w)}),c+=4+w}}catch{}const u=Gt(n,r+4);Object.assign(e,{signature:ht(n,r+um),compressedSize:ht(n,r+Ba),uncompressedSize:ht(n,r+Pa)});const l=a.get(em);l&&(FQ(l,e),e.extraFieldZip64=l);const d=a.get(Yz);d&&(yk(d,BT,PT,e,t),e.extraFieldUnicodePath=d);const f=a.get(Kz);f&&(yk(f,bm,RT,e,t),e.extraFieldUnicodeComment=f);const h=a.get(v_);h?(MQ(h,e,u),e.extraFieldAES=h):e.compressionMethod=u;const m=a.get(B_);m&&(DQ(m,e),e.extraFieldNTFS=m);const p=a.get(M_);if(p)wk(p,e,!1),e.extraFieldUnix=p;else{const y=a.get(F_);y&&(wk(y,e,!0),e.extraFieldInfoZip=y)}const g=a.get(tm);g&&(OQ(g,e,i),e.extraFieldExtendedTimestamp=g);const A=a.get(R_);A&&(e.extraFieldUSDZ=A)}function FQ(t,e){e.zip64=!0;const n=pt(t.data),r=vQ.filter(([i,s])=>e[i]==s);for(let i=0,s=0;i<r.length;i++){const[a,o]=r[i];if(e[a]==o){const c=BQ[o];e[a]=t[a]=c.getValue(n,s),s+=c.bytes}else if(t[a])throw new Error(TQ)}}function yk(t,e,n,r,i){const s=pt(t.data),a=new $l;a.append(i[n]);const o=pt(new Uint8Array(4));o.setUint32(0,a.get(),!0);const c=ht(s,1);Object.assign(t,{version:Ri(s,0),[e]:rd(t.data.subarray(5)),valid:!i.bitFlag.languageEncodingFlag&&c==ht(o,0)}),t.valid&&(r[e]=t[e],r[e+xQ]=!0)}function MQ(t,e,n){const r=pt(t.data),i=Ri(r,4);Object.assign(t,{vendorVersion:Ri(r,0),vendorId:Ri(r,2),strength:i,originalCompressionMethod:n,compressionMethod:Gt(r,5)}),e.compressionMethod=t.compressionMethod}function DQ(t,e){const n=pt(t.data);let r=4,i;try{for(;r<t.data.length&&!i;){const s=Gt(n,r),a=Gt(n,r+2);s==P_&&(i=t.data.slice(r+4,r+4+a)),r+=4+a}}catch{}try{if(i&&i.length==24){const s=pt(i),a=s.getBigUint64(0,!0),o=s.getBigUint64(8,!0),c=s.getBigUint64(16,!0);Object.assign(t,{rawLastModDate:a,rawLastAccessDate:o,rawCreationDate:c});const u=Cm(a),l=Cm(o),d=Cm(c),f={lastModDate:u,lastAccessDate:l,creationDate:d};Object.assign(t,f),Object.assign(e,f)}}catch{}}function wk(t,e,n){try{const r=pt(new Uint8Array(t.data));let i=0;const s=Ri(r,i++),a=Ri(r,i++),o=t.data.subarray(i,i+a);i+=a;const c=bk(o),u=Ri(r,i++),l=t.data.subarray(i,i+u);i+=u;const d=bk(l);let f=te;if(!n&&i+2<=t.data.length){const h=t.data;f=new DataView(h.buffer,h.byteOffset+i,2).getUint16(0,!0)}Object.assign(t,{version:s,uid:c,gid:d,unixMode:f}),c!==te&&(e.uid=c),d!==te&&(e.gid=d),f!==te&&(e.unixMode=f)}catch{}}function bk(t){const e=new Uint8Array(4);return e.set(t,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function OQ(t,e,n){const r=pt(t.data),i=Ri(r,0),s=[],a=[];n?((i&1)==1&&(s.push(id),a.push(Sm)),(i&2)==2&&(s.push(_m),a.push(j6)),(i&4)==4&&(s.push(Tm),a.push(OT))):t.data.length>=5&&(s.push(id),a.push(Sm));let o=1;
516s.forEach((c,u)=>{if(t.data.length>=o+4){const l=ht(r,o);e[c]=t[c]=new Date(l*1e3);const d=a[u];t[d]=l}o+=4})}async function NQ({reader:t,fileEntry:e,offset:n,diskNumberStart:r,signature:i,compressedSize:s,uncompressedSize:a,dataOffset:o,dataDescriptor:c,extraFieldZip64:u,readRanges:l}){let d=0;if(r)for(let m=0;m<r;m++){const p=t.readers[m];d+=p.size}let f=0;if(c&&(u?f=x_:f=C_),f){const m=await Jt(t,o+s,f+Hl,r);if(ht(pt(m),0)==T_){const g=ht(pt(m),4);let A,y;u?(A=Fa(pt(m),8),y=Fa(pt(m),16)):(A=ht(pt(m),8),y=ht(pt(m),12)),(e.encrypted&&!e.zipCrypto||g==i)&&A==s&&y==a&&(f+=Hl)}}const h={start:d+n,end:d+o+s+f,fileEntry:e};for(const m of l)if(m.fileEntry!=e&&h.start>=m.start&&h.start<m.end){const p=new Error(CQ);throw p.overlappingEntry=m.fileEntry,p}l.push(h)}async function UQ(t,e,n,r,i){const s=new Uint8Array(4),a=pt(s);zQ(a,0,e);const o=r+i;return await c(r)||await c(Math.min(o,n));async function c(u){const l=n-u,d=await Jt(t,l,u);for(let f=d.length-r;f>=0;f--)if(d[f]==s[0]&&d[f+1]==s[1]&&d[f+2]==s[2]&&d[f+3]==s[3])return{offset:l+f,buffer:d.slice(f,f+r).buffer}}}function Zt(t,e,n){return e[n]===te?t.options[n]:e[n]}function LQ(t){const e=(t&4294901760)>>16,n=t&je;try{return new Date(1980+((e&65024)>>9),((e&480)>>5)-1,e&31,(n&63488)>>11,(n&2016)>>5,(n&31)*2,0)}catch{}}function Cm(t){return new Date(Number(t/BigInt(1e4)-BigInt(116444736e5)))}function Ri(t,e){return t.getUint8(e)}function Gt(t,e){return t.getUint16(e,!0)}function ht(t,e){return t.getUint32(e,!0)}function Fa(t,e){return Number(t.getBigUint64(e,!0))}function zQ(t,e,n){t.setUint32(e,n,!0)}function pt(t){return new DataView(t.buffer)}const QQ="File already exists",HQ="Zip file comment exceeds 64KB",WQ="File entry comment exceeds 64KB",VQ="File entry name exceeds 64KB",Ek="Version exceeds 65535",GQ="The strength must equal 1, 2, or 3",qQ="Extra field type exceeds 65535",YQ="Extra field data exceeds 64KB",Sk="Zip64 is not supported (set the 'zip64' option to 'true')",KQ="Undefined uncompressed size",jQ="Zip file not empty",$Q="Invalid uid (must be integer 0..2^32-1)",XQ="Invalid gid (must be integer 0..2^32-1)",JQ="Invalid UNIX mode (must be integer 0..65535)",ZQ="Invalid unixExtraFieldType (must be 'infozip' or 'unix')",eH="Invalid msdosAttributesRaw (must be integer 0..255)",tH="Invalid msdosAttributes (must be an object with boolean flags)",_k=new Uint8Array([7,0,2,0,65,69,3,0,0]),Tk="infozip",kk="unix";let xm=0;const Ik=[];class nH{constructor(e,n={}){e=new xT(e);const r=e.availableSize!==te&&e.availableSize>0&&e.availableSize!==oc&&e.maxSize!==te&&e.maxSize>0&&e.maxSize!==oc;Object.assign(this,{writer:e,addSplitZipSignature:r,options:n,config:H_(),files:new Map,filenames:new Set,offset:n[lk]===te?e.size||e.writable.size||0:n[lk],pendingEntriesSize:0,pendingAddFileCalls:new Set,bufferedWrites:0})}async prependZip(e){if(this.filenames.size)throw new Error(jQ);e=new wm(e);const n=new PQ(e.readable),r=await n.getEntries();await n.close(),await e.readable.pipeTo(this.writer.writable,{preventClose:!0,preventAbort:!0}),this.writer.size=this.offset=e.size,this.filenames=new Set(r.map(i=>i.filename)),this.files=new Map(r.map(i=>{const{version:s,compressionMethod:a,lastModDate:o,lastAccessDate:c,creationDate:u,rawFilename:l,bitFlag:d,encrypted:f,uncompressedSize:h,compressedSize:m,diskOffset:p,diskNumber:g,zip64:A}=i;let{rawExtraFieldZip64:y,rawExtraFieldAES:w,rawExtraFieldExtendedTimestamp:E,rawExtraFieldNTFS:S,rawExtraFieldUnix:k,rawExtraField:T}=i;const{level:C,languageEncodingFlag:_,dataDescriptor:x}=d;y=y||new Uint8Array,w=w||new Uint8Array,E=E||new Uint8Array,S=S||new Uint8Array,k=i.rawExtraFieldUnix||new Uint8Array,T=T||new Uint8Array;const P=De(y,w,E,S,k,T),v=A&&h>At,M=A&&m>At,{headerArray:D,headerView:O}=vk({version:s,bitFlag:Bk(C,_,x,f,a),compressionMethod:a,uncompressedSize:h,compressedSize:m,lastModDate:o,rawFilename:l,zip64CompressedSize:M,zip64UncompressedSize:v,extraFieldLength:P});return Object.assign(i,{zip64UncompressedSize:v,zip64CompressedSize:M,zip64Offset:A&&this.offset-p>At,zip64DiskNumberStart:A&&g>je,rawExtraFieldZip64:y,rawExtraFieldAES:w,rawExtraFieldExtendedTimestamp:E,rawExtraFieldNTFS:S,rawExtraFieldUnix:k,rawExtraField:T,extendedTimestamp:E.length>0||S.length>0,extraFieldExtendedTimestampFlag:1+(c?2:0)+(u?4:0),headerArray:D,headerView:O}),[i.filename,i]}))}async add(e="",n,r={}){const i=this,{pendingAddFileCalls:s,config:a}=i;xm<a.maxWorkers?xm++:await new Promise(c=>Ik.push(c));let o;try{if(e=e.trim(),i.filenames.has(e))throw new Error(QQ);return i.filenames.add(e),o=iH(i,e,n,r),s.add(o),await o}catch(c){throw i.filenames.delete(e),c}finally{s.delete(o);const c=Ik.shift();c?c():xm--}}remove(e){const{filenames:n,files:r}=this;if(typeof e=="string"&&(e=r.get(e)),e&&e.filename!==te){const{filename:i}=e;if(n.has(i)&&r.has(i))return n.delete(i),r.delete(i),!0}return!1}async close(e=new Uint8Array,n={}){const r=this,{pendingAddFileCalls:i,writer:s}=this,{writable:a}=s;for(;i.size;)await Promise.allSettled(Array.from(i));return await hH(r,e,n),Pe(r,n,uk)||await a.getWriter().close(),s.getData?s.getData():a}}class rH{constructor(e={}){const{readable:n,writable:r}=new TransformStream;this.readable=n,this.zipWriter=new nH(r,e)}transform(e){const{readable:n,writable:r}=new TransformStream({flush:()=>{this.zipWriter.close()}});return this.zipWriter.add(e,n),{readable:this.readable,writable:r}}writable(e){const{readable:n,writable:r}=new TransformStream;return this.zipWriter.add(e,n),r}close(e=te,n={}){return this.zipWriter.close(e,n)}}async function iH(t,e,n,r){e=e.trim();let i=Pe(t,r,QT),s=Pe(t,r,VT,i?20:768);const a=Pe(t,r,qT),o=Pe(t,r,$T),c=Pe(t,r,XT);let u=Pe(t,r,JT);const l=Pe(t,r,wQ);let d=Pe(t,r,ZT),f=Pe(t,r,ek),h=Pe(t,r,tk);if(o!==te&&(o<0||o>At))throw new Error($Q);if(c!==te&&(c<0||c>At))throw new Error(XQ);if(u!==te&&(u<0||u>je))throw new Error(JQ);if(l!==te&&l!==Tk&&l!==kk)throw new Error(ZQ);let m=Pe(t,r,LT),p=Pe(t,r,zT);const g=o!==te||c!==te||u!==te||l,A=m!==te||p!==te;if(g?(i=!1,s=s&je|768):A&&(i=!0,s=s&Ar),m!==te&&(m<0||m>Ar))throw new Error(eH);if(p&&typeof p!==e6)throw new Error(tH);if(s>je)throw new Error(Ek);let y=Pe(t,r,UT,0);!r[sd]&&e.endsWith(Kl)&&(r[sd]=!0);const w=Pe(t,r,sd);w?(e.endsWith(Kl)||(e+=Kl),y===0&&(y=Wl,i||(y|=(sc|ac|Vl)<<16))):!i&&y===0&&(a?y=(ac|Vl)<<16:y=Vl<<16);let E;i||(E=y>>16&je,u=u===te?E:u&je,d?u|=Gl:d=!!(u&Gl),f?u|=ql:f=!!(u&ql),h?u|=Yl:h=!!(u&Yl),w&&(u|=sc),y=(u&je)<<16|y&Ar),{msdosAttributesRaw:m,msdosAttributes:p}=uH(m,p),A&&(y=y&At|m&Ar);const S=Pe(t,r,yQ,Xl);let k=S(e);if(k===te&&(k=Xl(e)),De(k)>je)throw new Error(VQ);const T=r[bm]||"";let C=S(T);if(C===te&&(C=Xl(T)),De(C)>je)throw new Error(WQ);const _=Pe(t,r,WT,Zz);if(_>je)throw new Error(Ek);const x=Pe(t,r,id,new Date),P=Pe(t,r,_m),v=Pe(t,r,Tm),M=Pe(t,r,NT,0),D=Pe(t,r,ik);let O,N;D||(O=Pe(t,r,nk),N=Pe(t,r,rk));const Q=Pe(t,r,cQ,3),G=Pe(t,r,GT),V=Pe(t,r,uQ,!0),Z=Pe(t,r,lQ,!0),B=Pe(t,r,ak),L=Pe(t,r,ck,!0),K=Pe(t,r,fQ),q=Pe(t,r,hQ),ne=Pe(t,r,pQ,!1),fe=Pe(t,r,sk),Ae=Pe(t,r,mQ,!0),ie=Pe(t,r,YT);let ye=Pe(t,r,dQ),$e=Pe(t,r,ok),ge=Pe(t,r,gQ);K&&ge===te&&(ge=!1),(ge===te||G)&&(ge=!0),ye!==te&&ye!=6&&($e=!1),!$e&&t.config.CompressionStream===te&&t.config.CompressionStreamZlib===te&&(ye=0);let xe=Pe(t,r,km);if(!G&&(O!==te||N!==te)&&!(Q>=1&&Q<=3))throw new Error(GQ);let We=new Uint8Array;const be=r[jT];if(be){let Fe=0,Vt=0;be.forEach(Dt=>Fe+=4+De(Dt)),We=new Uint8Array(Fe),be.forEach((Dt,mn)=>{if(mn>je)throw new Error(qQ);if(De(Dt)>je)throw new Error(YQ);lt(We,new Uint16Array([mn]),Vt),lt(We,new Uint16Array([De(Dt)]),Vt+2),lt(We,Dt,Vt+4),Vt+=4+De(Dt)})}let I=0,H=0,F=0;if(D&&(F=r[Em],F===te))throw new Error(KQ);const U=xe===!0;n&&(n=new wm(n),await Pi(n),D?(r.uncompressedSize=F,I=xk(F)):n.size===te?(ge=!0,(xe||xe===te)&&(xe=!0,F=I=At+1)):(r.uncompressedSize=F=n.size,I=xk(F)));const{diskOffset:$,diskNumber:z}=t.writer,X=U||F>At,Y=U||I>At;if(X||Y){if(xe===!1)throw new Error(Sk);xe=!0}xe=xe||!1;const re=Pe(t,r,HT);r=Object.assign({},r,{rawFilename:k,rawComment:C,version:_,versionMadeBy:s,lastModDate:x,lastAccessDate:P,creationDate:v,rawExtraField:We,zip64:xe,zip64UncompressedSize:X,zip64CompressedSize:Y,password:O,rawPassword:N,level:ye,useWebWorkers:B,transferStreams:L,encryptionStrength:Q,extendedTimestamp:V,zipCrypto:G,bufferedWrite:K,createTempStream:q,keepOrder:Z,useUnicodeFileNames:Ae,dataDescriptor:ge,dataDescriptorSignature:ne,signal:fe,msDosCompatible:i,internalFileAttribute:M,internalFileAttributes:M,externalFileAttribute:y,externalFileAttributes:y,useCompressionStream:$e,passThrough:D,encrypted:!!(O&&De(O)||N&&De(N))||D&&re,signature:r[KT],compressionMethod:ie,uncompressedSize:F,offset:t.offset-$,diskNumberStart:z,uid:o,gid:c,setuid:d,setgid:f,sticky:
516h,unixMode:u,msdosAttributesRaw:m,msdosAttributes:p,unixExternalUpper:E});const se=oH(r),oe=lH(r),Ke=De(se.localHeaderArray,oe.dataDescriptorArray);H=Ke+I,t.options[dk]&&(H+=H+64),t.pendingEntriesSize+=H;let ue;try{ue=await sH(t,e,n,{headerInfo:se,dataDescriptorInfo:oe,metadataSize:Ke},r)}finally{t.pendingEntriesSize-=H}return Object.assign(ue,{name:e,comment:T,extraField:be}),new ad(ue)}async function sH(t,e,n,r,i){const{files:s,writer:a}=t,{keepOrder:o,dataDescriptor:c,signal:u}=i,{headerInfo:l}=r,d=t.options[dk],f=Array.from(s.values()).pop();let h={},m,p,g,A,y,w;s.set(e,h);try{let T;o&&(T=f&&f.lock,E()),(i.bufferedWrite||!o||t.writerLocked||t.bufferedWrites||!c)&&!d?(i.createTempStream?w=await i.createTempStream():w=new TransformStream(te,te,{highWaterMark:oc}),w.size=0,m=!0,t.bufferedWrites++,await Pi(a)):(w=a,await S()),await Pi(w);const{writable:C,diskOffset:_}=a;if(t.addSplitZipSignature){delete t.addSplitZipSignature;const M=new Uint8Array(4),D=Ht(M);Ve(D,0,Xp),await Gr(a,M),t.offset+=4}d&&cH(r,t.offset-_);const{localHeaderView:x,localHeaderArray:P}=l;m||(await T,await k(C));const{diskNumber:v}=a;return h.diskNumberStart=v,m||(y=!0,await Gr(w,P)),h=await aH(n,w,h,r,t.config,i),m||(y=!1),s.set(e,h),h.filename=e,m?(await Promise.all([w.writable.getWriter().close(),T]),await S(),A=!0,h.diskNumberStart=a.diskNumber,h.offset=t.offset-a.diskOffset,fH(h,x,i),await k(C),await Gr(a,P),await w.readable.pipeTo(C,{preventClose:!0,preventAbort:!0,signal:u}),a.size+=w.size,A=!1):h.offset=t.offset-_,t.offset+=h.size,h}catch(T){if(A||y){if(t.hasCorruptedEntries=!0,T)try{T.corruptedEntry=!0}catch{}m?t.offset+=w.size:t.offset=w.size}throw s.delete(e),T}finally{m&&t.bufferedWrites--,g&&g(),p&&p()}function E(){h.lock=new Promise(T=>g=T)}async function S(){t.writerLocked=!0;const{lockWriter:T}=t;t.lockWriter=new Promise(C=>p=()=>{t.writerLocked=!1,C()}),await T}async function k(T){De(l.localHeaderArray)>a.availableSize&&(a.availableSize=0,await Gr(T,new Uint8Array))}}async function aH(t,e,{diskNumberStart:n,lock:r},i,s,a){const{headerInfo:o,dataDescriptorInfo:c,metadataSize:u}=i,{headerArray:l,headerView:d,lastModDate:f,rawLastModDate:h,encrypted:m,compressed:p,version:g,compressionMethod:A,rawExtraFieldZip64:y,localExtraFieldZip64Length:w,rawExtraFieldExtendedTimestamp:E,extraFieldExtendedTimestampFlag:S,rawExtraFieldNTFS:k,rawExtraFieldUnix:T,rawExtraFieldAES:C}=o,{dataDescriptorArray:_}=c,{rawFilename:x,lastAccessDate:P,creationDate:v,password:M,rawPassword:D,level:O,zip64:N,zip64UncompressedSize:Q,zip64CompressedSize:G,zipCrypto:V,dataDescriptor:Z,directory:B,executable:L,versionMadeBy:K,rawComment:q,rawExtraField:ne,useWebWorkers:fe,transferStreams:Ae,onstart:ie,onprogress:ye,onend:$e,signal:ge,encryptionStrength:xe,extendedTimestamp:We,msDosCompatible:be,internalFileAttributes:I,externalFileAttributes:H,uid:F,gid:U,unixMode:$,setuid:z,setgid:X,sticky:Y,unixExternalUpper:re,msdosAttributesRaw:se,msdosAttributes:oe,useCompressionStream:Ke,passThrough:ue}=a,Fe={lock:r,versionMadeBy:K,zip64:N,directory:!!B,executable:!!L,filenameUTF8:!0,rawFilename:x,commentUTF8:!0,rawComment:q,rawExtraFieldZip64:y,localExtraFieldZip64Length:w,rawExtraFieldExtendedTimestamp:E,rawExtraFieldNTFS:k,rawExtraFieldUnix:T,rawExtraFieldAES:C,rawExtraField:ne,extendedTimestamp:We,msDosCompatible:be,internalFileAttributes:I,externalFileAttributes:H,diskNumberStart:n,uid:F,gid:U,unixMode:$,setuid:z,setgid:X,sticky:Y,unixExternalUpper:re,msdosAttributesRaw:se,msdosAttributes:oe};let{signature:Vt,uncompressedSize:Dt}=a,mn=0;ue||(Dt=0);const{writable:Jc}=e;if(t){t.chunkSize=W_(s);const HA=t.readable,hY=t.size,pY={options:{codecType:gT,level:O,rawPassword:D,password:M,encryptionStrength:xe,zipCrypto:m&&V,passwordVerification:m&&V&&h>>8&Ar,signed:!ue,compressed:p&&!ue,encrypted:m&&!ue,useWebWorkers:fe,useCompressionStream:Ke,transferStreams:Ae},config:s,streamOptions:{signal:ge,size:hY,onstart:ie,onprogress:ye,onend:$e}};try{const Ws=await _T({readable:HA,writable:Jc},pY);mn=Ws.outputSize,e.size+=mn,ue||(Dt=Ws.inputSize,Vt=Ws.signature)}catch(Ws){throw Ws.outputSize!==te&&(e.size+=Ws.outputSize),Ws}}
516return dH({signature:Vt,compressedSize:mn,uncompressedSize:Dt,headerInfo:o,dataDescriptorInfo:c},a),Z&&await Gr(e,_),Object.assign(Fe,{uncompressedSize:Dt,compressedSize:mn,lastModDate:f,rawLastModDate:h,creationDate:v,lastAccessDate:P,encrypted:m,zipCrypto:V,size:u+mn,compressionMethod:A,version:g,headerArray:l,headerView:d,signature:Vt,extraFieldExtendedTimestampFlag:S,zip64UncompressedSize:Q,zip64CompressedSize:G}),Fe}function oH(t){const{rawFilename:e,lastModDate:n,lastAccessDate:r,creationDate:i,level:s,zip64:a,zipCrypto:o,useUnicodeFileNames:c,dataDescriptor:u,directory:l,rawExtraField:d,encryptionStrength:f,extendedTimestamp:h,passThrough:m,encrypted:p,zip64UncompressedSize:g,zip64CompressedSize:A,uncompressedSize:y}=t;let{version:w,compressionMethod:E}=t;const S=!l&&(s>0||s===te&&E!==0);let k;const T=m||!S,C=a&&(t.bufferedWrite||!g&&!A||T);if(a){let L=4;g&&(L+=8),A&&(L+=8),k=new Uint8Array(L);const K=Ht(k);if(He(K,0,em),He(K,2,De(k)-4),C){const q=Ht(k);let ne=4;g&&(qt(q,ne,BigInt(y)),ne+=8),A&&T&&(qt(q,ne,BigInt(y)),ne+=8),ne==4&&(k=new Uint8Array)}}else k=new Uint8Array;let _;if(p&&!o){_=new Uint8Array(De(_k)+2);const L=Ht(_);He(L,0,v_),lt(_,_k,2),Ma(L,8,f)}else _=new Uint8Array;let x,P,v;if(h){P=new Uint8Array(9+(r?4:0)+(i?4:0));const L=Ht(P);He(L,0,tm),He(L,2,De(P)-4),v=1+(r?2:0)+(i?4:0),Ma(L,4,v);let K=5;Ve(L,K,Math.floor(n.getTime()/1e3)),K+=4,r&&(Ve(L,K,Math.floor(r.getTime()/1e3)),K+=4),i&&Ve(L,K,Math.floor(i.getTime()/1e3));try{x=new Uint8Array(36);const q=Ht(x),ne=vm(n);He(q,0,B_),He(q,2,32),He(q,8,P_),He(q,10,24),qt(q,12,ne),qt(q,20,vm(r)||ne),qt(q,28,vm(i)||ne)}catch{x=new Uint8Array}}else x=P=new Uint8Array;let M;try{const{uid:L,gid:K,unixMode:q,setuid:ne,setgid:fe,sticky:Ae,unixExtraFieldType:ie}=t;if(ie&&(L!==te||K!==te||q!==te)){const ye=Ck(L),$e=Ck(K);let ge=new Uint8Array;
516if(ie==kk&&q!==te){let I=q&je;ne&&(I|=Gl),fe&&(I|=ql),Ae&&(I|=Yl),ge=new Uint8Array(2),new DataView(ge.buffer).setUint16(0,I,!0)}const xe=3+ye.length+$e.length+ge.length;M=new Uint8Array(4+xe);const We=Ht(M);He(We,0,ie==Tk?F_:M_),He(We,2,xe),Ma(We,4,1),Ma(We,5,ye.length);let be=6;lt(M,ye,be),be+=ye.length,Ma(We,be,$e.length),be++,lt(M,$e,be),be+=$e.length,lt(M,ge,be)}else M=new Uint8Array}catch{M=new Uint8Array}E===te&&(E=S?jp:E_),a&&(w=w>O_?w:O_),p&&!o&&(w=w>N_?w:N_,_[9]=E,E=S_);const D=C?De(k):0,O=D+De(_,P,x,M,d),{headerArray:N,headerView:Q,rawLastModDate:G}=vk({version:w,bitFlag:Bk(s,c,u,p,E),compressionMethod:E,uncompressedSize:y,lastModDate:n<L_?L_:n>U_?U_:n,rawFilename:e,zip64CompressedSize:A,zip64UncompressedSize:g,extraFieldLength:O});let V=ys;const Z=new Uint8Array(V+De(e)+O),B=Ht(Z);return Ve(B,0,__),lt(Z,N,4),lt(Z,e,V),V+=De(e),C&&lt(Z,k,V),V+=D,lt(Z,_,V),V+=De(_),lt(Z,P,V),V+=De(P),lt(Z,x,V),V+=De(x),lt(Z,M,V),V+=De(M),lt(Z,d,V),u&&(Ve(B,Ba+4,0),Ve(B,Pa+4,0)),{localHeaderArray:Z,localHeaderView:B,headerArray:N,headerView:Q,lastModDate:n,rawLastModDate:G,encrypted:p,compressed:S,version:w,compressionMethod:E,extraFieldExtendedTimestampFlag:v,rawExtraFieldZip64:new Uint8Array,localExtraFieldZip64Length:D,rawExtraFieldExtendedTimestamp:P,rawExtraFieldNTFS:x,rawExtraFieldUnix:M,rawExtraFieldAES:_,extraFieldLength:O}}function cH(t,e){const{headerInfo:n}=t;let{localHeaderArray:r,extraFieldLength:i}=n,s=Ht(r),a=64-(e+De(r))%64;a<4&&(a+=64);const o=new Uint8Array(a),c=Ht(o);He(c,0,R_),He(c,2,a-2);const u=r;n.localHeaderArray=r=new Uint8Array(De(u)+a),lt(r,u),lt(r,o,De(u)),s=Ht(r),He(s,28,i+a),t.metadataSize+=a}function Ck(t){if(t===te)return new Uint8Array;{const e=new Uint8Array(4);Ht(e).setUint32(0,t,!0);let r=4;for(;r>1&&e[r-1]===0;)r--;return e.subarray(0,r)}}function uH(t,e){if(t!==te)t=t&Ar;else if(e!==te){const{readOnly:n,hidden:r,system:i,directory:s,archive:a}=e;let o=0;n&&(o|=sm),r&&(o|=am),i&&(o|=om),s&&(o|=Wl),a&&(o|=cm),t=o&Ar}return e===te&&(e={readOnly:!!(t&sm),hidden:!!(t&am),system:!!(t&om),directory:!!(t&Wl),archive:!!(t&cm)}),{msdosAttributesRaw:t,msdosAttributes:e}}function lH({zip64:t,dataDescriptor:e,dataDescriptorSignature:n}){let r=new Uint8Array,i,s=0,a=t?x_:C_;return n&&(a+=Hl),e&&(r=new Uint8Array(a),i=Ht(r),n&&(s=Hl,Ve(i,0,T_))),{dataDescriptorArray:r,dataDescriptorView:i,dataDescriptorOffset:s}}function dH({signature:t,compressedSize:e,uncompressedSize:n,headerInfo:r,dataDescriptorInfo:i},{zip64:s,zipCrypto:a,dataDescriptor:o}){const{headerView:c,encrypted:u}=r,{dataDescriptorView:l,dataDescriptorOffset:d}=i;(!u||a)&&t!==te&&(Ve(c,um,t),o&&Ve(l,d,t)),s?o&&(qt(l,d+4,BigInt(e)),qt(l,d+12,BigInt(n))):(Ve(c,Ba,e),Ve(c,Pa,n),o&&(Ve(l,d+4,e),Ve(l,d+8,n)))}function fH({rawFilename:t,encrypted:e,zip64:n,localExtraFieldZip64Length:r,signature:i,compressedSize:s,uncompressedSize:a,zip64UncompressedSize:o,zip64CompressedSize:c},u,{dataDescriptor:l}){if(l||(e||Ve(u,um+4,i),c||Ve(u,Ba+4,s),o||Ve(u,Pa+4,a)),n&&r){let d=ys+De(t)+4;o&&(qt(u,d,BigInt(a)),d+=8),c&&(qt(u,d,BigInt(s)),d+=8)}}async function hH(t,e,n){const{files:r,writer:i}=t,{diskOffset:s}=i;let{diskNumber:a}=i,o=0,c=0,u=t.offset-s,l=r.size;
516for(const[,E]of r){const{rawFilename:S,rawExtraFieldAES:k,rawComment:T,rawExtraFieldNTFS:C,rawExtraFieldUnix:_,rawExtraField:x,extendedTimestamp:P,extraFieldExtendedTimestampFlag:v,lastModDate:M,zip64UncompressedSize:D,zip64CompressedSize:O,uncompressedSize:N,compressedSize:Q}=E,G=E.offset>At,V=E.diskNumberStart>je;let Z;if(G||V||D||O){let L=4;D&&(L+=8),O&&(L+=8),G&&(L+=8),V&&(L+=4),Z=new Uint8Array(L);const K=Ht(Z);He(K,0,em),He(K,2,L-4);let q=4;D&&(qt(K,q,BigInt(N)),q+=8),O&&(qt(K,q,BigInt(Q)),q+=8),G&&(qt(K,q,BigInt(E.offset)),q+=8),V&&Ve(K,q,E.diskNumberStart)}else Z=new Uint8Array;E.rawExtraFieldZip64=Z,E.zip64Offset=G,E.zip64DiskNumberStart=V;let B;if(P){B=new Uint8Array(9);const L=Ht(B);He(L,0,tm),He(L,2,5),Ma(L,4,v),Ve(L,5,Math.floor(M.getTime()/1e3))}else B=new Uint8Array;E.rawExtraFieldExtendedTimestamp=B,c+=46+De(S,T,Z,k,C,_,B,x)}const d=new Uint8Array(c),f=Ht(d);await Pi(i);let h=0;for(const[E,S]of Array.from(r.values()).entries()){const{offset:k,rawFilename:T,rawExtraFieldZip64:C,rawExtraFieldAES:_,rawExtraFieldExtendedTimestamp:x,rawExtraFieldNTFS:P,rawExtraFieldUnix:v,rawExtraField:M,rawComment:D,versionMadeBy:O,headerArray:N,headerView:Q,zip64UncompressedSize:G,zip64CompressedSize:V,zip64DiskNumberStart:Z,zip64Offset:B,internalFileAttributes:L,externalFileAttributes:K,diskNumberStart:q,uncompressedSize:ne,compressedSize:fe}=S,Ae=De(C,_,x,P,v,M);Ve(f,o,Jp),He(f,o+4,O),G||Ve(Q,Pa,ne),V||Ve(Q,Ba,fe),lt(d,N,o+6);let ie=o+ys;if(He(f,ie,Ae),ie+=2,He(f,ie,De(D)),ie+=2,He(f,ie,Z?je:q),ie+=2,He(f,ie,L),ie+=2,K&&Ve(f,ie,K),ie+=4,Ve(f,ie,B?At:k),ie+=4,lt(d,T,ie),ie+=De(T),lt(d,C,ie),ie+=De(C),lt(d,_,ie),ie+=De(_),lt(d,x,ie),ie+=De(x),lt(d,P,ie),ie+=De(P),lt(d,v,ie),ie+=De(v),lt(d,M,ie),ie+=De(M),lt(d,D,ie),ie+=De(D),o-h>i.availableSize&&(i.availableSize=0,await Gr(i,d.slice(h,o)),h=o),o=ie,n.onprogress)try{await n.onprogress(E+1,r.size,new ad(S))}catch{}}await Gr(i,h?d.slice(h):d);let m=i.diskNumber;const{availableSize:p}=i;p<Vr&&m++;let g=Pe(t,n,km);if(u>At||c>At||l>je||m>je){if(g===!1)throw new Error(Sk);g=!0}const A=new Uint8Array(g?qz:Vr),y=Ht(A);o=0,g&&(Ve(y,0,Zp),qt(y,4,BigInt(44)),He(y,12,45),He(y,14,45),Ve(y,16,m),Ve(y,20,a),qt(y,24,BigInt(l)),qt(y,32,BigInt(l)),qt(y,40,BigInt(c)),qt(y,48,BigInt(u)),Ve(y,56,I_),qt(y,64,BigInt(u)+BigInt(c)),Ve(y,72,m+1),Pe(t,n,AQ,!0)&&(m=je,a=je),l=je,u=At,c=At,o+=ic+rc),Ve(y,o,k_),He(y,o+4,m),He(y,o+6,a),He(y,o+8,l),He(y,o+10,l),Ve(y,o+12,c),Ve(y,o+16,u);const w=De(e);if(w)if(w<=je)He(y,o+20,w);else throw new Error(HQ);await Gr(i,A),w&&await Gr(i,e)}async function Gr(t,e){const{writable:n}=t,r=n.getWriter();try{await r.ready,t.size+=De(e),await r.write(e)}finally{r.releaseLock()}}function vm(t){if(t)return(BigInt(t.getTime())+BigInt(116444736e5))*BigInt(1e4)}function Pe(t,e,n,r){const i=e[n]===te?t.options[n]:e[n];return i===te?r:i}function xk(t){return t+5*(Math.floor(t/16383)+1)}function Ma(t,e,n){t.setUint8(e,n)}function He(t,e,n){t.setUint16(e,n,!0)}function Ve(t,e,n){t.setUint32(e,n,!0)}function qt(t,e,n){t.setBigUint64(e,n,!0)}function lt(t,e,n){t.set(e,n)}function Ht(t){return new DataView(t.buffer)}function De(...t){let e=0;return t.forEach(n=>n&&(e+=n.length)),e}function vk({version:t,bitFlag:e,compressionMethod:n,uncompressedSize:r,compressedSize:i,lastModDate:s,rawFilename:a,zip64CompressedSize:o,zip64UncompressedSize:c,extraFieldLength:u}){const l=new Uint8Array(ys-4),d=Ht(l);He(d,0,t),He(d,2,e),He(d,4,n);const f=new Uint32Array(1),h=Ht(f);He(h,0,(s.getHours()<<6|s.getMinutes())<<5|s.getSeconds()/2),He(h,2,(s.getFullYear()-1980<<4|s.getMonth()+1)<<5|s.getDate());const m=f[0];return Ve(d,6,m),(o||i!==te)&&Ve(d,Ba,o?At:i),(c||r!==te)&&Ve(d,Pa,c?At:r),He(d,22,De(a)),He(d,24,u),{headerArray:l,headerView:d,rawLastModDate:m}}function Bk(t,e,n,r,i){let s=0;return e&&(s=s|im),n&&(s=s|rm),(i==jp||i==$p)&&(t>=0&&t<=3&&(s=s|Jz),t>3&&t<=5&&(s=s|Xz),t==9&&(s=s|$z)),r&&(s=s|nm),s}try{jl({baseURI:self.location.href})}catch{}const In="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function pH(t){let e;t({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(n=>{n=(a=>{const o=(a=(a+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,c=[];for(let u=0;o>u;u+=4){const l=In.indexOf(a[u])<<18|In.indexOf(a[u+1])<<12|(63&In.indexOf(a[u+2]))<<6|63&In.indexOf(a[u+3]);c.push(l>>16&255),a[u+2]!=="="&&c.push(l>>8&255),a[u+3]!=="="&&c.push(255&l)}return new Uint8Array(c)})(n);let r=new Uint8Array(1024),i=0;for(let a=0;a<n.length;){const o=n[a++];if(128&o){const c=3+(127&o),u=n[a++]<<8|n[a++],l=i-u;s(i+c);for(let d=0;c>d;d++)r[i++]=r[l+d]}else{const c=o;s(i+c);for(let u=0;c>u&&a<n.length;u++)r[i++]=n[a++]}}return(a=>{let o="";const c=a.length;let u=0;for(;c>u+2;u+=3){const d=a[u]<<16|a[u+1]<<8|a[u+2];o+=In[d>>18&63]+In[d>>12&63]+In[d>>6&63]+In[63&d]}const l=c-u;if(l===1){const d=a[u]<<16;o+=In[d>>18&63]+In[d>>12&63]+"=="}else if(l===2){const d=a[u]<<16|a[u+1]<<8;o+=In[d>>18&63]+In[d>>12&63]+In[d>>6&63]+"="}return o}
516)(new Uint8Array(r.buffer.slice(0,i)));function s(a){if(r.length<a){let o=2*r.length;for(;a>o;)o*=2;const c=new Uint8Array(o);c.set(r.subarray(0,i)),r=c}}})("
vendor: 39,356 bytes, line 516
516FQBhc20BAAAAAUULYAF/AX9gAn9/AIEABYAACwIDf4IABwEBgAARAQaAAAuDAA6BABUDAGAAgAADgAANAQSBABUDAGAHgwAegAAfEgNCQQcABAEABAgIAAIABQIKAIAAB4EAAwEFgQAHAgICgQAHEAEDAAUGAAMDBQQJBAQJAQaAAAEeAAIEAwIEAgIBBAcDAwQFAXABDQ0FBgEBggKCAgYIgACYIkHQ1QQLB4oEHAZtZW1vcnkCAAxpbmZsYXRlOV9uZXcABw2GAA8HaW5pdAAIEYoAEAdfcmF3AAoQhgAUCXByb2Nlc3MAC4cARgZlbmQADhaGAA8QbGFzdF9jb25zdW1lZAARC4QAGYMAbYUANoMAbAEShQBYhwBrARSFAH+DABMHZ3ppcAAVD4UAFIUAfgEWhgBWgQB9AhgVhQAOjQB8AmRliQB8hQAOggB8AhoQiQAPggB8AhsRigATggB8AhwPhQAUhQB8AR2GAFaBAHwJHwRmcmVlAAIVhQAVjACDCgZtYWxsb2MAAQuCAFUKaWFsaXplAAAZX4AADxZkaXJlY3RfZnVuY3Rpb25fdGFibGUBgAAcG2Vtc2NyaXB0ZW5fc3RhY2tfcmVzdG9yZQAFHI4AGwJnZYAAbw51cnJlbnQABiJfX2N4YYAAWwRjcmVtgAASBl9leGNlcIIAXQZyZWZjb3WAACUtPQkSAQBBAQsMACEiDA8XGR4+NTg7CqHlAkECAAu/JwELfyMAQRBrIgokAAJAjwACEiAAQfQBTQRAQaQnKAIAIgNBEIAAEgYLakH4A3GBAAkQSRsiBkEDdiIAdiIBQQNxBIEAMgYBQX9zQQGAAB8GaiICQQN0gAAZDMwnaiIAIAEoAtQnIoAABgQIIgVGggBSCSADQX4gAndxNoACphEBCyAFIAA2AgwgACAFNgIIC4AASAMIaiGAADcBIIIARoAABQRyNgIEgQAPA2oiAYEATQMEQQGBABIHDAsLIAZBrIIAnwMITQ2AABuBAIYEQQIgAIEANQUAIAJrcoAANQQAdHFogQCjA3QiAIIAj4AAH4IAj4AABosAjwUBd3EiA4YAkQECgQCRAQKEAJEBAIAAaIMAhYAACgJqIoAAjIIA3wUgBmsiBYMAjIAAGQIBaoEALgoAIAgEQCAIQXhxgQBuBCEBQbiBAKAEIQICf4AAZQEBgAAZBwN2dCIHcUWEAHgCIAeAAD6AADyBAHWBASEDCyEDgQDpgAB2gAAchACEAQGDAAeAAJyBAIuCARyAAFYCIASAADmAAP6CAHWAAQsCQaiCAQkCC0WAAQkFC2hBAnSAAOYDKSICgQEuAnhxgACqByEEIAIhAQOCAagFKAIQIgCAAIOBAAoBFIAACgENgAB+gAEQhAAqgADZgQFuBQRJIgEbgAA2gAFJASCAAAmAATgBIYEApwILIIAAVAMYIQmAABaAAAkEDCIAR4AASIAACgEIgAA3hAHGgACxAwgMCoIAKQUUIgEEf4AByAIUaoABU4EAdwMBRQ2AANkOQRBqCyEFA0AgBSEHIAGAAZoDFGohgAIFggAwAg0AgADlARCEABCAADEGDQALIAdBgABbCAAMCQtBfyEGgAAfA79/S4IAJwELgAISgAC1AiEGhAD+CAdFDQBBHyEIgAH+ggDygALEA///B4ACxoABwQEmgQJYBnZnIgBrdoICpQpBAXRrQT5qIQgLhALxAQiFATUBAYEBngIAIYECCoEAB4AAPAEZgAAdAwF2a4AAVwgIQR9HG3QhAoUBSYUBNAQDIARPgACTAQGAALcDAyIEgACGAQCAAH8BAYAARAEDgQI/ggFoAQOAAdOBAtQGHXZBBHFqggDcAkYbgAAdAgMbgABkAQKAAI+AAWSBAO6BADECBXKDAIQBBYACzwEIgQK7gADugALPAgdxgQGuAwMgAIUB4QEhgAEdggHAgAFMiAHCAQKAAb4BIYAAbIEByYMBxAEFgQAJhQFTgAGTAQGDAW8DCyIAggByAQWAATkCIASDA02AAEGBAMsBBYEB5wEIgAA5gAAJhAHngAAKjQHngAKTgAAWgwHnAQWCAeeAAA+EAecBBYIB54ABK4ACeoAA+4MB54IDgIgB54IAEIQB5wEDgwHnAQeHA9gBBYEEgoMDQ4AEpoAAjYECnwNBEE+AAI2CA4uAATKGA4ECBWqBAJOAAFeFA66BA1WAABeGA7sBBYsEQIABX4AEJwEhgAHlgANGgQA6gQNWgAN0gQCZgQNlgAJvgABKAbCCAIgCAkmAAIgBsIAAH4IAgYEALAK8J4AAA4EAG4MAiIEAN4kAjYYEMYUAS4QCSgEvgAQ/BQJ/QfwqgAA7gABTAoQrgAAIgQJoBYgrQn83gABXBoArQoCggIAAAQEEgQAOEfwqIApBDGpBcHFB2KrVqgVzgQB6ApArggEnA0HgKoMACAaAIAsiAWqABaKAAZMBa4AEXIEEmQVNDQhB3IEAZAIiBYAAZgHUggAKAQiABKMFIgkgCE2AAUcFCUlyDQmAAvmAAEUDLQAAgAKQgAJvhQX6hADYgQA5BOQqIQCDAlqBAD+BAY2AADwBCIICagNqSQ2BAtuBAhKCAkMEQQAQBIAFdwJ/RoAB+QMBIQOAAMmCAR0BQYAAk4AD+4AGIYEC/AFrgQVTAWqCAs0DcWohgABAAQOBAKsBA4QAq4EBEYMAq4ADRQNqIgeAAHGAAUoBB4AAqwEEgAAqgABfgAFjBUcNAQwFgQA4gABMgADrgQAWggJCgABTgQCVAUaABP4BAoIDFYEAioABCQVBMGogA4EAuIAB7QMMBAuDAXGBAyADIANrgQCJBwJrcSICEASDAC6ABWWAAJaCACuAAJyAAM0ERw0CC4EBaAHggQCWAkEEgQWsgAWohADpggDygQBoAXKBBSQDTXINgANTgABQgAPoCAZBKGpNDQULgADOgwDRgQDPggGsAdiCAA4BAIECTgLYKoEDSQEAgQGFgwFxAQSHAXGDANOBA2uAANUCIgWAANeCABKDAWuBAMcBtIMCe4EBSoAAewEbgQQtAbSDAr2CAmkDQegqgQYwAQCAAFCCABUFQcQnQX+BAAgCyCeDAnuBAAwB8IMCQIEB4IMGz4MHsIAGUAHUgAMQgQZYAtgngQUngAC7A0EgR4AAeYEDAQQDQShrgAAQAXiAAOkBQYECa4AB3oMDDoQHoIIGzoADdIUDCAQCakEogQNsBMAnQYyBAXuBA+CAAc6AAYEBTYEGZAJLcoMA2gQMQQhxgQAKgAHZAgVqgQAwgABRgATNAiAEggBmgAhRggN0ArAngwOPgQFPgAAtgACJgwBvgAClggBvgABWkABvAQOCARMCDAaDAAeFAT0DIAJLiAE1gwH7AQWCAYACAkCBBpmEAYKBBPeEAXoDAQwCgQWcAi0AgQCtgATgAQuEAa6BCSyDAa4BBIECaYEHPIICjAMiBUmEB1kBCIIGTJQBQAEHkAFAAQeZAUCAAGICBUGAB/iBAEEDakEvgABPgAAoAQSABUyACZQDAUEbggksCUHsKikCADcCEIAACwHkgwALAQiAABSCCVuBAHCNAiCEAgyAACABGIAEr4ICE4AAmIMEv4AABQEEgQmQgADPgQL+AyAERoEG6YMFSQF+gAnDAQSDCC+ABnaEALaCCMEBAIAI8gMCQf+BCkOAAAiECQ+AABWEClCABSqBCd+ACQ0BAoUJDYAAEYIJDYIJgoEBNgELgAbDgADagQkNgABggAZ1AkEMgAWyAQiBBS8BH4IHMwH/hAfdAQKAB92AABmQB92AALGAAMUGNgIcIARCggEPAQCABzkDQdQpgAmaggTrgwg3gAKvgQo1AQOCAIoBqIEJlwEFgwmXggllgQCPAQKACAOAAFWCCAOACGKBCAOCB9aAB6KBAi2BCt2CB3wBAoIDqoAH44EHbIEH04MDDoAH8AIiA4EG5wEFggbngQBXARCBAJqAAe8DGEEIgAcEAgQigAgsAkEMhQoHgAHTgQDwgwCBAQiDAMOACNWAACMBGIABAgEMgAA7hAbsgQLygwRHhAapgAZkAU2ACH6AAmqBB8ixBquAAyEEoCdBMIEAOYEDMIIIwIMHFoIC14ADKIIDa4UCwwFqgAYZhQBCgAmMgAaDggAVgAUFAiAIgAbsA2shB4UE4QIgA4ELboED2YoDzAEHgwUbgQDlhAvYgAHgggfzgwAxhwrrhAifjgAxgQIlgwEGgQFAgAFogQWXBANxQQGAAD+AACSACiABCYEAFoACPYIM14MClIAAEYEIzAECgwwCgwKWgAwGgAA5AXaDDJgBAoEC7IcLg4ECd4EANQMYIQaAAEaABC+BBBqCAEWCAR+BACaBAaWAACaAAB+AABiAC1iACRMBA4IJE4IB+4EJp4AAEIEJE4ALh4IKKoAGiYEJE4IEMIAAMIADV4ELGoEJuYIAMYECLAEFgwkTggqKgACSAQaACaiDAGABHIAA5AECgAW2gQoGggEpgAF+gALYgwGrAwINAYACyIMC3oEA1YUA0oEAOwIgBoAAXYEAMAEGgQAsARCBANeCAAoBFIAC5oIMCoAI5IACl4QAtYEDXoEA2YADOoEAJQEYggEEggw0gQJFgAAZARSGABkEByAJaoALzwEDgAAHgQLtAQSBA32AB02GBCSFBNWAAAoCaiCBBPaAABKDAYwBB5MEIAEHrQQggwMpgQAHhAGxgAQoAQKBAGaEBCgBB4AEKAEHkgQogAFbgALUiAQogA8mgwQogg8dhAQoggS1A3QiBYUEKIAD24MAkoYEKAEHgAQogAUHggQoAQKEDCuCBh6DAfSBDnaCBCgBB4EEKIEMC4EB7YML+4EFfYEEKIMLQIIB/IYEKIAA1gEYgAAHhADkgQDyhQEEgQZ2gwuPgwQqgQIvgQAriAEIAQuADLWCA9qCAgABCIMCQoAAZgEcgADQgADOgAJsgAJCgQ8KgACKgQJCggNdgAbvgQDiAQeEDxmBAa+DAECACgCEAkCACgiEAkCCAAqAAkCEDkoCIAiBAISDAMiCC6mAAIaABomCAMaFDC+BAkCCABkBFIUAGYAAXAMEQQ+DCmMBBIEEqYADi4cLuYMEfYYEIYEMCoQAH4AACoEEb4QAHIEFXQFqggGPgAASgwJegQFxkAJeAQSiAl6BD3aAAByAAAcBDIECzYMAB4cCXoIAZoQCXgEEgAJeAQSVBoaCADwDHCADkQaGgQMaghC1hQJYgAK0hAaAgQelgwBxARiBAJgBBJYGh4MCX4UP74AHo4QGh4IJHYEAJoEF8oECXwEHhw9VgQBeARCDEGiBA9iFAOWBAPOCBvSDBN2CABaDEH+DDaGABBuDBPKCANSBDgGDAl+CBPoBCYMCX4AAPIQCX4AB74ACX4EFZ4AAKI0CXwELgwJfhgJdAwIgCYQCXQEJhgJdggAKiAJdAQmBAIKDEEyPAl2DEHOZAl2BC/uKAl2ACXaNAl2ABQKEAB+AAAqAA5KGAl2AAm6EAl2KEeaBDjqCAYWAAmGGEeQBIIMIT4gR5ogCW4ABO4ICRoMB3IEH6YICW4IB8QEIgQb/ghHXgQ6ZgQBugQiAgQFjAQuADg4DEGokgABKBgveCwEIf4EGz4IA7AJBCIEMd4AJqAFrgwLeAXiBCzQCIQWCE5QCAXGBCa8BQYACXYEGgIEFv4AAIoAAL4MLB4AKo4ISvIME6IAE6oQHeoQG3oAHNIAAPIQJxoMG7wEEgA0ViQcygBMMhAcygQ2YggchigcfiwdFgQ3KhRAwiAcdghAwgwcdAQSAAsoBBIISF4IHHYABhIUQMIIHHYIAEIsSF4AIo4ACZoAJQ4EH9QIDR4AOUIABOIICZ4AQ9oQGf4EBHoMBxIIUbQIAD4QF8YEAmYIFUIAN6Y4HYoICwQEEhwdiAQSWB2KJAsWrB2KBAsWCARyBAsWIB2KCAsWCABmBAsWFA6MBBYQRmoEA7QEBgAHShhW7gwHigglggQHAghTZgAlrggvlhglrgA1IggEXhwENAQODAfACRw2BEXGDEE8BuIMACAEPhAmFgQ/4hAmHggBNhgmHjwBNgQ2YhQFdgQKEgAAjgQw3iwJGghJEgAF7jAl4igJGiwGagAIzghKMgQJXAQWIEoeJAleDAgOREoeAADS0AleAAg2RAkCGAOaDDlmHAjOHB1ODAjOCB1OjAjOABsSjAjOGB1WMAjOHB1WOAjOOALiAABQBCIAPz4UDJYABrYULFIELLIMWt4YHKoAE+oILFIAUhIUEz4AG9I0WtYQGq4AICIUGRYIE1oMGIYACSoEJh4AAZYQHKQEAgAcpgASzgAcpAQGDBymAAsyGCYeCBlyGBymGCYeAEzWAAucBf4sJiYMXSIIJiYMFYoABqIECpIENJYMJIpEJj4ABnoAVnYECD4YNtwEAhgmPgQzagxWKgAG7hgcwgBXRhQcwgQBdgAu9gAfpgQD3AgMihgEGgALVggD8gwEKgAAngADjgRRhAQuAAnWBEF6DBjiEARqCAY2CD/qAEZoBxIICEoAFlIASTQIgAIAPwYATTwSMCwEHgAANgQWagAXHgxBjgRJ3ggXOgAEWggXOghB3gACOhAhIgQAmgRKBhAaPhBC7AQyABm2FD4mAAZGRBcOBD4mGA32AACKBA2yEBgSCADCCB/6BAc+BGJmBA5CCDLABBIADbIEV04QWVgEEghaZiBXzAQeAAWGBBeOAATCCBNKAAUWCBeODABCFAVWLBcOAAIqHBcOCDuKAFD2EA4OBBsaFBcOBABuCBcOEAJmHBcOAAEqEA5CAAJYBHIAAUYYDkAEAhwOQgwlXiwOQhBqPggOQgA8VhgOQgQH1gwOQgAAKgAOQAQOCA5CABeWBA5CCAPoBAoIBWoEDuIMJKIADd4IBIYADuoEB8YEDx4UAGYYFr4QA7pEFtIIFhoYFtIATf4QW1oYPsqkFtIIAH4YFtJAATYEauIQBToERp4ICTYMFtIcCN4QFtIIPj5UCN4sBi4cFtIAGtIYFtIsCSIUFtIECSIgFtIACSIUFtK8CSIIFtI8CMYYA5oMFtIcCJIIFtIgCJIgFtJ0CJIkFtJoCJIIA1pACJIIA/ZACJJEAuIENVYQFtIQBrYUHUIEHaYIFtIAcY4YdrIEVzIEFtIAII4UM3oEK0IAEHoUL2YEM3oMQsoUKfIQQx4MKmIIFtIAErIYFtAEBhhtAAQKDBbSBBSeCBbSCEiGAALkDHCAAgwW0AQOFBbSAEW+GDzuBBkiAFmWGBbKAEAWDAJGEDBCCBq+CBUuABbOAAMGCBbMBA4MFs4ABH4EFs4ICDoEBqIIFswEBgQWzAQOBBbOBAAeABbOAAnqAAJWGBbMBAoMFs4QQu4AClYIBWYQA6oMGl4EGCoYa0IMTZIADXYIM4oQTgIMBDQMLC0mBBxEBkIMGe4EVGwFqgQtiAQKCCzWAAHSCA1CCF4UDIAA/gAUCAXSAHo2HE0UBf4ABTAGQhAqQAwELBoAALQYkAAsEACOAE7MCAQGABtUEQcQAEIAQGYMLyAIEa4EZj4AMOoIADoAGHgMA/AuBGM6CBWuAASMBJIEHjQU2AiAgAIASGQMLCxGAACaBAVEBfoIHxQsQEAkL2QIBA39BeoAHMARAQZQIgQBNATGBAjgBfoEcBYQAVYQEuAEggwJ8gAAKASSEAAgKKEEBQdg3IAIRA4AGVoEAVwF8gQBXgweQgADmAzYCOIUBrwQCQb/+gAAJgABlBCAAECODFg8GQR91IgNzgBlXgQKAgBQFgBYugwLSASiDDnwCdkGCGfoEAUEAToAeWYEfa4ABYIIAPYIAXAM0IAKBAj8BLIkAFIAA54EAB4ABloEAG4AI1YIN8YAAX4ADhgEwgALIgQAWATyDACsBJIAAB4AbNYIOHAFCgRtAAXCCCD8BQoAAqAE3gQ3IAkKBgwAUAcyAAOCAACsCtAqCCr4BcIMA0QFUgwAHAlBBggkNgAEJgxmBAyQRAYQBMQEcgAIsjAFtAXCAAW0BEoIB+oEA5oIXlAgEEA0L/SQBIoQhWQIUJIEBeAEZhgEkgQeMAiIShAFsAwQhE4QbV4ECNwETgARnAwAhE4IAfYEEkAHcgAs6AR+AAKcF9AVqIRWAAAgB2IAAEAEbgAAIAfCAAAgBGoMAvwIhFoEAIIAAEAMRQZyBGBkEIRxBmIIACAQdQZQrgAH4AiEegQM2A0AhCoEABwE8gQr5AUGAGDIIAkkhIEF9IQ2AAA4GBkchISATgQIYgQMvAxchEIEY+JEiCpIAAoEJjpEiNoEQgoAiGoABdxdrDhMEBQYHCAkDAgwNARkAGw8iIhQhIoIEfwVMIQYMGYYACoAW0IAACgFsgR5MgQAIASKAC9YDKAJggh8wAwxJG4AAIQQGCyAggR/agABWgAZSBA4hDQyAAZGBBMYCDQ+ADxICCHKAFeABCIEEAIIXjQMKQQKCBrQDRQ0OgRqIAWuBH5KAARADIAp0gBR4gRSggBrSgAAtAwkhCoMgzoERfoACUAMIQcGAAF6AAtKGAMuAABgBdoIWRwZrDgMAAQKABOgBHoENdIIfmAUIA0BBkIAKBoAP7QGQghokARGBICIFdGpBCDuAAjSAAAuAIFiBAF+AACcCgAKAH0YBBIAAB4MAJ4AFCYAAJwEJgQAngAALgArZhAAnApgCggBOAZiEACeDAE4BB40AToAANAGgigBJggBwhwBJgSB3gAIIA0GgK4EEewKgPIMACQMgFEGAETYBDIAFgwERgAA/gAAXgAARBwxqIBUQJBqCAFMBIIkAUgEFjABSAZyAAE4BPIECqgEcgwBKgBCZAQyAIJYDEUEgigBJgAJ2A0EBOoAEcASgKyEdgQFXAR2AA1GAA3gBiYADeAHQgAOEAViAABOAAEKAA2sCQceCBDwCQQGAAqMBIYAKNAQKQQNrgAKngRXuAiEHgQAdgQg2gSB6gAERgQHsBB8LQcSBAZuDC9ECwguBGTQB0YEAEYIcR4AASoERF4gAQ4UAPQIMGoEAGYAX/gEFgAYIAQqAGJaAAByBGa0CQR+CE66CB+mAAh+AAXaBAh8BBYQCH4MBboMS1AMFDAKABWeAAVKBAhsBBoAAVAEKggCRAR2ABZOBCHID//8DgB6CgAAJgCT3AhB2ggsuAkHdgxKfgQChggqqgAJmBBoLQcKCAEABAoEACIMSVoAE/gFEgABagAi2gABUgQOMgAQWgQBbgACzAwJBw4IAJoIC4gNEIgOCCDmCFNiAG+ACAyCBE7EBEIEACoECiYAAKoQDEYAAOQESgBWIAwMQJYMjmQFEgAWJgABkgAAtBBJqIRKBADYCayGBADuAANaBGlCAAA4CBAyBEzCEBckCDBeACNOCAz0CDUuADFmNAR2FAzyEAR2AA3QBaoMDP4IBHoEBnoMAhoEAUoABEAEfgAEXA0GBAoAaKQFkggAQAgV2gAATgAA7AzYCaIIAEAUKdkEPcYAcVQEigAkgAWCAAE4BDoMBvQEOggG9AkEegiHeAkGhigFKgAChgAAMAcWDAjoCACGABCOBBZgBbIADE4ADqgMGIAyBCpsBE4AACQcGQRNNGyEJgADLAwYgCYIN1oAAE4EhHoAALYAC44AADAV0LwGwDoIC6gEAgQLqAQOABGABAIEHZJgESQEKowRJgANhgBrygwBpgAAMhgBpgADbAgdxgQBsiwKnAQSAAMaFAquDAEEBFoMGi4AAB4AGmYEdgYEDNYAADoAGmYADcAUTIBogG4EDbAIiDoIBIQG/ghdnhgEhARaBASEBxoQCYYIBHYABKAEOgQ6AggJKA2QiD4EABwRoaiEMgADcAQuABVqAATKAHaMEKAJYdIACwQEhghVUA1AhIoABAQEJgACbgAOXggEFASKAAzwCGHGACdIHaiIjLQABIoADBoAfOIEK4YEWDoABFYABAYkDPwEJgQEVAQmFAz+AANeAAZ8GIy8BAiIIhRV/gAj3hgEmgAAMgAEfggTEgSPbgQEcAiAGgwEcAQuBFlABf4UGaIACegQQaw4CgAWHgSOUgAl6gg/AhgCMgBAwoQCMigBlAwUgC4IJsgJBh4sDswEJgAGTAQOAAvmAJpuBBmeAAgaBADOAJYmBAJiAJE2ADqCBJp2BALsDIBFqgAAeAi8Bgg7AgBYzjQCXARuoAJeEAhuAAJqACyyDAiCAAjaAAFSCDFiACnOMAFwBGqkAXAEHiABcAQeDAFwD/wBxgCc/gCeGgQIiAwQgDIAAKQILaoACFJYBEYAD3YEFPoIGKoMBuAEEgQG4gQHPgAJigwMhhALIgAWjAWyAF7mEADiCABQELwH0BIMBbwKUCooCtwEVgQK3gABxhQLrhAMAgQasAiAPjALyAaOLAvKCADuABEMBXIME8wFwgAM+gQaZggLuggChgQLwgABDAR+IAEMB8Y0AQ4QGcYYGloADNIQFkYAACwENgwBkAciFBZGBA1cC0DeJAzeCA1UBUIADyosDNwEMgAFugATjgQM3AQuLAzeBJuahAbgBC4ADNQIhD4AC+oAAQIAp14ELUwX/AXFBDoEARwMGIQyAAJ0BBoECGgMMIA+BAGYCIRiAAJUBBoABwoIAlYIBqQIgGIAAhAELgCgPAXaCAIcBD4EAhwEMgBjPgQHkgACIgAR8pwMzgQdCggOYgABGAQCAAe4BD4IAnYEB6wEPgQZlgAVkAiAMgAXeAtA3gAAvAQyDAmwBDIEALwELgQC0gA/SgQP5AkHNgwFzARGBGscBIIEmEYUGfYAACYAknQLQN4MAGwLAAIEAHAMAQdWBB+mHAaqAABwDAkHJhQdAgBnNAXGBBj4BTIUCZoIP0oAGoYoBhoAAvIQA7oAIUqIA7oICSYAAxwEGgwDOhAdLgAfiAiAGgQFagA5dAQyBAPGLBK2FAumAKDABEIMKHwEQgQDthAcUARKBB5qBAEeACR2GAkwCIBCBAI8DECASgQCCAhIMgh3lggebAQqBHJiAAdABCoIHWoAFz4QARoYAIoIAGIAHCIQAGIITBYUAGIIAEgEOlABMgAE8hAA0AQ2AAk6AAAeBC3cCQdCDAI+GCSGDCTIBCoQrvwJEIYIik5IAUIAAyYQAUIAA+AMCQcqFAZuAASEC1DeAK6mBAEABXIMCj4EACwFUkgMkAQuDAySCAp2HAySAB2miAa6CAoeBBmKBApcCIg+DKhiCAcGCB5SAAGIBC4gDHQEPgwMdAQ+GAx0BD4YDHYIDpIgDHaUCL4sDHYUCO4ACGoEDtYAEHIIDxYAAiAEhgAzCgQMlAQqFAyWJAj8BD4YC8wHxigLzhgJYgCsQAwJBy4UBYAEPhgL7ggVpAUiHAwKIAV8DIAYEgybGhQMBgRnrtQMBAUiJAwGBAHKSAv+BAKUBzIQFKYYDB4AAEYQCJQEGgAfOggBNgArEAhcggA8fAQmAAe2CGy4BCYEcvIAAGgEwgCS5gQAIAsw3gxCpAfyLBikBB4QAQQE0gCrEAQOBANaAAAyAEJEBKIAQM4MARAFrggcrggAWgAAiAWuBBtyBE1qBC0WBFIcDBkkbgQAgARKBCvyCLo2AABeBHYmBAZiHC1cBCYILNgMJIQOAAT4DEiAFgAEtgQO3gwOngQblgQf7gQFKAiIDgRJgARCAAHmAA8aBAE2AAWKFA92BFP6SAzOAAcSEAQ6BDLSFABuJA9mAA0aEACKACFKIB0GIBA6BABaEDIqBEZ4BEIMS4QEShiIFgRQ2gAblgRF9gAFBgQlygApJATyHD58BLIABXQQQIBdGgAhVgAP9gCmBgRG8gBgSgSYJgAARgCsIhBCHgBVdATiDBbyCGDeAEh6BFXACKHSBGhKAEj+BEiaAAG8COCCBFbGCHLUDLCIFggAugRGXATCCMO+CADCBKiICLAuDAfWAALuBA6QBBIEBXANrIAWADK6CIFMBNIMemQEsgBHXgwRwgAANgAHoAWqBDNSAACeBAd+AASWBASkGSSIJGyIEgAA4AQmBAGqBAeyBDPeAKH0DBGsggQAXghaAjABPggANATSAIhiACoWAARyDAKsCCUeAGWmAACmAAniAAJYBCYEdWIENZ4EpH4ASW4IRpAIIIIIRpAEEgABcgAAWgRrdAReDES2AEuSCLQUBFIAAF4EVt4ABVgEgggA6gBKxghF2gAPSgRpygABDBBtqQYCAEdyDERiCEMIBRoEAE4ASrYIUOIEOEoEwBYEIfoAAGYABKQcgDUF7IA0bginVAQ2AAJMBF4AAHwENgACZAROAAAiAAagERhshGYMokQHSgwiwAnwhgBFJARSDIBcGGQuUCQEMgBQrhhKngAEhgAjQgAAHgBMngAM0gANCAQ6CB40BEIIatwMCQUCAAY6HJ++CC3OAM+kBAoEz6YEozoEz6IAEwAEOgSBggCGaAQSABWSABh4BDYEFcoEUpYAASgELgADJgSBEAQuADc8CIA2BC+IBCYAEEwQNIAtrgy1rgAmIAU2BLUWCF5sDCSANgAx/gQjUgwArgQAngAGUARCBAEEBCYAAFQEPgBFgAnJBgSOIgAT9gAjNgCFFgCFNggAPAwwgDIYho4AEeQMIEAOBI4GDGTmCDf2DGS4DDWoigABVgABykwBQAQiDAHOEJoqBKSaFK36BAzKBAFKDIP+CAFKDGTOAAFIFCCALSQ2BKDyAAAmBAD2CBmeSAGABDYYm5YACU4EAOYIm5wEIgSUzhCssgyLSgQA5AiAIhQA7ggAsAgcggBa3hzCagRAagAeogBnCAQ2EIgmCJYOBBtWBAYiAMqwBcYABNYEigoEAooALkoEBRIAABwFrgASngAAiAwwhCoINNYMYJIAAEQEIgABhAQqMGcCBIqmGKOyAAB+BBEOABdaEI/+AADUBGIEUFYAAEwEMgRDchQBFigAmgAAfgAAYAxQiB4AWoQEMghnEgAAPARCBM4gBAYAAEIEZxAENgAVJAQ2ABLMDByIKgRnEgAEiggAwgANvgSLMgAAQAQqCADGBBU6AA56EAYaAERaBBkWCGaOAAFEBHIEA8IAYPYIZo4EBnIABZ4EZo4AAjIAAR4sZowEIiBmjAwwgEIQZowEQgQAsghmjggAKgBmjAQqCGaMBCoEFQAEYhAC1gAAoggDZARCDAQ2AEM2DANyBBo+CABkBFIYAGQESgw7OhAHKARGHAgUBEYsByoMB75ICigEShALajgA0gAIQAhIQggX/gAf5AgcLggCYgCi2gQbegQRJgBgtgSVlAxpBfIArbgEOhCPzgBBTAnEbgilIgQBMgRD2AwdLG4IAOgYJIA4gB/yAOmaAA8cBEIADFwILIoEEAocX2wE8gAAHAQ6ABceABA6AAC6ADPwCIAKDAC6CBk2BBluDF6qBACyBBluBBFODGbKACAYBEYEk9YEAHIIFKIAHO4EF24EFI4AMrYAaOYEf2gUYdHILCIEE6gUFEBALS4AZSIEXDgQEf0F+gh43gCExgQZmgQB7jRd4gAAdgDOcgwAXggZyiBePgRj8AR2JF48DIAERgAengQCcgADkBQAQAgsQhAAehBfSAUCMF74FDxATC9KBGSuHJUObGRiBCQyhGRgBtIcZGAEmgQ5DgC0QgAEFgApqgAYFA0giBIATuANBD0uCGwwDQYH+gAVDAXKIGSaCGR6CGSgBIIEAKYMZIYAARo4ZIYYAFI4ZIYAZXZ0ZJIEbaYsZJIAAtIoZJAHEtBkkAkF+jAFmAXGAAWaLABIBH4AAEowZNgEGgBk2BIBEASOEGTYBEIIZNgEXhQFCgxk2AQyEAYqEGS+BAm2GCKeCB1oBA4IHWoIOVAHAgwcYgAAHgRybgRj2AiEdgAAXgRlTgBkTghlTgAe0khlTgRlrghlTgxk7gBAWgxk7gggFARyFGSsDDiESiRjzgRSCgBlTgiGmpRknwwACgAHmgAG7A2sOH4IZZxszNDU2CgsMDQ4PEBEDAhQVASQAJhcYBD4/QEGEGWoDCwwkhgAKgSRZgBlsgw5aghl2ghopgxl2AQqBB/aBDkmAABIBDIAMGQEygwAKghZ0hgFiAgwzgRBnAQaDBQmACgQBN4oWMgEGixYyAQaBDGKBELGBEP+AIPWABKsEn5YCR4E45oEAWwEogwBZgBBNASiBBf2ABMKAHPyAAAICECeBAwcBHIAPLoAALgI7AYEpLwEQgABKBEECECeCIJ8BtYgXUIAEFYAAYgEzggCrASSBNr6AAlyAEFeAAwSABT0DdEGAgANugi39BWpBH3BFggMhggjBAwBBuYsMaIAAQgEHgRafAQiDF9EBh4AO0I0AHgIEdoEDxwNxIgmCDTiADUYCB02CAMYCIgqABwcBCoAMXYEpvgIoIIAhFgQFT3ENgBaXgAWmgjq4Aa6LDeEBA4AUYwEyiwFGATakAUaCC9aABpCCEhWTAKuAAbYEB0GAwIE9nYAAHQHYixL5gwHTASSEGF+BARiCBDKBNo+BADaAOBGBBGSBNOyDAAuAAXcDOgAIgAc+gQArAjoAhDv/gQGagwGPgh0kAwJBtoUTRYEIwAEGgwDbgxlvA0UNNaUA24gAmIEOToEMtwMtABWCJPSLAJSCCIaKAIoBBIYAigG3kACKhQFlgAwMrgCKgAD3gyK8ggFzgSAWmQCYgQKskwEiAbiLAJiBACSAPBsDQYAIgQGnAQeCERmFAKmBAASLAKiABLyAL4CKAKiDGqKCFq4BNoIamIICfYATlIEAvIENJYAP34EI8YIDV4AAaIEAo4AFvIUArgEogACugBvykQCuAgwohQECgQAngg2oARCAABSKAdQBMqcCr4AICoECWoADh4ADj4A8y4ECc4QDlQQYdnJygwPpgghuATCAAScBvo8BJ4EQVYMIrYEIloAC7I8O8YARF4UO8QRBAiEXgAEShgRKASiMAGGDFHsDCyAdgB8UAg0vhB5PgRohjBoGgBhuhBoGAQ+KGgaFAOyGGgaHAOmkHk+BHkeABjsCpDyAAE+BDG+BHWWCD+7/HlyXHlwFqDxBsDyCJqEBzYAABIEACoACM4keXYAAGIAAEoAeFQMUECmgHl4BrIAAUAHNggfagikfARCJHl+KAEuAASiCHmCBAdIBqIEBK48eX4AAQoceX4MXxYE7jIAR8AEGjR4bATKfHlSTADkBKoEAGYQeVIAZlrceVIAATgMGDDCpHkoBBoEAfZMeRAEGhBizAgwtnh5AAQ6AAAoBDoIeQAINLIANIZIeMwEMgA+mgQApAWuAEDyLHjOBBBOFHjMBJ4MEC4IPyoAECwErqAQLkh4hgTmHjx4jgAGbAWCAAD+AHiOBAYyCHiMEBUEeSYEl+wFNhQfBix4qASeKHiqACNeIHiqAFZqDHiqAGWGCHiqDGCcBC4MeKoIcm4QeKoEa440eKoBFTIEeKpgEJIAbR6EEJAEKgQBpgAS0gQBpgAAMjx4qiwJ9AQiAAMaLHioBFYMLkYAAB4geKoAADoALnwIhDYgeLoADOgIiFoIBJYweLgEmkR4ugR5DiR4qgQHhgBGrgT0piBrzARODGvMBGIYWcAEGggEFgRdSARODF88BGYEXT4AdNIQXz4AAvaQeKgEZgR4qhjOpAQ2IASaAAAyFHHIDBSAKggEcAiAKgwEcAQ2LHiqAPQqFHiqAHbyAAn2CAeIBCIQXCIEUcaMX2ocAZQMFIA2eHiqAFOGAAgaBADOMHioBBIIAu4oeKoAgB40AlwEkqACXhAIbgACagBEXgwIghx4qgBnHjQBcASOpAFyAHiqGAFyCHiqAEkSEHiqAA04BC4AA8oEVnwENmx4qggglgQUNhQG4ggZKgQHPgBHwgwQmhALIgBLdph4qASWIHiqBAuuEAwCIHiqHAu6MHiqCADugHioBHogAQ4weKoIAQ4YeJAEWhx4kAwUMK4keJAQEQQZJgBGXA4ICSYIM3aYIsIAFjAIOaoAFFAFrgBo3gQV9AhJrgSgDgRaRgQ7CghaJAxwiDYEXF4ADkoEWwQQgaiEhgAOXgAAMgxtmASKDAA2DA6QBI4EACwFUgAOkgAAHA1AhGYEABwFAgQLIgQ7QAQOBAAeBFheAAAcDMCEkgga/AQ6BA3KFBrSAMJuAAAuBPrgCCGqAGKGCRckBcoIKeYEDTwILIIAroQIgI4ID6oE9DIRBLwEGgQP0gAzngRl0AgR2gQQWgRuUggHKgBtZAy0AAoEZSIEjIoAcU4ADBIADpoEK8QEGgRshAQmAEhWCHdGCAC6CBO2CA9OBEB+CAJiBIYCBAt2CBk0BCogAqIIAnAIIaoAAT4IAeYABAgEEghqmgTyKgBoEgACJgTF+hADfAQqGAv+BAAuGAN+BHPOAANiBIeOBAOYBC4IEyQEihADfhwDbAQiDG+kBCIEDFIIA24AWuIFK9wF/gACWgQC7hEUegRt/ggOIiQNsgQXvghDsgD8SAQOAGuYBGoMAgQEDhAAfgS7tgQA4gACHgQNhgAC3gwBsgwFHgAEighuAgwDaAWqABVgDDCAfgBjwgxs/gBo+gRkcASSBGzyAAdABxIEbPIAbOoAGaoEdGYEXa4EBVAMOICCAACiDB4KAAIkBC4EFmQMOICGDABSBABGAAESBIhaBGQiBLWeCAbKCGvqDAbKCJUSCBpCBQrGBFawBDoEaioEAfIAUzgIiB4AXcaIANoAWOoEEYIAANANrIQmBFnYBDoEET4EAhYAAB4AUuYEZh6sASYABKwEJgQRuAwlBA4EXlogAOoIBtwE6gAFnhQJ/gBT9gQU7AQmAAFWAAjqBAFWAAAeDB5KAFVGAIMKGADwCCUGAQciAFsuDAq6AAJyCAG+BI4ABDIAcS4AAqYQAKIAADIQAZIIACoIAZIIAVoAuT4MF/IEAcoAQJwECgEqvggBmgAJNgQAqgAA+gAWPAUGCC26AEB2EAGaAAOEFLQAEOgCAOqGAFASAABSAAo0BCIMeHYAeG4EBAIId3QMIDB+BHsCBAhmBAqWCAh2AEOGAAh2DArSAANKCCKeCIUuBAf4BGYcALIcDI4YALAELgQnQgiGTAw0cGoAhdoAAFQEbgQDyhgE/gQMegCAsgBsOAU+AJNKAInGBRAiDKKqABPMByJEjD4ADpIoIHIEeLIQjDwENgQNNgAZtqwgcAiANhSMPgABAAgAigAZLiCMPAQuCHV+BJjGAAGmDIw8BE4AAlYAANYMf8oEYgwEFgBvMgBqYA3EgC4gjD4AKDoUf8qUAiIAKLIMDnQELhiMPAQ2PIw+BAFmBARuMCKwBDYIjD4IUw4YjD4Ao2AEIkSMPAsg3gwAblCMPgikPhiMPggSDgAAhiCMPgE4JgQqjiQGGgAC8hADuggqTpSAOgADHhADOiCMPAQuFBI6DIw+AARWBAOaCARWFB86AAjQBDoEPNoItz4si/oAK7YEMXIQDYYABqoIUX4EePoIHUQEKixBlASSkDFqAHwYCIA6CPQmMHZuBRLMBIIJFh4AZO4EHXAFGggecgBHOgSDHgRD4giJGgRGLgQJPgAG/AQODFGGCAJaAADeABK2AAl2DABkBKIEWV4MUcoQQToID2oARQoERQIAZyZwQ6YIAZwIbRoAAMQMAQeeKCOKABVUBEoEs7oMmkIAAEoEWqAGAgAS3AXSDACaTEMkCvf6CHleCE+wCAHGBR/+BDhUCDB6GIISABHKCIGkBBoEBaYMAFIAAZo8AHpEAMoAtyo4AFIISxwHOhSQ4hA8Fgw8WAQaCLAKBJDgBCoM3joMOnYAA2IEANAHPgwK7gRZ7hyQvgAECAcyLJC+CAZIBVIADV4sCvoAcOgIgCogkL4cERKQqioMDp4EdGIwkLwLIN4MHGYAcjIgEPYokL4EEPYAZxYQEPYEHvoEeaIUEPaUAgYsEPYUDW4ABIYEILoAFPAEKggChgB0vggN7gSfPhARFiQNfniQvggFgiyQvggQbgQ53gRBpkiQ0gAFkAiALhCQ0hQQmqic1jAQmgyQ0hAQmgyQ0iQDFgQ03gACEiSQ0AQ6BNTWAKX6AAMCHJCqCA9GBAeiCJCoBBYwkKoII7o8kKgEShiQqgAoUjSQqgQBEiCQqgAAiiiQqgSIugCD1gyY+hyQqAQuDJCqBAB6FEUGJJCqAD/eLCLGOJCoBDoEkKgEOggBNgAUThiQqhie/iANggSkGjQAUhyghhwAUgAA8hQHzggT9gThtgQEDgSvPgA1nggFVhgx4gRJ+AgN2gCFugx28gAWWAWuBEYEBIoQMngETgCNogAh0gROFgQA9AQWBTJyAE4qBA3aBCDMBBYIByIEMposbGYAABwEEgQR9AUeBBP+EBraAQr+BEt+DJKcBBoFUmoMVwQJBuYcSlwEUgAkUgxbyggFegUXxgSzagBKWggHqghZ2gB+hgB93gRtxAQ2EAAoBGIABnoAABwEUgQHEAQWBAgOADNGADKuAAZaAJEyBGriAHTkDC0sbgRLQgAAmgAoYgUSQkBjMhBbrgRL7hBeWhRL/gQD0AUSEEuyEEvqAAF2AUSqAAL8BuogRLQFEhhf9gQDFgQa0gQaohA93AWqBA80BA4UAx4EfrIFE1gEcgVWbggK2AUSACHiAABEBIIEkc4MSC4EAdYEIMwIgA4IU4YFRyoECQYEBGAJJG4ACPpYYaoYAygEFhADKgQB/ghOugA40gADCgCDkgimehBfGgR4Ygh2qgADGAbuSAM+BDNOFAM+CFNmVAM8BJI0AzwEo5ADPgzYliQDPgRzVAkG8iQJdAQWBAfWCBM2HGfSBLvSgCEWDAJyFAJGAAuIDLwEcgU7wAwBBmosJgYIXwIcYnYQaKAFBgDowgCb7gADwAQmDG1GAEhiMHMyMGIKBBGqAFDmCBGgBFIAACIoI+oJGeqAI+oEIpIEjc4IDkgEggVLLAwBB0IoFFYIApYAF6YQXyYIAuYMHo4AAGwEWgRaWgQCpgywOgSwfgUAJpRC7hBN5gQVhgTTHgAlfgVNMgySngShjhyhiAQiBCvaAABCJKGKCCw+WKGKAAG4BOIFKtIUoYoMokI0oYoAAmwEsgQG7ggYvgAbRgQfZAQiABZaFKBWQKGSCKAcENCIGaoAAJwEJgAAngU8ugCWJgSWNAUmBIagBCIAAOIESw4IoZIAAI4AFIYAQBIAmeYEoZIAAlpMoZIFO84AC74IowYsoZIIPXIsoZIAE3IMnnQEEgQGFhChzgEyChShuggDOlShphQKmhwrPgSEqgACmgwq4ARyBWaKDBweBCtSBEQ0DCBAngySPgQALAigLgQFbgQKOgAAHgijxgQXauSi4AQWAKLgBBYMouAEFggCVARuCS8kBHIYouAEXgwJkgyi4AQuAKLmADMQBEIMouQEXgyQjAQeHJCMBJsEkIwEKg0DqAw8QP4UACwFxhwALAR+AAAuMIosBCIAiiwLXJIApQoEhuoFPOAIQNIEiQYArJAIAGoIC44EBY4QiiwEcg03ZgFWegwCZg0qfgQDqgwE0BQRBmgVHgCtdgRpgAYeBA4uFKZGAJteCAx6ADEiAAHmABDCAAXiHA0KBAa0DABA2ggApgwcfgAIdgwE5gAdfASiFRpUBBIBWdYFFNgJBd4MkNQJLG4EP3IQAEAcDQQRKG2pKgAC2gBBCmCI/AwRBKoEQgYIAqoNEToAEcwELgTCxgAB3ARiDDqYB8YIEpIMwDgMwQQyAIUgB8IEY4IEEOIMAsQGIgACHAUqDBgoChAGAGdYCAkiAEoEBwIEIAgEDgBUKgAAMgAJHAcCBUPkBBoACA4MbX4BPNoAAKQIgcoMJdAFsgSUUAh9wgEChBEEfcxCCCGIBbIIX/wQALwEygQAQgQAJAzAQPIEBSYQNAoMFQIIAm4IBLYEBOIQEc4EAYwMEQTmDUfqEBXiCAC+DBhqBGYqBA0uCAHqAFVsBH4IOl5MAHAGLgRxvlQAdgCEOhkzogyMXkwAoggoV7AAcgB77gkjPggGQAQmAAeMBQYBGy4MDzIIBroE2lwICSIQBjpEARgEggBKFlgBigQfVjgF+ggLUgwKigALmgATxASSBCv6BAyaADEWBHtiAC/OABRKBCq+BBPaBAvqECgeCAF2CALKABLGCAH2ABpwCR0GBBGYDCBtyggC4AQOAAAiCXdOAAAgBEIEITQIbcoIAhIAAX4IG1IUATYMcQIAKH4QASYMAqp4AJoIi0YMAKQMvAQagAE8CLQCBE4mcACa9AX2CALeCRYWcAI6CVlmBTU6BCvShAQyZACaIAQyAAcABC4ABs4IYxIAEG4ADQ4EGn4EAN4IDUoIdZYcKQwEgglsygwOBggRbAcWAJpkGBQIJCQkDghSLAduAMFmBUaUB54EMLIJaAoICLoIoTocAxoAHbwIvAYAG6YAG54EOLYEAbYEEaIFD+YImgIJPvAFPgwPrgAoXghm4gADSgjGCASCAAL+BFpGGHtCAEbuCBzaCACMCLEWBBHgBT4QZlIcA0IAARIAGpgFrhQDTggBJhBIwhgLcgRWlgQwTAQaBBPaDDvKDAuuDQLmQAIkBBoUAhAEUglKdigCHgAClAU2RAIeBAL2GAVqBAVKCE+KGCbyAAD0BHIMGEQEUgiBzgQAThAEjgU1PgADvgkaLhADqAQePAGOAGPeAABiFAGOGBTeCAfuAAEqEChWBIPmBC4SDAQqEAiGAEzyDDAaBBb6EAjOGALeBAjCBDuOEBQ6BAIGDBg+BYPKAGBqBB2OKAIaAABaPAOkB24IA6YYARIIre+MA7IArFq4A7LEA6gHniQHLgQNXgQDIhADUgBdjgh1RhQCpgRPDg0tnATCXAImGAB6aA8uJBwaBAIeNBbiBKUeCAs2CNmaCAAqCD66CAAqADAaEAAqDAI6CK3aAADgBdIFF84FJqIED8oAIP4E0NYQIV4IKc4EE/YMHFQMBEDWCMCeFCOCABQQBAoUfnwMCQZSBESaDRHaFAFcDAhA5iABihBUJArQtgwxCgQmrgAAdAVyBYO0BToFkWYELnQIDaoE8xIEADAFsgAOmBEEBEC6DACYBbIId8IAGfQMQNkGABXSCAAuAA6MBG4MA1oAAVgFggwBAgQArhgHzgAANAqAtgUiugAFNAqAtgUhTBCgCmC2JB3SwAB+DAbCBEg+BFD6ADCuAIAmAACSBHxWCADSADPGAEk0BdIQAt4EPK4I/IIIAToEABgKkLZsA+4EQsYAB448A+IUA9IJhNYIBIwKgLYIObJ4BRpkAToACNYMBRIEBv4IjWIMhfYIAy4BF/QKDAoIVWYYBYwFsgyVogQHaAgFFhwAlAklxgA+VgDioiwAqgSFHgQ4ygQCVgBbHggInhgICgi3iwAICgQLsgwEMhCrJuAEMAQeEEWKAAK6AD7OCET+CAO+BWueAMvQBAYFJ0oANxoEV44IPA4Id/IYACoBi0YEzCgGCgRtkgAkGgBFoiQACgAT8gBvygBE6gR4vAQiDWXWAAAyAADWAGfSBAAqBTyuDAAqAAx6BMjqAAAqAC82BY6WAAAqAIKKAXYaBAAoCB0eBPR2BGMCBHoSAE+mBFdOBE7YFA0H6AUmBHreCEVuCP8iAFd6BBAOAIsiBAAqBLMWBHMwBCYJN1IEcrAEJgk26gRyigh3DgC/CgQAKgRDHgSJ8gQENgAnLgBRfgADUgl4Hgjl7gQcFggHjgAMggQMJAQOANLCAL3eCAHCCAyyCAyqBZB2HC3aBACuFAB+CBNeOA2qOAB+BAFqACAOCBaiBG20ELQCQIYADdYASjQJBhIEffYoDe4Au74IuRoMCfoER6wKIE4IAHAGIgCTjggKogicSgQOYgwyqgwOYggKUgQB/gRYUgQHmgQQ8gQNUgwnJhgDMAQOMAK2GAB+CAE2OAMyOAB8CIAWBAB+CAYmoBDaEAJyFBDeEACy0BDeAHeiBAO2BTj8GQQxsQZgggGi3AQCAM/UBC4AATwF+gBmMgzFyAZqACWiBV9gCQX2ANpSBNKSCADwBBoExVoYJ5IAA3oAExIUGCYALCYAKHgUAAQEBAoJU3IABewK4LYMDoQG8gAEKBXRyIgY7gAASghDCAwNBDoEy1JQLLQEGlwyqgREjArktgwyugFXkhQBdAmt2hABdBANBDWuCEbuAAt+AANEBNoAAHoQAcQEKvwBxgCgygQDAgQBzAkEJhABnAgdqgBRDgQBlAhAtggUQhAeaASuBT62CAaqAMZuBD8SCZkSAAA2AFxmFKHuBIluBDQqCTg6BAfyFNAKABRiCAAiAAbuDKOeGED6CACKCB7yDEJiBJK6CBVcBGIECDARMDQMagwhCgQHcgWdXlQDVggOQhAAqlQAjhQhsgA+ymAAmggAjAy0AM50AI4AAC7sAI4cAjwEKnwCPg1EKlgAjghUlgh/cgGp4AXaLEJCDAyoBGIFniAFKgwbIgGaVhlyIAkULgjTzAfqBJyQEQXsLHIBP7og1CwEQgAxhhzavArsBgDaMgRJwixL3gQ63glZcmBL+gAAgAUScACABQJwAILATXgF9ghJoAfGAE/0BC4FQ1AEBgADEAQmCE0sCbBCBcHOAACcBbYET6gcQQAu6CQEVgTXcAUCAJWSCBtICBkGBOZODDdYCIAeBEoICCkGADTSCZvYCdGqCBOWABPCAScuHBPCAABqAFvmCDXuCV76AF9cCIQmAbgwBDoEj+oFA3YIAQoAQTYIAQIEKeoAADIEkY4EAMoEkJ4AABIFOSoAW2YEZpYAlu4EsBgEQgB8JgiomgAA8gi8UgAA8gjtVgi8UgSNEgCG/gQAdgUo2hAOKgySKhABYgRuOBAhLGyGAOd6ADFEBAYImL4A8H4EA04EAzIE67YIAuYIAQYIeXwIgaoEAZQFrgAkAAgBOhGhRgAALgAIXgQCxAkdygBkegjGogCLQATuAI7KDAFKAAO2AAK6HAS6HASkBIoEJPgEKgwCfhAExgABagwEzgWEhgixSgAANgS5jhQFBAkETgUDJgE+KARWEBYwDAA4CgAuPgT3IDCESQe4IIRVBrgghFIE6bQF/gAARAvANgAARA7ANIYAyQQEBgBatBA9BCUuBaXuAZVyBYOABAoAU7QFxgGnDgARZAw90IoAHPQNrIReDEfCAKZOCDWSABIOBCiOBY84DdCEYgAosAX+BEcECIBaFAMKARQOAFDEBGoAyhgISTIRCNAHggjznARSBRSOACimBACaAQWMDBiAVgQdoAwshGoEk7oAIXwIiDoEBYIApw4BGaoMkzAIgGIIOLYEeZIA9EwEHgyyKAiAQgAFJgCUCAQ6BJMsDGSAagQP1gSZCgl+oAwFrdIMBYoE+EgF2glxhAQeAWWCJAhOGAoiAAbSEAoqAbMWAIcyBUswBB4FxF4AAy4FRjQEGgh9cgijBgEx5gwGwghzNAQyDChSCRUkDAiAXgCBFgRpQgwElgQAYBSAPIgkhgDdshwDLgQRQgQC2gBlMgQC2gRVPgRPWgD8kiACygWIHglmngD4JgmzwgwCYAQCCbV6AAJiCAqODX+8CIBOBAFaDWyCAJKGBAmMBDoEJ4oApA4YBiYQAB4Ifk4AApYEg3gFGgADKAQ+AbNeBPZqDGRkBS4Il/wQgDBsigEflAQeAALIBGIIBegERgQFNgQGTBAZ0IRCCL2eBA3EBDIAvvIEhoYA9cYEBToJKM4IC/IAFUAFKgW2bgDzfggJUgQJNggIgAyATaoACRAPTBkuEAlsFE0HRBEuAAl+CFEqAAtqAJUCCRa0CIA+BAReAAtWDCSCAM7WAUtkBdoEBMoAhOoED0oEAbIECNIMDrIEDyQEAgwMPgT5vg04QgwMdhwOTgAAYAQ2BAAiBAzyFJ0EDDgsrgAFfggHLgATbhB/hgQSTgVzwgQAHgmW8gGr4gW8AgwT1A2BB1IIE9QLEA4JxZYQ8goFV5QHVgRgkgRcbAdWABnSCAAeDUS8BAYEdcoMAHoMlpYAQVIEmy4ADNIEOkoFRBYAcz4EoKoEMDYM364AOYYAIxQdBoIbi7X5zgiASAgFxgXHngzBohBwSgAoagAoQAcCAb+6BABaCIaqBAGiBHKKDbyABc4Agu4FrpIAuKAF/gwKuggDlAyADc4InW4FyYYAAPoEQSIAAKokA8YUCXYAAQ4AYjJQAM4ACoQIIdoEAHoACwYkAHocAGYAC4ZMAGYAcDZMAGYAQuJMAGYAHMpMAGYADIZMAGYA71YoAGYIA4oAdUIEA4oAbRIIA4gMLvQWCB5aCA9qAACGAPKCEXiGBCviAADGAAPuBA60E8f8Da4ER+wRB8P8DgCDEgWqOgXKlgXaGA4CAPIAKF4AAW4IAGwMgAHKBWbqCdRKBHpiEAXaDAVSGAFGBZsKBdD2CAXGDBvSBAGMBcIAAUoEHc4EAbYFjLIIAUoAAUIACKQLbAoEMgANBsCuBD3iAbEmCDjeBAmeDAE2DAA2BMtuEAAuBDZmEAAuAb0qFAAuAALaFAAuADiGFAAuBFMCEAAuADtCFAAuBDUyEAAuBae6EAAuADqqFAAuAQOOFAAuABAmFAAuABZiFAAsBDocACwEPgQALgnWugC0IgiAsgCGJgQR3gwD4ggLZggAJgQGkArArgwGlArArhQKIAQKAAr+BAVIBEIcCyKQBUoYAWoEj/4QBzoJsS4ICuIAADYQAC4FmI4QAC4FxyYQAC4ABMIUAC4FooYQAC4FmXIQAC4FsqYQAC4ABMIUAC4ABMIUAC4E/YYQAC4ABMIUAC4ABMIUAC4ABMIUAC4ABMIUAC4UBMIACZIMBDAEQhAELgRezgS9aAnRygAFEAwsLkYkJeoARooMInocJfAEGiAl8ggUQhQl8gCjFhwl8iAjyhwl8ggBCgTpeigl5gUV3hwl4hGZsgXA+giR1BEHAAjaBDMySABeCTJKBFZGPCa2CB0+BJFCjCa2CCR2DCa2ICjeHCa2ALDyCAFyAbpiECo2CdCiABh2BCYyFLmiAEDOICa+ACMoBToEINYBbzAEggENVgWGnhAmyAg0CgFXfgSjkhgmzgQiEgD5BjAFnhwFihURoiAFqgQh/hAm1ggAXASCBCGuFAI6CBbkBFIAGzwUFIhMhFIwJtQKBAoAJMQmgDyEUQeAOIROBCbWBCUICoBCBABEBD4BaUYAHWAENkgmzAgQagQAbAnQigEraAWuAMiCECbQBDYIXHIEJtIBUJYAAIYAH0QEWhAm0gACAAiAVhQDDgCvAAWqALtMBGoAf6IADdoEGqgEOhAm3AROBABOAE4OFCboBDoABdgEUiQm6BA9rIheBAWuBCO8BD4MJugEHgCKBggs7gijzgAbZgQfmAxggDoEH0gMYIBeBB+0BGIMJugEGiQm6ggFpgQfJgilNAiAGjQm6hQLGgAG/hALIggkiAQaBCSIBBoEJuoAAz4FB9IM5f4UJuoF2v4gA64oJGAEZgClKgEaAgAAoAQ2NCRgBD4AITAQPGyIPgRq3ARGACVaHCRiAAPGACvuADKqCCRiAKcCAUESDMYCCAKyBVimDAmWAUdSBCRgBB4AkUoJldYIJFoAj9AISaoABpgHUhgkWAxJB0IIJFgEHgFQCgkX7g07lgE6/AQ2EMO6DMP8BEYAYfYQJFwELgAp+gAM8gQBrgAGRhAMWggkXgAM1ggyqgSzbgQAYgQKKgAKAhwL8giXJhwkYgQVugTXXgjBOhwqoggGkhAqohgp2ARKECnaCNjGCCncDCwuqgBHygQdSgRY6gTIzAwFBnoISRQQAQYgTgAASgAJJgmzJAkEegwAVAfyBYfaGABUBE4J8a4AACYAAWIMD4YgF0oABMAM7AZSAbC2BDqACsC2DRRIBqIAACIEAEAKgLYEToJIAOZYAGQMLrwKCAKyBD++BEi6BDwKAEkABBIASnYA8xYAAEoF04gEEgxKdgg8ugRnIgxBAgkQpgBBAghPBlAAcgAb4gxIsgmLNhABdgBKdihKbgTJGgxI0AgAQgEX5gwBKhxCmgwBKgjValQAchRELlQAfgAL7AXODFTCUAKiGHhODECKEJI+BD+oBEIA3E4MANYBtRIFAYwGngBPQgkdRggDMAwFBCYgBG4EBWIRtkIUA/wG4hAD/lQAgggEfgxK9gBKvmQAqggBKgiIggwGZgQCAgm76gAH7gQE8ghRwgTkkgQA6BMAtC6aFAKmBAeCEAK2CSie8AK2FAIKCTUqBClABSIJtXp4AVIEAP4cAuoAKgIIB9AQLC/wKgGgFgwarhQX4gRtcgxJugQwyASKAKw8BLIETvoEKnYEDVAcJQf+A/59/gjSsAQaDP3qBDB2BB0CBGVmDBzaCIyOABTaBGWyGBmKABxWCAuoBAYFwOgMvAbyEAAgByIAACAJBIINYfIAMh4E9KIAcroAMW4EAOoAhtIIRcIUWKIEYFIQpGoAOX4ANaoIpAIEBFwWYFmoQL4IACgGkhgAKgACwgQDFBJwWEDCCABCABAKBABABqIUAEAGwgwAqAkH+gYAdAkESgQYjgAECgDVggQZyAQKDL7OCN50B8IBBxIMA2oMF5oYyD4EATgEtgQAygBe6AwVBEYABgIEEEQYoAqwtQQqAIsmAWQ6ACm2AJteAAAqCLFCAABuAHKCBeOCCEYaADXyBHpKBGrSBTt6Aeq2DHmiCJjECECuBAICCBByDdcGAAnOAGA2EACGAFVOABCeANWsCciKARriSBC2NAhGJA8eXAmGBOC2FArSEBC0BAY8ELQJBoIBBjAMaEDGCAoeBJhCEAI2CdwKGAIeEAJq5AI+EAz0BDYEqpIEAmoAAlIIKi4Q3AIRMRoEAk4EB6YEt9gH+gls+ggHogUlaggEXAQyEAJCBIYuHATK4AJgBBYIH04kBKoJuggELggEohABngWwKgAKxgH88gwChgACKAQGHAIqAYzDCAIqDCF2WAIqCAGeCABKHAIoEBkH9/4MBJYIAkwENhwEdwwCTkQEfASKAPaKCAksBDIIAmYcAb4UAGAEEgACfgwHKggQ0AQqGA5iAA+uCE3UBCoJCtoEcbooDk4F/a4YAR58DBYEnV6AAwYEZz48AvIgDB4kArIYEDoEEcoAAkAMJEDKFBHCAZ84BB4IADoEgqQExgReWgH0YgiGJBywLC5YLARKBDT8EIGsiD4AqpIJ1Z4BhrYIXj4INCYEX5oElogEAgk1NAtDHgAhxAdCCRymBAAQBSoKDbwNB2CiDDtoC3BaBVeMBf4MVFIIMF4Fqa4ESWoBXbwEogW3ZgBT/ggDagQCkgFd8ASiAAUuFOeCBLzyBFG+AJjmBVP+CcE6BQtiAH0mAgh2ACPiBAMGAfvuDEqGDBPeCHB2ABO+BNG8CCRuBFoSCbjKDBP+CE5+ANG2AACMBrIEajAELgXQrgwBSgB4bgAG3hQGiAdCALZSAChWEAJCCFVSEcM2GAHCAa6GCLFeCCgyBBgWBCduCAXOAAV2DJiCABmyCAPSAB8iDBrkC0CiCABGCAO+AAISAAF2AABUB4IAMBoICQoIAh4JF4gLgFoAAEYAfRAIQM4MAjwHUgACPgjGlAdSFADKCHwiCAJeABm2EAP2JACaFAB6EATSCIYKGAOoBBYMK4YMMcYEA94INhYN4QoAMKIEfuYEWFAEEggAKgBokgR7JgADfhCHNgQr7gC1NgwsCgBw/iACthEPxhgHcgCshhAaQgwCcgACOggCcgwHhggDKgw8MAbyAAieARc2BGfqAcEqBAmYBCYYCcgEQg3wZAQiDW1ABBINOpoJD74I0hIAKRoI8T4IsCIUcOIYUEYIx1YEMrYMAhIMBYYUK94AxP4IJ7wHUgACtgACUBrwETBshEoIHboIBzoEjGIAv1IAx+IEvNoQAPIEktYAX84A0QoAB6IBSZYQ8YoFDwYEANYEHJQVMIgIbIoIXgIGD9oEqEYEFdAIgDIIV/oIX34se14IU8YA+jYEEIIBIMIFWRIMAbINsZIMHzoAAaYAAfIABpQMQamyDB9GANB+HAtmAQN2AFkeAAIaAAcOBACCDAt+AAMqChuKBRyiAAHaCRNkBAYICg4AB4IEK84KAvYE8noIO3oEI0YAASIE6poIOOoNIvIEBHIEArAECggImgl+igQ5egg+4A0ECSoEABYAtGoAAO4EAXYEAlIQAboEOP4IC/4ID8IM4LIEtKYQBR4EBEIE+HYIJWIAfxIEBQoAFfIMFT4MA9IAAFIEIVQIFa4QA8oAR+4UDbIUTBYEK4oAMuIIWuAMAQbqAAkeBAU+BEJCEAhyBGvEBf4I6nwIASIECxYIEioINWIQbhIMNBoMAgIEFBAEPgwJJgS/RggXIhgGkgoIfgQB8AXGABdiBDj2CAmgBS4QD6IQ4NIITv4JD+IIAnIUNpgEPgA5XASSAFa+DAF2AhreBHHGAbuWBA3yBABGABt6JAraBhVKAA62AA1KHAOsFC7YCAQmABxmBOSyCgmyCAsaABtECOwGAP0sBQYACQoAE7gRBB0GKgGbHARuALHGDDkaBHC4BCoE6ZoEEhoMBAYJ1voEK2ICGroADHoNCyIIaBYAZooF5K4IW7oGMzIQC2IAv24EET4EFjgFLgRBtgAbOgAVegSe5gAQHggE9gxotgALtggDHgh/2ghYqggcdhQAlgHDohgLzggLYgAtugRCLATuAAAeDQvqBCuYBCYJ1KoEAHQHAgwAdAsAVgweagAASAcSDABIBxIBivoARWAIKQYA7hIEEtgRGIgMbhQD3gCTwgAMlARuEAQ+CATgC0AiAATiDDESAJPqBAF6CCr2CCY2ACr2BAHqDBpCAIryAEYeBQNGCekOCB7YBL4EFDIEANYFDOIIikIMBgIIAkIEOsoIcfIQHlYEhwYIPJIAHp4AzgwIDSIcH8Y0OgokPI40AHIgH8YATp4UAXIAH8YMPgIEFqIAU+4EMeoEAC4MK7IAk7AKQIYFBcgJ0IoEWpAQvAYYIiwCmAoQIgDawgwBLAQeAAKeAAjaDCJmDAKsBB4gAq4EHeIEAj4JUAIUtQ58Aq4BY14UAYIAAq4MAYIEkJoEAq4QmF4UInwYJQRxrQWyBF7WCf1YCkB6BOnCDAIyAAA8BoIA0hYA0mYMAkoAaCoIJSYBJAocJ/40AhoIuOoQAHJYQcIwJ/QEEgAqSgzSVhAChhABqhAAVhQCrgACCgQB6gQq0gQ1jgCbRgUgggA4SgR8eBIECSRuAAXgBI4MBeIAW94AC4YANoYMAt4ECGYBEpokRN4AAfQEGhgDakgCupBE6hwFsgADHhABggQe6hgFsAQaGI9oDCUEEgVsjgAjFgAFpAR+ADLCAADuAAAsDoBwigACLhAKigTSwgQK8hAIVgwB/hytZqgIHgYAYiwFnjwCghwByhQLShgCwgRzFgBhsgiF/AqAtgUNygALeAy8BgoGGLYJ82AMvAYCBcryBAD2EAhSDXbubA2+iAiKBETCFALiAgMuEAQ2AiIqDALaBeM2DEKEFswsBCn+DBWuBBY8BIoAfEIEw7YAs9wEbghsvhAV5iwV1gI/CghzcgA6LgQcVgALygU2VgTgkg00Xgj+EgmoygIMmgStDggWEgwVxgQs4gj3SgBVJghVjgABmggTFggDEgATFgR1CggSagQJ9gAFbgQJ9gD2OjAElgAHyAQWIASWNAeKJASWNAByIASWAXOCEASUBBYAB3YMAYIGCjYQBJ4EACwELgQqGgSXyhR4ngRXehxA4hBRUgXrdgRA6gQX4gAD0gRTlgh2whQDmASKCSSaDix6DIeSCA0+CAqaAHluCAfWZA02iArKCI/mBBWCBAMCCEhuBbjSABByDAfOBG0GGD86CfFeBBraDAIqBKraBAQwELwG+FYB2H4YEs4kDRsAAlIEEeo0AlIAF/IAAJ4IBZAEFhQ83gB1chFsFgSoXjQ8zgQ4TgQBtggasjA8zgQJrgi9njwHtjAU2gHcFgyfhgVCZgA/HgQaFhgBxhAAagCs/gQAagkrKgDwQhHuAgQfQjQE3AcL6ATcB/oUBN4QPmeIBN4APrJABM4NOxIIBJgHEjgEmAcb6ASYB9oUBJoIqHeQBJoMqOo0BJoAIQYN+WYIj/4IDkYIKA4At4gFGgA1zgQWPAQiBBYqBCgOAAA+ALiGBBY8BCIQKBwL/AYCX+4MQmoEJsYEQmoGRooUMkIBNOoAMC4FKnYMNKIMOBYCNHYEAnYAOzgEEgAyugkONAQSAHRKCGyuAAWKABV+FAECCBLKBBKWBelmEMPOBABiALt6DABgBDYM9nQENgSpzgATvgQ9cghCPgAAIgj4agAuPgw1cgBraigBCggBjggBagXhbgQDtgQy3gQA/hA+tgXl3gQEpgg9Vg39uhA0ehQAVgCmLAwALg4EahIANGYKMDoQ7zoF2X4EACIVf84ApfoEACoEPggEggS+3gRYHgz0KAduAG6oEAUEWTYAru4AGs4BfxgSggAJxgCe4gQBNgzb1AQGAm8aCC9oDQSpGgUA4AgVGgV/lAwBBOYEtAYEG+YACXwML3AmCAYaBkPqAQs6CAhQBLIEr9oAG34Byv4EAD4AAA4BUXoIruoMpOYMXo4J74YJ64YMCLgJBKoAWwAJ1IoB5b4EBtYACSIEAFwFsgwg5AVyAJaiAAYiBi42BmLaABI6BAGuAAtyBYhyDFJsBT4ASTwFLgRbjgBwAAUWAZfIFIARHcnKBZFuCLJyEPNCADFuAanOALKmBArqCAs6AW2qAHU2EFgOFABOAIpmGGnCHABaBk/WAJCqEGmWHABiAHY6GNKSDLnaAHKKEgHOBARiBAAgBOIIAxoFD5IEAt4AfvoI33oIBBIBEMoEAJYE3q4KLFIE3fYEvroALx4EADYAD8YIDboIAXQFcggANgVH9gDfGgQF/hRk/ghyqgDWFAhA3gi0NhwARggBWggANgQdeg4kngTlhhBrqgn4/ggFjgBCcghjugQMTgn/Tg35DgQGEggJ8gRB6gYGUggSbAiwigjMagnvKgRyjgi+MgQJjgQEkgQDZhAAlgi3XggPbAWyDAEOAABeAY6iBAdiAAWQBBIKY/IAAkYEuKIE0KIEASIEDw4FFAIQBIAGwgARGAUGDg9SCCUGBAHCCALCAAEKBAAcCtC2BQI2CErcBtIMAGYEwFoQBe4ADUYNBOIIAkAFsgSTPgQCLgglSgQChgwBBgWkGgQq/AgVJgDrTgABhggBIgQC0AVyBBT+AACMCxC2BHueCABMCxC2CDtUBBIM0JwEBgAMkgZ9RhAFCgTZXgSIAgQL+gQGtgBpkhgD0gi8LhAAlggCygQLVggmMgEILgCo5gQBfgpJ7gwCggTnLgQHphAESgomvggFZmAESgEgVhBOsAWyDA1SFARyCAYeCBo6CAnCCP+yBBYqBMs2BG1iDATaADQEBA4ICP4MBLIGUmoMAjIIAOIUBLIAAo4QAPIABToMAWJABJIQBAYAMkoAKeIQDy4IDCIUD54EBDoAy2IIDt4QCUoFG+IAD0IMhhoAQtAFFhQO0AQaAYV6ElV6CAWODgx6DAKgBOIAFMYIMfINHdoGAO4ID7IAE6gEagzHAgwGWARqCOzWAGJmBA/yDA0qBAwGCAWGBA7KBEucBQYBa0AEDgorSAUGAQkuAHV6AJIUBi4Muz4JjnwEQgAqkgy9fghfJgGs+gRqTgZSshAVsgjkFgBo7hQJxgBT5ggN/gi+VgAAYgAANgUSGgQQ2ggANhAPVgRptg4FPggBdgWVqgwAcgjVdggAWgACQBBALC4SBHe6BADKAZCeCBEiBJ6WCBAOCA0SCXCyCANGBAiuHHWiAOaYBGIEyp4M4rIIAcwEwgh73gUB/hBGLhQAThDpohABGgACkhAf2gAS4gAANgSI8BQuECQEPgQd3gSDogRk+gR2ugiSDhwByA3RBhYJaSAEAgTcpggARgAKzAoYCgjy1gzCEgzmvgTU8hABuAVSDAriDAoyABwSCAe8BSIEABQNYdHOAgKOBS3qAAA2EAq4BNIAfAoMWcIBQpYMU04EHUIAJTIIDR4IStYQBlQEsgAB5gUUWAgNrgQdtggQrAhA6gjXFggD7gjU7ggT1g1N4ggA0gDTFgwNagTR/gQARgTTFggMWgAAFAXCABQSGCQ6SACqBjzybACKCNd2CBnaBhJqGNd2AEVyBNd2EFZ+DJUqBb16BUiSBXVmBDn+EEKyBRMCAF8QCkCOBCDCCDVyKADaCAHsBdIIA34EE34ABP4IADQKkLYEUSIEAlYFFVoABgIMD3QKAAYUeEoIV04AN6wFgggGIgRz7ggEkAUiDB7EBbIMEXwE0gBfTgQGMgCyFgQGCg0X7AVSATfeBAa6BLTmBAEmCAPaEBdeBFIqECR8DEHRzgE6AgXH3AUiCbhYBDIMByoAlXoIBx4EWIYJfWYELGIMKUoUAkYIpSYI1A4QAV4AksIA4K4ILfoM2+ocEuoQAd4IEIYAAD4FUqYQCQ4MCbIFU7oMBjoECXoEAGYIATYILMoIANYEASYQ7S5YBxogaprAAH4ML3IFSwJQBvYQ3FYMA1YcBTII3FIIBy4Kb1IFEoIQGToALSoE3GYIAwAECgzcZgQQXgjcZgwBGiATxgQAHgztQgpoMgaJtgwY4gAFgAU+AR+2HOqeEAF6CaZKEAF4BAYQ6V4GXJIE6pI0AXoI6pIQAYgEbg0YtAqAtgzpRnQBPmQCtgUaZgAdfgSH2Awu+BYARsoID4IALqYAD4oMKa4Kg0IEACYI03oIEUQFqgRSLggAdASyAA5qCBJaBB1SBEaaBlb6AGIyFBa8BcIAKVoFeh4QCR4AKY4I8vYQGL4EAHAFcgwR+ArQtgj7kgQuahAh0AUSBAAUBTIEd6YMRy4FEIoEAioABCIIG6oMQ7IAADIJD/gQgCE8bhCWjgAuDhAmAgwyeghqkghjOpQA7gBe5gA3PhAhogIXWgkb8gQJEgwV5gwFiAgRqgAcmAhA3ggASggfYAXSDADCBB9GBExCABYmEAneBCG6CAP+BQoGAHleCHDuHAzqBDQ2BAzyCBA8BWIAxKIAFnIAf7YBRFoEQJoEStYAAfoKUb4NAfoEqL4AD8gEIhAAmggDogAAFgEpLiAXCggE3ASKAUjSCA/uAHNyDAwWCGs6CAWSFHIeCHayCWIOBGjMBhYEACoQCHIE/0IUJbIMJaQHEgB9TgiMLgyUbggEJgCM+gAJlgWAGAYKCOwqBpCIBAYAADIAIhYEjHICKGIVKgIEDQoEISoI4p4Gc0YIPTII8CoAAQoGlpIECroGKCIEAB4QM74AHjIAUI4UAQQEBgp+Wg4b2gQCPgA0CgABDgRRxgAkhAwurBIAflIEAGQF8gRlHgCjfgQAMAXiDAX0CjAGFDTuECuUCLGuAAuOBGcCBBUoBA4Bh7YIFgAGQgJACggDbgAGVgAxUgAA0ggWQATiAHMmBoHWBURaABZQBB4I9k4Eq9YEu9oEE04NYIoEACoIAmgE0gB2AgQGYgx0pgQrWgF3AgQv/gwAvgBnzgk6gggAyAiALggiTgQAKgVo7hAANgANKgz4KgT34gxIwiGYwhj3/gACAggAtgQV9gT3QgAANgAHRgj4FgAv0gTEugAANgDpAgAKSgTEigAANgAnHgABQgTEWgAANgD4OgASegTEKgAANgD4RgAGDgTD+gAANghRqgQVKgQc8gBAMgg9KgC6rgT4XgAeMgSC4gz4egACfhD4egRB8g4WQgF9PgQAKgkAHgB3cAQaDRdOAETUBBoOhO4JbW4Ico4AA14IU84IeS4Ja5oBt5oMCFIAC7oMn2YAC5oBKAQEggiLrAQODTo2BAPmDAXeALCiCAAqAABSBTpcBDIBNGIBf84IDCYED5gEBgQuugS53AiIJgQLOgRlLgQAEBUkbC6ALgRwpgwlzgSoZhAlzhQl1ggIFiQlzAUWDAheBCXSAQJyAAV2AQuKCBX2RCXOCAmKaCXODB/WTCXOCCWyAApWFHAOCCHEDNgJ4hAVTgGUYgAIVgSJAgABPAWCBToiFAFABgIIA74EC3YIJoYQEdIUJpAEEgAmkgwf2gEy2hibRgh5MgAulgAH9AUGAAUODADWBAGeAVAMBIIEA2YgAbIIC3AF4gqObgwjoAQWFYMiAABiJB5GCBjeBA0KAAAmFCeiDCogBZIAP7oACT5sHx4BQvccJ7YEo3LQJ7QF4gR3fggkrhAF8gD9QgAeegACMgCjkgRsVglojgQDdgwahAaSCAPoCoC2OCa6AHeWEHbKEAiOBBQyCNMyJAh6ABZiVBc+DIGSLCcqCGiOECcsBeIQJy4MCE4IJvAFohQnZgQ5zgZHUhgl5AVyBUIeGCCoBBIUIKoCjT5oI14Kk+IAACgFohQWOggX+hAT38gnUhwm4iAlVkAmzggLUlAm2hANigQoOhgiahgoohgD6AQSCobKDAVWUAC6ABJiCqZ//ASGHASGCAgjoCouGAmG4CouBBF6AjxYDAAs/gg+agQAejxcghj/GlAAfgAAcglI2AgRAgAGUAQOAAA0CgweBN1qFP2KAENOAIiWBLjyATW2Al8aCULCOdeuFDu+BFfgBQYAjsIAAMAF/gFCoAQaCpL0CAEiAP46BE52BFj+CMuiAVRiCesqCBTGBNXiBF4mCBtyAF3qCkRUCCEmBIbwCS3KAFfOAUuKCBRCBdj8ByIAJjYFUz4MAcINePYNXjIEFY4KaDQJBKoEQioABX4IWuQRC//+BgmzZAVSAAAwDgICCgFF3ATeAW8SATlOBAWaACXmCVmiCFoOBAAyBWtqBCt2DVJiBAHWBI8+CAOSAAHeBVUSEABaBT4aJABmCAseCABcBTIcAF4JCFIAAHQHEgR6TgABegFkbgDjKgAAJAZyEMQgBKIEAD4AYXoQAMIEEgIFkuIAARgGcgSwPAQKAXrGAe+eDFRQBOIJXqYAE84QACAFEgks1gpMgg0Q6gAGRAYCCZ2yAQRSAeNaCB/2BAH4BiIEjhIALRQGEgQCOgCoZgGkkggpUATaCRV2BQzUBbIAFngE2gAQbg5DfAhA0ggHdgACMgBN2incXgACngY9Wg19ShRIZg0G7gAUngRpRgQokgWVJg0G9BEE5QSqBJY+AAdSCp0+CK4mBAv6DS0qCNWeDUoqACpeAS++BAGaAE6ODCCuEQ/oGQYgRNgK4gI+lgAALgB8IgBRvgo+xgHpvAayDABWACJaAALyBABUB4IAAFQGggwAVgAijgADfgQAVAX6CeBOAKpCDAL2BAK4BLIAGIoRbhIVEKIIoEgFEgDgahDK+ghZehQuBhkQhgiqgAiA3gQbcgQCrgG1ihQAShEQ3AUiDAReAMFsCDGyAGOQClCCBCVoBNoALK4EDbwJBkIQADwGMgwAPAZKEAA8BgIMADwGWhAAPAXyBDmACC0ODGVyBWjCXGVyCDWuBOE2CGVyBAAqAATmAeSgBSYIEGgMLC+OAjWKAAhQEC6EEaYCzYAVmZmljaYCy5QEgg7TZEwAxLjMuMS4xLW1vdGxleQBpbnaAs20VZCBsaXRlcmFsL2xlbmd0aHMgc2V0hgAcBWNvZGUgiQAZD3Vua25vd24gaGVhZGVyIICz0wFniwAyAmRpgLN3AW6AtAmKABYDYml0hABHECByZXBlYXQAdG9vIG1hbnmFABcHc3ltYm9sc44AGAJvcoYAU4YAJIUAVoKz9IAAXYC0QAFrhQCmAgBigAD4gACaDGVycm9yAHN0cmVhbYQADYoA1QstLSBtaXNzaW5nIIC0pwQtb2YtggBHgAAlAmNvgLQtAmN0hQDjA2NoZYoAF4QAmI0AFwRkYXRhhgAViwELASCBANQFZmFyIGKAtJABAIUAVwJyY4EAgQVtYXRjaIYAMgF3gLT0BG93IHOBtQOGATuCAN4DdHlwhwATiwGyggDQjwB1ggAWhQGvBGNvbXCAtSQBc4C06YACDgR0aG9kgDInEwwLpQIDAAQABQAGAAcACAAJAAqAKQcNDQAPABEAEwAXABsAH4CVbhYrADMAOwBDAFMAYwBzAIMAowDDAOMAgAY4ggABAYCMAAIBgYQAAgGChAACAYOEAAIBhIQAAgGFhAACBZAASQDIghjMgK1JggCEAQeAAIABDYAAegEZgCkpATGAA4wBYYAARgHBgEjqAYGBSOyAQBYEAQYBCIApDAMQARiABbwJMAFAAWABgAHAiQB4hQBwhQBoAYaAAAIBh4AAAgGIgAACAYmAAAIBioAAAgGLgAACAYyAAAIBjYAAAgGOgAACARCAAHIBEoAAiAEIggCAAQaAAQIBBYABBAMEAAyAAJaAHJwCAA6AAKIBD4CwMwQOC7cMtQEsgBzVggABARCMAAIBEYQAAgEShAACAROEAAIBFIQAAgEVhAACARDAASyJAICFAHSFAGyBAGQBFoAAAgEXgAACARiAAAIBGYAAAgEagAACARuAAAIBHIAAAgEdgAACAUCAAAIGoAgAAKANgACIgADQAR6AAAQBD4AAVAEggAAQAiAOgwDgAR6AAASBABSBAAEBoIQAFAETgAAEAQeEABQBDIABOAGMgAAEAUyAAAQBzIAABAEsgAAEAayAAAQBbIAABAHsgAAEARyAAAQBnIAABAFcgAAEAdyAAAQBPIAABAG8gAAEAXyAAAQB/IAABAECgAAEAYKAAAQBQoAABAHCgAAEASKAAAQBooAABAFigAAEAeKAAAQBEoAABAGSgAAEAVKAAAQB0oAABAEygAAEAbKAAAQBcoAABAHygAAEAQqAAAQBioAABAFKgAAEAcqAAAQBKoAABAGqgAAEAWqAAAQB6oAABAEagAAEAZqAAAQBWoAABAHagAAEgHm4AgC6gAAEAXqAAAQB+oAABAEGgAAEAYaAAAQBRoAABAHGgAAEASaAAAQBpoAABAFmgAAEAeaAAAQBFoAABAGWgAAEAVaAAAQB1oAABAE2gAAEAbaAAAQBdoAABAH2gAAEAQ6AAAQBjoAABAFOgAAEAc6AAAQBLoAABAGugAAEAW6AAAQB7oAABAEegAAEAZ6AAAQBXoAABAHegAAEAT6AAAQBvoAABAF+gAAEAf6AAAQBAYAABAGBgAAEAUGAAAQBwYAABAEhgAAEAaGAAAQBYYAABAHhgAAEARGAAAQBkYAABAFRgAAEAdGAAAQBMYAABAGxgAAEAXGAAAQB8YAABAEJgAAEAYmAAAQBSYAABAHJgAAEASmAAAQBqYAABAFpgAAEAemAAAQBGYAABAGZgAAEAVmAAAQB2YAABAE5gAAEAbmAAAQBeYAABAH5gAAEAQWAAAQBhYAABAFFgAAEAcWAAAQBJYAABAGlgAAEAWWAAAQB5YAABAEVgAAEAZWAAAQBVYAABAHVgAAEATWAAAQBtYAABAF1gAAEAfWAAAQBDYAABAGNgAAEAU2AAAQBzYAABIARMwIArYAABAFtgAAEAe2AAAQBHYAABAGdgAAEAV2AAAQB3YAABAE9gAAEAb2AAAQBfYAABAH9gAAEAROAAMIFEwEJAJOAAAgBk4AACAFTgAAIAVOAAAgB04AACAHTgAAIATOAAAgBM4AACAGzgAAIAbOAAAgBc4AACAFzgAAIAfOAAAgB84AACAELgAAIgBDagAQCgAAEgAAIAUuAAAgBS4AACAHLgAAIAcuAAAgBK4AACAErgAAIAauAAAgBq4AACAFrgAAIAWuAAAgB64AACAHrgAAIARuAAAgBG4AACAGbgAAIAZuAAAgBW4AACAFbgAAIAduAAAgB24AACAE7gAAIATuAAAgBu4AACAG7gAAIAXuAAAgBe4AACAH7gAAIAfuAAAiBA7YBB4AACAGHgAAIAYeAAAgBR4AACAFHgAAIAceAAAgBx4AACAEngAAIASeAAAgBp4AACAGngAAIAWeAAAgBZ4AACAHngAAIAeeAAAgBF4AACAEXgAAIAZeAAAgBl4AACAFXgAAIAVeAAAgB14AACAHXgAAIATeAAAgBN4AACAG3gAAIAbeAAAgBd4AACAF3gAAIAfeAAAgB94AACAEPgAAIAQ+AAAgBj4AACAGPgAAIAU+AAAgBT4AACAHPgAAIAc+AAAgBL4AACAEvgAAIAa+AAAgBr4AACAFvgAAIAW+AAAgB74AACAHvgAAIAR+AAAgBH4AACAGfgAAIAZ+AAAgBX4AACAFfgAAIAd+AAAgB34AACAE/gAAIAT+AAAgBv4AACAG/gAAIAX+AAAgBf4AACAH/gAAIAf+AAAiBBAoBQIAABAEggAAEAWCAAAQBEIAABAFQgAAEATCAAAQBcIIFVgMHAEiAAAQBKIAABAFogAAEARiAAAQBWIAABAE4gAAEAXiAAAQBBIAABAFEgAAEASSAAAQBZIAABAEUgAAEAVSAAAQBNIAABAF0gAAEAQOAAEIBg4AABAFDgAAEAcOAAAQBI4AABAGjgAAEAWOAAAQB44AABIC+K4AAdIECxgEFgABcAQWCBUoBFIAABAEMgAAEARyAAASAvlaABEQBBYIGBAEaggXqAQWAA9QBBYADuAEFgAOcgE92gAAEARGAAAQBCYAABAEZgAAEgQACARWAAAQBDYAABAEdgAAEgL59gAKkgQZAAQWAAiyBBaYBBYABtAEFgD3fAxsLTYMfuYcABIC+rooABIEHUYkABAEEjAAEAQWKAAQEQbAcC4C9CosAS40AO4UALwEGhAAEgQWIgQAEgQEKgQAEgQGSgQAEgIS2ggAEAQuEAAQBDIQABIAF24FHeQTgHQsjhQBfhQXLAhARgAVtBgcJBgoFC4A6uAQNAg4BgAclBJQeC2mFAJCFAIiFAICFAHiBAGiBAFyBBh8BEIAABAEUgAAEARiAAAQBHIAABAEggAAEASiAAAQBMIAABAE4gAAEAUCAAAQBUIAABIEGvQFwgAAEAYCAAAQBoIAABAHAgAAEAeCAAG8DHwtyjQBvgQBrgQBngQBjgQBfgQBbgQBXgQBTgQBPgQBLgQBHgQBDgQE8AYCvAEGAUc0CC22BAMcBBIAAAgEIgAAEgQEzgQJLARCAAA6DAAyBnqyAqmuEACSBB3OBAE8BCIAACIEAGIUADIEIt4MADAEggQCUgDKEgQBrAYCBCC8BBIMADIA/SAoBABAMAEGRIQv/gCUfgMDAgIKxBQgJCQoKgEk3gAABAQ2AAAEBDoAAAQEPgAABARCEAAEBEYQAAQEShAABAROEAAEBFIwAAQEVjAABARaMAAEBF4wAAQEYnAABARmcAAEBGpwAAQEbmwABARyBffsEBAQFBYHB1QEHgAABAQiEAAGAXSqCAAEBCowAAYAnsooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==
516")),e)})}let Ct,Da,Cn,pc;function mH(t){if(Ct=t,{malloc:Da,free:Cn,memory:pc}=Ct,typeof Da!="function"||typeof Cn!="function"||!pc)throw Ct=Da=Cn=pc=null,new Error("Invalid WASM module")}function Pk(t,e,n={}){const r=typeof n.level=="number"?n.level:-1,i=typeof n.outBuffer=="number"?n.outBuffer:64*1024,s=typeof n.inBufferSize=="number"?n.inBufferSize:64*1024;return new TransformStream({start(){let a;if(this.out=Da(i),this.in=Da(s),this.inBufferSize=s,this._scratch=new Uint8Array(i),t?(this._process=Ct.deflate_process,this._last_consumed=Ct.deflate_last_consumed,this._end=Ct.deflate_end,this.streamHandle=Ct.deflate_new(),e==="gzip"?a=Ct.deflate_init_gzip(this.streamHandle,r):e==="deflate-raw"?a=Ct.deflate_init_raw(this.streamHandle,r):a=Ct.deflate_init(this.streamHandle,r)):e==="deflate64-raw"?(this._process=Ct.inflate9_process,this._last_consumed=Ct.inflate9_last_consumed,this._end=Ct.inflate9_end,this.streamHandle=Ct.inflate9_new(),a=Ct.inflate9_init_raw(this.streamHandle)):(this._process=Ct.inflate_process,this._last_consumed=Ct.inflate_last_consumed,this._end=Ct.inflate_end,this.streamHandle=Ct.inflate_new(),e==="deflate-raw"?a=Ct.inflate_init_raw(this.streamHandle):e==="gzip"?a=Ct.inflate_init_gzip(this.streamHandle):a=Ct.inflate_init(this.streamHandle)),a!==0)throw new Error("init failed:"+a)},transform(a,o){try{const c=a,u=new Uint8Array(pc.buffer),l=this._process,d=this._last_consumed,f=this.out,h=this._scratch;let m=0;for(;m<c.length;){const p=Math.min(c.length-m,32768);(!this.in||this.inBufferSize<p)&&(this.in&&Cn&&Cn(this.in),this.in=Da(p),this.inBufferSize=p),u.set(c.subarray(m,m+p),this.in);const g=l(this.streamHandle,this.in,p,f,i,0),A=g&16777215;if(A&&(h.set(u.subarray(f,f+A),0),o.enqueue(h.slice(0,A))),!t){const w=g>>24&255,E=w&128?w-256:w;if(E<0)throw new Error("process error:"+E)}const y=d(this.streamHandle);if(y===0)break;m+=y}}catch(c){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Cn&&Cn(this.in),this.out&&Cn&&Cn(this.out),o.error(c)}},flush(a){try{const o=new Uint8Array(pc.buffer),c=this._process,u=this.out,l=this._scratch;for(;;){const d=c(this.streamHandle,0,0,u,i,4),f=d&16777215,h=d>>24&255;if(!t){const m=h&128?h-256:h;if(m<0)throw new Error("process error:"+m)}if(f&&(l.set(o.subarray(u,u+f),0),a.enqueue(l.slice(0,f))),h===1||f===0)break}}catch(o){a.error(o)}finally{if(this._end&&this.streamHandle){const o=this._end(this.streamHandle);o!==0&&a.error(new Error("end error:"+o))}this.in&&Cn&&Cn(this.in),this.out&&Cn&&Cn(this.out)}}})}class gH{constructor(e="deflate",n){return Pk(!0,e,n)}}class AH{constructor(e="deflate",n){return Pk(!1,e,n)}}let Rk=!1;async function yH(t,{baseURI:e}){if(!Rk){let n,r;try{try{r=new URL(t,e)}catch{}n=await(await fetch(r)).arrayBuffer()}catch(s){if(t.startsWith("data:application/wasm;base64,"))n=wH(t);else throw s}const i=await WebAssembly.instantiate(n);mH(i.instance.exports),Rk=!0}}function wH(t){const e=t.split(",")[1],n=atob(e),r=n.length,i=new Uint8Array(r);for(let s=0;s<r;++s)i[s]=n.charCodeAt(s);return i.buffer}let Bm;pH(jl),M6({initModule:t=>{if(!Bm){let{wasmURI:e}=t;typeof e==vi&&(e=e()),Bm=yH(e,t)}return Bm}}),jl({CompressionStreamZlib:gH,DecompressionStreamZlib:AH});const Pm
vendor: 23,402 bytes, line 516
516={application:{"andrew-inset":"ez",annodex:"anx","atom+xml":"atom","atomcat+xml":"atomcat","atomserv+xml":"atomsrv",bbolin:"lin","cu-seeme":"cu","davmount+xml":"davmount",dsptype:"tsp",ecmascript:["es","ecma"],futuresplash:"spl",hta:"hta","java-archive":"jar","java-serialized-object":"ser","java-vm":"class",m3g:"m3g","mac-binhex40":"hqx",mathematica:["nb","ma","mb"],msaccess:"mdb",msword:["doc","dot","wiz"],mxf:"mxf",oda:"oda",ogg:"ogx",pdf:"pdf","pgp-keys":"key","pgp-signature":["asc","sig"],"pics-rules":"prf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],rar:"rar","rdf+xml":"rdf","rss+xml":"rss",rtf:"rtf","xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","xpdl"],"xspf+xml":"xspf",zip:"zip","vnd.android.package-archive":"apk","vnd.cinderella":"cdy","vnd.google-earth.kml+xml":"kml","vnd.google-earth.kmz":"kmz","vnd.mozilla.xul+xml":"xul","vnd.ms-excel":["xls","xlb","xlt","xlm","xla","xlc","xlw"],"vnd.ms-pki.seccat":"cat","vnd.ms-pki.stl":"stl","vnd.ms-powerpoint":["ppt","pps","pot","ppa","pwz"],"vnd.oasis.opendocument.chart":"odc","vnd.oasis.opendocument.database":"odb","vnd.oasis.opendocument.formula":"odf","vnd.oasis.opendocument.graphics":"odg","vnd.oasis.opendocument.graphics-template":"otg","vnd.oasis.opendocument.image":"odi","vnd.oasis.opendocument.presentation":"odp","vnd.oasis.opendocument.presentation-template":"otp","vnd.oasis.opendocument.spreadsheet":"ods","vnd.oasis.opendocument.spreadsheet-template":"ots","vnd.oasis.opendocument.text":"odt","vnd.oasis.opendocument.text-master":["odm","otm"],"vnd.oasis.opendocument.text-template":"ott","vnd.oasis.opendocument.text-web":"oth","vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","vnd.openxmlformats-officedocument.presentationml.template":"potx","vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","vnd.smaf":"mmf","vnd.stardivision.calc":"sdc","vnd.stardivision.chart":"sds","vnd.stardivision.draw":"sda","vnd.stardivision.impress":"sdd","vnd.stardivision.math":["sdf","smf"],"vnd.stardivision.writer":["sdw","vor"],"vnd.stardivision.writer-global":"sgl","vnd.sun.xml.calc":"sxc","vnd.sun.xml.calc.template":"stc","vnd.sun.xml.draw":"sxd","vnd.sun.xml.draw.template":"std","vnd.sun.xml.impress":"sxi","vnd.sun.xml.impress.template":"sti","vnd.sun.xml.math":"sxm","vnd.sun.xml.writer":"sxw","vnd.sun.xml.writer.global":"sxg","vnd.sun.xml.writer.template":"stw","vnd.symbian.install":["sis","sisx"],"vnd.visio":["vsd","vst","vss","vsw","vsdx","vssx","vstx","vssm","vstm"],"vnd.wap.wbxml":"wbxml","vnd.wap.wmlc":"wmlc","vnd.wap.wmlscriptc":"wmlsc","vnd.wordperfect":"wpd","vnd.wordperfect5.1":"wp5","x-123":"wk","x-7z-compressed":"7z","x-abiword":"abw","x-apple-diskimage":"dmg","x-bcpio":"bcpio","x-bittorrent":"torrent","x-cbr":["cbr","cba","cbt","cb7"],"x-cbz":"cbz","x-cdf":["cdf","cda"],"x-cdlink":"vcd","x-chess-pgn":"pgn","x-cpio":"cpio","x-csh":"csh","x-director":["dir","dxr","cst","cct","cxt","w3d","fgd","swa"],"x-dms":"dms","x-doom":"wad","x-dvi":"dvi","x-httpd-eruby":"rhtml","x-font":"pcf.Z","x-freemind":"mm","x-gnumeric":"gnumeric","x-go-sgf":"sgf","x-graphing-calculator":"gcf","x-gtar":["gtar","taz"],"x-hdf":"hdf","x-httpd-php":["phtml","pht","php"],"x-httpd-php-source":"phps","x-httpd-php3":"php3","x-httpd-php3-preprocessed":"php3p","x-httpd-php4":"php4","x-httpd-php5":"php5","x-ica":"ica","x-info":"info","x-internet-signup":["ins","isp"],"x-iphone":"iii","x-iso9660-image":"iso","x-java-jnlp-file":"jnlp","x-jmol":"jmz","x-killustrator":"kil","x-latex":"latex","x-lyx":"lyx","x-lzx":"lzx","x-maker":["frm","fb","fbdoc"],"x-ms-wmd":"wmd","x-msdos-program":["com","exe","bat","dll"],"x-netcdf":["nc"],"x-ns-proxy-autoconfig":["pac","dat"],"x-nwc":"nwc","x-object":"o","x-oz-application":"oza","x-pkcs7-certreqresp":"p7r","x-python-code":["pyc","pyo"],"x-qgis":["qgs","shp","shx"],"x-quicktimeplayer":"qtl","x-redhat-package-manager":["rpm","rpa"],"x-ruby":"rb","x-sh":"sh","x-shar":"shar","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","x-stuffit":"sit","x-sv4cpio":"sv4cpio","x-sv4crc":"sv4crc","x-tar":"tar","x-tex-gf":"gf","x-tex-pk":"pk","x-texinfo":["texinfo","texi"],"x-trash":["~","%","bak","old","sik"],"x-ustar":"ustar","x-wais-source":"src","x-wingz":"wz","x-x509-ca-cert":["crt","der","cer"],"x-xcf":"xcf","x-xfig":"fig","x-xpinstall":"xpi",applixware:"aw","atomsvc+xml":"atomsvc","ccxml+xml":"ccxml","cdmi-capability":"cdmia","cdmi-container":"cdmic","cdmi-domain":"cdmid","cdmi-object":"cdmio","cdmi-queue":"cdmiq","docbook+xml":"dbk","dssc+der":"dssc","dssc+xml":"xdssc","emma+xml":"emma","epub+zip":"epub",exi:"exi","font-tdpfr":"pfr","gml+xml":"gml","gpx+xml":"gpx",gxf:"gxf",hyperstudio:"stk","inkml+xml":["ink","inkml"],ipfix:"ipfix","jsonml+json":"jsonml","lost+xml":"lostxml","mads+xml":"mads",marc:"mrc","marcxml+xml":"mrcx","mathml+xml":["mathml","mml"],mbox:"mbox","mediaservercontrol+xml":"mscml","metalink+xml":"metalink","metalink4+xml":"meta4","mets+xml":"mets","mods+xml":"mods",mp21:["m21","mp21"],mp4:"mp4s","oebps-package+xml":"opf","omdoc+xml":"omdoc",onenote:["onetoc","onetoc2","onetmp","onepkg"],oxps:"oxps","patch-ops-error+xml":"xer","pgp-encrypted":"pgp",pkcs10:"p10","pkcs7-mime":["p7m","p7c"],"pkcs7-signature":"p7s",pkcs8:"p8","pkix-attr-cert":"ac","pkix-crl":"crl","pkix-pkipath":"pkipath",pkixcmp:"pki","pls+xml":"pls","prs.cww":"cww","pskc+xml":"pskcxml","reginfo+xml":"rif","relax-ng-compact-syntax":"rnc","resource-lists+xml":"rl","resource-lists-diff+xml":"rld","rls-services+xml":"rs","rpki-ghostbusters":"gbr","rpki-manifest":"mft","rpki-roa":"roa","rsd+xml":"rsd","sbml+xml":"sbml","scvp-cv-request":"scq","scvp-cv-response":"scs","scvp-vp-request":"spq","scvp-vp-response":"spp",sdp:"sdp","set-payment-initiation":"setpay","set-registration-initiation":"setreg","shf+xml":"shf","sparql-query":"rq","sparql-results+xml":"srx",srgs:"gram","srgs+xml":"grxml","sru+xml":"sru","ssdl+xml":"ssdl","ssml+xml":"ssml","tei+xml":["tei","teicorpus"],"thraud+xml":"tfi","timestamped-data":"tsd","vnd.3gpp.pic-bw-large":"plb","vnd.3gpp.pic-bw-small":"psb","vnd.3gpp.pic-bw-var":"pvb","vnd.3gpp2.tcap":"tcap","vnd.3m.post-it-notes":"pwn","vnd.accpac.simply.aso":"aso","vnd.accpac.simply.imp":"imp","vnd.acucobol":"acu","vnd.acucorp":["atc","acutc"],"vnd.adobe.air-application-installer-package+zip":"air","vnd.adobe.formscentral.fcdt":"fcdt","vnd.adobe.fxp":["fxp","fxpl"],"vnd.adobe.xdp+xml":"xdp","vnd.adobe.xfdf":"xfdf","vnd.ahead.space":"ahead","vnd.airzip.filesecure.azf":"azf","vnd.airzip.filesecure.azs":"azs","vnd.amazon.ebook":"azw","vnd.americandynamics.acc":"acc","vnd.amiga.ami":"ami","vnd.anser-web-certificate-issue-initiation":"cii","vnd.anser-web-funds-transfer-initiation":"fti","vnd.antix.game-component":"atx","vnd.apple.installer+xml":"mpkg","vnd.apple.mpegurl":"m3u8","vnd.aristanetworks.swi":"swi","vnd.astraea-software.iota":"iota","vnd.audiograph":"aep","vnd.blueice.multipass":"mpm","vnd.bmi":"bmi","vnd.businessobjects":"rep","vnd.chemdraw+xml":"cdxml","vnd.chipnuts.karaoke-mmd":"mmd","vnd.claymore":"cla","vnd.cloanto.rp9":"rp9","vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"vnd.cluetrust.cartomobile-config":"c11amc","vnd.cluetrust.cartomobile-config-pkg":"c11amz","vnd.commonspace":"csp","vnd.contact.cmsg":"cdbcmsg","vnd.cosmocaller":"cmc","vnd.crick.clicker":"clkx","vnd.crick.clicker.keyboard":"clkk","vnd.crick.clicker.palette":"clkp","vnd.crick.clicker.template":"clkt","vnd.crick.clicker.wordbank":"clkw","vnd.criticaltools.wbs+xml":"wbs","vnd.ctc-posml":"pml","vnd.cups-ppd":"ppd","vnd.curl.car":"car","vnd.curl.pcurl":"pcurl","vnd.dart":"dart","vnd.data-vision.rdz":"rdz","vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"vnd.dece.ttml+xml":["uvt","uvvt"],"vnd.dece.unspecified":["uvx","uvvx"],"vnd.dece.zip":["uvz","uvvz"],"vnd.denovo.fcselayout-link":"fe_launch","vnd.dna":"dna","vnd.dolby.mlp":"mlp","vnd.dpgraph":"dpg","vnd.dreamfactory":"dfac","vnd.ds-keypoint":"kpxx","vnd.dvb.ait":"ait","vnd.dvb.service":"svc","vnd.dynageo":"geo","vnd.ecowin.chart":"mag","vnd.enliven":"nml","vnd.epson.esf":"esf","vnd.epson.msf":"msf","vnd.epson.quickanime":"qam","vnd.epson.salt":"slt","vnd.epson.ssf":"ssf","vnd.eszigno3+xml":["es3","et3"],"vnd.ezpix-album":"ez2","vnd.ezpix-package":"ez3","vnd.fdf":"fdf","vnd.fdsn.mseed":"mseed","vnd.fdsn.seed":["seed","dataless"],"vnd.flographit":"gph","vnd.fluxtime.clip":"ftc","vnd.framemaker":["fm","frame","maker","book"],"vnd.frogans.fnc":"fnc","vnd.frogans.ltf":"ltf","vnd.fsc.weblaunch":"fsc","vnd.fujitsu.oasys":"oas","vnd.fujitsu.oasys2":"oa2","vnd.fujitsu.oasys3":"oa3","vnd.fujitsu.oasysgp":"fg5","vnd.fujitsu.oasysprs":"bh2","vnd.fujixerox.ddd":"ddd","vnd.fujixerox.docuworks":"xdw","vnd.fujixerox.docuworks.binder":"xbd","vnd.fuzzysheet":"fzs","vnd.genomatix.tuxedo":"txd","vnd.geogebra.file":"ggb","vnd.geogebra.tool":"ggt","vnd.geometry-explorer":["gex","gre"],"vnd.geonext":"gxt","vnd.geoplan":"g2w","vnd.geospace":"g3w","vnd.gmx":"gmx","vnd.grafeq":["gqf","gqs"],"vnd.groove-account":"gac","vnd.groove-help":"ghf","vnd.groove-identity-message":"gim","vnd.groove-injector":"grv","vnd.groove-tool-message":"gtm","vnd.groove-tool-template":"tpl","vnd.groove-vcard":"vcg","vnd.hal+xml":"hal","vnd.handheld-entertainment+xml":"zmm","vnd.hbci":"hbci","vnd.hhe.lesson-player":"les","vnd.hp-hpgl":"hpgl","vnd.hp-hpid":"hpid","vnd.hp-hps":"hps","vnd.hp-jlyt":"jlt","vnd.hp-pcl":"pcl","vnd.hp-pclxl":"pclxl","vnd.hydrostatix.sof-data":"sfd-hdstx","vnd.ibm.minipay":"mpy","vnd.ibm.modcap":["afp","listafp","list3820"],"vnd.ibm.rights-management":"irm","vnd.ibm.secure-container":"sc","vnd.iccprofile":["icc","icm"],"vnd.igloader":"igl","vnd.immervision-ivp":"ivp","vnd.immervision-ivu":"ivu","vnd.insors.igm":"igm","vnd.intercon.formnet":["xpw","xpx"],"vnd.intergeo":"i2g","vnd.intu.qbo":"qbo","vnd.intu.qfx":"qfx","vnd.ipunplugged.rcprofile":"rcprofile","vnd.irepository.package+xml":"irp","vnd.is-xpr":"xpr","vnd.isac.fcs":"fcs","vnd.jam":"jam","vnd.jcp.javame.midlet-rms":"rms","vnd.jisp":"jisp","vnd.joost.joda-archive":"joda","vnd.kahootz":["ktz","ktr"],"vnd.kde.karbon":"karbon","vnd.kde.kchart":"chrt","vnd.kde.kformula":"kfo","vnd.kde.kivio":"flw","vnd.kde.kontour":"kon","vnd.kde.kpresenter":["kpr","kpt"],"vnd.kde.kspread":"ksp","vnd.kde.kword":["kwd","kwt"],"vnd.kenameaapp":"htke","vnd.kidspiration":"kia","vnd.kinar":["kne","knp"],"vnd.koan":["skp","skd","skt","skm"],"vnd.kodak-descriptor":"sse","vnd.las.las+xml":"lasxml","vnd.llamagraphics.life-balance.desktop":"lbd","vnd.llamagraphics.life-balance.exchange+xml":"lbe","vnd.lotus-1-2-3":"123","vnd.lotus-approach":"apr","vnd.lotus-freelance":"pre","vnd.lotus-notes":"nsf","vnd.lotus-organizer":"org","vnd.lotus-screencam":"scm","vnd.lotus-wordpro":"lwp","vnd.macports.portpkg":"portpkg","vnd.mcd":"mcd","vnd.medcalcdata":"mc1","vnd.mediastation.cdkey":"cdkey","vnd.mfer":"mwf","vnd.mfmp":"mfm","vnd.micrografx.flo":"flo","vnd.micrografx.igx":"igx","vnd.mif":"mif","vnd.mobius.daf":"daf","vnd.mobius.dis":"dis","vnd.mobius.mbk":"mbk","vnd.mobius.mqy":"mqy","vnd.mobius.msl":"msl","vnd.mobius.plc":"plc","vnd.mobius.txf":"txf","vnd.mophun.application":"mpn","vnd.mophun.certificate":"mpc","vnd.ms-artgalry":"cil","vnd.ms-cab-compressed":"cab","vnd.ms-excel.addin.macroenabled.12":"xlam","vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","vnd.ms-excel.sheet.macroenabled.12":"xlsm","vnd.ms-excel.template.macroenabled.12":"xltm","vnd.ms-fontobject":"eot","vnd.ms-htmlhelp":"chm","vnd.ms-ims":"ims","vnd.ms-lrm":"lrm","vnd.ms-officetheme":"thmx","vnd.ms-powerpoint.addin.macroenabled.12":"ppam","vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","vnd.ms-powerpoint.slide.macroenabled.12":"sldm","vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","vnd.ms-powerpoint.template.macroenabled.12":"potm","vnd.ms-project":["mpp","mpt"],"vnd.ms-word.document.macroenabled.12":"docm","vnd.ms-word.template.macroenabled.12":"dotm","vnd.ms-works":["wps","wks","wcm","wdb"],"vnd.ms-wpl":"wpl","vnd.ms-xpsdocument":"xps","vnd.mseq":"mseq","vnd.musician":"mus","vnd.muvee.style":"msty","vnd.mynfc":"taglet","vnd.neurolanguage.nlu":"nlu","vnd.nitf":["ntf","nitf"],"vnd.noblenet-directory":"nnd","vnd.noblenet-sealer":"nns","vnd.noblenet-web":"nnw","vnd.nokia.n-gage.data":"ngdat","vnd.nokia.n-gage.symbian.install":"n-gage","vnd.nokia.radio-preset":"rpst","vnd.nokia.radio-presets":"rpss","vnd.novadigm.edm":"edm","vnd.novadigm.edx":"edx","vnd.novadigm.ext":"ext","vnd.oasis.opendocument.chart-template":"otc","vnd.oasis.opendocument.formula-template":"odft","vnd.oasis.opendocument.image-template":"oti","vnd.olpc-sugar":"xo","vnd.oma.dd2+xml":"dd2","vnd.openofficeorg.extension":"oxt","vnd.openxmlformats-officedocument.presentationml.slide":"sldx","vnd.osgeo.mapguide.package":"mgp","vnd.osgi.dp":"dp","vnd.osgi.subsystem":"esa","vnd.palm":["pdb","pqa","oprc"],"vnd.pawaafile":"paw","vnd.pg.format":"str","vnd.pg.osasli":"ei6","vnd.picsel":"efif","vnd.pmi.widget":"wg","vnd.pocketlearn":"plf","vnd.powerbuilder6":"pbd","vnd.previewsystems.box":"box","vnd.proteus.magazine":"mgz","vnd.publishare-delta-tree":"qps","vnd.pvi.ptid1":"ptid","vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"vnd.realvnc.bed":"bed","vnd.recordare.musicxml":"mxl","vnd.recordare.musicxml+xml":"musicxml","vnd.rig.cryptonote":"cryptonote","vnd.rn-realmedia":"rm","vnd.rn-realmedia-vbr":"rmvb","vnd.route66.link66+xml":"link66","vnd.sailingtracker.track":"st","vnd.seemail":"see","vnd.sema":"sema","vnd.semd":"semd","vnd.semf":"semf","vnd.shana.informed.formdata":"ifm","vnd.shana.informed.formtemplate":"itp","vnd.shana.informed.interchange":"iif","vnd.shana.informed.package":"ipk","vnd.simtech-mindmapper":["twd","twds"],"vnd.smart.teacher":"teacher","vnd.solent.sdkm+xml":["sdkm","sdkd"],"vnd.spotfire.dxp":"dxp","vnd.spotfire.sfs":"sfs","vnd.stepmania.package":"smzip","vnd.stepmania.stepchart":"sm","vnd.sus-calendar":["sus","susp"],"vnd.svd":"svd","vnd.syncml+xml":"xsm","vnd.syncml.dm+wbxml":"bdm","vnd.syncml.dm+xml":"xdm","vnd.tao.intent-module-archive":"tao","vnd.tcpdump.pcap":["pcap","cap","dmp"],"vnd.tmobile-livetv":"tmo","vnd.trid.tpt":"tpt","vnd.triscape.mxs":"mxs","vnd.trueapp":"tra","vnd.ufdl":["ufd","ufdl"],"vnd.uiq.theme":"utz","vnd.umajin":"umj","vnd.unity":"unityweb","vnd.uoml+xml":"uoml","vnd.vcx":"vcx","vnd.visionary":"vis","vnd.vsf":"vsf","vnd.webturbo":"wtb","vnd.wolfram.player":"nbp","vnd.wqd":"wqd","vnd.wt.stf":"stf","vnd.xara":"xar","vnd.xfdl":"xfdl","vnd.yamaha.hv-dic":"hvd","vnd.yamaha.hv-script":"hvs","vnd.yamaha.hv-voice":"hvp","vnd.yamaha.openscoreformat":"osf","vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","vnd.yamaha.smaf-audio":"saf","vnd.yamaha.smaf-phrase":"spf","vnd.yellowriver-custom-menu":"cmp","vnd.zul":["zir","zirz"],"vnd.zzazz.deck+xml":"zaz","voicexml+xml":"vxml",widget:"wgt",winhlp:"hlp","wsdl+xml":"wsdl","wspolicy+xml":"wspolicy","x-ace-compressed":"ace","x-authorware-bin":["aab","x32","u32","vox"],"x-authorware-map":"aam","x-authorware-seg":"aas","x-blorb":["blb","blorb"],"x-bzip":"bz","x-bzip2":["bz2","boz"],"x-cfs-compressed":"cfs","x-chat":"chat","x-conference":"nsc","x-dgc-compressed":"dgc","x-dtbncx+xml":"ncx","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-eva":"eva","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-freearc":"arc","x-gca-compressed":"gca","x-glulx":"ulx","x-gramps-xml":"gramps","x-install-instructions":"install","x-lzh-compressed":["lzh","lha"],"x-mie":"mie","x-mobipocket-ebook":["prc","mobi"],"x-ms-application":"application","x-ms-shortcut":"lnk","x-ms-xbap":"xbap","x-msbinder":"obd","x-mscardfile":"crd","x-msclip":"clp","application/x-ms-installer":"msi","x-msmediaview":["mvb","m13","m14"],"x-msmetafile":["wmf","wmz","emf","emz"],"x-msmoney":"mny","x-mspublisher":"pub","x-msschedule":"scd","x-msterminal":"trm","x-mswrite":"wri","x-nzb":"nzb","x-pkcs12":["p12","pfx"],"x-pkcs7-certificates":["p7b","spc"],"x-research-info-systems":"ris","x-silverlight-app":"xap","x-sql":"sql","x-stuffitx":"sitx","x-subrip":"srt","x-t3vm-image":"t3","x-tex-tfm":"tfm","x-tgif":"obj","x-xliff+xml":"xlf","x-xz":"xz","x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"xaml+xml":"xaml","xcap-diff+xml":"xdf","xenc+xml":"xenc","xml-dtd":"dtd","xop+xml":"xop","xproc+xml":"xpl","xslt+xml":"xslt","xv+xml":["mxml","xhvml","xvml","xvm"],yang:"yang","yin+xml":"yin",envoy:"evy",fractals:"fif","internet-property-stream":"acx",olescript:"axs","vnd.ms-outlook":"msg","vnd.ms-pkicertstore":"sst","x-compress":"z","x-perfmon":["pma","pmc","pmr","pmw"],"ynd.ms-pkipko":"pko",gzip:["gz","tgz"],"smil+xml":["smi","smil"],"vnd.debian.binary-package":["deb","udeb"],"vnd.hzn-3d-crossword":"x3d","vnd.sqlite3":["db","sqlite","sqlite3","db-wal","sqlite-wal","db-shm","sqlite-shm"],"vnd.wap.sic":"sic","vnd.wap.slc":"slc","x-krita":["kra","krz"],"x-perl":["pm","pl"],yaml:["yaml","yml"]},audio:{amr:"amr","amr-wb":"awb",annodex:"axa",basic:["au","snd"],flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"prs.sid":"sid","x-aiff":"aifc","x-gsm":"gsm","x-ms-wma":"wma","x-ms-wax":"wax","x-pn-realaudio":"ram","x-realaudio":"ra","x-sd2":"sd2",adpcm:"adp",mp4:"mp4a",s3m:"s3m",silk:"sil","vnd.dece.audio":["uva","uvva"],"vnd.digital-winds":"eol","vnd.dra":"dra","vnd.dts":"dts","vnd.dts.hd":"dtshd","vnd.lucent.voice":"lvp","vnd.ms-playready.media.pya":"pya","vnd.nuera.ecelp4800":"ecelp4800","vnd.nuera.ecelp7470":"ecelp7470","vnd.nuera.ecelp9600":"ecelp9600","vnd.rip":"rip",webm:"weba","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",aac:"aac",aiff:["aiff","aif","aff"],opus:"opus",wav:"wav"},chemical:{"x-alchemy":"alc","x-cache":["cac","cache"],"x-cache-csf":"csf","x-cactvs-binary":["cbin","cascii","ctab"],"x-cdx":"cdx","x-chem3d":"c3d","x-cif":"cif","x-cmdf":"cmdf","x-cml":"cml","x-compass":"cpa","x-crossfire":"bsd","x-csml":["csml","csm"],"x-ctx":"ctx","x-cxf":["cxf","cef"],"x-embl-dl-nucleotide":["emb","embl"],"x-gamess-input":["inp","gam","gamin"],"x-gaussian-checkpoint":["fch","fchk"],"x-gaussian-cube":"cub","x-gaussian-input":["gau","gjc","gjf"],"x-gaussian-log":"gal","x-gcg8-sequence":"gcg","x-genbank":"gen","x-hin":"hin","x-isostar":["istr","ist"],"x-jcamp-dx":["jdx","dx"],"x-kinemage":"kin","x-macmolecule":"mcm","x-macromodel-input":"mmod","x-mdl-molfile":"mol","x-mdl-rdfile":"rd","x-mdl-rxnfile":"rxn","x-mdl-sdfile":"sd","x-mdl-tgf":"tgf","x-mmcif":"mcif","x-mol2":"mol2","x-molconn-Z":"b","x-mopac-graph":"gpt","x-mopac-input":["mop","mopcrt","zmt"],"x-mopac-out":"moo","x-ncbi-asn1":"asn","x-ncbi-asn1-ascii":["prt","ent"],"x-ncbi-asn1-binary":"val","x-rosdal":"ros","x-swissprot":"sw","x-vamas-iso14976":"vms","x-vmd":"vmd","x-xtel":"xtel","x-xyz":"xyz"},font:{otf:"otf",woff:"woff",woff2:"woff2"},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe","jfif","jfif-tbnl","jif"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"vnd.djvu":["djvu","djv"],"vnd.wap.wbmp":"wbmp","x-canon-cr2":"cr2","x-canon-crw":"crw","x-cmu-raster":"ras","x-coreldraw":"cdr","x-coreldrawpattern":"pat","x-coreldrawtemplate":"cdt","x-corelphotopaint":"cpt","x-epson-erf":"erf","x-icon":"ico","x-jg":"art","x-jng":"jng","x-nikon-nef":"nef","x-olympus-orf":"orf","x-portable-anymap":"pnm","x-portable-bitmap":"pbm","x-portable-graymap":"pgm","x-portable-pixmap":"ppm","x-rgb":"rgb","x-xbitmap":"xbm","x-xpixmap":"xpm","x-xwindowdump":"xwd",bmp:"bmp",cgm:"cgm",g3fax:"g3",ktx:"ktx","prs.btif":"btif",sgi:"sgi","vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"vnd.dwg":"dwg","vnd.dxf":"dxf","vnd.fastbidsheet":"fbs","vnd.fpx":"fpx","vnd.fst":"fst","vnd.fujixerox.edmics-mmr":"mmr","vnd.fujixerox.edmics-rlc":"rlc","vnd.ms-modi":"mdi","vnd.ms-photo":"wdp","vnd.net-fpx":"npx","vnd.xiff":"xif",webp:"webp","x-3ds":"3ds","x-cmx":"cmx","x-freehand":["fh","fhc","fh4","fh5","fh7"],"x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod",avif:"avifs",heic:["heif","heic"],pjpeg:["pjpg"],"vnd.adobe.photoshop":"psd","x-adobe-dng":"dng","x-fuji-raf":"raf","x-icns":"icns","x-kodak-dcr":"dcr","x-kodak-k25":"k25","x-kodak-kdc":"kdc","x-minolta-mrw":"mrw","x-panasonic-raw":["raw","rw2","rwl"],"x-pentax-pef":["pef","ptx"],"x-sigma-x3f":"x3f","x-sony-arw":"arw","x-sony-sr2":"sr2","x-sony-srf":"srf"},message:{rfc822:["eml","mime","mht","mhtml","nws"]},model:{iges:["igs","iges"],mesh:["msh","mesh","silo"],vrml:["wrl","vrml"],"x3d+vrml":["x3dv","x3dvz"],"x3d+xml":"x3dz","x3d+binary":["x3db","x3dbz"],"vnd.collada+xml":"dae","vnd.dwf":"dwf","vnd.gdl":"gdl","vnd.gtw":"gtw","vnd.mts":"mts","vnd.usdz+zip":"usdz","vnd.vtu":"vtu"},text:{"cache-manifest":["manifest","appcache"],calendar:["ics","icz","ifb"],css:"css",csv:"csv",h323:"323",html:["html","htm","shtml","stm"],iuls:"uls",plain:["txt","text","brf","conf","def","list","log","in","bas","diff","ksh"],richtext:"rtx",scriptlet:["sct","wsc"],texmacs:"tm","tab-separated-values":"tsv","vnd.sun.j2me.app-descriptor":"jad","vnd.wap.wml":"wml","vnd.wap.wmlscript":"wmls","x-bibtex":"bib","x-boo":"boo","x-c++hdr":["h++","hpp","hxx","hh"],"x-c++src":["c++","cpp","cxx","cc"],"x-component":"htc","x-dsrc":"d","x-diff":"patch","x-haskell":"hs","x-java":"java","x-literate-haskell":"lhs","x-moc":"moc","x-pascal":["p","pas","pp","inc"],"x-pcs-gcd":"gcd","x-python":"py","x-scala":"scala","x-setext":"etx","x-tcl":["tcl","tk"],"x-tex":["tex","ltx","sty","cls"],"x-vcalendar":"vcs","x-vcard":"vcf",n3:"n3","prs.lines.tag":"dsc",sgml:["sgml","sgm"],troff:["t","tr","roff","man","me","ms"],turtle:"ttl","uri-list":["uri","uris","urls"],vcard:"vcard","vnd.curl":"curl","vnd.curl.dcurl":"dcurl","vnd.curl.scurl":"scurl","vnd.curl.mcurl":"mcurl","vnd.dvb.subtitle":"sub","vnd.fly":"fly","vnd.fmi.flexstor":"flx","vnd.graphviz":"gv","vnd.in3d.3dml":"3dml","vnd.in3d.spot":"spot","x-asm":["s","asm"],"x-c":["c","h","dic"],"x-fortran":["f","for","f77","f90"],"x-opml":"opml","x-nfo":"nfo","x-sfv":"sfv","x-uuencode":"uu",webviewhtml:"htt",javascript:"js",json:"json",markdown:["md","markdown","mdown","markdn"],"vnd.wap.si":"si","vnd.wap.sl":"sl"},video:{avif:"avif","3gpp":"3gp",annodex:"axv",dl:"dl",dv:["dif","dv"],fli:"fli",gl:"gl",mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.dece.hd":["uvh","uvvh"],"vnd.dece.mobile":["uvm","uvvm"],"vnd.dece.pd":["uvp","uvvp"],"vnd.dece.sd":["uvs","uvvs"],"vnd.dece.video":["uvv","uvvv"],"vnd.dvb.file":"dvb","vnd.fvt":"fvt","vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv",mp2t:"ts"},"x-conference":{"x-cooltalk":"ice"},"x-world":{"x-vrml":["vrm","flr","wrz","xaf","xof"]}}
516;(()=>{const t={};for(const e of Object.keys(Pm))for(const n of Object.keys(Pm[e])){const r=Pm[e][n];if(typeof r=="string")t[r]=e+"/"+n;else for(let i=0;i<r.length;i++)t[r[i]]=e+"/"+n}return t})(),r6(jl);const Oa=".",bH=t=>{var e;return t&&t.includes(Oa)&&((e=t.split(Oa).pop())==null?void 0:e.trim())||null},EH=t=>t.includes(Oa)?t.split(Oa).slice(0,-1).join(Oa):t,SH=(t,e)=>{const n=bH(t),r=e(EH(t));return n?`${r}${Oa}${n}`:r},mc="/",_H=t=>t?t.replace(/\\/g,mc).split(mc).filter(Boolean):[],TH=(t,e)=>{const n=_H(t),r=n.length<=1,i=n.shift()||"";return r?SH(i,e):`${e(i)}${mc}${n.join(mc)}`},kH=async(t,e)=>{const n=new rH(t),{onProgress:r}=e||{};let i=0,s=0;const a=new TransformStream({transform(o,c){s+=o.byteLength,r==null||r({sourceBytesRead:i,destinationBytesWritten:s}),c.enqueue(o)}});return{zipStream:n.readable.pipeThrough(a),writeZip:async o=>{const c=new Map;for(const u of o){const l=typeof u=="function"?await u():u;if(!l)continue;const{path:d,stream:f,options:h}=l;let m=d,p=2;for(;c.has(m);)m=TH(d,A=>`${A}(${p})`),p++;const g=new TransformStream({transform(A,y){y.enqueue(A),i+=A.byteLength,r==null||r({sourceBytesRead:i,destinationBytesWritten:s})}});c.set(m,await n.zipWriter.add(m,f.pipeThrough(g),h))}return await n.close(),c}}};/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function IH(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Rm(t,...e){if(!IH(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Fk(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function CH(t,e){Rm(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Fm(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Mm(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Dm(t,e){return t<<e|t>>>32-e>>>0}function xH(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Mk(t){return typeof t=="string"&&(t=xH(t)),Rm(t),t}class vH{}function BH(t){const e=r=>t().update(Mk(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function PH(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),a=Number(n>>i&s),o=Number(n&s),c=r?4:0,u=r?0:4;t.setUint32(e+c,a,r),t.setUint32(e+u,o,r)}function RH(t,e,n){return t&e^~t&n}function FH(t,e,n){return t&e^t&n^e&n}class MH extends vH{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=Mm(this.buffer)}update(e){Fk(this),e=Mk(e),Rm(e);const{view:n,buffer:r,blockLen:i}=this,s=e.length;for(let a=0;a<s;){const o=Math.min(i-this.pos,s-a);if(o===i){const c=Mm(e);for(;i<=s-a;a+=i)this.process(c,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Fk(this),CH(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:a}=this;n[a++]=128,Fm(this.buffer.subarray(a)),this.padOffset>i-a&&(this.process(r,0),a=0);for(let d=a;d<i;d++)n[d]=0;PH(r,i-8,BigInt(this.length*8),s),this.process(r,0);const o=Mm(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,l[d],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=s,e.length=i,e.pos=o,i%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const gc=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),Fi=new Uint32Array(80);class DH extends MH{constructor(){super(64,20,8,!1),this.A=gc[0]|0,this.B=gc[1]|0,this.C=gc[2]|0,this.D=gc[3]|0,this.E=gc[4]|0}get(){const{A:e,B:n,C:r,D:i,E:s}=this;return[e,n,r,i,s]}set(e,n,r,i,s){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0}process(e,n){for(let c=0;c<16;c++,n+=4)Fi[c]=e.getUint32(n,!1);for(let c=16;c<80;c++)Fi[c]=Dm(Fi[c-3]^Fi[c-8]^Fi[c-14]^Fi[c-16],1);let{A:r,B:i,C:s,D:a,E:o}=this;for(let c=0;c<80;c++){let u,l;c<20?(u=RH(i,s,a),l=1518500249):c<40?(u=i^s^a,l=1859775393):c<60?(u=FH(i,s,a),l=2400959708):(u=i^s^a,l=3395469782);const d=Dm(r,5)+u+o+l+Fi[c]|0;o=a,a=s,s=Dm(i,30),i=r,r=d}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,this.set(r,i,s,a,o)}roundClean(){Fm(Fi)}destroy(){this.set(0,0,0,0,0),Fm(this.buffer)}}const OH=BH(()=>new DH);class Dk extends TransformStream{constructor(){let e=null;super({start:()=>{e=OH.create()},transform:(n,r)=>{e&&e.update(n),r.enqueue(n)},flush:()=>{e&&this.sha1PromiseWithResolvers.resolve(e.digest())}}),this.sha1PromiseWithResolvers=di()}getSha1(){return this.sha1PromiseWithResolvers.promise}}const NH=180*1e3+1e4,UH=3e4,Ok=12e4;class LH{constructor(e){this.target=e,this.pending=new Map,this.disposed=!1}start(){var a,o;if(this.stop)return this.stop;this.disposed=!1;const e=({data:c})=>{var u;c&&typeof c.id=="string"&&((u=this.pending.get(c.id))==null||u.receive(c))},n=()=>i(new Error("Message channel could not deserialize a message"));let r=!1;this.listen=()=>{r||(r=!0,this.target.addEventListener("message",e),this.target.addEventListener("messageerror",n))},this.unlisten=()=>{r&&(r=!1,this.target.removeEventListener("message",e),this.target.removeEventListener("messageerror",n))};const i=(c=new Error("Message channel disposed"))=>{var u;if(this.stop===s){this.stop=void 0,this.disposed=!0,(u=this.unlisten)==null||u.call(this),this.listen=void 0,this.unlisten=void 0;for(const l of this.pending.values())l.reject(c)}},s=()=>i();this.stop=s,this.listen();try{(o=(a=this.target).start)==null||o.call(a)}catch(c){i(c instanceof Error?c:new Error("Message channel failed to start"))}return s}request(e,n,r,i=UH,s=[],a){return this.disposed?Promise.reject(new Error("Message channel disposed")):i===!1&&!a?Promise.reject(new Error("A replacement deadline requires a cancellation signal")):a!=null&&a.aborted?Promise.reject(a.reason??new Error("Message request canceled")):new Promise((o,c)=>{var m;const u=(p,g)=>{var A;this.pending.delete(e.id)&&(clearTimeout(d),a==null||a.removeEventListener("abort",l),this.pending.size||(A=this.unlisten)==null||A.call(this),p!==void 0?c(p):o(g))},l=()=>u((a==null?void 0:a.reason)??new Error("Message request canceled")),d=i===!1?void 0:setTimeout(()=>u(new Error(`${e.type} was not answered within ${i}ms`)),i);let f=!1;const h=p=>u(p??new Error("Message request failed"));this.pending.set(e.id,{reject:h,receive:p=>{if(!f){if(p.type==="msgChannelRequestError")u(new Error(p.error));else if(p.type===n){f=!0;try{const g=r(p);Promise.resolve(g).then(A=>u(void 0,A),h)}catch(g){h(g)}}}}}),a==null||a.addEventListener("abort",l,{once:!0});try{a==null||a.throwIfAborted(),(m=this.listen)==null||m.call(this),this.target.postMessage(e,s)}catch(p){h(p)}})}}class zH{constructor(e){this.requests=new LH(e)}start(){return this.requests.start()}getApiOptions(){return this.requests.request({type:"msgChannelClientApiOptions",id:crypto.randomUUID()},"msgChannelServerApiOptions",e=>e.apiOptions)}async getApiOptionsInit(e,n){const r={type:"msgChannelClientApiOptionsInit",id:crypto.randomUUID(),apiInput:z8(e),apiInit:{...n,body:typeof(n==null?void 0:n.body)=="string"?n.body:void 0,headers:Ul(n==null?void 0:n.headers),signal:void 0}};return this.requests.request(r,"msgChannelServerApiOptionsInit",i=>i.apiOptionsInit)}getCsrfFetcher(){return{getCsrfToken:()=>this.apiOptionsGetCsrfToken(),invalidateCsrfToken:()=>this.apiOptionsInvalidateCsrfToken(),getFetchedCsrfToken:()=>this.apiOptionsGetFetchedCsrfToken()}}getTurnstileToken(){return this.requests.request({type:"msgChannelClientApiOptionsGetTurnstileToken",id:crypto.randomUUID()},"msgChannelServerApiOptionsGetTurnstileToken",e=>{if(!e.turnstileToken)throw new Error(e.error||"Turnstile challenge failed");return e.turnstileToken},NH)}getAuthFetcher(){return{getAuthToken:()=>this.apiOptionsGetAuthToken(),invalidateAuthToken:()=>this.apiOptionsInvalidateAuthToken()}}apiOptionsGetCsrfToken(){return this.requests.request({type:"msgChannelClientApiOptionsGetCsrfToken",id:crypto.randomUUID()},"msgChannelServerApiOptionsGetCsrfToken",e=>e.csrfToken)}apiOptionsInvalidateCsrfToken(){return this.requests.request({type:"msgChannelClientApiOptionsInvalidateCsrfToken",id:crypto.randomUUID()},"msgChannelServerApiOptionsInvalidateCsrfToken",()=>{})}apiOptionsGetFetchedCsrfToken(){return this.requests.request({type:"msgChannelClientApiOptionsFetchedCsrfToken",id:crypto.randomUUID()},"msgChannelServerApiOptionsFetchedCsrfToken",e=>e.csrfToken)}apiOptionsGetAuthToken(){return this.requests.request({type:"msgChannelClientApiOptionsGetAuthToken",id:crypto.randomUUID()},"msgChannelServerApiOptionsGetAuthToken",e=>e.authToken,Ok)}apiOptionsInvalidateAuthToken(){return this.requests.request({type:"msgChannelClientApiOptionsInvalidateAuthToken",id:crypto.randomUUID()},"msgChannelServerApiOptionsInvalidateAuthToken",()=>{},Ok)}}const Nk=(t,e)=>typeof OffscreenCanvas=="function"&&t instanceof OffscreenCanvas?t.convertToBlob(e):new Promise((n,r)=>{try{t.toBlob(i=>{i?n(i):r()},e==null?void 0:e.type,e==null?void 0:e.quality)}catch{r()}}),QH=t=>{const{width:e=0,height:n=0,context2DSettings:r}=t||{},i=document.createElement("canvas");i.width=e,i.height=n;const s=i.getContext("2d",r);if(!s)throw new Error("Canvas context couldn't be created");return{canvas:i,context:s,getBlob:a=>Nk(i,a)}},HH=()=>typeof OffscreenCanvas=="function",WH=t=>{const{width:e=0,height:n=0,context2DSettings:r}=t||{};if(!HH())throw new Error("Offscreen Canvas API not supported");const i=new OffscreenCanvas(e,n),s=i.getContext("2d",r);if(!s)throw new Error("Offscreen Canvas context couldn't be created");return{canvas:i,context:s,getBlob:a=>Nk(i,a)}},Uk=t=>{try{return WH(t)}catch{}return QH(t)},VH=t=>{if(typeof t=="string")return[t];const e=URL.createObjectURL(t);return[e,()=>URL.revokeObjectURL(e)]},Lk={modelPreparation:10*6e4,inference:9e4,decode:12e4,seek:6e4,thumbnail:12e4,videoScan:5*6e4};
516class zk extends Error{constructor(e){super(`Media processing timed out (${e})`),this.stage=e,this.name="MediaProcessingTimeoutError"}}const Om=new WeakMap,GH=5e3;function Qk(t,e,{signal:n,onWaitingForVisibility:r}={},i){return n!=null&&n.aborted?Promise.reject(n.reason??new Error("Media processing canceled")):new Promise((s,a)=>{const o=new AbortController,c=Symbol(),u=typeof document>"u"?void 0:document,l=typeof window>"u"?void 0:window;let d=!1,f=!1,h=Date.now(),m=0,p=(u==null?void 0:u.visibilityState)==="hidden",g;const A=k=>{if(f===k||!r)return;f=k;const T=Om.get(r)??new Set,C=T.size>0;k?T.add(c):T.delete(c),T.size?Om.set(r,T):Om.delete(r),C!==T.size>0&&r(T.size>0)},y=(k,T)=>{d||(d=!0,clearTimeout(g),u==null||u.removeEventListener("visibilitychange",E),u==null||u.removeEventListener("resume",S),l==null||l.removeEventListener("pageshow",S),n==null||n.removeEventListener("abort",w),A(!1),k!==void 0?(o.abort(k),a(k)):s(T))},w=()=>y((n==null?void 0:n.reason)??new Error("Media processing canceled")),E=()=>{if(d)return;clearTimeout(g);const k=Date.now(),T=k-h,C=(u==null?void 0:u.visibilityState)==="hidden";if(h=k,C||p||T>GH||T<0?m=0:m+=T,p=C,A(C),!d){if(!C&&m>=Lk[t]){y(new zk(t));return}g=setTimeout(E,C?1e3:Math.min(1e3,Lk[t]-m))}},S=()=>{m=0,h=Date.now(),E()};if(u==null||u.addEventListener("visibilitychange",E),u==null||u.addEventListener("resume",S),l==null||l.addEventListener("pageshow",S),n==null||n.addEventListener("abort",w,{once:!0}),E(),!d)try{Promise.resolve(e(o.signal)).then(k=>{d?i==null||i(k):y(void 0,k)},k=>y(k??new Error("Media processing failed")))}catch(k){y(k??new Error("Media processing failed"))}})}const Hk=new Set,qH=async(t,e)=>{var r,i;let n;try{(r=e==null?void 0:e.signal)==null||r.throwIfAborted();const[s,a]=VH(t),o=document.createElement("img");e&&Hk.add(o);let c=!1;const u=()=>{var d;c||(c=!0,(d=e==null?void 0:e.signal)==null||d.removeEventListener("abort",u),Hk.delete(o),o.removeAttribute("src"),a==null||a())};n=u,(i=e==null?void 0:e.signal)==null||i.addEventListener("abort",u,{once:!0});const l=d=>new Promise((f,h)=>{const m=()=>{o.onload=null,o.onerror=null,d.removeEventListener("abort",p)},p=()=>{m(),h(d.reason)};o.onload=()=>{m(),f()},o.onerror=()=>{m(),h(new Error("Could not decode image. Try a supported image file."))},d.addEventListener("abort",p,{once:!0}),o.src=s,o.complete&&o.naturalWidth>0&&(m(),f())});return e?await Qk("decode",l,e):await l(new AbortController().signal),$t({mediaElement:o,dispose:u})}catch(s){return n==null||n(),we(Lt(s))}},YH=async(t,e)=>{if(t instanceof Blob){const n=await qH(t,e);if(!n.ok)return n;const{mediaElement:r,dispose:i}=n.value;return $t({dispose:()=>{i()},width:r.naturalWidth,height:r.naturalHeight,source:r})}if(t instanceof HTMLVideoElement)return $t({dispose:eu,width:t.videoWidth,height:t.videoHeight,source:t});if(t instanceof HTMLImageElement)return $t({dispose:eu,width:t.naturalWidth,height:t.naturalHeight,source:t});if(t instanceof SVGImageElement){const{width:n,height:r}=t.getBBox();return $t({dispose:eu,width:n,height:r,source:t})}return $t({dispose:eu,width:t.width,height:t.height,source:t})},Wk=async t=>{try{const e=await createImageBitmap(t);return $t({dispose:()=>e.close(),height:e.height,width:e.width,source:e})}catch(e){return we(Lt(e))}},KH=async(t,e)=>{var n,r;try{(n=e==null?void 0:e.signal)==null||n.throwIfAborted();const i=e?await Qk("decode",()=>Wk(t),e,s=>{s.ok&&s.value.dispose()}):await Wk(t);return i.ok||((r=e==null?void 0:e.signal)==null||r.throwIfAborted(),i.error instanceof zk)?i:YH(t,e)}catch(i){return we(Lt(i))}},jH=(t,e,n=!1,r=.5,i=.5,s=1)=>{const{width:a,height:o}=e,{width:c,height:u}=t,l=c/u,d=a/o;let f=a*s,h=o*s;return(n?l>d:l<d)?h=f/l:f=h*l,{width:f,height:h,offsetX:(a-f)*r,offsetY:(o-h)*i}},Vk={width:256,height:256},$H=.86,XH=t=>{const e=Uk({width:20,height:20});return e.context.fillStyle="#fff",e.context.fillRect(0,0,20,20),e.context.fillStyle="#D0D5DD",e.context.fillRect(10,0,10,10),e.context.fillRect(0,10,10,10),t.createPattern(e.canvas,"repeat")},JH=async(t,{width:e,height:n},r)=>{r==null||r.throwIfAborted();const{width:i,height:s,offsetX:a,offsetY:o}=jH({width:e,height:n},Vk),c=await KH(t,typeof document<"u"&&r?{signal:r}:void 0);if(!c.ok)return null;const{dispose:u,source:l}=c.value;let d=!1;const f=()=>{d||(d=!0,u())};r==null||r.addEventListener("abort",f,{once:!0});try{r==null||r.throwIfAborted();const{context:h,getBlob:m}=Uk({...Vk,context2DSettings:{alpha:!1,desynchronized:!0}}),p=XH(h);p&&(h.fillStyle=p),h.fillRect(0,0,i,s),h.drawImage(l,a,o,i,s);const g=await m({type:"image/jpeg",quality:$H}).catch(()=>null);return r==null||r.throwIfAborted(),g}finally{r==null||r.removeEventListener("abort",f),f()}};var ZH="/build/workers/worker-BAOIWoxA.js",eW="/build/assets/ffmpeg-core-CI9Irx9p.js",tW="/build/assets/ffmpeg-core-CgUfceKH.wasm";const Gk=new Map,nW=async t=>{const e=await t;return e.ok&&!e.value.loaded},rW=async t=>{const{signal:e,timeout:n=45e3,classWorkerURL:r=ZH,coreURL:i=eW,wasmURL:s=tW}=t||{},a=di(),o=()=>{clearTimeout(c),a.resolve(we(new Error("Ffmpeg load timed out or was aborted"))),e==null||e.removeEventListener("abort",o)},c=setTimeout(o,n);return e==null||e.addEventListener("abort",o),e!=null&&e.aborted&&o(),(async()=>{const{FFmpeg:u}=await Promise.resolve().then(function(){return _W}),d=JSON.stringify({coreURL:i,wasmURL:s,classWorkerURL:r}),f=Gk.get(d);if(f&&!await nW(f))return f;const h=new u,m=new Promise(p=>{h.load({coreURL:i,wasmURL:s,classWorkerURL:r}).then(g=>{p(g?$t(h):we(new Error("Ffmpeg load wasn't successful")))}).catch(g=>p(we(Lt(g,new Error(`Ffmpeg load error: ${g}`)))))});return Gk.set(d,m),m})().then(u=>{a.resolve(u)}),a.promise},qk=1e3,iW=["B","KB","MB","GB","TB","PB"],Nm=(t,e={})=>
516{if(!t)return"0B";const n=Math.floor(Math.log(t)/Math.log(qk));return new Intl.NumberFormat("en-US",{style:"decimal",maximumFractionDigits:1,...e}).format(t/Math.pow(qk,n))+iW[n]},Yk=(t,e,n)=>{const r=new DataView(t.buffer),i=[],s=t.length/e;for(let a=0;a<e;a++){const o=Math.floor(a*s),c=Math.ceil((a+1)*s);let u=0;for(let l=o;l<c;l+=2){const d=Math.floor(l/2)*2,f=r.getInt16(d,!0);Math.abs(f)>Math.abs(u)&&(u=f)}i.push(Math.round(u*n)/n)}return i},Kk=500*1024*1024,sW=async(t,e,n,r,i)=>{const s=[],{promise:a,resolve:o}=di(),c=l=>{s.forEach(d=>{d()}),o(l)};r&&r.addEventListener("abort",()=>{c(we(new Error("Pcm data operation was aborted")))});const u=setTimeout(()=>{c(we(new Error("Pcm data operation timed out")))},i);return s.push(()=>clearTimeout(u)),(async()=>{try{const{Input:l,Output:d,Conversion:f,BlobSource:h,BufferTarget:m,WavOutputFormat:p,AudioSampleSink:g,BufferSource:A,ALL_FORMATS:y,WAVE:w}=await Promise.resolve().then(function(){return fY}),E=new l({formats:y,source:new h(t)});s.push(()=>E.dispose());const S=new d({format:new p,target:new m}),k=await f.init({input:E,output:S,audio:{sampleRate:1e3,codec:"pcm-s16"}});if(s.push(()=>k.cancel()),await k.execute(),!S.target.buffer)throw new Error("No Output Buffer");const T=new l({formats:[w],source:new A(S.target.buffer)});s.push(()=>T.dispose());const C=await T.getPrimaryAudioTrack();if(!C)throw new Error("No Audio Track");const _=new g(C);let x=new Uint8Array;for await(const P of _.samples()){s.push(()=>P.close());const{numberOfChannels:v}=P,M=[];let D=1/0;for(let N=0;N<v;N++){const Q=P.allocationSize({format:"s16-planar",planeIndex:N}),G=new Int16Array(Q/2);P.copyTo(G,{format:"s16-planar",planeIndex:N}),M.push(G),D=Math.min(D,G.length)}const O=new Int16Array(D);for(let N=0;N<D;N++){const Q=M.reduce((G,V)=>G+V[N],0)/v;O[N]=Q}x=Uv(x,new Uint8Array(O.buffer)),P.close()}c($t(Yk(x,e,n)))}catch(l){c(we(Lt(l)))}})(),a},aW=async(t,e,n,r,i,s)=>{const a=performance.now(),o=await rW({signal:r,timeout:i,...s}),c=performance.now()-a;if(!o.ok)return o;if(r!=null&&r.aborted)return we(new Error("Pcm data operation was aborted"));const{value:u}=o,l=crypto.randomUUID(),d=`audio-${l}`,f=`pcm-${l}`,h=async()=>{await Promise.all([u.deleteFile(d).catch(()=>null),u.deleteFile(f).catch(()=>null)])};try{if(!await u.writeFile(d,new Uint8Array(await t.arrayBuffer()),{signal:r}))throw new Error(`FFmpeg couldn't write ${d}`);const p=await u.exec([...`-i ${d} -ac 1 -filter_complex:a aresample=1000 -map 0:a -c:a pcm_s16le -f data ${f}`.split(" ").filter(y=>!!y)],i-c,{signal:r});if(p!==0)throw new Error(`FFmpeg executed with code: ${p}`);const g=await u.readFile(f,void 0,{signal:r});if(!(g instanceof Uint8Array))throw new Error("FFmpeg read file didn't return binary data");const A=Yk(g,e,n);return $t(A)}catch(m){return we(Lt(m,new Error(`Pcm data error: ${m}`)))}finally{await h()}},oW=async(t,e)=>{if(t.size>Kk)return we(new Error(`Pcm data size limit is ${Nm(Kk)}`));const{maxLength:n=8e3,precision:r=1e4,signal:i,timeout:s=45e3,ffmpegOptions:a}=e||{},o=await sW(t,n,r,i,s);return o.ok?o:(console.log(o.error),aW(t,n,r,i,s,a))},cW=async(t,e)=>{const n=await oW(t,e);if(!n.ok)return null;try{const r={length:n.value.length,data:n.value},i=new TextEncoder().encode(JSON.stringify(r));return new Blob([i],{type:"application/json"})}catch{return null}},uW=3,jk=async(t,e,n)=>{var p;const{init:r,retry:i,signal:s,onPartCreated:a,onPartStart:o,onPartProgress:c,onPartEnd:u}=n||{},{data:l,partNumber:d}=t,f={partNumber:d,size:l.size};a==null||a(f);let h=0,m=null;for(;;){let g,A;try{({url:g,method:A}=await e())}catch(E){return we(Lt(E,new Error(`S3 Part upload could not resolve URL for Part #${d}`)))}const y=await Y8(g,{init:async E=>{const S=await J8(r,E)||{};return{...S,withCredentials:!1,signal:a_(S.signal,s),method:A,body:l,progressStall:2e4,headers:Ul(S.headers,{"content-type":l.type||"application/octet-stream"})}},inspect:E=>!(E.status>=200&&E.status<300)&&we(new Qn(new Error(`S3 Part upload (${A}) failed for Part #${d}. (${E.status})`),E)),uploadCallbacks:{onLoadStart(E){o==null||o(f,{loaded:E.loaded,total:E.total})},onProgress(E){c==null||c(f,{loaded:E.loaded,total:E.total})},onLoad(E){u==null||u(f,{loaded:E.loaded,total:E.total})}}});if(y.ok){const E=y.value.getResponseHeader("ETag");return E?$t({partNumber:d,size:l.size,eTag:E}):we(new Error("S3 Part upload could not find eTag header in upload response"))}m=y.error;let w;try{w=await Z8(i,h,y.error)}catch{break}if(typeof w!="number"||((p=y.error.xhr)==null?void 0:p.status)===403&&h>=uW)break;w>0&&await new Promise(E=>setTimeout(E,w)),h++}
516return we(new Error(`S3 Part upload could not upload data (${Nm(l.size)}): ${(m==null?void 0:m.message)??"Unknown error"}`))},lW=async(t,e,n)=>{const{apiOptions:r,createUploadRequest:i}=e,{signal:s,retry:a,onProgress:o}=n||{},c=Yp(b_,{...r,retry:a}),u=await zl(c.createSingleFileUpload({createUploadRequest:i}));if(!u.ok)return we(u.error);const{method:l,url:d,resultS3Url:f}=u.value,h={partNumber:1,data:new Blob};try{await t.pipeTo(new WritableStream({write:g=>{h.data=new Blob([h.data,g])}}),{signal:s})}catch(g){return we(new Error(`S3 Singlepart upload stream error: ${Lt(g).message}`))}let m={loaded:0};const p=await jk(h,async()=>({url:d,method:l}),{...n,onPartProgress:(g,A)=>{var y;(y=n==null?void 0:n.onPartProgress)==null||y.call(n,g,A),m={...A,loaded:Math.max(m.loaded,A.loaded)},o==null||o(m)}});return p.ok?$t({s3Url:f,size:p.value.size,parts:[p.value]}):we(new Error(`S3 Singlepart upload error: ${p.error.message}`))},dW=async(t,e,n,r)=>jk(n,async()=>{const s=await zl(t.signPart({...e,partNumber:n.partNumber}));if(!s.ok)throw new Error(`Could not sign part #${n.partNumber} (${Nm(n.data.size)}): ${s.error.code}`);return s.value},r),fW=async(t,e,n,r)=>{const{apiOptions:i,createUploadRequest:s}=e,{maxPartSize:a,maxParallelParts:o}=n,{signal:c,retry:u,onProgress:l}=r||{},d=Yp(b_,{...i,async init(T,C){const _=await h_(i.init,T,C);return nc(f,_.signal),{..._,signal:f.signal}},retry:u}),f=new AbortController,h=await zl(d.createMultipartFileUpload({createUploadRequest:s}));if(!h.ok)return we(h.error);const m=new Map,p=[],g=new Map;let A={partNumber:1,data:new Blob([])};const y=T=>{if(Array.from(g.keys()).find(({partNumber:D})=>D===T.partNumber)||p.find(({partNumber:D})=>D===T.partNumber))return;const{data:x,partNumber:P}=T;if(x.size===0&&P!==1)return;const v={partNumber:P,size:x.size},M=dW(d,h.value,T,{...r,signal:f.signal,onPartProgress:(D,O)=>{var Q;(Q=r==null?void 0:r.onPartProgress)==null||Q.call(r,D,O);const N=m.get(D)||O;m.set(D,{...N,loaded:Math.max(N.loaded,O.loaded)}),l==null||l(Array.from(m.values()).reduce((G,{loaded:V})=>({...G,loaded:G.loaded+V}),{loaded:0}))}});g.set(v,M)},w=T=>{const C=Array.from(g.entries()).find(([{partNumber:_}])=>_===T.partNumber);C&&g.delete(C[0]),p.push(T)},E=T=>{k(T),g.clear(),m.clear(),f.signal.aborted||f.abort(T)},{promise:S,resolve:k}=di();return f.signal.addEventListener("abort",()=>{const{reason:T}=f.signal;E(we(Lt(T,new Error(`S3 Multipart upload aborted: ${T}`))))}),nc(f,c),(async()=>{try{await t.pipeTo(new WritableStream({async write(C){if(A.data=new Blob([A.data,C]),A.data.size>=a){const _=A.data.slice(0,a),x={partNumber:A.partNumber,data:_};y(x),A={partNumber:A.partNumber+1,data:A.data.slice(x.data.size)}}if(g.size>=o){const _=Array.from(g.values()),x=await Promise.race(_);if(!x.ok)throw x.error;w(x.value)}},async close(){const C=A.data.slice(0,a),_={partNumber:A.partNumber,data:C};y(_);const x=Array.from(g.values()),P=await Promise.all(x);for(const v of P){if(!v.ok)throw v.error;w(v.value)}}}),{signal:f.signal}),p.sort((C,_)=>C.partNumber-_.partNumber);const T=await zl(d.completeMultipartUpload({...h.value,completeMultipartUploadRequest:{parts:p}}));if(!T.ok)throw new Error(`Could not complete multipart upload: ${T.error.code}`);E($t({s3Url:T.value.resultS3Url,size:p.reduce((C,{size:_})=>C+_,0),parts:p.map(({partNumber:C,size:_})=>({partNumber:C,size:_}))}))}catch(T){E(we(new Error(`S3 Multipart upload error: ${Lt(T).message}`)))}})(),S},$k=(t,e,n,r)=>{const{strategies:i=["stream","multipart","singlepart"]}=r||{},{promise:s,resolve:a}=di();return(async()=>{try{for(const o of i)if(o!=="stream"){if(o==="multipart"){a(await fW(t,e,n,r));return}if(o==="singlepart"){a(await lW(t,e,r));return}}}catch(o){a(we(Lt(o,new Error(`S3 Upload error: ${o}
516`))))}a(we(new Error(`S3 Upload no strategy returned a result. (${i.join(", ")})`)))})(),s};var od={staticContentItemEncryptionIvs:{mainFileNameBase64:"EtrUFVLIRAW8aUCd",mainFileBase64:"C8aZG384/qPpBzg=",mainFileSha1Base64:"6Q+YlJkg8RFR/FHN",previewFileBase64:"i3iv8Nv2xEje9VE="}};const Um=256,Xk=["encrypt","decrypt"],hW={ASYMMETRIC_PRIVATE_KEY:{keyFormat:"jwk",keyProperties:{name:"ECDH",namedCurve:"P-256"},keyUsages:["deriveBits","deriveKey"]},"SYMMETRIC_AES-GCM_KEY":{keyFormat:"raw",keyProperties:{name:"AES-GCM",length:Um},keyUsages:Xk},"SYMMETRIC_AES-CTR_KEY":{keyFormat:"raw",keyProperties:{name:"AES-CTR",length:Um},keyUsages:Xk},WRAPPING_KEY:{keyFormat:"raw",keyProperties:{name:"AES-KW",length:Um},keyUsages:["wrapKey","unwrapKey"]},WRAPPED_ASYMMETRIC_PRIVATE_KEY:{keyFormat:"raw",keyProperties:{name:"AES-CTR"},keyUsages:["wrapKey"]}},Jk=new Map,Zk=new Map;class rr{static getKeyProperties(e){return hW[e]}async createKeyWrappingKey(){const e=rr.getKeyProperties("WRAPPING_KEY");return crypto.subtle.generateKey(e.keyProperties,!0,e.keyUsages)}async createEncryptionAesCryptoKey(e){const n=rr.getKeyProperties(e);return{aesKeyType:e,cryptoKey:await crypto.subtle.generateKey(n.keyProperties,!0,n.keyUsages)}}async deriveEncryptionKeyFromAesKey(e,n){const r=rr.getKeyProperties(e.aesKeyType),i=await crypto.subtle.exportKey("raw",e.cryptoKey),s=await crypto.subtle.importKey("raw",i,"HKDF",!1,["deriveKey"]),a=new TextEncoder;return{aesKeyType:e.aesKeyType,cryptoKey:await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",info:a.encode(n),salt:a.encode("no-salt-because-it-needs-to-be-deterministic")},s,r.keyProperties,!0,r.keyUsages)}}async serializeEncryptionAesCryptoKey({aesKeyType:e,cryptoKey:n}){return{aesKeyType:e,jwk:await crypto.subtle.exportKey("jwk",n)}}async deserializeEncryptionAesCryptoKey({aesKeyType:e,jwk:n}){const r=rr.getKeyProperties(e);return{aesKeyType:e,cryptoKey:await crypto.subtle.importKey("jwk",n,r.keyProperties,!0,r.keyUsages)}}randomSalt(){return crypto.getRandomValues(new Uint8Array(16))}async wrapWithPassphrase(e,n,r){const i=await this.generateWrappingKeyFromPassphrase(e,n),s=this.getWrappingFormat(r);return crypto.subtle.wrapKey(s,r,i,"AES-KW")}async extractPrivateKeyAndWrapWithPassphrase(e,n,r){const i=await this.generateWrappingKeyFromPassphrase(e,n);return this.extractPrivateKeyAndWrapWithWrappingKey(i,r)}async unwrapKeyWithPassphrase(e,n,r,i){const s=`${i}_${e}_${jn(n)}_${jn(r)}`,a=Zk.get(s);if(a)return a;const o=await this.generateWrappingKeyFromPassphrase(e,n),{keyFormat:c,keyProperties:u,keyUsages:l}=rr.getKeyProperties(i),d=await crypto.subtle.unwrapKey(c,r,o,"AES-KW",u,!0,l);return Zk.set(s,d),d}async unwrapKeyWithWrappingKey(e,n,r){const{keyFormat:i,keyProperties:s,keyUsages:a}=rr.getKeyProperties(r);return crypto.subtle.unwrapKey(i,n,e,"AES-KW",s,!0,a)}wrapWithWrappingKey(e,n){return crypto.subtle.wrapKey(this.getWrappingFormat(n),n,e,"AES-KW")}async extractPrivateKeyAndWrapWithWrappingKey(e,n){const r=await this.extractPrivateKey(n),i=await crypto.subtle.importKey("raw",Bt(r),{name:"AES-CTR"},!0,["wrapKey"]);return crypto.subtle.wrapKey("raw",i,e,"AES-KW")}async encryptAesGcm(e,n,r){const i=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e.cryptoKey,n);return{iv:r,encryptedData:i}}async encryptAesCtr(e,n,r,i){const s=this.getAesCtrNonce(r,i),a=await crypto.subtle.encrypt({name:"AES-CTR",counter:s,length:40},e.cryptoKey,n),o=i+Math.ceil(n.byteLength/16);return{iv:r,encryptedData:a,newCounter:o}}getAesCtrNonce(e,n){if(e.byteLength!==11)throw new Error("IV must be 11 bytes");if(n<0||n>0xffffffffff||!Number.isInteger(n))throw new Error("Counter must be a non-negative integer not exceeding 40 bits");const r=new ArrayBuffer(16);new Uint8Array(r).set(new Uint8Array(e),0);const s=new DataView(r,11,5);return s.setUint32(0,Math.floor(n/256),!1),s.setUint8(4,n%256),r}decryptAesGcm(e,n,r){return r.byteLength===0?new ArrayBuffer(0):crypto.subtle.decrypt({name:"AES-GCM",iv:n},e.cryptoKey,r)}async decryptAesCtr(e,n,r,i){if(i.byteLength==0)return{decryptedData:new ArrayBuffer(0),newCounter:r};const a={name:"AES-CTR",counter:this.getAesCtrNonce(n,r),length:40},o=await crypto.subtle.decrypt(a,e.cryptoKey,i),c=r+Math.ceil(i.byteLength/16);return{decryptedData:o,newCounter:c}}async exportPrivateKey(e){return JSON.stringify(await crypto.subtle.exportKey("jwk",e))}async importPrivateKey(e){const{keyProperties:n}=rr.getKeyProperties("ASYMMETRIC_PRIVATE_KEY");return await crypto.subtle.importKey("jwk",e,n,!0,["deriveKey","deriveBits"])}async generateWrappingKeyFromPassphrase(e,n){const r=`${e}_${jn(n)}`,i=Jk.get(r);if(i)return i;const s=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),a=rr.getKeyProperties("WRAPPING_KEY"),o=await crypto.subtle.deriveKey({name:"PBKDF2",iterations:1e5,hash:"SHA-256",salt:n},s,a.keyProperties,!0,a.keyUsages);return Jk.set(r,o),o}getWrappingFormat(e){switch(e.type){case"private":return"jwk";case"public":case"secret":return"raw";default:throw new Error("Unsupported")}}async extractPrivateKey(e){if(e.type==="secret")return jn(await crypto.subtle.exportKey("raw",e));const r=(await crypto.subtle.exportKey("jwk",e)).d;if(!r)throw Error("Could not extract private-key part");return Nv(r)}}class eI{constructor(e){this.encryptionKeys=e,this.utf8TextEncoder=new TextEncoder,this.symmetricKeyService=new rr}async encryptFileContents(e){return await this.encryptAesCtr(e,Bt(od.staticContentItemEncryptionIvs.mainFileBase64))}async encryptPreview(e){return await this.encryptAesCtr(e,Bt(od.staticContentItemEncryptionIvs.previewFileBase64))}async encryptFileName(e){const n=await this.encryptAesGcm(this.utf8TextEncoder.encode(e),Bt(od.staticContentItemEncryptionIvs.mainFileNameBase64));return{nameEncrypted:jn(n)}}async encryptSha1(e){const n=await this.encryptAesGcm(e,Bt(od.staticContentItemEncryptionIvs.mainFileSha1Base64));return{sha1Encrypted:jn(n)}}async encryptAesGcm(e,n){const r=this.encryptionKeys.aesGcmCryptoKey;if(n.byteLength!==12)throw Error("AES-GCM requires a 12-byte IV");return(await this.symmetricKeyService.encryptAesGcm(r,e,n)).encryptedData}async encryptAesCtr(e,n){const r=this.encryptionKeys.aesCtrCryptoKey,i=this.symmetricKeyService;if(n.byteLength!==11)throw Error("AES-CTR requires a 11-byte IV");let s=0,a=new Uint8Array(0);const o=new TransformStream({async transform(c,u){const l=new Uint8Array(a.byteLength+c.byteLength);l.set(a,0),l.set(c,a.byteLength);const d=Math.floor(l.byteLength/16)*16,f=l.slice(0,d),{encryptedData:h,newCounter:m}=await i.encryptAesCtr(r,f,n,s);u.enqueue(new Uint8Array(h)),a=l.slice(d),s=m},async flush(c){if(a.byteLength>0){const{encryptedData:u,newCounter:l}=await i.encryptAesCtr(r,a,n,s);c.enqueue(new Uint8Array(u)),s=l}}});return e.pipeThrough(o)}}const tI=async t=>{const e=new rr,[n,r]=await Promise.all([e.deserializeEncryptionAesCryptoKey(t.aesGcmJwk),e.deserializeEncryptionAesCryptoKey(t.aesCtrJwk)]);return{ephemeralPublicKey:t.ephemeralPublicKey,aesGcmCryptoKey:n,aesCtrCryptoKey:r}},nI={sha1Names:["x6BHXOMaRK5nCIjWOP9ftrwFJyA="],sha1Hashes:["PmB5hC7xpfiwsuTAiBQxdYgloAw=","Mv6gYUOyM/x6SKQ2xYc2jqOxy04="]},Es=new zH(self),rI=L8({minDelay:1e3,maxDelay:2e4}),iI=Es.getCsrfFetcher(),sI=Es.getAuthFetcher(),cd=new Map,pW="upload_limit_reached",aI=t=>{t instanceof Hr&&t.code===pW||reportError(t)};typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&(addEventListener("error",({error:t})=>{throw t instanceof Error?t:typeof t=="string"?new Error(t):new Error(`[Upload worker] error: ${t}`)}),addEventListener("unhandledrejection",({reason:t})=>{throw t instanceof Error?t:typeof t=="string"?new Error(t):new Error(`[Upload worker] unhandledrejection: ${t}`)}),addEventListener("message",async t=>{var n;const{data:e}=t;switch(e.type){case"imagePreviewCancel":{(n=cd.get(e.id))==null||n.abort(),cd.delete(e.id);break}case"imagePreview":{const r=new AbortController;cd.set(e.id,r);try{const i=await JH(e.fileData,e.metadata,r.signal).catch(()=>null);r.signal.aborted||postMessage({type:"imagePreview",id:e.id,imagePreview:i})}finally{cd.delete(e.id)}break}case"audioWaveformJsonPreview":{postMessage({type:"audioWaveformJsonPreview",waveformJsonPreview:await cW(e.fileData,{ffmpegOptions:e.ffmpegOptions}).catch(()=>null)});break}case"previewUpload":{const r=await mW(e.preview,e.openUploadResultSerialized,e.encryptionKeysSerialized,e.uploadMultipartOptions).catch(i=>(aI(i),null));postMessage({type:"previewUpload",previewId:e.preview.id,previewItem:r});break}case"fileUpload":{try{postMessage({type:"fileUpload",uploadedFile:await gW(e.openUploadResultSerialized,e.encryptionKeysSerialized,e.uploadMultipartOptions)})}catch(r){aI(r),postMessage({type:"fileUpload",error:r instanceof Error?r.message:"Upload failed",errorCode:r instanceof Hr?r.code:void 0})}break}}}),Es.start());async function mW(t,e,n,r){const{id:i,previewType:s,fileDescriptor:{data:a,type:o}}=t;if(!a)throw new Error("Couldn't get preview data");const u=await new eI(await tI(n)).encryptPreview(a.stream()),l={...await Es.getApiOptions(),init:(...f)=>Es.getApiOptionsInit(...f),csrfFetcher:iI,authFetcher:sI},d=await $k(u,{apiOptions:l,createUploadRequest:{sharingBucket:e.sharingBucket,contentItem:e.contentItem,fileEncryptionKey:e.f
516ileEncryptionKey,metadataId:i}},r,{strategies:["stream","singlepart"],retry:(f,{underlyingError:h,response:m})=>{if(!(Gp(m)||!m&&!c_(h)))return rI(f)}});if(!d.ok)throw d.error;return{id:t.id,mediaType:o,type:s}}async function gW(t,e,n){let r=0,i=0,s=null;const{fileDescriptor:a,sources:o,sharingBucket:c,contentItem:u,fileEncryptionKey:l}=t,d={...await Es.getApiOptions(),init:(...T)=>Es.getApiOptionsInit(...T),csrfFetcher:iI,authFetcher:sI},f=new eI(await tI(e)),h=()=>{const T=r,C=s?s.sourceBytesRead/a.size*(i/s.destinationBytesWritten):i/a.size;r=Math.max(0,Math.min(1,Math.max(C,T)))||0,postMessage({type:"fileUploadProgress",progress:r})},m=async()=>{if(o.length>1){const{zipStream:T,writeZip:C}=await kH({},{onProgress(_){s=_,h()}});return C(o.map(_=>{const x=_.path.startsWith(mc)?_.path.slice(1):_.path;if(!x)throw new Error(`Invalid file path: ${_.path}`);return async()=>({path:x,stream:(await oI(_.id)).stream()})})),T}return(await oI(o[0].id)).stream()},p=new Dk,[g,{nameEncrypted:A}]=await Promise.all([f.encryptFileContents((await m()).pipeThrough(p)),f.encryptFileName(a.name)]),y=new Date,w=await $k(g,{apiOptions:d,createUploadRequest:{contentItem:u,sharingBucket:c,fileEncryptionKey:l}},n,{retry:(T,{underlyingError:C,response:_})=>{if(!(Gp(_)&&(_==null?void 0:_.status)!==403||!_&&!c_(C)))return rI(T)},onProgress:({loaded:T})=>{i=T,h()}});if(!w.ok)throw w.error;const{size:E}=w.value,[{sha1Encrypted:S}]=await Promise.all([f.encryptSha1(await p.getSha1().then(T=>{if(nI.sha1Hashes.includes(jn(T)))throw new Error("File Upload Error: 2h41");return T})),AW(a.name).then(T=>{if(nI.sha1Names.includes(jn(T)))throw new Error("File Upload Error: u4w3")}),Yp(Gz,d).logEvent({logEventRequestInner:[{logEventType:"UploadLogEvent",startedAt:y,finishedAt:new Date,sharingBucketId:c.id,size:E}]})]);return{originalSharingBucketId:c.id,nameEncrypted:A,sha1Encrypted:S,size:E}}async function oI(t){return new Promise(e=>{const n=r=>{const{data:i}=r;switch(i.type){case"fileSourceData":{if(i.id!==t)return;self.removeEventListener("message",n),e(i.sourceData);break}}};self.addEventListener("message",n),self.postMessage({type:"fileSourceData",id:t})})}async function AW(t){const e=new Dk;return await new ReadableStream({start(n){n.enqueue(new TextEncoder().encode(t)),n.close()}}).pipeThrough(e).pipeTo(new WritableStream),e.getSha1()}var yW=Object.freeze({__proto__:null}),Je;(function(t){t.LOAD="LOAD",t.EXEC="EXEC",t.FFPROBE="FFPROBE",t.WRITE_FILE="WRITE_FILE",t.READ_FILE="READ_FILE",t.DELETE_FILE="DELETE_FILE",t.RENAME="RENAME",t.CREATE_DIR="CREATE_DIR",t.LIST_DIR="LIST_DIR",t.DELETE_DIR="DELETE_DIR",t.ERROR="ERROR",t.DOWNLOAD="DOWNLOAD",t.PROGRESS="PROGRESS",t.LOG="LOG",t.MOUNT="MOUNT",t.UNMOUNT="UNMOUNT"})(Je||(Je={}));const wW=(()=>{let t=0;return()=>t++})(),bW=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),EW=new Error("called FFmpeg.terminate()");class SW{constructor(){ji(this,Dn,null);ji(this,Ki,{});ji(this,li,{});ji(this,Qs,[]);ji(this,Hs,[]);gn(this,"loaded",!1);ji(this,mf,()=>{Qe(this,Dn)&&(Qe(this,Dn).onmessage=({data:{id:e,type:n,data:r}})=>{switch(n){case Je.LOAD:this.loaded=!0,Qe(this,Ki)[e](r);break;case Je.MOUNT:case Je.UNMOUNT:case Je.EXEC:case Je.FFPROBE:case Je.WRITE_FILE:case Je.READ_FILE:case Je.DELETE_FILE:case Je.RENAME:case Je.CREATE_DIR:case Je.LIST_DIR:case Je.DELETE_DIR:Qe(this,Ki)[e](r);break;case Je.LOG:Qe(this,Qs).forEach(i=>i(r));break;case Je.PROGRESS:Qe(this,Hs).forEach(i=>i(r));break;case Je.ERROR:Qe(this,li)[e](r);break}delete Qe(this,Ki)[e],delete Qe(this,li)[e]})});ji(this,pn,({type:e,data:n},r=[],i)=>Qe(this,Dn)?new Promise((s,a)=>{const o=wW();Qe(this,Dn)&&Qe(this,Dn).postMessage({id:o,type:e,data:n},r),Qe(this,Ki)[o]=s,Qe(this,li)[o]=a,i==null||i.addEventListener("abort",()=>{a(new DOMException(`Message # ${o} was aborted`,"AbortError"))},{once:!0})}):Promise.reject(bW));gn(this,"load",({classWorkerURL:e,...n}={},{signal:r}={})=>(Qe(this,Dn)||(Zc(this,Dn,e?new Worker(new URL(e,self.location.href),{type:"module"}):new Worker(new URL("/build/workers/worker-BAOIWoxA.js",self.location.href),{type:"module"})),Qe(this,mf).call(this)),Qe(this,pn).call(this,{type:Je.LOAD,data:n},void 0,r)));gn(this,"exec",(e,n=-1,{signal:r}={})=>Qe(this,pn).call(this,{type:Je.EXEC,data:{args:e,timeout:n}},void 0,r));gn(this,"ffprobe",(e,n=-1,{signal:r}={})=>Qe(this,pn).call(this,{type:Je.FFPROBE,data:{args:e,timeout:n}},void 0,r));gn(this,"terminate",()=>{const e=Object.keys(Qe(this,li));for(const n of e)Qe(this,li)[n](EW),delete Qe(this,li)[n],delete Qe(this,Ki)[n];Qe(this,Dn)&&(Qe(this,Dn).terminate(),Zc(this,Dn,null),this.loaded=!1)});gn(this,"writeFile",(e,n,{signal:r}={})=>{const i=[];return n instanceof Uint8Array&&i.push(n.buffer),Qe(this,pn).call(this,{type:Je.WRITE_FILE,data:{path:e,data:n}},i,r)});gn(this,"mount",(e,n,r)=>{const i=[];return Qe(this,pn).call(this,{type:Je.MOUNT,data:{fsType:e,options:n,mountPoint:r}},i)});gn(this,"unmount",e=>{const n=[];return Qe(this,pn).call(this,{type:Je.UNMOUNT,data:{mountPoint:e}},n)});gn(this,"readFile",(e,n="binary",{signal:r}={})=>Qe(this,pn).call(this,{type:Je.READ_FILE,data:{path:e,encoding:n}},void 0,r));gn(this,"deleteFile",(e,{signal:n}={})=>Qe(this,pn).call(this,{type:Je.DELETE_FILE,data:{path:e}},void 0,n));gn(this,"rename",(e,n,{signal:r}={})=>Qe(this,pn).call(this,{type:Je.RENAME,data:{oldPath:e,newPath:n}},void 0,r));gn(this,"createDir",(e,{signal:n}={})=>Qe(this,pn).call(this,{type:Je.CREATE_DIR,data:{path:e}},void 0,n));gn(this,"listDir",(e,{signal:n}={})=>Qe(this,pn).call(this,{type:Je.LIST_DIR,data:{path:e}},void 0,n));gn(this,"deleteDir",(e,{signal:n}={})=>Qe(this,pn).call(this,{type:Je.DELETE_DIR,data:{path:e}},void 0,n))}on(e,n){e==="log"?Qe(this,Qs).push(n):e==="progress"&&Qe(this,Hs).push(n)}off(e,n){e==="log"?Zc(this,Qs,Qe(this,Qs).filter(r=>r!==n)):e==="progress"&&Zc(this,Hs,Qe(this,Hs).filter(r=>r!==n))}}Dn=new WeakMap,Ki=new WeakMap,li=new WeakMap,Qs=new WeakMap,Hs=new WeakMap,mf=new WeakMap,pn=new WeakMap;var Lm;(function(t){t.MEMFS="MEMFS",t.NODEFS="NODEFS",t.NODERAWFS="NODERAWFS",t.IDBFS="IDBFS",t.WORKERFS="WORKERFS",t.PROXYFS="PROXYFS"})(Lm||(Lm={}));var _W=Object.freeze({__proto__:null,get FFFSType(){return Lm},FFmpeg:SW});/*!
517 * Copyright (c) 2026-present, Vanilagy and contributors
518 *
519 * This Source Code Form is subject to the terms of the Mozilla Public
520 * License, v. 2.0. If a copy of the MPL was not distributed with this
521 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
522 */function b(t){if(!t)throw new Error("Assertion failed.")}const Na=t=>{const e=(t%360+360)%360;if(e===0||e===90||e===180||e===270)return e;throw new Error(`Invalid rotation ${t}.`)},yt=t=>t&&t[t.length-1],Mi=t=>t>=0&&t<2**32,ee=t=>{let e=0;for(;t.readBits(1)===0&&e<32;)e++;if(e>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<e)-1+t.readBits(e)},qr=t=>{const e=ee(t);return(e&1)===0?-(e>>1):e+1>>1},TW=(t,e,n,r)=>{for(let i=e;i<n;i++){const s=Math.floor(i/8);let a=t[s];const o=7-(i&7);a&=~(1<<o),a|=(r&1<<n-i-1)>>n-i-1<<o,t[s]=a}},dt=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),_e=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),xn=new TextDecoder,tt=new TextEncoder,Yr=t=>{for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>255)return!1;return!0},zm=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[n,e])),Ss={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},ud=zm(Ss),_s={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},ld=zm(_s),Ts={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},dd=zm(Ts),cI=t=>!!t&&!!t.primaries&&!!t.transfer&&!!t.matrix&&t.fullRange!==void 0,Ua=t=>t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||ArrayBuffer.isView(t);class ks{constructor(){this.currentPromise=Promise.resolve(),this.pending=0}async acquire(){let e;const n=new Promise(i=>{let s=!1;e=()=>{s||(i(),this.pending--,s=!0)}}),r=this.currentPromise;return this.currentPromise=n,this.pending++,await r,e}}const kW=/^[0-9a-fA-F]+$/,Ac=t=>[...t].map(e=>e.toString(16).padStart(2,"0")).join(""),IW=t=>{b(t.length%2===0);const e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n/2]=parseInt(t.slice(n,n+2),16);return e},uI=t=>(t=t>>1&1431655765|(t&1431655765)<<1,t=t>>2&858993459|(t&858993459)<<2,t=t>>4&252645135|(t&252645135)<<4,t=t>>
5228&16711935|(t&16711935)<<8,t=t>>16&65535|(t&65535)<<16,t>>>0),yc=(t,e,n)=>{let r=0,i=t.length-1,s=-1;for(;r<=i;){const a=r+i>>1,o=n(t[a]);o===e?(s=a,i=a-1):o<e?r=a+1:i=a-1}return s},Ge=(t,e,n)=>{let r=0,i=t.length-1,s=-1;for(;r<=i;){const a=r+(i-r+1)/2|0;n(t[a])<=e?(s=a,r=a+1):i=a-1}return s},lI=(t,e,n)=>{const r=Ge(t,n(e),n);t.splice(r+1,0,e)},wt=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}},dI=(t,e)=>{const n=t.indexOf(e);n!==-1&&t.splice(n,1)},fI=(t,e)=>{for(let n=t.length-1;n>=0;n--)if(e(t[n]))return t[n]},fd=(t,e)=>{for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1},CW=async function*(t){Symbol.iterator in t?yield*t[Symbol.iterator]():yield*t[Symbol.asyncIterator]()},xW=t=>{if(!(Symbol.iterator in t)&&!(Symbol.asyncIterator in t))throw new TypeError("Argument must be an iterable or async iterable.")},rn=t=>{throw new Error(`Unexpected value: ${t}`)},hd=(t,e,n)=>{const r=t.getUint8(e),i=t.getUint8(e+1),s=t.getUint8(e+2);return n?r|i<<8|s<<16:r<<16|i<<8|s},vW=(t,e,n)=>hd(t,e,n)<<8>>8,pd=(t,e,n,r)=>{n=n>>>0,n=n&16777215,r?(t.setUint8(e,n&255),t.setUint8(e+1,n>>>8&255),t.setUint8(e+2,n>>>16&255)):(t.setUint8(e,n>>>16&255),t.setUint8(e+1,n>>>8&255),t.setUint8(e+2,n&255))},BW=(t,e,n,r)=>{n=Yt(n,-8388608,8388607),n<0&&(n=n+16777216&16777215),pd(t,e,n,r)},PW=(t,e,n,r)=>{t.setUint32(e+0,n,!0),t.setInt32(e+4,Math.floor(n/2**32),!0)},md=(t,e)=>({async next(){const n=await t.next();return n.done?{value:void 0,done:!0}:{value:e(n.value),done:!1}},return(){return t.return()},throw(n){return t.throw(n)},[Symbol.asyncIterator](){return this}}),Yt=(t,e,n)=>Math.max(e,Math.min(n,t)),Kt="und",wc=t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t},Qm=(t,e)=>Math.round(t/e)*e,La=(t,e)=>Math.round(t*e)/e,Hm=(t,e)=>Math.floor(t/e)*e,hI=(t,e)=>Math.floor(t*e)/e,RW=t=>{let e=0;for(;t;)e++,t>>=1;return e},FW=/^[a-z]{3}$/,bc=t=>FW.test(t),Di=1e6*(1+Number.EPSILON),MW=(t,e)=>{const n={...t,...e};if(t.headers||e.headers){const r=t.headers?pI(t.headers):{},i=e.headers?pI(e.headers):{},s={...r};Object.entries(i).forEach(([a,o])=>{const c=Object.keys(s).find(u=>u.toLowerCase()===a.toLowerCase());c&&delete s[c],s[a]=o}),n.headers=s}return n},pI=t=>{if(t instanceof Headers){const e={};return t.forEach((n,r)=>{e[r]=n}),e}if(Array.isArray(t)){const e={};return t.forEach(([n,r])=>{e[n]=r}),e}return t},DW=async(t,e,n,r,i)=>{let s=0;for(;;)try{return await t(e,n)}catch(a){if(i())throw a;s++;const o=r(s,a,e);if(o===null)throw a;if(console.error("Retrying failed fetch. Error:",a),!Number.isFinite(o)||o<0)throw new TypeError("Retry delay must be a non-negative finite number.");if(o>0&&await Jm(1e3*o),i())throw a}},OW=(t,e)=>{const n=t<0?-1:1;t=Math.abs(t);let r=0,i=1,s=1,a=0,o=t;for(;;){const c=Math.floor(o),u=c*s+r,l=c*a+i;if(l>e)return{num:n*s,den:a};if(r=s,i=a,s=u,a=l,o=1/(o-c),!isFinite(o))break}return{num:n*s,den:a}};class Ec{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let Wm=null;const Sc=()=>{var t;return Wm!==null?Wm:Wm=!!(typeof navigator<"u"&&((t=navigator.vendor)!=null&&t.match(/apple/i)||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)))};let Vm=null;const gd=()=>{var t;return Vm!==null?Vm:Vm=typeof navigator<"u"&&((t=navigator.userAgent)==null?void 0:t.includes("Firefox"))};let Gm=null;const qm=()=>{var t;return Gm!==null?Gm:Gm=!!(typeof navigator<"u"&&((t=navigator.vendor)!=null&&t.includes("Google Inc")||/Chrome/.test(navigator.userAgent)))};let Ym=null;const NW=()=>{if(Ym!==null)return Ym;if(typeof navigator>"u")return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Ym=Number(t[1]):null},za=(t,e)=>t!==-1?t:e,Km=(t,e,n,r)=>t<=r&&n<=e,Qa=function*(t){for(const e in t){const n=t[e];n!==void 0&&(yield{key:e,value:n})}},UW=t=>{switch(t.toLowerCase()){case"image/jpeg":case"image/jpg":return".jpg";case"image/png":return".png";case"image/gif":return".gif";case"image/webp":return".webp";case"image/bmp":return".bmp";case"image/svg+xml":return".svg";case"image/tiff":return".tiff";case"image/avif":return".avif";case"image/x-icon":case"image/vnd.microsoft.icon":return".ico";default:return null}},Ad=t=>{const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n},LW=t=>{let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)},mI=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},jm=()=>{Symbol.dispose??(Symbol.dispose=Symbol("Symbol.dispose"))},Ha=t=>typeof t=="number"&&!Number.isNaN(t),en=(t,e)=>{if(e.includes("://"))return e;if(t.includes("://")){const o=t.indexOf("?");
522o!==-1&&(t=t.slice(0,o))}let n;if(e.startsWith("/")){const o=t.indexOf("://");if(o===-1)n=e;else{const c=t.indexOf("/",o+3);c===-1?n=t+e:n=t.slice(0,c)+e}}else{const o=t.lastIndexOf("/");o===-1?n=e:n=t.slice(0,o+1)+e}let r="";const i=n.indexOf("://");if(i!==-1){const o=n.indexOf("/",i+3);o!==-1&&(r=n.slice(0,o),n=n.slice(o))}const s=n.split("/"),a=[];for(const o of s)o===".."?a.pop():o!=="."&&a.push(o);return r+a.join("/")},_c=(t,e)=>{let n=0;for(let r=0;r<t.length;r++)e(t[r])&&n++;return n},$m=(t,e)=>{let n=-1,r=1/0;for(let i=0;i<t.length;i++){const s=e(t[i]);s<r&&(r=s,n=i)}return n},zW=(t,e)=>{let n=-1,r=-1/0;for(let i=0;i<t.length;i++){const s=e(t[i]);s>r&&(r=s,n=i)}return n},Tc=t=>{b(Number.isInteger(t.num)),b(Number.isInteger(t.den)),b(t.den!==0);let e=Math.abs(t.num),n=Math.abs(t.den);for(;n!==0;){const i=e%n;e=n,n=i}const r=e||1;return{num:t.num/r,den:t.den/r}},gI=(t,e)=>{if(typeof t!="object"||!t)throw new TypeError(`${e} must be an object.`);if(!Number.isInteger(t.left)||t.left<0)throw new TypeError(`${e}.left must be a non-negative integer.`);if(!Number.isInteger(t.top)||t.top<0)throw new TypeError(`${e}.top must be a non-negative integer.`);if(!Number.isInteger(t.width)||t.width<0)throw new TypeError(`${e}.width must be a non-negative integer.`);if(!Number.isInteger(t.height)||t.height<0)throw new TypeError(`${e}.height must be a non-negative integer.`)};let kc,QW=1;const AI=new Map,Xm=new Map,yI=()=>typeof window>"u",HW=()=>{const t=new Map,e=new Map;self.onmessage=n=>{const r=n.data;switch(r.type){case"set-timeout":{const i=setTimeout(()=>{t.delete(r.timerId),self.postMessage({type:"fire",timerId:r.timerId})},r.delay);t.set(r.timerId,i)}break;case"set-interval":{const i=setInterval(()=>{self.postMessage({type:"fire",timerId:r.timerId})},r.delay);e.set(r.timerId,i)}break;case"clear-timeout":{const i=t.get(r.timerId);i!==void 0&&(clearTimeout(i),t.delete(r.timerId))}break;case"clear-interval":{const i=e.get(r.timerId);i!==void 0&&(clearInterval(i),e.delete(r.timerId))}break}}},wI=()=>{if(kc)return kc;const t=`(${HW.toString()})();`,e=URL.createObjectURL(new Blob([t],{type:"text/javascript"}));return kc=new Worker(e),URL.revokeObjectURL(e),kc.onmessage=n=>{const r=n.data,i=AI.get(r.timerId);if(i){AI.delete(r.timerId),i();return}const s=Xm.get(r.timerId);s&&s()},kc},WW=(t,e)=>{if(yI())return{id:setInterval(t,e)};const n=QW++;return Xm.set(n,()=>{t()}),wI().postMessage({type:"set-interval",timerId:n,delay:e}),{id:n}},VW=t=>{if(yI()){clearInterval(t.id);return}b(typeof t.id=="number"),Xm.delete(t.id),wI().postMessage({type:"clear-interval",timerId:t.id})},Jm=t=>new Promise(e=>setTimeout(e,t)),Wa=t=>Array.isArray(t)?t:[t];class Ic{constructor(){this._listeners=new Map}on(e,n,r){this._listeners.has(e)||this._listeners.set(e,new Set);const i={fn:n,once:(r==null?void 0:r.once)??!1};return this._listeners.get(e).add(i),()=>{var s;(s=this._listeners.get(e))==null||s.delete(i)}}_emit(...e){const[n,r]=e,i=this._listeners.get(n);if(i)for(const s of i){try{s.fn(r)}catch(a){console.error(a)}s.once&&i.delete(s)}}}const Va=t=>Math.ceil(t/2)*2;class GW{constructor(e){this._queue=[],this._errored=!1,this.parallelism=e}get errored(){return this._errored}get inFlightCount(){return this._queue.length}async run(e){for(this._errored&&await Promise.race(this._queue);this._queue.length>=this.parallelism;)await Promise.race(this._queue);const n=e();this._queue.push(n),n.then(()=>dI(this._queue,n)).catch(()=>this._errored=!0)}async flush(){await Promise.all(this._queue)}}const bI=t=>t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype&&Object.values(t).every(e=>typeof e=="string");/*!
523 * Copyright (c) 2026-present, Vanilagy and contributors
524 *
525 * This Source Code Form is subject to the terms of the Mozilla Public
526 * License, v. 2.0. If a copy of the MPL was not distributed with this
527 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
528 */class Is{constructor(e,n){if(this.data=e,this.mimeType=n,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if(typeof n!="string")throw new TypeError("mimeType must be a string.")}}class yd{constructor(e,n,r,i){if(this.data=e,this.mimeType=n,this.name=r,this.description=i,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");
vendor: 5,082 bytes, lines 528-534
528if(n!==void 0&&typeof n!="string")throw new TypeError("mimeType, when provided, must be a string.");if(r!==void 0&&typeof r!="string")throw new TypeError("name, when provided, must be a string.");if(i!==void 0&&typeof i!="string")throw new TypeError("description, when provided, must be a string.")}}const Zm=t=>{if(!t||typeof t!="object")throw new TypeError("tags must be an object.");if(t.title!==void 0&&typeof t.title!="string")throw new TypeError("tags.title, when provided, must be a string.");if(t.description!==void 0&&typeof t.description!="string")throw new TypeError("tags.description, when provided, must be a string.");if(t.artist!==void 0&&typeof t.artist!="string")throw new TypeError("tags.artist, when provided, must be a string.");if(t.album!==void 0&&typeof t.album!="string")throw new TypeError("tags.album, when provided, must be a string.");if(t.albumArtist!==void 0&&typeof t.albumArtist!="string")throw new TypeError("tags.albumArtist, when provided, must be a string.");if(t.trackNumber!==void 0&&(!Number.isInteger(t.trackNumber)||t.trackNumber<=0))throw new TypeError("tags.trackNumber, when provided, must be a positive integer.");if(t.tracksTotal!==void 0&&(!Number.isInteger(t.tracksTotal)||t.tracksTotal<=0))throw new TypeError("tags.tracksTotal, when provided, must be a positive integer.");if(t.discNumber!==void 0&&(!Number.isInteger(t.discNumber)||t.discNumber<=0))throw new TypeError("tags.discNumber, when provided, must be a positive integer.");if(t.discsTotal!==void 0&&(!Number.isInteger(t.discsTotal)||t.discsTotal<=0))throw new TypeError("tags.discsTotal, when provided, must be a positive integer.");if(t.genre!==void 0&&typeof t.genre!="string")throw new TypeError("tags.genre, when provided, must be a string.");if(t.date!==void 0&&(!(t.date instanceof Date)||Number.isNaN(t.date.getTime())))throw new TypeError("tags.date, when provided, must be a valid Date.");if(t.lyrics!==void 0&&typeof t.lyrics!="string")throw new TypeError("tags.lyrics, when provided, must be a string.");if(t.images!==void 0){if(!Array.isArray(t.images))throw new TypeError("tags.images, when provided, must be an array.");for(const e of t.images){if(!e||typeof e!="object")throw new TypeError("Each image in tags.images must be an object.");if(!(e.data instanceof Uint8Array))throw new TypeError("Each image.data must be a Uint8Array.");if(typeof e.mimeType!="string")throw new TypeError("Each image.mimeType must be a string.");if(!["coverFront","coverBack","unknown"].includes(e.kind))throw new TypeError("Each image.kind must be 'coverFront', 'coverBack', or 'unknown'.")}}if(t.comment!==void 0&&typeof t.comment!="string")throw new TypeError("tags.comment, when provided, must be a string.");if(t.raw!==void 0){if(!t.raw||typeof t.raw!="object")throw new TypeError("tags.raw, when provided, must be an object.");for(const e of Object.values(t.raw))if(e!==null&&typeof e!="string"&&!(e instanceof Uint8Array)&&!(e instanceof Is)&&!(e instanceof yd)&&!bI(e))throw new TypeError("Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, Record<string, string>, or null.")}},Cc=t=>t.title===void 0&&t.description===void 0&&t.artist===void 0&&t.album===void 0&&t.albumArtist===void 0&&t.trackNumber===void 0&&t.tracksTotal===void 0&&t.discNumber===void 0&&t.discsTotal===void 0&&t.genre===void 0&&t.date===void 0&&t.lyrics===void 0&&(!t.images||t.images.length===0)&&t.comment===void 0&&(t.raw===void 0||Object.keys(t.raw).length===0),Kr={default:!0,primary:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1},qW=t=>{if(!t||typeof t!="object")throw new TypeError("disposition must be an object.");if(t.default!==void 0&&typeof t.default!="boolean")throw new TypeError("disposition.default must be a boolean.");if(t.primary!==void 0&&typeof t.primary!="boolean")throw new TypeError("disposition.primary must be a boolean.");if(t.forced!==void 0&&typeof t.forced!="boolean")throw new TypeError("disposition.forced must be a boolean.");if(t.original!==void 0&&typeof t.original!="boolean")throw new TypeError("disposition.original must be a boolean.");if(t.commentary!==void 0&&typeof t.commentary!="boolean")throw new TypeError("disposition.commentary must be a boolean.");if(t.hearingImpaired!==void 0&&typeof t.hearingImpaired!="boolean")throw new TypeError("disposition.hearingImpaired must be a boolean.");if(t.visuallyImpaired!==void 0&&typeof t.visuallyImpaired!="boolean")throw new TypeError("disposition.visuallyImpaired must be a boolean.")};/*!
529 * Copyright (c) 2026-present, Vanilagy and contributors
530 *
531 * This Source Code Form is subject to the terms of the Mozilla Public
532 * License, v. 2.0. If a copy of the MPL was not distributed with this
533 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
534 */class Me{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){const e=Math.floor(this.pos/8),n=this.bytes[e]??0,r=7-(this.pos&7),i=(n&1<<r)>>r;return this.pos++,i}readBits(e){if(e===1)return this.readBit();let n=0;for(let r=0;r<e;r++)n<<=1,n|=this.readBit();return n}
534writeBits(e,n){const r=this.pos+e;for(let i=this.pos;i<r;i++){const s=Math.floor(i/8);let a=this.bytes[s];const o=7-(i&7);a&=~(1<<o),a|=(n&1<<r-i-1)>>r-i-1<<o,this.bytes[s]=a}this.pos=r}readAlignedByte(){if(this.pos%8!==0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,n=this.bytes[e]??0;return this.pos+=8,n}skipBits(e){this.pos+=e}getBitsLeft(){return this.bytes.length*8-this.pos}clone(){const e=new Me(this.bytes);return e.pos=this.pos,e}}/*!
535 * Copyright (c) 2026-present, Vanilagy and contributors
536 *
537 * This Source Code Form is subject to the terms of the Mozilla Public
538 * License, v. 2.0. If a copy of the MPL was not distributed with this
539 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
540 */const Oi=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ga=[-1,1,2,3,4,5,6,8],xc=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Me(t);let n=e.readBits(5);n===31&&(n=32+e.readBits(6));const r=e.readBits(4);let i=null;r===15?i=e.readBits(24):r<Oi.length&&(i=Oi[r]);const s=e.readBits(4);let a=null;return s>=1&&s<=7&&(a=Ga[s]),{objectType:n,frequencyIndex:r,sampleRate:i,channelConfiguration:s,numberOfChannels:a}},eg=t=>{let e=Oi.indexOf(t.sampleRate),n=null;e===-1&&(e=15,n=t.sampleRate);const r=Ga.indexOf(t.numberOfChannels);if(r===-1)throw new TypeError(`Unsupported number of channels: ${t.numberOfChannels}`);let i=13;t.objectType>=32&&(i+=6),e===15&&(i+=24);const s=Math.ceil(i/8),a=new Uint8Array(s),o=new Me(a);return t.objectType<32?o.writeBits(5,t.objectType):(o.writeBits(5,31),o.writeBits(6,t.objectType-32)),o.writeBits(4,e),e===15&&o.writeBits(24,n),o.writeBits(4,r),a},EI=t=>{const e=new Uint8Array(7),n=new Me(e),{objectType:r,frequencyIndex:i,channelConfiguration:s}=t,a=r-1;return n.writeBits(12,4095),n.writeBits(1,0),n.writeBits(2,0),n.writeBits(1,1),n.writeBits(2,a),n.writeBits(4,i),n.writeBits(1,0),n.writeBits(3,s),n.writeBits(1,0),n.writeBits(1,0),n.writeBits(1,0),n.writeBits(1,0),n.skipBits(13),n.writeBits(11,2047),n.writeBits(2,0),{header:e,bitstream:n}},SI=(t,e)=>{t.pos=30,t.writeBits(13,e)};/*!
541 * Copyright (c) 2026-present, Vanilagy and contributors
542 *
543 * This Source Code Form is subject to the terms of the Mozilla Public
544 * License, v. 2.0. If a copy of the MPL was not distributed with this
545 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
546 */const xt=["avc","hevc","vp9","av1","vp8"],Nt=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],Ni=["aac","opus","mp3","vorbis","flac","ac3","eac3"],Ut=[...Ni,...Nt],ir=["webvtt"],wd=[{maxMacroblocks:99,maxBitrate:64e3,maxDpbMbs:396,level:10},{maxMacroblocks:396,maxBitrate:192e3,maxDpbMbs:900,level:11},{maxMacroblocks:396,maxBitrate:384e3,maxDpbMbs:2376,level:12},{maxMacroblocks:396,maxBitrate:768e3,maxDpbMbs:2376,level:13},{maxMacroblocks:396,maxBitrate:2e6,maxDpbMbs:2376,level:20},{maxMacroblocks:792,maxBitrate:4e6,maxDpbMbs:4752,level:21},{maxMacroblocks:1620,maxBitrate:4e6,maxDpbMbs:8100,level:22},{maxMacroblocks:1620,maxBitrate:1e7,maxDpbMbs:8100,level:30},{maxMacroblocks:3600,maxBitrate:14e6,maxDpbMbs:18e3,level:31},{maxMacroblocks:5120,maxBitrate:2e7,maxDpbMbs:20480,level:32},{maxMacroblocks:8192,maxBitrate:2e7,maxDpbMbs:32768,level:40},{maxMacroblocks:8192,maxBitrate:5e7,maxDpbMbs:32768,level:41},{maxMacroblocks:8704,maxBitrate:5e7,maxDpbMbs:34816,level:42},{maxMacroblocks:22080,maxBitrate:135e6,maxDpbMbs:110400,level:50},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:51},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:52},{maxMacroblocks:139264,maxBitrate:24e7,maxDpbMbs:696320,level:60},{maxMacroblocks:139264,maxBitrate:48e7,maxDpbMbs:696320,level:61},{maxMacroblocks:139264,maxBitrate:8e8,maxDpbMbs:696320,level:62}],_I=[{maxPictureSize:36864,maxBitrate:128e3,tier:"L",level:30},{maxPictureSize:122880,maxBitrate:15e5,tier:"L",level:60},{maxPictureSize:245760,maxBitrate:3e6,tier:"L",level:63},{maxPictureSize:552960,maxBitrate:6e6,tier:"L",level:90},{maxPictureSize:983040,maxBitrate:1e7,tier:"L",level:93},{maxPictureSize:2228224,maxBitrate:12e6,tier:"L",level:120},{maxPictureSize:2228224,maxBitrate:3e7,tier:"H",level:120},{maxPictureSize:2228224,maxBitrate:2e7,tier:"L",level:123},{maxPictureSize:2228224,maxBitrate:5e7,tier:"H",level:123},{maxPictureSize:8912896,maxBitrate:25e6,tier:"L",level:150},{maxPictureSize:8912896,maxBitrate:1e8,tier:"H",level:150},{maxPictureSize:8912896,maxBitrate:4e7,tier:"L",level:153},{maxPictureSize:8912896,maxBitrate:16e7,tier:"H",level:153},{maxPictureSize:8912896,maxBitrate:6e7,tier:"L",level:156},{maxPictureSize:8912896,maxBitrate:24e7,tier:"H",level:156},{maxPictureSize:35651584,maxBitrate:6e7,tier:"L",level:180},{maxPictureSize:35651584,maxBitrate:24e7,tier:"H",level:180},{maxPictureSize:35651584,maxBitrate:12e7,tier:"L",level:183},{maxPictureSize:35651584,maxBitrate:48e7,tier:"H",level:183},{maxPictureSize:35651584,maxBitrate:24e7,tier:"L",level:186},{maxPictureSize:35651584,maxBitrate:8e8,tier:"H",level:186}],Ui=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],TI=[{maxPictureSize:147456,maxBitrate:15e5,tier:"M",level:0},{maxPictureSize:278784,maxBitrate:3e6,tier:"M",level:1},{maxPictureSize:665856,maxBitrate:6e6,tier:"M",level:4},{maxPictureSize:1065024,maxBitrate:1e7,tier:"M",level:5},{maxPictureSize:2359296,maxBitrate:12e6,tier:"M",level:8},{maxPictureSize:2359296,maxBitrate:3e7,tier:"H",level:8},{maxPictureSize:2359296,maxBitrate:2e7,tier:"M",level:9},{maxPictureSize:2359296,maxBitrate:5e7,tier:"H",level:9},{maxPictureSize:8912896,maxBitrate:3e7,tier:"M",level:12},{maxPictureSize:8912896,maxBitrate:1e8,tier:"H",level:12},{maxPictureSize:8912896,maxBitrate:4e7,tier:"M",level:13},{maxPictureSize:8912896,maxBitrate:16e7,tier:"H",level:13},{maxPictureSize:8912896,maxBitrate:6e7,tier:"M",level:14},{maxPictureSize:8912896,maxBitrate:24e7,tier:"H",level:14},{maxPictureSize:35651584,maxBitrate:6e7,tier:"M",level:15},{maxPictureSize:35651584,maxBitrate:24e7,tier:"H",level:15},{maxPictureSize:35651584,maxBitrate:6e7,tier:"M",level:16},{maxPictureSize:35651584,maxBitrate:24e7,tier:"H",level:16},{maxPictureSize:35651584,maxBitrate:1e8,tier:"M",level:17},{maxPictureSize:35651584,maxBitrate:48e7,tier:"H",level:17},{maxPictureSize:35651584,maxBitrate:16e7,tier:"M",level:18},{maxPictureSize:35651584,maxBitrate:8e8,tier:"H",level:18},{maxPictureSize:35651584,maxBitrate:16e7,tier:"M",level:19},{maxPictureSize:35651584,maxBitrate:8e8,tier:"H",level:19}],kI=".01.01.01.01.00",II=".0.110.01.01.01.0",CI=(t,e,n,r)=>{if(t==="avc"){const s=Math.ceil(e/16)*Math.ceil(n/16),a=wd.find(d=>s<=d.maxMacroblocks&&r<=d.maxBitrate)??yt(wd),o=a?a.level:0,c="64".padStart(2,"0"),u="00",l=o.toString(16).padStart(2,"0");return`avc1.${c}${u}${l}`}else if(t==="hevc"){const o=e*n,c=_I.find(l=>o<=l.maxPictureSize&&r<=l.maxBitrate)??yt(_I);return`hev1.1.6.${c.tier}${c.level}.B0`}else{if(t==="vp8")return"vp8";if(t==="vp9"){const s=e*n;return`vp09.00.${(Ui.find(c=>s<=c.maxPictureSize&&r<=c.maxBitrate)??yt(Ui)).level.toString().padStart(2,"0")}.08`}else if(t==="av1"){const s=e*n,a=TI.find(u=>s<=u.maxPictureSize&&r<=u.maxBitrate)??yt(TI);return`av01.0.${a.level.toString().padStart(2,"0")}${a.tier}.08`}}throw new TypeError(`Unhandled codec '${t}'.`)},YW=t=>{const e=t.split("."),n=Number(e[1]),r=Number(e[2]),i=Number(e[3]),s=e[4]?Number(e[4]):1;return[1,1,n,2,1,r,3,1,i,4,1,s]},xI=t=>{const e=t.split("."),i=(1<<7)+1,s=Number(e[1]),a=e[2],o=Number(a.slice(0,-1)),c=(s<<5)+o,u=a.slice(-1)==="H"?1:0,d=Number(e[3])===8?0:1,f=0,h=e[4]?Number(e[4]):0,m=e[5]?Number(e[5][0]):1,p=e[5]?Number(e[5][1]):1,g=e[5]?Number(e[5][2]):0,A=(u<<7)+(d<<6)+(f<<5)+(h<<4)+(m<<3)+(p<<2)+g;return[i,c,A,0]},tg=t=>{const{codec:e,codecDescription:n,colorSpace:r,avcCodecInfo:i,hevcCodecInfo:s,vp9CodecInfo:a,av1CodecInfo:o}=t;if(e==="avc"){if(b(t.avcType!==null),i){const c=new Uint8Array([i.avcProfileIndication,i.profileCompatibility,i.avcLevelIndication]);return`avc${t.avcType}.${Ac(c)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${t.avcType}.${Ac(n.subarray(1,4))}`}else if(e==="hevc"){let c,u,l,d,f,h;if(s)c=s.generalProfileSpace,u=s.generalProfileIdc,l=uI(s.generalProfileCompatibilityFlags),d=s.generalTierFlag,f=s.generalLevelIdc,h=[...s.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw new TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");const p=_e(n),g=p.getUint8(1);c=g>>6&3,u=g&31,l=uI(p.getUint32(2)),d=g>>5&1,f=p.getUint8(12),h=[];for(let A=0;A<6;A++)h.push(p.getUint8(6+A))}let m="hev1.";for(m+=["","A","B","C"][c]+u,m+=".",m+=l.toString(16).toUpperCase(),m+=".",m+=d===0?"L":"H",m+=f;h.length>0&&h[h.length-1]===0;)h.pop();return h.length>0&&(m+=".",m+=h.map(p=>p.toString(16).toUpperCase()).join(".")),m}else{if(e==="vp8")return"vp8";if(e==="vp9"){if(!a){const A=t.width*t.height;let y=yt(Ui).level;for(const w of Ui)if(A<=w.maxPictureSize){y=w.level;break}return`vp09.00.${y.toString().padStart(2,"0")}.08`}const c=a.profile.toString().padStart(2,"0"),u=a.level.toString().padStart(2,"0"),l=a.bitDepth.toString().padStart(2,"0"),d=a.chromaSubsampling.toString().padStart(2,"0"),f=a.colourPrimaries.toString().padStart(2,"0"),h=a.transferCharacteristics.toString().padStart(2,"0"),m=a.matrixCoefficients.toString().padStart(2,"0"),p=a.videoFullRangeFlag.toString().padStart(2,"0");let g=`vp09.${c}.${u}.${l}.${d}`;return g+=`.${f}.${h}.${m}.${p}`,g.endsWith(kI)&&(g=g.slice(0,-kI.length)),g}
546else if(e==="av1"){if(!o){const w=t.width*t.height;let E=yt(Ui).level;for(const S of Ui)if(w<=S.maxPictureSize){E=S.level;break}return`av01.0.${E.toString().padStart(2,"0")}M.08`}const c=o.profile,u=o.level.toString().padStart(2,"0"),l=o.tier?"H":"M",d=o.bitDepth.toString().padStart(2,"0"),f=o.monochrome?"1":"0",h=100*o.chromaSubsamplingX+10*o.chromaSubsamplingY+1*(o.chromaSubsamplingX&&o.chromaSubsamplingY?o.chromaSamplePosition:0),m=r!=null&&r.primaries?Ss[r.primaries]:1,p=r!=null&&r.transfer?_s[r.transfer]:1,g=r!=null&&r.matrix?Ts[r.matrix]:1,A=r!=null&&r.fullRange?1:0;let y=`av01.${c}.${u}${l}.${d}`;return y+=`.${f}.${h.toString().padStart(3,"0")}`,y+=`.${m.toString().padStart(2,"0")}`,y+=`.${p.toString().padStart(2,"0")}`,y+=`.${g.toString().padStart(2,"0")}`,y+=`.${A}`,y.endsWith(II)&&(y=y.slice(0,-II.length)),y}}throw new TypeError(`Unhandled codec '${e}'.`)},vI=(t,e,n)=>{if(t==="aac")return e>=2&&n<=24e3?"mp4a.40.29":n<=24e3?"mp4a.40.5":"mp4a.40.2";if(t==="mp3")return"mp3";if(t==="opus")return"opus";if(t==="vorbis")return"vorbis";if(t==="flac")return"flac";if(t==="ac3")return"ac-3";if(t==="eac3")return"ec-3";if(Nt.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},ng=t=>{const{codec:e,codecDescription:n,aacCodecInfo:r}=t;if(e==="aac"){if(!r)throw new TypeError("AAC codec info must be provided.");if(r.isMpeg2)return"mp4a.67";{let i;return r.objectType!==null?i=r.objectType:i=xc(n).objectType,`mp4a.40.${i}`}}else{if(e==="mp3")return"mp3";if(e==="opus")return"opus";if(e==="vorbis")return"vorbis";if(e==="flac")return"flac";if(e==="ac3")return"ac-3";if(e==="eac3")return"ec-3";if(e&&Nt.includes(e))return e}throw new TypeError(`Unhandled codec '${e}'.`)},KW=t=>{},jW=t=>{switch(t.codec){case"flac":{const e=Ad("ZkxhQ4AAACIQABAAAAYtACWtCsRC8AANRBhVFucAcYu5ASE2m1Dxv8tw");return t.sampleRate>=1<<20||t.numberOfChannels>8?!1:(e[18]=t.sampleRate>>>12,e[19]=t.sampleRate>>>4,e[20]=(t.sampleRate&15)<<4|t.numberOfChannels-1<<1,e)}case"vorbis":{const e=Ad("Ah7/AgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMNAAAATGF2ZjU4Ljc2LjEwMAgAAAAMAAAAbGFuZ3VhZ2U9dW5kGQAAAGhhbmRsZXJfbmFtZT1Tb3VuZEhhbmRsZXIWAAAAdmVuZG9yX2lkPVswXVswXVswXVswXSAAAABlbmNvZGVyPUxhdmM1OC4xMzQuMTAwIGxpYnZvcmJpcxAAAABtYWpvcl9icmFuZD1pc29tEQAAAG1pbm9yX3ZlcnNpb249NTEyIgAAAGNvbXBhdGlibGVfYnJhbmRzPWlzb21pc28yYXZjMW1wNDEmAAAAREVTQ1JJUFRJT049TWFkZSB3aXRoIFJlbW90aW9uIDQuMC4yNzgBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLB
546BU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBA=="),n=_e(e);return n.setUint8(15,t.numberOfChannels),n.setUint32(16,t.sampleRate,!0),e}default:return}},qa=48e3,BI=/^pcm-([usf])(\d+)(be)?$/,sr=t=>{if(b(Nt.includes(t)),t==="ulaw")return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if(t==="alaw")return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const e=BI.exec(t);b(e);let n;e[1]==="u"?n="unsigned":e[1]==="s"?n="signed":n="float";const r=Number(e[2])/8,i=e[3]!=="be",s=t==="pcm-u8"?2**7:0;return{dataType:n,sampleSize:r,littleEndian:i,silentValue:s}},jr=t=>t.startsWith("avc1")||t.startsWith("avc3")?"avc":t.startsWith("hev1")||t.startsWith("hvc1")?"hevc":t==="vp8"?"vp8":t.startsWith("vp09")?"vp9":t.startsWith("av01")?"av1":t==="mp3"||t==="mp4a.69"||t==="mp4a.6B"||t==="mp4a.6b"||t==="mp4a.40.34"?"mp3":t.startsWith("mp4a.40.")||t==="mp4a.67"?"aac":t==="opus"?"opus":t==="vorbis"?"vorbis":t==="flac"?"flac":t==="ac-3"||t==="ac3"?"ac3":t==="ec-3"||t==="eac3"?"eac3":t==="ulaw"?"ulaw":t==="alaw"?"alaw":BI.test(t)?t:t==="webvtt"?"webvtt":null,$W=t=>t==="avc"?{avc:{format:"avc"}}:t==="hevc"?{hevc:{format:"hevc"}}:{},XW=t=>t==="aac"?{aac:{format:"aac"}}:t==="opus"?{opus:{format:"opus"}}:{},JW=["avc1","avc3","hev1","hvc1","vp8","vp09","av01"],ZW=/^(avc1|avc3)\.[0-9a-fA-F]{6}$/,eV=/^(hev1|hvc1)\.(?:[ABC]?\d+)\.[0-9a-fA-F]{1,8}\.[LH]\d+(?:\.[0-9a-fA-F]{1,2}){0,6}$/,tV=/^vp09(?:\.\d{2}){3}(?:(?:\.\d{2}){5})?$/,nV=/^av01\.\d\.\d{2}[MH]\.\d{2}(?:\.\d\.\d{3}\.\d{2}\.\d{2}\.\d{2}\.\d)?$/,bd=t=>{if(!t)throw new TypeError("Video chunk metadata must be provided.");if(typeof t!="object")throw new TypeError("Video chunk metadata must be an object.");if(!t.decoderConfig)throw new TypeError("Video chunk metadata must include a decoder configuration.");if(typeof t.decoderConfig!="object")throw new TypeError("Video chunk metadata decoder configuration must be an object.");if(typeof t.decoderConfig.codec!="string")throw new TypeError("Video chunk metadata decoder configuration must specify a codec string.");if(!JW.some(e=>t.decoderConfig.codec.startsWith(e)))throw new TypeError("Video chunk metadata decoder configuration codec string must be a valid video codec string as specified in the Mediabunny Codec Registry.");if(!Number.isInteger(t.decoderConfig.codedWidth)||t.decoderConfig.codedWidth<=0)throw new TypeError("Video chunk metadata decoder configuration must specify a valid codedWidth (positive integer).");if(!Number.isInteger(t.decoderConfig.codedHeight)||t.decoderConfig.codedHeight<=0)throw new TypeError("Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).");if(t.decoderConfig.displayAspectWidth!==void 0&&(!Number.isInteger(t.decoderConfig.displayAspectWidth)||t.decoderConfig.displayAspectWidth<=0))throw new TypeError("Video chunk metadata decoder configuration displayAspectWidth, when defined, must be a positive integer.");if(t.decoderConfig.displayAspectHeight!==void 0&&(!Number.isInteger(t.decoderConfig.displayAspectHeight)||t.decoderConfig.displayAspectHeight<=0))throw new TypeError("Video chunk metadata decoder configuration displayAspectHeight, when defined, must be a positive integer.");if(t.decoderConfig.displayAspectWidth!==void 0!=(t.decoderConfig.displayAspectHeight!==void 0))throw new TypeError("Video chunk metadata decoder configuration must specify both displayAspectWidth and displayAspectHeight, or neither.");if(t.decoderConfig.description!==void 0&&!Ua(t.decoderConfig.description))throw new TypeError("Video chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.");if(t.decoderConfig.colorSpace!==void 0){const{colorSpace:e}=t.decoderConfig;if(typeof e!="object")throw new TypeError("Video chunk metadata decoder configuration colorSpace, when provided, must be an object.");const n=Object.keys(Ss);if(e.primaries!=null&&!n.includes(e.primaries))throw new TypeError(`Video chunk metadata decoder configuration colorSpace primaries, when defined, must be one of ${n.join(", ")}.`);const r=Object.keys(_s);if(e.transfer!=null&&!r.includes(e.transfer))throw new TypeError(`Video chunk metadata decoder configuration colorSpace transfer, when defined, must be one of ${r.join(", ")}.`);const i=Object.keys(Ts);if(e.matrix!=null&&!i.includes(e.matrix))throw new TypeError(`Video chunk metadata decoder configuration colorSpace matrix, when defined, must be one of ${i.join(", ")}.`);
vendor: 10,480 bytes, lines 546-564
546if(e.fullRange!=null&&typeof e.fullRange!="boolean")throw new TypeError("Video chunk metadata decoder configuration colorSpace fullRange, when defined, must be a boolean.")}if(t.decoderConfig.codec.startsWith("avc1")||t.decoderConfig.codec.startsWith("avc3")){if(!ZW.test(t.decoderConfig.codec))throw new TypeError("Video chunk metadata decoder configuration codec string for AVC must be a valid AVC codec string as specified in Section 3.4 of RFC 6381.")}else if(t.decoderConfig.codec.startsWith("hev1")||t.decoderConfig.codec.startsWith("hvc1")){if(!eV.test(t.decoderConfig.codec))throw new TypeError("Video chunk metadata decoder configuration codec string for HEVC must be a valid HEVC codec string as specified in Section E.3 of ISO 14496-15.")}else if(t.decoderConfig.codec.startsWith("vp8")){if(t.decoderConfig.codec!=="vp8")throw new TypeError('Video chunk metadata decoder configuration codec string for VP8 must be "vp8".')}else if(t.decoderConfig.codec.startsWith("vp09")){if(!tV.test(t.decoderConfig.codec))throw new TypeError('Video chunk metadata decoder configuration codec string for VP9 must be a valid VP9 codec string as specified in Section "Codecs Parameter String" of https://www.webmproject.org/vp9/mp4/.')}else if(t.decoderConfig.codec.startsWith("av01")&&!nV.test(t.decoderConfig.codec))throw new TypeError('Video chunk metadata decoder configuration codec string for AV1 must be a valid AV1 codec string as specified in Section "Codecs Parameter String" of https://aomediacodec.github.io/av1-isobmff/.')},rV=["mp4a","mp3","opus","vorbis","flac","ulaw","alaw","pcm","ac-3","ec-3"],Li=t=>{if(!t)throw new TypeError("Audio chunk metadata must be provided.");if(typeof t!="object")throw new TypeError("Audio chunk metadata must be an object.");if(!t.decoderConfig)throw new TypeError("Audio chunk metadata must include a decoder configuration.");if(typeof t.decoderConfig!="object")throw new TypeError("Audio chunk metadata decoder configuration must be an object.");if(typeof t.decoderConfig.codec!="string")throw new TypeError("Audio chunk metadata decoder configuration must specify a codec string.");if(!rV.some(e=>t.decoderConfig.codec.startsWith(e)))throw new TypeError("Audio chunk metadata decoder configuration codec string must be a valid audio codec string as specified in the Mediabunny Codec Registry.");if(!Number.isInteger(t.decoderConfig.sampleRate)||t.decoderConfig.sampleRate<=0)throw new TypeError("Audio chunk metadata decoder configuration must specify a valid sampleRate (positive integer).");if(!Number.isInteger(t.decoderConfig.numberOfChannels)||t.decoderConfig.numberOfChannels<=0)throw new TypeError("Audio chunk metadata decoder configuration must specify a valid numberOfChannels (positive integer).");if(t.decoderConfig.description!==void 0&&!Ua(t.decoderConfig.description))throw new TypeError("Audio chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.");if(t.decoderConfig.codec.startsWith("mp4a")&&t.decoderConfig.codec!=="mp4a.69"&&t.decoderConfig.codec!=="mp4a.6B"&&t.decoderConfig.codec!=="mp4a.6b"){if(!["mp4a.40.2","mp4a.40.02","mp4a.40.5","mp4a.40.05","mp4a.40.29","mp4a.67"].includes(t.decoderConfig.codec))throw new TypeError("Audio chunk metadata decoder configuration codec string for AAC must be a valid AAC codec string as specified in https://www.w3.org/TR/webcodecs-aac-codec-registration/.")}else if(t.decoderConfig.codec.startsWith("mp3")||t.decoderConfig.codec.startsWith("mp4a")){if(t.decoderConfig.codec!=="mp3"&&t.decoderConfig.codec!=="mp4a.69"&&t.decoderConfig.codec!=="mp4a.6B"&&t.decoderConfig.codec!=="mp4a.6b")throw new TypeError('Audio chunk metadata decoder configuration codec string for MP3 must be "mp3", "mp4a.69" or "mp4a.6B".')}else if(t.decoderConfig.codec.startsWith("opus")){if(t.decoderConfig.codec!=="opus")throw new TypeError('Audio chunk metadata decoder configuration codec string for Opus must be "opus".');if(t.decoderConfig.description&&t.decoderConfig.description.byteLength<18)throw new TypeError("Audio chunk metadata decoder configuration description, when specified, is expected to be an Identification Header as specified in Section 5.1 of RFC 7845.")}else if(t.decoderConfig.codec.startsWith("vorbis")){if(t.decoderConfig.codec!=="vorbis")throw new TypeError('Audio chunk metadata decoder configuration codec string for Vorbis must be "vorbis".');if(!t.decoderConfig.description)throw new TypeError("Audio chunk metadata decoder configuration for Vorbis must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-vorbis-codec-registration/.")}else if(t.decoderConfig.codec.startsWith("flac")){if(t.decoderConfig.codec!=="flac")throw new TypeError('Audio chunk metadata decoder configuration codec string for FLAC must be "flac".');if(!t.decoderConfig.description||t.decoderConfig.description.byteLength<42)throw new TypeError("Audio chunk metadata decoder configuration for FLAC must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-flac-codec-registration/.")}else if(t.decoderConfig.codec.startsWith("ac-3")||t.decoderConfig.codec.startsWith("ac3")){if(t.decoderConfig.codec!=="ac-3")throw new TypeError('Audio chunk metadata decoder configuration codec string for AC-3 must be "ac-3".')}else if(t.decoderConfig.codec.startsWith("ec-3")||t.decoderConfig.codec.startsWith("eac3")){if(t.decoderConfig.codec!=="ec-3")throw new TypeError('Audio chunk metadata decoder configuration codec string for EC-3 must be "ec-3".')}else if((t.decoderConfig.codec.startsWith("pcm")||t.decoderConfig.codec.startsWith("ulaw")||t.decoderConfig.codec.startsWith("alaw"))&&!Nt.includes(t.decoderConfig.codec))throw new TypeError(`Audio chunk metadata decoder configuration codec string for PCM must be one of the supported PCM codecs (${Nt.join(", ")}).`)},PI=t=>{if(!t)throw new TypeError("Subtitle metadata must be provided.");if(typeof t!="object")throw new TypeError("Subtitle metadata must be an object.");if(!t.config)throw new TypeError("Subtitle metadata must include a config object.");if(typeof t.config!="object")throw new TypeError("Subtitle metadata config must be an object.");if(typeof t.config.description!="string")throw new TypeError("Subtitle metadata config description must be a string.")};/*!
547 * Copyright (c) 2026-present, Vanilagy and contributors
548 *
549 * This Source Code Form is subject to the terms of the Mozilla Public
550 * License, v. 2.0. If a copy of the MPL was not distributed with this
551 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
552 */const Cs=4,iV=[44100,48e3,32e3],rg=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1,-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1,-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],Ed=1483304551,ig=1231971951,sg=(t,e,n,r,i)=>e===0?0:e===1?Math.floor(144*n/(r<<t))+i:e===2?Math.floor(144*n/r)+i:(Math.floor(12*n/r)+i)*4,sV=(t,e,n,r)=>e===0?0:e===1?144*n/(r<<t):e===2?144*n/r:12*n/r*4,Sd=(t,e)=>t===3?e===3?21:36:e===3?13:21,_d=(t,e)=>{const n=t>>>24,r=t>>>16&255,i=t>>>8&255,s=t&255;if(n!==255&&r!==255&&i!==255&&s!==255)return{header:null,bytesAdvanced:4};if(n!==255)return{header:null,bytesAdvanced:1};if((r&224)!==224)return{header:null,bytesAdvanced:1};let a=0,o=0;r&16?a=r&8?0:1:(a=1,o=1);const c=r>>3&3,u=r>>1&3,l=i>>4&15,d=(i>>2&3)%3,f=i>>1&1,h=s>>6&3,m=s>>4&3,p=s>>3&1,g=s>>2&1,A=s&3,y=rg[a*16*4+u*16+l];if(y===-1)return{header:null,bytesAdvanced:1};const w=y*1e3,E=iV[d]>>a+o,S=sg(a,u,w,E,f);if(e!==null&&e<S)return{header:null,bytesAdvanced:1};let k;return c===3?k=u===3?384:1152:u===3?k=384:u===2?k=1152:k=576,{header:{totalSize:S,mpegVersionId:c,lowSamplingFrequency:a,layer:u,bitrate:w,frequencyIndex:d,sampleRate:E,channel:h,modeExtension:m,copyright:p,original:g,emphasis:A,audioSamplesInFrame:k},bytesAdvanced:1}},aV=t=>{let e=127,n=0,r=t;for(;(e^2147483647)!==0;)n=r&~e,n<<=1,n|=r&e,e=(e+1<<8)-1,r=n;return n},ag=t=>{let e=2130706432,n=0;for(;e!==0;)n>>=1,n|=t&e,e>>=8;return n};var xs;(function(t){t[t.FrameCount=1]="FrameCount",t[t.FileSize=2]="FileSize",t[t.Toc=4]="Toc"})(xs||(xs={}));const vc=t=>t===3?1:2;/*!
553 * Copyright (c) 2026-present, Vanilagy and contributors
554 *
555 * This Source Code Form is subject to the terms of the Mozilla Public
556 * License, v. 2.0. If a copy of the MPL was not distributed with this
557 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
558 */const Td=[48e3,44100,32e3],RI=[24e3,22050,16e3];/*!
559 * Copyright (c) 2026-present, Vanilagy and contributors
560 *
561 * This Source Code Form is subject to the terms of the Mozilla Public
562 * License, v. 2.0. If a copy of the MPL was not distributed with this
563 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
564 */var Vn;(function(t){t[t.NON_IDR_SLICE=1]="NON_IDR_SLICE",t[t.SLICE_DPA=2]="SLICE_DPA",t[t.SLICE_DPB=3]="SLICE_DPB",t[t.SLICE_DPC=4]="SLICE_DPC",t[t.IDR=5]="IDR",t[t.SEI=6]="SEI",t[t.SPS=7]="SPS",t[t.PPS=8]="PPS",t[t.AUD=9]="AUD",t[t.SPS_EXT=13]="SPS_EXT"})(Vn||(Vn={}));var Rt;(function(t){t[t.RASL_N=8]="RASL_N",t[t.RASL_R=9]="RASL_R",t[t.BLA_W_LP=16]="BLA_W_LP",t[t.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",t[t.VPS_NUT=32]="VPS_NUT",t[t.SPS_NUT=33]="SPS_NUT",t[t.PPS_NUT=34]="PPS_NUT",t[t.AUD_NUT=35]="AUD_NUT",t[t.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",t[t.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"})(Rt||(Rt={}));const Ya=function*(t){let e=0,n=-1;for(;e<t.length-2;){const r=t.indexOf(0,e);if(r===-1||r>=t.length-2)break;e=r;let i=0;if(e+3<t.length&&t[e+1]===0&&t[e+2]===0&&t[e+3]===1?i=4:t[e+1]===0&&t[e+2]===1&&(i=3),i===0){e++;continue}n!==-1&&e>n&&(yield{offset:n,length:e-n}),n=e+i,e=n}n!==-1&&n<t.length&&(yield{offset:n,length:t.length-n})},og=function*(t,e){let n=0;const r=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n+e<=t.length;){let i;e===1?i=r.getUint8(n):e===2?i=r.getUint16(n,!1):e===3?i=hd(r,n,!1):(b(e===4),i=r.getUint32(n,!1)),n+=e,yield{offset:n,length:i},n+=i}},FI=(t,e)=>{if(e.description){const i=(dt(e.description)[4]&3)+1;return og(t,i)}else return Ya(t)},Ka=t=>t&31,kd=t=>{const e=[],n=t.length;for(let r=0;r<n;r++)r+2<n&&t[r]===0&&t[r+1]===0&&t[r+2]===3?(e.push(0,0),r+=2):e.push(t[r]);return new Uint8Array(e)}
564,cg=new Uint8Array([0,0,0,1]),Id=t=>{const e=t.reduce((i,s)=>i+cg.byteLength+s.byteLength,0),n=new Uint8Array(e);let r=0;for(const i of t)n.set(cg,r),r+=cg.byteLength,n.set(i,r),r+=i.byteLength;return n},ug=(t,e)=>{const n=t.reduce((s,a)=>s+e+a.byteLength,0),r=new Uint8Array(n);let i=0;for(const s of t){const a=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(e){case 1:a.setUint8(i,s.byteLength);break;case 2:a.setUint16(i,s.byteLength,!1);break;case 3:pd(a,i,s.byteLength,!1);break;case 4:a.setUint32(i,s.byteLength,!1);break}i+=e,r.set(s,i),i+=s.byteLength}return r},oV=(t,e)=>{if(e.description){const i=(dt(e.description)[4]&3)+1;return ug(t,i)}else return Id(t)},lg=t=>{try{const e=[],n=[],r=[];for(const o of Ya(t)){const c=t.subarray(o.offset,o.offset+o.length),u=Ka(c[0]);u===Vn.SPS?e.push(c):u===Vn.PPS?n.push(c):u===Vn.SPS_EXT&&r.push(c)}if(e.length===0||n.length===0)return null;const i=e[0],s=dg(i);b(s!==null);const a=s.profileIdc===100||s.profileIdc===110||s.profileIdc===122||s.profileIdc===144;return{configurationVersion:1,avcProfileIndication:s.profileIdc,profileCompatibility:s.constraintFlags,avcLevelIndication:s.levelIdc,lengthSizeMinusOne:3,sequenceParameterSets:e,pictureParameterSets:n,chromaFormat:a?s.chromaFormatIdc:null,bitDepthLumaMinus8:a?s.bitDepthLumaMinus8:null,bitDepthChromaMinus8:a?s.bitDepthChromaMinus8:null,sequenceParameterSetExt:a?r:null}}catch(e){return console.error("Error building AVC Decoder Configuration Record:",e),null}},cV=t=>{const e=[];e.push(t.configurationVersion),e.push(t.avcProfileIndication),e.push(t.profileCompatibility),e.push(t.avcLevelIndication),e.push(252|t.lengthSizeMinusOne&3),e.push(224|t.sequenceParameterSets.length&31);for(const n of t.sequenceParameterSets){const r=n.byteLength;e.push(r>>8),e.push(r&255);for(let i=0;i<r;i++)e.push(n[i])}e.push(t.pictureParameterSets.length);for(const n of t.pictureParameterSets){const r=n.byteLength;e.push(r>>8),e.push(r&255);for(let i=0;i<r;i++)e.push(n[i])}if(t.avcProfileIndication===100||t.avcProfileIndication===110||t.avcProfileIndication===122||t.avcProfileIndication===144){b(t.chromaFormat!==null),b(t.bitDepthLumaMinus8!==null),b(t.bitDepthChromaMinus8!==null),b(t.sequenceParameterSetExt!==null),e.push(252|t.chromaFormat&3),e.push(248|t.bitDepthLumaMinus8&7),e.push(248|t.bitDepthChromaMinus8&7),e.push(t.sequenceParameterSetExt.length);for(const n of t.sequenceParameterSetExt){const r=n.byteLength;e.push(r>>8),e.push(r&255);for(let i=0;i<r;i++)e.push(n[i])}}return new Uint8Array(e)},MI=t=>{try{const e=_e(t);let n=0;const r=e.getUint8(n++),i=e.getUint8(n++),s=e.getUint8(n++),a=e.getUint8(n++),o=e.getUint8(n++)&3,c=e.getUint8(n++)&31,u=[];for(let h=0;h<c;h++){const m=e.getUint16(n,!1);n+=2,u.push(t.subarray(n,n+m)),n+=m}const l=e.getUint8(n++),d=[];for(let h=0;h<l;h++){const m=e.getUint16(n,!1);n+=2,d.push(t.subarray(n,n+m)),n+=m}const f={configurationVersion:r,avcProfileIndication:i,profileCompatibility:s,avcLevelIndication:a,lengthSizeMinusOne:o,sequenceParameterSets:u,pictureParameterSets:d,chromaFormat:null,bitDepthLumaMinus8:null,bitDepthChromaMinus8:null,sequenceParameterSetExt:null};if((i===100||i===110||i===122||i===144)&&n+4<=t.length){const h=e.getUint8(n++)&3,m=e.getUint8(n++)&7,p=e.getUint8(n++)&7,g=e.getUint8(n++);f.chromaFormat=h,f.bitDepthLumaMinus8=m,f.bitDepthChromaMinus8=p;const A=[];for(let y=0;y<g;y++){const w=e.getUint16(n,!1);n+=2,A.push(t.subarray(n,n+w)),n+=w}f.sequenceParameterSetExt=A}return f}catch(e){return console.error("Error deserializing AVC Decoder Configuration Record:",e),null}},DI={1:{num:1,den:1},2:{num:12,den:11},3:{num:10,den:11},4:{num:16,den:11},5:{num:40,den:33},6:{num:24,den:11},7:{num:20,den:11},8:{num:32,den:11},9:{num:80,den:33},10:{num:18,den:11},11:{num:15,den:11},12:{num:64,den:33},13:{num:160,den:99},14:{num:4,den:3},15:{num:3,den:2},16:{num:2,den:1}},dg=t=>{try{const e=new Me(kd(t));if(e.skipBits(1),e.skipBits(2),e.readBits(5)!==7)return null;const r=e.readAlignedByte(),i=e.readAlignedByte(),s=e.readAlignedByte();ee(e);let a=1,o=0,c=0,u=0;
564if((r===100||r===110||r===122||r===244||r===44||r===83||r===86||r===118||r===128)&&(a=ee(e),a===3&&(u=e.readBits(1)),o=ee(e),c=ee(e),e.skipBits(1),e.readBits(1))){for(let v=0;v<(a!==3?8:12);v++)if(e.readBits(1)){const D=v<6?16:64;let O=8,N=8;for(let Q=0;Q<D;Q++){if(N!==0){const G=qr(e);N=(O+G+256)%256}O=N===0?O:N}}}ee(e);const l=ee(e);if(l===0)ee(e);else if(l===1){e.skipBits(1),qr(e),qr(e);const P=ee(e);for(let v=0;v<P;v++)qr(e)}ee(e),e.skipBits(1);const d=ee(e),f=ee(e),h=16*(d+1),m=16*(f+1);let p=h,g=m;const A=e.readBits(1);if(A||e.skipBits(1),e.skipBits(1),e.readBits(1)){const P=ee(e),v=ee(e),M=ee(e),D=ee(e);let O,N;if((u===0?a:0)===0)O=1,N=2-A;else{const G=a===3?1:2,V=a===1?2:1;O=G,N=V*(2-A)}p-=O*(P+v),g-=N*(M+D)}let w=2,E=2,S=2,k=0,T={num:1,den:1},C=null,_=null;if(e.readBits(1)){if(e.readBits(1)){const V=e.readBits(8);if(V===255)T={num:e.readBits(16),den:e.readBits(16)};else{const Z=DI[V];Z&&(T=Z)}}e.readBits(1)&&e.skipBits(1),e.readBits(1)&&(e.skipBits(3),k=e.readBits(1),e.readBits(1)&&(w=e.readBits(8),E=e.readBits(8),S=e.readBits(8))),e.readBits(1)&&(ee(e),ee(e)),e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.skipBits(1));const N=e.readBits(1);N&&OI(e);const Q=e.readBits(1);Q&&OI(e),(N||Q)&&e.skipBits(1),e.skipBits(1),e.readBits(1)&&(e.skipBits(1),ee(e),ee(e),ee(e),ee(e),C=ee(e),_=ee(e))}if(C===null){b(_===null);const P=i&16;if((r===44||r===86||r===100||r===110||r===122||r===244)&&P)C=0,_=0;else{const v=d+1,M=f+1,D=(2-A)*M,O=wd.find(Q=>Q.level>=s)??yt(wd),N=Math.min(Math.floor(O.maxDpbMbs/(v*D)),16);C=N,_=N}}return b(_!==null),{profileIdc:r,constraintFlags:i,levelIdc:s,frameMbsOnlyFlag:A,chromaFormatIdc:a,bitDepthLumaMinus8:o,bitDepthChromaMinus8:c,codedWidth:h,codedHeight:m,displayWidth:p,displayHeight:g,pixelAspectRatio:T,colourPrimaries:w,matrixCoefficients:S,transferCharacteristics:E,fullRangeFlag:k,numReorderFrames:C,maxDecFrameBuffering:_}}catch(e){return console.error("Error parsing AVC SPS:",e),null}},OI=t=>{const e=ee(t);t.skipBits(4),t.skipBits(4);for(let n=0;n<=e;n++)ee(t),ee(t),t.skipBits(1);t.skipBits(5),t.skipBits(5),t.skipBits(5),t.skipBits(5)},uV=(t,e)=>{if(e.description){const i=(dt(e.description)[21]&3)+1;return ug(t,i)}else return Id(t)},Cd=(t,e)=>{if(e.description){const i=(dt(e.description)[21]&3)+1;return og(t,i)}else return Ya(t)},zi=t=>t>>1&63,NI=t=>{try{const e=new Me(kd(t));e.skipBits(16),e.readBits(4);const n=e.readBits(3),r=e.readBits(1),{general_profile_space:i,general_tier_flag:s,general_profile_idc:a,general_profile_compatibility_flags:o,general_constraint_indicator_flags:c,general_level_idc:u}=lV(e,n);ee(e);const l=ee(e);let d=0;l===3&&(d=e.readBits(1));const f=ee(e),h=ee(e);let m=f,p=h;if(e.readBits(1)){const v=ee(e),M=ee(e),D=ee(e),O=ee(e);let N=1,Q=1;const G=d===0?l:0;G===1?(N=2,Q=2):G===2&&(N=2,Q=1),m-=(v+M)*N,p-=(D+O)*Q}const g=ee(e),A=ee(e);ee(e);const w=e.readBits(1)?0:n;let E=0;for(let v=w;v<=n;v++)ee(e),E=ee(e),ee(e);ee(e),ee(e),ee(e),ee(e),ee(e),ee(e),e.readBits(1)&&e.readBits(1)&&dV(e),e.skipBits(1),e.skipBits(1),e.readBits(1)&&(e.skipBits(4),e.skipBits(4),ee(e),ee(e),e.skipBits(1));const S=ee(e);if(fV(e,S),e.readBits(1)){const v=ee(e);for(let M=0;M<v;M++)ee(e),e.skipBits(1)}e.skipBits(1),e.skipBits(1);let k=2,T=2,C=2,_=0,x=0,P={num:1,den:1};if(e.readBits(1)){const v=pV(e,n);P=v.pixelAspectRatio,k=v.colourPrimaries,T=v.transferCharacteristics,C=v.matrixCoefficients,_=v.fullRangeFlag,x=v.minSpatialSegmentationIdc}return{displayWidth:m,displayHeight:p,pixelAspectRatio:P,colourPrimaries:k,transferCharacteristics:T,matrixCoefficients:C,fullRangeFlag:_,maxDecFrameBuffering:E+1,spsMaxSubLayersMinus1:n,spsTemporalIdNestingFlag:r,generalProfileSpace:i,generalTierFlag:s,generalProfileIdc:a,generalProfileCompatibilityFlags:o,generalConstraintIndicatorFlags:c,generalLevelIdc:u,chromaFormatIdc:l,bitDepthLumaMinus8:g,bitDepthChromaMinus8:A,minSpatialSegmentationIdc:x}}catch(e){return console.error("Error parsing HEVC SPS:",e),null}},fg=t=>{try{const e=[],n=[],r=[],i=[];for(const u of Ya(t)){const l=t.subarray(u.offset,u.offset+u.length),d=zi(l[0]);d===Rt.VPS_NUT?e.push(l):d===Rt.SPS_NUT?n.push(l):d===Rt.PPS_NUT?r.push(l):(d===Rt.PREFIX_SEI_NUT||d===Rt.SUFFIX_SEI_NUT)&&i.push(l)}if(n.length===0||r.length===0)return null;const s=NI(n[0]);if(!s)return null;let a=0;if(r.length>0){const u=r[0],l=new Me(kd(u));l.skipBits(16),ee(l),ee(l),l.skipBits(1),l.skipBits(1),l.skipBits(3),l.skipBits(1),l.skipBits(1),ee(l),ee(l),qr(l),l.skipBits(1),l.skipBits(1),l.readBits(1)&&ee(l),qr(l),qr(l),l.skipBits(1),l.skipBits(1),l.skipBits(1),l.skipBits(1);const d=l.readBits(1),f=l.readBits(1);!d&&!f?a=0:d&&!f?a=2:!d&&f?a=3:a=0}const o=[...e.length?[{arrayCompleteness:1,nalUnitType:Rt.VPS_NUT,nalUnits:e}]:[],...n.length?[{arrayCompleteness:1,nalUnitType:Rt.SPS_NUT,nalUnits:n}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:Rt.PPS_NUT,nalUnits:r}]:[],...i.length?[{arrayCompleteness:1,nalUnitType:zi(i[0][0]),nalUnits:i}]:[]];return{configurationVersion:1,generalProfileSpace:s.generalProfileSpace,generalTierFlag:s.generalTierFlag,generalProfileIdc:s.generalProfileIdc,generalProfileCompatibilityFlags:s.generalProfileCompatibilityFlags,generalConstraintIndicatorFlags:s.generalConstraintIndicatorFlags,generalLevelIdc:s.generalLevelIdc,minSpatialSegmentationIdc:s.minSpatialSegmentationIdc,parallelismType:a,chromaFormatIdc:s.chromaFormatIdc,bitDepthLumaMinus8:s.bitDepthLumaMinus8,bitDepthChromaMinus8:s.bitDepthChromaMinus8,avgFrameRate:0,constantFrameRate:0,numTemporalLayers:s.spsMaxSubLayersMinus1+1,temporalIdNested:s.spsTemporalIdNestingFlag,lengthSizeMinusOne:3,arrays:o}}catch(e){return console.error("Error building HEVC Decoder Configuration Record:",e),null}},lV=(t,e)=>{const n=t.readBits(2),r=t.readBits(1),i=t.readBits(5);let s=0;for(let l=0;l<32;l++)s=s<<1|t.readBits(1);const a=new Uint8Array(6);for(let l=0;l<6;l++)a[l]=t.readBits(8);const o=t.readBits(8),c=[],u=[];for(let l=0;l<e;l++)c.push(t.readBits(1)),u.push(t.readBits(1));if(e>0)for(let l=e;l<8;l++)t.skipBits(2);for(let l=0;l<e;l++)c[l]&&t.skipBits(88),u[l]&&t.skipBits(8);return{general_profile_space:n,general_tier_flag:r,general_profile_idc:i,general_profile_compatibility_flags:s,general_constraint_indicator_flags:a,general_level_idc:o}},dV=t=>{for(let e=0;e<4;e++)for(let n=0;n<(e===3?2:6);n++)if(!t.readBits(1))ee(t);else{const i=Math.min(64,1<<4+(e<<1));e>1&&qr(t);for(let s=0;s<i;s++)qr(t)}},fV=(t,e)=>{const n=[];for(let r=0;r<e;r++)n[r]=hV(t,r,e,n)},hV=(t,e,n,r)=>{let i=0,s=0,a=0;if(e!==0&&(s=t.readBits(1)),s){if(e===n){const c=ee(t);a=e-(c+1)}else a=e-1;t.readBits(1),ee(t);const o=r[a]??0;for(let c=0;c<=o;c++)t.readBits(1)||t.readBits(1);i=r[a]}else{const o=ee(t),c=ee(t);for(let u=0;u<o;u++)ee(t),t.readBits(1);for(let u=0;u<c;u++)ee(t),t.readBits(1);i=o+c}return i},pV=(t,e)=>{let n=2,r=2,i=2,s=0,a=0,o={num:1,den:1};if(t.readBits(1)){const c=t.readBits(8);if(c===255)o={num:t.readBits(16),den:t.readBits(16)};else{const u=DI[c];u&&(o=u)}}return t.readBits(1)&&t.readBits(1),t.readBits(1)&&(t.readBits(3),s=t.readBits(1),t.readBits(1)&&(n=t.readBits(8),r=t.readBits(8),i=t.readBits(8))),t.readBits(1)&&(ee(t),ee(t)),t.readBits(1),t.readBits(1),t.readBits(1),t.readBits(1)&&(ee(t),ee(t),ee(t),ee(t)),t.readBits(1)&&(t.readBits(32),t.readBits(32),t.readBits(1)&&ee(t),t.readBits(1)&&mV(t,!0,e)),t.readBits(1)&&(t.readBits(1),t.readBits(1),t.readBits(1),a=ee(t),ee(t),ee(t),ee(t),ee(t)),{pixelAspectRatio:o,colourPrimaries:n,transferCharacteristics:r,matrixCoefficients:i,fullRangeFlag:s,minSpatialSegmentationIdc:a}},mV=(t,e,n)=>{let r=!1,i=!1,s=!1;r=t.readBits(1)===1,i=t.readBits(1)===1,(r||i)&&(s=t.readBits(1)===1,s&&(t.readBits(8),t.readBits(5),t.readBits(1),t.readBits(5)),t.readBits(4),t.readBits(4),s&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let a=0;a<=n;a++){const o=t.readBits(1)===1;let c=!0;o||(c=t.readBits(1)===1);let u=!1;c?ee(t):u=t.readBits(1)===1;let l=1;u||(l=ee(t)+1),r&&UI(t,l,s),i&&UI(t,l,s)}},UI=(t,e,n)=>{for(let r=0;r<e;r++)ee(t),ee(t),n&&(ee(t),ee(t)),t.readBits(1)},gV=t=>{const e=[];e.push(t.configurationVersion),e.push((t.generalProfileSpace&3)<<6|(t.generalTierFlag&1)<<5|t.generalProfileIdc&31),e.push(t.generalProfileCompatibilityFlags>>>24&255),e.push(t.generalProfileCompatibilityFlags>>>16&255),e.push(t.generalProfileCompatibilityFlags>>>8&255),e.push(t.generalProfileCompatibilityFlags&255),e.push(...t.generalConstraintIndicatorFlags),e.push(t.generalLevelIdc&255),e.push(240|t.minSpatialSegmentationIdc>>8&15),e.push(t.minSpatialSegmentationIdc&255),e.push(252|t.parallelismType&3),e.push(252|t.chromaFormatIdc&3),e.push(248|t.bitDepthLumaMinus8&7),e.push(248|t.bitDepthChromaMinus8&7),e.push(t.avgFrameRate>>8&255),e.push(t.avgFrameRate&255),e.push((t.constantFrameRate&3)<<6|(t.numTemporalLayers&7)<<3|(t.temporalIdNested&1)<<2|t.lengthSizeMinusOne&3),e.push(t.arrays.length&255);for(const n of t.arrays){e.push((n.arrayCompleteness&1)<<7|0|n.nalUnitType&63),e.push(n.nalUnits.length>>8&255),e.push(n.nalUnits.length&255);for(const r of n.nalUnits){e.push(r.length>>8&255),e.push(r.length&255);for(let i=0;i<r.length;i++)e.push(r[i])}}return new Uint8Array(e)},AV=t=>{try{const e=_e(t);let n=0;const r=e.getUint8(n++),i=e.getUint8(n++),s=i>>6&3,a=i>>5&1,o=i&31,c=e.getUint32(n,!1);n+=4;const u=t.subarray(n,n+6);n+=6;const l=e.getUint8(n++),d=(e.getUint8(n++)&15)<<8|e.getUint8(n++),f=e.getUint8(n++)&3,h=e.getUint8(n++)&3,m=e.getUint8(n++)&7,p=e.getUint8(n++)&7,g=e.getUint16(n,!1);n+=2;const A=e.getUint8(n++),y=A>>6&3,w=A>>3&7,E=A>>2&1,S=A&3,k=e.getUint8(n++),T=[];for(let C=0;C<k;C++){const _=e.getUint8(n++),x=_>>7&1,P=_&63,v=e.getUint16(n,!1);n+=2;const M=[];for(let D=0;D<v;D++){const O=e.getUint16(n,!1);n+=2,M.push(t.subarray(n,n+O)),n+=O}T.push({arrayCompleteness:x,nalUnitType:P,nalUnits:M})}return{configurationVersion:r,generalProfileSpace:s,generalTierFlag:a,generalProfileIdc:o,generalProfileCompatibilityFlags:c,generalConstraintIndicatorFlags:u,generalLevelIdc:l,minSpatialSegmentationIdc:d,parallelismType:f,chromaFormatIdc:h,bitDepthLumaMinus8:m,bitDepthChromaMinus8:p,avgFrameRate:g,constantFrameRate:y,numTemporalLayers:w,temporalIdNested:E,lengthSizeMinusOne:S,arrays:T}}catch(e){return console.error("Error deserializing HEVC Decoder Configuration Record:",e),null}};var sn;
564(function(t){t[t.audAllowed=0]="audAllowed",t[t.beforeFirstVcl=1]="beforeFirstVcl",t[t.afterFirstVcl=2]="afterFirstVcl",t[t.eoBitstreamAllowed=3]="eoBitstreamAllowed",t[t.noMoreDataAllowed=4]="noMoreDataAllowed"})(sn||(sn={}));const yV=(t,e)=>{const n=new Set;let r=sn.audAllowed;for(const s of Cd(t,e)){if(r===sn.noMoreDataAllowed){n.add(s.offset);continue}const a=zi(t[s.offset]);if(r===sn.eoBitstreamAllowed&&a!==37){n.add(s.offset);continue}let o=!1;a===35?r>sn.audAllowed?o=!0:r=sn.beforeFirstVcl:a<=31?r>sn.afterFirstVcl?o=!0:r=sn.afterFirstVcl:a===36?r!==sn.afterFirstVcl?o=!0:r=sn.eoBitstreamAllowed:a===37?r<sn.afterFirstVcl?o=!0:r=sn.noMoreDataAllowed:a===32||a===33||a===34||a===39||a>=41&&a<=44||a>=48&&a<=55?r>sn.beforeFirstVcl?o=!0:r=sn.beforeFirstVcl:(a===38||a===40||a>=45&&a<=47||a>=56&&a<=63)&&r<sn.afterFirstVcl&&(o=!0),o&&n.add(s.offset)}if(n.size===0)return null;const i=[];for(const s of Cd(t,e))n.has(s.offset)||i.push(t.subarray(s.offset,s.offset+s.length));return uV(i,e)},LI=t=>{const e=new Me(t);if(e.readBits(2)!==2)return null;const r=e.readBits(1),s=(e.readBits(1)<<1)+r;if(s===3&&e.skipBits(1),e.readBits(1)===1||e.readBits(1)!==0||(e.skipBits(2),e.readBits(24)!==4817730))return null;let u=8;s>=2&&(u=e.readBits(1)?12:10);const l=e.readBits(3);let d=0,f=0;if(l!==7)if(f=e.readBits(1),s===1||s===3){const T=e.readBits(1),C=e.readBits(1);d=!T&&!C?3:T&&!C?2:1,e.skipBits(1)}else d=1;else d=3,f=1;const h=e.readBits(16),m=e.readBits(16),p=h+1,g=m+1,A=p*g;let y=yt(Ui).level;for(const k of Ui)if(A<=k.maxPictureSize){y=k.level;break}return{profile:s,level:y,bitDepth:u,chromaSubsampling:d,videoFullRangeFlag:f,colourPrimaries:l===2?1:l===1?6:2,transferCharacteristics:l===2?1:l===1?6:2,matrixCoefficients:l===7?0:l===2?1:l===1?6:2}},zI=function*(t){const e=new Me(t),n=()=>{let r=0;for(let i=0;i<8;i++){const s=e.readAlignedByte();if(r|=(s&127)<<i*7,!(s&128))break;if(i===7&&s&128)return null}return r>=2**32-1?null:r};for(;e.getBitsLeft()>=8;){e.skipBits(1);const r=e.readBits(4),i=e.readBits(1),s=e.readBits(1);e.skipBits(1),i&&e.skipBits(8);let a;if(s){const o=n();if(o===null)return;a=o}else a=Math.floor(e.getBitsLeft()/8);b(e.pos%8===0),yield{type:r,data:t.subarray(e.pos/8,e.pos/8+a)},e.skipBits(a*8)}},QI=t=>{for(const{type:e,data:n}of zI(t)){if(e!==1)continue;const r=new Me(n),i=r.readBits(3);r.readBits(1);const s=r.readBits(1);let a=0,o=0,c=0;if(s)a=r.readBits(5);else{if(r.readBits(1)&&(r.skipBits(32),r.skipBits(32),r.readBits(1)))return null;const S=r.readBits(1);S&&(c=r.readBits(5),r.skipBits(32),r.skipBits(5),r.skipBits(5));const k=r.readBits(5);for(let T=0;T<=k;T++){r.skipBits(12);const C=r.readBits(5);if(T===0&&(a=C),C>7){const x=r.readBits(1);T===0&&(o=x)}if(S&&r.readBits(1)){const P=c+1;r.skipBits(P),r.skipBits(P),r.skipBits(1)}r.readBits(1)&&r.skipBits(4)}}const u=r.readBits(4),l=r.readBits(4),d=u+1;r.skipBits(d);const f=l+1;r.skipBits(f);let h=0;if(s?h=0:h=r.readBits(1),h&&(r.skipBits(4),r.skipBits(3)),r.skipBits(1),r.skipBits(1),r.skipBits(1),!s){r.skipBits(1),r.skipBits(1),r.skipBits(1),r.skipBits(1);const E=r.readBits(1);E&&(r.skipBits(1),r.skipBits(1));const S=r.readBits(1);let k=0;S?k=2:k=r.readBits(1),k>0&&(r.readBits(1)||r.skipBits(1)),E&&r.skipBits(3)}r.skipBits(1),r.skipBits(1),r.skipBits(1);const m=r.readBits(1);let p=8;i===2&&m?p=r.readBits(1)?12:10:i<=2&&(p=m?10:8);let g=0;i!==1&&(g=r.readBits(1));let A=1,y=1,w=0;return g||(i===0?(A=1,y=1):i===1?(A=0,y=0):p===12&&(A=r.readBits(1),A&&(y=r.readBits(1))),A&&y&&(w=r.readBits(2))),{profile:i,level:a,tier:o,bitDepth:p,monochrome:g,chromaSubsamplingX:A,chromaSubsamplingY:y,chromaSamplePosition:w}}return null},xd=t=>{const e=_e(t),n=e.getUint8(9),r=e.getUint16(10,!0),i=e.getUint32(12,!0),s=e.getInt16(16,!0),a=e.getUint8(18);let o=null;return a&&(o=t.subarray(19,21+n)),{outputChannelCount:n,preSkip:r,inputSampleRate:i,outputGain:s,channelMappingFamily:a,channelMappingTable:o}},wV=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960],bV=t=>{const e=t[0]>>3;return{durationInSamples:wV[e]}},HI=t=>{if(t.length<7)throw new Error("Setup header is too short.");if(t[0]!==5)throw new Error("Wrong packet type in Setup header.");if(String.fromCharCode(...t.slice(1,7))!=="vorbis")throw new Error("Invalid packet signature in Setup header.");const n=t.length,r=new Uint8Array(n);for(let d=0;d<n;d++)r[d]=t[n-1-d];const i=new Me(r);let s=0;for(;i.getBitsLeft()>97;)if(i.readBits(1)===1){s=i.pos;break}if(s===0)throw new Error("Invalid Setup header: framing bit not found.");let a=0,o=!1,c=0;for(;i.getBitsLeft()>=97;){const d=i.pos,f=i.readBits(8),h=i.readBits(16),m=i.readBits(16);if(f>63||h!==0||m!==0){i.pos=d;break}if(i.skipBits(1),a++,a>64)break;
564i.clone().readBits(6)+1===a&&(o=!0,c=a)}if(!o)throw new Error("Invalid Setup header: mode header not found.");if(c>63)throw new Error(`Unsupported mode count: ${c}.`);const u=c;i.pos=0,i.skipBits(s);const l=Array(u).fill(0);for(let d=u-1;d>=0;d--)i.skipBits(40),l[d]=i.readBits(1);return{modeBlockflags:l}},vd=(t,e,n)=>{switch(t){case"avc":{for(const r of FI(n,e)){const i=n[r.offset],s=Ka(i);if(s>=Vn.NON_IDR_SLICE&&s<=Vn.SLICE_DPC)return"delta";if(s===Vn.IDR)return"key";if(s===Vn.SEI&&(!qm()||NW()>=144)){const a=n.subarray(r.offset,r.offset+r.length),o=kd(a);let c=1;do{let u=0;for(;;){const f=o[c++];if(f===void 0||(u+=f,f<255))break}let l=0;for(;;){const f=o[c++];if(f===void 0||(l+=f,f<255))break}if(u===6){const f=new Me(o);f.pos=8*c;const h=ee(f),m=f.readBits(1);if(h===0&&m===1)return"key"}c+=l}while(c<o.length-1)}}return"delta"}case"hevc":{for(const r of Cd(n,e)){const i=zi(n[r.offset]);if(i<Rt.BLA_W_LP)return"delta";if(i<=Rt.RSV_IRAP_VCL23)return"key"}return"delta"}case"vp8":return(n[0]&1)===0?"key":"delta";case"vp9":{const r=new Me(n);if(r.readBits(2)!==2)return null;const i=r.readBits(1);return(r.readBits(1)<<1)+i===3&&r.skipBits(1),r.readBits(1)?null:r.readBits(1)===0?"key":"delta"}case"av1":{let r=!1;for(const{type:i,data:s}of zI(n))if(i===1){const a=new Me(s);a.skipBits(4),r=!!a.readBits(1)}else if(i===3||i===6||i===7){if(r)return"key";const a=new Me(s);return a.readBits(1)?null:a.readBits(2)===0?"key":"delta"}return null}default:rn(t),b(!1)}};var $r;(function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"})($r||($r={}));const hg=(t,e)=>{var o,c;const n=_e(t);let r=0;const i=n.getUint32(r,!0);r+=4;const s=xn.decode(t.subarray(r,r+i));r+=i,i>0&&(e.raw??(e.raw={}),(o=e.raw).vendor??(o.vendor=s));const a=n.getUint32(r,!0);r+=4;for(let u=0;u<a;u++){const l=n.getUint32(r,!0);r+=4;const d=xn.decode(t.subarray(r,r+l));r+=l;const f=d.indexOf("=");if(f===-1)continue;const h=d.slice(0,f).toUpperCase(),m=d.slice(f+1);switch(e.raw??(e.raw={}),(c=e.raw)[h]??(c[h]=m),h){case"TITLE":e.title??(e.title=m);break;case"DESCRIPTION":e.description??(e.description=m);break;case"ARTIST":e.artist??(e.artist=m);break;case"ALBUM":e.album??(e.album=m);break;case"ALBUMARTIST":e.albumArtist??(e.albumArtist=m);break;case"COMMENT":e.comment??(e.comment=m);break;case"LYRICS":e.lyrics??(e.lyrics=m);break;case"TRACKNUMBER":{const p=m.split("/"),g=Number.parseInt(p[0],10),A=p[1]&&Number.parseInt(p[1],10);Number.isInteger(g)&&g>0&&(e.trackNumber??(e.trackNumber=g)),A&&Number.isInteger(A)&&A>0&&(e.tracksTotal??(e.tracksTotal=A))}break;case"TRACKTOTAL":{const p=Number.parseInt(m,10);Number.isInteger(p)&&p>0&&(e.tracksTotal??(e.tracksTotal=p))}break;case"DISCNUMBER":{const p=m.split("/"),g=Number.parseInt(p[0],10),A=p[1]&&Number.parseInt(p[1],10);Number.isInteger(g)&&g>0&&(e.discNumber??(e.discNumber=g)),A&&Number.isInteger(A)&&A>0&&(e.discsTotal??(e.discsTotal=A))}break;case"DISCTOTAL":{const p=Number.parseInt(m,10);Number.isInteger(p)&&p>0&&(e.discsTotal??(e.discsTotal=p))}break;case"DATE":{const p=new Date(m);Number.isNaN(p.getTime())||(e.date??(e.date=p))}break;case"GENRE":e.genre??(e.genre=m);break;case"METADATA_BLOCK_PICTURE":{const p=Ad(m),g=_e(p),A=g.getUint32(0,!1),y=g.getUint32(4,!1),w=String.fromCharCode(...p.subarray(8,8+y)),E=g.getUint32(8+y,!1),S=xn.decode(p.subarray(12+y,12+y+E)),k=g.getUint32(y+E+28),T=p.subarray(y+E+32,y+E+32+k);e.images??(e.images=[]),e.images.push({data:T,mimeType:w,kind:A===3?"coverFront":A===4?"coverBack":"unknown",name:void 0,description:S||void 0})}break}}},pg=(t,e,n)=>{var m,p;const r=[t],s=tt.encode("Mediabunny");let a=new Uint8Array(4+s.length),o=new DataView(a.buffer);o.setUint32(0,s.length,!0),a.set(s,4),r.push(a);const c=new Set,u=(g,A)=>{const y=`${g}=${A}`,w=tt.encode(y);a=new Uint8Array(4+w.length),o=new DataView(a.buffer),o.setUint32(0,w.length,!0),a.set(w,4),r.push(a),c.add(g)};for(const{key:g,value:A}of Qa(e))switch(g){case"title":u("TITLE",A);break;case"description":u("DESCRIPTION",A);break;case"artist":u("ARTIST",A);break;case"album":u("ALBUM",A);break;case"albumArtist":u("ALBUMARTIST",A);break;case"genre":u("GENRE",A);break;case"date":{const y=((m=e.raw)==null?void 0:m.DATE)??((p=e.raw)==null?void 0:p.date);y&&typeof y=="string"?u("DATE",y):u("DATE",A.toISOString().slice(0,10))}break;case"comment":u("COMMENT",A);break;case"lyrics":u("LYRICS",A);break;case"trackNumber":u("TRACKNUMBER",A.toString());break;case"tracksTotal":u("TRACKTOTAL",A.toString());break;case"discNumber":u("DISCNUMBER",A.toString());break;case"discsTotal":u("DISCTOTAL",A.toString());break;case"images":{if(!n)break;for(const y of A){const w=y.kind==="coverFront"?3:y.kind==="coverBack"?4:0,E=new Uint8Array(y.mimeType.length);for(let _=0;_<y.mimeType.length;_++)E[_]=y.mimeType.charCodeAt(_);const S=tt.encode(y.description??""),k=new Uint8Array(8+E.length+4+S.length+16+4+y.data.length),T=_e(k);T.setUint32(0,w,!1),T.setUint32(4,E.length,!1),k.set(E,8),T.setUint32(8+E.length,S.length,!1),k.set(S,12+E.length),T.setUint32(28+E.length+S.length,y.data.length,!1),k.set(y.data,32+E.length+S.length);const C=LW(k);u("METADATA_BLOCK_PICTURE",C)}}break;case"raw":break;default:rn(g)}if(e.raw)for(const g in e.raw){const A=e.raw[g]??e.raw[g.toLowerCase()];g==="vendor"||A==null||c.has(g)||typeof A=="string"&&u(g,A)}const l=new Uint8Array(4);_e(l).setUint32(0,c.size,!0),r.splice(2,0,l);const d=r.reduce((g,A)=>g+A.length,0),f=new Uint8Array(d);let h=0;for(const g of r)f.set(g,h),h+=g.length;return f},mg=[2,1,2,3,3,4,4,5],WI=t=>{if(t.length<7||t[0]!==11||t[1]!==119)return null;const e=new Me(t);e.skipBits(16),e.skipBits(16);const n=e.readBits(2);if(n===3)return null;const r=e.readBits(6),i=e.readBits(5);if(i>8)return null;const s=e.readBits(3),a=e.readBits(3);(a&1)!==0&&a!==1&&e.skipBits(2),(a&4)!==0&&e.skipBits(2),a===2&&e.skipBits(2);const o=e.readBits(1),c=Math.floor(r/2);
564return{fscod:n,bsid:i,bsmod:s,acmod:a,lfeon:o,bitRateCode:c}},EV=[128,138,192,128,140,192,160,174,240,160,176,240,192,208,288,192,210,288,224,242,336,224,244,336,256,278,384,256,280,384,320,348,480,320,350,480,384,416,288*2,384,418,288*2,448,486,336*2,448,488,336*2,256*2,278*2,384*2,256*2,279*2,384*2,320*2,348*2,480*2,320*2,349*2,480*2,384*2,417*2,576*2,384*2,418*2,576*2,448*2,487*2,672*2,448*2,488*2,672*2,512*2,557*2,768*2,512*2,558*2,768*2,640*2,696*2,960*2,640*2,697*2,960*2,768*2,835*2,1152*2,768*2,836*2,1152*2,896*2,975*2,1344*2,896*2,976*2,1344*2,1024*2,1114*2,1536*2,1024*2,1115*2,1536*2,1152*2,1253*2,1728*2,1152*2,1254*2,1728*2,1280*2,1393*2,1920*2,1280*2,1394*2,1920*2],SV=1536,Bd=new Uint8Array([5,4,65,67,45,51]),Pd=new Uint8Array([5,4,69,65,67,51]),VI=[1,2,3,6],GI=t=>{if(t.length<6||t[0]!==11||t[1]!==119)return null;const e=new Me(t);e.skipBits(16);const n=e.readBits(2);if(e.skipBits(3),n!==0&&n!==2)return null;const r=e.readBits(11),i=e.readBits(2);let s=0,a;i===3?(s=e.readBits(2),a=3):a=e.readBits(2);const o=e.readBits(3),c=e.readBits(1),u=e.readBits(5);if(u<11||u>16)return null;const l=VI[a];let d;return i<3?d=Td[i]/1e3:d=RI[s]/1e3,{dataRate:Math.round((r+1)*d/(l*16)),substreams:[{fscod:i,fscod2:s,bsid:u,bsmod:0,acmod:o,lfeon:c,numDepSub:0,chanLoc:0}]}},_V=t=>{if(t.length<2)return null;const e=new Me(t),n=e.readBits(13),r=e.readBits(3),i=[];for(let s=0;s<=r&&!(Math.ceil(e.pos/8)+3>t.length);s++){const a=e.readBits(2),o=e.readBits(5);e.skipBits(1),e.skipBits(1);const c=e.readBits(3),u=e.readBits(3),l=e.readBits(1);e.skipBits(3);const d=e.readBits(4);let f=0;d>0?f=e.readBits(9):e.skipBits(1),i.push({fscod:a,fscod2:null,bsid:o,bsmod:c,acmod:u,lfeon:l,numDepSub:d,chanLoc:f})}return i.length===0?null:{dataRate:n,substreams:i}},qI=t=>{const e=t.substreams[0];return b(e),e.fscod<3?Td[e.fscod]:e.fscod2!==null&&e.fscod2<3?RI[e.fscod2]:null},YI=t=>{const e=t.substreams[0];b(e);let n=mg[e.acmod]+e.lfeon;if(e.numDepSub>0){const r=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)e.chanLoc&1<<8-i&&(n+=r[i])}return n};/*!
565 * Copyright (c) 2026-present, Vanilagy and contributors
566 *
567 * This Source Code Form is subject to the terms of the Mozilla Public
568 * License, v. 2.0. If a copy of the MPL was not distributed with this
569 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
570 */class Xr{constructor(e){this.input=e}dispose(){}}/*!
571 * Copyright (c) 2026-present, Vanilagy and contributors
572 *
573 * This Source Code Form is subject to the terms of the Mozilla Public
574 * License, v. 2.0. If a copy of the MPL was not distributed with this
575 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
576 */const vn=new Uint8Array(0);class nt{constructor(e,n,r,i,s=-1,a,o){if(this.data=e,this.type=n,this.timestamp=r,this.duration=i,this.sequenceNumber=s,e===vn&&a===void 0)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(a===void 0&&(a=e.byteLength),!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if(n!=="key"&&n!=="delta")throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(r))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(s))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(a)||a<0)throw new TypeError("byteLength must be a non-negative integer.");if(o!==void 0&&(typeof o!="object"||!o))throw new TypeError("sideData, when provided, must be an object.");if((o==null?void 0:o.alpha)!==void 0&&!(o.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if((o==null?void 0:o.alphaByteLength)!==void 0&&(!Number.isInteger(o.alphaByteLength)||o.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=a,this.sideData=o??{},this.sideData.alpha&&this.sideData.alphaByteLength===void 0&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===vn}get microsecondTimestamp(){return Math.trunc(Di*this.timestamp)}get microsecondDuration(){return Math.trunc(Di*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw new Error("Your browser does not support EncodedVideoChunk.");
576return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if(typeof EncodedAudioChunk>"u")throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,n){if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const r=new Uint8Array(e.byteLength);return e.copyTo(r),new nt(r,e.type,e.timestamp/1e6,(e.duration??0)/1e6,void 0,void 0,n)}clone(e){if(e!==void 0&&(typeof e!="object"||e===null))throw new TypeError("options, when provided, must be an object.");if((e==null?void 0:e.data)!==void 0&&!(e.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if((e==null?void 0:e.type)!==void 0&&e.type!=="key"&&e.type!=="delta")throw new TypeError('options.type, when provided, must be either "key" or "delta".');if((e==null?void 0:e.timestamp)!==void 0&&!Number.isFinite(e.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if((e==null?void 0:e.duration)!==void 0&&!Number.isFinite(e.duration))throw new TypeError("options.duration, when provided, must be a number.");if((e==null?void 0:e.sequenceNumber)!==void 0&&!Number.isFinite(e.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if((e==null?void 0:e.sideData)!==void 0&&(typeof e.sideData!="object"||e.sideData===null))throw new TypeError("options.sideData, when provided, must be an object.");return new nt((e==null?void 0:e.data)??this.data,(e==null?void 0:e.type)??this.type,(e==null?void 0:e.timestamp)??this.timestamp,(e==null?void 0:e.duration)??this.duration,(e==null?void 0:e.sequenceNumber)??this.sequenceNumber,this.byteLength,(e==null?void 0:e.sideData)??this.sideData)}}/*!
577 * Copyright (c) 2026-present, Vanilagy and contributors
578 *
579 * This Source Code Form is subject to the terms of the Mozilla Public
580 * License, v. 2.0. If a copy of the MPL was not distributed with this
581 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
582 */const KI=t=>{let n=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isQuickTime?"quicktime":"mp4");if(t.codecStrings.length>0){const r=[...new Set(t.codecStrings)];n+=`; codecs="${r.join(", ")}"`}return n},jI=t=>{const e=_e(t);let n=0;const r=e.getUint8(n);n+=1,n+=3;const i=Ac(t.subarray(n,n+16));n+=16;let s=null;if(r>0){const o=e.getUint32(n);if(n+=4,o>0){s=[];for(let c=0;c<o;c++)s.push(Ac(t.subarray(n,n+16))),n+=16}}const a=e.getUint32(n);return n+=4,{systemId:i,keyIds:s,data:t.slice(n,n+a)}},$I=(t,e)=>t.systemId===e.systemId&&mI(t.data,e.data);/*!
583 * Copyright (c) 2026-present, Vanilagy and contributors
584 *
585 * This Source Code Form is subject to the terms of the Mozilla Public
586 * License, v. 2.0. If a copy of the MPL was not distributed with this
587 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
588 */const Jr=8,vs=16,Qi=t=>{let e=J(t);const n=_t(t,4);let r=8;e===1&&(e=qn(t),r=16);const s=e-r;return s<0?null:{name:n,totalSize:e,headerSize:r,contentSize:s}},Bs=t=>Us(t)/65536,gg=t=>Us(t)/1073741824,Ag=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const r=ce(t);if(e|=r&127,(r&128)===0)break}return e},br=t=>{let e=Mt(t);return t.skip(2),e=Math.min(e,t.remainingLength),xn.decode(de(t,e))},TV=t=>{const e=Qi(t);if(!e||e.name!=="data"||t.remainingLength<8)return null;const n=J(t);t.skip(4);const r=de(t,e.contentSize-8);switch(n){case 1:return xn.decode(r);case 2:return new TextDecoder("utf-16be").decode(r);case 13:return new Is(r,"image/jpeg");case 14:return new Is(r,"image/png");case 27:return new Is(r,"image/bmp");default:return r}};/*!
589 * Copyright (c) 2026-present, Vanilagy and contributors
590 *
591 * This Source Code Form is subject to the terms of the Mozilla Public
592 * License, v. 2.0. If a copy of the MPL was not distributed with this
593 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
594 */const Er=16,Zr=new Uint32Array(256),ja=new Uint32Array(256),$a=new Uint32Array(256),Xa=new Uint32Array(256),Ja=new Uint32Array(256),tn=new Uint32Array(256),XI=new Uint32Array(10);let JI=!1;const kV=()=>{const t=new Uint8Array(256),e=new Uint8Array(256),n=new Uint8Array(256);for(let s=0,a=1;s<256;s++)n[s]=a,e[a]=s,a=a^a<<1^(a&128?283:0);const r=(s,a)=>s&&a?n[(e[s]+e[a])%255]:0;t[0]=99;for(let s=1;s<256;s++){const a=n[255-e[s]];let o=a^a<<1^a<<2^a<<3^a<<4;o=o>>>8^o&255^99,t[s]=o}for(let s=0;s<256;s++){const a=t[s],o=t.indexOf(s);Zr[s]=a<<24|a<<16|a<<8|a,tn[s]=o<<24|o<<16|o<<8|o;
594const c=r(o,14),u=r(o,9),l=r(o,13),d=r(o,11),f=c<<24|u<<16|l<<8|d;ja[s]=f,$a[s]=f>>>8|f<<24,Xa[s]=f>>>16|f<<16,Ja[s]=f>>>24|f<<8}let i=1;for(let s=0;s<10;s++)XI[s]=i<<24,i=i<<1^(i&128?283:0);JI=!0};class ZI{constructor(){this.roundkey=new Uint32Array(44),this.iv=new Uint32Array(Er/Uint32Array.BYTES_PER_ELEMENT),this.in=new Uint8Array(Er),this.out=new Uint8Array(Er),this.inView=new DataView(this.in.buffer),this.outView=new DataView(this.out.buffer)}init({key:e,iv:n}){b(e.byteLength===16),b(n.byteLength===16),JI||kV();const r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=new DataView(n.buffer,n.byteOffset,n.byteLength);this.roundkey[0]=r.getUint32(0,!1),this.roundkey[1]=r.getUint32(4,!1),this.roundkey[2]=r.getUint32(8,!1),this.roundkey[3]=r.getUint32(12,!1),this.iv[0]=i.getUint32(0,!1),this.iv[1]=i.getUint32(4,!1),this.iv[2]=i.getUint32(8,!1),this.iv[3]=i.getUint32(12,!1);for(let s=4;s<44;s+=4){const a=this.roundkey[s-1];this.roundkey[s]=this.roundkey[s-4]^Zr[a>>>16&255]&4278190080^Zr[a>>>8&255]&16711680^Zr[a>>>0&255]&65280^Zr[a>>>24&255]&255^XI[s/4-1],this.roundkey[s+1]=this.roundkey[s-3]^this.roundkey[s],this.roundkey[s+2]=this.roundkey[s-2]^this.roundkey[s+1],this.roundkey[s+3]=this.roundkey[s-1]^this.roundkey[s+2]}for(let s=0,a=40;s<a;s+=4,a-=4)for(let o=0;o<4;o++){const c=this.roundkey[s+o];this.roundkey[s+o]=this.roundkey[a+o],this.roundkey[a+o]=c}for(let s=4;s<40;s+=4)for(let a=0;a<4;a++){const o=this.roundkey[s+a];this.roundkey[s+a]=ja[Zr[o>>>24&255]&255]^$a[Zr[o>>>16&255]&255]^Xa[Zr[o>>>8&255]&255]^Ja[Zr[o>>>0&255]&255]}}decrypt(){let e=this.inView.getUint32(0,!1)^this.roundkey[0],n=this.inView.getUint32(4,!1)^this.roundkey[1],r=this.inView.getUint32(8,!1)^this.roundkey[2],i=this.inView.getUint32(12,!1)^this.roundkey[3];const s=this.inView.getUint32(0,!1),a=this.inView.getUint32(4,!1),o=this.inView.getUint32(8,!1),c=this.inView.getUint32(12,!1);let u,l,d,f;for(let A=1;A<10;A++){const y=A*4;u=ja[e>>>24]^$a[i>>>16&255]^Xa[r>>>8&255]^Ja[n&255]^this.roundkey[y],l=ja[n>>>24]^$a[e>>>16&255]^Xa[i>>>8&255]^Ja[r&255]^this.roundkey[y+1],d=ja[r>>>24]^$a[n>>>16&255]^Xa[e>>>8&255]^Ja[i&255]^this.roundkey[y+2],f=ja[i>>>24]^$a[r>>>16&255]^Xa[n>>>8&255]^Ja[e&255]^this.roundkey[y+3],e=u,n=l,r=d,i=f}const h=tn[e>>>24&255]&4278190080^tn[i>>>16&255]&16711680^tn[r>>>8&255]&65280^tn[n>>>0&255]&255^this.roundkey[40],m=tn[n>>>24&255]&4278190080^tn[e>>>16&255]&16711680^tn[i>>>8&255]&65280^tn[r>>>0&255]&255^this.roundkey[41],p=tn[r>>>24&255]&4278190080^tn[n>>>16&255]&16711680^tn[e>>>8&255]&65280^tn[i>>>0&255]&255^this.roundkey[42],g=tn[i>>>24&255]&4278190080^tn[r>>>16&255]&16711680^tn[n>>>8&255]&65280^tn[e>>>0&255]&255^this.roundkey[43];this.outView.setUint32(0,h^this.iv[0],!1),this.outView.setUint32(4,m^this.iv[1],!1),this.outView.setUint32(8,p^this.iv[2],!1),this.outView.setUint32(12,g^this.iv[3],!1),this.iv[0]=s,this.iv[1]=a,this.iv[2]=o,this.iv[3]=c}}const IV=(t,e,n)=>{let r=!1,i=0;const s=2**16,a=16,o=new ZI;return new ReadableStream({pull:async c=>{r||(o.init(await e()),r=!0);const u=s+a;let l=t.requestSliceRange(i,0,u);if(l instanceof Promise&&(l=await l),!l||l.length===0)throw new Error("Invalid ciphertext.");const d=l.length;if(d%16!==0)throw new Error("Invalid ciphertext.");const f=d===u?d-a:d,h=de(l,f),m=new Uint8Array(f);for(let p=0;p<f;p+=16)o.in.set(h.subarray(p,p+16)),o.decrypt(),m.set(o.out,p);if(f<d)c.enqueue(m),i+=f;else{const p=m[f-1];if(p===0||p>16)throw new Error("Invalid PKCS#7 padding. Incorrect key or corrupted data.");const g=m.subarray(0,f-p);c.enqueue(g),c.close(),n()}},cancel:()=>{n()}})};/*!
595 * Copyright (c) 2026-present, Vanilagy and contributors
596 *
597 * This Source Code Form is subject to the terms of the Mozilla Public
598 * License, v. 2.0. If a copy of the MPL was not distributed with this
599 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
600 */class yg extends Xr{constructor(e){super(e),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.pss
600hBoxes=[],this.currentFragment=null,this.lastReadFragment=null,this.decryptionKeyCache=new Map,this.reader=e._reader}async getTrackBackings(){return await this.readMetadata(),this.tracks.map(e=>e.trackBacking)}async getMimeType(){await this.readMetadata();const e=await this.getTrackBackings(),n=await Promise.all(e.map(r=>r.getDecoderConfig().then(i=>(i==null?void 0:i.codec)??null)));return KI({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some(r=>{var i;return((i=r.info)==null?void 0:i.type)==="video"}),hasAudio:this.tracks.some(r=>{var i;return((i=r.info)==null?void 0:i.type)==="audio"}),codecStrings:n.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{let e=0,n=!1;for(;;){let r=this.reader.requestSliceRange(e,Jr,vs);if(r instanceof Promise&&(r=await r),!r)break;const i=e,s=Qi(r);if(!s)break;if(s.name==="ftyp"||s.name==="styp"){const a=_t(r,4);this.isQuickTime=a==="qt  "}else if(s.name==="moov"){let a=this.reader.requestSlice(r.filePos,s.contentSize);if(a instanceof Promise&&(a=await a),!a)break;this.moovSlice=a,this.readContiguousBoxes(this.moovSlice);for(const o of this.tracks){const c=o.editListPreviousSegmentDurations/this.movieTimescale;o.editListOffset-=Math.round(c*o.timescale)}n=this.isFragmented&&this.reader.fileSize!==null&&this.reader.fileSize>i+s.totalSize;break}else if(s.name==="moof"){if(!this.input._initInput)throw new Error('"moof" box encountered with no "moov" box present; this file is likely a Segment as described in ISO/IEC 14496-12 Section 8.16. A separate init file that contains a "moov" box is required to read this file, please provide it using InputOptions.initInput.');const a=await this.input._initInput._getDemuxer();if(a.constructor!==yg)throw new Error("Init input must match the input's format.");await a.readMetadata(),this.movieTimescale=a.movieTimescale,this.movieDurationInTimescale=a.movieDurationInTimescale,this.metadataTags=a.metadataTags,this.isFragmented=!0,this.fragmentTrackDefaults=a.fragmentTrackDefaults,this.psshBoxes=a.psshBoxes;for(const o of a.tracks){const c={id:o.id,demuxer:this,trackBacking:null,disposition:o.disposition,timescale:o.timescale,durationInMediaTimescale:o.durationInMediaTimescale,durationInMovieTimescale:o.durationInMovieTimescale,rotation:o.rotation,internalCodecId:o.internalCodecId,name:o.name,languageCode:o.languageCode,sampleTableByteOffset:null,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:o.editListPreviousSegmentDurations,editListOffset:o.editListOffset,encryptionInfo:o.encryptionInfo,encryptionAuxInfo:null,frmaCodecString:null,info:o.info};if(o.trackBacking){if(b(c.info),c.info.type==="video"&&c.info.width!==-1){const u=c;c.trackBacking=new tC(u),this.tracks.push(c)}else if(c.info.type==="audio"&&c.info.numberOfChannels!==-1){const u=c;c.trackBacking=new nC(u),this.tracks.push(c)}}}n=!1;break}e=i+s.totalSize}if(n){b(this.reader.fileSize!==null);let r=this.reader.requestSlice(this.reader.fileSize-4,4);r instanceof Promise&&(r=await r),b(r);const i=J(r),s=this.reader.fileSize-i;if(s>=0&&s<=this.reader.fileSize-vs){let a=this.reader.requestSliceRange(s,Jr,vs);if(a instanceof Promise&&(a=await a),a){const o=Qi(a);if(o&&o.name==="mfra"){let c=this.reader.requestSlice(a.filePos,o.contentSize);c instanceof Promise&&(c=await c),c&&this.readContiguousBoxes(c)}}}}})())}getSampleTableForTrack(e){var s,a;if(e.sampleTable)return e.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};if(e.sampleTable=n,e.sampleTableByteOffset===null)return n;b(this.moovSlice);const r=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(r),this.currentTrack=null,((s=e.info)==null?void 0:s.type)==="audio"&&e.info.codec&&Nt.includes(e.info.codec)&&n.sampleCompositionTimeOffsets.length===0){b(((a=e.info)==null?void 0:a.type)==="audio");const o=sr(e.info.codec),c=[],u=[];for(let l=0;l<n.sampleToChunk.length;l++){const d=n.sampleToChunk[l],f=n.sampleToChunk[l+1],h=(f?f.startChunkIndex:n.chunkOffsets.length)-d.startChunkIndex;for(let m=0;m<h;m++){const p=d.startSampleIndex+m*d.samplesPerChunk,g=p+d.samplesPerChunk,A=Ge(n.sampleTimingEntries,p,x=>x.startIndex),y=n.sampleTimingEntries[A],w=Ge(n.sampleTimingEntries,g,x=>x.startIndex),E=n.sampleTimingEntries[w],S=y.startDecodeTimestamp+(p-y.startIndex)*y.delta,T=E.startDecodeTimestamp+(g-E.startIndex)*E.delta-S,C=yt(c);C&&C.delta===T?C.count++:c.push({startIndex:d.startChunkIndex+m,startDecodeTimestamp:S,count:1,delta:T});const _=d.samplesPerChunk*o.sampleSize*e.info.numberOfChannels;u.push(_)}d.startSampleIndex=d.startChunkIndex,d.samplesPerChunk=1}n.sampleTimingEntries=c,n.sampleSizes=u}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const o of n.sampleTimingEntries)for(let c=0;c<o.count;c++)n.presentationTimestamps.push({presentationTimestamp:o.startDecodeTimestamp+c*o.delta,sampleIndex:o.startIndex+c});for(const o of n.sampleCompositionTimeOffsets)for(let c=0;c<o.count;c++){const u=o.startIndex+c,l=n.presentationTimestamps[u];l&&(l.presentationTimestamp+=o.offset)}n.presentationTimestamps.sort((o,c)=>o.presentationTimestamp-c.presentationTimestamp),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let o=0;o<n.presentationTimestamps.length;o++)n.presentationTimestampIndexMap[n.presentationTimestamps[o].sampleIndex]=o}return n}async readFragment(e){var a;
600if(((a=this.lastReadFragment)==null?void 0:a.moofOffset)===e)return this.lastReadFragment;let n=this.reader.requestSliceRange(e,Jr,vs);n instanceof Promise&&(n=await n),b(n);const r=Qi(n);b((r==null?void 0:r.name)==="moof");let i=this.reader.requestSlice(e,r.totalSize);i instanceof Promise&&(i=await i),b(i),this.traverseBox(i);const s=this.lastReadFragment;b(s&&s.moofOffset===e);for(const[,o]of s.trackData){const c=o.track,{fragmentPositionCache:u}=c;if(!o.startTimestampIsFinal){const d=c.fragmentLookupTable.find(f=>f.moofOffset===s.moofOffset);if(d)bg(o,d.timestamp);else{const f=Ge(u,s.moofOffset-1,h=>h.moofOffset);if(f!==-1){const h=u[f];bg(o,h.endTimestamp)}}o.startTimestampIsFinal=!0}const l=Ge(u,o.startTimestamp,d=>d.startTimestamp);if((l===-1||u[l].moofOffset!==s.moofOffset)&&u.splice(l+1,0,{moofOffset:s.moofOffset,startTimestamp:o.startTimestamp,endTimestamp:o.endTimestamp}),o.encryptionAuxInfo&&c.encryptionInfo){const d=await sC(this.reader,c.encryptionInfo,o.encryptionAuxInfo);for(let f=0;f<Math.min(o.samples.length,d.length);f++){const h=d[f];o.samples[f].encryption=h}}}return s}readContiguousBoxes(e){const n=e.filePos;for(;e.filePos-n<=e.length-Jr&&this.traverseBox(e););}*iterateContiguousBoxes(e){const n=e.filePos;for(;e.filePos-n<=e.length-Jr;){const r=e.filePos,i=Qi(e);if(!i)break;yield{boxInfo:i,slice:e},e.filePos=r+i.totalSize}}traverseBox(e){var a,o,c,u,l,d,f,h,m,p,g,A,y,w,E,S,k,T,C,_,x,P,v,M,D,O,N,Q,G,V,Z,B,L,K,q,ne,fe,Ae,ie,ye,$e,ge,xe,We,be;const n=e.filePos,r=Qi(e);if(!r)return!1;const i=e.filePos,s=n+r.totalSize;switch(r.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"sinf":case"schi":this.readContiguousBoxes(e.slice(i,r.contentSize));break;case"mvhd":{const I=ce(e);e.skip(3),I===1?(e.skip(16),this.movieTimescale=J(e),this.movieDurationInTimescale=qn(e)):(e.skip(8),this.movieTimescale=J(e),this.movieDurationInTimescale=J(e))}break;case"trak":{const I={id:-1,demuxer:this,trackBacking:null,disposition:{...Kr,primary:!1},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:Kt,sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0,encryptionInfo:null,encryptionAuxInfo:null,frmaCodecString:null};if(this.currentTrack=I,this.readContiguousBoxes(e.slice(i,r.contentSize)),I.id!==-1&&I.timescale!==-1&&I.info!==null){if(I.info.type==="video"&&I.info.width!==-1){const H=I;I.trackBacking=new tC(H),this.tracks.push(I)}else if(I.info.type==="audio"&&I.info.numberOfChannels!==-1){const H=I;I.trackBacking=new nC(H),this.tracks.push(I)}}this.currentTrack=null}break;case"tkhd":{const I=this.currentTrack;if(!I)break;const H=ce(e),U=!!(si(e)&1);if(I.disposition.default=U,H===0)e.skip(8),I.id=J(e),e.skip(4),I.durationInMovieTimescale=J(e);else if(H===1)e.skip(16),I.id=J(e),e.skip(4),I.durationInMovieTimescale=qn(e);else throw new Error(`Incorrect track header version ${H}.`);e.skip(16);const $=[Bs(e),Bs(e),gg(e),Bs(e),Bs(e),gg(e),Bs(e),Bs(e),gg(e)],z=Na(Qm(BV($),90));b(z===0||z===90||z===180||z===270),I.rotation=z}break;case"elst":{const I=this.currentTrack;if(!I)break;const H=ce(e);e.skip(3);let F=!1,U=0;const $=J(e);for(let z=0;z<$;z++){const X=H===1?qn(e):J(e),Y=H===1?rG(e):Us(e),re=Bs(e);if(X!==0){if(F){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(Y===-1){U+=X;continue}if(re!==1){console.warn("Unsupported edit list entry: media rate must be 1.");break}I.editListPreviousSegmentDurations=U,I.editListOffset=Y,F=!0}}}break;case"mdhd":{const I=this.currentTrack;if(!I)break;const H=ce(e);e.skip(3),H===0?(e.skip(8),I.timescale=J(e),I.durationInMediaTimescale=J(e)):H===1&&(e.skip(16),I.timescale=J(e),I.durationInMediaTimescale=qn(e));let F=Mt(e);
600if(F>0){I.languageCode="";for(let U=0;U<3;U++)I.languageCode=String.fromCharCode(96+(F&31))+I.languageCode,F>>=5;bc(I.languageCode)||(I.languageCode=Kt)}}break;case"hdlr":{const I=this.currentTrack;if(!I)break;e.skip(8);const H=_t(e,4);H==="vide"?I.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:H==="soun"&&(I.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null,pcmLittleEndian:!1,pcmSampleSize:null})}break;case"stbl":{const I=this.currentTrack;if(!I)break;I.sampleTableByteOffset=n,this.readContiguousBoxes(e.slice(i,r.contentSize))}break;case"stsd":{const I=this.currentTrack;if(!I||I.info===null||I.sampleTable)break;const H=ce(e);e.skip(3);const F=J(e);for(let U=0;U<F;U++){const $=e.filePos,z=Qi(e);if(!z)break;I.internalCodecId=z.name;const X=z.name.toLowerCase();if(I.info.type==="video"){e.skip(24),I.info.width=Mt(e),I.info.height=Mt(e),I.info.squarePixelWidth=I.info.width,I.info.squarePixelHeight=I.info.height,e.skip(50),I.frmaCodecString=null,this.readContiguousBoxes(e.slice(e.filePos,$+z.totalSize-e.filePos));const Y=X==="encv"?I.frmaCodecString:X;I.frmaCodecString=null,Y==="avc1"||Y==="avc3"?(I.info.codec="avc",I.info.avcType=Y==="avc1"?1:3):Y==="hvc1"||Y==="hev1"?I.info.codec="hevc":Y==="vp08"?I.info.codec="vp8":Y==="vp09"?I.info.codec="vp9":Y==="av01"?I.info.codec="av1":console.warn(Y===null?"Unknown encrypted video codec due to missing frma box.":`Unsupported video codec (sample entry type '${z.name}').`)}else{e.skip(8);const Y=Mt(e);e.skip(6);let re=Mt(e),se=Mt(e);e.skip(4);let oe=J(e)/65536,Ke=null;H===0&&Y>0&&(Y===1?(e.skip(4),se=8*J(e),e.skip(8)):Y===2&&(e.skip(4),oe=qx(e),re=J(e),e.skip(4),se=J(e),Ke=J(e),e.skip(8))),I.info.numberOfChannels=re,I.info.sampleRate=oe,I.frmaCodecString=null,this.readContiguousBoxes(e.slice(e.filePos,$+z.totalSize-e.filePos));const ue=X==="enca"?I.frmaCodecString:X;if(I.frmaCodecString=null,ue!=="mp4a")if(ue==="opus")I.info.codec="opus",I.info.sampleRate=qa;else if(ue==="flac")I.info.codec="flac";else if(ue==="ulaw")I.info.codec="ulaw";else if(ue==="alaw")I.info.codec="alaw";else if(ue==="ac-3")I.info.codec="ac3";else if(ue==="ec-3")I.info.codec="eac3";else if(ue==="twos")se===8?I.info.codec="pcm-s8":se===16?I.info.codec=I.info.pcmLittleEndian?"pcm-s16":"pcm-s16be":(console.warn(`Unsupported sample size ${se} for codec 'twos'.`),I.info.codec=null);else if(ue==="sowt")se===8?I.info.codec="pcm-s8":se===16?I.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${se} for codec 'sowt'.`),I.info.codec=null);else if(ue==="raw ")I.info.codec="pcm-u8";else if(ue==="in24")I.info.codec=I.info.pcmLittleEndian?"pcm-s24":"pcm-s24be";else if(ue==="in32")I.info.codec=I.info.pcmLittleEndian?"pcm-s32":"pcm-s32be";else if(ue==="fl32")I.info.codec=I.info.pcmLittleEndian?"pcm-f32":"pcm-f32be";else if(ue==="fl64")I.info.codec=I.info.pcmLittleEndian?"pcm-f64":"pcm-f64be";else if(ue==="ipcm"){const Fe=I.info.pcmSampleSize;I.info.pcmLittleEndian?Fe===16?I.info.codec="pcm-s16":Fe===24?I.info.codec="pcm-s24":Fe===32?I.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${Fe}.`),I.info.codec=null):Fe===16?I.info.codec="pcm-s16be":Fe===24?I.info.codec="pcm-s24be":Fe===32?I.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${Fe}.`),I.info.codec=null)}else if(ue==="fpcm"){const Fe=I.info.pcmSampleSize;I.info.pcmLittleEndian?Fe===32?I.info.codec="pcm-f32":Fe===64?I.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${Fe}.`),I.info.codec=null):Fe===32?I.info.codec="pcm-f32be":Fe===64?I.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${Fe}.`),I.info.codec=null)}else if(ue==="lpcm"&&Ke!==null){const Fe=se+7>>3,Vt=!!(Ke&1),Dt=!!(Ke&2),mn=Ke&4?-1:0;se>0&&se<=64&&(Vt?se===32&&(I.info.codec=Dt?"pcm-f32be":"pcm-f32"):mn&1<<Fe-1?Fe===1?I.info.codec="pcm-s8":Fe===2?I.info.codec=Dt?"pcm-s16be":"pcm-s16":Fe===3?I.info.codec=Dt?"pcm-s24be":"pcm-s24":Fe===4&&(I.info.codec=Dt?"pcm-s32be":"pcm-s32"):Fe===1&&(I.info.codec="pcm-u8")),I.info.codec===null&&console.warn("Unsupported PCM format.")}else console.warn(ue===null?"Unknown encrypted audio codec due to missing frma box.":`Unsupported audio codec (sample entry type '${z.name}').`)}e.filePos=$+z.totalSize}}break;case"frma":{const I=this.currentTrack;if(!I)break;const F=_t(e,4).toLowerCase();I.frmaCodecString=F}break;case"schm":{const I=this.currentTrack;if(!I)break;e.skip(4);const H=_t(e,4);
600H==="cenc"||H==="cens"||H==="cbcs"?I.encryptionInfo={scheme:H,defaultKid:null,defaultIsProtected:null,defaultPerSampleIvSize:null,defaultConstantIv:null,defaultCryptByteBlock:null,defaultSkipByteBlock:null}:console.warn(`Unsupported encryption scheme '${H}'.`)}break;case"tenc":{const I=this.currentTrack;if(!I||!I.encryptionInfo)break;const H=ce(e);e.skip(3),e.skip(1);const F=ce(e);if(H>0?(I.encryptionInfo.defaultCryptByteBlock=F>>4,I.encryptionInfo.defaultSkipByteBlock=F&15):(I.encryptionInfo.defaultCryptByteBlock=0,I.encryptionInfo.defaultSkipByteBlock=0),I.encryptionInfo.defaultIsProtected=ce(e)!==0,I.encryptionInfo.defaultPerSampleIvSize=ce(e),I.encryptionInfo.defaultKid=Ac(de(e,16)),I.encryptionInfo.defaultIsProtected&&I.encryptionInfo.defaultPerSampleIvSize===0){const U=ce(e),$=new Uint8Array(16);$.set(de(e,U),0),I.encryptionInfo.defaultConstantIv=$}}break;case"avcC":{const I=this.currentTrack;if(!I)break;b(I.info),I.info.codecDescription=de(e,r.contentSize)}break;case"hvcC":{const I=this.currentTrack;if(!I)break;b(I.info),I.info.codecDescription=de(e,r.contentSize)}break;case"vpcC":{const I=this.currentTrack;if(!I)break;b(((a=I.info)==null?void 0:a.type)==="video"),e.skip(4);const H=ce(e),F=ce(e),U=ce(e),$=U>>4,z=U>>1&7,X=U&1,Y=ce(e),re=ce(e),se=ce(e);I.info.vp9CodecInfo={profile:H,level:F,bitDepth:$,chromaSubsampling:z,videoFullRangeFlag:X,colourPrimaries:Y,transferCharacteristics:re,matrixCoefficients:se}}break;case"av1C":{const I=this.currentTrack;if(!I)break;b(((o=I.info)==null?void 0:o.type)==="video"),e.skip(1);const H=ce(e),F=H>>5,U=H&31,$=ce(e),z=$>>7,X=$>>6&1,Y=$>>5&1,re=$>>4&1,se=$>>3&1,oe=$>>2&1,Ke=$&3,ue=F===2&&X?Y?12:10:X?10:8;I.info.av1CodecInfo={profile:F,level:U,tier:z,bitDepth:ue,monochrome:re,chromaSubsamplingX:se,chromaSubsamplingY:oe,chromaSamplePosition:Ke}}break;case"colr":{const I=this.currentTrack;if(!I||(b(((c=I.info)==null?void 0:c.type)==="video"),_t(e,4)!=="nclx"))break;const F=Mt(e),U=Mt(e),$=Mt(e),z=!!(ce(e)&128);I.info.colorSpace={primaries:ud[F],transfer:ld[U],matrix:dd[$],fullRange:z}}break;case"pasp":{const I=this.currentTrack;if(!I)break;b(((u=I.info)==null?void 0:u.type)==="video");const H=J(e),F=J(e);H>0&&F>0&&(H>F?I.info.squarePixelWidth=Math.round(I.info.width*H/F):I.info.squarePixelHeight=Math.round(I.info.height*F/H))}break;case"wave":this.readContiguousBoxes(e.slice(i,r.contentSize));break;case"esds":{const I=this.currentTrack;if(!I)break;b(((l=I.info)==null?void 0:l.type)==="audio"),e.skip(4);const H=ce(e);b(H===3),Ag(e),e.skip(2);const F=ce(e),U=(F&128)!==0,$=(F&64)!==0,z=(F&32)!==0;if(U&&e.skip(2),$){const oe=ce(e);e.skip(oe)}z&&e.skip(2);const X=ce(e);b(X===4);const Y=Ag(e),re=e.filePos,se=ce(e);if(se===64||se===103?(I.info.codec="aac",I.info.aacCodecInfo={isMpeg2:se===103,objectType:null}):se===105||se===107?I.info.codec="mp3":se===221?I.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${se}) - discarding track.`),e.skip(12),Y>e.filePos-re){const oe=ce(e);b(oe===5);const Ke=Ag(e);if(I.info.codecDescription=de(e,Ke),I.info.codec==="aac"){const ue=xc(I.info.codecDescription);ue.numberOfChannels!==null&&(I.info.numberOfChannels=ue.numberOfChannels),ue.sampleRate!==null&&(I.info.sampleRate=ue.sampleRate)}}}break;case"enda":{const I=this.currentTrack;if(!I)break;b(((d=I.info)==null?void 0:d.type)==="audio"),I.info.pcmLittleEndian=!!(Mt(e)&255)}break;case"pcmC":{const I=this.currentTrack;if(!I)break;b(((f=I.info)==null?void 0:f.type)==="audio"),e.skip(4);const H=ce(e);I.info.pcmLittleEndian=!!(H&1),I.info.pcmSampleSize=ce(e)}break;case"dOps":{const I=this.currentTrack;if(!I)break;b(((h=I.info)==null?void 0:h.type)==="audio"),e.skip(1);const H=ce(e),F=Mt(e),U=J(e),$=lA(e),z=ce(e);let X;z!==0?X=de(e,2+H):X=new Uint8Array(0);const Y=new Uint8Array(19+X.byteLength),re=new DataView(Y.buffer);re.setUint32(0,1332770163,!1),re.setUint32(4,1214603620,!1),re.setUint8(8,1),re.setUint8(9,H),re.setUint16(10,F,!0),re.setUint32(12,U,!0),re.setInt16(16,$,!0),re.setUint8(18,z),Y.set(X,19),I.info.codecDescription=Y,I.info.numberOfChannels=H}break;case"dfLa":{const I=this.currentTrack;if(!I)break;b(((m=I.info)==null?void 0:m.type)==="audio"),e.skip(4);const H=127,F=128,U=e.filePos;for(;e.filePos<s;){const re=ce(e),se=si(e);if((re&H)===$r.STREAMINFO){e.skip(10);const Ke=J(e),ue=Ke>>>12,Fe=(Ke>>9&7)+1;I.info.sampleRate=ue,I.info.numberOfChannels=Fe,e.skip(20)}else e.skip(se);if(re&F)break}const $=e.filePos;e.filePos=U;const z=de(e,$-U),X=new Uint8Array(4+z.byteLength);new DataView(X.buffer).setUint32(0,1716281667,!1),X.set(z,4),I.info.codecDescription=X}break;case"dac3":{const I=this.currentTrack;if(!I)break;b(((p=I.info)==null?void 0:p.type)==="audio");const H=de(e,3),F=new Me(H),U=F.readBits(2);F.skipBits(8);const $=F.readBits(3),z=F.readBits(1);U<3&&(I.info.sampleRate=Td[U]),I.info.numberOfChannels=mg[$]+z}break;case"dec3":{const I=this.currentTrack;if(!I)break;b(((g=I.info)==null?void 0:g.type)==="audio");const H=de(e,r.contentSize),F=_V(H);if(!F){console.warn("Invalid dec3 box contents, ignoring.");break}const U=qI(F);U!==null&&(I.info.sampleRate=U),I.info.numberOfChannels=YI(F)}break;case"stts":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4);const H=J(e);let F=0,U=0;for(let $=0;$<H;$++){const z=J(e),X=J(e);I.sampleTable.sampleTimingEntries.push({startIndex:F,startDecodeTimestamp:U,count:z,delta:X}),F+=z,U+=z*X}}break;case"ctts":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4);const H=J(e);let F=0;for(let U=0;U<H;U++){const $=J(e),z=Us(e);
600I.sampleTable.sampleCompositionTimeOffsets.push({startIndex:F,count:$,offset:z}),F+=$}}break;case"stsz":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4);const H=J(e),F=J(e);if(H===0)for(let U=0;U<F;U++){const $=J(e);I.sampleTable.sampleSizes.push($)}else I.sampleTable.sampleSizes.push(H)}break;case"stz2":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4),e.skip(3);const H=ce(e),F=J(e),U=de(e,Math.ceil(F*H/8)),$=new Me(U);for(let z=0;z<F;z++){const X=$.readBits(H);I.sampleTable.sampleSizes.push(X)}}break;case"stss":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4),I.sampleTable.keySampleIndices=[];const H=J(e);for(let F=0;F<H;F++){const U=J(e)-1;I.sampleTable.keySampleIndices.push(U)}I.sampleTable.keySampleIndices[0]!==0&&I.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4);const H=J(e);for(let U=0;U<H;U++){const $=J(e)-1,z=J(e),X=J(e);I.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:$,samplesPerChunk:z,sampleDescriptionIndex:X})}let F=0;for(let U=0;U<I.sampleTable.sampleToChunk.length;U++)if(I.sampleTable.sampleToChunk[U].startSampleIndex=F,U<I.sampleTable.sampleToChunk.length-1){const z=I.sampleTable.sampleToChunk[U+1].startChunkIndex-I.sampleTable.sampleToChunk[U].startChunkIndex;F+=z*I.sampleTable.sampleToChunk[U].samplesPerChunk}}break;case"stco":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4);const H=J(e);for(let F=0;F<H;F++){const U=J(e);I.sampleTable.chunkOffsets.push(U)}}break;case"co64":{const I=this.currentTrack;if(!I||!I.sampleTable)break;e.skip(4);const H=J(e);for(let F=0;F<H;F++){const U=qn(e);I.sampleTable.chunkOffsets.push(U)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(i,r.contentSize));break;case"mehd":{const I=ce(e);e.skip(3);const H=I===1?qn(e):J(e);this.movieDurationInTimescale=H}break;case"trex":{e.skip(4);const I=J(e),H=J(e),F=J(e),U=J(e),$=J(e);this.fragmentTrackDefaults.push({trackId:I,defaultSampleDescriptionIndex:H,defaultSampleDuration:F,defaultSampleSize:U,defaultSampleFlags:$})}break;case"tfra":{const I=ce(e);e.skip(3);const H=J(e),F=this.tracks.find(ue=>ue.id===H);if(!F)break;const U=J(e),$=(U&48)>>4,z=(U&12)>>2,X=U&3,Y=[ce,Mt,si,J],re=Y[$],se=Y[z],oe=Y[X],Ke=J(e);for(let ue=0;ue<Ke;ue++){const Fe=I===1?qn(e):J(e),Vt=I===1?qn(e):J(e);re(e),se(e),oe(e),F.fragmentLookupTable.push({timestamp:Fe,moofOffset:Vt})}F.fragmentLookupTable.sort((ue,Fe)=>ue.timestamp-Fe.timestamp);for(let ue=0;ue<F.fragmentLookupTable.length-1;ue++){const Fe=F.fragmentLookupTable[ue],Vt=F.fragmentLookupTable[ue+1];Fe.timestamp===Vt.timestamp&&(F.fragmentLookupTable.splice(ue+1,1),ue--)}}break;case"moof":this.currentFragment={moofOffset:n,moofSize:r.totalSize,implicitBaseDataOffset:n,trackData:new Map,psshBoxes:[]},this.readContiguousBoxes(e.slice(i,r.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(b(this.currentFragment),this.readContiguousBoxes(e.slice(i,r.contentSize)),this.currentTrack){const I=this.currentFragment.trackData.get(this.currentTrack.id);if(I){this.currentFragment.implicitBaseDataOffset=I.currentOffset,I.presentationTimestamps=I.samples.map(($,z)=>({presentationTimestamp:$.presentationTimestamp,sampleIndex:z})).sort(($,z)=>$.presentationTimestamp-z.presentationTimestamp);for(let $=0;$<I.presentationTimestamps.length;$++){const z=I.presentationTimestamps[$],X=I.samples[z.sampleIndex];if(I.firstKeyFrameTimestamp===null&&X.isKeyFrame&&(I.firstKeyFrameTimestamp=X.presentationTimestamp),$<I.presentationTimestamps.length-1){const re=I.presentationTimestamps[$+1].presentationTimestamp-z.presentationTimestamp;X.duration=re}}const H=I.samples[I.presentationTimestamps[0].sampleIndex],F=I.samples[yt(I.presentationTimestamps).sampleIndex];I.startTimestamp=H.presentationTimestamp,I.endTimestamp=F.presentationTimestamp+F.duration;const{currentFragmentState:U}=this.currentTrack;b(U),U.startTimestamp!==null&&(bg(I,U.startTimestamp),I.startTimestampIsFinal=!0),U.encryptionAuxInfo&&!I.samples[0].encryption&&(I.encryptionAuxInfo=U.encryptionAuxInfo)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"pssh":{if((A=this.input._formatOptions.isobmff)!=null&&A._suppressPsshParsing)break;const I=jI(de(e,r.contentSize));this.currentFragment?this.currentFragment.psshBoxes.push(I):this.currentTrack||this.pss
600hBoxes.push(I)}break;case"tfhd":{b(this.currentFragment),e.skip(1);const I=si(e),H=!!(I&1),F=!!(I&2),U=!!(I&8),$=!!(I&16),z=!!(I&32),X=!!(I&65536),Y=!!(I&131072),re=J(e),se=this.tracks.find(Ke=>Ke.id===re);if(!se)break;const oe=this.fragmentTrackDefaults.find(Ke=>Ke.trackId===re);this.currentTrack=se,se.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:(oe==null?void 0:oe.defaultSampleDescriptionIndex)??null,defaultSampleDuration:(oe==null?void 0:oe.defaultSampleDuration)??null,defaultSampleSize:(oe==null?void 0:oe.defaultSampleSize)??null,defaultSampleFlags:(oe==null?void 0:oe.defaultSampleFlags)??null,startTimestamp:null,encryptionAuxInfo:null},H?se.currentFragmentState.baseDataOffset=qn(e):Y&&(se.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),F&&(se.currentFragmentState.sampleDescriptionIndex=J(e)),U&&(se.currentFragmentState.defaultSampleDuration=J(e)),$&&(se.currentFragmentState.defaultSampleSize=J(e)),z&&(se.currentFragmentState.defaultSampleFlags=J(e)),X&&(se.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const I=this.currentTrack;if(!I)break;b(I.currentFragmentState);const H=ce(e);e.skip(3);const F=H===0?J(e):qn(e);I.currentFragmentState.startTimestamp=F}break;case"trun":{const I=this.currentTrack;if(!I)break;b(this.currentFragment),b(I.currentFragmentState);const H=ce(e),F=si(e),U=!!(F&1),$=!!(F&4),z=!!(F&256),X=!!(F&512),Y=!!(F&1024),re=!!(F&2048),se=J(e);let oe=null;U&&(oe=Us(e));let Ke=null;$&&(Ke=J(e));let ue;if(this.currentFragment.trackData.has(I.id)?(ue=this.currentFragment.trackData.get(I.id),oe!==null&&(ue.currentOffset=I.currentFragmentState.baseDataOffset+oe)):(ue={track:I,currentTimestamp:0,currentOffset:I.currentFragmentState.baseDataOffset+(oe??0),startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1,encryptionAuxInfo:null},this.currentFragment.trackData.set(I.id,ue)),se===0){this.currentFragment.implicitBaseDataOffset=ue.currentOffset;break}for(let Fe=0;Fe<se;Fe++){let Vt;z?Vt=J(e):(b(I.currentFragmentState.defaultSampleDuration!==null),Vt=I.currentFragmentState.defaultSampleDuration);let Dt;X?Dt=J(e):(b(I.currentFragmentState.defaultSampleSize!==null),Dt=I.currentFragmentState.defaultSampleSize);let mn;Y?mn=J(e):(b(I.currentFragmentState.defaultSampleFlags!==null),mn=I.currentFragmentState.defaultSampleFlags),Fe===0&&Ke!==null&&(mn=Ke);let Jc=0;re&&(H===0?Jc=J(e):Jc=Us(e));const HA=!(mn&65536);ue.samples.push({presentationTimestamp:ue.currentTimestamp+Jc,duration:Vt,byteOffset:ue.currentOffset,byteSize:Dt,isKeyFrame:HA,encryption:null}),ue.currentOffset+=Dt,ue.currentTimestamp+=Vt}}break;case"saiz":{const I=this.currentTrack;if(!I||!I.encryptionInfo)break;if(e.skip(1),si(e)&1){const X=_t(e,4),Y=J(e);if(X!==I.encryptionInfo.scheme||Y!==0)break}const F=ce(e),U=J(e);let $=null;F===0&&U>0&&($=de(e,U));const z=iC(I);z.defaultSampleInfoSize=F,z.sampleSizes=$,z.sampleCount=U}break;case"saio":{const I=this.currentTrack;if(!I||!I.encryptionInfo)break;const H=ce(e);if(si(e)&1){const X=_t(e,4),Y=J(e);if(X!==I.encryptionInfo.scheme||Y!==0)break}const U=J(e);if(U===0)break;U>1&&console.warn("Multiple saio entries are not supported; using the first offset only.");let $=H===0?J(e):Number(qn(e));this.currentFragment&&($+=this.currentFragment.moofOffset);const z=iC(I);z.offset=$}break;case"senc":{const I=this.currentTrack;if(!I||!I.encryptionInfo)break;b(this.currentFragment);const H=this.currentFragment.trackData.get(I.id);if(!H)break;e.skip(1);const U=!!(si(e)&2),$=J(e),z=I.encryptionInfo.defaultPerSampleIvSize;b(z!==null);for(let X=0;X<Math.min($,H.samples.length);X++){const Y=new Uint8Array(16);z>0?Y.set(de(e,z),0):Y.set(I.encryptionInfo.defaultConstantIv,0);let re=null;if(U){const oe=Mt(e);re=[];for(let Ke=0;Ke<oe;Ke++){const ue=Mt(e),Fe=J(e);re.push({clearLen:ue,protectedLen:Fe})}}const se=H.samples[X];se.encryption={iv:Y,subsamples:re}}}break;case"udta":{const I=this.iterateContiguousBoxes(e.slice(i,r.contentSize));for(const{boxInfo:H,slice:F}of I){if(H.name!=="meta"&&!this.currentTrack){const U=F.filePos;(y=this.metadataTags).raw??(y.raw={}),H.name[0]==="©"?(w=this.metadataTags.raw)[E=H.name]??(w[E]=br(F)):(S=this.metadataTags.raw)[k=H.name]??(S[k]=de(F,H.contentSize)),F.filePos=U}switch(H.name){case"meta":F.skip(-H.headerSize),this.traverseBox(F);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=xn.decode(de(F,H.contentSize)):(T=this.metadataTags).title??(T.title=br(F));break;case"©des":this.currentTrack||((C=this.metadataTags).description??(C.description=br(F)));break;case"©ART":this.currentTrack||((_=this.metadataTags).artist??(_.artist=br(F)));break;case"©alb":this.currentTrack||((x=this.metadataTags).album??(x.album=br(F)));break;case"albr":this.currentTrack||((P=this.metadataTags).albumArtist??(P.albumArtist=br(F)));break;case"©gen":this.currentTrack||((v=this.metadataTags).genre??(v.genre=br(F)));break;case"©day":if(!this.currentTrack){const U=new Date(br(F));Number.isNaN(U.getTime())||((M=this.metadataTags).date??(M.date=U))}break;case"©cmt":this.currentTrack||((D=this.metadataTags).comment??(D.comment=br(F)));break;case"©lyr":this.currentTrack||((O=this.metadataTags).lyrics??(O.lyrics=br(F)));break}}}break;case"meta":{if(this.currentTrack)break;const H=J(e)!==0;this.currentMetadataKeys=new Map,H?this.readContiguousBoxes(e.slice(i,r.contentSize)):this.readContiguousBoxes(e.slice(i+4,r.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;e.skip(4);const I=J(e);for(let H=0;H<I;H++){const F=J(e);e.skip(4);const U=xn.decode(de(e,F-8));this.currentMetadataKeys.set(H+1,U)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const I=this.iterateContiguousBoxes(e.slice(i,r.contentSize));for(const{boxInfo:H,slice:F}of I){let U=H.name;const $=(U.charCodeAt(0)<<24)+(U.charCodeAt(1)<<16)+(U.charCodeAt(2)<<8)+U.charCodeAt(3);this.currentMetadataKeys.has($)&&(U=this.currentMetadataKeys.get($));const z=TV(F);switch((N=this.metadataTags).raw??(N.raw={}),(Q=this.metadataTags.raw)[U]??(Q[U]=z),U){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":typeof z=="string"&&((G=this.metadataTags).title??(G.title=z));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":typeof z=="string"&&((V=this.metadataTags).description??(V.description=z));break;case"©ART":case"com.apple.quicktime.artist":case"artist":typeof z=="string"&&((Z=this.metadataTags).artist??(Z.artist=z));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":typeof z=="string"&&((B=this.metadataTags).album??(B.album=z));break;case"aART":case"album_artist":typeof z=="string"&&((L=this.metadataTags).albumArtist??(L.albumArtist=z));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":typeof z=="string"&&((K=this.metadataTags).comment??(K.comment=z));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":typeof z=="string"&&((q=this.metadataTags).genre??(q.genre=z));break;case"©lyr":case"lyrics":typeof z=="string"&&((ne=this.metadataTags).lyrics??(ne.lyrics=z));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if(typeof z=="string"){const X=new Date(z);Number.isNaN(X.getTime())||((fe=this.metadataTags).date??(fe.date=X))}break;case"covr":case"com.apple.quicktime.artwork":z instanceof Is?((Ae=this.metadataTags).images??(Ae.images=[]),this.metadataTags.images.push({data:z.data,kind:"coverFront",mimeType:z.mimeType})):z instanceof Uint8Array&&((ie=this.metadataTags).images??(ie.images=[]),this.metadataTags.images.push({data:z,kind:"coverFront",mimeType:"image/*"}));break;case"track":if(typeof z=="string"){const X=z.split("/"),Y=Number.parseInt(X[0],10),re=X[1]&&Number.parseInt(X[1],10);Number.isInteger(Y)&&Y>0&&((ye=this.metadataTags).trackNumber??(ye.trackNumber=Y)),re&&Number.isInteger(re)&&re>0&&(($e=this.metadataTags).tracksTotal??($e.tracksTotal=re))}break;case"trkn":if(z instanceof Uint8Array&&z.length>=6){const X=_e(z),Y=X.getUint16(2,!1),re=X.getUint16(4,!1);Y>0&&((ge=this.metadataTags).trackNumber??(ge.trackNumber=Y)),re>0&&((xe=this.metadataTags).tracksTotal??(xe.tracksTotal=re))}break;case"disc":case"disk":if(z instanceof Uint8Array&&z.length>=6){const X=_e(z),Y=X.getUint16(2,!1),re=X.getUint16(4,!1);Y>0&&((We=this.metadataTags).discNumber??(We.discNumber=Y)),re>0&&((be=this.metadataTags).discsTotal??(be.discsTotal=re))}break}}}break}return e.filePos=s,!0}}class eC{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const e=this.internalTrack.demuxer,n=this.internalTrack.trackBacking.getType();let r=0;for(const i of e.tracks)if(i.trackBacking.getType()===n&&r++,i===this.internalTrack)break;return r}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}isRelativeToUnixEpoch(){return!1}getDisposition(){return this.internalTrack.disposition}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){const e=this.internalTrack;if(e.durationInMediaTimescale<=0)return null;b(e.trackBacking);const n=await e.trackBacking.getFirstPacket({metadataOnly:!0});return((n==null?void 0:n.timestamp)??0)+e.durationInMediaTimescale/e.timescale}
600async getLiveRefreshInterval(){return null}async getFirstPacket(e){const n=await this.fetchPacketForSampleIndex(0,e);return n||!this.internalTrack.demuxer.isFragmented?n:this.performFragmentedLookup(null,r=>r.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1},-1/0,1/0,e)}mapTimestampIntoTimescale(e){return wc(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,n){const r=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),s=wg(i,r),a=await this.fetchPacketForSampleIndex(s,n);return!rC(i)||!this.internalTrack.demuxer.isFragmented?a:this.performFragmentedLookup(null,o=>{const c=o.trackData.get(this.internalTrack.id);if(!c)return{sampleIndex:-1,correctSampleFound:!1};const u=Ge(c.presentationTimestamps,r,f=>f.presentationTimestamp),l=u!==-1?c.presentationTimestamps[u].sampleIndex:-1,d=u!==-1&&r<c.endTimestamp;return{sampleIndex:l,correctSampleFound:d}},r,r,n)}async getNextPacket(e,n){const r=this.packetToSampleIndex.get(e);if(r!==void 0)return this.fetchPacketForSampleIndex(r+1,n);const i=this.packetToFragmentLocation.get(e);if(i===void 0)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,s=>{if(s===i.fragment){const a=s.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<a.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(s.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,n)}async getKeyPacket(e,n){const r=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),s=CV(i,r),a=await this.fetchPacketForSampleIndex(s,n);return!rC(i)||!this.internalTrack.demuxer.isFragmented?a:this.performFragmentedLookup(null,o=>{const c=o.trackData.get(this.internalTrack.id);if(!c)return{sampleIndex:-1,correctSampleFound:!1};const u=fd(c.presentationTimestamps,f=>c.samples[f.sampleIndex].isKeyFrame&&f.presentationTimestamp<=r),l=u!==-1?c.presentationTimestamps[u].sampleIndex:-1,d=u!==-1&&r<c.endTimestamp;return{sampleIndex:l,correctSampleFound:d}},r,r,n)}async getNextKeyPacket(e,n){const r=this.packetToSampleIndex.get(e);if(r!==void 0){const s=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a=vV(s,r);return this.fetchPacketForSampleIndex(a,n)}const i=this.packetToFragmentLocation.get(e);if(i===void 0)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,s=>{if(s===i.fragment){const o=s.trackData.get(this.internalTrack.id).samples.findIndex((c,u)=>c.isKeyFrame&&u>i.sampleIndex);if(o!==-1)return{sampleIndex:o,correctSampleFound:!0}}else{const a=s.trackData.get(this.internalTrack.id);if(a&&a.firstKeyFrameTimestamp!==null){const o=a.samples.findIndex(c=>c.isKeyFrame);return b(o!==-1),{sampleIndex:o,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,n)}async fetchPacketForSampleIndex(e,n){if(e===-1)return null;const r=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=xV(r,e);if(!i)return null;let s;if(n.metadataOnly)s=vn;else{let u=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);if(u instanceof Promise&&(u=await u),!u)return null;if(s=de(u,i.sampleSize),this.internalTrack.encryptionAuxInfo){b(this.internalTrack.encryptionInfo);const l=await sC(this.internalTrack.demuxer.reader,this.internalTrack.encryptionInfo,this.internalTrack.encryptionAuxInfo);e<l.length&&(s=await aC(this.internalTrack,l[e],s,null))}}const a=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,o=i.duration/this.internalTrack.timescale,c=new nt(s,i.isKeyFrame?"key":"delta",a,o,e,i.sampleSize);return this.packetToSampleIndex.set(c,e),c}async fetchPacketInFragment(e,n,r){if(n===-1)return null;const s=e.trackData.get(this.internalTrack.id).samples[n];b(s);let a;if(r.metadataOnly)a=vn;else{let l=this.internalTrack.demuxer.reader.requestSlice(s.byteOffset,s.byteSize);if(l instanceof Promise&&(l=await l),!l)return null;a=de(l,s.byteSize),s.encryption&&(a=await aC(this.internalTrack,s.encryption,a,e))}const o=(s.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,c=s.duration/this.internalTrack.timescale,u=new nt(a,s.isKeyFrame?"key":"delta",o,c,e.moofOffset+n,s.byteSize);return this.packetToFragmentLocation.set(u,{fragment:e,sampleIndex:n}),u}async performFragmentedLookup(e,n,r,i,s){const a=this.internalTrack.demuxer;let o=null,c=null,u=-1;if(e){const{sampleIndex:g,correctSampleFound:A}=n(e);if(A)return this.fetchPacketInFragment(e,g,s);g!==-1&&(c=e,u=g)}const l=Ge(this.internalTrack.fragmentLookupTable,r,g=>g.timestamp),d=l!==-1?this.internalTrack.fragmentLookupTable[l]:null,f=Ge(this.internalTrack.fragmentPositionCache,r,g=>g.startTimestamp),h=f!==-1?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max((d==null?void 0:d.moofOff
600set)??0,(h==null?void 0:h.moofOffset)??0)||null;let p;for(e?m===null||e.moofOffset>=m?(p=e.moofOffset+e.moofSize,o=e):p=m:p=m??0;;){if(o){const w=o.trackData.get(this.internalTrack.id);if(w&&w.startTimestamp>i)break}let g=a.reader.requestSliceRange(p,Jr,vs);if(g instanceof Promise&&(g=await g),!g)break;const A=p,y=Qi(g);if(!y)break;if(y.name==="moof"){o=await a.readFragment(A);const{sampleIndex:w,correctSampleFound:E}=n(o);if(E)return this.fetchPacketInFragment(o,w,s);w!==-1&&(c=o,u=w)}p=A+y.totalSize}if(d&&(!c||c.moofOffset<d.moofOffset)){const g=this.internalTrack.fragmentLookupTable[l-1];b(!g||g.timestamp<d.timestamp);const A=(g==null?void 0:g.timestamp)??-1/0;return this.performFragmentedLookup(null,n,A,i,s)}return c?this.fetchPacketInFragment(c,u,s):null}}class tC extends eC{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getType(){return"video"}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.rotation}async getColorSpace(){var e,n,r,i;return{primaries:(e=this.internalTrack.info.colorSpace)==null?void 0:e.primaries,transfer:(n=this.internalTrack.info.colorSpace)==null?void 0:n.transfer,matrix:(r=this.internalTrack.info.colorSpace)==null?void 0:r.matrix,fullRange:(i=this.internalTrack.info.colorSpace)==null?void 0:i.fullRange}}
600async canBeTransparent(){return!1}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfigPromise??(this.decoderConfigPromise=(async()=>{if(this.internalTrack.info.codec==="vp9"&&!this.internalTrack.info.vp9CodecInfo){const n=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=n&&LI(n.data)}else if(this.internalTrack.info.codec==="av1"&&!this.internalTrack.info.av1CodecInfo){const n=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=n&&QI(n.data)}const e={codec:tg(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:this.internalTrack.info.codecDescription??void 0,colorSpace:this.internalTrack.info.colorSpace??void 0};return(this.internalTrack.info.width!==this.internalTrack.info.squarePixelWidth||this.internalTrack.info.height!==this.internalTrack.info.squarePixelHeight)&&(e.displayAspectWidth=this.internalTrack.info.squarePixelWidth,e.displayAspectHeight=this.internalTrack.info.squarePixelHeight),e})()):null}}class nC extends eC{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getType(){return"audio"}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfig??(this.decoderConfig={codec:ng(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}):null}}const wg=(t,e)=>{if(t.presentationTimestamps){const n=Ge(t.presentationTimestamps,e,r=>r.presentationTimestamp);return n===-1?-1:t.presentationTimestamps[n].sampleIndex}else{const n=Ge(t.sampleTimingEntries,e,i=>i.startDecodeTimestamp);if(n===-1)return-1;const r=t.sampleTimingEntries[n];return r.startIndex+Math.min(Math.floor((e-r.startDecodeTimestamp)/r.delta),r.count-1)}},CV=(t,e)=>{if(!t.keySampleIndices)return wg(t,e);if(t.presentationTimestamps){const n=Ge(t.presentationTimestamps,e,r=>r.presentationTimestamp);if(n===-1)return-1;for(let r=n;r>=0;r--){const i=t.presentationTimestamps[r].sampleIndex;if(yc(t.keySampleIndices,i,a=>a)!==-1)return i}return-1}else{const n=wg(t,e),r=Ge(t.keySampleIndices,n,i=>i);return t.keySampleIndices[r]??-1}},xV=(t,e)=>{const n=Ge(t.sampleTimingEntries,e,A=>A.startIndex),r=t.sampleTimingEntries[n];if(!r||r.startIndex+r.count<=e)return null;let s=r.startDecodeTimestamp+(e-r.startIndex)*r.delta;const a=Ge(t.sampleCompositionTimeOffsets,e,A=>A.startIndex),o=t.sampleCompositionTimeOffsets[a];o&&e-o.startIndex<o.count&&(s+=o.offset);const c=t.sampleSizes[Math.min(e,t.sampleSizes.length-1)],u=Ge(t.sampleToChunk,e,A=>A.startSampleIndex),l=t.sampleToChunk[u];b(l);const d=l.startChunkIndex+Math.floor((e-l.startSampleIndex)/l.samplesPerChunk),f=t.chunkOffsets[d],h=l.startSampleIndex+(d-l.startChunkIndex)*l.samplesPerChunk;let m=0,p=f;if(t.sampleSizes.length===1)p+=c*(e-h),m+=c*l.samplesPerChunk;else for(let A=h;A<h+l.samplesPerChunk;A++){const y=t.sampleSizes[A];A<e&&(p+=y),m+=y}let g=r.delta;if(t.presentationTimestamps){const A=t.presentationTimestampIndexMap[e];b(A!==void 0),A<t.presentationTimestamps.length-1&&(g=t.presentationTimestamps[A+1].presentationTimestamp-s)}return{presentationTimestamp:s,duration:g,sampleOffset:p,sampleSize:c,chunkOffset:f,chunkSize:m,isKeyFrame:t.keySampleIndices?yc(t.keySampleIndices,e,A=>A)!==-1:!0}},vV=(t,e)=>{if(!t.keySampleIndices)return e+1;const n=Ge(t.keySampleIndices,e,r=>r);return t.keySampleIndices[n+1]??-1},bg=(t,e)=>{t.startTimestamp+=e,t.endTimestamp+=e;for(const n of t.samples)n.presentationTimestamp+=e;for(const n of t.presentationTimestamps)n.presentationTimestamp+=e},BV=t=>{const[e,n]=t,r=Math.atan2(n,e);return Number.isFinite(r)?r*(180/Math.PI):0},rC=t=>t.sampleSizes.length===0,iC=t=>{var e;return t.currentFragmentState?(e=t.currentFragmentState).encryptionAuxInfo??(e.encryptionAuxInfo={defaultSampleInfoSize:0,sampleSizes:null,sampleC
600ount:0,offset:null,resolved:null}):t.encryptionAuxInfo??(t.encryptionAuxInfo={defaultSampleInfoSize:0,sampleSizes:null,sampleCount:0,offset:null,resolved:null})},sC=async(t,e,n)=>{if(n.resolved)return n.resolved;if(n.offset===null||n.sampleCount===0)throw new Error("Incomplete saiz/saio info; cannot resolve encryption data.");let r=0;if(n.defaultSampleInfoSize>0)r=n.defaultSampleInfoSize*n.sampleCount;else{b(n.sampleSizes);for(let o=0;o<n.sampleCount;o++)r+=n.sampleSizes[o]}let i=t.requestSlice(n.offset,r);if(i instanceof Promise&&(i=await i),!i)throw new Error("Failed to read auxiliary encryption info.");const s=e.defaultPerSampleIvSize;b(s!==null);const a=[];for(let o=0;o<n.sampleCount;o++){const c=n.defaultSampleInfoSize>0?n.defaultSampleInfoSize:n.sampleSizes[o],u=new Uint8Array(16);s>0?u.set(de(i,s),0):u.set(e.defaultConstantIv,0);let l=null;if(c>s){const d=Mt(i);l=[];for(let f=0;f<d;f++){const h=Mt(i),m=J(i);l.push({clearLen:h,protectedLen:m})}}a.push({iv:u,subsamples:l})}return n.resolved=a,a},aC=async(t,e,n,r)=>{var c;b(t.encryptionInfo);const i=t.encryptionInfo;b(i.defaultKid!==null);const s=i.defaultKid;let a;const o=t.demuxer.decryptionKeyCache.get(s);if(o)a=await o;else{if(!((c=t.demuxer.input._formatOptions.isobmff)!=null&&c.resolveKeyId))throw new Error("Encrypted media samples encountered. To decrypt them, please provide a callback for InputOptions.formatOptions.isobmff.resolveKeyId.");const u=(async()=>{let l=t.demuxer.psshBoxes;if(r){l=[...l,...r.psshBoxes].filter(f=>f.keyIds===null||f.keyIds.includes(s));for(let f=0;f<l.length-1;f++)for(let h=f+1;h<l.length;h++)$I(l[f],l[h])&&(l.splice(h,1),h--)}const d=await t.demuxer.input._formatOptions.isobmff.resolveKeyId({keyId:s,psshBoxes:l});if(!(typeof d=="string"&&d.length===32&&kW.test(d)||d instanceof Uint8Array&&d.byteLength===16))throw new TypeError("resolveKeyId must return a 32-character hex string or a 16-byte Uint8Array containing the decryption key.");return d instanceof Uint8Array?d:IW(d)})();t.demuxer.decryptionKeyCache.set(s,u),a=await u}return i.scheme==="cenc"||i.scheme==="cens"?PV(a,i,e,n):RV(a,i,e,n)},PV=async(t,e,n,r)=>{const i=new Uint8Array(16);i.set(n.iv,0);const s=await crypto.subtle.importKey("raw",t,{name:"AES-CTR"},!1,["decrypt"]),a=async m=>{const p=await crypto.subtle.decrypt({name:"AES-CTR",counter:i,length:64},s,m);return new Uint8Array(p)};if(!n.subsamples)return a(r);b(e.defaultCryptByteBlock!==null&&e.defaultSkipByteBlock!==null);const o=oC(n.subsamples,e.defaultCryptByteBlock,e.defaultSkipByteBlock);let c=0;for(const m of o)for(const p of m.perSubsample)c+=p.length;const u=new Uint8Array(c);let l=0;for(const m of o)for(const p of m.perSubsample)u.set(r.subarray(p.offset,p.offset+p.length),l),l+=p.length;const d=await a(u),f=new Uint8Array(r);let h=0;for(const m of o)for(const p of m.perSubsample)f.set(d.subarray(h,h+p.length),p.offset),h+=p.length;return f},RV=(t,e,n,r)=>{const i=new ZI;i.init({key:t,iv:n.iv});const s=e.defaultCryptByteBlock,a=e.defaultSkipByteBlock;if(b(s!==null&&a!==null),!n.subsamples){const l=new Uint8Array(r),d=Math.floor(r.length/16);for(let f=0;f<d;f++){const h=f*16;i.in.set(r.subarray(h,h+16)),i.decrypt(),l.set(i.out,h)}return l}if(s===0&&a===0)throw new Error("cbcs with subsamples requires pattern encryption.");const o=new Uint8Array(r),c=oC(n.subsamples,s,a),u=new DataView(n.iv.buffer,n.iv.byteOffset,16);for(const l of c){i.iv[0]=u.getUint32(0,!1),i.iv[1]=u.getUint32(4,!1),i.iv[2]=u.getUint32(8,!1),i.iv[3]=u.getUint32(12,!1);for(const d of l.perSubsample){const f=d.length/16;for(let h=0;h<f;h++){const m=d.offset+h*16;i.in.set(r.subarray(m,m+16)),i.decrypt(),o.set(i.out,m)}}}return o},oC=(t,e,n)=>{const r=[],i=e!==0||n!==0;let s=0;for(const a of t){s+=a.clearLen;const o=[];if(!i)a.protectedLen>0&&o.push({offset:s,length:a.protectedLen}),s+=a.protectedLen;else{let c=a.protectedLen,u=s;for(;c>0&&!(c<16*e);){const l=16*e;o.push({offset:u,length:l}),u+=l,c-=l;const d=Math.min(16*n,c);u+=d,c-=d}s+=a.protectedLen}r.push({perSubsample:o})}return r};/*!
601 * Copyright (c) 2026-present, Vanilagy and contributors
602 *
603 * This Source Code Form is subject to the terms of the Mozilla Public
604 * License, v. 2.0. If a copy of the MPL was not distributed with this
605 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
606 */class Eg{constructor(e){this.value=e}}class Sg{constructor(e){this.value=e}}class cC{constructor(e){this.value=e}}class Hi{constructor(e){this.value=e}}var R;(function(t){t[t.EBML=440786851]="EBML",t[t.EBMLVersion=17030]="EBMLVersion",t[t.EBMLReadVersion=17143]="EBMLReadVersion",t[t.EBMLMaxIDLength=17138]="EBMLMaxIDLength",t[t.EBMLMaxSizeLength=17139]="EBMLMaxSizeLength",t[t.DocType=17026]="DocType",t[t.DocTypeVersion=17031]="DocTypeVersion",t[t.DocTypeReadVersion=17029]="DocTypeReadVersion",t[t.Void=236]="Void",t[t.Segment=408125543]="Segment",t[t.SeekHead=290298740]="SeekHead",t[t.Seek=19899]="Seek",t[t.SeekID=21419]="SeekID",t[t.SeekPosition=21420]="SeekPosition",t[t.Duration=17545]="Duration",t[t.Info=357149030]="Info",t[t.TimestampScale=2807729]="TimestampScale",t[t.MuxingApp=19840]="MuxingApp",t[t.WritingApp=22337]="WritingApp",t[t.Tracks=374648427]="Tracks",t[t.TrackEntry=174]="TrackEntry",t[t.TrackNumber=215]="TrackNumber",t[t.TrackUID=29637]="TrackUID",t[t.TrackType=131]="TrackType",t[t.FlagEnabled=185]="FlagEnabled",t[t.FlagDefault=136]="FlagDefault",t[t.FlagForced=21930]="FlagForced",t[t.FlagOriginal=2
vendor: 6,495 bytes, line 606
6061934]="FlagOriginal",t[t.FlagHearingImpaired=21931]="FlagHearingImpaired",t[t.FlagVisualImpaired=21932]="FlagVisualImpaired",t[t.FlagCommentary=21935]="FlagCommentary",t[t.FlagLacing=156]="FlagLacing",t[t.Name=21358]="Name",t[t.Language=2274716]="Language",t[t.LanguageBCP47=2274717]="LanguageBCP47",t[t.CodecID=134]="CodecID",t[t.CodecPrivate=25506]="CodecPrivate",t[t.CodecDelay=22186]="CodecDelay",t[t.SeekPreRoll=22203]="SeekPreRoll",t[t.DefaultDuration=2352003]="DefaultDuration",t[t.Video=224]="Video",t[t.PixelWidth=176]="PixelWidth",t[t.PixelHeight=186]="PixelHeight",t[t.DisplayWidth=21680]="DisplayWidth",t[t.DisplayHeight=21690]="DisplayHeight",t[t.DisplayUnit=21682]="DisplayUnit",t[t.AlphaMode=21440]="AlphaMode",t[t.Audio=225]="Audio",t[t.SamplingFrequency=181]="SamplingFrequency",t[t.Channels=159]="Channels",t[t.BitDepth=25188]="BitDepth",t[t.SimpleBlock=163]="SimpleBlock",t[t.BlockGroup=160]="BlockGroup",t[t.Block=161]="Block",t[t.BlockAdditions=30113]="BlockAdditions",t[t.BlockMore=166]="BlockMore",t[t.BlockAdditional=165]="BlockAdditional",t[t.BlockAddID=238]="BlockAddID",t[t.BlockDuration=155]="BlockDuration",t[t.ReferenceBlock=251]="ReferenceBlock",t[t.Cluster=524531317]="Cluster",t[t.Timestamp=231]="Timestamp",t[t.Cues=475249515]="Cues",t[t.CuePoint=187]="CuePoint",t[t.CueTime=179]="CueTime",t[t.CueTrackPositions=183]="CueTrackPositions",t[t.CueTrack=247]="CueTrack",t[t.CueClusterPosition=241]="CueClusterPosition",t[t.Colour=21936]="Colour",t[t.MatrixCoefficients=21937]="MatrixCoefficients",t[t.TransferCharacteristics=21946]="TransferCharacteristics",t[t.Primaries=21947]="Primaries",t[t.Range=21945]="Range",t[t.Projection=30320]="Projection",t[t.ProjectionType=30321]="ProjectionType",t[t.ProjectionPoseRoll=30325]="ProjectionPoseRoll",t[t.Attachments=423732329]="Attachments",t[t.AttachedFile=24999]="AttachedFile",t[t.FileDescription=18046]="FileDescription",t[t.FileName=18030]="FileName",t[t.FileMediaType=18016]="FileMediaType",t[t.FileData=18012]="FileData",t[t.FileUID=18094]="FileUID",t[t.Chapters=272869232]="Chapters",t[t.Tags=307544935]="Tags",t[t.Tag=29555]="Tag",t[t.Targets=25536]="Targets",t[t.TargetTypeValue=26826]="TargetTypeValue",t[t.TargetType=25546]="TargetType",t[t.TagTrackUID=25541]="TagTrackUID",t[t.TagEditionUID=25545]="TagEditionUID",t[t.TagChapterUID=25540]="TagChapterUID",t[t.TagAttachmentUID=25542]="TagAttachmentUID",t[t.SimpleTag=26568]="SimpleTag",t[t.TagName=17827]="TagName",t[t.TagLanguage=17530]="TagLanguage",t[t.TagString=17543]="TagString",t[t.TagBinary=17541]="TagBinary",t[t.ContentEncodings=28032]="ContentEncodings",t[t.ContentEncoding=25152]="ContentEncoding",t[t.ContentEncodingOrder=20529]="ContentEncodingOrder",t[t.ContentEncodingScope=20530]="ContentEncodingScope",t[t.ContentCompression=20532]="ContentCompression",t[t.ContentCompAlgo=16980]="ContentCompAlgo",t[t.ContentCompSettings=16981]="ContentCompSettings",t[t.ContentEncryption=20533]="ContentEncryption"})(R||(R={}));const FV=[R.EBML,R.Segment],Bc=[R.SeekHead,R.Info,R.Cluster,R.Tracks,R.Cues,R.Attachments,R.Chapters,R.Tags],Rd=[...FV,...Bc],uC=t=>t<256?1:t<65536?2:t<1<<24?3:t<2**32?4:t<2**40?5:6,lC=t=>t<1n<<8n?1:t<1n<<16n?2:t<1n<<24n?3:t<1n<<32n?4:t<1n<<40n?5:t<1n<<48n?6:t<1n<<56n?7:8,dC=t=>t>=-64&&t<64?1:t>=-8192&&t<8192?2:t>=-1048576&&t<1<<20?3:t>=-134217728&&t<1<<27?4:t>=-17179869184&&t<2**34?5:6,MV=t=>{if(t<127)return 1;if(t<16383)return 2;if(t<(1<<21)-1)return 3;if(t<(1<<28)-1)return 4;if(t<2**35-1)return 5;if(t<2**42-1)return 6;throw new Error("EBML varint size not supported "+t)};class DV{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap,this.dataOffsets=new WeakMap}writeByte(e){this.helperView.setUint8(0,e),this.writer.write(this.helper.subarray(0,1))}writeFloat32(e){this.helperView.setFloat32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeFloat64(e){this.helperView.setFloat64(0,e,!1),this.writer.write(this.helper)}writeUnsignedInt(e,n=uC(e)){let r=0;switch(n){case 6:this.helperView.setUint8(r++,e/2**40|0);case 5:this.helperView.setUint8(r++,e/2**32|0);case 4:this.helperView.setUint8(r++,e>>24);case 3:this.helperView.setUint8(r++,e>>16);case 2:this.helperView.setUint8(r++,e>>8);case 1:this.helperView.setUint8(r++,e);break;default:throw new Error("Bad unsigned int size "+n)}this.writer.write(this.helper.subarray(0,r))}writeUnsignedBigInt(e,n=lC(e)){let r=0;for(let i=n-1;i>=0;i--)this.helperView.setUint8(r++,Number(e>>BigInt(i*8)&0xffn));this.writer.write(this.helper.subarray(0,r))}writeSignedInt(e,n=dC(e)){e<0&&(e+=2**(n*8)),this.writeUnsignedInt(e,n)}writeVarInt(e,n=MV(e)){let r=0;switch(n){case 1:this.helperView.setUint8(r++,128|e);break;case 2:this.helperView.setUint8(r++,64|e>>8),this.helperView.setUint8(r++,e);break;case 3:this.helperView.setUint8(r++,32|e>>16),this.helperView.setUint8(r++,e>>8),this.helperView.setUint8(r++,e);break;case 4:this.helperView.setUint8(r++,16|e>>24),this.helperView.setUint8(r++,e>>16),this.helperView.setUint8(r++,e>>8),this.helperView.setUint8(r++,e);break;case 5:this.helperView.setUint8(r++,8|e/2**32&7),this.helperView.setUint8(r++,e>>24),this.helperView.setUint8(r++,e>>16),this.helperView.setUint8(r++,e>>8),this.helperView.setUint8(r++,e);break;case 6:this.helperView.setUint8(r++,4|e/2**40&3),this.helperView.setUint8(r++,e/2**32|0),this.helperView.setUint8(r++,e>>24),this.helperView.setUint8(r++,e>>16),this.helperView.setUint8(r++,e>>8),this.helperView.setUint8(r++,e);break;default:throw new Error("Bad EBML varint size "+n)}this.writer.write(this.helper.subarray(0,r))}writeAsciiString(e){this.writer.write(new Uint8Array(e.split("").map(n=>n.charCodeAt(0))))}writeEBML(e){if(e!==null)if(e instanceof Uint8Array)this.writer.write(e);else if(Array.isArray(e))for(const n of e)this.writeEBML(n);else if(this.offsets.set(e,this.writer.getPos()),this.writeUnsignedInt(e.id),Array.isArray(e.data)){const n=this.writer.getPos(),r=e.size===-1?1:e.size??4;e.size===-1?this.writeByte(255):this.writer.seek(this.writer.getPos()+r);const i=this.writer.getPos();if(this.dataOffsets.set(e,i),this.writeEBML(e.data),e.size!==-1){const s=this.writer.getPos()-i,a=this.writer.getPos();this.writer.seek(n),this.writeVarInt(s,r),this.writer.seek(a)}}else if(typeof e.data=="number"){const n=e.size??uC(e.data);this.writeVarInt(n),this.writeUnsignedInt(e.data,n)}else if(typeof e.data=="bigint"){const n=e.size??lC(e.data);this.writeVarInt(n),this.writeUnsignedBigInt(e.data,n)}
606else if(typeof e.data=="string")this.writeVarInt(e.data.length),this.writeAsciiString(e.data);else if(e.data instanceof Uint8Array)this.writeVarInt(e.data.byteLength,e.size),this.writer.write(e.data);else if(e.data instanceof Eg)this.writeVarInt(4),this.writeFloat32(e.data.value);else if(e.data instanceof Sg)this.writeVarInt(8),this.writeFloat64(e.data.value);else if(e.data instanceof cC){const n=e.size??dC(e.data.value);this.writeVarInt(n),this.writeSignedInt(e.data.value,n)}else if(e.data instanceof Hi){const n=tt.encode(e.data.value);this.writeVarInt(n.length),this.writer.write(n)}else rn(e.data)}}const _g=8,Gn=2,ei=2*_g,fC=t=>{if(t.remainingLength<1)return null;const e=ce(t);if(t.skip(-1),e===0)return null;let n=1,r=128;for(;(e&r)===0;)n++,r>>=1;return t.remainingLength<n?null:n},Pc=t=>{if(t.remainingLength<1)return null;const e=ce(t);if(e===0)return null;let n=1,r=128;for(;(e&r)===0;)n++,r>>=1;if(t.remainingLength<n-1)return null;let i=e&r-1;for(let s=1;s<n;s++)i*=256,i+=ce(t);return i},Oe=(t,e)=>{if(e<1||e>8)throw new Error("Bad unsigned int size "+e);let n=0;for(let r=0;r<e;r++)n*=256,n+=ce(t);return n},OV=(t,e)=>{if(e<1)throw new Error("Bad unsigned int size "+e);let n=0n;for(let r=0;r<e;r++)n<<=8n,n+=BigInt(ce(t));return n},Tg=t=>{const e=fC(t);return e===null||t.remainingLength<e?null:Oe(t,e)},hC=t=>{if(t.remainingLength<1)return null;if(ce(t)===255)return;t.skip(-1);const n=Pc(t);if(n===null)return null;if(n!==72057594037927940)return n},ti=t=>{b(t.remainingLength>=Gn);const e=Tg(t);if(e===null)return null;const n=hC(t);return n===null?null:{id:e,size:n}},Za=(t,e)=>{const n=de(t,e);let r=0;for(;r<e&&n[r]!==0;)r+=1;return String.fromCharCode(...n.subarray(0,r))},Rc=(t,e)=>{const n=de(t,e);let r=0;for(;r<e&&n[r]!==0;)r+=1;return xn.decode(n.subarray(0,r))},kg=(t,e)=>{if(e===0)return 0;if(e!==4&&e!==8)throw new Error("Bad float size "+e);return e===4?sG(t):qx(t)},Ig=async(t,e,n,r)=>{const i=new Set(n);let s=e;for(;r===null||s<r;){let a=t.requestSliceRange(s,Gn,ei);if(a instanceof Promise&&(a=await a),!a)break;const o=ti(a);if(!o)break;if(i.has(o.id))return{pos:s,found:!0};Wi(o.size),s=a.filePos+o.size}return{pos:r!==null&&r>s?r:s,found:!1}},pC=async(t,e,n,r)=>{const s=new Set(n);let a=e;for(;a<r;){let o=t.requestSliceRange(a,0,Math.min(65536,r-a));if(o instanceof Promise&&(o=await o),!o||o.length<_g)break;for(let c=0;c<o.length-_g;c++){o.filePos=a;const u=Tg(o);if(u!==null&&s.has(u))return a;a++}}return null},Bn={avc:"V_MPEG4/ISO/AVC",hevc:"V_MPEGH/ISO/HEVC",vp8:"V_VP8",vp9:"V_VP9",av1:"V_AV1",aac:"A_AAC",mp3:"A_MPEG/L3",opus:"A_OPUS",vorbis:"A_VORBIS",flac:"A_FLAC",ac3:"A_AC3",eac3:"A_EAC3","pcm-u8":"A_PCM/INT/LIT","pcm-s16":"A_PCM/INT/LIT","pcm-s16be":"A_PCM/INT/BIG","pcm-s24":"A_PCM/INT/LIT","pcm-s24be":"A_PCM/INT/BIG","pcm-s32":"A_PCM/INT/LIT","pcm-s32be":"A_PCM/INT/BIG","pcm-f32":"A_PCM/FLOAT/IEEE","pcm-f64":"A_PCM/FLOAT/IEEE",webvtt:"S_TEXT/WEBVTT"};function Wi(t){if(t===void 0)throw new Error("Undefined element size is used in a place where it is not supported.")}/*!
607 * Copyright (c) 2026-present, Vanilagy and contributors
608 *
609 * This Source Code Form is subject to the terms of the Mozilla Public
610 * License, v. 2.0. If a copy of the MPL was not distributed with this
611 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
612 */const mC=t=>{let n=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isWebM?"webm":"x-matroska");if(t.codecStrings.length>0){const r=[...new Set(t.codecStrings.filter(Boolean))];n+=`; codecs="${r.join(", ")}"`}return n};/*!
613 * Copyright (c) 2026-present, Vanilagy and contributors
614 *
615 * This Source Code Form is subject to the terms of the Mozilla Public
616 * License, v. 2.0. If a copy of the MPL was not distributed with this
617 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
618 */var ni;(function(t){t[t.None=0]="None",t[t.Xiph=1]="Xiph",t[t.FixedSize=2]="FixedSize",t[t.Ebml=3]="Ebml"})(ni||(ni={}));var Fd;(function(t){t[t.Block=1]="Block",t[t.Private=2]="Private",t[t.Next=4]="Next"})(Fd||(Fd={}));var Fc;(function(t){t[t.Zlib=0]="Zlib",t[t.Bzlib=1]="Bzlib",t[t.lzo1x=2]="lzo1x",t[t.HeaderStripping=3]="HeaderStripping"})(Fc||(Fc={}));const Cg=[{id:R.SeekHead,flag:"seekHeadSeen"},{id:R.Info,flag:"infoSeen"},{id:R.Tracks,flag:"tracksSeen"},{id:R.Cues,flag:"cuesSeen"}],gC=10*2**20;class NV extends Xr{constructor(e){super(e),this.readMetadataPromise=null,this.segments=[],this.currentSegment=null,this.currentTrack=null,this.currentCluster=null,this.currentBlock=null,this.currentBlockAdditional=null,this.currentCueTime=null,this.currentDecodingInstruction=null,this.currentTagTargetIsMovie=!0,this.currentSimpleTagName=null,this.currentAttachedFile=null,this.isWebM=!1,this.reader=e._reader}async getTrackBackings(){return await this.readMetadata(),this.segments.flatMap(e=>e.tracks.map(n=>n.trackBacking))}async getMimeType(){await this.readMetadata();const e=await this.getTrackBackings(),n=await Promise.all(e.map(r=>r.getDecoderConfig().then(i=>(i==null?void 0:i.codec)??null)));return mC({isWebM:this.isWebM,hasVideo:this.segments.some(r=>r.tracks.some(i=>{var s;return((s=i.info)==null?void 0:s.type)==="video"})),hasAudio:this.segments.some(r=>r.tracks.some(i=>{var s;return((s=i.info)==null?void 0:s.type)==="audio"}
618)),codecStrings:n.filter(Boolean)})}async getMetadataTags(){await this.readMetadata();for(const n of this.segments)n.metadataTagsCollected||(this.reader.fileSize!==null&&await this.loadSegmentMetadata(n),n.metadataTagsCollected=!0);let e={};for(const n of this.segments)e={...e,...n.metadataTags};return e}readMetadata(){return this.readMetadataPromise??(this.readMetadataPromise=(async()=>{let e=0;for(;;){let n=this.reader.requestSliceRange(e,Gn,ei);if(n instanceof Promise&&(n=await n),!n)break;const r=ti(n);if(!r)break;const i=r.id;let s=r.size;const a=n.filePos;if(i===R.EBML){Wi(s);let o=this.reader.requestSlice(a,s);if(o instanceof Promise&&(o=await o),!o)break;this.readContiguousElements(o)}else if(i===R.Segment){if(await this.readSegment(a,s),s===void 0||this.reader.fileSize===null)break}else if(i===R.Cluster){if(this.reader.fileSize===null)break;s===void 0&&(s=(await Ig(this.reader,a,Rd,this.reader.fileSize)).pos-a);const o=yt(this.segments);o&&(o.elementEndPos=a+s)}Wi(s),e=a+s}})())}async readSegment(e,n){this.currentSegment={seekHeadSeen:!1,infoSeen:!1,tracksSeen:!1,cuesSeen:!1,tagsSeen:!1,attachmentsSeen:!1,timestampScale:-1,timestampFactor:-1,duration:-1,seekEntries:[],tracks:[],cuePoints:[],dataStartPos:e,elementEndPos:n===void 0?null:e+n,clusterSeekStartPos:e,lastReadCluster:null,metadataTags:{},metadataTagsCollected:!1},this.segments.push(this.currentSegment);let r=e;for(;this.currentSegment.elementEndPos===null||r<this.currentSegment.elementEndPos;){let o=this.reader.requestSliceRange(r,Gn,ei);if(o instanceof Promise&&(o=await o),!o)break;const c=r,u=ti(o);if(!u||!Bc.includes(u.id)&&u.id!==R.Void){const m=await pC(this.reader,c,Bc,Math.min(this.currentSegment.elementEndPos??1/0,c+gC));if(m){r=m;continue}else break}const{id:l,size:d}=u,f=o.filePos,h=Cg.findIndex(m=>m.id===l);if(h!==-1){const m=Cg[h].flag;this.currentSegment[m]=!0,Wi(d);let p=this.reader.requestSlice(f,d);p instanceof Promise&&(p=await p),p&&this.readContiguousElements(p)}else if(l===R.Tags||l===R.Attachments){l===R.Tags?this.currentSegment.tagsSeen=!0:this.currentSegment.attachmentsSeen=!0,Wi(d);let m=this.reader.requestSlice(f,d);m instanceof Promise&&(m=await m),m&&this.readContiguousElements(m)}else if(l===R.Cluster){this.currentSegment.clusterSeekStartPos=c;break}if(d===void 0)break;r=f+d}if(this.currentSegment.seekEntries.sort((o,c)=>o.segmentPosition-c.segmentPosition),this.reader.fileSize!==null)for(const o of this.currentSegment.seekEntries){const c=Cg.find(m=>m.id===o.id);if(!c||this.currentSegment[c.flag])continue;let u=this.reader.requestSliceRange(e+o.segmentPosition,Gn,ei);if(u instanceof Promise&&(u=await u),!u)continue;const l=ti(u);if(!l)continue;const{id:d,size:f}=l;if(d!==c.id)continue;Wi(f),this.currentSegment[c.flag]=!0;let h=this.reader.requestSlice(u.filePos,f);h instanceof Promise&&(h=await h),h&&this.readContiguousElements(h)}this.currentSegment.timestampScale===-1&&(this.currentSegment.timestampScale=1e6,this.currentSegment.timestampFactor=1e9/1e6);for(const o of this.currentSegment.tracks)o.defaultDurationNs!==null&&(o.defaultDuration=this.currentSegment.timestampFactor*o.defaultDurationNs/1e9);const i=new Map(this.currentSegment.tracks.map(o=>[o.id,o]));for(const o of this.currentSegment.cuePoints){const c=i.get(o.trackId);c&&c.cuePoints.push(o)}for(const o of this.currentSegment.tracks){o.cuePoints.sort((c,u)=>c.time-u.time);for(let c=0;c<o.cuePoints.length-1;c++){const u=o.cuePoints[c],l=o.cuePoints[c+1];u.time===l.time&&(o.cuePoints.splice(c+1,1),c--)}}let s=null,a=-1/0;for(const o of this.currentSegment.tracks)o.cuePoints.length>a&&(a=o.cuePoints.length,s=o);for(const o of this.currentSegment.tracks)o.cuePoints.length===0&&(o.cuePoints=s.cuePoints);this.currentSegment=null}async readCluster(e,n){var d;if(((d=n.lastReadCluster)==null?void 0:d.elementStartPos)===e)return n.lastReadCluster;let r=this.reader.requestSliceRange(e,Gn,ei);r instanceof Promise&&(r=await r),b(r);const i=e,s=ti(r);b(s);const a=s.id;b(a===R.Cluster);let o=s.size;const c=r.filePos;o===void 0&&(o=(await Ig(this.reader,c,Rd,n.elementEndPos)).pos-c);let u=this.reader.requestSlice(c,o);u instanceof Promise&&(u=await u);const l={segment:n,elementStartPos:i,elementEndPos:c+o,dataStartPos:c,timestamp:-1,trackData:new Map};if(this.currentCluster=l,u){const f=this.readContiguousElements(u,Rd);l.elementEndPos=f}for(const[,f]of l.trackData){const h=f.track;b(f.blocks.length>0);let m=!1;for(let y=0;y<f.blocks.length;y++){const w=f.blocks[y];w.timestamp+=l.timestamp,m||(m=w.lacing!==ni.None)}f.presentationTimestamps=f.blocks.map((y,w)=>({timestamp:y.timestamp,blockIndex:w})).sort((y,w)=>y.timestamp-w.timestamp);for(let y=0;y<f.presentationTimestamps.length;y++){const w=f.presentationTimestamps[y],E=f.blocks[w.blockIndex];if(f.firstKeyFrameTimestamp===null&&E.isKeyFrame&&(f.firstKeyFrameTimestamp=E.timestamp),y<f.presentationTimestamps.length-1){const S=f.presentationTimestamps[y+1];E.duration=S.timestamp-E.timestamp}else E.duration===0&&h.defaultDuration!=null&&E.lacing===ni.None&&(E.duration=h.defaultDuration)}m&&(this.expandLacedBlocks(f.blocks,h),f.presentationTimestamps=f.blocks.map((y,w)=>({timestamp:y.timestamp,blockIndex:w})).sort((y,w)=>y.timestamp-w.timestamp));const p=f.blocks[f.presentationTimestamps[0].blockIndex],g=f.blocks[yt(f.presentationTimestamps).blockIndex];f.startTimestamp=p.timestamp,f.endTimestamp=g.timestamp+g.duration;const A=Ge(h.clusterPositionCache,f.startTimestamp,y=>y.startTimestamp);(A===-1||h.clusterPositionCache[A].elementStartPos!==i)&&h.clusterPositionCache.splice(A+1,0,{elementStartPos:l.elementStartPos,startTimestamp:f.startTimestamp})}return n.lastReadCluster=l,l}getTrackDataInCluster(e,n){let r=e.trackData.get(n);if(!r){const i=e.segment.tracks.find(s=>s.id===n);if(!i)return null;r={track:i,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,blocks:[],presentationTimestamps:[]},e.trackData.set(n,r)}return r}expandLacedBlocks(e,n){for(let r=0;r<e.length;r++){const i=e[r];if(i.lacing===ni.None)continue;i.decoded||(i.data=this.decodeBlockData(n,i.data),i.decoded=!0);const s=an.tempFromBytes(i.data),a=[],o=ce(s)+1;switch(i.lacing){case ni.Xiph:{let u=0;for(let l=0;l<o-1;l++){let d=0;for(;s.bufferPos<s.length;){const f=ce(s);if(d+=f,f<255){a.push(d),u+=d;break}}}a.push(s.length-(s.bufferPos+u))}break;case ni.FixedSize:{const u=s.length-1,l=Math.floor(u/o);for(let d=0;d<o;d++)a.push(l)}break;case ni.Ebml:{const u=Pc(s);b(u!==null);let l=u;a.push(l);let d=l;for(let f=1;f<o-1;f++){const h=s.bufferPos,m=Pc(s);b(m!==null);const p=m,A=(1<<(s.bufferPos-h)*7-1)-1,y=p-A;l+=y,a.push(l),d+=l}a.push(s.length-(s.bufferPos+d))}break;default:b(!1)}b(a.length===o),e.splice(r,1);const c=i.duration||o*(n.defaultDuration??0);for(let u=0;u<o;u++){const l=a[u],d=de(s,l),f=i.timestamp+c*u/o,h=c/o;e.splice(r+u,0,{timestamp:f,duration:h,isKeyFrame:i.isKeyFrame,data:d,lacing:ni.None,decoded:!0,mainAdditional:i.mainAdditional})}r+=o,r--}}async loadSegmentMetadata(e){for(const n of e.seekEntries){if(!(n.id===R.Tags&&!e.tagsSeen)){if(!(n.id===R.Attachments&&!e.attachmentsSeen))continue}let r=this.reader.requestSliceRange(e.dataStartPos+n.segmentPosition,Gn,ei);if(r instanceof Promise&&(r=await r),!r)continue;const i=ti(r);
618if(!i||i.id!==n.id)continue;const{size:s}=i;Wi(s),b(!this.currentSegment),this.currentSegment=e;let a=this.reader.requestSlice(r.filePos,s);a instanceof Promise&&(a=await a),a&&this.readContiguousElements(a),this.currentSegment=null,n.id===R.Tags?e.tagsSeen=!0:n.id===R.Attachments&&(e.attachmentsSeen=!0)}}readContiguousElements(e,n){for(;e.remainingLength>=Gn;){const r=e.filePos;if(!this.traverseElement(e,n))return r}return e.filePos}traverseElement(e,n){var o,c,u,l,d,f,h,m,p,g,A,y,w,E,S,k,T,C,_,x,P,v,M,D,O,N,Q,G,V,Z,B,L,K,q,ne,fe,Ae,ie,ye,$e,ge,xe,We,be,I,H;const r=ti(e);if(!r||n&&n.includes(r.id))return!1;const{id:i,size:s}=r,a=e.filePos;switch(Wi(s),i){case R.DocType:this.isWebM=Za(e,s)==="webm";break;case R.Seek:{if(!this.currentSegment)break;const F={id:-1,segmentPosition:-1};this.currentSegment.seekEntries.push(F),this.readContiguousElements(e.slice(a,s)),(F.id===-1||F.segmentPosition===-1)&&this.currentSegment.seekEntries.pop()}break;case R.SeekID:{const F=(o=this.currentSegment)==null?void 0:o.seekEntries[this.currentSegment.seekEntries.length-1];if(!F)break;F.id=Oe(e,s)}break;case R.SeekPosition:{const F=(c=this.currentSegment)==null?void 0:c.seekEntries[this.currentSegment.seekEntries.length-1];if(!F)break;F.segmentPosition=Oe(e,s)}break;case R.TimestampScale:{if(!this.currentSegment)break;this.currentSegment.timestampScale=Oe(e,s),this.currentSegment.timestampFactor=1e9/this.currentSegment.timestampScale}break;case R.Duration:{if(!this.currentSegment)break;this.currentSegment.duration=kg(e,s)}break;case R.TrackEntry:{if(!this.currentSegment||(this.currentTrack={id:-1,segment:this.currentSegment,demuxer:this,clusterPositionCache:[],cuePoints:[],disposition:{...Kr,primary:!1},trackBacking:null,codecId:null,codecPrivate:null,defaultDuration:null,defaultDurationNs:null,name:null,languageCode:"eng",hasLanguageBcp47:!1,decodingInstructions:[],info:null},this.readContiguousElements(e.slice(a,s)),!this.currentTrack))break;if(this.currentTrack.decodingInstructions.some(F=>{var U;return((U=F.data)==null?void 0:U.type)!=="decompress"||F.scope!==Fd.Block||F.data.algorithm!==Fc.HeaderStripping})&&(console.warn(`Track #${this.currentTrack.id} has an unsupported content encoding; dropping.`),this.currentTrack=null),this.currentTrack&&this.currentTrack.id!==-1&&this.currentTrack.codecId&&this.currentTrack.info){const F=this.currentTrack.codecId.indexOf("/"),U=F===-1?this.currentTrack.codecId:this.currentTrack.codecId.slice(0,F);if(this.currentTrack.info.type==="video"&&this.currentTrack.info.width!==-1&&this.currentTrack.info.height!==-1){if(this.currentTrack.info.squarePixelWidth=this.currentTrack.info.width,this.currentTrack.info.squarePixelHeight=this.currentTrack.info.height,this.currentTrack.info.displayWidth!==null&&this.currentTrack.info.displayHeight!==null){const z=this.currentTrack.info.displayWidth*this.currentTrack.info.height,X=this.currentTrack.info.displayHeight*this.currentTrack.info.width;z>0&&X>0&&(z>X?this.currentTrack.info.squarePixelWidth=Math.round(this.currentTrack.info.width*z/X):this.currentTrack.info.squarePixelHeight=Math.round(this.currentTrack.info.height*X/z))}this.currentTrack.codecId===Bn.avc?(this.currentTrack.info.codec="avc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===Bn.hevc?(this.currentTrack.info.codec="hevc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):U===Bn.vp8?this.currentTrack.info.codec="vp8":U===Bn.vp9?this.currentTrack.info.codec="vp9":U===Bn.av1&&(this.currentTrack.info.codec="av1");const $=this.currentTrack;this.currentTrack.trackBacking=new UV($),this.currentSegment.tracks.push(this.currentTrack)}else if(this.currentTrack.info.type==="audio"){U===Bn.aac?(this.currentTrack.info.codec="aac",this.currentTrack.info.aacCodecInfo={isMpeg2:this.currentTrack.codecId.includes("MPEG2"),objectType:null},this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===Bn.mp3?this.currentTrack.info.codec="mp3":U===Bn.opus?(this.currentTrack.info.codec="opus",this.currentTrack.info.codecDescription=this.currentTrack.codecPr
618ivate,this.currentTrack.info.sampleRate=qa):U===Bn.vorbis?(this.currentTrack.info.codec="vorbis",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):U===Bn.flac?(this.currentTrack.info.codec="flac",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):U===Bn.ac3?(this.currentTrack.info.codec="ac3",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):U===Bn.eac3?(this.currentTrack.info.codec="eac3",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId==="A_PCM/INT/LIT"?this.currentTrack.info.bitDepth===8?this.currentTrack.info.codec="pcm-u8":this.currentTrack.info.bitDepth===16?this.currentTrack.info.codec="pcm-s16":this.currentTrack.info.bitDepth===24?this.currentTrack.info.codec="pcm-s24":this.currentTrack.info.bitDepth===32&&(this.currentTrack.info.codec="pcm-s32"):this.currentTrack.codecId==="A_PCM/INT/BIG"?this.currentTrack.info.bitDepth===8?this.currentTrack.info.codec="pcm-u8":this.currentTrack.info.bitDepth===16?this.currentTrack.info.codec="pcm-s16be":this.currentTrack.info.bitDepth===24?this.currentTrack.info.codec="pcm-s24be":this.currentTrack.info.bitDepth===32&&(this.currentTrack.info.codec="pcm-s32be"):this.currentTrack.codecId==="A_PCM/FLOAT/IEEE"&&(this.currentTrack.info.bitDepth===32?this.currentTrack.info.codec="pcm-f32":this.currentTrack.info.bitDepth===64&&(this.currentTrack.info.codec="pcm-f64"));const $=this.currentTrack;this.currentTrack.trackBacking=new LV($),this.currentSegment.tracks.push(this.currentTrack)}}this.currentTrack=null}break;case R.TrackNumber:{if(!this.currentTrack)break;this.currentTrack.id=Oe(e,s)}break;case R.TrackType:{if(!this.currentTrack)break;const F=Oe(e,s);F===1?this.currentTrack.info={type:"video",width:-1,height:-1,displayWidth:null,displayHeight:null,displayUnit:null,squarePixelWidth:-1,squarePixelHeight:-1,rotation:0,codec:null,codecDescription:null,colorSpace:null,alphaMode:!1}:F===2&&(this.currentTrack.info={type:"audio",numberOfChannels:1,sampleRate:8e3,bitDepth:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case R.FlagEnabled:{if(!this.currentTrack)break;Oe(e,s)||(this.currentTrack=null)}break;case R.FlagDefault:{if(!this.currentTrack)break;this.currentTrack.disposition.default=!!Oe(e,s)}break;case R.FlagForced:{if(!this.currentTrack)break;this.currentTrack.disposition.forced=!!Oe(e,s)}break;case R.FlagOriginal:{if(!this.currentTrack)break;this.currentTrack.disposition.original=!!Oe(e,s)}break;case R.FlagHearingImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.hearingImpaired=!!Oe(e,s)}break;case R.FlagVisualImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.visuallyImpaired=!!Oe(e,s)}break;case R.FlagCommentary:{if(!this.currentTrack)break;this.currentTrack.disposition.commentary=!!Oe(e,s)}break;case R.CodecID:{if(!this.currentTrack)break;this.currentTrack.codecId=Za(e,s)}break;case R.CodecPrivate:{if(!this.currentTrack)break;this.currentTrack.codecPrivate=de(e,s)}break;case R.DefaultDuration:{if(!this.currentTrack)break;this.currentTrack.defaultDurationNs=Oe(e,s)}break;case R.Name:{if(!this.currentTrack)break;this.currentTrack.name=Rc(e,s)}break;case R.Language:{if(!this.currentTrack||this.currentTrack.hasLanguageBcp47)break;this.currentTrack.languageCode=Za(e,s),bc(this.currentTrack.languageCode)||(this.currentTrack.languageCode=Kt)}break;case R.LanguageBCP47:{if(!this.currentTrack)break;const U=Za(e,s).split("-")[0];U?this.currentTrack.languageCode=U:this.currentTrack.languageCode=Kt,this.currentTrack.hasLanguageBcp47=!0}break;case R.Video:{if(((l=(u=this.currentTrack)==null?void 0:u.info)==null?void 0:l.type)!=="video")break;this.readContiguousElements(e.slice(a,s))}break;case R.PixelWidth:{if(((f=(d=this.currentTrack)==null?void 0:d.info)==null?void 0:f.type)!=="video")break;this.currentTrack.info.width=Oe(e,s)}break;case R.PixelHeight:{if(((m=(h=this.currentTrack)==null?void 0:h.info)==null?void 0:m.type)!=="video")break;this.currentTrack.info.height=Oe(e,s)}break;case R.DisplayWidth:{if(((g=(p=this.currentTrack)==null?void 0:p.info)==null?void 0:g.type)!=="video")break;this.currentTrack.info.displayWidth=Oe(e,s)}break;
618case R.DisplayHeight:{if(((y=(A=this.currentTrack)==null?void 0:A.info)==null?void 0:y.type)!=="video")break;this.currentTrack.info.displayHeight=Oe(e,s)}break;case R.DisplayUnit:{if(((E=(w=this.currentTrack)==null?void 0:w.info)==null?void 0:E.type)!=="video")break;this.currentTrack.info.displayUnit=Oe(e,s)}break;case R.AlphaMode:{if(((k=(S=this.currentTrack)==null?void 0:S.info)==null?void 0:k.type)!=="video")break;this.currentTrack.info.alphaMode=Oe(e,s)===1}break;case R.Colour:{if(((C=(T=this.currentTrack)==null?void 0:T.info)==null?void 0:C.type)!=="video")break;this.currentTrack.info.colorSpace={},this.readContiguousElements(e.slice(a,s))}break;case R.MatrixCoefficients:{if(((x=(_=this.currentTrack)==null?void 0:_.info)==null?void 0:x.type)!=="video"||!this.currentTrack.info.colorSpace)break;const F=Oe(e,s),U=dd[F]??null;this.currentTrack.info.colorSpace.matrix=U}break;case R.Range:{if(((v=(P=this.currentTrack)==null?void 0:P.info)==null?void 0:v.type)!=="video"||!this.currentTrack.info.colorSpace)break;this.currentTrack.info.colorSpace.fullRange=Oe(e,s)===2}break;case R.TransferCharacteristics:{if(((D=(M=this.currentTrack)==null?void 0:M.info)==null?void 0:D.type)!=="video"||!this.currentTrack.info.colorSpace)break;const F=Oe(e,s),U=ld[F]??null;this.currentTrack.info.colorSpace.transfer=U}break;case R.Primaries:{if(((N=(O=this.currentTrack)==null?void 0:O.info)==null?void 0:N.type)!=="video"||!this.currentTrack.info.colorSpace)break;const F=Oe(e,s),U=ud[F]??null;this.currentTrack.info.colorSpace.primaries=U}break;case R.Projection:{if(((G=(Q=this.currentTrack)==null?void 0:Q.info)==null?void 0:G.type)!=="video")break;this.readContiguousElements(e.slice(a,s))}break;case R.ProjectionPoseRoll:{if(((Z=(V=this.currentTrack)==null?void 0:V.info)==null?void 0:Z.type)!=="video")break;const U=-kg(e,s);try{this.currentTrack.info.rotation=Na(U)}catch{}}break;case R.Audio:{if(((L=(B=this.currentTrack)==null?void 0:B.info)==null?void 0:L.type)!=="audio")break;this.readContiguousElements(e.slice(a,s))}break;case R.SamplingFrequency:{if(((q=(K=this.currentTrack)==null?void 0:K.info)==null?void 0:q.type)!=="audio")break;this.currentTrack.info.sampleRate=kg(e,s)}break;case R.Channels:{if(((fe=(ne=this.currentTrack)==null?void 0:ne.info)==null?void 0:fe.type)!=="audio")break;this.currentTrack.info.numberOfChannels=Oe(e,s)}break;case R.BitDepth:{if(((ie=(Ae=this.currentTrack)==null?void 0:Ae.info)==null?void 0:ie.type)!=="audio")break;this.currentTrack.info.bitDepth=Oe(e,s)}break;case R.CuePoint:{if(!this.currentSegment)break;this.readContiguousElements(e.slice(a,s)),this.currentCueTime=null}break;case R.CueTime:this.currentCueTime=Oe(e,s);break;case R.CueTrackPositions:{if(this.currentCueTime===null)break;b(this.currentSegment);const F={time:this.currentCueTime,trackId:-1,clusterPosition:-1};this.currentSegment.cuePoints.push(F),this.readContiguousElements(e.slice(a,s)),(F.trackId===-1||F.clusterPosition===-1)&&this.currentSegment.cuePoints.pop()}break;case R.CueTrack:{const F=(ye=this.currentSegment)==null?void 0:ye.cuePoints[this.currentSegment.cuePoints.length-1];if(!F)break;F.trackId=Oe(e,s)}break;case R.CueClusterPosition:{const F=($e=this.currentSegment)==null?void 0:$e.cuePoints[this.currentSegment.cuePoints.length-1];if(!F)break;b(this.currentSegment),F.clusterPosition=this.currentSegment.dataStartPos+Oe(e,s)}break;case R.Timestamp:{if(!this.currentCluster)break;this.currentCluster.timestamp=Oe(e,s)}break;case R.SimpleBlock:{if(!this.currentCluster)break;const F=Pc(e);if(F===null)break;const U=this.getTrackDataInCluster(this.currentCluster,F);if(!U)break;const $=lA(e),z=ce(e),X=z>>1&3;let Y=!!(z&128);((ge=U.track.info)==null?void 0:ge.type)==="audio"&&U.track.info.codec&&(Y=!0);const re=de(e,s-(e.filePos-a)),se=U.track.decodingInstructions.length>0;U.blocks.push({timestamp:$,duration:0,isKeyFrame:Y,data:re,lacing:X,decoded:!se,mainAdditional:null})}break;case R.BlockGroup:{if(!this.currentCluster)break;this.readContiguousElements(e.slice(a,s)),this.currentBlock=null}break;case R.Block:{if(!this.currentCluster)break;const F=Pc(e);if(F===null)break;const U=this.getTrackDataInCluster(this.currentCluster,F);if(!U)break;const $=lA(e),X=ce(e)>>
6181&3,Y=de(e,s-(e.filePos-a)),re=U.track.decodingInstructions.length>0;this.currentBlock={timestamp:$,duration:0,isKeyFrame:!0,data:Y,lacing:X,decoded:!re,mainAdditional:null},U.blocks.push(this.currentBlock)}break;case R.BlockAdditions:this.readContiguousElements(e.slice(a,s));break;case R.BlockMore:{if(!this.currentBlock)break;this.currentBlockAdditional={addId:1,data:null},this.readContiguousElements(e.slice(a,s)),this.currentBlockAdditional.data&&this.currentBlockAdditional.addId===1&&(this.currentBlock.mainAdditional=this.currentBlockAdditional.data),this.currentBlockAdditional=null}break;case R.BlockAdditional:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.data=de(e,s)}break;case R.BlockAddID:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.addId=Oe(e,s)}break;case R.BlockDuration:{if(!this.currentBlock)break;this.currentBlock.duration=Oe(e,s)}break;case R.ReferenceBlock:{if(!this.currentBlock)break;this.currentBlock.isKeyFrame=!1}break;case R.Tag:this.currentTagTargetIsMovie=!0,this.readContiguousElements(e.slice(a,s));break;case R.Targets:this.readContiguousElements(e.slice(a,s));break;case R.TargetTypeValue:Oe(e,s)!==50&&(this.currentTagTargetIsMovie=!1);break;case R.TagTrackUID:case R.TagEditionUID:case R.TagChapterUID:case R.TagAttachmentUID:this.currentTagTargetIsMovie=!1;break;case R.SimpleTag:{if(!this.currentTagTargetIsMovie)break;this.currentSimpleTagName=null,this.readContiguousElements(e.slice(a,s))}break;case R.TagName:this.currentSimpleTagName=Rc(e,s);break;case R.TagString:{if(!this.currentSimpleTagName)break;const F=Rc(e,s);this.processTagValue(this.currentSimpleTagName,F)}break;case R.TagBinary:{if(!this.currentSimpleTagName)break;const F=de(e,s);this.processTagValue(this.currentSimpleTagName,F)}break;case R.AttachedFile:{if(!this.currentSegment)break;this.currentAttachedFile={fileUid:null,fileName:null,fileMediaType:null,fileData:null,fileDescription:null},this.readContiguousElements(e.slice(a,s));const F=this.currentSegment.metadataTags;if(this.currentAttachedFile.fileUid&&this.currentAttachedFile.fileData&&(F.raw??(F.raw={}),F.raw[this.currentAttachedFile.fileUid.toString()]=new yd(this.currentAttachedFile.fileData,this.currentAttachedFile.fileMediaType??void 0,this.currentAttachedFile.fileName??void 0,this.currentAttachedFile.fileDescription??void 0)),(xe=this.currentAttachedFile.fileMediaType)!=null&&xe.startsWith("image/")&&this.currentAttachedFile.fileData){const U=this.currentAttachedFile.fileName;let $="unknown";if(U){const z=U.toLowerCase();z.startsWith("cover.")?$="coverFront":z.startsWith("back.")&&($="coverBack")}F.images??(F.images=[]),F.images.push({data:this.currentAttachedFile.fileData,mimeType:this.currentAttachedFile.fileMediaType,kind:$,name:this.currentAttachedFile.fileName??void 0,description:this.currentAttachedFile.fileDescription??void 0})}this.currentAttachedFile=null}break;case R.FileUID:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileUid=OV(e,s)}break;case R.FileName:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileName=Rc(e,s)}break;
618case R.FileMediaType:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileMediaType=Za(e,s)}break;case R.FileData:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileData=de(e,s)}break;case R.FileDescription:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileDescription=Rc(e,s)}break;case R.ContentEncodings:{if(!this.currentTrack)break;this.readContiguousElements(e.slice(a,s)),this.currentTrack.decodingInstructions.sort((F,U)=>U.order-F.order)}break;case R.ContentEncoding:this.currentDecodingInstruction={order:0,scope:Fd.Block,data:null},this.readContiguousElements(e.slice(a,s)),this.currentDecodingInstruction.data&&this.currentTrack.decodingInstructions.push(this.currentDecodingInstruction),this.currentDecodingInstruction=null;break;case R.ContentEncodingOrder:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.order=Oe(e,s)}break;case R.ContentEncodingScope:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.scope=Oe(e,s)}break;case R.ContentCompression:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decompress",algorithm:Fc.Zlib,settings:null},this.readContiguousElements(e.slice(a,s))}break;case R.ContentCompAlgo:{if(((be=(We=this.currentDecodingInstruction)==null?void 0:We.data)==null?void 0:be.type)!=="decompress")break;this.currentDecodingInstruction.data.algorithm=Oe(e,s)}break;case R.ContentCompSettings:{if(((H=(I=this.currentDecodingInstruction)==null?void 0:I.data)==null?void 0:H.type)!=="decompress")break;this.currentDecodingInstruction.data.settings=de(e,s)}break;case R.ContentEncryption:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decrypt"}}break}return e.filePos=a+s,!0}decodeBlockData(e,n){b(e.decodingInstructions.length>0);let r=n;for(const i of e.decodingInstructions)switch(b(i.data),i.data.type){case"decompress":switch(i.data.algorithm){case Fc.HeaderStripping:if(i.data.settings&&i.data.settings.length>0){const s=i.data.settings,a=new Uint8Array(s.length+r.length);a.set(s,0),a.set(r,s.length),r=a}break}break}return r}processTagValue(e,n){var i,s;if(!((i=this.currentSegment)!=null&&i.metadataTags))return;const r=this.currentSegment.metadataTags;if(r.raw??(r.raw={}),(s=r.raw)[e]??(s[e]=n),typeof n=="string")switch(e.toLowerCase()){case"title":r.title??(r.title=n);break;case"description":r.description??(r.description=n);break;case"artist":r.artist??(r.artist=n);break;case"album":r.album??(r.album=n);break;case"album_artist":r.albumArtist??(r.albumArtist=n);break;case"genre":r.genre??(r.genre=n);break;case"comment":r.comment??(r.comment=n);break;case"lyrics":r.lyrics??(r.lyrics=n);break;case"date":{const a=new Date(n);Number.isNaN(a.getTime())||(r.date??(r.date=a))}break;case"track_number":case"part_number":{const a=n.split("/"),o=Number.parseInt(a[0],10),c=a[1]&&Number.parseInt(a[1],10);Number.isInteger(o)&&o>0&&(r.trackNumber??(r.trackNumber=o)),c&&Number.isInteger(c)&&c>0&&(r.tracksTotal??(r.tracksTotal=c))}break;case"disc_number":case"disc":{const a=n.split("/"),o=Number.parseInt(a[0],10),c=a[1]&&Number.parseInt(a[1],10);Number.isInteger(o)&&o>0&&(r.discNumber??(r.discNumber=o)),c&&Number.isInteger(c)&&c>0&&(r.discsTotal??(r.discsTotal=c))}break}}}class AC{constructor(e){this.internalTrack=e,this.packetToClusterLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const e=this.internalTrack.demuxer,n=this.internalTrack.trackBacking.getType();let r=0;for(const i of e.segments)for(const s of i.tracks)if(s.trackBacking.getType()===n&&r++,s===this.internalTrack)break;return r}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.codecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.segment.timestampFactor}isRelativeToUnixEpoch(){return!1}getDisposition(){return this.internalTrack.disposition}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){const e=this.internalTrack.segment;if(e.duration<=0)return null;let n=e.duration/e.timestampFactor;const r=await this.getFirstPacket({metadataOnly:!0});return n+=(r==null?void 0:r.timestamp)??0,n}
618async getLiveRefreshInterval(){return null}async getFirstPacket(e){return this.performClusterLookup(null,n=>n.trackData.get(this.internalTrack.id)?{blockIndex:0,correctBlockFound:!0}:{blockIndex:-1,correctBlockFound:!1},-1/0,1/0,e)}intoTimescale(e){return wc(e*this.internalTrack.segment.timestampFactor)}async getPacket(e,n){const r=this.intoTimescale(e);return this.performClusterLookup(null,i=>{const s=i.trackData.get(this.internalTrack.id);if(!s)return{blockIndex:-1,correctBlockFound:!1};const a=Ge(s.presentationTimestamps,r,u=>u.timestamp),o=a!==-1?s.presentationTimestamps[a].blockIndex:-1,c=a!==-1&&r<s.endTimestamp;return{blockIndex:o,correctBlockFound:c}},r,r,n)}async getNextPacket(e,n){const r=this.packetToClusterLocation.get(e);if(r===void 0)throw new Error("Packet was not created from this track.");return this.performClusterLookup(r.cluster,i=>{if(i===r.cluster){const s=i.trackData.get(this.internalTrack.id);if(r.blockIndex+1<s.blocks.length)return{blockIndex:r.blockIndex+1,correctBlockFound:!0}}else if(i.trackData.get(this.internalTrack.id))return{blockIndex:0,correctBlockFound:!0};return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,n)}async getKeyPacket(e,n){const r=this.intoTimescale(e);return this.performClusterLookup(null,i=>{const s=i.trackData.get(this.internalTrack.id);if(!s)return{blockIndex:-1,correctBlockFound:!1};const a=fd(s.presentationTimestamps,u=>s.blocks[u.blockIndex].isKeyFrame&&u.timestamp<=r),o=a!==-1?s.presentationTimestamps[a].blockIndex:-1,c=a!==-1&&r<s.endTimestamp;return{blockIndex:o,correctBlockFound:c}},r,r,n)}async getNextKeyPacket(e,n){const r=this.packetToClusterLocation.get(e);if(r===void 0)throw new Error("Packet was not created from this track.");return this.performClusterLookup(r.cluster,i=>{if(i===r.cluster){const a=i.trackData.get(this.internalTrack.id).blocks.findIndex((o,c)=>o.isKeyFrame&&c>r.blockIndex);if(a!==-1)return{blockIndex:a,correctBlockFound:!0}}else{const s=i.trackData.get(this.internalTrack.id);if(s&&s.firstKeyFrameTimestamp!==null){const a=s.blocks.findIndex(o=>o.isKeyFrame);return b(a!==-1),{blockIndex:a,correctBlockFound:!0}}}return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,n)}async fetchPacketInCluster(e,n,r){var d;if(n===-1)return null;const s=e.trackData.get(this.internalTrack.id).blocks[n];b(s),s.decoded||(s.data=this.internalTrack.demuxer.decodeBlockData(this.internalTrack,s.data),s.decoded=!0);const a=r.metadataOnly?vn:s.data,o=s.timestamp/this.internalTrack.segment.timestampFactor,c=s.duration/this.internalTrack.segment.timestampFactor,u={};s.mainAdditional&&((d=this.internalTrack.info)==null?void 0:d.type)==="video"&&this.internalTrack.info.alphaMode&&(u.alpha=r.metadataOnly?vn:s.mainAdditional,u.alphaByteLength=s.mainAdditional.byteLength);const l=new nt(a,s.isKeyFrame?"key":"delta",o,c,e.dataStartPos+n,s.data.byteLength,u);return this.packetToClusterLocation.set(l,{cluster:e,blockIndex:n}),l}async performClusterLookup(e,n,r,i,s){const{demuxer:a,segment:o}=this.internalTrack;let c=null,u=null,l=-1;if(e){const{blockIndex:A,correctBlockFound:y}=n(e);if(y)return this.fetchPacketInCluster(e,A,s);A!==-1&&(u=e,l=A)}const d=Ge(this.internalTrack.cuePoints,r,A=>A.time),f=d!==-1?this.internalTrack.cuePoints[d]:null,h=Ge(this.internalTrack.clusterPositionCache,r,A=>A.startTimestamp),m=h!==-1?this.internalTrack.clusterPositionCache[h]:null,p=Math.max((f==null?void 0:f.clusterPosition)??0,(m==null?void 0:m.elementStartPos)??0)||null;let g;for(e?p===null||e.elementStartPos>=p?(g=e.elementEndPos,c=e):g=p:g=p??o.clusterSeekStartPos;o.elementEndPos===null||g<=o.elementEndPos-Gn;){if(c){const C=c.trackData.get(this.internalTrack.id);if(C&&C.startTimestamp>i)break}let A=a.reader.requestSliceRange(g,Gn,ei);if(A instanceof Promise&&(A=await A),!A)break;const y=g,w=ti(A);if(!w||!Bc.includes(w.id)&&w.id!==R.Void){const C=await pC(a.reader,y,Bc,Math.min(o.elementEndPos??1/0,y+gC));if(C){g=C;continue}else break}const E=w.id;let S=w.size;const k=A.filePos;if(E===R.Cluster){c=await a.readCluster(y,o),S=c.elementEndPos-k;const{blockIndex:C,correctBlockFound:_}=n(c);if(_)return this.fetchPacketInCluster(c,C,s);C!==-1&&(u=c,l=C)}S===void 0&&(b(E!==R.Cluster),S=(await Ig(a.reader,k,Rd,o.elementEndPos)).pos-k);const T=k+S;
618if(o.elementEndPos===null){let C=a.reader.requestSliceRange(T,Gn,ei);if(C instanceof Promise&&(C=await C),!C)break;if(Tg(C)===R.Segment){o.elementEndPos=T;break}}g=T}if(f&&(!u||u.elementStartPos<f.clusterPosition)){const A=this.internalTrack.cuePoints[d-1];b(!A||A.time<f.time);const y=(A==null?void 0:A.time)??-1/0;return this.performClusterLookup(null,n,y,i,s)}return u?this.fetchPacketInCluster(u,l,s):null}}class UV extends AC{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getType(){return"video"}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.info.rotation}async getColorSpace(){var e,n,r,i;return{primaries:(e=this.internalTrack.info.colorSpace)==null?void 0:e.primaries,transfer:(n=this.internalTrack.info.colorSpace)==null?void 0:n.transfer,matrix:(r=this.internalTrack.info.colorSpace)==null?void 0:r.matrix,fullRange:(i=this.internalTrack.info.colorSpace)==null?void 0:i.fullRange}}
618async canBeTransparent(){return this.internalTrack.info.alphaMode}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfigPromise??(this.decoderConfigPromise=(async()=>{let e=null;(this.internalTrack.info.codec==="vp9"||this.internalTrack.info.codec==="av1"||this.internalTrack.info.codec==="avc"&&!this.internalTrack.info.codecDescription||this.internalTrack.info.codec==="hevc"&&!this.internalTrack.info.codecDescription)&&(e=await this.getFirstPacket({}));const r={codec:tg({width:this.internalTrack.info.width,height:this.internalTrack.info.height,codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,colorSpace:this.internalTrack.info.colorSpace,avcType:1,avcCodecInfo:this.internalTrack.info.codec==="avc"&&e?lg(e.data):null,hevcCodecInfo:this.internalTrack.info.codec==="hevc"&&e?fg(e.data):null,vp9CodecInfo:this.internalTrack.info.codec==="vp9"&&e?LI(e.data):null,av1CodecInfo:this.internalTrack.info.codec==="av1"&&e?QI(e.data):null}),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:this.internalTrack.info.codecDescription??void 0,colorSpace:this.internalTrack.info.colorSpace??void 0};return(this.internalTrack.info.width!==this.internalTrack.info.squarePixelWidth||this.internalTrack.info.height!==this.internalTrack.info.squarePixelHeight)&&(r.displayAspectWidth=this.internalTrack.info.squarePixelWidth,r.displayAspectHeight=this.internalTrack.info.squarePixelHeight),r})()):null}}class LV extends AC{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getType(){return"audio"}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfig??(this.decoderConfig={codec:ng({codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,aacCodecInfo:this.internalTrack.info.aacCodecInfo}),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}):null}}/*!
619 * Copyright (c) 2026-present, Vanilagy and contributors
620 *
621 * This Source Code Form is subject to the terms of the Mozilla Public
622 * License, v. 2.0. If a copy of the MPL was not distributed with this
623 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
624 */const xg=async(t,e,n,r=null)=>{let s=e;for(;n===null||s<n;){const a=n!==null?Math.min(65536,n-s):65536;let o=t.requestSliceRange(s,Cs,a);if(o instanceof Promise&&(o=await o),!o||o.length<Cs)break;for(;o.remainingLength>=Cs;){const c=o.filePos,u=J(o),l=t.fileSize!==null?t.fileSize-s:null,d=_d(u,l);if(d.header&&(!r||d.header.sampleRate===r.sampleRate&&d.header.mpegVersionId===r.mpegVersionId&&d.header.layer===r.layer&&vc(d.header.channel)===vc(r.channel)))return{header:d.header,startPos:s};o.filePos=c+d.bytesAdvanced,s=o.filePos}}return null};/*!
625 * Copyright (c) 2026-present, Vanilagy and contributors
626 *
627 * This Source Code Form is subject to the terms of the Mozilla Public
628 * License, v. 2.0. If a copy of the MPL was not distributed with this
629 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
630 */class zV extends Xr{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.firstFrameHeaderPos=null,this.loadedSamples=[],this.metadataTags=null,this.xingData=null,this.trackBackings=[],this.readingMutex=new ks,this.lastSampleLoaded=!1,this.lastLoadedPos=0,this.nextTimestampInSamples=0,this.reader=e._reader}async readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{for(;!this.firstFrameHeader&&!this.lastSampleLoaded;)await this.advanceReader();if(!this.firstFrameHeader)throw new Error("No valid MP3 frame found.");this.trackBackings=[new QV(this)]})())}async advanceReader(){if(this.lastLoadedPos===0)for(;;){let o=this.reader.requestSlice(this.lastLoadedPos,ai);if(o instanceof Promise&&(o=await o),!o){this.lastSampleLoaded=!0;return}const c=Ls(o);if(!c)break;this.lastLoadedPos=o.filePos+c.size}const e=await xg(this.reader,this.lastLoadedPos,this.reader.fileSize,this.firstFrameHeader);if(!e){this.lastSampleLoaded=!0;return}const n=e.header;this.lastLoadedPos=e.startPos+n.totalSize-1;const r=Sd(n.mpegVersionId,n.channel);let i=this.reader.requestSlice(e.startPos+r,4);if(i instanceof Promise&&(i=await i),i){const o=J(i);if(o===Ed||o===ig){if(!this.xingData){let u=this.reader.requestSlice(e.startPos+r+4,12);if(u instanceof Promise&&(u=await u),u){const l=de(u,12),d=_e(l),f=d.getUint32(0,!1);this.xingData={frameCount:f&xs.FrameCount?d.getUint32(4,!1):null,fileSize:f&xs.FileSize?d.getUint32(8,!1):null}}}return}}this.firstFrameHeader||(this.firstFrameHeader=n,this.firstFrameHeaderPos=e.startPos);const s=n.audioSamplesInFrame/this.firstFrameHeader.sampleRate,a={timestamp:this.nextTimestampInSamples/this.firstFrameHeader.sampleRate,duration:s,dataStart:e.startPos,dataSize:n.totalSize};this.loadedSamples.push(a),this.nextTimestampInSamples+=n.audioSamplesInFrame}async getMimeType(){return"audio/mpeg"}async getTrackBackings(){return await this.readMetadata(),this.trackBackings}async getMetadataTags(){const e=await this.readingMutex.acquire();try{if(await this.readMetadata(),this.metadataTags)return this.metadataTags;this.metadataTags={};let n=0,r=!1;for(;;){let i=this.reader.requestSlice(n,ai);if(i instanceof Promise&&(i=await i),!i)break;const s=Ls(i);if(!s)break;r=!0;let a=this.reader.requestSlice(i.filePos,s.size);if(a instanceof Promise&&(a=await a),!a)break;dA(a,s,this.metadataTags),n=i.filePos+s.size}if(!r&&this.reader.fileSize!==null&&this.reader.fileSize>=ef){let i=this.reader.requestSlice(this.reader.fileSize-ef,ef);i instanceof Promise&&(i=await i),b(i),_t(i,3)==="TAG"&&aG(i,this.metadataTags)}return this.metadataTags}finally{e()}}}class QV{constructor(e){this.demuxer=e}getType(){return"audio"}getId(){return 1}getNumber(){return 1}getTimeResolution(){return b(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate/this.demuxer.firstFrameHeader.audioSamplesInFrame}isRelativeToUnixEpoch(){return!1}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){const e=this.demuxer;if(b(e.firstFrameHeader!==null),b(e.firstFrameHeaderPos!==null),e.xingData){if(e.xingData.frameCount!==null)return e.xingData.frameCount*e.firstFrameHeader.audioSamplesInFrame/e.firstFrameHeader.sampleRate}
630else if(e.reader.fileSize!==null){const n=sV(e.firstFrameHeader.lowSamplingFrequency,e.firstFrameHeader.layer,e.firstFrameHeader.bitrate,e.firstFrameHeader.sampleRate),r=(e.reader.fileSize-e.firstFrameHeaderPos)/n;return Math.round(r)*e.firstFrameHeader.audioSamplesInFrame/e.firstFrameHeader.sampleRate}return null}async getLiveRefreshInterval(){return null}getName(){return null}getLanguageCode(){return Kt}getCodec(){return"mp3"}getInternalCodecId(){return null}getNumberOfChannels(){return b(this.demuxer.firstFrameHeader),vc(this.demuxer.firstFrameHeader.channel)}getSampleRate(){return b(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate}getDisposition(){return{...Kr}}async getDecoderConfig(){return b(this.demuxer.firstFrameHeader),{codec:"mp3",numberOfChannels:vc(this.demuxer.firstFrameHeader.channel),sampleRate:this.demuxer.firstFrameHeader.sampleRate}}async getPacketAtIndex(e,n){if(e===-1)return null;const r=this.demuxer.loadedSamples[e];if(!r)return null;let i;if(n.metadataOnly)i=vn;else{let s=this.demuxer.reader.requestSlice(r.dataStart,r.dataSize);if(s instanceof Promise&&(s=await s),!s)return null;i=de(s,r.dataSize)}return new nt(i,"key",r.timestamp,r.duration,e,r.dataSize)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getNextPacket(e,n){const r=await this.demuxer.readingMutex.acquire();try{const i=yc(this.demuxer.loadedSamples,e.timestamp,a=>a.timestamp);if(i===-1)throw new Error("Packet was not created from this track.");const s=i+1;for(;s>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(s,n)}finally{r()}}async getPacket(e,n){const r=await this.demuxer.readingMutex.acquire();try{for(;;){const i=Ge(this.demuxer.loadedSamples,e,s=>s.timestamp);if(i===-1&&this.demuxer.loadedSamples.length>0)return null;if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(i,n);if(i>=0&&i+1<this.demuxer.loadedSamples.length)return this.getPacketAtIndex(i,n);await this.demuxer.advanceReader()}}finally{r()}}getKeyPacket(e,n){return this.getPacket(e,n)}getNextKeyPacket(e,n){return this.getNextPacket(e,n)}}/*!
631 * Copyright (c) 2026-present, Vanilagy and contributors
632 *
633 * This Source Code Form is subject to the terms of the Mozilla Public
634 * License, v. 2.0. If a copy of the MPL was not distributed with this
635 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
636 */const vg=1399285583,HV=79764919,yC=new Uint32Array(256);for(let t=0;t<256;t++){let e=t<<24;for(let n=0;n<8;n++)e=e&2147483648?e<<1^HV:e<<1;yC[t]=e>>>0&4294967295}const wC=t=>{const e=_e(t),n=e.getUint32(22,!0);e.setUint32(22,0,!0);let r=0;for(let i=0;i<t.length;i++){const s=t[i];r=(r<<8^yC[r>>>24^s])>>>0}return e.setUint32(22,n,!0),r},bC=(t,e,n)=>{let r=0,i=null;if(t.length>0)if(e.codec==="vorbis"){b(e.vorbisInfo);const s=e.vorbisInfo.modeBlockflags.length,o=(1<<RW(s-1))-1<<1,c=(t[0]&o)>>1;if(c>=e.vorbisInfo.modeBlockflags.length)throw new Error("Invalid mode number.");let u=n;const l=e.vorbisInfo.modeBlockflags[c];if(i=e.vorbisInfo.blocksizes[l],l===1){const d=(o|1)+1,f=t[0]&d?1:0;u=e.vorbisInfo.blocksizes[f]}r=u!==null?u+i>>2:0}else e.codec==="opus"&&(r=bV(t).durationInSamples);return{durationInSamples:r,vorbisBlockSize:i}},EC=t=>{let e="audio/ogg";if(t.codecStrings){const n=[...new Set(t.codecStrings)];e+=`; codecs="${n.join(", ")}"`}return e};/*!
637 * Copyright (c) 2026-present, Vanilagy and contributors
638 *
639 * This Source Code Form is subject to the terms of the Mozilla Public
640 * License, v. 2.0. If a copy of the MPL was not distributed with this
641 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
642 */const Ps=27,eo=282,SC=eo+65025,Mc=t=>{const e=t.filePos;if(uo(t)!==vg)return null;t.skip(1);const r=ce(t),i=iG(t),s=uo(t),a=uo(t),o=uo(t),c=ce(t),u=new Uint8Array(c);for(let h=0;h<c;h++)u[h]=ce(t);const l=27+c,d=u.reduce((h,m)=>h+m,0),f=l+d;return{headerStartPos:e,totalSize:f,dataStartPos:e+l,dataSize:d,headerType:r,granulePosition:i,serialNumber:s,sequenceNumber:a,checksum:o,lacingValues:u}},WV=(t,e)=>{for(;t.filePos<e-3;){const n=uo(t),r=n&255,i=n>>>8&255,s=n>>>16&255,a=n>>>24&255,o=79;if(!(r!==o&&i!==o&&s!==o&&a!==o)){if(t.skip(-4),n===vg)return!0;t.skip(1)}}return!1};/*!
643 * Copyright (c) 2026-present, Vanilagy and contributors
644 *
645 * This Source Code Form is subject to the terms of the Mozilla Public
646 * License, v. 2.0. If a copy of the MPL was not distributed with this
647 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
648 */class VV extends Xr{constructor(e){super(e),this.metadataPromise=null,this.bitstreams=[],this.trackBackings=[],this.metadataTags={},this.reader=e._reader}async readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{let e=0;for(;;){let n=this.reader.requestSliceRange(e,Ps,eo);if(n instanceof Promise&&(n=await n),!n)break;const r=Mc(n);if(!r||!!!(r.headerType&2))break;
648this.bitstreams.push({serialNumber:r.serialNumber,bosPage:r,description:null,numberOfChannels:-1,sampleRate:-1,codecInfo:{codec:null,vorbisInfo:null,opusInfo:null},lastMetadataPacket:null}),e=r.headerStartPos+r.totalSize}for(const n of this.bitstreams){const r=await this.readPacket(n.bosPage,0);r&&(r.data.byteLength>=7&&r.data[0]===1&&r.data[1]===118&&r.data[2]===111&&r.data[3]===114&&r.data[4]===98&&r.data[5]===105&&r.data[6]===115?await this.readVorbisMetadata(r,n):r.data.byteLength>=8&&r.data[0]===79&&r.data[1]===112&&r.data[2]===117&&r.data[3]===115&&r.data[4]===72&&r.data[5]===101&&r.data[6]===97&&r.data[7]===100&&await this.readOpusMetadata(r,n),n.codecInfo.codec!==null&&this.trackBackings.push(new GV(n,this)))}})())}async readVorbisMetadata(e,n){let r=await this.findNextPacketStart(e);if(!r)return;const i=await this.readPacket(r.startPage,r.startSegmentIndex);if(!i||(r=await this.findNextPacketStart(i),!r))return;const s=await this.readPacket(r.startPage,r.startSegmentIndex);if(!s||i.data[0]!==3||s.data[0]!==5)return;const a=[],o=d=>{for(;a.push(Math.min(255,d)),!(d<255);)d-=255};o(e.data.length),o(i.data.length);const c=new Uint8Array(1+a.length+e.data.length+i.data.length+s.data.length);c[0]=2,c.set(a,1),c.set(e.data,1+a.length),c.set(i.data,1+a.length+e.data.length),c.set(s.data,1+a.length+e.data.length+i.data.length),n.codecInfo.codec="vorbis",n.description=c,n.lastMetadataPacket=s;const u=_e(e.data);n.numberOfChannels=u.getUint8(11),n.sampleRate=u.getUint32(12,!0);const l=u.getUint8(28);n.codecInfo.vorbisInfo={blocksizes:[1<<(l&15),1<<(l>>4)],modeBlockflags:HI(s.data).modeBlockflags},hg(i.data.subarray(7),this.metadataTags)}async readOpusMetadata(e,n){const r=await this.findNextPacketStart(e);if(!r)return;const i=await this.readPacket(r.startPage,r.startSegmentIndex);if(!i)return;n.codecInfo.codec="opus",n.description=e.data,n.lastMetadataPacket=i;const s=xd(e.data);n.numberOfChannels=s.outputChannelCount,n.sampleRate=qa,n.codecInfo.opusInfo={preSkip:s.preSkip},hg(i.data.subarray(8),this.metadataTags)}async readPacket(e,n){b(n<e.lacingValues.length);let r=0;for(let d=0;d<n;d++)r+=e.lacingValues[d];let i=e,s=r,a=n;const o=[];e:for(;;){let d=this.reader.requestSlice(i.dataStartPos,i.dataSize);d instanceof Promise&&(d=await d),b(d);const f=de(d,i.dataSize);for(;;){if(a===i.lacingValues.length){o.push(f.subarray(r,s));break}const m=i.lacingValues[a];if(s+=m,m<255){o.push(f.subarray(r,s));break e}a++}let h=i.headerStartPos+i.totalSize;for(;;){let m=this.reader.requestSliceRange(h,Ps,eo);if(m instanceof Promise&&(m=await m),!m)return null;const p=Mc(m);if(!p)return null;if(i=p,i.serialNumber===e.serialNumber)break;h=i.headerStartPos+i.totalSize}r=0,s=0,a=0}const c=o.reduce((d,f)=>d+f.length,0);if(c===0)return null;const u=new Uint8Array(c);let l=0;for(let d=0;d<o.length;d++){const f=o[d];u.set(f,l),l+=f.length}return{data:u,endPage:i,endSegmentIndex:a}}async findNextPacketStart(e){if(e.endSegmentIndex<e.endPage.lacingValues.length-1)return{startPage:e.endPage,startSegmentIndex:e.endSegmentIndex+1};if(!!(e.endPage.headerType&4))return null;let r=e.endPage.headerStartPos+e.endPage.totalSize;for(;;){let i=this.reader.requestSliceRange(r,Ps,eo);if(i instanceof Promise&&(i=await i),!i)return null;const s=Mc(i);if(!s)return null;if(s.serialNumber===e.endPage.serialNumber)return{startPage:s,startSegmentIndex:0};r=s.headerStartPos+s.totalSize}}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.trackBackings.map(n=>n.getDecoderConfig().then(r=>(r==null?void 0:r.codec)??null)));return EC({codecStrings:e.filter(Boolean)})}async getTrackBackings(){return await this.readMetadata(),this.trackBackings}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}}class GV{constructor(e,n){this.bitstream=e,this.demuxer=n,this.encodedPacketToMetadata=new WeakMap,this.sequentialScanCache=[],this.sequentialScanMutex=new ks,this.internalSampleRate=e.codecInfo.codec==="opus"?qa:e.sampleRate}getType(){return"audio"}getId(){return this.bitstream.serialNumber}getNumber(){const e=this.demuxer.trackBackings.findIndex(n=>n.bitstream===this.bitstream);return b(e!==-1),e+1}getNumberOfChannels(){return this.bitstream.numberOfChannels}getSampleRate(){return this.bitstream.sampleRate}getTimeResolution(){return this.bitstream.sampleRate}isRelativeToUnixEpoch(){return!1}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){return null}
648async getLiveRefreshInterval(){return null}getCodec(){return this.bitstream.codecInfo.codec}getInternalCodecId(){return null}async getDecoderConfig(){return b(this.bitstream.codecInfo.codec),{codec:this.bitstream.codecInfo.codec,numberOfChannels:this.bitstream.numberOfChannels,sampleRate:this.bitstream.sampleRate,description:this.bitstream.description??void 0}}getName(){return null}getLanguageCode(){return Kt}getDisposition(){return{...Kr,primary:!1}}granulePositionToTimestampInSamples(e){return this.bitstream.codecInfo.codec==="opus"?(b(this.bitstream.codecInfo.opusInfo),e-this.bitstream.codecInfo.opusInfo.preSkip):e}createEncodedPacketFromOggPacket(e,n,r){if(!e)return null;const{durationInSamples:i,vorbisBlockSize:s}=bC(e.data,this.bitstream.codecInfo,n.vorbisLastBlocksize),a=new nt(r.metadataOnly?vn:e.data,"key",Math.max(0,n.timestampInSamples)/this.internalSampleRate,i/this.internalSampleRate,e.endPage.headerStartPos+e.endSegmentIndex,e.data.byteLength);return this.encodedPacketToMetadata.set(a,{packet:e,timestampInSamples:n.timestampInSamples,durationInSamples:i,vorbisLastBlockSize:n.vorbisLastBlocksize,vorbisBlockSize:s}),a}async getFirstPacket(e){b(this.bitstream.lastMetadataPacket);const n=await this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket);if(!n)return null;let r=0;this.bitstream.codecInfo.codec==="opus"&&(b(this.bitstream.codecInfo.opusInfo),r-=this.bitstream.codecInfo.opusInfo.preSkip);const i=await this.demuxer.readPacket(n.startPage,n.startSegmentIndex);return this.createEncodedPacketFromOggPacket(i,{timestampInSamples:r,vorbisLastBlocksize:null},e)}async getNextPacket(e,n){const r=this.encodedPacketToMetadata.get(e);if(!r)throw new Error("Packet was not created from this track.");const i=await this.demuxer.findNextPacketStart(r.packet);if(!i)return null;const s=r.timestampInSamples+r.durationInSamples,a=await this.demuxer.readPacket(i.startPage,i.startSegmentIndex);return this.createEncodedPacketFromOggPacket(a,{timestampInSamples:s,vorbisLastBlocksize:r.vorbisBlockSize},n)}async getPacket(e,n){if(this.demuxer.reader.fileSize===null)return this.getPacketSequential(e,n);const r=wc(e*this.internalSampleRate);if(r===0)return this.getFirstPacket(n);if(r<0)return null;b(this.bitstream.lastMetadataPacket);const i=await this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket);if(!i)return null;let s=i.startPage,a=this.demuxer.reader.fileSize;const o=[s];e:for(;s.headerStartPos+s.totalSize<a;){const y=s.headerStartPos,w=Math.floor((y+a)/2);let E=w;for(;;){const S=Math.min(E+SC,a-Ps);let k=this.demuxer.reader.requestSlice(E,S-E);if(k instanceof Promise&&(k=await k),b(k),!WV(k,S)){a=w+Ps;continue e}let C=this.demuxer.reader.requestSliceRange(k.filePos,Ps,eo);C instanceof Promise&&(C=await C),b(C);const _=Mc(C);b(_);let x=!1;if(_.serialNumber===this.bitstream.serialNumber)x=!0;else{let v=this.demuxer.reader.requestSlice(_.headerStartPos,_.totalSize);v instanceof Promise&&(v=await v),b(v);const M=de(v,_.totalSize);x=wC(M)===_.checksum}if(!x){E=_.headerStartPos+4;continue}if(x&&_.serialNumber!==this.bitstream.serialNumber){E=_.headerStartPos+_.totalSize;continue}if(_.granulePosition===-1){E=_.headerStartPos+_.totalSize;continue}this.granulePositionToTimestampInSamples(_.granulePosition)>r?a=_.headerStartPos:(s=_,o.push(_));continue e}}let c=i.startPage;for(const y of o){if(y.granulePosition===s.granulePosition)break;(!c||y.headerStartPos>c.headerStartPos)&&(c=y)}let u=c;const l=[u];for(;!(u.serialNumber===this.bitstream.serialNumber&&u.granulePosition===s.granulePosition);){const y=u.headerStartPos+u.totalSize;let w=this.demuxer.reader.requestSliceRange(y,Ps,eo);w instanceof Promise&&(w=await w),b(w);const E=Mc(w);b(E),u=E,u.serialNumber===this.bitstream.serialNumber&&l.push(u)}b(u.granulePosition!==-1);let d=null,f,h,m=u,p=0;if(u.headerStartPos===i.startPage.headerStartPos)f=this.granulePositionToTimestampInSamples(0),h=!0,d=0;else{f=0,h=!1;for(let E=u.lacingValues.length-1;E>=0;E--)if(u.lacingValues[E]<255){d=E+1;break}if(d===null)throw new Error("Invalid page with granule position: no packets end on this page.");p=d-1;const y={data:vn,endPage:m,endSegmentIndex:p};if(await this.demuxer.findNextPacketStart(y)){const E=TC(l,u,d);b(E);const S=_C(l,E.page,E.segmentIndex);S&&(u=S.page,d=S.segmentIndex)}else for(;;){const E=TC(l,u,d);if(!E)break;const S=_C(l,E.page,E.segmentIndex);if(!S)break;if(u=S.page,d=S.segmentIndex,E.page.headerStartPos!==m.headerStartPos){m=E.page,p=E.segmentIndex;break}}}let g=null,A=null;for(;u!==null;){b(d!==null);const y=await this.demuxer.readPacket(u,d);if(!y)break;if(!(u.headerStartPos===i.startPage.headerStartPos&&d<i.startSegmentIndex)){let S=this.createEncodedPacketFromOggPacket(y,{timestampInSamples:f,vorbisLastBlocksize:(A==null?void 0:A.vorbisBlockSize)??null},n);b(S);let k=this.encodedPacketToMetadata.get(S);if(b(k),!h&&y.endPage.headerStartPos===m.headerStartPos&&y.endSegmentIndex===p?(f=this.granulePositionToTimestampInSamples(u.granulePosition),h=!0,S=this.createEncodedPacketFromOggPacket(y,{timestampInSamples:f-k.durationInSamples,vorbisLastBlocksize:(A==null?void 0:A.vorbisBlockSize)??null},n),b(S),k=this.encodedPacketToMetadata.get(S),b(k)):f+=k.durationInSamples,g=S,A=k,h&&(Math.max(f,0)>r||Math.max(k.timestampInSamples,0)===r))break}const E=await this.demuxer.findNextPacketStart(y);if(!E)break;u=E.startPage,d=E.startSegmentIndex}return g}async getPacketSequential(e,n){const r=await this.sequentialScanMutex.acquire();try{const i=wc(e*this.internalSampleRate);e=i/this.internalSampleRate;const s=Ge(this.sequentialScanCache,i,c=>c.timestampInSamples);let a;if(s!==-1){const c=this.sequentialScanCache[s];a=this.createEncodedPacketFromOggPacket(c.packet,{timestampInSamples:c.timestampInSamples,vorbisLastBlocksize:c.vorbisLastBlockSize},n)}else a=await this.getFirstPacket(n);let o=0;for(;a&&a.timestamp<e;){const c=await this.getNextPacket(a,n);if(!c||c.timestamp>e)break;if(a=c,o++,o===100){o=0;const u=this.encodedPacketToMetadata.get(a);b(u),this.sequentialScanCache.length>0&&b(yt(this.sequentialScanCache).timestampInSamples<=u.timestampInSamples),this.sequentialScanCache.push(u)}}return a}finally{r()}}getKeyPacket(e,n){return this.getPacket(e,n)}getNextKeyPacket(e,n){return this.getNextPacket(e,n)}}const _C=(t,e,n)=>{let r=e,i=n;e:for(;;){for(i--,i;i>=0;i--)if(r.lacingValues[i]<255){i++;break e}if(b(i===-1),!(r.headerType&1)){i=0;break}const a=fI(t,o=>o.headerStartPos<r.headerStartPos);if(!a)return null;r=a,i=r.lacingValues.length}if(b(i!==-1),i===r.lacingValues.length){const s=t[t.indexOf(r)+1];b(s),r=s,i=0}return{page:r,segmentIndex:i}},TC=(t,e,n)=>{if(n>0)return{page:e,segmentIndex:n-1};const r=fI(t,i=>i.headerStartPos<e.headerStartPos);return r?{page:r,segmentIndex:r.lacingValues.length-1}:null};/*!
649 * Copyright (c) 2026-present, Vanilagy and contributors
650 *
651 * This Source Code Form is subject to the terms of the Mozilla Public
652 * License, v. 2.0. If a copy of the MPL was not distributed with this
653 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
654 */var Pn;(function(t){t[t.PCM=1]="PCM",t[t.IEEE_FLOAT=3]="IEEE_FLOAT",t[t.ALAW=6]="ALAW",t[t.MULAW=7]="MULAW",t[t.EXTENSIBLE=65534]="EXTENSIBLE"})(Pn||(Pn={}));class qV extends Xr{constructor(e){super(e),this.metadataPromise=null,this.dataStart=-1,this.dataSize=-1,this.audioInfo=null,this.trackBackings=[],this.lastKnownPacketIndex=0,this.metadataTags={},this.reader=e._reader}async readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{let e=this.reader.requestSlice(0,12);e instanceof Promise&&(e=await e),b(e);const n=_t(e,4),r=n!=="RIFX",i=n==="RF64",s=qi(e,r);let a=i?this.reader.fileSize:Math.min(s+8,this.reader.fileSize??1/0);if(_t(e,4)!=="WAVE")throw new Error("Invalid WAVE file - wrong format");let c=0,u=null,l=e.filePos;for(;a===null||l<a;){let f=this.reader.requestSlice(l,8);if(f instanceof Promise&&(f=await f),!f)break;const h=_t(f,4),m=qi(f,r),p=f.filePos;if(i&&c===0&&h!=="ds64")throw new Error('Invalid RF64 file: First chunk must be "ds64".');if(h==="fmt ")await this.parseFmtChunk(p,m,r);else if(h==="data"){if(u??(u=m),this.dataStart=f.filePos,this.dataSize=Math.min(u,(a??1/0)-this.dataStart),this.reader.fileSize===null)break}else if(h==="ds64"){let g=this.reader.requestSlice(p,m);if(g instanceof Promise&&(g=await g),!g)break;const A=Gx(g,r);u=Gx(g,r),a=Math.min(A+8,this.reader.fileSize??1/0)}else h==="LIST"?await this.parseListChunk(p,m,r):(h==="ID3 "||h==="id3 ")&&await this.parseId3Chunk(p,m);l=p+m+(m&1),c++}if(!this.audioInfo)throw new Error('Invalid WAVE file - missing "fmt " chunk');if(this.dataStart===-1)throw new Error('Invalid WAVE file - missing "data" chunk');const d=this.audioInfo.blockSizeInBytes;this.dataSize=Math.floor(this.dataSize/d)*d,this.trackBackings.push(new YV(this))})())}async parseFmtChunk(e,n,r){let i=this.reader.requestSlice(e,n);if(i instanceof Promise&&(i=await i),!i)return;let s=Kc(i,r);const a=Kc(i,r),o=qi(i,r);i.skip(4);const c=Kc(i,r);let u;if(n===14?u=8:u=Kc(i,r),n>=18&&s!==357){const l=Kc(i,r),d=n-18;if(Math.min(d,l)>=22&&s===Pn.EXTENSIBLE){i.skip(6);const h=de(i,16);s=h[0]|h[1]<<8}}(s===Pn.MULAW||s===Pn.ALAW)&&(u=8),this.audioInfo={format:s,numberOfChannels:a,sampleRate:o,sampleSizeInBytes:Math.ceil(u/8),blockSizeInBytes:c}
654}async parseListChunk(e,n,r){var o,c,u,l,d,f,h,m,p,g,A;let i=this.reader.requestSlice(e,n);if(i instanceof Promise&&(i=await i),!i)return;const s=_t(i,4);if(s!=="INFO"&&s!=="INF0")return;let a=i.filePos;for(;a<=e+n-8;){i.filePos=a;const y=_t(i,4),w=qi(i,r),E=de(i,w);let S=0;for(let T=0;T<E.length&&E[T]!==0;T++)S++;const k=String.fromCharCode(...E.subarray(0,S));switch((o=this.metadataTags).raw??(o.raw={}),this.metadataTags.raw[y]=k,y){case"INAM":case"TITL":(c=this.metadataTags).title??(c.title=k);break;case"TIT3":(u=this.metadataTags).description??(u.description=k);break;case"IART":(l=this.metadataTags).artist??(l.artist=k);break;case"IPRD":(d=this.metadataTags).album??(d.album=k);break;case"IPRT":case"ITRK":case"TRCK":{const T=k.split("/"),C=Number.parseInt(T[0],10),_=T[1]&&Number.parseInt(T[1],10);Number.isInteger(C)&&C>0&&((f=this.metadataTags).trackNumber??(f.trackNumber=C)),_&&Number.isInteger(_)&&_>0&&((h=this.metadataTags).tracksTotal??(h.tracksTotal=_))}break;case"ICRD":case"IDIT":{const T=new Date(k);Number.isNaN(T.getTime())||((m=this.metadataTags).date??(m.date=T))}break;case"YEAR":{const T=Number.parseInt(k,10);Number.isInteger(T)&&T>0&&((p=this.metadataTags).date??(p.date=new Date(T,0,1)))}break;case"IGNR":case"GENR":(g=this.metadataTags).genre??(g.genre=k);break;case"ICMT":case"CMNT":case"COMM":(A=this.metadataTags).comment??(A.comment=k);break}a+=8+w+(w&1)}}async parseId3Chunk(e,n){let r=this.reader.requestSlice(e,n);if(r instanceof Promise&&(r=await r),!r)return;const i=Ls(r);if(i){const s=n-ai;if(i.size=Math.min(i.size,s),i.size>0){const a=r.slice(e+ai,i.size);dA(a,i,this.metadataTags)}}}getCodec(){if(b(this.audioInfo),this.audioInfo.format===Pn.MULAW)return"ulaw";if(this.audioInfo.format===Pn.ALAW)return"alaw";if(this.audioInfo.format===Pn.PCM){if(this.audioInfo.sampleSizeInBytes===1)return"pcm-u8";if(this.audioInfo.sampleSizeInBytes===2)return"pcm-s16";if(this.audioInfo.sampleSizeInBytes===3)return"pcm-s24";if(this.audioInfo.sampleSizeInBytes===4)return"pcm-s32"}return this.audioInfo.format===Pn.IEEE_FLOAT&&this.audioInfo.sampleSizeInBytes===4?"pcm-f32":null}async getMimeType(){return"audio/wav"}async getTrackBackings(){return await this.readMetadata(),this.trackBackings}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}}const to=2048;class YV{constructor(e){this.demuxer=e}getType(){return"audio"}getId(){return 1}getNumber(){return 1}getCodec(){return this.demuxer.getCodec()}getInternalCodecId(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.format}async getDecoderConfig(){const e=this.demuxer.getCodec();return e?(b(this.demuxer.audioInfo),{codec:e,numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate}):null}getNumberOfChannels(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}getSampleRate(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getTimeResolution(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}isRelativeToUnixEpoch(){return!1}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){return b(this.demuxer.dataSize!==-1),this.demuxer.dataSize/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate}
654async getLiveRefreshInterval(){return null}getName(){return null}getLanguageCode(){return Kt}getDisposition(){return{...Kr}}async getPacketAtIndex(e,n){b(e>=0),b(this.demuxer.audioInfo);const r=e*to*this.demuxer.audioInfo.blockSizeInBytes;if(r>=this.demuxer.dataSize)return null;const i=Math.min(to*this.demuxer.audioInfo.blockSizeInBytes,this.demuxer.dataSize-r);if(this.demuxer.reader.fileSize===null){let c=this.demuxer.reader.requestSlice(this.demuxer.dataStart+r,i);if(c instanceof Promise&&(c=await c),!c)return null}let s;if(n.metadataOnly)s=vn;else{let c=this.demuxer.reader.requestSlice(this.demuxer.dataStart+r,i);c instanceof Promise&&(c=await c),b(c),s=de(c,i)}const a=e*to/this.demuxer.audioInfo.sampleRate,o=i/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate;return this.demuxer.lastKnownPacketIndex=Math.max(e,this.demuxer.lastKnownPacketIndex),new nt(s,"key",a,o,e,i)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getPacket(e,n){b(this.demuxer.audioInfo);const r=Math.floor(Math.min(e*this.demuxer.audioInfo.sampleRate/to,(this.demuxer.dataSize-1)/(to*this.demuxer.audioInfo.blockSizeInBytes)));if(r<0)return null;const i=await this.getPacketAtIndex(r,n);if(i)return i;if(r===0)return null;b(this.demuxer.reader.fileSize===null);let s=await this.getPacketAtIndex(this.demuxer.lastKnownPacketIndex,n);for(;s;){const a=await this.getNextPacket(s,n);if(!a)break;s=a}return s}getNextPacket(e,n){b(this.demuxer.audioInfo);const r=Math.round(e.timestamp*this.demuxer.audioInfo.sampleRate/to);return this.getPacketAtIndex(r+1,n)}getKeyPacket(e,n){return this.getPacket(e,n)}getNextKeyPacket(e,n){return this.getNextPacket(e,n)}}/*!
655 * Copyright (c) 2026-present, Vanilagy and contributors
656 *
657 * This Source Code Form is subject to the terms of the Mozilla Public
658 * License, v. 2.0. If a copy of the MPL was not distributed with this
659 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
660 */const Dc=7,Vi=9,ri=t=>{const e=t.filePos,n=de(t,9),r=new Me(n);if(r.readBits(12)!==4095||(r.skipBits(1),r.readBits(2)!==0))return null;const a=r.readBits(1),o=r.readBits(2)+1,c=r.readBits(4);if(c===15)return null;r.skipBits(1);const u=r.readBits(3);if(u===0)throw new Error("ADTS frames with channel configuration 0 are not supported.");r.skipBits(1),r.skipBits(1),r.skipBits(1),r.skipBits(1);const l=r.readBits(13);r.skipBits(11);const d=r.readBits(2)+1;if(d!==1)throw new Error("ADTS frames with more than one AAC frame are not supported.");let f=null;return a===1?t.filePos-=2:f=r.readBits(16),{objectType:o,samplingFrequencyIndex:c,channelConfiguration:u,frameLength:l,numberOfAacFrames:d,crcCheck:f,startPos:e}};/*!
661 * Copyright (c) 2026-present, Vanilagy and contributors
662 *
663 * This Source Code Form is subject to the terms of the Mozilla Public
664 * License, v. 2.0. If a copy of the MPL was not distributed with this
665 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
666 */const Md=1024;class KV extends Xr{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.metadataTags=null,this.trackBackings=[],this.readingMutex=new ks,this.lastSampleLoaded=!1,this.lastLoadedPos=0,this.nextTimestampInSamples=0,this.reader=e._reader}async readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{for(;!this.firstFrameHeader&&!this.lastSampleLoaded;)await this.advanceReader();b(this.firstFrameHeader),this.trackBackings=[new jV(this)]})())}async advanceReader(){if(this.lastLoadedPos===0)for(;;){let a=this.reader.requestSlice(this.lastLoadedPos,ai);if(a instanceof Promise&&(a=await a),!a){this.lastSampleLoaded=!0;return}const o=Ls(a);if(!o)break;this.lastLoadedPos=a.filePos+o.size}let e=this.reader.requestSliceRange(this.lastLoadedPos,Dc,Vi);if(e instanceof Promise&&(e=await e),!e){this.lastSampleLoaded=!0;return}const n=ri(e);if(!n){this.lastSampleLoaded=!0;return}if(this.reader.fileSize!==null&&n.startPos+n.frameLength>this.reader.fileSize){this.lastSampleLoaded=!0;return}this.firstFrameHeader||(this.firstFrameHeader=n);const r=Oi[n.samplingFrequencyIndex];b(r!==void 0);const i=Md/r,s={timestamp:this.nextTimestampInSamples/r,duration:i,dataStart:n.startPos,dataSize:n.frameLength};this.loadedSamples.push(s),this.nextTimestampInSamples+=Md,this.lastLoadedPos=n.startPos+n.frameLength}async getMimeType(){return"audio/aac"}async getTrackBackings(){return await this.readMetadata(),this.trackBackings}async getMetadataTags(){const e=await this.readingMutex.acquire();try{if(await this.readMetadata(),this.metadataTags)return this.metadataTags;this.metadataTags={};let n=0;for(;;){let r=this.reader.requestSlice(n,ai);if(r instanceof Promise&&(r=await r),!r)break;const i=Ls(r);if(!i)break;let s=this.reader.requestSlice(r.filePos,i.size);if(s instanceof Promise&&(s=await s),!s)break;dA(s,i,this.metadataTags),n=r.filePos+i.size}return this.metadataTags}finally{e()}}}class jV{constructor(e){this.demuxer=e}getType(){return"audio"}getId(){return 1}getNumber(){return 1}
vendor: 4,551 bytes, lines 666-678
666getTimeResolution(){return this.getSampleRate()/Md}isRelativeToUnixEpoch(){return!1}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){return null}async getLiveRefreshInterval(){return null}getName(){return null}getLanguageCode(){return Kt}getCodec(){return"aac"}getInternalCodecId(){return b(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.objectType}getNumberOfChannels(){b(this.demuxer.firstFrameHeader);const e=Ga[this.demuxer.firstFrameHeader.channelConfiguration];return b(e!==void 0),e}getSampleRate(){b(this.demuxer.firstFrameHeader);const e=Oi[this.demuxer.firstFrameHeader.samplingFrequencyIndex];return b(e!==void 0),e}getDisposition(){return{...Kr}}async getDecoderConfig(){return b(this.demuxer.firstFrameHeader),{codec:`mp4a.40.${this.demuxer.firstFrameHeader.objectType}`,numberOfChannels:this.getNumberOfChannels(),sampleRate:this.getSampleRate()}}async getPacketAtIndex(e,n){if(e===-1)return null;const r=this.demuxer.loadedSamples[e];if(!r)return null;let i;if(n.metadataOnly)i=vn;else{let s=this.demuxer.reader.requestSlice(r.dataStart,r.dataSize);if(s instanceof Promise&&(s=await s),!s)return null;i=de(s,r.dataSize)}return new nt(i,"key",r.timestamp,r.duration,e,r.dataSize)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getNextPacket(e,n){const r=await this.demuxer.readingMutex.acquire();try{const i=yc(this.demuxer.loadedSamples,e.timestamp,a=>a.timestamp);if(i===-1)throw new Error("Packet was not created from this track.");const s=i+1;for(;s>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(s,n)}finally{r()}}async getPacket(e,n){const r=await this.demuxer.readingMutex.acquire();try{for(;;){const i=Ge(this.demuxer.loadedSamples,e,s=>s.timestamp);if(i===-1&&this.demuxer.loadedSamples.length>0)return null;if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(i,n);if(i>=0&&i+1<this.demuxer.loadedSamples.length)return this.getPacketAtIndex(i,n);await this.demuxer.advanceReader()}}finally{r()}}getKeyPacket(e,n){return this.getPacket(e,n)}getNextKeyPacket(e,n){return this.getNextPacket(e,n)}}/*!
667 * Copyright (c) 2026-present, Vanilagy and contributors
668 *
669 * This Source Code Form is subject to the terms of the Mozilla Public
670 * License, v. 2.0. If a copy of the MPL was not distributed with this
671 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
672 */const kC=t=>t===0?null:t===1?192:t>=2&&t<=5?144*2**t:t===6?"uncommon-u8":t===7?"uncommon-u16":t>=8&&t<=15?2**t:null,$V=(t,e)=>{switch(t){case 0:return e;case 1:return 88200;case 2:return 176400;case 3:return 192e3;case 4:return 8e3;case 5:return 16e3;case 6:return 22050;case 7:return 24e3;case 8:return 32e3;case 9:return 44100;case 10:return 48e3;case 11:return 96e3;case 12:return"uncommon-u8";case 13:return"uncommon-u16";case 14:return"uncommon-u16-10";default:return null}},IC=t=>{let e=0;const n=new Me(de(t,1));for(;n.readBits(1)===1;)e++;if(e===0)return n.readBits(7);const r=[],i=e-1,s=new Me(de(t,i)),a=8-e-1;for(let c=0;c<a;c++)r.unshift(n.readBits(1));for(let c=0;c<i;c++)for(let u=0;u<8;u++){const l=s.readBits(1);u<2||r.unshift(l)}return r.reduce((c,u,l)=>c|u<<l,0)},CC=(t,e)=>{if(e==="uncommon-u16")return Mt(t)+1;if(e==="uncommon-u8")return ce(t)+1;if(typeof e=="number")return e;rn(e),b(!1)},XV=(t,e)=>e==="uncommon-u16"?Mt(t):e==="uncommon-u16-10"?Mt(t)*10:e==="uncommon-u8"?ce(t):typeof e=="number"?e:null,JV=t=>{let n=0;for(const r of t){n^=r;for(let i=0;i<8;i++)(n&128)!==0?n=n<<1^7:n<<=1,n&=255}return n};/*!
673 * Copyright (c) 2026-present, Vanilagy and contributors
674 *
675 * This Source Code Form is subject to the terms of the Mozilla Public
676 * License, v. 2.0. If a copy of the MPL was not distributed with this
677 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
678 */class ZV extends Xr{constructor(e){super(e),this.loadedSamples=[],this.metadataPromise=null,this.trackBacking=null,this.metadataTags={},this.audioInfo=null,this.lastLoadedPos=null,this.blockingBit=null,this.readingMutex=new ks,this.lastSampleLoaded=!1,this.reader=e._reader}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}async getTrackBackings(){return await this.readMetadata(),b(this.trackBacking),[this.trackBacking]}async getMimeType(){return"audio/flac"}async readMetadata(){let e=4;return this.metadataPromise??(this.metadataPromise=(async()=>{var n;for(;this.reader.fileSize===null||e<this.reader.fileSize;){let r=this.reader.requestSlice(e,4);
678if(r instanceof Promise&&(r=await r),e+=4,r===null)throw new Error(`Metadata block at position ${e} is too small! Corrupted file.`);b(r);const i=ce(r),s=si(r),a=(i&128)!==0;switch(i&127){case $r.STREAMINFO:{let c=this.reader.requestSlice(e,s);if(c instanceof Promise&&(c=await c),b(c),c===null)throw new Error(`StreamInfo block at position ${e} is too small! Corrupted file.`);const u=de(c,34),l=new Me(u),d=l.readBits(16),f=l.readBits(16),h=l.readBits(24),m=l.readBits(24),p=l.readBits(20),g=l.readBits(3)+1;l.readBits(5);const A=l.readBits(36);l.skipBits(128);const y=new Uint8Array(42);y.set(new Uint8Array([102,76,97,67]),0),y.set(new Uint8Array([128,0,0,34]),4),y.set(u,8),this.audioInfo={numberOfChannels:g,sampleRate:p,totalSamples:A,minimumBlockSize:d,maximumBlockSize:f,minimumFrameSize:h,maximumFrameSize:m,description:y},this.trackBacking=new e5(this);break}case $r.VORBIS_COMMENT:{let c=this.reader.requestSlice(e,s);c instanceof Promise&&(c=await c),b(c),hg(de(c,s),this.metadataTags);break}case $r.PICTURE:{let c=this.reader.requestSlice(e,s);c instanceof Promise&&(c=await c),b(c);const u=J(c),l=J(c),d=xn.decode(de(c,l)),f=J(c),h=xn.decode(de(c,f));c.skip(16);const m=J(c),p=de(c,m);(n=this.metadataTags).images??(n.images=[]),this.metadataTags.images.push({data:p,mimeType:d,kind:u===3?"coverFront":u===4?"coverBack":"unknown",description:h});break}}if(e+=s,a){this.lastLoadedPos=e;break}}if(!this.audioInfo)throw new Error("Missing STREAMINFO metadata block! Corrupted FLAC file.")})())}async readNextFlacFrame({startPos:e,isFirstPacket:n}){b(this.audioInfo);const r=6,i=16,s=10,a=this.audioInfo.maximumBlockSize*this.audioInfo.numberOfChannels*4+i+2,o=this.audioInfo.minimumFrameSize||s,u=(this.audioInfo.maximumFrameSize||a)+i,l=await this.reader.requestSliceRange(e,i,u);if(!l)return null;const d=this.readFlacFrameHeader({slice:l,isFirstPacket:n});if(!d)return null;for(l.filePos=e+o;;){if(l.filePos>l.end-r)return{num:d.num,blockSize:d.blockSize,sampleRate:d.sampleRate,size:l.end-e,isLastFrame:!0};if(ce(l)===255){const h=l.filePos,m=ce(l),p=this.blockingBit===1?249:248;if(m!==p){l.filePos=h;continue}l.skip(-2);const g=l.filePos-e,A=this.readFlacFrameHeader({slice:l,isFirstPacket:!1});if(!A){l.filePos=h;continue}if(this.blockingBit===0){if(A.num-d.num!==1){l.filePos=h;continue}}else if(A.num-d.num!==d.blockSize){l.filePos=h;continue}return{num:d.num,blockSize:d.blockSize,sampleRate:d.sampleRate,size:g,isLastFrame:!1}}}}readFlacFrameHeader({slice:e,isFirstPacket:n}){const r=e.filePos,i=de(e,4),s=new Me(i);if(s.readBits(15)!==32764)return null;if(this.blockingBit===null){b(n);const g=s.readBits(1);this.blockingBit=g}else if(this.blockingBit===1){if(b(!n),s.readBits(1)!==1)return null}else if(this.blockingBit===0){if(b(!n),s.readBits(1)!==0)return null}else throw new Error("Invalid blocking bit");const o=kC(s.readBits(4));if(!o)return null;b(this.audioInfo);const c=$V(s.readBits(4),this.audioInfo.sampleRate);if(!c||(s.readBits(4),s.readBits(3),s.readBits(1)!==0))return null;const l=IC(e),d=CC(e,o),f=XV(e,c);if(f===null||f!==this.audioInfo.sampleRate)return null;const h=e.filePos-r,m=ce(e);e.skip(-h),e.skip(-1);const p=JV(de(e,h));return m!==p?null:{num:l,blockSize:d,sampleRate:f}}async advanceReader(){await this.readMetadata(),b(this.lastLoadedPos!==null),b(this.audioInfo);const e=this.lastLoadedPos,n=await this.readNextFlacFrame({startPos:e,isFirstPacket:this.loadedSamples.length===0});if(!n){this.lastSampleLoaded=!0;return}const r=this.loadedSamples[this.loadedSamples.length-1],s={blockOffset:r?r.blockOffset+r.blockSize:0,blockSize:n.blockSize,byteOffset:e,byteSize:n.size};if(this.lastLoadedPos=this.lastLoadedPos+n.size,this.loadedSamples.push(s),n.isLastFrame){this.lastSampleLoaded=!0;return}}}class e5{constructor(e){this.demuxer=e}getType(){return"audio"}getId(){return 1}getNumber(){return 1}getCodec(){return"flac"}getInternalCodecId(){return null}getNumberOfChannels(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}getSampleRate(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getName(){return null}getLanguageCode(){return Kt}
678getTimeResolution(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}isRelativeToUnixEpoch(){return!1}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){return b(this.demuxer.audioInfo),this.demuxer.audioInfo.totalSamples===0?null:this.demuxer.audioInfo.totalSamples/this.demuxer.audioInfo.sampleRate}async getLiveRefreshInterval(){return null}getDisposition(){return{...Kr}}async getDecoderConfig(){return b(this.demuxer.audioInfo),{codec:"flac",numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate,description:this.demuxer.audioInfo.description}}async getPacket(e,n){if(b(this.demuxer.audioInfo),e<0)return null;const r=await this.demuxer.readingMutex.acquire();try{for(;;){const i=Ge(this.demuxer.loadedSamples,e,c=>c.blockOffset/this.demuxer.audioInfo.sampleRate);if(i===-1){await this.demuxer.advanceReader();continue}const s=this.demuxer.loadedSamples[i],a=s.blockOffset/this.demuxer.audioInfo.sampleRate,o=s.blockSize/this.demuxer.audioInfo.sampleRate;if(a+o<=e){if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(this.demuxer.loadedSamples.length-1,n);await this.demuxer.advanceReader();continue}return this.getPacketAtIndex(i,n)}}finally{r()}}async getNextPacket(e,n){const r=await this.demuxer.readingMutex.acquire();try{const i=e.sequenceNumber+1;if(this.demuxer.lastSampleLoaded&&i>=this.demuxer.loadedSamples.length)return null;for(;i>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(i,n)}finally{r()}}getKeyPacket(e,n){return this.getPacket(e,n)}getNextKeyPacket(e,n){return this.getNextPacket(e,n)}async getPacketAtIndex(e,n){const r=this.demuxer.loadedSamples[e];if(!r)return null;let i;if(n.metadataOnly)i=vn;else{let o=this.demuxer.reader.requestSlice(r.byteOffset,r.byteSize);if(o instanceof Promise&&(o=await o),!o)return null;i=de(o,r.byteSize)}b(this.demuxer.audioInfo);const s=r.blockOffset/this.demuxer.audioInfo.sampleRate,a=r.blockSize/this.demuxer.audioInfo.sampleRate;return new nt(i,"key",s,a,e,r.byteSize)}async getFirstPacket(e){for(;this.demuxer.loadedSamples.length===0&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(0,e)}}/*!
679 * Copyright (c) 2026-present, Vanilagy and contributors
680 *
681 * This Source Code Form is subject to the terms of the Mozilla Public
682 * License, v. 2.0. If a copy of the MPL was not distributed with this
683 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
684 */const ar=9e4,hn=188,xC=t=>{let e="video/MP2T";const n=[...new Set(t.filter(Boolean))];return n.length>0&&(e+=`; codecs="${n.join(", ")}"`),e};/*!
685 * Copyright (c) 2026-present, Vanilagy and contributors
686 *
687 * This Source Code Form is subject to the terms of the Mozilla Public
688 * License, v. 2.0. If a copy of the MPL was not distributed with this
689 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
690 */const vC="PES packet is missing PTS where it was expected. PES packets without PTS are not currently supported. If you think this file should be supported, please report it.",BC=new Set;class t5 extends Xr{constructor(e){super(e),this.metadataPromise=null,this.elementaryStreams=[],this.trackBackingEntries=[],this.packetOffset=0,this.packetStride=-1,this.sectionEndPositions=[],this.seekChunkSize=5*1024*1024,this.minReferencePointByteDistance=-1,this.reader=e._reader}async readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{const e=hn+16+1;let n=this.reader.requestSlice(0,e);n instanceof Promise&&(n=await n),b(n);const r=de(n,e);if(r[0]===71&&r[hn]===71)this.packetOffset=0,this.packetStride=hn;else if(r[0]===71&&r[hn+16]===71)this.packetOffset=0,this.packetStride=hn+16;else if(r[4]===71&&r[4+hn+4]===71)this.packetOffset=4,this.packetStride=hn+4;else throw new Error("Unreachable.");const i=256;this.minReferencePointByteDistance=i*this.packetStride;let s=this.packetOffset,a=null,o=!1,c=!1;for(;;){const u=await this.readPacketHeader(s);if(!u)break;if(u.payloadUnitStartIndicator===0){s+=this.packetStride;
690continue}const l=await this.readSection(s,!0,!c);if(!l)break;const d=3,f=32;let h=!1;if(!c&&l.pid!==0&&!(l.payload[0]===0&&l.payload[1]===0&&l.payload[2]===1)){const g=new Me(l.payload),A=g.readAlignedByte();g.skipBits(8*A),h=g.readBits(8)===2}if(l.pid===0&&!o){const p=new Me(l.payload),g=p.readAlignedByte();p.skipBits(8*g),p.skipBits(14);const A=p.readBits(10);for(p.skipBits(40);8*(A+d)-p.pos>f;){const y=p.readBits(16);p.skipBits(3);const w=p.readBits(13);if(y!==0){if(a!==null)throw new Error("Only files with a single program are supported.");a=w}}if(a===null)throw new Error("Program Association Table must link to a Program Map Table.");o=!0}else if((l.pid===a||h)&&!c){const p=new Me(l.payload),g=p.readAlignedByte();p.skipBits(8*g),p.skipBits(12);const A=p.readBits(12);p.skipBits(43),p.readBits(13),p.skipBits(6);const y=p.readBits(10);for(p.skipBits(8*y);8*(A+d)-p.pos>f;){const w=p.readBits(8);p.skipBits(3);const E=p.readBits(13);p.skipBits(6);const S=p.readBits(10),k=p.pos+8*S;let T=!1,C=!1;for(;p.pos<k;){const x=p.readBits(8),P=p.readBits(8);x===106?T=!0:(x===122||x===204)&&(C=!0),p.skipBits(8*P)}let _=null;switch(w){case 27:case 36:_={type:"video",codec:w===27?"avc":"hevc",decoderConfig:null,avcCodecInfo:null,hevcCodecInfo:null,colorSpace:{primaries:null,transfer:null,matrix:null,fullRange:null},width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,reorderSize:-1};break;case 3:case 4:case 15:case 129:case 135:{let x;if(w===3||w===4)x="mp3";else if(w===15)x="aac";else if(w===129)x="ac3";else if(w===135)x="eac3";else throw new Error("Unreachable.");_={type:"audio",codec:x,decoderConfig:null,aacCodecInfo:null,numberOfChannels:-1,sampleRate:-1}}break;case 6:C?_={type:"audio",codec:"eac3",decoderConfig:null,aacCodecInfo:null,numberOfChannels:-1,sampleRate:-1}:T&&(_={type:"audio",codec:"ac3",decoderConfig:null,aacCodecInfo:null,numberOfChannels:-1,sampleRate:-1});break;default:BC.has(w)||(console.warn(`Note: MPEG-TS streams with stream_type 0x${w.toString(16)} are not currently supported.`),BC.add(w))}_&&this.elementaryStreams.push({demuxer:this,pid:E,streamType:w,initialized:!1,firstSection:null,canBeTrustedWithKeyPackets:!1,info:_,referencePesPackets:[]})}c=!0}else{const p=this.elementaryStreams.find(g=>g.pid===l.pid);e:if(p&&!p.initialized){const g=no(l,!0);if(!g)throw new Error(`Couldn't read first PES packet for Elementary Stream with PID ${p.pid}`);if(p.firstSection=l,p.canBeTrustedWithKeyPackets=l.randomAccessIndicator===1,this.input._initInput){const w=(await this.input._initInput._getDemuxer()).elementaryStreams.find(E=>E.pid===l.pid&&E.info.codec===p.info.codec);if(w){p.info=w.info,p.initialized=!0;break e}}const A=new Oc(p,g);if(p.info.type==="video"){for(;;){const y=A;if(y.suppliedPacket=null,await A.markNextPacket(),p.info.codec==="avc"){if(!A.suppliedPacket)throw new Error("Invalid AVC video stream; could not extract AVCDecoderConfigurationRecord from any packet.");if(p.info.avcCodecInfo=lg(A.suppliedPacket.data),!p.info.avcCodecInfo)continue;const w=p.info.avcCodecInfo.sequenceParameterSets[0];b(w);const E=dg(w);p.info.width=E.displayWidth,p.info.height=E.displayHeight;const S=E.pixelAspectRatio.num,k=E.pixelAspectRatio.den;S>0&&k>0&&(S>k?(p.info.squarePixelWidth=Math.round(p.info.width*S/k),p.info.squarePixelHeight=p.info.height):(p.info.squarePixelWidth=p.info.width,p.info.squarePixelHeight=Math.round(p.info.height*k/S))),p.info.colorSpace={primaries:ud[E.colourPrimaries],transfer:ld[E.transferCharacteristics],matrix:dd[E.matrixCoefficients],fullRange:!!E.fullRangeFlag},p.info.reorderSize=E.maxDecFrameBuffering;break}else if(p.info.codec==="hevc"){if(!A.suppliedPacket)throw new Error("Invalid HEVC video stream; could not extract HVCDecoderConfigurationRecord from first packet.");if(p.info.hevcCodecInfo=fg(A.suppliedPacket.data),!p.info.hevcCodecInfo)continue;const E=p.info.hevcCodecInfo.arrays.find(k=>k.nalUnitType===Rt.SPS_NUT).nalUnits[0];b(E);const S=NI(E);p.info.width=S.displayWidth,p.info.height=S.displayHeight,S.pixelAspectRatio.num>S.pixelAspectRatio.den?(p.info.squarePixelWidth=Math.round(p.info.width*S.pixelAspectRatio.num/S.pixelAspectRatio.den),p.info.squarePixelHeight=p.info.height):(p.info.squarePixelWidth=p.info.width,p.info.squarePixelHeight=Math.round(p.info.height*S.pixelAspectRatio.den/S.pixelAspectRatio.num)),p.info.colorSpace
690={primaries:ud[S.colourPrimaries],transfer:ld[S.transferCharacteristics],matrix:dd[S.matrixCoefficients],fullRange:!!S.fullRangeFlag},p.info.reorderSize=S.maxDecFrameBuffering;break}else throw new Error("Unhandled.")}p.info.decoderConfig={codec:tg({width:p.info.width,height:p.info.height,codec:p.info.codec,codecDescription:null,colorSpace:p.info.colorSpace,avcType:1,avcCodecInfo:p.info.avcCodecInfo,hevcCodecInfo:p.info.hevcCodecInfo,vp9CodecInfo:null,av1CodecInfo:null}),codedWidth:p.info.width,codedHeight:p.info.height,colorSpace:p.info.colorSpace},(p.info.width!==p.info.squarePixelWidth||p.info.height!==p.info.squarePixelHeight)&&(p.info.decoderConfig.displayAspectWidth=p.info.squarePixelWidth,p.info.decoderConfig.displayAspectHeight=p.info.squarePixelHeight),p.initialized=!0}else{if(await A.markNextPacket(),!A.suppliedPacket)throw new Error(`Couldn't parse first media packet for Elementary Stream with PID ${p.pid}`);if(p.info.codec==="aac"){const y=an.tempFromBytes(A.suppliedPacket.data),w=ri(y);if(!w)throw new Error("Invalid AAC audio stream; could not read ADTS frame header from first packet.");p.info.aacCodecInfo={isMpeg2:!1,objectType:w.objectType},p.info.numberOfChannels=Ga[w.channelConfiguration],p.info.sampleRate=Oi[w.samplingFrequencyIndex]}else if(p.info.codec==="mp3"){const y=J(an.tempFromBytes(A.suppliedPacket.data)),w=_d(y,A.suppliedPacket.data.byteLength);if(!w.header)throw new Error("Invalid MP3 audio stream; could not read frame header from first packet.");p.info.numberOfChannels=vc(w.header.channel),p.info.sampleRate=w.header.sampleRate}else if(p.info.codec==="ac3"){const y=WI(A.suppliedPacket.data);if(!y)throw new Error("Invalid AC-3 audio stream; could not read sync frame from first packet.");if(y.fscod===3)throw new Error("Invalid AC-3 audio stream; reserved sample rate code found in first packet.");p.info.numberOfChannels=mg[y.acmod]+y.lfeon,p.info.sampleRate=Td[y.fscod]}else if(p.info.codec==="eac3"){const y=GI(A.suppliedPacket.data);if(!y)throw new Error("Invalid E-AC-3 audio stream; could not read sync frame from first packet.");const w=qI(y);if(w===null)throw new Error("Invalid E-AC-3 audio stream; reserved sample rate code found in first packet.");p.info.numberOfChannels=YI(y),p.info.sampleRate=w}else throw new Error("Unhandled.");p.info.decoderConfig={codec:ng({codec:p.info.codec,codecDescription:null,aacCodecInfo:p.info.aacCodecInfo}),numberOfChannels:p.info.numberOfChannels,sampleRate:p.info.sampleRate},p.initialized=!0}}}if(c&&this.elementaryStreams.every(p=>p.initialized))break;s+=this.packetStride}if(!c)throw o?new Error("No Program Map Table found in the file."):new Error("No Program Association Table found in the file.");for(const u of this.elementaryStreams)u.info.type==="video"?this.trackBackingEntries.push(new n5(u)):this.trackBackingEntries.push(new r5(u))})())}async getTrackBackings(){return await this.readMetadata(),this.trackBackingEntries}async getMetadataTags(){return{}}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.trackBackingEntries.map(n=>n.getDecoderConfig().then(r=>(r==null?void 0:r.codec)??null)));return xC(e)}async readSection(e,n,r=!1){let i=e,s=e;const a=[];let o=0,c=null,u=!0,l=0;for(;;){const f=await this.readPacket(s);if(s+=this.packetStride,!f)break;if(c){if(f.pid!==c.pid){if(r)break;continue}if(f.payloadUnitStartIndicator===1)break}else{if(f.payloadUnitStartIndicator===0)break;c=f}const h=!!(f.adaptationFieldControl&2),m=!!(f.adaptationFieldControl&1);let p=0;if(h&&(p=1+f.body[0],f===c&&p>1&&(l=f.body[1]>>6&1)),m&&(p===0?(a.push(f.body),o+=f.body.byteLength):(a.push(f.body.subarray(p)),o+=f.body.byteLength-p)),i=s,!n&&o>=64){u=!1;break}if(yc(this.sectionEndPositions,i,A=>A)!==-1){u=!1;break}}if(u){const f=Ge(this.sectionEndPositions,i,h=>h);this.sectionEndPositions.splice(f+1,0,i)}if(!c)return null;let d;if(a.length===1)d=a[0];else{const f=a.reduce((m,p)=>m+p.length,0);d=new Uint8Array(f);let h=0;for(const m of a)d.set(m,h),h+=m.length}return{startPos:e,endPos:n?i:null,pid:c.pid,payload:d,randomAccessIndicator:l}}async readPacketHeader(e){let n=this.reader.requestSlice(e,4);
690if(n instanceof Promise&&(n=await n),!n)return null;if(ce(n)!==71)throw new Error("Invalid TS packet sync byte. Likely an internal bug, please report this file.");const i=Mt(n),s=i>>14&1,a=i&8191,c=ce(n)>>4&3;return{payloadUnitStartIndicator:s,pid:a,adaptationFieldControl:c}}async readPacket(e){let n=this.reader.requestSlice(e,hn);if(n instanceof Promise&&(n=await n),!n)return null;const r=de(n,hn);if(r[0]!==71)throw new Error("Invalid TS packet sync byte. Likely an internal bug, please report this file.");const s=(r[1]<<8)+r[2],a=s>>14&1,o=s&8191,u=r[3]>>4&3;return{payloadUnitStartIndicator:a,pid:o,adaptationFieldControl:u,body:r.subarray(4)}}}const Rs=(t,e)=>{if(t.payload.byteLength<3)return null;const n=new Me(t.payload);if(n.readBits(24)!==1)return null;const i=n.readBits(8);if(n.skipBits(16),i===188||i===190||i===191||i===240||i===241||i===255||i===242||i===248)return null;n.skipBits(8);const s=n.readBits(2);n.skipBits(14);let a=null;if(s===2||s===3)a=0,n.skipBits(4),a+=n.readBits(3)*(1<<30),n.skipBits(1),a+=n.readBits(15)*32768,n.skipBits(1),a+=n.readBits(15);else if(e)throw new Error(vC);return{sectionStartPos:t.startPos,sectionEndPos:t.endPos,pts:a,randomAccessIndicator:t.randomAccessIndicator}},no=(t,e)=>{b(t.endPos!==null);const n=Rs(t,e);if(!n)return null;const r=new Me(t.payload);r.skipBits(32);const i=r.readBits(16),s=6;r.skipBits(16);const a=r.readBits(8),o=r.pos+8*a;r.pos=o;const c=o/8;b(Number.isInteger(c));const u=t.payload.subarray(c,i>0?s+i:t.payload.byteLength);return{...n,data:u}};class Dd{constructor(e){this.elementaryStream=e,this.packetBuffers=new WeakMap,this.packetSectionStarts=new WeakMap}getId(){return this.elementaryStream.pid}getNumber(){const e=this.elementaryStream.demuxer,n=this.elementaryStream.info.type;let r=0;for(const i of e.trackBackingEntries)if(i.getType()===n&&r++,b(i instanceof Dd),i.elementaryStream===this.elementaryStream)break;return r}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.elementaryStream.streamType}getName(){return null}getLanguageCode(){return Kt}getDisposition(){return{...Kr,primary:!1}}getTimeResolution(){return ar}isRelativeToUnixEpoch(){return!1}getPairingMask(){return 1n}getBitrate(){return null}getAverageBitrate(){return null}async getDurationFromMetadata(){return null}
690async getLiveRefreshInterval(){return null}createEncodedPacket(e,n,r){let i;return this.allPacketsAreKeyPackets()?i="key":i=e.randomAccessIndicator===1?"key":"delta",new nt(r.metadataOnly?vn:e.data,i,e.pts/ar,Math.max(n/ar,0),e.sequenceNumber,e.data.byteLength)}async getFirstPacket(e){const n=this.elementaryStream.firstSection;b(n);const r=no(n,!0);b(r);const i=new Oc(this.elementaryStream,r),s=new Pg(this,i),a=await s.readNext();if(!a)return null;const o=this.createEncodedPacket(a.packet,a.duration,e);return this.packetBuffers.set(o,s),this.packetSectionStarts.set(o,a.packet.sectionStartPos),o}async getNextPacket(e,n){let r=this.packetBuffers.get(e);if(r){const l=await r.readNext();if(!l)return null;this.packetBuffers.delete(e);const d=this.createEncodedPacket(l.packet,l.duration,n);return this.packetBuffers.set(d,r),this.packetSectionStarts.set(d,l.packet.sectionStartPos),d}const i=this.packetSectionStarts.get(e);if(i===void 0)throw new Error("Packet was not created from this track.");const a=await this.elementaryStream.demuxer.readSection(i,!0);b(a);const o=no(a,!0);b(o);const c=new Oc(this.elementaryStream,o);r=new Pg(this,c);const u=e.sequenceNumber;for(;;){const l=await r.readNext();if(!l)return null;if(l.packet.sequenceNumber>u){const d=this.createEncodedPacket(l.packet,l.duration,n);return this.packetBuffers.set(d,r),this.packetSectionStarts.set(d,l.packet.sectionStartPos),d}}}async getNextKeyPacket(e,n){let r=e;for(;;){if(r=await this.getNextPacket(r,n),!r)return null;if(r.type==="key")return r}}getPacket(e,n){return this.doPacketLookup(e,!1,n)}getKeyPacket(e,n){return this.doPacketLookup(e,!0,n)}async doPacketLookup(e,n,r){var E;const i=wc(e*ar),s=this.elementaryStream.demuxer,{reader:a,seekChunkSize:o}=s,c=this.elementaryStream.pid,u=async(S,k,T)=>{let C=S;for(;C<k;){const _=await s.readPacketHeader(C);if(!_)return null;if(_.pid===c&&_.payloadUnitStartIndicator===1){const x=await s.readSection(C,T);if(!x)return null;const P=Rs(x,!1);if(P&&P.pts!==null)return{pesPacketHeader:P,section:x}}C+=s.packetStride}return null},l=this.elementaryStream.firstSection;b(l);const d=Rs(l,!0);if(b(d),i<d.pts)return null;let f;const h=this.elementaryStream.referencePesPackets,m=Ge(h,i,S=>S.pts),p=m!==-1?h[m]:null;if(p&&i-p.pts<ar/2)f=p.sectionStartPos;else{let S=0;if(a.fileSize!==null){const k=Math.ceil(a.fileSize/o);if(k>1){let T=0,C=k-1;for(S=T;T<=C;){const _=Math.floor((T+C)/2),x=Hm(_*o,s.packetStride)+d.sectionStartPos,P=x+o,v=await u(x,P,!1);if(!v){C=_-1;continue}v.pesPacketHeader.pts<=i?(S=_,T=_+1):C=_-1}}}f=Hm(S*o,s.packetStride)+d.sectionStartPos}const g=await u(f,a.fileSize??1/0,!1);let A=(g==null?void 0:g.pesPacketHeader)??null;A||(A=d);const y=this.getReorderSize(),w=async(S,k)=>{var N;const T=await s.readSection(S,!0);b(T);const C=no(T,!0);b(C);const _=new Oc(this.elementaryStream,C),x=new Pg(this,_);for(;!((((N=yt(x.presentationOrderPackets))==null?void 0:N.pts)??-1/0)>=i||!await x.readNextPacket()););const P=fd(x.presentationOrderPackets,k);if(P===-1)return null;const v=x.presentationOrderPackets[P],M=P===0?0:v.pts-x.presentationOrderPackets[P-1].pts;for(;x.decodeOrderPackets[0]!==v;)x.decodeOrderPackets.shift();x.lastDuration=M;const D=await x.readNext();b(D);const O=this.createEncodedPacket(D.packet,D.duration,r);return this.packetBuffers.set(O,x),this.packetSectionStarts.set(O,D.packet.sectionStartPos),O};if(!n||this.allPacketsAreKeyPackets()){e:for(;;){let S=A.sectionStartPos+s.packetStride;for(;;){const k=await s.readPacketHeader(S);if(!k)break e;if(k.pid===c&&k.payloadUnitStartIndicator===1){const T=await s.readSection(S,!1);if(T){const C=Rs(T,!1);if(C&&C.pts!==null){if(C.pts>i)break e;A=C,Bg(this.elementaryStream,A);break}}}S+=s.packetStride}}e:for(let S=0;S<y+1;S++){let k=A.sectionStartPos-s.packetStride;for(;k>=s.packetOffset;){const T=await s.readPacketHeader(k);if(!T)break e;if(T.pid===c&&T.payloadUnitStartIndicator===1){const C=await s.readSection(k,!1);if(C){const _=Rs(C,!1);if(_&&_.pts!==null){A=_;break}}}k-=s.packetStride}}return w(A.sectionStartPos,S=>S.pts<=i)}else{let S=f,k=null;const T=!this.elementaryStream.canBeTrustedWithKeyPackets;for(;;){let C=null;const _=S<=d.sectionStartPos;let x,P=null;if(_)x=d,P=l;else{const D=await u(S,a.fileSize??1/0,T);x=(D==null?void 0:D.pesPacketHeader)??null,P=(D==null?void 0:D.section)??null}let v=!1,M=0;e:for(;x&&!(k!==null&&x.sectionStartPos>=k);){if(x.pts<=i){let O;if(this.elementaryStream.canBeTrustedWithKeyPackets)O=x.randomAccessIndicator===1;else{b(P);const N=no(P,!0);b(N);const Q=new Oc(this.elementaryStream,N);await Q.markNextPacket(),O=((E=Q.suppliedPacket)==null?void 0:E.randomAccessIndicator)===1}O&&(C=x)}if(x.pts>i&&(v=!0),v&&(M++,M>y))break;let D=x.sectionStartPos+s.packetStride;for(;;
690){const O=await s.readPacketHeader(D);if(!O)break e;if(O.pid===c&&O.payloadUnitStartIndicator===1){const N=await s.readSection(D,T);if(N){const Q=Rs(N,!1);if(Q&&Q.pts!==null){x=Q,P=N,Bg(this.elementaryStream,x);break}}}D+=s.packetStride}}if(C){let D=C;if(M===0)e:for(let N=0;N<y;N++){let Q=D.sectionStartPos-s.packetStride;for(;Q>=s.packetOffset;){const G=await s.readPacketHeader(Q);if(!G)break e;if(G.pid===c&&G.payloadUnitStartIndicator===1){const V=await s.readSection(Q,T);if(V){const Z=Rs(V,!1);if(Z&&Z.pts!==null){D=Z;break}}}Q-=s.packetStride}}const O=await w(D.sectionStartPos,N=>N.pts<=i&&N.randomAccessIndicator===1);return b(O),O}if(_)return null;k=S,S=Math.max(Hm(S-d.sectionStartPos-o,s.packetStride)+d.sectionStartPos,d.sectionStartPos)}}}}class n5 extends Dd{getType(){return"video"}getCodec(){return this.elementaryStream.info.codec}getCodedWidth(){return this.elementaryStream.info.width}getCodedHeight(){return this.elementaryStream.info.height}getSquarePixelWidth(){return this.elementaryStream.info.squarePixelWidth}getSquarePixelHeight(){return this.elementaryStream.info.squarePixelHeight}getRotation(){return 0}async getColorSpace(){return this.elementaryStream.info.colorSpace}
690async canBeTransparent(){return!1}async getDecoderConfig(){return b(this.elementaryStream.info.decoderConfig),this.elementaryStream.info.decoderConfig}allPacketsAreKeyPackets(){return!1}getReorderSize(){return this.elementaryStream.info.reorderSize}}class r5 extends Dd{getType(){return"audio"}getCodec(){return this.elementaryStream.info.codec}getNumberOfChannels(){return this.elementaryStream.info.numberOfChannels}getSampleRate(){return this.elementaryStream.info.sampleRate}async getDecoderConfig(){return b(this.elementaryStream.info.decoderConfig),this.elementaryStream.info.decoderConfig}allPacketsAreKeyPackets(){return!0}getReorderSize(){return 0}}const Bg=(t,e)=>{const n=t.referencePesPackets,r=Ge(n,e.sectionStartPos,i=>i.sectionStartPos);if(r>=0){const i=n[r];if(e.pts<=i.pts)return!1;const s=t.demuxer.minReferencePointByteDistance;if(e.sectionStartPos-i.sectionStartPos<s)return!1;if(r<n.length-1){const a=n[r+1];if(a.pts<e.pts||a.sectionStartPos-e.sectionStartPos<s)return!1}}return n.splice(r+1,0,e),!0};class Oc{constructor(e,n){this.currentPos=0,this.pesPackets=[],this.currentPesPacketIndex=0,this.currentPesPacketPos=0,this.endPos=0,this.lastSuppliedPesPacket=null,this.nextPts=null,this.suppliedPacket=null,this.elementaryStream=e,this.pid=e.pid,this.demuxer=e.demuxer,this.startingPesPacket=n}ensureBuffered(e){const n=this.endPos-this.currentPos;return n>=e?e:this.bufferData(e-n).then(()=>Math.min(this.endPos-this.currentPos,e))}getCurrentPesPacket(){const e=this.pesPackets[this.currentPesPacketIndex];return b(e),e}async bufferData(e){const n=this.endPos+e;for(;this.endPos<n;){let r;if(this.pesPackets.length===0)r=this.startingPesPacket;else{let i=yt(this.pesPackets).sectionEndPos;for(b(i!==null);;){const s=await this.demuxer.readPacketHeader(i);if(!s)return;if(s.pid===this.pid){const a=await this.demuxer.readSection(i,!0);if(!a)return;const o=no(a,!1);if(o){r=o;break}}i+=this.demuxer.packetStride}}this.pesPackets.push(r),this.endPos+=r.data.byteLength}}readBytes(e){const n=this.getCurrentPesPacket(),r=this.currentPos-this.currentPesPacketPos,i=r+e;if(this.currentPos+=e,i<=n.data.byteLength)return n.data.subarray(r,i);const s=new Uint8Array(e);s.set(n.data.subarray(r));let a=n.data.byteLength-r;for(;;){this.advanceCurrentPacket();const o=this.getCurrentPesPacket(),c=e-a;if(c<=o.data.byteLength){s.set(o.data.subarray(0,c),a);break}s.set(o.data,a),a+=o.data.byteLength}return s}readU8(){let e=this.getCurrentPesPacket();const n=this.currentPos-this.currentPesPacketPos;return this.currentPos++,n<e.data.byteLength?e.data[n]:(this.advanceCurrentPacket(),e=this.getCurrentPesPacket(),e.data[0])}seekTo(e){if(e!==this.currentPos){if(e<this.currentPos)for(;e<this.currentPesPacketPos;){this.currentPesPacketIndex--;const n=this.getCurrentPesPacket();this.currentPesPacketPos-=n.data.byteLength}else for(;;){const n=this.getCurrentPesPacket(),r=this.currentPesPacketPos+n.data.byteLength;if(e<r)break;this.currentPesPacketPos+=n.data.byteLength,this.currentPesPacketIndex++}this.currentPos=e}}skip(e){this.seekTo(this.currentPos+e)}advanceCurrentPacket(){this.currentPesPacketPos+=this.getCurrentPesPacket().data.byteLength,this.currentPesPacketIndex++}async markNextPacket(){b(!this.suppliedPacket);const e=this.elementaryStream;if(e.info.type==="video"){const n=e.info.codec,r=1024;if(n!=="avc"&&n!=="hevc")throw new Error("Unhandled.");let i=null;for(;;){let s=this.ensureBuffered(r);if(s instanceof Promise&&(s=await s),s===0)break;const a=this.currentPos,o=this.readBytes(s),c=o.byteLength;let u=0;for(;u<c;){const l=o.indexOf(0,u);if(l===-1||l>=c)break;u=l;const d=a+u;if(u+4>=c){this.seekTo(d);break}const f=o[u+1],h=o[u+2],m=o[u+3];let p=0,g=null;if(f===0&&h===0&&m===1?(p=4,g=o[u+4]):f===0&&h===1&&(p=3,g=m),p===0){u++;continue}const A=d;if(i===null){i=A,u+=p;continue}if(g!==null){const y=n==="avc"?Ka(g):zi(g);if(n==="avc"?y===Vn.AUD:y===Rt.AUD_NUT){const E=A-i;return this.seekTo(i),this.supplyPacket(E,0)}}u+=p}if(s<r)break}if(i!==null){const s=this.endPos-i;return this.seekTo(i),this.supplyPacket(s,0)}}else{const n=e.info.codec,r=128;for(;;){let i=this.ensureBuffered(r);i instanceof Promise&&(i=await i);const s=this.currentPos;for(;this.currentPos-s<i;){const a=this.readU8();if(n==="aac"){if(a!==255)continue;this.skip(-1);const o=this.currentPos;let c=this.ensureBuffered(Vi);if(c instanceof Promise&&(c=await c),c<Vi)return;const u=this.readBytes(Vi),l=ri(an.tempFromBytes(u));if(l){this.seekTo(o);let d=this.ensureBuffered(l.frameLength);return d instanceof Promise&&(d=await d),this.supplyPacket(d,Math.round(Md*ar/e.info.sampleRate))}else this.seekTo(o+1)}else if(n==="mp3"){if(a!==255)continue;this.skip(-1);const o=this.currentPos;let c=this.ensureBuffered(Cs);if(c instanceof Promise&&(c=await c),c<Cs)return;const u=this.readBytes(Cs),l=_e(u).getUint32(0),d=_d(l,null);if(d.header){this.seekTo(o);let f=this.ensureBuffered(d.header.totalSize);f instanceof Promise&&(f=await f);const h=d.header.audioSamplesInFrame*ar/e.info.sampleRate;return this.supplyPacket(f,Math.round(h))}else this.seekTo(o+1)}else if(n==="ac3"){if(a!==11)continue;this.skip(-1);const o=this.currentPos;let c=this.ensureBuffered(5);if(c instanceof Promise&&(c=await c),c<5)return;const u=this.readBytes(5);if(u[0]!==11||u[1]!==119){this.seekTo(o+1);continue}const l=u[4]>>6,d=u[4]&63;if(l===3||d>37){this.seekTo(o+1);continue}const f=EV[3*d+l];b(f!==void 0),this.seekTo(o),c=this.ensureBuffered(f),c instanceof Promise&&(c=await c);const h=Math.round(SV*ar/e.info.sampleRate);return this.supplyPacket(c,h)}else if(n==="eac3"){if(a!==11)continue;this.skip(-1);const o=this.currentPos;let c=this.ensureBuffered(5);if(c instanceof Promise&&(c=await c),c<5)return;const u=this.readBytes(5);if(u[0]!==11||u[1]!==119){this.seekTo(o+1);continue}const d=(((u[2]&7)<<8|u[3])+1)*2,h=u[4]>>6===3?3:u[4]>>4&3,m=VI[h];this.seekTo(o),c=this.ensureBuffered(d),c instanceof Promise&&(c=await c);const p=m*256,g=Math.round(p*ar/e.info.sampleRate);return this.supplyPacket(c,g)}else throw new Error("Unhandled.")}if(i<r)break}}}supplyPacket(e,n){const r=this.getCurrentPesPacket();let i;if(this.lastSuppliedPesPacket===r)b(this.nextPts!==null),i=this.nextPts;else{if(r.pts===null)throw new Error(vC);i=r.pts,Bg(this.elementaryStream,r)}this.lastSuppliedPesPacket=r,this.nextPts=i+n;const s=r.sectionStartPos,a=s+(this.currentPos-this.currentPesPacketPos),o=this.readBytes(e);let c=r.randomAccessIndicator;if(c===0&&!this.elementaryStream.canBeTrustedWithKeyPackets){if(this.elementaryStream.info.type==="audio")c=1;else if(this.elementaryStream.info.decoderConfig){const u=vd(this.elementaryStream.info.codec,this.elementaryStream.info.decoderConfig,o)==="key";c=Number(u)}}this.suppliedPacket={pts:i,data:o,sequenceNumber:a,sectionStartPos:s,randomAccessIndicator:c},this.pesPackets.splice(0,this.currentPesPacketIndex),this.currentPesPacketIndex=0}}class Pg{constructor(e,n){this.decodeOrderPackets=[],this.reorderBuffer=[],this.presentationOrderPackets=[],this.reachedEnd=!1,this.lastDuration=0,this.backing=e,this.context=n,this.reorderSize=e.getReorderSize(),b(this.reorderSize>=0)}
690async readNext(){if(this.decodeOrderPackets.length===0&&!await this.readNextPacket())return null;await this.ensureCurrentPacketHasNext();const e=this.decodeOrderPackets[0],n=this.presentationOrderPackets.indexOf(e);b(n!==-1);let r;for(n===this.presentationOrderPackets.length-1?r=this.lastDuration:(r=this.presentationOrderPackets[n+1].pts-e.pts,this.lastDuration=r),this.decodeOrderPackets.shift();this.presentationOrderPackets.length>0;){const i=this.presentationOrderPackets[0];if(this.decodeOrderPackets.includes(i))break;this.presentationOrderPackets.shift()}return{packet:e,duration:r}}async readNextPacket(){if(this.reachedEnd)return!1;let e;return this.context.suppliedPacket?e=this.context.suppliedPacket:(await this.context.markNextPacket(),e=this.context.suppliedPacket),this.context.suppliedPacket=null,e?(this.decodeOrderPackets.push(e),this.processPacketThroughReorderBuffer(e),!0):(this.reachedEnd=!0,this.flushReorderBuffer(),!1)}async ensureCurrentPacketHasNext(){const e=this.decodeOrderPackets[0];for(b(e);;){const n=this.presentationOrderPackets.indexOf(e);if(n!==-1&&n<=this.presentationOrderPackets.length-2||!await this.readNextPacket())break}}processPacketThroughReorderBuffer(e){if(this.reorderBuffer.push(e),this.reorderBuffer.length>this.reorderSize){let n=0;for(let i=1;i<this.reorderBuffer.length;i++)this.reorderBuffer[i].pts<this.reorderBuffer[n].pts&&(n=i);const r=this.reorderBuffer[n];this.presentationOrderPackets.push(r),this.reorderBuffer.splice(n,1)}}flushReorderBuffer(){this.reorderBuffer.sort((e,n)=>e.pts-n.pts),this.presentationOrderPackets.push(...this.reorderBuffer),this.reorderBuffer.length=0}}/*!
691 * Copyright (c) 2026-present, Vanilagy and contributors
692 *
693 * This Source Code Form is subject to the terms of the Mozilla Public
694 * License, v. 2.0. If a copy of the MPL was not distributed with this
695 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
696 */const ro="application/vnd.apple.mpegurl",PC="#EXT-X-STREAM-INF:",RC="#EXT-X-I-FRAME-STREAM-INF:",FC="#EXT-X-MEDIA:",Rg="#EXTINF:",MC="#EXT-X-MAP:",DC="#EXT-X-KEY:",OC="#EXT-X-MEDIA-SEQUENCE:",NC="#EXT-X-BYTERANGE:",UC="#EXT-X-PROGRAM-DATE-TIME:",i5="#EXT-X-DISCONTINUITY",LC="#EXT-X-TARGETDURATION:",s5="#EXT-X-ENDLIST",zC="#EXT-X-PLAYLIST-TYPE:",a5="#EXT-X-I-FRAMES-ONLY",QC=t=>t.length===0||t.startsWith("#")&&!t.startsWith("#EXT");class Nc{constructor(e){this._attributes={};let n="",r="",i=!1,s=!1;for(let a=0;a<e.length;a++){const o=e[a];o==='"'?s=!s:o==="="&&!i&&!s?i=!0:o===","&&!s?(n&&(this._attributes[n.trim().toLowerCase()]=r),n="",r="",i=!1):i?r+=o:n+=o}n&&(this._attributes[n.trim().toLowerCase()]=r)}get(e){return this._attributes[e.toLowerCase()]??null}getAsNumber(e){const n=this.get(e);if(n===null)return null;const r=Number(n);return Number.isFinite(r)?r:null}merge(e){Object.assign(this._attributes,e._attributes)}}/*!
697 * Copyright (c) 2026-present, Vanilagy and contributors
698 *
699 * This Source Code Form is subject to the terms of the Mozilla Public
700 * License, v. 2.0. If a copy of the MPL was not distributed with this
701 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
702 */class o5{constructor(e,n,r){this.nextInputCacheAge=0,this.inputCache=[],this.trackBackingsPromise=null,this.firstSegment=null,this.firstSegmentFirstTimestamps=new WeakMap,this.firstTimestampCache=new WeakMap,this.input=e,this.path=n,this.trackDeclarations=r}
702async getDurationFromMetadata(e){const n=await this.getSegmentAt(1/0,{skipLiveWait:e.skipLiveWait});return n?n.timestamp+n.duration:null}async getTrackBackings(){return this.trackBackingsPromise??(this.trackBackingsPromise=(async()=>{const e=[];if(this.trackDeclarations){for(const n of this.trackDeclarations)if(n.type==="video"){const r=_c(e,i=>i.getType()==="video")+1;e.push(new WC(this,n,r))}else if(n.type==="audio"){const r=_c(e,i=>i.getType()==="audio")+1;e.push(new VC(this,n,r))}}else{if(this.firstSegment=await this.getFirstSegment({}),!this.firstSegment)return[];const r=await this.getInputForSegment(this.firstSegment).getTracks();for(const i of r)if(i.type==="video"){const s=_c(e,a=>a.getType()==="video")+1;e.push(new WC(this,{id:e.length+1,type:"video"},s))}else if(i.type==="audio"){const s=_c(e,a=>a.getType()==="audio")+1;e.push(new VC(this,{id:e.length+1,type:"audio"},s))}}return e})())}async getFirstTimestampForInput(e){const n=this.firstTimestampCache.get(e);if(n!==void 0)return n;const r=await e.getFirstTimestamp();return this.firstTimestampCache.set(e,r),r}async getMediaOffset(e,n){const r=e.firstSegment??e;let i;if(this.firstSegmentFirstTimestamps.has(r))i=this.firstSegmentFirstTimestamps.get(r);else{const u=this.getInputForSegment(r);i=await this.getFirstTimestampForInput(u),this.firstSegmentFirstTimestamps.set(r,i)}if(r===e)return r.timestamp-i;const s=await this.getFirstTimestampForInput(n),a=e.timestamp-r.timestamp,c=s-i-a;return Math.abs(c)<=Math.min(.25,a)?r.timestamp-i:e.timestamp-s}dispose(){for(const e of this.inputCache)e.input.dispose();this.inputCache.length=0}}class HC{constructor(e,n,r){this.packetInfos=new WeakMap,this.hydrationPromise=null,this.firstInputTrack=null,this.segmentedInput=e,this.decl=n,this.number=r}hydrate(){return this.hydrationPromise??(this.hydrationPromise=(async()=>{var i;if((i=this.segmentedInput).firstSegment??(i.firstSegment=await this.segmentedInput.getFirstSegment({})),!this.segmentedInput.firstSegment)throw new Error("Missing first segment, can't retrieve track.");const r=(await this.segmentedInput.getInputForSegment(this.segmentedInput.firstSegment).getTracks()).find(s=>s.type===this.decl.type&&s.number===this.number);if(!r)throw new Error("No matching track found in underlying media data.");this.firstInputTrack=r})())}getId(){return this.decl.id}getType(){return this.decl.type}getNumber(){return this.number}delegate(e){return this.firstInputTrack?e():this.hydrate().then(e)}async getDecoderConfig(){return this.delegate(()=>this.firstInputTrack._backing.getDecoderConfig())}getHasOnlyKeyPackets(){return this.delegate(()=>{var e,n;return((n=(e=this.firstInputTrack._backing).getHasOnlyKeyPackets)==null?void 0:n.call(e))??null})}getPairingMask(){return 1n}getCodec(){return this.delegate(()=>this.firstInputTrack._backing.getCodec())}getInternalCodecId(){return this.delegate(()=>this.firstInputTrack._backing.getInternalCodecId())}getDisposition(){return this.delegate(()=>this.firstInputTrack._backing.getDisposition())}getLanguageCode(){return this.delegate(()=>this.firstInputTrack._backing.getLanguageCode())}getName(){return this.delegate(()=>this.firstInputTrack._backing.getName())}getTimeResolution(){return this.delegate(()=>this.firstInputTrack._backing.getTimeResolution())}async isRelativeToUnixEpoch(){return await this.hydrate(),b(this.segmentedInput.firstSegment),this.segmentedInput.firstSegment.relativeToUnixEpoch}getBitrate(){return this.delegate(()=>this.firstInputTrack._backing.getBitrate())}getAverageBitrate(){return this.delegate(()=>this.firstInputTrack._backing.getAverageBitrate())}getDurationFromMetadata(e){return this.segmentedInput.getDurationFromMetadata(e)}
702getLiveRefreshInterval(){return this.segmentedInput.getLiveRefreshInterval()}async createAdjustedPacket(e,n,r){b(e.sequenceNumber>=0),b(this.segmentedInput.firstSegment);const i=await this.segmentedInput.getMediaOffset(n,r.input),s=n.timestamp-this.segmentedInput.firstSegment.timestamp,a=e.clone({timestamp:La(e.timestamp+i,await r.getTimeResolution()),sequenceNumber:Math.floor(1e8*s)+e.sequenceNumber});return this.packetInfos.set(a,{segment:n,track:r,sourcePacket:e}),a}async getFirstPacket(e){await this.hydrate(),b(this.segmentedInput.firstSegment),b(this.firstInputTrack);const n=await this.firstInputTrack._backing.getFirstPacket(e);return n?this.createAdjustedPacket(n,this.segmentedInput.firstSegment,this.firstInputTrack):null}getNextPacket(e,n){return this._getNextInternal(e,n,!1)}getNextKeyPacket(e,n){return this._getNextInternal(e,n,!0)}async _getNextInternal(e,n,r){const i=this.packetInfos.get(e);if(!i)throw new Error("Packet was not created from this track.");const s=r?await i.track._backing.getNextKeyPacket(i.sourcePacket,n):await i.track._backing.getNextPacket(i.sourcePacket,n);if(s)return this.createAdjustedPacket(s,i.segment,i.track);let a=i.segment;for(;;){const o=await this.segmentedInput.getNextSegment(a,{skipLiveWait:n.skipLiveWait});if(!o)return null;const l=(await this.segmentedInput.getInputForSegment(o).getTracks()).find(f=>f.type===i.track.type&&f.number===i.track.number);if(!l){a=o;continue}const d=await l._backing.getFirstPacket(n);return d?this.createAdjustedPacket(d,o,l):null}}getPacket(e,n){return this._getPacketInternal(e,n,!1)}getKeyPacket(e,n){return this._getPacketInternal(e,n,!0)}async _getPacketInternal(e,n,r){let i=await this.segmentedInput.getSegmentAt(e,{skipLiveWait:n.skipLiveWait});if(!i)return null;for(await this.hydrate();i;){const s=this.segmentedInput.getInputForSegment(i),o=(await s.getTracks()).find(d=>d.type===this.firstInputTrack.type&&d.number===this.firstInputTrack.number);if(!o){i=await this.segmentedInput.getPreviousSegment(i,{skipLiveWait:n.skipLiveWait});continue}const c=await this.segmentedInput.getMediaOffset(i,s),u=e-c,l=r?await o._backing.getKeyPacket(u,n):await o._backing.getPacket(u,n);if(!l){i=await this.segmentedInput.getPreviousSegment(i,{skipLiveWait:n.skipLiveWait});continue}return this.createAdjustedPacket(l,i,o)}return null}}class WC extends HC{getType(){return"video"}getCodec(){return this.delegate(()=>this.firstInputTrack._backing.getCodec())}getCodedWidth(){return this.delegate(()=>this.firstInputTrack._backing.getCodedWidth())}getCodedHeight(){return this.delegate(()=>this.firstInputTrack._backing.getCodedHeight())}getSquarePixelWidth(){return this.delegate(()=>this.firstInputTrack._backing.getSquarePixelWidth())}getSquarePixelHeight(){return this.delegate(()=>this.firstInputTrack._backing.getSquarePixelHeight())}getRotation(){return this.delegate(()=>this.firstInputTrack._backing.getRotation())}async getColorSpace(){return this.delegate(()=>this.firstInputTrack._backing.getColorSpace())}
702async canBeTransparent(){return this.delegate(()=>this.firstInputTrack._backing.canBeTransparent())}async getDecoderConfig(){return this.delegate(()=>this.firstInputTrack._backing.getDecoderConfig())}}class VC extends HC{getType(){return"audio"}getCodec(){return this.delegate(()=>this.firstInputTrack._backing.getCodec())}getNumberOfChannels(){return this.delegate(()=>this.firstInputTrack._backing.getNumberOfChannels())}getSampleRate(){return this.delegate(()=>this.firstInputTrack._backing.getSampleRate())}async getDecoderConfig(){return this.delegate(()=>this.firstInputTrack._backing.getDecoderConfig())}}var Od=Object.freeze({__proto__:null});/*!
703 * Copyright (c) 2026-present, Vanilagy and contributors
704 *
705 * This Source Code Form is subject to the terms of the Mozilla Public
706 * License, v. 2.0. If a copy of the MPL was not distributed with this
707 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
708 */jm();const GC=typeof Od<"u"?Od:void 0,qC=0,YC=1/0;let Fs=null;typeof FinalizationRegistry<"u"&&(Fs=new FinalizationRegistry(t=>{t()}));class Rn extends Ic{constructor(){super(),this._disposed=!1,this._refCount=0,this._usedForHls=!1,this._refFinalizationRegistry=null,this._sizePromise=null,this.onread=null,typeof FinalizationRegistry<"u"&&(this._refFinalizationRegistry=new FinalizationRegistry(e=>{e._decrementRefCount()}))}async getSizeOrNull(){if(this._disposed)throw new bn;return this._sizePromise??(this._sizePromise=(async()=>{let e=this._getFileSize();return e!==void 0||(await this._read(0,1,qC,YC),e=this._getFileSize(),b(e!==void 0)),e})())}async getSize(){if(this._disposed)throw new bn;
708const e=await this.getSizeOrNull();if(e===null)throw new Error("Cannot determine the size of an unsized source.");return e}slice(e,n){if(!Number.isInteger(e)||e<0)throw new TypeError("offset must be a non-negative integer.");if(n!==void 0&&(!Number.isInteger(n)||n<0))throw new TypeError("length, when provided, must be a non-negative integer.");return new JC(this,e,n)}_dispatchRead(e,n){var r;(r=this.onread)==null||r.call(this,e,n),this._emit("read",{start:e,end:n})}ref(){return new Nd(this)}_incrementRefCount(){this._refCount++}_decrementRefCount(){this._refCount--,this._refCount===0&&(this._dispose(),this._disposed=!0)}}class Nd{constructor(e){var n;if(this._freed=!1,e._disposed)throw new Error("Cannot ref a disposed source.");e._incrementRefCount(),(n=e._refFinalizationRegistry)==null||n.register(this,e,this),this._source=e}get source(){if(!this._source)throw new Error("Can't get source; ref has already been freed.");return this._source}get freed(){return this._freed}free(){var n;if(this._freed)throw new Error("Illegal operation: double free on SourceRef.");const e=this.source;b(e._refCount>0),e._decrementRefCount(),(n=e._refFinalizationRegistry)==null||n.unregister(this),this._freed=!0,this._source=null}[Symbol.dispose](){this.freed||this.free()}}class Ms extends Rn{constructor(e,n){if(typeof e!="string")throw new TypeError("rootPath must be a string.");if(typeof n!="function")throw new TypeError("requestHandler must be a function.");super(),this.rootPath=e,this.requestHandler=n}_resolveRequest(e){const n=this.requestHandler(e),r=i=>{var a;if(!(i instanceof Rn||i instanceof Nd))throw new TypeError("requestHandler must return or resolve to a Source or SourceRef.");const s=i instanceof Rn?i.ref():i;return(a=s.source)._usedForHls||(a._usedForHls=this._usedForHls),s};return n instanceof Promise?n.then(r):r(n)}}const KC=(t,e)=>t.path===e.path;class jC extends Ms{constructor(){super(...arguments),this._root=null,this._rootRequest=null}_read(e,n,r,i){if(!this._root){if(!this._rootRequest){const s=this._resolveRequest({path:this.rootPath,isRoot:!0}),a=o=>{const c=o instanceof Rn?o.ref():o;return this._root=c,this._rootRequest=null,c};s instanceof Promise?this._rootRequest=s.then(a):(a(s),b(this._root))}if(this._rootRequest)return this._rootRequest.then(s=>s.source._read(e,n,r,i))}return this._root.source._read(e,n,r,i)}_getFileSize(){if(this._root)return this._root.source._getFileSize()}_dispose(){this._root?this._root.free():this._rootRequest&&this._rootRequest.then(e=>e.free())}}class c5 extends Rn{constructor(e){if(!(e instanceof ArrayBuffer)&&!(typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("buffer must be an ArrayBuffer, SharedArrayBuffer, or ArrayBufferView.");super(),this._onreadCalled=!1,this._bytes=dt(e),this._view=_e(e)}_getFileSize(){return this._bytes.byteLength}_read(){return this._onreadCalled||(this._dispatchRead(0,this._bytes.byteLength),this._onreadCalled=!0),{bytes:this._bytes,view:this._view,offset:0}}_dispose(){}}class u5 extends Rn{constructor(e,n={}){if(!(e instanceof Blob))throw new TypeError("blob must be a Blob.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(n.maxCacheSize!==void 0&&(!Ha(n.maxCacheSize)||n.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(n.useStreamReader!==void 0&&typeof n.useStreamReader!="boolean")throw new TypeError("options.useStreamReader, when provided, must be a boolean.");super(),this._readers=new WeakMap,this._blob=e,this._options=n,this._orchestrator=new Ng({maxCacheSize:n.maxCacheSize??8*2**20,maxWorkerCount:4,runWorker:this._runWorker.bind(this),prefetchProfile:Og.fileSystem}),this._orchestrator.fileSize=e.size}_getFileSize(){return this._orchestrator.fileSize}_read(e,n,r,i){return this._orchestrator.read(e,n,r,i)}async _runWorker(e){b(e.strictTarget);let n=this._readers.get(e);for(n===void 0&&("stream"in this._blob&&!Sc()&&this._options.useStreamReader!==!1?n=this._blob.slice(e.currentPos).stream().getReader():n=null,this._readers.set(e,n));e.currentPos<e.targetPos&&!e.aborted;)if(n){const{done:r,value:i}=await n.read();
708if(r)throw this._orchestrator.onWorkerFinished(e),new Error("Blob reader stopped unexpectedly before all requested data was read.");if(e.aborted)break;this._dispatchRead(e.currentPos,e.currentPos+i.length),this._orchestrator.supplyWorkerData(e,i)}else{const r=await this._blob.slice(e.currentPos,e.targetPos).arrayBuffer();if(e.aborted)break;this._dispatchRead(e.currentPos,e.currentPos+r.byteLength),this._orchestrator.supplyWorkerData(e,new Uint8Array(r))}this._orchestrator.signalWorkerStoppedRunning(e),e.aborted&&await(n==null?void 0:n.cancel())}_dispose(){this._orchestrator.dispose()}}const l5=.5*2**20,d5=((t,e,n)=>{if(e instanceof Error&&(e.message.includes("Failed to fetch")||e.message.includes("Load failed")||e.message.includes("NetworkError when attempting to fetch resource"))&&typeof window<"u"){let i=null;try{typeof window<"u"&&typeof window.location<"u"&&(i=new URL(n instanceof Request?n.url:n,window.location.href).origin)}catch{}if((typeof navigator<"u"&&typeof navigator.onLine=="boolean"?navigator.onLine:!0)&&i!==null&&i!==window.location.origin)return console.warn("Request will not be retried because a CORS error was suspected due to different origins. You can modify this behavior by providing your own function for the 'getRetryDelay' option."),null}return Math.min(2**(t-2),16)}),$C=new Set;class Fg extends Ms{constructor(e,n={}){if(typeof e!="string"&&!(e instanceof URL)&&!(typeof Request<"u"&&e instanceof Request))throw new TypeError("url must be a string, URL or Request.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(n.requestInit!==void 0&&(!n.requestInit||typeof n.requestInit!="object"))throw new TypeError("options.requestInit, when provided, must be an object.");if(n.getRetryDelay!==void 0&&typeof n.getRetryDelay!="function")throw new TypeError("options.getRetryDelay, when provided, must be a function.");if(n.maxCacheSize!==void 0&&(!Ha(n.maxCacheSize)||n.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(n.parallelism!==void 0&&(!Number.isInteger(n.parallelism)||n.parallelism<1))throw new TypeError("options.parallelism, when provided, must be a positive number.");if(n.fetchFn!==void 0&&typeof n.fetchFn!="function")throw new TypeError("options.fetchFn, when provided, must be a function.");const r=e instanceof Request?e.url:e instanceof URL?e.href:e;super(r,s=>new Fg(s.path,this._options)),this._fileSizeDetermined=!1,this._url=e,this._options=n,this._getRetryDelay=n.getRetryDelay??d5;const i=2;this._orchestrator=new Ng({maxCacheSize:n.maxCacheSize??64*2**20,maxWorkerCount:n.parallelism??i,runWorker:this._runWorker.bind(this),prefetchProfile:Og.network})}_getFileSize(){return this._fileSizeDetermined?this._orchestrator.fileSize:void 0}_read(e,n,r,i){return this._orchestrator.read(e,n,r,i)}async _runWorker(e){for(;;){const n=new AbortController,r=await DW(this._options.fetchFn??fetch,this._url,MW(this._options.requestInit??{},{headers:{Range:`bytes=${e.currentPos}-`},signal:n.signal}),this._getRetryDelay,()=>this._disposed);if(!r.ok)throw new Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);e:if(this._orchestrator.fileSize===null){const s=r.headers.get("Content-Range");if(s){const o=/\/(\d+)/.exec(s);if(o){this._orchestrator.supplyFileSize(Number(o[1]));break e}}const a=r.headers.get("Content-Length");
708a&&this._orchestrator.supplyFileSize(e.currentPos+Number(a))}if(this._fileSizeDetermined=!0,r.status!==206){if(!this._usedForHls){const s=new URL(this._url instanceof Request?this._url.url:this._url,typeof window<"u"?window.location.href:void 0);s.origin!=="null"&&!(s.pathname.endsWith(".m3u8")||s.pathname.endsWith(".m3u"))&&($C.has(s.origin)||(console.log(this._usedForHls,this._url,s.pathname),console.warn(`HTTP server (origin ${s.origin}) did not respond to a range request with 206 Partial Content, meaning the entire resource will now be downloaded. To enable efficient media file streaming across a network, please make sure your server supports range requests.`),$C.add(s.origin)))}e.currentPos=0,this._orchestrator.options.maxCacheSize=1/0,this._orchestrator.fileSize!==null?e.targetPos=this._orchestrator.fileSize:(e.targetPos=1/0,e.strictTarget=!1),this._orchestrator.consolidateEverythingIntoOneWorker(e)}if(!r.body)throw new Error("Missing HTTP response body stream. The used fetch function must provide the response body as a ReadableStream.");const i=r.body.getReader();for(;;){if(e.currentPos>=e.targetPos||e.aborted){n.abort(),this._orchestrator.signalWorkerStoppedRunning(e);return}let s;try{s=await i.read()}catch(c){if(this._disposed)throw c;const u=this._getRetryDelay(1,c,this._url);if(u!==null){console.error("Error while reading response stream. Attempting to resume.",c),await Jm(1e3*u);break}else throw c}if(e.aborted)continue;const{done:a,value:o}=s;if(a){if(e.currentPos>=e.targetPos){this._orchestrator.onWorkerFinished(e);return}if(e.strictTarget)break;this._orchestrator.onWorkerFinished(e);return}this._dispatchRead(e.currentPos,e.currentPos+o.length),this._orchestrator.supplyWorkerData(e,o)}}}_dispose(){this._orchestrator.dispose()}}class Mg extends Ms{constructor(e,n={}){if(typeof e!="string")throw new TypeError("filePath must be a string.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(n.maxCacheSize!==void 0&&(!Ha(n.maxCacheSize)||n.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(!GC.fs)throw new Error("FilePathSource is only available in server-side environments (Node.js, Bun, Deno).");super(e,r=>new Mg(r.path,n)),this._fileHandle=null,this._customSource=new Dg({getSize:async()=>{const r=await GC.fs.open(e,"r");return this._fileHandle=r,Fs==null||Fs.register(this,()=>{r.close()},this),(await r.stat()).size},read:async(r,i)=>{b(this._fileHandle);const s=new Uint8Array(i-r);return await this._fileHandle.read(s,0,i-r,r),s},maxCacheSize:n.maxCacheSize,prefetchProfile:"fileSystem"})}_read(e,n,r,i){return this._customSource._read(e,n,r,i)}_getFileSize(){return this._customSource._getFileSize()}_dispose(){this._customSource._dispose(),this._fileHandle&&(this._fileHandle.close(),this._fileHandle=null,Fs==null||Fs.unregister(this))}}class Dg extends Rn{constructor(e){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(typeof e.getSize!="function")throw new TypeError("options.getSize must be a function.");if(typeof e.read!="function")throw new TypeError("options.read must be a function.");if(e.dispose!==void 0&&typeof e.dispose!="function")throw new TypeError("options.dispose, when provided, must be a function.");if(e.maxCacheSize!==void 0&&(!Ha(e.maxCacheSize)||e.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(e.prefetchProfile&&!["none","fileSystem","network"].includes(e.prefetchProfile))throw new TypeError("options.prefetchProfile, when provided, must be one of 'none', 'fileSystem' or 'network'.");super(),this._options=e,this._orchestrator=new Ng({maxCacheSize:e.maxCacheSize??8*2**20,maxWorkerCount:2,prefetchProfile:Og[e.prefetchProfile??"none"],runWorker:this._runWorker.bind(this)})}_getFileSize(){return this._orchestrator.fileSize??void 0}_read(e,n,r,i){if(this._orchestrator.fileSize!==null)return this._orchestrator.read(e,n,r,i);const s=this._options.getSize();if(s instanceof Promise)return s.then(a=>{if(!Number.isInteger(a)||a<0)throw new TypeError("options.getSize must return or resolve to a non-negative integer.");
708return this._orchestrator.fileSize=a,this._orchestrator.read(e,n,r,i)});if(!Number.isInteger(s)||s<0)throw new TypeError("options.getSize must return or resolve to a non-negative integer.");return this._orchestrator.fileSize=s,this._orchestrator.read(e,n,r,i)}async _runWorker(e){for(;e.currentPos<e.targetPos&&!e.aborted;){const n=e.currentPos,r=e.targetPos;let i=this._options.read(e.currentPos,r);if(i instanceof Promise&&(i=await i),e.aborted)break;if(i instanceof Uint8Array){if(i=dt(i),i.length!==r-e.currentPos)throw new Error(`options.read returned a Uint8Array with unexpected length: Requested ${r-e.currentPos} bytes, but got ${i.length}.`);this._dispatchRead(e.currentPos,e.currentPos+i.length),this._orchestrator.supplyWorkerData(e,i)}else if(i instanceof ReadableStream){const s=i.getReader();for(;e.currentPos<r&&!e.aborted;){const{done:a,value:o}=await s.read();if(a){if(e.currentPos<r)throw new Error(`ReadableStream returned by options.read ended before supplying enough data. Requested ${r-n} bytes, but got ${e.currentPos-n}`);break}if(!(o instanceof Uint8Array))throw new TypeError("ReadableStream returned by options.read must yield Uint8Array chunks.");if(e.aborted)break;const c=dt(o);this._dispatchRead(e.currentPos,e.currentPos+c.length),this._orchestrator.supplyWorkerData(e,c)}}else throw new TypeError("options.read must return or resolve to a Uint8Array or a ReadableStream.")}this._orchestrator.signalWorkerStoppedRunning(e)}_dispose(){var e,n;this._orchestrator.dispose(),(n=(e=this._options).dispose)==null||n.call(e)}}const f5=Dg;class XC extends Rn{constructor(e,n={}){if(!(e instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(n.maxCacheSize!==void 0&&(!Ha(n.maxCacheSize)||n.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");super(),this._reader=null,this._cache=[],this._pendingSlices=[],this._currentIndex=0,this._targetIndex=0,this._maxRequestedIndex=0,this._endIndex=null,this._pulling=!1,this._stream=e,this._maxCacheSize=n.maxCacheSize??32*2**20}_getFileSize(){return this._endIndex}_read(e,n){if(this._endIndex!==null&&n>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,n);const r=Ge(this._cache,e,l=>l.start),i=r!==-1?this._cache[r]:null;if(i&&i.start<=e&&n<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let s=e;const a=new Uint8Array(n-e);if(r!==-1)for(let l=r;l<this._cache.length;l++){const d=this._cache[l];if(d.start>=n)break;const f=Math.max(e,d.start);f>s&&this._throwDueToCacheMiss();const h=Math.min(n,d.end);f<h&&(a.set(d.bytes.subarray(f-d.start,h-d.start),f-e),s=h)}if(s===n)return{bytes:a,view:_e(a),offset:e};this._currentIndex>s&&this._throwDueToCacheMiss();const{promise:o,resolve:c,reject:u}=wt();return this._pendingSlices.push({start:e,end:n,bytes:a,resolve:c,reject:u}),this._targetIndex=Math.max(this._targetIndex,n),this._pulling||(this._pulling=!0,this._pull().catch(l=>{if(this._pulling=!1,this._pendingSlices.length>0)this._pendingSlices.forEach(d=>d.reject(l)),this._pendingSlices.length=0;else throw l})),o}_throwDueToCacheMiss(){throw new Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}async _pull(){for(this._reader??(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){const{done:e,value:n}=await this._reader.read();if(e){for(const s of this._pendingSlices)s.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const r=this._currentIndex,i=this._currentIndex+n.byteLength;this._dispatchRead(r,i);for(let s=0;s<this._pendingSlices.length;s++){const a=this._pendingSlices[s],o=Math.max(r,a.start),c=Math.min(i,a.end);o<c&&(a.bytes.set(n.subarray(o-r,c-r),o-a.start),c===a.end&&(a.resolve({bytes:a.bytes,view:_e(a.bytes),offset:a.start}),this._pendingSlices.splice(s,1),s--))}for(this._cache.push({start:r,end:i,bytes:n,view:_e(n),age:0});this._cache.length>0;){const s=this._cache[0];if(this._maxRequestedIndex-s.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){var e;this._pendingSlices.length=0,this._cache.length=0,(e=this._reader)==null||e.cancel()}}const Og={none:(t,e)=>({start:t,end:e}),fileSystem:(t,e)=>(t=Math.floor((t-65536)/65536)*65536,e=Math.ceil((e+65536)/65536)*65536,{start:t,end:e}),network:(t,e,n)=>{t=Math.max(0,Math.floor((t-65536)/65536)*65536);for(const i of n){const a=Math.max((i.startPos+i.targetPos)/2,i.targetPos-8388608);if(Km(t,e,a,i.targetPos)){const o=i.targetPos-i.startPos,c=Math.ceil((o+1)/8388608)*8388608,u=2**Math.ceil(Math.log2(o+1)),l=Math.min(u,c);e=Math.max(e,i.startPos+l)}}return e=Math.max(e,t+l5),{start:t,end:e}}};class Ng{constructor(e){this.options=e,this.fileSize=null,this.nextAge=0,this.workers=[],this.cache=[],this.currentCacheSize=0,this.disposed=!1,this.queuedReads=[]}read(e,n,r,i){b(!this.disposed);const s=this.options.prefetchProfile(e,n,this.workers),a=Math.max(s.start,r),o=Math.min(s.end,this.fileSize??1/0,i);b(a<=e&&n<=o);let c=null;const u=Ge(this.cache,e,S=>S.start),l=u!==-1?this.cache[u]:null;l&&l.start<=e&&n<=l.end&&(l.age=this.nextAge++,c={bytes:l.bytes,view:l.view,offset:l.start});const d=Ge(this.cache,a,S=>S.start),f=c?null:new Uint8Array(n-e);let h=0,m=a;const p=[];if(d!==-1){for(let S=d;S<this.cache.length;S++){const k=this.cache[S];if(k.start>=o)break;if(k.end<=a)continue;const T=Math.max(a,k.start),C=Math.min(o,k.end);if(b(T<=C),m<T&&p.push({start:m,end:T}),m=C,f){const _=Math.max(e,k.start),x=Math.min(n,k.end);if(_<x){const P=_-e;f.set(k.bytes.subarray(_-k.start,x-k.start),P),P===h&&(h=x-e)}}k.age=this.nextAge++}m<o&&p.push({start:m,end:o})}else p.push({start:a,end:o});if(f&&h>=f.length&&(c={bytes:f,view:_e(f),offset:e}),p.length===0)return b(c),c;const{promise:g,resolve:A,reject:y}=wt(),w=[];for(const S of p){const k=Math.max(e,S.start),T=Math.min(n,S.end);k===S.start&&T===S.end?w.push(S):k<T&&w.push({start:k,end:T})}const E=f&&{start:e,bytes:f,holes:w,resolve:A,reject:y};e:for(const S of p){for(const C of this.workers)if(this.checkHoleAgainstWorker(C,S,E?[E]:[])){this.checkQueuedReadsAgainstWorker(C);continue e}const k=S.end<o||this.fileSize!==null,T=this.createWorker(S.start,S.end,k);if(T)E&&(T.pendingSlices=[E]),this.runWorker(T);else{let C=Ge(this.queuedReads,S.start,x=>x.hole.start),_=C!==-1?this.queuedReads[C]:null;for(_&&S.start<=_.hole.end?(_.hole.end=Math.max(_.hole.end,S.end),_.strictTarget&&(_.strictTarget=k),E&&_.pendingSlices.push(E)):(C++,_={hole:{start:S.start,end:S.end},strictTarget:k,pendingSlices:E?[E]:[],age:this.nextAge++},this.queuedReads.splice(C,0,_));C+1<this.queuedReads.length;){const x=this.queuedReads[C+1];if(x.hole.start>_.hole.end)break;_.hole.end=Math.max(_.hole.end,x.hole.end),_.pendingSlices.push(...x.pendingSlices),_.strictTarget&&(_.strictTarget=x.strictTarget),_.age=Math.min(_.age,x.age),this.queuedReads.splice(C+1,1)}}}return c||(b(f),c=g.then(S=>S&&{bytes:S,view:_e(S),offset:e})),c}checkHoleAgainstWorker(e,n,r){if(Km(n.start-131072,n.start,e.currentPos,e.targetPos)){e.targetPos=Math.max(e.targetPos,n.end);for(let s=0;s<r.length;s++){const a=r[s];
vendor: 1,327 bytes, line 708
708e.pendingSlices.includes(a)||e.pendingSlices.push(a)}return e.running||this.runWorker(e),!0}return!1}checkQueuedReadsAgainstWorker(e){let n=!1;for(let r=0;r<this.queuedReads.length;r++){const i=this.queuedReads[r];if(this.checkHoleAgainstWorker(e,i.hole,i.pendingSlices))this.queuedReads.splice(r,1),r--,n=!0;else if(n)break}}createWorker(e,n,r){if(this.workers.length>=this.options.maxWorkerCount){let s=null,a=null;for(let o=0;o<this.workers.length;o++){const c=this.workers[o];!c.running&&c.pendingSlices.length===0&&(!s||c.age<s.age)&&(a=o,s=c)}if(s)b(a!==null),b(s.pendingSlices.length===0),this.workers.splice(a,1);else return null}const i={startPos:e,currentPos:e,targetPos:n,strictTarget:r,running:!1,aborted:this.disposed,pendingSlices:[],age:this.nextAge++};return this.workers.push(i),i}runWorker(e){b(!e.running),b(e.currentPos<e.targetPos),e.running=!0,e.age=this.nextAge++,this.options.runWorker(e).catch(n=>{if(e.running=!1,e.pendingSlices.length>0)e.pendingSlices.forEach(r=>r.reject(n)),e.pendingSlices.length=0;else throw n}).finally(()=>{if(!e.running&&this.queuedReads.length>0){let n=0;for(let s=1;s<this.queuedReads.length;s++)this.queuedReads[s].age<this.queuedReads[n].age&&(n=s);const r=this.queuedReads[n];this.queuedReads.splice(n,1);const i=this.createWorker(r.hole.start,r.hole.end,r.strictTarget);
708b(i),i.pendingSlices=r.pendingSlices,this.runWorker(i)}})}consolidateEverythingIntoOneWorker(e){const n=new Set(e.pendingSlices);for(let r=0;r<this.workers.length;r++){const i=this.workers[r];if(i!==e){for(const s of i.pendingSlices)n.add(s);i.aborted=!0,i.pendingSlices.length=0,this.workers.splice(r,1),r--}}for(let r=0;r<this.queuedReads.length;r++){const i=this.queuedReads[r];for(const s of i.pendingSlices)n.add(s)}e.pendingSlices=[...n],this.queuedReads.length=0}supplyWorkerData(e,n){b(!e.aborted);const r=e.currentPos,i=r+n.length;this.insertIntoCache({start:r,end:i,bytes:n,view:_e(n),age:this.nextAge++}),e.currentPos+=n.length,e.currentPos>e.targetPos&&(e.targetPos=e.currentPos,this.checkQueuedReadsAgainstWorker(e));for(let s=0;s<e.pendingSlices.length;s++){const a=e.pendingSlices[s],o=Math.max(r,a.start),c=Math.min(i,a.start+a.bytes.length);o<c&&a.bytes.set(n.subarray(o-r,c-r),o-a.start);for(let u=0;u<a.holes.length;u++){const l=a.holes[u];r<=l.start&&i>l.start&&(l.start=i),l.end<=l.start&&(a.holes.splice(u,1),u--)}a.holes.length===0&&(a.resolve(a.bytes),e.pendingSlices.splice(s,1),s--)}for(let s=0;s<this.workers.length;s++){const a=this.workers[s];e===a||a.running||Km(r,i,a.currentPos,a.targetPos)&&(this.workers.splice(s,1),s--)}}supplyFileSize(e){b(this.fileSize===null),this.fileSize=e;for(const n of this.workers){n.targetPos=Math.min(n.targetPos,e),n.strictTarget=!0;for(let r=0;r<n.pendingSlices.length;r++){const i=n.pendingSlices[r];for(const s of i.holes)if(s.end>e){i.resolve(null),n.pendingSlices.splice(r,1),r--;break}}}for(let n=0;n<this.queuedReads.length;n++){const r=this.queuedReads[n];if(r.hole.start>=e){for(const i of r.pendingSlices)i.resolve(null);this.queuedReads.splice(n,1),n--}else if(r.hole.end>e){r.hole.end=e,r.strictTarget=!0;for(let i=0;i<r.pendingSlices.length;i++){const s=r.pendingSlices[i];s.start>=e&&(s.resolve(null),r.pendingSlices.splice(i,1),i--)}}}}signalWorkerStoppedRunning(e){e.running=!1,e.pendingSlices.length=0}onWorkerFinished(e){const n=this.workers.indexOf(e);b(n!==-1),e.running=!1,this.workers.splice(n,1),this.fileSize===null&&this.supplyFileSize(e.currentPos);for(const r of e.pendingSlices)r.resolve(null)}insertIntoCache(e){if(this.options.maxCacheSize===0)return;let n=Ge(this.cache,e.start,r=>r.start)+1;if(n>0){const r=this.cache[n-1];if(r.end>=e.end)return;if(r.end>e.start){const i=new Uint8Array(e.end-r.start);i.set(r.bytes,0),i.set(e.bytes,e.start-r.start),this.currentCacheSize+=e.end-r.end,r.bytes=i,r.view=_e(i),r.end=e.end,n--,e=r}else this.cache.splice(n,0,e),this.currentCacheSize+=e.bytes.length}else this.cache.splice(n,0,e),this.currentCacheSize+=e.bytes.length;for(let r=n+1;r<this.cache.length;r++){const i=this.cache[r];if(e.end<=i.start)break;if(e.end>=i.end){this.cache.splice(r,1),this.currentCacheSize-=i.bytes.length,r--;continue}const s=new Uint8Array(i.end-e.start);s.set(e.bytes,0),s.set(i.bytes,i.start-e.start),this.currentCacheSize-=e.end-i.start,e.bytes=s,e.view=_e(s),e.end=i.end,this.cache.splice(r,1);break}for(;this.currentCacheSize>this.options.maxCacheSize;){let r=0,i=this.cache[0];for(let s=1;s<this.cache.length;s++){const a=this.cache[s];a.age<i.age&&(r=s,i=a)}if(this.currentCacheSize-i.bytes.length<=this.options.maxCacheSize)break;this.cache.splice(r,1),this.currentCacheSize-=i.bytes.length}}dispose(){for(const e of this.workers)e.aborted=!0;this.workers.length=0,this.cache.length=0,this.disposed=!0}}class JC extends Rn{constructor(e,n,r){if(super(),this._ref=null,e._disposed)throw new Error("Cannot create a slice of a disposed source.");this._baseSource=e,this._offset=n,this._length=r??null}_getFileSize(){const e=this._baseSource._getFileSize();return e===void 0?this._length!==null?this._length:void 0:e===null?this._length!==null?this._length:null:Yt(e-this._offset,0,this._length??1/0)}_read(e,n,r,i){if(this._length!==null&&n>this._length)return null;const s=this._baseSource._read(this._offset+e,this._offset+n,this._offset+r,this._offset+i);return s instanceof Promise?s.then(a=>a?(a.offset-=this._offset,a):null):s?(s.offset-=this._offset,s):null}_dispose(){var e;(e=this._ref)==null||e.free()}ref(){return this._ref??(this._ref=this._baseSource.ref()),super.ref()}}/*!
709 * Copyright (c) 2026-present, Vanilagy and contributors
710 *
711 * This Source Code Form is subject to the terms of the Mozilla Public
712 * License, v. 2.0. If a copy of the MPL was not distributed with this
713 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
714 */var ZC=function(t,e,n){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],n&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");
714i&&(r=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:r,async:n})}else n&&t.stack.push({async:!0});return e},ex=(function(t){return function(e){function n(a){e.error=e.hasError?new t(a,e.error,"An error was suppressed during disposal."):a,e.hasError=!0}var r,i=0;function s(){for(;r=e.stack.pop();)try{if(!r.async&&i===1)return i=0,e.stack.push(r),Promise.resolve().then(s);if(r.dispose){var a=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(a).then(s,function(o){return n(o),s()})}else i|=1}catch(o){n(o)}if(i===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return s()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r});const h5=/^0[xX][0-9a-fA-F]+$/,p5=/^data:.*;base64,/i;class tx extends o5{constructor(e,n,r,i){super(e.input,n,r),this.segments=[],this.nextLines=null,this.currentUpdateSegmentsPromise=null,this.streamHasEnded=!1,this.lastSegmentUpdateTime=-1/0,this.refreshInterval=5,this.demuxer=e,this.nextLines=i}runUpdateSegments(){return this.currentUpdateSegmentsPromise??(this.currentUpdateSegmentsPromise=(async()=>{try{const e=this.getRemainingWaitTimeMs();e>0&&await Jm(e),this.lastSegmentUpdateTime=performance.now(),await this.updateSegments()}finally{this.currentUpdateSegmentsPromise=null}})())}getRemainingWaitTimeMs(){const e=performance.now()-this.lastSegmentUpdateTime,n=Math.max(0,1e3*this.refreshInterval-e);return n<=50?0:n}async updateSegments(){let e=this.nextLines;if(this.nextLines=null,!e){const A={stack:[],error:void 0,hasError:!1};try{const y=ZC(A,await this.demuxer.input._getSourceUncached({path:this.path,isRoot:!1}),!1),E=await new Zd(y.source).requestEntireFile();b(E),e=Yx(E,E.length,{ignore:QC})}catch(y){A.error=y,A.hasError=!0}finally{ex(A)}}let n=!1,r=0,i=null,s=null,a=0,o=null,c=null,u=null,l=null,d=null,f=null,h=!1,m=yt(this.segments)??null;const p=A=>{const y=A.indexOf("@"),w=Number(y===-1?A:A.slice(0,y));if(!Number.isInteger(w)||w<0)throw new Error(`Invalid #EXT-X-BYTERANGE length '${A}'.`);let E=null;if(y!==-1&&(E=Number(A.slice(y+1)),!Number.isInteger(E)||E<0))throw new Error(`Invalid #EXT-X-BYTERANGE offset '${A}'.`);return{length:w,offset:E}},g=A=>{a=A,m&&(b(m.sequenceNumber!==null),m.sequenceNumber<A&&(r=m.timestamp+m.duration,o=m.firstSegment,c=m.initSegment,d=m.lastProgramDateTimeSeconds,m=null))};for(let A=0;A<e.length;A++){const y=e[A];if(!n){if(y!=="#EXTM3U")throw new Error("Invalid M3U8 file; expected first line to be #EXTM3U.");n=!0;continue}if(!y.startsWith("#")){if(!m){if(i===null)throw new Error("Invalid M3U8 file; a segment must be preceded by an #EXTINF tag.");let w=s;if(w&&w.method==="AES-128"&&!w.iv){const T=new Uint8Array(Er),C=_e(T);C.setUint32(8,Math.floor(a/2**32)),C.setUint32(12,a),w={...w,iv:T}}const S={path:en(this.path,y),offset:(l==null?void 0:l.offset)??0,length:(l==null?void 0:l.length)??null},k={timestamp:r,relativeToUnixEpoch:d!==null,firstSegment:o,sequenceNumber:a,location:S,duration:i,encryption:w,initSegment:c,lastProgramDateTimeSeconds:d};o??(o=k),r+=i,this.segments.push(k)}i=null,l===null?u=null:l=null,g(a+1)}if(y.startsWith(Rg)){if(m){h=!0;continue}h||(d===null&&a>0&&f!==null&&(r=a*f),h=!0);const w=y.slice(Rg.length),E=w.indexOf(","),S=E===-1?w:w.slice(0,E),k=Number(S);if(!Number.isFinite(k)||k<0)throw new Error(`Invalid #EXTINF tag duration '${S}'.`);i=k}else if(y.startsWith(MC)){const w=new Nc(y.slice(MC.length)),E=w.get("uri");if(!E)throw new Error("Invalid #EXT-X-MAP tag; missing URI attribute.");const S=w.get("byterange");let k=null;if(S!==null&&(k=p(S)),k&&k.offset===null)throw new Error("Invalid #EXT-X-MAP tag; BYTERANGE attribute must have a specified offset.");if(!m){const C={path:en(this.path,E),offset:(k==null?void 0:k.offset)??0,length:(k==null?void 0:k.length)??null};if((s==null?void 0:s.method)==="AES-128"&&!s.iv)throw new Error("IV attribute must be set on #EXT-X-KEY tag preceding the #EXT-X-MAP tag.");c={timestamp:r,relativeToUnixEpoch:d!==null,firstSegment:null,sequenceNumber:null,location:C,duration:0,encryption:s,initSegment:null,lastProgramDateTimeSeconds:d}}i=null,l===null?u=null:l=null}else if(y.startsWith(DC)){const w=new Nc(y.slice(DC.length)),E=w.get("method");if(E==="NONE")s=null;else if(E==="AES-128"){const S=w.get("uri");if(!S)throw new Error("Invalid #EXT-X-KEY: AES-128 requires a URI attribute.");let k=null;const T=w.get("iv");if(T){if(!h5.test(T))throw new Error(`Unsupported IV format '${T}'.`);let _=T.slice(2);_=_.padStart(Er*2,"0"),k=new Uint8Array(Er);for(let x=0;x<Er;x++){const P=-Er*2+x;
714k[x]=parseInt(_.slice(P,P+2),16)}}const C=w.get("keyformat")??"identity";if(C!=="identity")throw new Error("For AES-128 encryption, only the 'identity' KEYFORMAT is currently supported. If you think other formats should be supported, please raise an issue.");s={method:"AES-128",keyUri:en(this.path,S),iv:k,keyFormat:C}}else if(E==="SAMPLE-AES"||E==="SAMPLE-AES-CTR"){const S=w.get("uri");if(!S)throw new Error(`Invalid #EXT-X-KEY: ${E} requires a URI attribute.`);if((w.get("keyformat")??"identity")==="identity")throw new Error("For SAMPLE-AES and SAMPLE-AES-CTR encryption, the 'identity' KEYFORMAT is not supported. If you think this format should be supported, please raise an issue.");let T=null;if(p5.test(S)){const C=S.indexOf(","),_=Ad(S.slice(C+1));if(_.length>=8&&_[4]===112&&_[5]===115&&_[6]===115&&_[7]===104){const x=_e(_).getUint32(0);T=jI(_.subarray(8,Math.min(x,_.length)))}}s={method:E,psshBox:T}}else throw new Error(`Unsupported encryption method '${E}'. If you think this method should be supported, please raise an issue.`)}else if(y.startsWith(OC)){const w=y.slice(OC.length),E=Number(w);if(!Number.isInteger(E)||E<0)throw new Error(`Invalid EXT-X-MEDIA-SEQUENCE value '${w}'.`);g(E)}else if(y.startsWith(NC)){const w=p(y.slice(NC.length));if(w.offset===null){if(u===null)throw new Error("Invalid M3U8 file; #EXT-X-BYTERANGE without offset requires a previous byte range.");w.offset=u}l=w,u=w.offset+w.length}else if(y.startsWith(UC)){if(m)continue;const w=y.slice(UC.length),E=Date.parse(w);if(!Number.isFinite(E))continue;const S=E/1e3;if(d===S)continue;if(d===null&&this.segments.length>0){const k=yt(this.segments),T=k.timestamp+k.duration,C=S-T;for(const _ of this.segments)_.timestamp+=C,_.relativeToUnixEpoch=!0;r+=C}d=S,r=S}else if(y===i5)o=null;else if(y.startsWith(LC)){const w=y.slice(LC.length),E=Number(w);if(!Number.isFinite(E)||E<0)throw new Error(`Invalid EXT-X-TARGETDURATION value '${w}'.`);this.refreshInterval=E,f=E}else if(y===s5){this.streamHasEnded=!0;break}else y.startsWith(zC)&&y.slice(zC.length).toLowerCase()==="vod"&&(this.streamHasEnded=!0)}if(!n)throw new Error("Invalid M3U8 file; no #EXTM3U header.")}async getFirstSegment(){return this.segments.length===0&&await this.runUpdateSegments(),this.segments[0]??null}async getSegmentAt(e,n){this.segments.length===0&&await this.runUpdateSegments();let r=!!n.skipLiveWait&&this.getRemainingWaitTimeMs()>0;for(;;){const i=Ge(this.segments,e,a=>a.timestamp);if(i===-1)return null;if(i<this.segments.length-1||this.streamHasEnded||r)return this.segments[i];const s=this.segments[i];if(e<s.timestamp+s.duration)return s;await this.runUpdateSegments(),n.skipLiveWait&&(r=!0)}}async getNextSegment(e,n){const r=this.segments.indexOf(e);b(r!==-1);const i=r+1;let s=!!n.skipLiveWait&&this.getRemainingWaitTimeMs()>0;for(;;){if(i<this.segments.length)return this.segments[i];if(this.streamHasEnded||s)return null;await this.runUpdateSegments(),n.skipLiveWait&&(s=!0)}}async getPreviousSegment(e){const n=this.segments.indexOf(e);return b(n!==-1),this.segments[n-1]??null}getInputForSegment(e){var c;const n=e,r=this.inputCache.find(u=>u.segment===n);if(r)return r.age=this.nextInputCacheAge++,r.input;let i=null;(n.initSegment||n.firstSegment)&&(i=this.getInputForSegment(n.initSegment??n.firstSegment));const s={...this.input._formatOptions,isobmff:{...this.input._formatOptions.isobmff,resolveKeyId:((c=this.input._formatOptions.isobmff)==null?void 0:c.resolveKeyId)&&(u=>{if(!n.encryption||!(n.encryption.method==="SAMPLE-AES"||n.encryption.method==="SAMPLE-AES-CTR")||!n.encryption.psshBox)return this.input._formatOptions.isobmff.resolveKeyId(u);let l=u.psshBoxes;const{psshBox:d}=n.encryption;return(d.keyIds===null||d.keyIds.includes(u.keyId))&&!l.some(f=>$I(f,d))&&(l=[...l,d]),this.input._formatOptions.isobmff.resolveKeyId({...u,psshBoxes:l})})}},a=new Yc({source:new jC(n.location.path,async u=>{b(u.isRoot);const l={...u,isRoot:!1};let d;const f=n.location.offset>0||n.location.length!==null;if(!n.encryption||n.encryption.method==="SAMPLE-AES"||n.encryption.method==="SAMPLE-AES-CTR"){if(d=await this.input._get
714SourceCached(l),f){const m=d.source.slice(n.location.offset,n.location.length??void 0).ref();d.free(),d=m}}else if(n.encryption.method==="AES-128"){const h=n.encryption;b(h.iv);let m=await this.input._getSourceCached(l);if(f){const y=m.source.slice(n.location.offset,n.location.length??void 0).ref();m.free(),m=y}const p=new Zd(m.source),g=IV(p,async()=>{const A={stack:[],error:void 0,hasError:!1};try{const y=ZC(A,await this.input._getSourceCached({path:h.keyUri,isRoot:!1},tG),!1),E=await new Zd(y.source).requestSlice(0,Er);if(!E)throw new Error("Invalid AES-128 key; expected at least 16 bytes of data.");return{key:de(E,Er),iv:h.iv}}catch(y){A.error=y,A.hasError=!0}finally{ex(A)}},()=>{m.free()});d=new XC(g).ref()}else b(!1);return d}),formats:this.input._formats.filter(u=>!(u instanceof zg)),initInput:i??void 0,formatOptions:s});if(a._onFormatDetermined=u=>{var l,d;if((((l=n.encryption)==null?void 0:l.method)==="SAMPLE-AES"||((d=n.encryption)==null?void 0:d.method)==="SAMPLE-AES-CTR")&&!u._isIsobmff)throw new Error("The SAMPLE-AES and SAMPLE-AES-CTR encryption methods are currently only supported for ISOBMFF files.")},this.inputCache.push({segment:n,input:a,age:this.nextInputCacheAge++}),this.inputCache.length>4){const u=$m(this.inputCache,l=>l.age);b(u!==-1),this.inputCache.splice(u,1)}return a}
714async getLiveRefreshInterval(){return this.getRemainingWaitTimeMs()===0&&await this.runUpdateSegments(),this.streamHasEnded?null:this.refreshInterval}}/*!
715 * Copyright (c) 2026-present, Vanilagy and contributors
716 *
717 * This Source Code Form is subject to the terms of the Mozilla Public
718 * License, v. 2.0. If a copy of the MPL was not distributed with this
719 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
720 */class m5 extends Xr{constructor(e){super(e),this.metadataPromise=null,this.trackBackings=null,this.internalTracks=null,this.segmentedInputs=[],this.hasMasterPlaylist=!0}readMetadata(){return this.metadataPromise??(this.metadataPromise=(async()=>{b(this.input._rootSource instanceof Ms);const{rootPath:e}=this.input._rootSource,n=await this.input._reader.requestEntireFile();b(n);const r=Yx(n,n.length,{ignore:QC}),i=[],s=[];for(let d=1;d<r.length;d++){const f=r[d];if(f.startsWith(PC)){const h=d,m=r[++d];if(m===void 0)throw new Error("Incorrect M3U8 file; a line must follow the #EXT-X-STREAM-INF tag.");const p=en(e,m),g=new Nc(f.slice(PC.length));if(g.getAsNumber("bandwidth")===null)throw new Error("Invalid M3U8 file; #EXT-X-STREAM-INF tag requires a BANDWIDTH attribute with a valid numerical value.");i.push({fullPath:p,attributes:g,lineNumber:h,hasOnlyKeyPackets:!1})}else if(f.startsWith(RC)){const h=new Nc(f.slice(RC.length)),m=h.get("uri");if(m===null)throw new Error("Invalid M3U8 file; #EXT-X-I-FRAME-STREAM-INF tag requires a URI attribute.");if(h.getAsNumber("bandwidth")===null)throw new Error("Invalid M3U8 file; #EXT-X-I-FRAME-STREAM-INF tag requires a BANDWIDTH attribute with a valid numerical value.");const g=en(e,m);i.push({fullPath:g,attributes:h,lineNumber:d,hasOnlyKeyPackets:!0})}else if(f.startsWith(FC)){const h=new Nc(f.slice(FC.length));if(h.get("type")===null)throw new Error("Invalid M3U8 file; #EXT-X-MEDIA tag requires a TYPE attribute.");if(h.get("group-id")===null)throw new Error("Invalid M3U8 file; #EXT-X-MEDIA tag requires a GROUP-ID attribute.");let g=null;const A=h.get("uri");A!==null&&(g=en(e,A)),s.push({fullPath:g,attributes:h,lineNumber:d})}else if(f!==a5){if(f.startsWith(Rg)){const h=new tx(this,e,null,r);this.segmentedInputs=[h],this.hasMasterPlaylist=!1,this.trackBackings=await h.getTrackBackings();return}}}const a=[...new Set(s.filter(d=>d.attributes.get("type").toLowerCase()==="video").map(d=>d.attributes.get("group-id")))],o=[...new Set(s.filter(d=>d.attributes.get("type").toLowerCase()==="audio").map(d=>d.attributes.get("group-id")))],c=await Promise.all(i.map(async(d,f)=>{const h=[],m=d.attributes.get("codecs");let p;if(m)p=m.split(",").map(_=>_.trim());
720else{const x=await this.getSegmentedInputForPath(d.fullPath).getTrackBackings(),P=await Promise.all(x.map(async v=>({track:v,codec:await v.getCodec()})));p=await Promise.all(P.filter(v=>v.codec!==null).map(v=>v.track.getDecoderConfig().then(M=>M.codec)))}const g=d.attributes.get("video"),A=d.attributes.get("audio"),y=p.some(_=>xt.includes(jr(_))),w=p.some(_=>Ut.includes(jr(_)));if(g!==null&&!y){if(!a.includes(g))throw new Error(`Invalid M3U8 file; variant stream references video group "${g}" which is not defined in any #EXT-X-MEDIA tags.`);const _=s.find(x=>{const P=x.attributes.get("group-id"),v=x.attributes.get("type");return P===g&&v.toLowerCase()==="video"});e:if(_){const x=_.attributes.get("uri");if(x===null)break e;const P=en(e,x),D=(await this.getSegmentedInputForPath(P).getTrackBackings()).find(N=>N.getType()==="video");if(!D||await D.getCodec()===null)break e;const O=await D.getDecoderConfig().then(N=>(N==null?void 0:N.codec)??null);b(O!==null),p.push(O)}}if(A!==null&&!w){if(!o.includes(A))throw new Error(`Invalid M3U8 file; variant stream references audio group "${A}" which is not defined in any #EXT-X-MEDIA tags.`);const _=s.find(x=>{const P=x.attributes.get("group-id"),v=x.attributes.get("type");return P===A&&v.toLowerCase()==="audio"});e:if(_){const x=_.attributes.get("uri");if(x===null)break e;
720const P=en(e,x),D=(await this.getSegmentedInputForPath(P).getTrackBackings()).find(N=>N.getType()==="audio");if(!D||await D.getCodec()===null)break e;const O=await D.getDecoderConfig().then(N=>(N==null?void 0:N.codec)??null);b(O!==null),p.push(O)}}p=[...new Set(p)];let E=null,S=null;const k=d.attributes.getAsNumber("bandwidth");b(k!==null);const T=d.attributes.getAsNumber("average-bandwidth"),C=d.attributes.get("name");for(const _ of p){const x=jr(_);if(x!==null){if(xt.includes(x)){if(E!==null)throw new Error("Unsupported M3U8 file; multiple video codecs found in the CODECS attribute of a variant stream.");E=_;const P=d.attributes.get("video");if(P===null){const v=d.attributes.get("resolution");let M=null,D=null;if(v){const O=v.match(/^(\d+)x(\d+)$/);O&&(M=Number(O[1]),D=Number(O[2]))}h.push({id:-1,demuxer:this,backingTrack:null,default:!0,autoselect:!0,languageCode:Kt,lineNumber:d.lineNumber,fullPath:d.fullPath,fullCodecString:E,pairingMask:1n<<BigInt(f),peakBitrate:k,averageBitrate:T,name:C,hasOnlyKeyPackets:d.hasOnlyKeyPackets,info:{type:"video",width:M,height:D}})}else{if(!a.includes(P))throw new Error(`Invalid M3U8 file; variant stream references video group "${P}" which is not defined in any #EXT-X-MEDIA tags.`);for(const v of s){const M=v.attributes.get("group-id"),D=v.attributes.get("type");if(M!==P||D.toLowerCase()!=="video")continue;const O=v.attributes.get("resolution")??d.attributes.get("resolution");let N=null,Q=null;if(O){const G=O.match(/^(\d+)x(\d+)$/);G&&(N=Number(G[1]),Q=Number(G[2]))}h.push({id:-1,demuxer:this,backingTrack:null,default:Ud(v.attributes),autoselect:Ud(v.attributes)||sx(v.attributes),languageCode:ax(v.attributes.get("language")),lineNumber:v.lineNumber,fullPath:v.fullPath??d.fullPath,fullCodecString:E,pairingMask:1n<<BigInt(f),peakBitrate:null,averageBitrate:null,name:v.attributes.get("name"),hasOnlyKeyPackets:d.hasOnlyKeyPackets,info:{type:"video",width:N,height:Q}})}}}else if(Ut.includes(x)){if(S!==null)throw new Error("Unsupported M3U8 file; multiple audio codecs found in the CODECS attribute of a variant stream.");S=_;const P=d.attributes.get("audio");if(P===null){const v=d.attributes.get("channels"),M=v!==null?Number(v.split("/")[0]):null;h.push({id:-1,demuxer:this,backingTrack:null,default:!0,autoselect:!0,languageCode:Kt,lineNumber:d.lineNumber,fullPath:d.fullPath,fullCodecString:S,pairingMask:1n<<BigInt(f),peakBitrate:k,averageBitrate:T,name:C,hasOnlyKeyPackets:d.hasOnlyKeyPackets,info:{type:"audio",numberOfChannels:M!==null&&Number.isInteger(M)&&M>0?M:null}})}else{if(!o.includes(P))throw new Error(`Invalid M3U8 file; variant stream references audio group "${P}" which is not defined in any #EXT-X-MEDIA tags.`);for(const v of s){const M=v.attributes.get("group-id"),D=v.attributes.get("type");if(M!==P||D.toLowerCase()!=="audio")continue;const O=v.attributes.get("channels")??d.attributes.get("channels"),N=O!==null?Number(O.split("/")[0]):null;h.push({id:-1,demuxer:this,backingTrack:null,default:Ud(v.attributes),autoselect:Ud(v.attributes)||sx(v.attributes),languageCode:ax(v.attributes.get("language")),lineNumber:v.lineNumber,fullPath:v.fullPath??d.fullPath,fullCodecString:S,pairingMask:1n<<BigInt(f),peakBitrate:null,averageBitrate:null,name:v.attributes.get("name"),hasOnlyKeyPackets:d.hasOnlyKeyPackets,info:{type:"audio",numberOfChannels:N!==null&&Number.isInteger(N)&&N>0?N:null}})}}}}}return h})),u=[],l=d=>{const f=u.find(h=>h.fullPath===d.fullPath&&h.info.type===d.info.type);f?(f.pairingMask|=d.pairingMask,f.default||(f.default=d.default),f.autoselect||(f.autoselect=d.autoselect),f.lineNumber=Math.min(f.lineNumber,d.lineNumber),d.peakBitrate!==null&&(f.peakBitrate=Math.max(f.peakBitrate??-1/0,d.peakBitrate)),d.averageBitrate!==null&&(f.averageBitrate=Math.max(f.averageBitrate??-1/0,d.averageBitrate)),f.languageCode===Kt&&(f.languageCode=d.languageCode)):(d.id=u.length+1,u.push(d))};for(const d of c)for(const f of d)l(f);u.sort((d,f)=>d.lineNumber-f.lineNumber),this.trackBackings=[];for(const d of u)d.info.type==="video"?this.trackBackings.push(new rx(d)):this.trackBackings.push(new ix(d));this.internalTracks=u})())}async getTrackBackings(){return await this.readMetadata(),b(this.trackBackings),this.trackBackings}getSegmentedInputForPath(e){let n=this.segmentedInputs.find(i=>i.path===e);if(n)return n;let r=null;return this.internalTracks&&(r=this.internalTracks.filter(s=>s.fullPath===e).map(s=>({id:s.id,type:s.info.type}))),n=new tx(this,e,r,null),this.segmentedInputs.push(n),n}async getMetadataTags(){return{}}async getMimeType(){return ro}dispose(){if(this.segmentedInputs){for(const e of this.segmentedInputs)e.dispose();this.segmentedInputs.length=0}}}class nx{constructor(e){this.internalTrack=e,this.hydrationPromise=null}hydrate(){return this.hydrationPromise??(this.hydrationPromise=(async()=>{const e=this.internalTrack.demuxer.getSegmentedInputForPath(this.internalTrack.fullPath);let n=null;const i=(await e.getTrackBackings()).filter(s=>s.getType()===this.getType());if(i.length===1)n=i[0];else if(this instanceof rx){for(const s of i)if(await s.getCodec()===this.getCodec()){n=s;break}}else{b(this instanceof ix);for(const s of i)if(await s.getCodec()===this.getCodec()){n=s;break}}if(!n)throw new Error("Could not find matching track in underlying media data.");this.internalTrack.backingTrack=n})())}delegate(e){return this.internalTrack.backingTrack?e():this.hydrate().then(e)}getCodec(){throw new Error("Not implemented on base class.")}getDisposition(){return{...Kr,default:this.internalTrack.autoselect,primary:this.internalTrack.default}}getId(){return this.internalTrack.id}getPairingMask(){return this.internalTrack.pairingMask}getInternalCodecId(){return null}getLanguageCode(){return this.internalTrack.languageCode}getName(){return this.internalTrack.name}getNumber(){b(this.internalTrack.demuxer.internalTracks);const e=this.internalTrack.info.type;let n=0;for(const r of this.internalTrack.demuxer.internalTracks)if(r.info.type===e&&n++,r===this.internalTrack)break;return n}getTimeResolution(){return this.delegate(()=>this.internalTrack.backingTrack.getTimeResolution())}isRelativeToUnixEpoch(){return this.delegate(()=>this.internalTrack.backingTrack.isRelativeToUnixEpoch())}getBitrate(){return this.internalTrack.peakBitrate}getAverageBitrate(){return this.internalTrack.averageBitrate}async getDurationFromMetadata(e){return await this.hydrate(),this.internalTrack.backingTrack.getDurationFromMetadata(e)}
vendor: 1,594 bytes, line 720
720async getLiveRefreshInterval(){return await this.hydrate(),this.internalTrack.backingTrack.getLiveRefreshInterval()}getHasOnlyKeyPackets(){return this.internalTrack.hasOnlyKeyPackets||null}async getFirstPacket(e){return await this.hydrate(),this.internalTrack.backingTrack.getFirstPacket(e)}async getPacket(e,n){return await this.hydrate(),this.internalTrack.backingTrack.getPacket(e,n)}async getKeyPacket(e,n){return await this.hydrate(),this.internalTrack.backingTrack.getKeyPacket(e,n)}async getNextPacket(e,n){return await this.hydrate(),this.internalTrack.backingTrack.getNextPacket(e,n)}async getNextKeyPacket(e,n){return await this.hydrate(),this.internalTrack.backingTrack.getNextKeyPacket(e,n)}}class rx extends nx{constructor(e){super(e)}get backingVideoTrack(){return this.internalTrack.backingTrack}getType(){return"video"}getCodec(){return jr(this.internalTrack.fullCodecString)}getCodedWidth(){return this.delegate(()=>this.backingVideoTrack.getCodedWidth())}getCodedHeight(){return this.delegate(()=>this.backingVideoTrack.getCodedHeight())}getSquarePixelWidth(){return this.delegate(()=>this.backingVideoTrack.getSquarePixelWidth())}getSquarePixelHeight(){return this.delegate(()=>this.backingVideoTrack.getSquarePixelHeight())}getMetadataDisplayWidth(){return this.backingVideoTrack?null:this.internalTrack.info.width}getMetadataDisplayHeight(){return this.backingVideoTrack?null:this.internalTrack.info.height}getRotation(){return this.delegate(()=>this.backingVideoTrack.getRotation())}async getColorSpace(){return await this.hydrate(),this.backingVideoTrack.getColorSpace()}
720async canBeTransparent(){return await this.hydrate(),this.backingVideoTrack.canBeTransparent()}getMetadataCodecParameterString(){return this.backingVideoTrack?null:this.internalTrack.fullCodecString}async getDecoderConfig(){return await this.hydrate(),this.backingVideoTrack.getDecoderConfig()}}class ix extends nx{constructor(e){super(e)}get backingAudioTrack(){return this.internalTrack.backingTrack}getType(){return"audio"}getCodec(){return jr(this.internalTrack.fullCodecString)}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels!==null?this.internalTrack.info.numberOfChannels:this.delegate(()=>this.backingAudioTrack.getNumberOfChannels())}getSampleRate(){return this.delegate(()=>this.backingAudioTrack.getSampleRate())}getMetadataCodecParameterString(){return this.backingAudioTrack?null:this.internalTrack.fullCodecString}async getDecoderConfig(){return await this.hydrate(),this.backingAudioTrack.getDecoderConfig()}}const Ud=t=>{const e=t.get("default");if(e===null)return!1;const n=e.toUpperCase();if(n==="YES")return!0;if(n==="NO")return!1;throw new Error(`Invalid M3U8 file; #EXT-X-MEDIA DEFAULT attribute must be YES or NO, got "${e}".`)},sx=t=>{const e=t.get("autoselect");if(e===null)return!1;const n=e.toUpperCase();if(n==="YES")return!0;if(n==="NO")return!1;throw new Error(`Invalid M3U8 file; #EXT-X-MEDIA AUTOSELECT attribute must be YES or NO, got "${e}".`)},ax=t=>{if(t===null)return Kt;const e=t.split("-")[0];return e||Kt};/*!
721 * Copyright (c) 2026-present, Vanilagy and contributors
722 *
723 * This Source Code Form is subject to the terms of the Mozilla Public
724 * License, v. 2.0. If a copy of the MPL was not distributed with this
725 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
726 */class or{constructor(){this._isIsobmff=!1}}class Ug extends or{constructor(){super(...arguments),this._isIsobmff=!0}async _getMajorBrand(e){let n=e._reader.requestSlice(0,12);if(n instanceof Promise&&(n=await n),!n)return null;n.skip(4);const r=_t(n,4);return r!=="ftyp"&&r!=="styp"?null:_t(n,4)}_createDemuxer(e){return new yg(e)}}class ox extends Ug{async _canReadInput(e){const n=await this._getMajorBrand(e);if(n!==null)return n!=="qt  ";let r=e._reader.requestSlice(4,4);if(r instanceof Promise&&(r=await r),!r)return!1;const i=_t(r,4);return i==="moof"||i==="sidx"}get name(){return"MP4"}get mimeType(){return"video/mp4"}}class cx extends Ug{async _canReadInput(e){return await this._getMajorBrand(e)==="qt  "}get name(){return"QuickTime File Format"}get mimeType(){return"video/quicktime"}}class Lg extends or{async isSupportedEBMLOfDocType(e,n){let r=e._reader.requestSlice(0,ei);if(r instanceof Promise&&(r=await r),!r)return!1;const i=fC(r);if(i===null||i<1||i>8||Oe(r,i)!==R.EBML)return!1;const a=hC(r);if(typeof a!="number")return!1;let o=e._reader.requestSlice(r.filePos,a);if(o instanceof Promise&&(o=await o),!o)return!1;const c=r.filePos;for(;o.filePos<=c+a-Gn;){const u=ti(o);if(!u)break;const{id:l,size:d}=u,f=o.filePos;if(d===void 0)return!1;switch(l){case R.EBMLVersion:if(Oe(o,d)!==1)return!1;break;case R.EBMLReadVersion:if(Oe(o,d)!==1)return!1;break;case R.DocType:if(Za(o,d)!==n)return!1;break;case R.DocTypeVersion:if(Oe(o,d)>4)return!1;break}o.filePos=f+d}return!0}_canReadInput(e){return this.isSupportedEBMLOfDocType(e,"matroska")}_createDemuxer(e){return new NV(e)}get name(){return"Matroska"}get mimeType(){return"video/x-matroska"}}class ux extends Lg{_canReadInput(e){return this.isSupportedEBMLOfDocType(e,"webm")}get name(){return"WebM"}get mimeType(){return"video/webm"}}class lx extends or{async _canReadInput(e){let n=0;for(;;){let d=e._reader.requestSlice(n,ai);if(d instanceof Promise&&(d=await d),!d)break;const f=Ls(d);if(!f)break;n=d.filePos+f.size}const r=await xg(e._reader,n,n+4096);if(!r)return!1;const i=r.header,s=Sd(i.mpegVersionId,i.channel);let a=e._reader.requestSlice(r.startPos+s,4);if(a instanceof Promise&&(a=await a),!a)return!1;const o=J(a);if(o===Ed||o===ig)return!0;n=r.startPos+r.header.totalSize;const u=await xg(e._reader,n,n+Cs);if(!u)return!1;const l=u.header;return!(i.channel!==l.channel||i.sampleRate!==l.sampleRate)}_createDemuxer(e){return new zV(e)}get name(){return"MP3"}get mimeType(){return"audio/mpeg"}}
726class dx extends or{async _canReadInput(e){let n=e._reader.requestSlice(0,12);if(n instanceof Promise&&(n=await n),!n)return!1;const r=_t(n,4);return r!=="RIFF"&&r!=="RIFX"&&r!=="RF64"?!1:(n.skip(4),_t(n,4)==="WAVE")}_createDemuxer(e){return new qV(e)}get name(){return"WAVE"}get mimeType(){return"audio/wav"}}class fx extends or{async _canReadInput(e){let n=e._reader.requestSlice(0,4);return n instanceof Promise&&(n=await n),n?_t(n,4)==="OggS":!1}_createDemuxer(e){return new VV(e)}get name(){return"Ogg"}get mimeType(){return"application/ogg"}}class hx extends or{async _canReadInput(e){let n=e._reader.requestSlice(0,4);return n instanceof Promise&&(n=await n),n?_t(n,4)==="fLaC":!1}get name(){return"FLAC"}get mimeType(){return"audio/flac"}_createDemuxer(e){return new ZV(e)}}class px extends or{async _canReadInput(e){let n=0;for(;;){let a=e._reader.requestSlice(n,ai);if(a instanceof Promise&&(a=await a),!a)break;const o=Ls(a);if(!o)break;n=a.filePos+o.size}let r=e._reader.requestSliceRange(n,Dc,Vi);if(r instanceof Promise&&(r=await r),!r)return!1;const i=ri(r);if(!i||(n+=i.frameLength,r=e._reader.requestSliceRange(n,Dc,Vi),r instanceof Promise&&(r=await r),!r))return!1;const s=ri(r);return s?i.objectType===s.objectType&&i.samplingFrequencyIndex===s.samplingFrequencyIndex&&i.channelConfiguration===s.channelConfiguration:!1}_createDemuxer(e){return new KV(e)}get name(){return"ADTS"}get mimeType(){return"audio/aac"}}class mx extends or{async _canReadInput(e){const n=hn+16+1;let r=e._reader.requestSlice(0,n);if(r instanceof Promise&&(r=await r),!r)return!1;const i=de(r,n);return i[0]===71&&i[hn]===71||i[0]===71&&i[hn+16]===71?!0:i[4]===71&&i[4+hn+4]===71}_createDemuxer(e){return new t5(e)}get name(){return"MPEG Transport Stream"}get mimeType(){return"video/MP2T"}}class zg extends or{async _canReadInput(e){let n=e._reader.requestSlice(0,7);if(n instanceof Promise&&(n=await n),!n||!(_t(n,7)==="#EXTM3U"))return!1;if(!(e._rootSource instanceof Ms))throw new TypeError("HLS inputs require `InputOptions.source` to be a PathedSource or a ref to one.");return e._rootSource._usedForHls=!0,!0}_createDemuxer(e){return new m5(e)}get name(){return"HTTP Live Streaming (HLS)"}get mimeType(){return ro}}const Qg=new ox,Hg=new cx,gx=new Lg,Ax=new ux,Wg=new lx,yx=new dx,wx=new fx,Vg=new px,bx=new hx,Gg=new mx,qg=new zg,g5=[qg,Qg,Hg,gx,Ax,yx,wx,bx,Wg,Vg,Gg],A5=[qg,Qg,Hg,Wg,Vg,Gg],y5=(t,e)=>{if(!t||typeof t!="object")throw new TypeError(`${e}, when provided, must be an object.`);if(t.isobmff!==void 0){if(!t.isobmff||typeof t.isobmff!="object")throw new TypeError(`${e}.isobmff, when provided, must be an object.`);if(t.isobmff.resolveKeyId!==void 0&&typeof t.isobmff.resolveKeyId!="function")throw new TypeError(`${e}.isobmff.resolveKeyId, when provided, must be a function.`)}};/*!
727 * Copyright (c) 2026-present, Vanilagy and contributors
728 *
729 * This Source Code Form is subject to the terms of the Mozilla Public
730 * License, v. 2.0. If a copy of the MPL was not distributed with this
731 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
732 */const Yg=new Map,Kg=new Map,w5=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.codec!==void 0&&typeof e.codec!="string")throw new TypeError("options.codec, when provided, must be a string.");if(e.codec!==void 0&&jr(e.codec)!==t)throw new TypeError(`options.codec, when provided, must match the specified codec (${t}).`);if(e.codedWidth!==void 0&&(!Number.isInteger(e.codedWidth)||e.codedWidth<=0))throw new TypeError("options.codedWidth, when provided, must be a positive integer.");if(e.codedHeight!==void 0&&(!Number.isInteger(e.codedHeight)||e.codedHeight<=0))throw new TypeError("options.codedHeight, when provided, must be a positive integer.");if(e.displayAspectWidth!==void 0&&(!Number.isInteger(e.displayAspectWidth)||e.displayAspectWidth<=0))throw new TypeError("options.displayAspectWidth, when provided, must be a positive integer.");if(e.displayAspectHeight!==void 0&&(!Number.isInteger(e.displayAspectHeight)||e.displayAspectHeight<=0))throw new TypeError("options.displayAspectHeight, when provided, must be a positive integer.");if(e.description!==void 0&&!Ua(e.description))throw new TypeError("options.description, when provided, must be a buffer source.");if(e.hardwareAcceleration!==void 0&&!["no-preference","prefer-hardware","prefer-software"].includes(e.hardwareAcceleration))throw new TypeError("options.hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.");
732if(e.optimizeForLatency!==void 0&&typeof e.optimizeForLatency!="boolean")throw new TypeError("options.optimizeForLatency, when provided, must be a boolean.")},b5=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.codec!==void 0&&typeof e.codec!="string")throw new TypeError("options.codec, when provided, must be a string.");if(e.codec!==void 0&&jr(e.codec)!==t)throw new TypeError(`options.codec, when provided, must match the specified codec (${t}).`);if(e.numberOfChannels!==void 0&&(!Number.isInteger(e.numberOfChannels)||e.numberOfChannels<=0))throw new TypeError("options.numberOfChannels, when provided, must be a positive integer.");if(e.sampleRate!==void 0&&(!Number.isInteger(e.sampleRate)||e.sampleRate<=0))throw new TypeError("options.sampleRate, when provided, must be a positive integer.");if(e.description!==void 0&&!Ua(e.description))throw new TypeError("options.description, when provided, must be a buffer source.")},E5=t=>xt.includes(t)?jg(t):Ut.includes(t)?$g(t):!1,jg=async(t,e={})=>{if(!xt.includes(t))return!1;w5(t,e);const n={...e,codedWidth:e.codedWidth??1280,codedHeight:e.codedHeight??720,codec:e.codec??CI(t,1280,720,1e6)};n.description??(n.description=KW());const r=JSON.stringify(n),i=Yg.get(r);if(i)return i;const s=(async()=>Hc.some(o=>o.supports(t,n))?!0:typeof VideoDecoder>"u"?!1:(await VideoDecoder.isConfigSupported(n)).supported===!0)();return Yg.set(r,s),s},$g=async(t,e={})=>{if(!Ut.includes(t))return!1;b5(t,e);const n={...e,numberOfChannels:e.numberOfChannels??2,sampleRate:e.sampleRate??48e3,codec:e.codec??vI(t,2,48e3)};if(n.description===void 0){const a=jW(n);if(a===!1)return!1;n.description=a}const r=JSON.stringify(n),i=Kg.get(r);if(i)return i;const s=(async()=>Wc.some(o=>o.supports(t,n))||Nt.includes(t)?!0:typeof AudioDecoder>"u"?!1:(await AudioDecoder.isConfigSupported(n)).supported===!0)();return Kg.set(r,s),s},S5=async()=>{const[t,e]=await Promise.all([Ex(),Sx()]);return[...t,...e]},Ex=async(t=xt,e)=>{const n=await Promise.all(t.map(r=>jg(r,e)));return t.filter((r,i)=>n[i])},Sx=async(t=Ut,e)=>{const n=await Promise.all(t.map(r=>$g(r,e)));return t.filter((r,i)=>n[i])};/*!
733 * Copyright (c) 2026-present, Vanilagy and contributors
734 *
735 * This Source Code Form is subject to the terms of the Mozilla Public
736 * License, v. 2.0. If a copy of the MPL was not distributed with this
737 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
738 */var _5=function(t,e,n){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],n&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:r,async:n})}else n&&t.stack.push({async:!0});return e},T5=(function(t){return function(e){function n(a){e.error=e.hasError?new t(a,e.error,"An error was suppressed during disposal."):a,e.hasError=!0}var r,i=0;function s(){for(;r=e.stack.pop();)try{if(!r.async&&i===1)return i=0,e.stack.push(r),Promise.resolve().then(s);if(r.dispose){var a=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(a).then(s,function(o){return n(o),s()})}else i|=1}catch(o){n(o)}if(i===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return s()}})(typeof SuppressedError=="function"?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r});jm();let _x=-1/0,Tx=-1/0,Fn=null;typeof FinalizationRegistry<"u"&&(Fn=new FinalizationRegistry(t=>{const e=performance.now();t.type==="video"?(e-_x>=1e3&&(console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),_x=e),typeof VideoFrame<"u"&&t.data instanceof VideoFrame&&t.data.close()):(e-Tx>=1e3&&(console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),Tx=e),typeof AudioData<"u"&&t.data instanceof AudioData&&t.data.close())}));class Gi{constructor(){this._referenceCount=0,this._lastAllocationBuffer=null}}const Ld=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],k5=new Set(Ld);class Ft{get codedWidth(){return this.visibleRect.width}get codedHeight(){return this.visibleRect.height}get displayWidth(){return this.rotation%180===0?this.squarePixelWidth:this.squarePixelHeight}get displayHeight(){return this.rotation%180===0?this.squarePixelHeight:this.squarePixelWidth}get microsecondTimestamp(){return Math.trunc(Di*this.timestamp)}get microsecondDuration(){return Math.trunc(Di*this.duration)}get hasAlpha(){return this.format&&this.format.includes("A")}constructor(e,n){var r,i,s,a,o,c,u,l;if(this._closed=!1,e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e)){if(!n||typeof n!="object")throw new TypeError("init must be an object.");if(n.format===void 0||!k5.has(n.format))throw new TypeError("init.format must be one of: "+Ld.join(", "));if(!Number.isInteger(n.codedWidth)||n.codedWidth<=0)throw new TypeError("init.codedWidth must be a positive integer.");
738if(!Number.isInteger(n.codedHeight)||n.codedHeight<=0)throw new TypeError("init.codedHeight must be a positive integer.");if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(n.timestamp))throw new TypeError("init.timestamp must be a number.");if(n.duration!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");if(n.layout!==void 0){if(!Array.isArray(n.layout))throw new TypeError("init.layout, when provided, must be an array.");for(const f of n.layout){if(!f||typeof f!="object"||Array.isArray(f))throw new TypeError("Each entry in init.layout must be an object.");if(!Number.isInteger(f.offset)||f.offset<0)throw new TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(f.stride)||f.stride<0)throw new TypeError("plane.stride must be a non-negative integer.")}}if(n.visibleRect!==void 0&&gI(n.visibleRect,"init.visibleRect"),n.displayWidth!==void 0&&(!Number.isInteger(n.displayWidth)||n.displayWidth<=0))throw new TypeError("init.displayWidth, when provided, must be a positive integer.");if(n.displayHeight!==void 0&&(!Number.isInteger(n.displayHeight)||n.displayHeight<=0))throw new TypeError("init.displayHeight, when provided, must be a positive integer.");if(n.displayWidth!==void 0!=(n.displayHeight!==void 0))throw new TypeError("init.displayWidth and init.displayHeight must be either both provided or both omitted.");this._data=dt(e).slice(),this._layout=n.layout??x5(n.format,n.codedWidth,n.codedHeight),this.format=n.format,this.rotation=n.rotation??0,this.timestamp=n.timestamp,this.duration=n.duration??0;let d=n.colorSpace??null;d===null&&(this.format==="RGBA"||this.format==="RGBX"||this.format==="BGRA"||this.format==="BGRX"?d={primaries:"bt709",transfer:"iec61966-2-1",matrix:"rgb",fullRange:!0}:d={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!1}),this.colorSpace=new zd(d),this.visibleRect={left:((r=n.visibleRect)==null?void 0:r.left)??0,top:((i=n.visibleRect)==null?void 0:i.top)??0,width:((s=n.visibleRect)==null?void 0:s.width)??n.codedWidth,height:((a=n.visibleRect)==null?void 0:a.height)??n.codedHeight},n.displayWidth!==void 0?(this.squarePixelWidth=this.rotation%180===0?n.displayWidth:n.displayHeight,this.squarePixelHeight=this.rotation%180===0?n.displayHeight:n.displayWidth):(this.squarePixelWidth=this.visibleRect.width,this.squarePixelHeight=this.visibleRect.height)}else if(typeof VideoFrame<"u"&&e instanceof VideoFrame){if((n==null?void 0:n.rotation)!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if((n==null?void 0:n.timestamp)!==void 0&&!Number.isFinite(n==null?void 0:n.timestamp))throw new TypeError("init.timestamp, when provided, must be a number.");if((n==null?void 0:n.duration)!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");(n==null?void 0:n.visibleRect)!==void 0&&gI(n.visibleRect,"init.visibleRect"),this._data=e,this._layout=null,this.format=e.format,this.visibleRect={left:((o=e.visibleRect)==null?void 0:o.x)??0,top:((c=e.visibleRect)==null?void 0:c.y)??0,width:((u=e.visibleRect)==null?void 0:u.width)??e.codedWidth,height:((l=e.visibleRect)==null?void 0:l.height)??e.codedHeight},this.rotation=(n==null?void 0:n.rotation)??0,this.squarePixelWidth=e.displayWidth,this.squarePixelHeight=e.displayHeight,this.timestamp=(n==null?void 0:n.timestamp)??e.timestamp/1e6,this.duration=(n==null?void 0:n.duration)??(e.duration??0)/1e6,this.colorSpace=new zd(e.colorSpace)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof SVGImageElement<"u"&&e instanceof SVGImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas){if(!n||typeof n!="object")throw new TypeError("init must be an object.");if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");
738if(!Number.isFinite(n.timestamp))throw new TypeError("init.timestamp must be a number.");if(n.duration!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");if(typeof VideoFrame<"u")return new Ft(new VideoFrame(e,{timestamp:Math.trunc(n.timestamp*Di),duration:Math.trunc((n.duration??0)*Di)||void 0}),n);let d=0,f=0;if("naturalWidth"in e?(d=e.naturalWidth,f=e.naturalHeight):"videoWidth"in e?(d=e.videoWidth,f=e.videoHeight):"width"in e&&(d=Number(e.width),f=Number(e.height)),!d||!f)throw new TypeError("Could not determine dimensions.");const h=new OffscreenCanvas(d,f),m=h.getContext("2d",{alpha:gd(),willReadFrequently:!0});b(m),m.drawImage(e,0,0),this._data=h,this._layout=null,this.format="RGBX",this.visibleRect={left:0,top:0,width:d,height:f},this.squarePixelWidth=d,this.squarePixelHeight=f,this.rotation=n.rotation??0,this.timestamp=n.timestamp,this.duration=n.duration??0,this.colorSpace=new zd({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else if(e instanceof Gi){if(!n||typeof n!="object")throw new TypeError("init must be an object.");if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(n.timestamp))throw new TypeError("init.timestamp must be a number.");if(n.duration!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");if(this._data=e,e._referenceCount++,this.format=e.getFormat(),this.format!==null&&!Ld.includes(this.format))throw new TypeError("getFormat() must return a VideoSamplePixelFormat or null.");if(this.visibleRect={left:0,top:0,width:e.getCodedWidth(),height:e.getCodedHeight()},!Number.isInteger(this.visibleRect.width)||this.visibleRect.width<=0)throw new TypeError("getCodedWidth() must return a positive integer.");if(!Number.isInteger(this.visibleRect.height)||this.visibleRect.height<=0)throw new TypeError("getCodedHeight() must return a positive integer.");if(this.squarePixelWidth=e.getSquarePixelWidth(),!Number.isInteger(this.squarePixelWidth)||this.squarePixelWidth<=0)throw new TypeError("getSquarePixelWidth() must return a positive integer.");if(this.squarePixelHeight=e.getSquarePixelHeight(),!Number.isInteger(this.squarePixelHeight)||this.squarePixelHeight<=0)throw new TypeError("getSquarePixelHeight() must return a positive integer.");this.rotation=n.rotation??0,this.timestamp=n.timestamp,this.duration=n.duration??0,this.colorSpace=e.getColorSpace()}else throw new TypeError("Invalid data type: Must be a BufferSource, CanvasImageSource, or VideoSampleResource.");this.pixelAspectRatio=Tc({num:this.squarePixelWidth*this.codedHeight,den:this.squarePixelHeight*this.codedWidth}),Fn==null||Fn.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw new Error("VideoSample is closed.");return b(this._data!==null),this._data instanceof Gi?new Ft(this._data,{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):Lc(this._data)?new Ft(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(b(this._layout),new Ft(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation,visibleRect:this.visibleRect,displayWidth:this.displayWidth,displayHeight:this.displayHeight})):new Ft(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation,visibleRect:this.visibleRect,displayWidth:this.displayWidth,displayHeight:this.displayHeight})}close(){this._closed||(Fn==null||Fn.unregister(this),this._data instanceof Gi?(this._data._referenceCount--,this._data._referenceCount===0&&this._data.close()):Lc(this._data)?this._data.close():this._data=null,this._closed=!0)}allocationSize(e={}){if(Ix(e),this._closed)throw new Error("VideoSample is closed.");if((e.format??this.format)==null)throw new Error("Cannot get allocation size when format is null.");return Lc(this._data)?this._data.allocationSize(e):Cx(this,e).allocationSize}async copyTo(e,n={}){if(!Ua(e))throw new TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(Ix(n),this._closed)throw new Error("VideoSample is closed.");if((n.format??this.format)==null)throw new Error("Cannot copy video sample data when format is null.");if(b(this._data!==null),Lc(this._data))return this._data.copyTo(e,n);if(n.format&&!["RGBA","RGBX","BGRA","BGRX"].includes(this.format)&&["RGBA","RGBX","BGRA","BGRX"].includes(n.format))if(this._data instanceof Gi){const u={stack:[],error:void 0,hasError:!1};try{const l=_5(u,await this._data.toRgbSample({timestamp:this.timestamp,duration:this.duration,rotation:this.rotation},n.colorSpace??"srgb"),!1);if(!(l instanceof Ft))throw new TypeError("toRgbSample() must return a VideoSample.");if(!["RGBA","RGBX","BGRA","BGRX"].includes(l.format))throw new Error(`Sample returned by toRgbSample was expected to have an RGB format, got '${l.format}' instead.`);return await l.copyTo(e,n)}catch(l){u.error=l,u.hasError=!0}finally{T5(u)}}else{if(typeof VideoFrame>"u")throw new Error("For this sample, converting from a non-RGB to an RGB format requires VideoFrame to be defined.");const u=this.toVideoFrame(),l=await u.copyTo(e,n);return u.close(),l}const r=Cx(this,n);b(this.format);const i=dt(e);
738if(i.byteLength<r.allocationSize)throw new TypeError(`Destination buffer too small. Required: ${r.allocationSize}, Available: ${i.byteLength}`);const s=Hd(this.format);let a;if(this._data instanceof Gi){let u=this._data.getDataPlanes();if(u instanceof Promise&&(u=await u),!Array.isArray(u)||u.some(l=>!(l.data instanceof Uint8Array)||!Number.isInteger(l.stride)||l.stride<0))throw new TypeError('getDataPlanes() must return an array of objects with a Uint8Array "data" property and a non-negative integer "stride" property.');a=u}else if(this._data instanceof Uint8Array)b(this._layout),b(this._layout.length===s.length),a=this._layout.map((u,l)=>{const d=Math.ceil(this.codedHeight/s[l].heightDivisor);return{data:this._data.subarray(u.offset,u.offset+u.stride*d),stride:u.stride}});else{const l=this._data.getContext("2d");b(l);const d=l.getImageData(0,0,this.codedWidth,this.codedHeight);a=[{data:dt(d.data),stride:4*this.codedWidth}]}const o=[],c=s.length;for(let u=0;u<c;u++){const l=r.computedLayouts[u],d=a[u].stride,f=a[u].data;let h=l.sourceTop*d;h+=l.sourceLeftBytes;let m=l.destinationOffset;const p=l.sourceWidthBytes,g={offset:m,stride:l.destinationStride};for(let A=0;A<l.sourceHeight;A++){if(h+p>f.byteLength)throw new Error("Source buffer OOB read.");if(m+p>i.byteLength)throw new Error("Destination buffer OOB write.");const y=f.subarray(h,h+p);i.set(y,m),h+=d,m+=l.destinationStride}o.push(g)}if(n.format!==void 0){const u=this.format.startsWith("RGB")!==n.format.startsWith("RGB"),l=this.format.includes("X")&&n.format.includes("A");if(u||l)for(let d=0;d<r.allocationSize;d+=4){if(u){const f=i[d],h=i[d+2];i[d]=h,i[d+2]=f}l&&(i[d+3]=255)}}return o}toVideoFrame(){if(this._closed)throw new Error("VideoSample is closed.");if(b(this._data!==null),this._data instanceof Gi){if(this.format===null)throw new Error("Cannot convert a VideoSampleResource-backed VideoSample to VideoFrame if format is null.");const e=this._data.getDataPlanes();if(e instanceof Promise)throw new Error("Cannot convert a VideoSampleResource-backed VideoSample to VideoFrame if getDataPlanes() returns a promise.");const n=e.reduce((a,o)=>a+o.data.byteLength,0),r=new Uint8Array(n);let i=0;const s=[];for(const a of e)r.set(a.data,i),s.push(i),i+=a.data.byteLength;return new VideoFrame(r,{format:this.format,layout:e.map((a,o)=>({offset:s[o],stride:a.stride})),codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration,colorSpace:this.colorSpace,displayWidth:this.squarePixelWidth,displayHeight:this.squarePixelHeight})}else return Lc(this._data)?new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0}):this._data instanceof Uint8Array?new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace,displayWidth:this.squarePixelWidth,displayHeight:this.squarePixelHeight}):new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(e,n,r,i,s,a,o,c,u){let l=0,d=0,f=this.displayWidth,h=this.displayHeight,m=0,p=0,g=this.displayWidth,A=this.displayHeight;if(a!==void 0?(l=n,d=r,f=i,h=s,m=a,p=o,c!==void 0?(g=c,A=u):(g=f,A=h)):(m=n,p=r,i!==void 0&&(g=i,A=s)),!(typeof CanvasRenderingContext2D<"u"&&e instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&e instanceof OffscreenCanvasRenderingContext2D))throw new TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(l))throw new TypeError("sx must be a number.");if(!Number.isFinite(d))throw new TypeError("sy must be a number.");if(!Number.isFinite(f)||f<0)throw new TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(h)||h<0)throw new TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(m))throw new TypeError("dx must be a number.");if(!Number.isFinite(p))throw new TypeError("dy must be a number.");if(!Number.isFinite(g)||g<0)throw new TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(A)||A<0)throw new TypeError("dHeight must be a non-negative number.");if(this._closed)throw new Error("VideoSample is closed.");({sx:l,sy:d,sWidth:f,sHeight:h}=this._rotateSourceRegion(l,d,f,h,this.rotation));const y=this.toCanvasImageSource();e.save();const w=m+g/2,E=p+A/2;e.translate(w,E),e.rotate(this.rotation*Math.PI/180);const S=this.rotation%180===0?1:g/A;
738e.scale(1/S,S),e.drawImage(y,l,d,f,h,-g/2,-A/2,g,A),e.restore()}drawWithFit(e,n){var y,w,E,S;if(!(typeof CanvasRenderingContext2D<"u"&&e instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&e instanceof OffscreenCanvasRenderingContext2D))throw new TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(!["fill","contain","cover"].includes(n.fit))throw new TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");n.crop!==void 0&&zc(n.crop,"options.");const r=e.canvas.width,i=e.canvas.height,s=n.rotation??this.rotation,[a,o]=s%180===0?[this.squarePixelWidth,this.squarePixelHeight]:[this.squarePixelHeight,this.squarePixelWidth];let c=n.crop;c&&(c=Qd(c,a,o));let u,l,d,f;const{sx:h,sy:m,sWidth:p,sHeight:g}=this._rotateSourceRegion(((y=n.crop)==null?void 0:y.left)??0,((w=n.crop)==null?void 0:w.top)??0,((E=n.crop)==null?void 0:E.width)??a,((S=n.crop)==null?void 0:S.height)??o,s);if(n.fit==="fill")u=0,l=0,d=r,f=i;else{const[k,T]=n.crop?[n.crop.width,n.crop.height]:[a,o],C=n.fit==="contain"?Math.min(r/k,i/T):Math.max(r/k,i/T);d=k*C,f=T*C,u=(r-d)/2,l=(i-f)/2}e.save();const A=s%180===0?1:d/f;e.translate(r/2,i/2),e.rotate(s*Math.PI/180),e.scale(1/A,A),e.translate(-r/2,-i/2),e.drawImage(this.toCanvasImageSource(),h,m,p,g,u,l,d,f),e.restore()}_rotateSourceRegion(e,n,r,i,s){return s===90?[e,n,r,i]=[n,this.squarePixelHeight-e-r,i,r]:s===180?[e,n]=[this.squarePixelWidth-e-r,this.squarePixelHeight-n-i]:s===270&&([e,n,r,i]=[this.squarePixelWidth-n-i,e,i,r]),{sx:e,sy:n,sWidth:r,sHeight:i}}toCanvasImageSource(){if(this._closed)throw new Error("VideoSample is closed.");if(b(this._data!==null),this._data instanceof Gi||this._data instanceof Uint8Array){const e=this.toVideoFrame();return queueMicrotask(()=>e.close()),e}else return this._data}async transform(e){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.width!==void 0&&(!Number.isInteger(e.width)||e.width<=0))throw new TypeError("options.width, when provided, must be a positive integer.");if(e.height!==void 0&&(!Number.isInteger(e.height)||e.height<=0))throw new TypeError("options.height, when provided, must be a positive integer.");if(e.roundDimensionsTo!==void 0&&(!Number.isInteger(e.roundDimensionsTo)||e.roundDimensionsTo<=0))throw new TypeError("options.roundDimensionsTo, when provided, must be a positive integer.");if(e.fit!==void 0&&!["fill","contain","cover"].includes(e.fit))throw new TypeError('options.fit, when provided, must be one of "fill", "contain", or "cover".');if(e.width!==void 0&&e.height!==void 0&&e.fit===void 0)throw new TypeError("When both options.width and options.height are provided, options.fit must also be provided.");if(e.rotate!==void 0&&![0,90,180,270].includes(e.rotate))throw new TypeError("options.rotate, when provided, must be 0, 90, 180 or 270.");if(e.crop!==void 0&&zc(e.crop,"options."),e.alpha!==void 0&&!["keep","discard"].includes(e.alpha))throw new TypeError("options.alpha, when provided, must be 'keep' or 'discard'.");const n=Na(this.rotation+(e.rotate??0)),[r,i]=n%180===0?[this.squarePixelWidth,this.squarePixelHeight]:[this.squarePixelHeight,this.squarePixelWidth];let s=e.crop;s&&(s=Qd(s,r,i));const a=s?s.width:r,o=s?s.height:i,c=a/o;let u,l;e.width!==void 0&&e.height===void 0?(u=e.width,l=u/c):e.width===void 0&&e.height!==void 0?(l=e.height,u=l*c):e.width!==void 0&&e.height!==void 0?(u=e.width,l=e.height):(u=a,l=o),u=Qm(u,e.roundDimensionsTo??1),l=Qm(l,e.roundDimensionsTo??1);const d={width:u,height:l,fit:e.fit??"fill",rotation:n,crop:s??{left:0,top:0,width:r,height:i},alpha:e.alpha??"keep"};for(const p of Xg){let g=p(this,d);if(g instanceof Promise&&(g=await g),g!==null)return g}let f=null,h=!1;for(const p of Uc)if(p.canvas.width===d.width&&p.canvas.height===d.height){f=p.canvas,p.age=kx++;break}if(f===null){if(typeof OffscreenCanvas<"u")f=new OffscreenCanvas(d.width,d.height);else{if(typeof window>"u"||typeof document>"u")throw new Error("Cannot transform VideoSamples in this environment. Either run in an environment with OffscreenCanvas or HTMLCanvasElement, or supply a custom VideoSample transformer using registerVideoSampleTransformer().");f=document.createElement("canvas"),f.width=d.width,f.height=d.height}h=!0,Uc.length>=C5&&Uc.splice($m(Uc,p=>
738p.age),1),Uc.push({canvas:f,age:kx++})}const m=f.getContext("2d",{alpha:!0});return b(m),d.alpha==="discard"?(m.fillStyle="black",m.fillRect(0,0,d.width,d.height)):h||m.clearRect(0,0,d.width,d.height),this.drawWithFit(m,{fit:d.fit,rotation:d.rotation,crop:d.crop}),new Ft(f,{timestamp:this.timestamp,duration:this.duration,rotation:0})}setRotation(e){if(![0,90,180,270].includes(e))throw new TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=e}setTimestamp(e){if(!Number.isFinite(e))throw new TypeError("newTimestamp must be a number.");this.timestamp=e}setDuration(e){if(!Number.isFinite(e)||e<0)throw new TypeError("newDuration must be a non-negative number.");this.duration=e}[Symbol.dispose](){this.close()}}const Xg=[],I5=t=>{Xg.includes(t)||Xg.push(t)},C5=3,Uc=[];let kx=0;class zd{constructor(e){if(e!==void 0){if(!e||typeof e!="object")throw new TypeError("init.colorSpace, when provided, must be an object.");const n=Object.keys(Ss);if(e.primaries!=null&&!n.includes(e.primaries))throw new TypeError(`init.colorSpace.primaries, when provided, must be one of ${n.join(", ")}.`);const r=Object.keys(_s);if(e.transfer!=null&&!r.includes(e.transfer))throw new TypeError(`init.colorSpace.transfer, when provided, must be one of ${r.join(", ")}.`);const i=Object.keys(Ts);if(e.matrix!=null&&!i.includes(e.matrix))throw new TypeError(`init.colorSpace.matrix, when provided, must be one of ${i.join(", ")}.`);if(e.fullRange!=null&&typeof e.fullRange!="boolean")throw new TypeError("init.colorSpace.fullRange, when provided, must be a boolean.")}this.primaries=(e==null?void 0:e.primaries)??null,this.transfer=(e==null?void 0:e.transfer)??null,this.matrix=(e==null?void 0:e.matrix)??null,this.fullRange=(e==null?void 0:e.fullRange)??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}}const Lc=t=>typeof VideoFrame<"u"&&t instanceof VideoFrame,Qd=(t,e,n)=>{const r=Math.min(t.left,e),i=Math.min(t.top,n),s=Math.min(t.width,e-r),a=Math.min(t.height,n-i);return b(s>=0),b(a>=0),{left:r,top:i,width:s,height:a}},zc=(t,e)=>{if(!t||typeof t!="object")throw new TypeError(e+"crop, when provided, must be an object.");if(!Number.isInteger(t.left)||t.left<0)throw new TypeError(e+"crop.left must be a non-negative integer.");if(!Number.isInteger(t.top)||t.top<0)throw new TypeError(e+"crop.top must be a non-negative integer.");if(!Number.isInteger(t.width)||t.width<0)throw new TypeError(e+"crop.width must be a non-negative integer.");if(!Number.isInteger(t.height)||t.height<0)throw new TypeError(e+"crop.height must be a non-negative integer.")},Ix=t=>{if(!t||typeof t!="object")throw new TypeError("options must be an object.");if(t.colorSpace!==void 0&&!["display-p3","srgb"].includes(t.colorSpace))throw new TypeError("options.colorSpace, when provided, must be 'dis
738play-p3' or 'srgb'.");if(t.format!==void 0&&typeof t.format!="string")throw new TypeError("options.format, when provided, must be a string.");if(t.layout!==void 0){if(!Array.isArray(t.layout))throw new TypeError("options.layout, when provided, must be an array.");for(const e of t.layout){if(!e||typeof e!="object")throw new TypeError("Each entry in options.layout must be an object.");if(!Number.isInteger(e.offset)||e.offset<0)throw new TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(e.stride)||e.stride<0)throw new TypeError("plane.stride must be a non-negative integer.")}}if(t.rect!==void 0){if(!t.rect||typeof t.rect!="object")throw new TypeError("options.rect, when provided, must be an object.");if(t.rect.x!==void 0&&(!Number.isInteger(t.rect.x)||t.rect.x<0))throw new TypeError("options.rect.x, when provided, must be a non-negative integer.");if(t.rect.y!==void 0&&(!Number.isInteger(t.rect.y)||t.rect.y<0))throw new TypeError("options.rect.y, when provided, must be a non-negative integer.");if(t.rect.width!==void 0&&(!Number.isInteger(t.rect.width)||t.rect.width<0))throw new TypeError("options.rect.width, when provided, must be a non-negative integer.");if(t.rect.height!==void 0&&(!Number.isInteger(t.rect.height)||t.rect.height<0))throw new TypeError("options.rect.height, when provided, must be a non-negative integer.")}},x5=(t,e,n)=>{const r=Hd(t),i=[];let s=0;for(const a of r){const o=Math.ceil(e/a.widthDivisor),c=Math.ceil(n/a.heightDivisor),u=o*a.sampleBytes,l=u*c;i.push({offset:s,stride:u}),s+=l}return i},Hd=t=>{const e=(n,r,i,s,a)=>{const o=[{sampleBytes:n,widthDivisor:1,heightDivisor:1},{sampleBytes:r,widthDivisor:i,heightDivisor:s},{sampleBytes:r,widthDivisor:i,heightDivisor:s}];return a&&o.push({sampleBytes:n,widthDivisor:1,heightDivisor:1}),o};switch(t){case"I420":return e(1,1,2,2,!1);case"I420P10":case"I420P12":return e(2,2,2,2,!1);case"I420A":return e(1,1,2,2,!0);case"I420AP10":case"I420AP12":return e(2,2,2,2,!0);case"I422":return e(1,1,2,1,!1);case"I422P10":case"I422P12":return e(2,2,2,1,!1);case"I422A":return e(1,1,2,1,!0);case"I422AP10":case"I422AP12":return e(2,2,2,1,!0);case"I444":return e(1,1,1,1,!1);case"I444P10":case"I444P12":return e(2,2,1,1,!1);case"I444A":return e(1,1,1,1,!0);case"I444AP10":case"I444AP12":return e(2,2,1,1,!0);case"NV12":return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case"RGBA":case"RGBX":case"BGRA":case"BGRX":return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:rn(t),b(!1)}},Cx=(t,e)=>{const n={left:0,top:0,width:t.codedWidth,height:t.codedHeight},r=e.rect,i=v5(n,r,t.codedWidth,t.codedHeight,t.format),s=e.layout;let a;if(!e.format||e.format===t.format)a=t.format;else if(["RGBA","RGBX","BGRA","BGRX"].includes(e.format))a=e.format;else throw new Error("NotSupportedError: Invalid destination format.");return P5(i,a,s)},v5=(t,e,n,r,i)=>{const s={...t};if(e!==void 0){if(e.width===0||e.height===0)throw new TypeError("visibleRect dimensions cannot be zero.");if((e.x||0)+(e.width||0)>n)throw new TypeError("visibleRect exceeds codedWidth.");if((e.y||0)+(e.height||0)>r)throw new TypeError("visibleRect exceeds codedHeight.");s.x=e.x||0,s.y=e.y||0,s.width=e.width||0,s.height=e.height||0}if(!B5(i,s))throw new TypeError("visibleRect alignment is invalid for the format.");return s},B5=(t,e)=>{if(t===null)return!0;const n=Hd(t);for(let r=0;r<n.length;r++){const i=n[r],s=i.widthDivisor,a=i.heightDivisor;if((e.x||0)%s!==0||(e.y||0)%a!==0)return!1}return!0},P5=(t,e,n)=>{const r=Hd(e),i=r.length;if(n!==void 0&&n.length!==i)throw new TypeError(`Layout must have ${i} planes.`);let s=0;const a=[],o=[];for(let c=0;c<i;c++){const u=r[c],l=u.sampleBytes,d=u.widthDivisor,f=u.heightDivisor,h={destinationOffset:0,destinationStride:0,sourceTop:0,sourceHeight:0,sourceLeftBytes:0,sourceWidthBytes:0};if(h.sourceTop=Math.ceil(Math.trunc(t.y||0)/f),h.sourceHeight=Math.ceil(Math.trunc(t.height||0)/f),h.sourceLeftBytes=Math.floor(Math.trunc(t.x||0)/d)*l,h.sourceWidthBytes=Math.floor(Math.trunc(t.width||0)/d)*l,n!==void 0){const g=n[c];if(g.stride<h.sourceWidthBytes)throw new TypeError(`Stride for plane ${c} is too small.`);h.destinationOffset=g.offset,h.destinationStride=g.stride}else h.destinationOffset=s,h.destinationStride=h.sourceWidthBytes;const p=h.destinationStride*h.sourceHeight+h.destinationOffset;if(p>4294967295)throw new TypeError("Allocation size exceeds limit.");o.push(p),s=Math.max(s,p);for(let g=0;g<c;g++){const A=a[g];if(!(o[c]<=A.destinationOffset||o[g]<=h.destinationOffset))throw new TypeError("Planes overlap.")}a.push(h)}return{allocationSize:s,computedLayouts:a}},Wd=new Set(["f32","f32-planar","s16","s16-planar","s32","s32-planar","u8","u8-planar"]);class io{constructor(){this._referenceCount=0}}class Wt{get microsecondTimestamp(){return Math.trunc(Di*this.timestamp)}get microsecondDuration(){return Math.trunc(Di*this.duration)}
738constructor(e){if(this._closed=!1,Qc(e)){if(e.format===null)throw new TypeError("AudioData with null format is not supported.");this._data=e,this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=e.numberOfFrames,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp/1e6,this.duration=e.numberOfFrames/e.sampleRate}else if(e instanceof io){if(this._data=e,e._referenceCount++,this.format=e.getFormat(),!Wd.has(this.format))throw new TypeError("getFormat() must return an AudioSampleFormat.");if(this.sampleRate=e.getSampleRate(),!Number.isInteger(this.sampleRate)||this.sampleRate<=0)throw new TypeError("getSampleRate() must return a positive integer.");if(this.numberOfFrames=e.getNumberOfFrames(),!Number.isInteger(this.numberOfFrames)||this.numberOfFrames<0)throw new TypeError("getNumberOfFrames() must return a non-negative integer.");if(this.numberOfChannels=e.getNumberOfChannels(),!Number.isInteger(this.numberOfChannels)||this.numberOfChannels<=0)throw new TypeError("getNumberOfChannels() must return a positive integer.");if(this.timestamp=e.getTimestamp(),!Number.isFinite(this.timestamp))throw new TypeError("getTimestamp() must return a finite number.");this.duration=this.numberOfFrames/this.sampleRate}else{if(!e||typeof e!="object")throw new TypeError("Invalid AudioDataInit: must be an object.");if(!Wd.has(e.format))throw new TypeError("Invalid AudioDataInit: invalid format.");if(!Number.isFinite(e.sampleRate)||e.sampleRate<=0)throw new TypeError("Invalid AudioDataInit: sampleRate must be > 0.");if(!Number.isInteger(e.numberOfChannels)||e.numberOfChannels===0)throw new TypeError("Invalid AudioDataInit: numberOfChannels must be an integer > 0.");if(!Number.isFinite(e==null?void 0:e.timestamp))throw new TypeError("init.timestamp must be a number.");const n=e.data.byteLength/(Ds(e.format)*e.numberOfChannels);if(!Number.isInteger(n))throw new TypeError("Invalid AudioDataInit: data size is not a multiple of frame size.");this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=n,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp,this.duration=n/e.sampleRate;let r;if(e.data instanceof ArrayBuffer)r=new Uint8Array(e.data);else if(ArrayBuffer.isView(e.data))r=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);else throw new TypeError("Invalid AudioDataInit: data is not a BufferSource.");const i=this.numberOfFrames*this.numberOfChannels*Ds(this.format);if(r.byteLength<i)throw new TypeError("Invalid AudioDataInit: insufficient data size.");this._data=r}Fn==null||Fn.register(this,{type:"audio",data:this._data},this)}allocationSize(e){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(!Number.isInteger(e.planeIndex)||e.planeIndex<0)throw new TypeError("planeIndex must be a non-negative integer.");if(e.format!==void 0&&!Wd.has(e.format))throw new TypeError("Invalid format.");if(e.frameOffset!==void 0&&(!Number.isInteger(e.frameOffset)||e.frameOffset<0))throw new TypeError("frameOffset must be a non-negative integer.");if(e.frameCount!==void 0&&(!Number.isInteger(e.frameCount)||e.frameCount<0))throw new TypeError("frameCount must be a non-negative integer.");if(this._closed)throw new Error("AudioSample is closed.");const n=e.format??this.format,r=e.frameOffset??0;if(r>=this.numberOfFrames)throw new RangeError("frameOffset out of range");const i=e.frameCount!==void 0?e.frameCount:this.numberOfFrames-r;if(i>this.numberOfFrames-r)throw new RangeError("frameCount out of range");const s=Ds(n),a=so(n);if(a&&e.planeIndex>=this.numberOfChannels)throw new RangeError("planeIndex out of range");if(!a&&e.planeIndex!==0)throw new RangeError("planeIndex out of range");return(a?i:i*this.numberOfChannels)*s}copyTo(e,n){if(!Ua(e))throw new TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(!Number.isInteger(n.planeIndex)||n.planeIndex<0)throw new TypeError("planeIndex must be a non-negative integer.");if(n.format!==void 0&&!Wd.has(n.format))throw new TypeError("Invalid format.");if(n.frameOffset!==void 0&&(!Number.isInteger(n.frameOffset)||n.frameOffset<0))throw new TypeError("frameOffset must be a non-negative integer.");if(n.frameCount!==void 0&&(!Number.isInteger(n.frameCount)||n.frameCount<0))throw new TypeError("frameCount must be a non-negative integer.");if(this._closed)throw new Error("AudioSample is closed.");const{format:r,frameCount:i,frameOffset:s}=n;let{planeIndex:a}=n;const o=this.format,c=r??this.format;if(!c)throw new Error("Destination format not determined");const u=this.numberOfFrames,l=this.numberOfChannels,d=s??0;if(d>=u)throw new RangeError("frameOffset out of range");const f=i!==void 0?i:u-d;if(f>u-d)throw new RangeError("frameCount out of range");const h=Ds(c),m=so(c);if(m&&a>=l)throw new RangeError("planeIndex out of range");if(!m&&a!==0)throw new RangeError("planeIndex out of range");const g=(m?f:f*l)*h;if(e.byteLength<g)throw new RangeError("Destination buffer is too small");const A=_e(e),y=vx(c);if(Qc(this._data))Sc()&&l>2&&c!==o?R5(this._data,A,o,c,l,a,d,f):this._data.copyTo(e,{planeIndex:a,frameOffset:d,frameCount:f,format:c});else{const w=xx(o),E=Ds(o),S=so(o);let k;if(this._data instanceof io){const C=_=>{const x=this._data.getDataPlane(_);if(!(x instanceof Uint8Array))throw new TypeError("getDataPlane() must return a Uint8Array.");const P=u*E*(S?1:l);if(x.byteLength!==P)throw new TypeError(`Data plane ${_}
738 has invalid size. Expected exactly ${P} bytes, got ${x.byteLength} bytes.`);return x};if(S)if(m)k=C(a),a=0;else{k=new Uint8Array(u*E*l);for(let _=0;_<l;_++){const x=C(_);k.set(x,_*u*E)}}else k=C(0)}else k=this._data;const T=_e(k);for(let C=0;C<f;C++)if(m){const _=C*h;let x;S?x=(a*u+(C+d))*E:x=((C+d)*l+a)*E;const P=w(T,x);y(A,_,P)}else for(let _=0;_<l;_++){const P=(C*l+_)*h;let v;S?v=(_*u+(C+d))*E:v=((C+d)*l+_)*E;const M=w(T,v);y(A,P,M)}}}clone(){if(this._closed)throw new Error("AudioSample is closed.");if(this._data instanceof io){const e=new Wt(this._data);return e.setTimestamp(this.timestamp),e}else if(Qc(this._data)){const e=new Wt(this._data.clone());return e.setTimestamp(this.timestamp),e}else return new Wt({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data})}close(){this._closed||(Fn==null||Fn.unregister(this),this._data instanceof io?(this._data._referenceCount--,this._data._referenceCount===0&&this._data.close()):Qc(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}toAudioData(){if(this._closed)throw new Error("AudioSample is closed.");return this._data instanceof io?this._createAudioDataFromData():Qc(this._data)?this._data.timestamp===this.microsecondTimestamp?this._data.clone():this._createAudioDataFromData():new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:this._data.buffer instanceof ArrayBuffer?this._data.buffer:this._data.slice()})}_createAudioDataFromData(){if(so(this.format)){const e=this.allocationSize({planeIndex:0,format:this.format}),n=new ArrayBuffer(e*this.numberOfChannels);for(let r=0;r<this.numberOfChannels;r++)this.copyTo(new Uint8Array(n,r*e,e),{planeIndex:r,format:this.format});return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:n})}else{const e=new ArrayBuffer(this.allocationSize({planeIndex:0,format:this.format}));return this.copyTo(e,{planeIndex:0,format:this.format}),new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:e})}}toAudioBuffer(){if(this._closed)throw new Error("AudioSample is closed.");const e=new AudioBuffer({numberOfChannels:this.numberOfChannels,length:this.numberOfFrames,sampleRate:this.sampleRate}),n=new Float32Array(this.allocationSize({planeIndex:0,format:"f32-planar"})/4);for(let r=0;r<this.numberOfChannels;r++)this.copyTo(n,{planeIndex:r,format:"f32-planar"}),e.copyToChannel(n,r);return e}setTimestamp(e){if(!Number.isFinite(e))throw new TypeError("newTimestamp must be a number.");this.timestamp=e}[Symbol.dispose](){this.close()}static*_fromAudioBuffer(e,n){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const r=48e3*5,i=e.numberOfChannels,s=e.sampleRate,a=e.length,o=Math.floor(r/i);let c=0,u=a;for(;u>0;){const l=Math.min(o,u),d=new Float32Array(i*l);for(let f=0;f<i;f++)e.copyFromChannel(d.subarray(f*l,(f+1)*l),f,c);yield new Wt({format:"f32-planar",sampleRate:s,numberOfFrames:l,numberOfChannels:i,timestamp:n+c/s,data:d}),c+=l,u-=l}}static fromAudioBuffer(e,n){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const r=48e3*5,i=e.numberOfChannels,s=e.sampleRate,a=e.length,o=Math.floor(r/i);let c=0,u=a;const l=[];for(;u>0;){const d=Math.min(o,u),f=new Float32Array(i*d);for(let m=0;m<i;m++)e.copyFromChannel(f.subarray(m*d,(m+1)*d),m,c);const h=new Wt({format:"f32-planar",sampleRate:s,numberOfFrames:d,numberOfChannels:i,timestamp:n+c/s,data:f});l.push(h),c+=d,u-=d}return l}}const Ds=t=>{switch(t){case"u8":case"u8-planar":return 1;case"s16":case"s16-planar":return 2;case"s32":case"s32-planar":return 4;case"f32":case"f32-planar":return 4;default:throw new Error("Unknown AudioSampleFormat")}},so=t=>{switch(t){case"u8-planar":case"s16-planar":case"s32-planar":case"f32-planar":return!0;default:return!1}},xx=t=>{switch(t){case"u8":case"u8-planar":return(e,n)=>(e.getUint8(n)-128)/128;case"s16":case"s16-planar":return(e,n)=>e.getInt16(n,!0)/32768;case"s32":case"s32-planar":return(e,n)=>e.getInt32(n,!0)/2147483648;case"f32":case"f32-planar":return(e,n)=>e.getFloat32(n,!0)}},vx=t=>{switch(t){case"u8":case"u8-planar":return(e,n,r)=>e.setUint8(n,Yt((r+1)*127.5,0,255));case"s16":case"s16-planar":return(e,n,r)=>e.setInt16(n,Yt(Math.round(r*32767),-32768,32767),!0);case"s32":case"s32-planar":return(e,n,r)=>e.setInt32(n,Yt(Math.round(r*2147483647),-2147483648,2147483647),!0);case"f32":case"f32-planar":return(e,n,r)=>e.setFloat32(n,r,!0)}},Qc=t=>typeof AudioData<"u"&&t instanceof AudioData,Bx=t=>{switch(t){case"u8-planar":return"u8";case"s16-planar":return"s16";case"s32-planar":return"s32";case"f32-planar":return"f32";default:return t}},R5=(t,e,n,r,i,s,a,o)=>{const c=xx(n),u=vx(r),l=Ds(n),d=Ds(r),f=so(n);if(so(r))if(f){const m=new ArrayBuffer(o*l),p=_e(m);t.copyTo(m,{planeIndex:s,frameOffset:a,frameCount:o,format:n});for(let g=0;g<o;g++){const A=g*l,y=g*d,w=c(p,A);u(e,y,w)}}else{const m=new ArrayBuffer(o*i*l),p=_e(m);t.copyTo(m,{planeIndex:0,frameOffset:a,frameCount:o,format:n});for(let g=0;g<o;g++){const A=(g*i+s)*l,y=g*d,w=c(p,A);u(e,y,w)}}else if(f){const m=o*l,p=new ArrayBuffer(m),g=_e(p);for(let A=0;A<i;A++){t.copyTo(p,{planeIndex:A,frameOffset:a,frameCount:o,format:n});for(let y=0;y<o;y++){const w=y*l,E=(y*i+A)*d,S=c(g,w);u(e,E,S)}}}else{const m=new ArrayBuffer(o*i*l),p=_e(m);t.copyTo(m,{planeIndex:0,frameOffset:a,frameCount:o,format:n});for(let g=0;g<o;g++)for(let A=0;A<i;A++){const y=g*i+A,w=y*l,E=y*d,S=c(p,w);u(e,E,S)}}},Px=(t,e)=>{const n=t.allocationSize({format:e,planeIndex:0}),r=new ArrayBuffer(n);return t.copyTo(r,{format:e,planeIndex:0}),new Wt({data:r,format:e,numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate,timestamp:t.timestamp,duration:t.duration})};/*!
739 * Copyright (c) 2026-present, Vanilagy and contributors
740 *
741 * This Source Code Form is subject to the terms of the Mozilla Public
742 * License, v. 2.0. If a copy of the MPL was not distributed with this
743 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
744 */const Jg=new Map,Zg=new Map,eA=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!xt.includes(t.codec))throw new TypeError(`Invalid video codec '${t.codec}'. Must be one of: ${xt.join(", ")}.`);
vendor: 5,068 bytes, line 744
744if(!(t.bitrate instanceof wn)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate must be a positive integer or a quality.");if(t.keyFrameInterval!==void 0&&(!Number.isFinite(t.keyFrameInterval)||t.keyFrameInterval<0))throw new TypeError("config.keyFrameInterval, when provided, must be a non-negative number.");if(t.sizeChangeBehavior!==void 0&&!["deny","passThrough","fill","contain","cover"].includes(t.sizeChangeBehavior))throw new TypeError("config.sizeChangeBehavior, when provided, must be 'deny', 'passThrough', 'fill', 'contain' or 'cover'.");if(t.transform!==void 0){if(typeof t.transform!="object"||!t.transform)throw new TypeError("config.transform, when provided, must be an object.");if(t.transform.width!==void 0&&(!Number.isInteger(t.transform.width)||t.transform.width<=0))throw new TypeError("config.transform.width, when provided, must be a positive integer.");if(t.transform.height!==void 0&&(!Number.isInteger(t.transform.height)||t.transform.height<=0))throw new TypeError("config.transform.height, when provided, must be a positive integer.");if(t.transform.fit!==void 0&&!["fill","contain","cover"].includes(t.transform.fit))throw new TypeError('config.transform.fit, when provided, must be one of "fill", "contain", or "cover".');if(t.transform.width!==void 0&&t.transform.height!==void 0&&t.transform.fit===void 0&&!["fill","contain","cover"].includes(t.sizeChangeBehavior))throw new TypeError("When both config.transform.width and config.transform.height are provided, config.transform.fit must also be provided.");if(t.transform.fit!==void 0&&["fill","contain","cover"].includes(t.sizeChangeBehavior)&&t.transform.fit!==t.sizeChangeBehavior)throw new TypeError("config.transform.fit, when provided, cannot differ from config.sizeChangeBehavior when config.sizeChangeBehavior is 'fill', 'contain' or 'cover', as sizeChangeBehavior already determines the fitting algorithm.");if(t.transform.rotate!==void 0&&![0,90,180,270].includes(t.transform.rotate))throw new TypeError("config.transform.rotate, when provided, must be 0, 90, 180 or 270.");if(t.transform.crop!==void 0&&zc(t.transform.crop,"config.transform."),t.transform.process!==void 0&&typeof t.transform.process!="function")throw new TypeError("config.transform.process, when provided, must be a function.");if(t.transform.frameRate!==void 0&&(!Number.isFinite(t.transform.frameRate)||t.transform.frameRate<=0))throw new TypeError("config.transform.frameRate, when provided, must be a finite positive number.");if(t.transform.force!==void 0&&typeof t.transform.force!="boolean")throw new TypeError("config.transform.force, when provided, must be a boolean.")}if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedPacket, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");Rx(t.codec,t)},Rx=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.alpha!==void 0&&!["discard","keep"].includes(e.alpha))throw new TypeError("options.alpha, when provided, must be 'discard' or 'keep'.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.latencyMode!==void 0&&!["quality","realtime"].includes(e.latencyMode))throw new TypeError("latencyMode, when provided, must be 'quality' or 'realtime'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&jr(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`);if(e.hardwareAcceleration!==void 0&&!["no-preference","prefer-hardware","prefer-software"].includes(e.hardwareAcceleration))throw new TypeError("hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.");if(e.scalabilityMode!==void 0&&typeof e.scalabilityMode!="string")throw new TypeError("scalabilityMode, when provided, must be a string.");if(e.contentHint!==void 0&&typeof e.contentHint!="string")throw new TypeError("contentHint, when provided, must be a string.")},Fx=t=>{const e=t.bitrate instanceof wn?t.bitrate._toVideoBitrate(t.codec,t.width,t.height):t.bitrate;return{codec:t.fullCodecString??CI(t.codec,t.width,t.height,e),width:t.width,height:t.height,displayWidth:t.squarePixelWidth,displayHeight:t.squarePixelHeight,bitrate:e,bitrateMode:t.bitrateMode,alpha:t.alpha??"discard",framerate:t.framerate,latencyMode:t.latencyMode,hardwareAcceleration:t.hardwareAcceleration,scalabilityMode:t.scalabilityMode,contentHint:t.contentHint,...$W(t.codec)}},tA=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!Ut.includes(t.codec))throw new TypeError(`Invalid audio codec '${t.codec}'. Must be one of: ${Ut.join(", ")}.`);
744if(t.bitrate===void 0&&!(Nt.includes(t.codec)||t.codec==="flac"))throw new TypeError("config.bitrate must be provided for compressed audio codecs.");if(t.bitrate!==void 0&&!(t.bitrate instanceof wn)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate, when provided, must be a positive integer or a quality.");if(t.transform!==void 0){if(typeof t.transform!="object"||!t.transform)throw new TypeError("config.transform, when provided, must be an object.");if(t.transform.numberOfChannels!==void 0&&(!Number.isInteger(t.transform.numberOfChannels)||t.transform.numberOfChannels<=0))throw new TypeError("config.transform.numberOfChannels, when provided, must be a positive integer.");if(t.transform.sampleRate!==void 0&&(!Number.isInteger(t.transform.sampleRate)||t.transform.sampleRate<=0))throw new TypeError("config.transform.sampleRate, when provided, must be a positive integer.");if(t.transform.sampleFormat!==void 0&&!["u8","s16","s32","f32"].includes(t.transform.sampleFormat))throw new TypeError("config.transform.sampleFormat, when provided, must be one of: u8, s16, s32, f32.");if(t.transform.process!==void 0&&typeof t.transform.process!="function")throw new TypeError("config.transform.process, when provided, must be a function.")}if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedPacket, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");Mx(t.codec,t)},Mx=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&jr(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`)},Dx=t=>{const e=t.bitrate instanceof wn?t.bitrate._toAudioBitrate(t.codec):t.bitrate;return{codec:t.fullCodecString??vI(t.codec,t.numberOfChannels,t.sampleRate),numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate,bitrate:e,bitrateMode:t.bitrateMode,...XW(t.codec)}};class wn{constructor(e){this._factor=e}_toVideoBitrate(e,n,r){const i=n*r,s={avc:1,hevc:.6,vp9:.6,av1:.4,vp8:1.2},a=1920*1080,o=3e6,c=Math.pow(i/a,.95),d=o*c*s[e]*this._factor;return Math.ceil(d/1e3)*1e3}_toAudioBitrate(e){if(Nt.includes(e)||e==="flac")return;const r={aac:128e3,opus:64e3,mp3:16e4,vorbis:64e3,ac3:384e3,eac3:192e3}[e];if(!r)throw new Error(`Unhandled codec: ${e}`);let i=r*this._factor;return e==="aac"?i=[96e3,128e3,16e4,192e3].reduce((a,o)=>Math.abs(o-i)<Math.abs(a-i)?o:a):e==="opus"||e==="vorbis"?i=Math.max(6e3,i):e==="mp3"&&(i=[8e3,16e3,24e3,32e3,4e4,48e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4].reduce((a,o)=>Math.abs(o-i)<Math.abs(a-i)?o:a)),Math.round(i/1e3)*1e3}}const F5=new wn(.3),M5=new wn(.6),D5=new wn(1),nA=new wn(2),O5=new wn(4),N5=t=>{if(xt.includes(t))return Vd(t);if(Ut.includes(t))return Gd(t);if(ir.includes(t))return qd(t);throw new TypeError(`Unknown codec '${t}'.`)},Vd=async(t,e={})=>{const{width:n=1280,height:r=720,bitrate:i=1e6,...s}=e;if(!xt.includes(t))return!1;if(!Number.isInteger(n)||n<=0)throw new TypeError("width must be a positive integer.");if(!Number.isInteger(r)||r<=0)throw new TypeError("height must be a positive integer.");if(!(i instanceof wn)&&(!Number.isInteger(i)||i<=0))throw new TypeError("bitrate must be a positive integer or a quality.");Rx(t,s);const a=Fx({codec:t,width:n,height:r,bitrate:i,framerate:void 0,...s,alpha:"discard"}),o=JSON.stringify(a),c=Jg.get(o);if(c)return c;const u=(async()=>Kd.some(f=>f.supports(t,a))?!0:typeof VideoEncoder>"u"||(n%2===1||r%2===1)&&(t==="avc"||t==="hevc")||!(await VideoEncoder.isConfigSupported(a)).supported?!1:gd()?new Promise(async f=>{try{const h=new VideoEncoder({output:()=>{},error:()=>f(!1)});h.configure(a);const m=new Uint8Array(n*r*4),p=new VideoFrame(m,{format:"RGBA",codedWidth:n,coded
744Height:r,timestamp:0});h.encode(p),p.close(),await h.flush(),f(!0)}catch{f(!1)}}):!0)();return Jg.set(o,u),u},Gd=async(t,e={})=>{const{numberOfChannels:n=2,sampleRate:r=48e3,bitrate:i=128e3,...s}=e;if(!Ut.includes(t))return!1;if(!Number.isInteger(n)||n<=0)throw new TypeError("numberOfChannels must be a positive integer.");if(!Number.isInteger(r)||r<=0)throw new TypeError("sampleRate must be a positive integer.");if(!(i instanceof wn)&&(!Number.isInteger(i)||i<=0))throw new TypeError("bitrate must be a positive integer.");Mx(t,s);const a=Dx({codec:t,numberOfChannels:n,sampleRate:r,bitrate:i,...s}),o=JSON.stringify(a),c=Zg.get(o);if(c)return c;const u=(async()=>jd.some(d=>d.supports(t,a))||Nt.includes(t)?!0:typeof AudioEncoder>"u"?!1:(await AudioEncoder.isConfigSupported(a)).supported===!0)();return Zg.set(o,u),u},qd=async t=>!!ir.includes(t),U5=async()=>{const[t,e,n]=await Promise.all([Ox(),Yd(),Nx()]);return[...t,...e,...n]},Ox=async(t=xt,e)=>{const n=await Promise.all(t.map(r=>Vd(r,e)));return t.filter((r,i)=>n[i])},Yd=async(t=Ut,e)=>{const n=await Promise.all(t.map(r=>Gd(r,e)));return t.filter((r,i)=>n[i])},Nx=async(t=ir)=>{const e=await Promise.all(t.map(qd));return t.filter((n,r)=>e[r])},Ux=async(t,e)=>{for(const n of t)if(await Vd(n,e))return n;return null},L5=async(t,e)=>{for(const n of t)if(await Gd(n,e))return n;return null},z5=async t=>{for(const e of t)if(await qd(e))return e;return null};/*!
745 * Copyright (c) 2026-present, Vanilagy and contributors
746 *
747 * This Source Code Form is subject to the terms of the Mozilla Public
748 * License, v. 2.0. If a copy of the MPL was not distributed with this
749 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
750 */class Lx{static supports(e,n){return!1}}class zx{static supports(e,n){return!1}}class Qx{static supports(e,n){return!1}}class Hx{static supports(e,n){return!1}}const Hc=[],Wc=[],Kd=[],jd=[],Q5=t=>{if(t.prototype instanceof Lx){const e=t;if(Hc.includes(e)){console.warn("Video decoder already registered.");return}Hc.push(e),Yg.clear()}else if(t.prototype instanceof zx){const e=t;if(Wc.includes(e)){console.warn("Audio decoder already registered.");return}Wc.push(e),Kg.clear()}else throw new TypeError("Decoder must be a CustomVideoDecoder or CustomAudioDecoder.")},H5=t=>{if(t.prototype instanceof Qx){const e=t;if(Kd.includes(e)){console.warn("Video encoder already registered.");return}Kd.push(e),Jg.clear()}else if(t.prototype instanceof Hx){const e=t;if(jd.includes(e)){console.warn("Audio encoder already registered.");return}jd.push(e),Zg.clear()}else throw new TypeError("Encoder must be a CustomVideoEncoder or CustomAudioEncoder.")};/*!
751 * Copyright (c) 2026-present, Vanilagy and contributors
752 *
753 * This Source Code Form is subject to the terms of the Mozilla Public
754 * License, v. 2.0. If a copy of the MPL was not distributed with this
755 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
756 */const W5=t=>{let r=t,i=4096,s=0,a=12,o=0;for(r<0&&(r=-r,s=128),r+=33,r>8191&&(r=8191);(r&i)!==i&&a>=5;)i>>=1,a--;return o=r>>a-4&15,~(s|a-5<<4|o)&255},V5=t=>{let n=0,r=0,i=~t;i&128&&(i&=-129,n=-1),r=((i&240)>>4)+5;const s=(1<<r|(i&15)<<r-4|1<<r-5)-33;return n===0?s:-s},G5=t=>{let n=2048,r=0,i=11,s=0,a=t;for(a<0&&(a=-a,r=128),a>4095&&(a=4095);(a&n)!==n&&i>=5;)n>>=1,i--;return s=a>>(i===4?1:i-4)&15,(r|i-4<<4|s)^85},q5=t=>{let e=0,n=0,r=t^85;r&128&&(r&=-129,e=-1),n=((r&240)>>4)+4;let i=0;return n!==4?i=1<<n|(r&15)<<n-4|1<<n-5:i=r<<1|1,e===0?i:-i};/*!
757 * Copyright (c) 2026-present, Vanilagy and contributors
758 *
759 * This Source Code Form is subject to the terms of the Mozilla Public
760 * License, v. 2.0. If a copy of the MPL was not distributed with this
761 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
762 */const Os=t=>{if(!t||typeof t!="object")throw new TypeError("options must be an object.");if(t.metadataOnly!==void 0&&typeof t.metadataOnly!="boolean")throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(t.verifyKeyPackets!==void 0&&typeof t.verifyKeyPackets!="boolean")throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(t.verifyKeyPackets&&t.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.");if(t.skipLiveWait!==void 0&&typeof t.skipLiveWait!="boolean")throw new TypeError("options.skipLiveWait, when defined, must be a boolean.")},ii=t=>{if(!Ha(t))throw new TypeError("timestamp must be a number.")},rA=(t,e,n)=>n.verifyKeyPackets?e.then(async r=>{if(!r||r.type==="delta")return r;const i=await t.determinePacketType(r);return i&&(r.type=i),r}):e;class ao{constructor(e){if(!(e instanceof oo))throw new TypeError("track must be an InputTrack.");this._track=e}async getFirstPacket(e={}){if(Os(e),this._track.input._disposed)throw new bn;return rA(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){Os(e);const n=await this.getFirstPacket(e);
762return n?n.type==="key"?n:this.getNextKeyPacket(n,e):null}async getPacket(e,n={}){if(ii(e),Os(n),this._track.input._disposed)throw new bn;return rA(this._track,this._track._backing.getPacket(e,n),n)}async getNextPacket(e,n={}){if(!(e instanceof nt))throw new TypeError("packet must be an EncodedPacket.");if(Os(n),this._track.input._disposed)throw new bn;return rA(this._track,this._track._backing.getNextPacket(e,n),n)}async getKeyPacket(e,n={}){if(ii(e),Os(n),this._track.input._disposed)throw new bn;if(!n.verifyKeyPackets)return this._track._backing.getKeyPacket(e,n);const r=await this._track._backing.getKeyPacket(e,n);return r&&(b(r.type==="key"),await this._track.determinePacketType(r)==="delta"?this.getKeyPacket(r.timestamp-1/await this._track.getTimeResolution(),n):r)}async getNextKeyPacket(e,n={}){if(!(e instanceof nt))throw new TypeError("packet must be an EncodedPacket.");if(Os(n),this._track.input._disposed)throw new bn;if(!n.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,n);const r=await this._track._backing.getNextKeyPacket(e,n);return r&&(b(r.type==="key"),await this._track.determinePacketType(r)==="delta"?this.getNextKeyPacket(r,n):r)}packets(e,n,r={}){if(e!==void 0&&!(e instanceof nt))throw new TypeError("startPacket must be an EncodedPacket.");if(e!==void 0&&e.isMetadataOnly&&!(r!=null&&r.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(n!==void 0&&!(n instanceof nt))throw new TypeError("endPacket must be an EncodedPacket.");if(Os(r),this._track.input._disposed)throw new bn;const i=[];let{promise:s,resolve:a}=wt(),{promise:o,resolve:c}=wt(),u=!1,l=!1,d=null;const f=[],h=()=>Math.max(2,f.length);(async()=>{let p=e??await this.getFirstPacket(r);for(;p&&!l&&!this._track.input._disposed&&!(n&&p.sequenceNumber>=(n==null?void 0:n.sequenceNumber));){if(i.length>h()){({promise:o,resolve:c}=wt()),await o;continue}i.push(p),a(),{promise:s,resolve:a}=wt(),p=await this.getNextPacket(p,r)}u=!0,a()})().catch(p=>{d||(d=p,a())});const m=this._track;return{async next(){for(;;){if(m.input._disposed)throw new bn;if(l)return{value:void 0,done:!0};if(d)throw d;if(i.length>0){const p=i.shift(),g=performance.now();for(f.push(g);f.length>0&&g-f[0]>=1e3;)f.shift();return c(),{value:p,done:!1}}else{if(u)return{value:void 0,done:!0};await s}}},async return(){return l=!0,c(),a(),{value:void 0,done:!0}},async throw(p){throw p},[Symbol.asyncIterator](){return this}}}}class iA{constructor(e,n){this.onSample=e,this.onError=n}}class sA{mediaSamplesInRange(e=-1/0,n=1/0,r){ii(e),ii(n);const i=[];let s=!1,a=null,{promise:o,resolve:c}=wt(),{promise:u,resolve:l}=wt(),d=!1,f=!1,h=!1,m=null;const p={...r,verifyKeyPackets:!0,metadataOnly:!1};(async()=>{const y=await this._createDecoder(C=>{if(l(),C.timestamp>=n&&(f=!0),f){C.close();return}a&&(C.timestamp>e?(i.push(a),s=!0):a.close()),C.timestamp>=e&&(i.push(C),s=!0),a=s?null:C,i.length>0&&(c(),{promise:o,resolve:c}=wt())},C=>{m||(m=C,c())}),w=this._createPacketSink(),E=await w.getKeyPacket(e,p)??await w.getFirstKeyPacket(p);let S=E;const T=w.packets(E??void 0,void 0,p);for(await T.next();S&&!f&&!this._track.input._disposed;){const C=Wx(i.length);if(i.length+y.getDecodeQueueSize()>C){({promise:u,resolve:l}=wt()),await u;continue}y.decode(S);const _=await T.next();if(_.done)break;S=_.value}await T.return(),!h&&!this._track.input._disposed&&await y.flush(),y.close(),!s&&a&&i.push(a),d=!0,c()})().catch(y=>{m||(m=y,c())});const g=this._track,A=()=>{a==null||a.close();for(const y of i)y.close()};return{async next(){for(;;){if(g.input._disposed)throw A(),new bn;if(h)return{value:void 0,done:!0};if(m)throw A(),m;if(i.length>0){const y=i.shift();return l(),{value:y,done:!1}}else if(!d)await o;else return{value:void 0,done:!0}}},async return(){return h=!0,f=!0,l(),c(),A(),{value:void 0,done:!0}},async throw(y){throw y},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e,n){xW(e);const r=CW(e),i=[],s=[];let{promise:a,resolve:o}=wt(),{promise:c,resolve:u}=wt(),l=!1,d=!1,f=null;const h=A=>{s.push(A),o(),{promise:a,resolve:o}=wt()},m={...n,verifyKeyPackets:!0,metadataOnly:!1};(async()=>{const A=await this._createDecoder(C=>{if(u(),d){C.close();return}let _=0;for(;i.length>0&&C.timestamp-i[0]>-1e-10;)_++,i.shift();if(_>0)for(let x=0;x<_;x++)h(x<_-1?C.clone():C);else C.close()},C=>{f||(f=C,o())}),y=this._createPacketSink();let w=null,E=null,S=-1;const k=async()=>{b(E);let C=E;for(A.decode(C);C.sequenceNumber<S;){const _=Wx(s.length);for(;s.length+A.getDecodeQueueSize()>_&&!d;)({promise:c,resolve:u}=wt()),await c;if(d)break;const x=await y.getNextPacket(C,m);b(x),A.decode(x),C=x}S=-1},T=async()=>{await A.flush();for(let C=0;C<i.length;C++)h(null);i.length=0};for await(const C of r){if(ii(C),d||this._track.input._disposed)break;const _=await y.getPacket(C,m),x=_&&await y.getKeyPacket(C,m);if(!x){S!==-1&&(await k(),await T()),h(null),w=null;continue}w&&(x.sequenceNumber!==E.sequenceNumber||_.timestamp<w.timestamp)&&(await k(),await T()),i.push(_.timestamp),S=Math.max(_.sequenceNumber,S),w=_,E=x}!d&&!this._track.input._disposed&&(S!==-1&&await k(),await T()),A.close(),l=!0,o()})().catch(A=>{f||(f=A,o())});const p=this._track,g=()=>{for(const A of s)A==null||A.close()};return{async next(){for(;;){if(p.input._disposed)throw g(),new bn;if(d)return{value:void 0,done:!0};if(f)throw g(),f;if(s.length>0){const A=s.shift();return b(A!==void 0),u(),{value:A,done:!1}}else if(!l)await a;else return{value:void 0,done:!0}}},async return(){return d=!0,u(),o(),g(),{value:void 0,done:!0}},async throw(A){throw A},[Symbol.asyncIterator](){return this}}}}const Wx=t=>t===0?40:8;class Y5 extends iA{constructor(e,n,r,i,s,a){super(e,n),this.codec=r,this.decoderConfig=i,this.rotation=s,this.timeResolution=a,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer
762=new Ec,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1,this.frameHandlerSerializer=new Ec;const o=Hc.find(c=>c.supports(r,i));if(o)this.customDecoder=new o,this.customDecoder.codec=r,this.customDecoder.config=i,this.customDecoder.onSample=c=>{if(!(c instanceof Ft))throw new TypeError("The argument passed to onSample must be a VideoSample.");this.finalizeAndEmitSample(c)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{const c=l=>{this.frameHandlerSerializer.call(async()=>{if(this.alphaQueue.length>0){const d=this.alphaQueue.shift();b(d!==void 0),await this.mergeAlpha(l,d)}else this.colorQueue.push(l)}).catch(d=>this.onError(d))};if(r==="avc"&&this.decoderConfig.description&&qm()){const l=MI(dt(this.decoderConfig.description));if(l&&l.sequenceParameterSets.length>0){const d=dg(l.sequenceParameterSets[0]);d&&d.frameMbsOnlyFlag===0&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:"prefer-software"})}}const u=new Error("Decoding error").stack;this.decoder=new VideoDecoder({output:l=>{try{c(l)}catch(d){this.onError(d)}},error:l=>{l.stack=u,this.onError(l)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){var e;return this.customDecoder?this.customDecoderQueueSize:(b(this.decoder),Math.max(this.decoder.decodeQueueSize,((e=this.alphaDecoder)==null?void 0:e.decodeQueueSize)??0))}decode(e){if(this.codec==="hevc"&&this.currentPacketIndex>
7620&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}if(this.customDecoder)this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--);else{if(b(this.decoder),Sc()||lI(this.inputTimestamps,e.timestamp,n=>n),qm()&&this.currentPacketIndex===0){if(this.codec==="avc"){const n=[];for(const i of FI(e.data,this.decoderConfig)){const s=Ka(e.data[i.offset]);s>=20&&s<=31||n.push(e.data.subarray(i.offset,i.offset+i.length))}const r=oV(n,this.decoderConfig);e=new nt(r,e.type,e.timestamp,e.duration)}else if(this.codec==="hevc"){const n=yV(e.data,this.decoderConfig);n&&(e=new nt(n,e.type,e.timestamp,e.duration))}}this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)}this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha){this.pushNullAlphaFrame();return}if(this.merger||(this.merger=new $d),!this.alphaDecoder){const r=s=>{this.frameHandlerSerializer.call(async()=>{if(this.colorQueue.length>0){const a=this.colorQueue.shift();b(a!==void 0),await this.mergeAlpha(a,s)}else this.alphaQueue.push(s);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){const a=this.colorQueue.shift();b(a!==void 0),await this.mergeAlpha(a,null)}else this.alphaQueue.push(null);this.alphaDecoderQueueSize--}).catch(a=>this.onError(a))},i=new Error("Decoding error").stack;this.alphaDecoder=new VideoDecoder({output:s=>{try{r(s)}catch(a){this.onError(a)}},error:s=>{s.stack=i,this.onError(s)}}),this.alphaDecoder.configure(this.decoderConfig)}const n=vd(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||(this.alphaHadKeyframe=n==="key"),this.alphaHadKeyframe){if(this.codec==="hevc"&&this.currentAlphaPacketIndex>
7620&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha)){this.pushNullAlphaFrame();return}this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(n??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){this.alphaDecoderQueueSize===0?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){for(const n of Cd(e,this.decoderConfig)){const r=zi(e[n.offset]);if(r===Rt.RASL_N||r===Rt.RASL_R)return!0}return!1}sampleHandler(e){if(Sc()){if(this.sampleQueue.length>0&&e.timestamp>=yt(this.sampleQueue).timestamp){for(const n of this.sampleQueue)this.finalizeAndEmitSample(n);this.sampleQueue.length=0}lI(this.sampleQueue,e,n=>n.timestamp)}else{const n=this.inputTimestamps.shift();b(n!==void 0),e.setTimestamp(n),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}async mergeAlpha(e,n){if(!n){const s=new Ft(e);this.sampleHandler(s);return}b(this.merger);const r=await this.merger.update(e,n),i=new Ft(r);this.sampleHandler(i)}async flush(){var e;if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(b(this.decoder),await Promise.all([this.decoder.flush(),(e=this.alphaDecoder)==null?void 0:e.flush()]),await this.frameHandlerSerializer.currentPromise,this.colorQueue.forEach(n=>n.close()),this.colorQueue.length=0,this.alphaQueue.forEach(n=>n==null?void 0:n.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),Sc()){for(const n of this.sampleQueue)this.finalizeAndEmitSample(n);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){var e,n;this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(b(this.decoder),this.decoder.close(),(e=this.alphaDecoder)==null||e.close(),this.colorQueue.forEach(r=>r.close()),this.colorQueue.length=0,this.alphaQueue.forEach(r=>r==null?void 0:r.close()),this.alphaQueue.length=0,(n=this.merger)==null||n.close());for(const r of this.sampleQueue)r.close();this.sampleQueue.length=0}}let Vx=!1;class $d{constructor(){this.canvas=null,this.gl=null,this.program=null,this.vao=null,this.colorTexture=null,this.alphaTexture=null,this.worker=null,this.pendingRequests=new Map,this.nextRequestId=0;const e=typeof OffscreenCanvas<"u"||typeof document<"u"&&typeof document.createElement=="function";if(!$d.forceCpu&&e&&!Vx)try{typeof OffscreenCanvas<"u"?this.canvas=new OffscreenCanvas(300,150):this.canvas=document.createElement("canvas");const n=this.canvas.getContext("webgl2",{premultipliedAlpha:!1});if(!n)throw new Error("Couldn't acquire WebGL 2 context.");this.gl=n,this.program=this.createProgram(),this.vao=this.createVAO(),this.colorTexture=this.createTexture(),this.alphaTexture=this.createTexture(),this.gl.useProgram(this.program),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_colorTexture"),0),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_alphaTexture"),1)}catch(n){this.gl=null,this.canvas=null,Vx=!0,console.warn("Falling back to CPU for color/alpha merging.",n)}}async update(e,n){return this.gl?this.updateGpu(e,n):this.updateCpu(e,n)}createProgram(){b(this.gl);const e=this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
763			in vec2 a_position;
764			in vec2 a_texCoord;
765			out vec2 v_texCoord;
766			
767			void main() {
768				gl_Position = vec4(a_position, 0.0, 1.0);
769				v_texCoord = a_texCoord;
770			}
771		`),n=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
772			precision highp float;
773			
774			uniform sampler2D u_colorTexture;
775			uniform sampler2D u_alphaTexture;
776			in vec2 v_texCoord;
777			out vec4 fragColor;
778			
779			void main() {
780				vec3 color = texture(u_colorTexture, v_texCoord).rgb;
781				float alpha = texture(u_alphaTexture, v_texCoord).r;
782				fragColor = vec4(color, alpha);
783			}
784		`),r=this.gl.createProgram();return this.gl.attachShader(r,e),this.gl.attachShader(r,n),this.gl.linkProgram(r),r}createShader(e,n){b(this.gl);const r=this.gl.createShader(e);return this.gl.shaderSource(r,n),this.gl.compileShader(r),r}createVAO(){b(this.gl),b(this.program);const e=this.gl.createVertexArray();this.gl.bindVertexArray(e);const n=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),r=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,r),this.gl.bufferData(this.gl.ARRAY_BUFFER,n,this.gl.STATIC_DRAW);const i=this.gl.getAttribLocation(this.program,"a_position"),s=this.gl.getAttribLocation(this.program,"a_texCoord");return this.gl.enableVertexAttribArray(i),this.gl.vertexAttribPointer(i,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(s),this.gl.vertexAttribPointer(s,2,this.gl.FLOAT,!1,16,8),e}createTexture(){b(this.gl);const e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}
784updateGpu(e,n){b(this.gl),b(this.canvas),(e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.colorTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,this.alphaTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,n),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const r=new VideoFrame(this.canvas,{timestamp:e.timestamp,duration:e.duration??void 0});return e.close(),n.close(),r}updateCpu(e,n){if(!this.worker){const s=new Blob([`(${K5.toString()})()`],{type:"application/javascript"}),a=URL.createObjectURL(s);this.worker=new Worker(a),URL.revokeObjectURL(a),this.worker.addEventListener("message",o=>{const c=o.data,u=this.pendingRequests.get(c.id);u&&(this.pendingRequests.delete(c.id),"error"in c?u.reject(new Error(c.error)):u.resolve(c.frame))}),this.worker.addEventListener("error",o=>{const c=new Error(o.message||"Color/alpha merge worker error.");for(const u of this.pendingRequests.values())u.reject(c);this.pendingRequests.clear()})}const r=this.nextRequestId++,i=wt();return this.pendingRequests.set(r,i),this.worker.postMessage({id:r,color:e,alpha:n},{transfer:[e,n]}),i.promise}close(){var n,r,i;(r=(n=this.gl)==null?void 0:n.getExtension("WEBGL_lose_context"))==null||r.loseContext(),this.gl=null,this.canvas=null,(i=this.worker)==null||i.terminate(),this.worker=null;const e=new Error("Color/alpha merger closed.");for(const s of this.pendingRequests.values())s.reject(e);this.pendingRequests.clear()}}$d.forceCpu=!0;const K5=()=>{let t=null,e=null,n=Promise.resolve();self.addEventListener("message",c=>{const{id:u,color:l,alpha:d}=c.data;n=n.then(async()=>{try{const f=await r(l,d);self.postMessage({id:u,frame:f},{transfer:[f]})}catch(f){self.postMessage({id:u,error:f.message})}finally{l.close(),d.close()}})});const r=async(c,u)=>{const l=c.format,d=u.format;if(!l||!d)throw new Error("CPU color/alpha merging requires a known VideoFrame format.");const f=l.includes("P10"),h=l.includes("P12"),m=d.includes("P10"),p=d.includes("P12");if(m!==f||p!==h)throw new Error(`CPU color/alpha merging requires the alpha frame to have the same bit depth as the color frame (color: '${l}', alpha: '${d}').`);const g=c.codedWidth,A=c.codedHeight;if(l==="RGBX"||l==="RGBA"||l==="BGRX"||l==="BGRA")return await i(c,u,g,A,l);if(l==="I420"||l==="I420P10"||l==="I420P12"||l==="I422"||l==="I422P10"||l==="I422P12"||l==="I444"||l==="I444P10"||l==="I444P12")return await s(c,u,g,A,l);if(l==="NV12")return await a(c,u,g,A);throw new Error(`CPU color/alpha merging does not support format '${l}'.`)},i=async(c,u,l,d,f)=>{const h=l*d,m=new Uint8Array(h*4);await c.copyTo(m);const p=await o(u,l,d,1);for(let y=0,w=3;y<h;y++,w+=4)m[w]=p[y];const A={format:f==="RGBX"||f==="RGBA"?"RGBA":"BGRA",codedWidth:l,codedHeight:d,timestamp:c.timestamp,duration:c.duration??void 0,transfer:[m.buffer]};return new VideoFrame(m,A)},s=async(c,u,l,d,f)=>{const h=f.includes("P10"),m=f.includes("P12"),p=h||m?2:1;let g,A;f.startsWith("I420")?(g=Math.ceil(l/2),A=Math.ceil(d/2)):f.startsWith("I422")?(g=Math.ceil(l/2),A=d):(g=l,A=d);const y=l*d,w=g*A,E=y*p,S=w*p,k=y*p,T=E+2*S+k,C=new Uint8Array(T);await c.copyTo(C);const _=await o(u,l,d,p),x=E+2*S;C.set(_,x);const v={format:f.slice(0,4)+"A"+f.slice(4),codedWidth:l,codedHeight:d,timestamp:c.timestamp,duration:c.duration??void 0,transfer:[C.buffer]};return new VideoFrame(C,v)},a=async(c,u,l,d)=>{const f=l*d,h=Math.ceil(l/2),m=Math.ceil(d/2),p=h*m,g=c.allocationSize();(!e||e.byteLength!==g)&&(e=new Uint8Array(g)),await c.copyTo(e);const A=new Uint8Array(f+2*p+f);A.set(e.subarray(0,f),0);const y=f,w=f+p,E=f;for(let T=0;T<p;T++)A[y+T]=e[E+T*2],A[w+T]=e[E+T*2+1];const S=await o(u,l,d,1);A.set(S,f+2*p);const k={format:"I420A",codedWidth:l,codedHeight:d,timestamp:c.timestamp,duration:c.duration??void 0,transfer:[A.buffer]};return new VideoFrame(A,k)},o=async(c,u,l,d)=>{const f=c.allocationSize();(!t||t.byteLength!==f)&&(t=new Uint8Array(f)),await c.copyTo(t);const h=c.format;if(h==="RGBA"||h==="BGRA"||h==="RGBX"||h==="BGRX"){const m=h==="RGBA"||h==="RGBX"?0:2,p=u*l;for(let g=0;g<p;g++)t[g]=t[g*4+m];return t.subarray(0,p)}else return t.subarray(0,u*l*d)}};class Xd extends sA{constructor(e){if(!(e instanceof Vc))throw new TypeError("videoTrack must be an InputVideoTrack.");super(),this._track=e}async _createDecoder(e,n){if(!await this._track.canDecode())throw new Error("This video track cannot be decoded by this browser. Make sure to check decodability before using a track.");const r=await this._track.getCodec(),i=await this._track.getRotation(),s=await this._track.getDecoderConfig(),a=await this._track.getTimeResolution();return b(r&&s),new Y5(e,n,r,s,i,a)}_createPacketSink(){return new ao(this._track)}async getSample(e,n={}){ii(e);for await(const r of this.mediaSamplesAtTimestamps([e],n))return r;throw new Error("Internal error: Iterator returned nothing.")}samples(e,n,r={}){return this.mediaSamplesInRange(e,n,r)}samplesAtTimestamps(e,n={}){return this.mediaSamplesAtTimestamps(e,n)}}class j5{constructor(e,n={}){if(this._rotation=0,this._initPromise=null,this._nextCanvasIndex=0,!(e instanceof Vc))throw new TypeError("videoTrack must be an InputVideoTrack.");
vendor: 6,338 bytes, line 784
784if(n&&typeof n!="object")throw new TypeError("options must be an object.");if(n.alpha!==void 0&&typeof n.alpha!="boolean")throw new TypeError("options.alpha, when provided, must be a boolean.");if(n.width!==void 0&&(!Number.isInteger(n.width)||n.width<=0))throw new TypeError("options.width, when defined, must be a positive integer.");if(n.height!==void 0&&(!Number.isInteger(n.height)||n.height<=0))throw new TypeError("options.height, when defined, must be a positive integer.");if(n.fit!==void 0&&!["fill","contain","cover"].includes(n.fit))throw new TypeError('options.fit, when provided, must be one of "fill", "contain", or "cover".');if(n.width!==void 0&&n.height!==void 0&&n.fit===void 0)throw new TypeError("When both options.width and options.height are provided, options.fit must also be provided.");if(n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError("options.rotation, when provided, must be 0, 90, 180 or 270.");if(n.crop!==void 0&&zc(n.crop,"options."),n.poolSize!==void 0&&(typeof n.poolSize!="number"||!Number.isInteger(n.poolSize)||n.poolSize<0))throw new TypeError("poolSize must be a non-negative integer.");this._videoTrack=e,this._alpha=n.alpha??!1,this._options=n,this._fit=n.fit??"fill",this._videoSampleSink=new Xd(e),this._canvasPool=Array.from({length:n.poolSize??0},()=>null)}_ensureInit(){return this._initPromise??(this._initPromise=(async()=>{const e=this._options,n=this._videoTrack,r=e.rotation??await n.getRotation(),i=await n.getSquarePixelWidth(),s=await n.getSquarePixelHeight(),[a,o]=r%180===0?[i,s]:[s,i];let c=e.crop;c&&(c=Qd(c,a,o));let[u,l]=c?[c.width,c.height]:[a,o];const d=u/l;e.width!==void 0&&e.height===void 0?(u=e.width,l=Math.round(u/d)):e.width===void 0&&e.height!==void 0?(l=e.height,u=Math.round(l*d)):e.width!==void 0&&e.height!==void 0&&(u=e.width,l=e.height),this._width=u,this._height=l,this._rotation=r,this._crop=c})())}_videoSampleToWrappedCanvas(e){const n=this._width,r=this._height;let i=this._canvasPool[this._nextCanvasIndex],s=!1;i||(typeof document<"u"?(i=document.createElement("canvas"),i.width=n,i.height=r):i=new OffscreenCanvas(n,r),this._canvasPool.length>0&&(this._canvasPool[this._nextCanvasIndex]=i),s=!0),this._canvasPool.length>0&&(this._nextCanvasIndex=(this._nextCanvasIndex+1)%this._canvasPool.length);const a=i.getContext("2d",{alpha:this._alpha||gd()});b(a),a.resetTransform(),s||(!this._alpha&&gd()?(a.fillStyle="black",a.fillRect(0,0,n,r)):a.clearRect(0,0,n,r)),e.drawWithFit(a,{fit:this._fit,rotation:this._rotation,crop:this._crop});const o={canvas:i,timestamp:e.timestamp,duration:e.duration};return e.close(),o}async getCanvas(e,n){ii(e),await this._ensureInit();const r=await this._videoSampleSink.getSample(e,n);return r&&this._videoSampleToWrappedCanvas(r)}async*canvases(e,n,r){await this._ensureInit(),yield*md(this._videoSampleSink.samples(e,n,r),i=>this._videoSampleToWrappedCanvas(i))}async*canvasesAtTimestamps(e,n){await this._ensureInit(),yield*md(this._videoSampleSink.samplesAtTimestamps(e,n),r=>r&&this._videoSampleToWrappedCanvas(r))}}class $5 extends iA{constructor(e,n,r,i){super(e,n),this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new Ec,this.customDecoderQueueSize=0,this.currentTimestamp=null,this.expectedFirstTimestamp=null,this.timestampOffset=0;const s=o=>{let c=o.timestamp;this.expectedFirstTimestamp&&this.currentTimestamp===null&&(this.timestampOffset=this.expectedFirstTimestamp-c),c+=this.timestampOffset,(this.currentTimestamp===null||Math.abs(c-this.currentTimestamp)>=o.duration)&&(this.currentTimestamp=c);const u=this.currentTimestamp;if(this.currentTimestamp+=o.duration,o.numberOfFrames===0){o.close();return}const l=i.sampleRate;o.setTimestamp(Math.round(u*l)/l),e(o)},a=Wc.find(o=>o.supports(r,i));if(a)this.customDecoder=new a,this.customDecoder.codec=r,this.customDecoder.config=i,this.customDecoder.onSample=o=>{if(!(o instanceof Wt))throw new TypeError("The argument passed to onSample must be an AudioSample.");s(o)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{const o=new Error("Decoding error").stack;this.decoder=new AudioDecoder({output:c=>{try{s(new Wt(c))}catch(u){this.onError(u)}},error:c=>{c.stack=o,this.onError(c)}}),this.decoder.configure(i)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(b(this.decoder),this.decoder.decodeQueueSize)}decode(e){this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--)):(b(this.decoder),this.expectedFirstTimestamp??(this.expectedFirstTimestamp=e.timestamp),this.decoder.decode(e.toEncodedAudioChunk()))}async flush(){this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(b(this.decoder),await this.decoder.flush()),this.currentTimestamp=null,this.expectedFirstTimestamp=null,this.timestampOffset=0}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(b(this.decoder),this.decoder.close())}}class X5 extends iA{constructor(e,n,r){super(e,n),this.decoderConfig=r,this.currentTimestamp=null,b(Nt.includes(r.codec)),this.codec=r.codec;const{dataType:i,sampleSize:s,littleEndian:a}=sr(this.codec);switch(this.inputSampleSize=s,s){case 1:i==="unsigned"?this.readInputValue=(o,c)=>o.getUint8(c)-2**7:i==="signed"?this.readInputValue=(o,c)=>o.getInt8(c):i==="ulaw"?this.readInputValue=(o,c)=>V5(o.getUint8(c)):i==="alaw"?this.readInputValue=(o,c)=>q5(o.getUint8(c)):b(!1);break;case 2:i==="unsigned"?this.readInputValue=(o,c)=>o.getUint16(c,a)-2**15:i==="signed"?this.readInputValue=(o,c)=>o.getInt16(c,a):b(!1);break;case 3:i==="unsigned"?this.readInputValue=(o,c)=>hd(o,c,a)-2**23:i==="signed"?this.readInputValue=(o,c)=>vW(o,c,a):b(!1);break;case 4:i==="unsigned"?this.readInputValue=(o,c)=>o.getUint32(c,a)-2**31:i==="signed"?this.readInputValue=(o,c)=>o.getInt32(c,a):i==="float"?this.readInputValue=(o,c)=>o.getFloat32(c,a):b(!1);break;case 8:i==="float"?this.readInputValue=(o,c)=>o.getFloat64(c,a):b(!1);break;default:rn(s),b(!1)}switch(s){case 1:i==="ulaw"||i==="alaw"?(this.outputSampleSize=2,this.outputFormat="s16",this.writeOutputValue=(o,c,u)=>o.setInt16(c,u,!0)):(this.outputSampleSize=1,this.outputFormat="u8",this.writeOutputValue=(o,c,u)=>
784o.setUint8(c,u+2**7));break;case 2:this.outputSampleSize=2,this.outputFormat="s16",this.writeOutputValue=(o,c,u)=>o.setInt16(c,u,!0);break;case 3:this.outputSampleSize=4,this.outputFormat="s32",this.writeOutputValue=(o,c,u)=>o.setInt32(c,u<<8,!0);break;case 4:this.outputSampleSize=4,i==="float"?(this.outputFormat="f32",this.writeOutputValue=(o,c,u)=>o.setFloat32(c,u,!0)):(this.outputFormat="s32",this.writeOutputValue=(o,c,u)=>o.setInt32(c,u,!0));break;case 8:this.outputSampleSize=4,this.outputFormat="f32",this.writeOutputValue=(o,c,u)=>o.setFloat32(c,u,!0);break;default:rn(s),b(!1)}}getDecodeQueueSize(){return 0}decode(e){const n=_e(e.data),r=e.byteLength/this.decoderConfig.numberOfChannels/this.inputSampleSize,i=r*this.decoderConfig.numberOfChannels*this.outputSampleSize,s=new ArrayBuffer(i),a=new DataView(s);for(let l=0;l<r*this.decoderConfig.numberOfChannels;l++){const d=l*this.inputSampleSize,f=l*this.outputSampleSize,h=this.readInputValue(n,d);this.writeOutputValue(a,f,h)}const o=r/this.decoderConfig.sampleRate;(this.currentTimestamp===null||Math.abs(e.timestamp-this.currentTimestamp)>=o)&&(this.currentTimestamp=e.timestamp);const c=this.currentTimestamp;this.currentTimestamp+=o;const u=new Wt({format:this.outputFormat,data:s,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:r,timestamp:c});this.onSample(u)}async flush(){}close(){}}class Jd extends sA{constructor(e){if(!(e instanceof Gc))throw new TypeError("audioTrack must be an InputAudioTrack.");super(),this._track=e}async _createDecoder(e,n){if(!await this._track.canDecode())throw new Error("This audio track cannot be decoded by this browser. Make sure to check decodability before using a track.");const r=await this._track.getCodec(),i=await this._track.getDecoderConfig();return b(r&&i),Nt.includes(i.codec)?new X5(e,n,i):new $5(e,n,r,i)}_createPacketSink(){return new ao(this._track)}async getSample(e,n={}){ii(e);for await(const r of this.mediaSamplesAtTimestamps([e],n))return r;throw new Error("Internal error: Iterator returned nothing.")}samples(e,n,r={}){return this.mediaSamplesInRange(e,n,r)}samplesAtTimestamps(e,n={}){return this.mediaSamplesAtTimestamps(e,n)}}class J5{constructor(e){if(!(e instanceof Gc))throw new TypeError("audioTrack must be an InputAudioTrack.");this._audioSampleSink=new Jd(e)}_audioSampleToWrappedArrayBuffer(e){const n={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),n}async getBuffer(e,n){ii(e);const r=await this._audioSampleSink.getSample(e,n);return r&&this._audioSampleToWrappedArrayBuffer(r)}buffers(e,n,r){return md(this._audioSampleSink.samples(e,n,r),i=>this._audioSampleToWrappedArrayBuffer(i))}buffersAtTimestamps(e,n){return md(this._audioSampleSink.samplesAtTimestamps(e,n),r=>r&&this._audioSampleToWrappedArrayBuffer(r))}}/*!
785 * Copyright (c) 2026-present, Vanilagy and contributors
786 *
787 * This Source Code Form is subject to the terms of the Mozilla Public
788 * License, v. 2.0. If a copy of the MPL was not distributed with this
789 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
790 */class oo{constructor(e,n){this.input=e,this._backing=n}isVideoTrack(){return this instanceof Vc}isAudioTrack(){return this instanceof Gc}get id(){return this._backing.getId()}get number(){return this._backing.getNumber()}async getInternalCodecId(){return this._backing.getInternalCodecId()}get internalCodecId(){return bt(this._backing.getInternalCodecId(),"internalCodecId","getInternalCodecId")}async getLanguageCode(){return this._backing.getLanguageCode()}get languageCode(){return bt(this._backing.getLanguageCode(),"languageCode","getLanguageCode")}async getName(){return this._backing.getName()}get name(){return bt(this._backing.getName(),"name","getName")}async getTimeResolution(){return this._backing.getTimeResolution()}get timeResolution(){return bt(this._backing.getTimeResolution(),"timeResolution","getTimeResolution")}async isRelativeToUnixEpoch(){return this._backing.isRelativeToUnixEpoch()}async getDisposition(){return this._backing.getDisposition()}get disposition(){return bt(this._backing.getDisposition(),"disposition","getDisposition")}async getBitrate(){return this._backing.getBitrate()}async getAverageBitrate(){return this._backing.getAverageBitrate()}async getFirstTimestamp(){const e=await this._backing.getFirstPacket({metadataOnly:!0});return(e==null?void 0:e.timestamp)??0}async computeDuration(e){const n=await this._backing.getPacket(1/0,{metadataOnly:!0,...e}),r=((n==null?void 0:n.timestamp)??0)+((n==null?void 0:n.duration)??0);return La(r,await this.getTimeResolution())}async getDurationFromMetadata(e={}){return this._backing.getDurationFromMetadata(e)}async computePacketStats(e=1/0,n){const r=new ao(this);let i=1/0,s=-1/0,a=0,o=0;for await(const c of r.packets(void 0,void 0,{metadataOnly:!0,...n})){if(a>=e&&c.timestamp>=s)break;i=Math.min(i,c.timestamp),s=Math.max(s,c.timestamp+c.duration),a++,o+=c.byteLength}return{packetCount:a,averagePacketRate:a?Number((a/(s-i)).toPrecision(16)):0,averageBitrate:a?
790Number((8*o/(s-i)).toPrecision(16)):0}}async isLive(){return await this._backing.getLiveRefreshInterval()!==null}async getLiveRefreshInterval(){return this._backing.getLiveRefreshInterval()}canBePairedWith(e){if(!(e instanceof oo))throw new TypeError("other must be an InputTrack.");return this.input!==e.input||this===e?!1:(this._backing.getPairingMask()&e._backing.getPairingMask())!==0n}async getPairableTracks(e){return this.input.getTracks(Ns({filter:n=>n.canBePairedWith(this)},e))}async getPairableVideoTracks(e){return this.input.getVideoTracks(Ns({filter:n=>n.canBePairedWith(this)},e))}async getPairableAudioTracks(e){return this.input.getAudioTracks(Ns({filter:n=>n.canBePairedWith(this)},e))}async getPrimaryPairableVideoTrack(e){return this.input.getPrimaryVideoTrack(Ns({filter:n=>n.canBePairedWith(this)},e))}async getPrimaryPairableAudioTrack(e){return this.input.getPrimaryAudioTrack(Ns({filter:n=>n.canBePairedWith(this)},e))}async hasPairableTrack(e){e&&(e=aA(e));const n=await this.input.getTracks();for(const r of n)if(this.canBePairedWith(r)&&(!e||await e(r)))return!0;return!1}hasPairableVideoTrack(e){return e&&(e=aA(e)),this.hasPairableTrack(async n=>n.isVideoTrack()&&(!e||await e(n)))}hasPairableAudioTrack(e){return e&&(e=aA(e)),this.hasPairableTrack(async n=>n.isAudioTrack()&&(!e||await e(n)))}}const bt=(t,e,n)=>{if(t instanceof Promise)throw new Error(`'${e}' is deprecated and not available synchronously for this track. Use the preferred '${n}()' instead.`);return t},aA=t=>{if(t!==void 0&&typeof t!="function")throw new TypeError("predicate, when provided, must be a function.");return t?e=>{const n=i=>{if(typeof i!="boolean")throw new TypeError("predicate must return or resolve to a boolean value.");return i},r=t(e);return r instanceof Promise?r.then(n):n(r)}:void 0};class Vc extends oo{constructor(e,n){super(e,n),this._pixelAspectRatioCache=null,this._backing=n}get type(){return"video"}async getCodec(){return this._backing.getCodec()}get codec(){return bt(this._backing.getCodec(),"codec","getCodec")}async hasOnlyKeyPackets(){var e,n;return await((n=(e=this._backing).getHasOnlyKeyPackets)==null?void 0:n.call(e))??!1}async getCodedWidth(){return this._backing.getCodedWidth()}get codedWidth(){return bt(this._backing.getCodedWidth(),"codedWidth","getCodedWidth")}async getCodedHeight(){return this._backing.getCodedHeight()}get codedHeight(){return bt(this._backing.getCodedHeight(),"codedHeight","getCodedHeight")}async getRotation(){return this._backing.getRotation()}get rotation(){return bt(this._backing.getRotation(),"rotation","getRotation")}async getSquarePixelWidth(){return this._backing.getSquarePixelWidth()}get squarePixelWidth(){return bt(this._backing.getSquarePixelWidth(),"squarePixelWidth","getSquarePixelWidth")}async getSquarePixelHeight(){return this._backing.getSquarePixelHeight()}get squarePixelHeight(){return bt(this._backing.getSquarePixelHeight(),"squarePixelHeight","getSquarePixelHeight")}async getPixelAspectRatio(){return this._pixelAspectRatioCache??(this._pixelAspectRatioCache=Tc({num:await this.get
790SquarePixelWidth()*await this.getCodedHeight(),den:await this.getSquarePixelHeight()*await this.getCodedWidth()}))}get pixelAspectRatio(){return this._pixelAspectRatioCache??(this._pixelAspectRatioCache=Tc({num:bt(this._backing.getSquarePixelWidth(),"pixelAspectRatio","getPixelAspectRatio")*bt(this._backing.getCodedHeight(),"pixelAspectRatio","getPixelAspectRatio"),den:bt(this._backing.getSquarePixelHeight(),"pixelAspectRatio","getPixelAspectRatio")*bt(this._backing.getCodedWidth(),"pixelAspectRatio","getPixelAspectRatio")}))}async getDisplayWidth(){var r,i;const e=await((i=(r=this._backing).getMetadataDisplayWidth)==null?void 0:i.call(r));return e??(await this.getRotation()%180===0?this.getSquarePixelWidth():this.getSquarePixelHeight())}get displayWidth(){var i,s;const e=(s=(i=this._backing).getMetadataDisplayWidth)==null?void 0:s.call(i);if(e!==void 0){const a=bt(e,"displayWidth","getDisplayWidth");if(a!==null)return a}const r=bt(this._backing.getRotation(),"displayWidth","getDisplayWidth")%180===0?this._backing.getSquarePixelWidth():this._backing.getSquarePixelHeight();return bt(r,"displayWidth","getDisplayWidth")}async getDisplayHeight(){var r,i;const e=await((i=(r=this._backing).getMetadataDisplayHeight)==null?void 0:i.call(r));return e??(await this.getRotation()%180===0?this.getSquarePixelHeight():this.getSquarePixelWidth())}get displayHeight(){var i,s;const e=(s=(i=this._backing).getMetadataDisplayHeight)==null?void 0:s.call(i);if(e!==void 0){const a=bt(e,"displayHeight","getDisplayHeight");if(a!==null)return a}const r=bt(this._backing.getRotation(),"displayHeight","getDisplayHeight")%180===0?this._backing.getSquarePixelHeight():this._backing.getSquarePixelWidth();return bt(r,"displayHeight","getDisplayHeight")}async getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const e=await this._backing.getColorSpace();return e.primaries==="bt2020"||e.primaries==="smpte432"||e.transfer==="pg"||e.transfer==="hlg"||e.matrix==="bt2020-ncl"}
790async canBeTransparent(){return this._backing.canBeTransparent()}async getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var r,i;const e=await((i=(r=this._backing).getMetadataCodecParameterString)==null?void 0:i.call(r));if(e!=null)return e;const n=await this._backing.getDecoderConfig();return(n==null?void 0:n.codec)??null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const n=await this._backing.getCodec();return b(n!==null),Hc.some(i=>i.supports(n,e))?!0:typeof VideoDecoder>"u"?!1:(await VideoDecoder.isConfigSupported(e)).supported===!0}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof nt))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");const n=await this.getCodec();if(n===null)return null;const r=await this.getDecoderConfig();return b(r),vd(n,r,e.data)}}class Gc extends oo{constructor(e,n){super(e,n),this._backing=n}get type(){return"audio"}async getCodec(){return this._backing.getCodec()}get codec(){return bt(this._backing.getCodec(),"codec","getCodec")}async hasOnlyKeyPackets(){var e,n;return await((n=(e=this._backing).getHasOnlyKeyPackets)==null?void 0:n.call(e))??!0}async getNumberOfChannels(){return this._backing.getNumberOfChannels()}get numberOfChannels(){return bt(this._backing.getNumberOfChannels(),"numberOfChannels","getNumberOfChannels")}async getSampleRate(){return this._backing.getSampleRate()}get sampleRate(){return bt(this._backing.getSampleRate(),"sampleRate","getSampleRate")}async getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var r,i;const e=await((i=(r=this._backing).getMetadataCodecParameterString)==null?void 0:i.call(r));if(e!=null)return e;const n=await this._backing.getDecoderConfig();return(n==null?void 0:n.codec)??null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const n=await this._backing.getCodec();return b(n!==null),Wc.some(r=>r.supports(n,e))||e.codec.startsWith("pcm-")?!0:typeof AudioDecoder>"u"?!1:(await AudioDecoder.isConfigSupported(e)).supported===!0}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof nt))throw new TypeError("packet must be an EncodedPacket.");return await this.getCodec()===null?null:"key"}}const Z5=t=>t??1/0,oA=t=>-(t??-1/0),co=t=>-t,qc=t=>{if(typeof t!="object"||!t)throw new TypeError("query must be an object.");if(t.filter!==void 0&&typeof t.filter!="function")throw new TypeError("query.filter, when provided, must be a function.");if(t.sortBy!==void 0&&typeof t.sortBy!="function")throw new TypeError("query.sortBy, when provided, must be a function.");return{filter:t.filter?e=>{const n=i=>{if(typeof i!="boolean")throw new TypeError("query.filter must return or resolve to a boolean.");return i},r=t.filter(e);return r instanceof Promise?r.then(n):n(r)}:void 0,sortBy:t.sortBy?e=>{const n=i=>{if(typeof i!="number"&&(!Array.isArray(i)||!i.every(s=>typeof s=="number")))throw new TypeError("query.sortBy must return or resolve to a number or an array of numbers.");return i},r=t.sortBy(e);return r instanceof Promise?r.then(n):n(r)}:void 0}},Ns=(t,e)=>({filter:t!=null&&t.filter||e!=null&&e.filter?n=>{var s;const r=((s=t==null?void 0:t.filter)==null?void 0:s.call(t,n))??!0,i=a=>{var o;return a===!1?!1:((o=e==null?void 0:e.filter)==null?void 0:o.call(e,n))??!0};return r instanceof Promise?r.then(i):i(r)}:void 0,sortBy:t!=null&&t.sortBy||e!=null&&e.sortBy?n=>{var a,o;const r=((a=t==null?void 0:t.sortBy)==null?void 0:a.call(t,n))??[],i=((o=e==null?void 0:e.sortBy)==null?void 0:o.call(e,n))??[],s=(c,u)=>[...Array.isArray(c)?c:[c],...Array.isArray(u)?u:[u]];return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then(([c,u])=>s(c,u)):s(r,i)}:void 0}),cA=async(t,e)=>{let n=t;if(e!=null&&e.filter){const a=t.map(c=>e.filter(c));if(a.some(c=>c instanceof Promise)){const c=await Promise.all(a);n=t.filter((u,l)=>c[l])}else n=t.filter((c,u)=>a[u])}if(!(e!=null&&e.sortBy))return n;const r=n.map(a=>e.sortBy(a)),s=r.some(a=>a instanceof Promise)?await Promise.all(r):r;return n.map((a,o)=>({track:a,sortValue:s[o]})).sort((a,o)=>{const c=Array.isArray(a.sortValue)?a.sortValue:[a.sortValue],u=Array.isArray(o.sortValue)?o.sortValue:[o.sortValue],l=Math.max(c.length,u.length);for(let d=0;d<l;d++){const f=c[d]??0,h=u[d]??0;if(f!==h)return f-h}return 0}).map(a=>a.track)};/*!
791 * Copyright (c) 2026-present, Vanilagy and contributors
792 *
793 * This Source Code Form is subject to the terms of the Mozilla Public
794 * License, v. 2.0. If a copy of the MPL was not distributed with this
795 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
796 */jm();const eG=1,tG=2;class Yc extends Ic{get disposed(){return this._disposed}constructor(e){if(super(),this._demuxerPromise=null,this._format=null,this._trackBackingsCache=null,this._backingToTrack=new Map,this._disposed=!1,this._nextSourceCacheAge=0,this._sourceRefs=[],this._sourceCache=[],this._sourceCachePromises=[],this._onFormatDetermined=null,!e||typeof e!="object")throw new TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some(n=>!(n instanceof or)))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof Rn||e.source instanceof Nd))throw new TypeError("options.source must be a Source or SourceRef.");if(e.source instanceof Rn&&e.source._disposed)throw new TypeError("options.source must not be a disposed Source.");if(e.initInput!==void 0&&!(e.initInput instanceof Yc))throw new TypeError("options.initInput, when provided, must be an Input.");e.formatOptions!==void 0&&y5(e.formatOptions,"formatOptions"),this._formats=e.formats,this._initInput=e.initInput??null,this._formatOptions=e.formatOptions??{},e.source instanceof Rn?this._rootRef=e.source.ref():this._rootRef=e.source,this._sourceRefs.push(this._rootRef)}get _rootSource(){return this._rootRef.source}async _getSourceUncached(e){b(this._rootSource instanceof Ms);const n=await this._rootSource._resolveRequest(e);return this._emit("source",{source:n.source,request:e,isRoot:e.isRoot}),n}_getSourceCached(e,n=eG){const r=this._sourceCache.find(a=>a.cacheGroup===n&&KC(a.request,e));if(r)return r.age++,Promise.resolve(r.sourceRef.source.ref());const i=this._sourceCachePromises.find(a=>a.cacheGroup===n&&KC(a.request,e));if(i)return i.promise.then(a=>a.sourceRef.source.ref());const s=(async()=>{const a=await this._getSourceUncached(e);if(_c(this._sourceCache,d=>d.cacheGroup===n&&d.sourceRef.source._refCount===1)>=4){const d=$m(this._sourceCache,h=>h.cacheGroup===n&&h.sourceRef.source._refCount===1?h.age:1/0);b(d!==-1);const f=this._sourceCache[d];this._sourceCache.splice(d,1),f.sourceRef.free(),dI(this._sourceRefs,f.sourceRef)}this._sourceRefs.push(a);const u=this._sourceCachePromises.findIndex(d=>d.request===e);return b(u!==-1),this._sourceCachePromises.splice(u,1),{request:e,sourceRef:a,age:this._nextSourceCacheAge++,cacheGroup:n}})();return this._sourceCachePromises.push({request:e,cacheGroup:n,promise:s}),s.then(a=>{const o=a.sourceRef.source.ref();return this._sourceCache.push(a),o})}_getDemuxer(){return this._demuxerPromise??(this._demuxerPromise=(async()=>{var e;this._reader=new Zd(this._rootSource),this._emit("source",{source:this._rootSource,request:null,isRoot:!0});
796for(const n of this._formats)if(await n._canReadInput(this))return this._format=n,(e=this._onFormatDetermined)==null||e.call(this,n),n._createDemuxer(this);throw new uA})())}get source(){return this._rootSource}async getFormat(){return await this._getDemuxer(),b(this._format),this._format}async canRead(){try{return await this._getDemuxer(),!0}catch(e){if(e instanceof uA)return!1;throw e}}async getFirstTimestamp(e){e??(e=await this.getTracks());const n=e.filter(i=>i!==null);if(n.length===0)return 0;const r=await Promise.all(n.map(i=>i.getFirstTimestamp()));return Math.min(...r)}async computeDuration(e,n){e??(e=await this.getTracks());const r=e.filter(s=>s!==null);if(r.length===0)return 0;const i=await Promise.all(r.map(s=>s.computeDuration(n)));return Math.max(...i)}async getDurationFromMetadata(e,n){e??(e=await this.getTracks());const r=e.filter(a=>a!==null),s=(await Promise.all(r.map(a=>a.getDurationFromMetadata(n)))).filter(a=>a!==null);return s.length===0?null:Math.max(...s)}async getTracks(e){e&&(e=qc(e));const r=(await this._getTrackBackings()).map(i=>this._wrapBackingAsTrack(i));return cA(r,e)}async getVideoTracks(e){e&&(e=qc(e));const r=(await this.getTracks()).filter(i=>i.isVideoTrack());return cA(r,e)}async getAudioTracks(e){e&&(e=qc(e));const r=(await this.getTracks()).filter(i=>i.isAudioTrack());return cA(r,e)}async getPrimaryVideoTrack(e){e&&(e=qc(e));const n=Ns(e,{sortBy:async i=>[co((await i.getDisposition()).default),co(await i.hasPairableAudioTrack()),co(!await i.hasOnlyKeyPackets()),oA(await i.getBitrate())]});return(await this.getVideoTracks(n))[0]??null}async getPrimaryAudioTrack(e){e&&(e=qc(e));const n=await this.getPrimaryVideoTrack(),r=Ns(e,{sortBy:async s=>[co(!n||s.canBePairedWith(n)),co((await s.getDisposition()).default),oA(await s.getBitrate())]});return(await this.getAudioTracks(r))[0]??null}async _getTrackBackings(){const e=await this._getDemuxer();return this._trackBackingsCache??(this._trackBackingsCache=await e.getTrackBackings())}_wrapBackingAsTrack(e){const n=this._backingToTrack.get(e);if(n)return n;const i=e.getType()==="video"?new Vc(this,e):new Gc(this,e);return this._backingToTrack.set(e,i),i}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){var e;if(!this._disposed){this._disposed=!0;for(const n of this._sourceRefs)n.free();this._sourceRefs.length=0,(e=this._demuxerPromise)==null||e.then(n=>n.dispose())}}[Symbol.dispose](){this.dispose()}}class uA extends Error{constructor(e="Input has an unsupported or unrecognizable format."){super(e),this.name="UnsupportedInputFormatError"}}class bn extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}/*!
797 * Copyright (c) 2026-present, Vanilagy and contributors
798 *
799 * This Source Code Form is subject to the terms of the Mozilla Public
800 * License, v. 2.0. If a copy of the MPL was not distributed with this
801 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
802 */class Zd{constructor(e){this.source=e}get fileSize(){const e=this.source._getFileSize();if(e===void 0)throw new Error("Reading file size too early; read required first.");return e}get fileSizeNonStrict(){return this.source._getFileSize()??null}requestSlice(e,n){if(this.source._disposed)throw new bn;if(e<0||this.fileSizeNonStrict!==null&&e+n>this.fileSizeNonStrict)return null;if(n===0){const s=new Uint8Array(0);return new an(s,_e(s),0,e,e)}const r=e+n,i=this.source._read(e,r,qC,YC);return i instanceof Promise?i.then(s=>s?new an(s.bytes,s.view,s.offset,e,r):null):i?new an(i.bytes,i.view,i.offset,e,r):null}requestSliceRange(e,n,r){if(this.source._disposed)throw new bn;if(e<0)return null;if(this.fileSizeNonStrict!==null)return this.requestSlice(e,Yt(this.fileSizeNonStrict-e,n,r));{const i=this.requestSlice(e,r),s=a=>a||(b(this.fileSizeNonStrict!==null),this.requestSlice(e,Yt(this.fileSizeNonStrict-e,n,r)));return i instanceof Promise?i.then(s):s(i)}}requestEntireFile(){if(this.fileSizeNonStrict!==null)return this.requestSlice(0,this.fileSizeNonStrict);const e=1024;return(async()=>{const n=[];let r=0;for(;;){if(n.length===1&&this.fileSizeNonStrict!==null)return this.requestSlice(0,this.fileSizeNonStrict);const a=n.length*e;let o=this.requestSliceRange(a,0,e);
802if(o instanceof Promise&&(o=await o),!o)break;n.push(de(o,o.length)),r+=o.length}const i=new Uint8Array(r);let s=0;for(const a of n)i.set(a,s),s+=a.length;return new an(i,_e(i),0,0,r)})()}}class an{constructor(e,n,r,i,s){this.bytes=e,this.view=n,this.offset=r,this.start=i,this.end=s,this.bufferPos=i-r}static tempFromBytes(e){return new an(e,_e(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,n=this.end-e){if(e<this.start||e+n>this.end)throw new RangeError("Slicing outside of original slice.");return new an(this.bytes,this.view,this.offset,e,e+n)}}const En=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},de=(t,e)=>{En(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},ce=t=>(En(t,1),t.view.getUint8(t.bufferPos++)),Kc=(t,e)=>{En(t,2);const n=t.view.getUint16(t.bufferPos,e);return t.bufferPos+=2,n},Mt=t=>{En(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},si=t=>{En(t,3);const e=hd(t.view,t.bufferPos,!1);return t.bufferPos+=3,e},lA=t=>{En(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},qi=(t,e)=>{En(t,4);const n=t.view.getUint32(t.bufferPos,e);return t.bufferPos+=4,n},J=t=>{En(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},uo=t=>{En(t,4);const e=t.view.getUint32(t.bufferPos,!0);return t.bufferPos+=4,e},Us=t=>{En(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},nG=t=>{En(t,4);const e=t.view.getInt32(t.bufferPos,!0);return t.bufferPos+=4,e},Gx=(t,e)=>{let n,r;return e?(n=qi(t,!0),r=qi(t,!0)):(r=qi(t,!1),n=qi(t,!1)),r*4294967296+n},qn=t=>{const e=J(t),n=J(t);return e*4294967296+n},rG=t=>{const e=Us(t),n=J(t);return e*4294967296+n},iG=t=>{const e=uo(t);return nG(t)*4294967296+e},sG=t=>{En(t,4);const e=t.view.getFloat32(t.bufferPos,!1);return t.bufferPos+=4,e},qx=t=>{En(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},_t=(t,e)=>{En(t,e);let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n},Yx=(t,e,n)=>xn.decode(de(t,e)).split(`
803`).map(s=>s.trim()).filter(s=>{var a;return s.length>0&&!((a=n==null?void 0:n.ignore)!=null&&a.call(n,s))});/*!
804 * Copyright (c) 2026-present, Vanilagy and contributors
805 *
806 * This Source Code Form is subject to the terms of the Mozilla Public
807 * License, v. 2.0. If a copy of the MPL was not distributed with this
808 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
809 */var lo;(function(t){t[t.Unsynchronisation=128]="Unsynchronisation",t[t.ExtendedHeader=64]="ExtendedHeader",t[t.ExperimentalIndicator=32]="ExperimentalIndicator",t[t.Footer=16]="Footer"})(lo||(lo={}));var jt;(function(t){t[t.ISO_8859_1=0]="ISO_8859_1",t[t.UTF_16_WITH_BOM=1]="UTF_16_WITH_BOM",t[t.UTF_16_BE_NO_BOM=2]="UTF_16_BE_NO_BOM",t[t.UTF_8=3]="UTF_8"})(jt||(jt={}));const ef=128,ai=10,fo=["Blues","Classic rock","Country","Dance","Disco","Funk","Grunge","Hip-hop","Jazz","Metal","New age","Oldies","Other","Pop","Rhythm and blues","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death metal","Pranks","Soundtrack","Euro-techno","Ambient","Trip-hop","Vocal","Jazz & funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound clip","Gospel","Noise","Alternative rock","Bass","Soul","Punk","Space","Meditative","Instrumental pop","Instrumental rock","Ethnic","Gothic","Darkwave","Techno-industrial","Electronic","Po
809p-folk","Eurodance","Dream","Southern rock","Comedy","Cult","Gangsta","Top 40","Christian rap","Pop/funk","Jungle music","Native US","Cabaret","New wave","Psychedelic","Rave","Showtunes","Trailer","Lo-fi","Tribal","Acid punk","Acid jazz","Polka","Retro","Musical","Rock 'n' roll","Hard rock","Folk","Folk rock","National folk","Swing","Fast fusion","Bebop","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic rock","Progressive rock","Psychedelic rock","Symphonic rock","Slow rock","Big band","Chorus","Easy listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber music","Sonata","Symphony","Booty bass","Primus","Porn groove","Satire","Slow jam","Club","Tango","Samba","Folklore","Ballad","Power ballad","Rhythmic Soul","Freestyle","Duet","Punk rock","Drum solo","A cappella","Euro-house","Dance hall","Goa music","Drum & bass","Club-house","Hardcore techno","Terror","Indie","Britpop","Negerpunk","Polsk punk","Beat","Christian gangsta rap","Heavy metal","Black metal","Crossover","Contemporary Christian","Christian rock","Merengue","Salsa","Thrash metal","Anime","Jpop","Synthpop","Christmas","Art rock","Baroque","Bhangra","Big beat","Breakbeat","Chillout","Downtempo","Dub","EBM","Eclectic","Electro","Electroclash","Emo","Experimental","Garage","Global","IDM","Illbient","Industro-Goth","Jam Band","Krautrock","Leftfield","Lounge","Math rock","New romantic","Nu-breakz","Post-punk","Post-rock","Psytrance","Shoegaze","Space rock","Trop rock","World music","Neoclassical","Audiobook","Audio theatre","Neue Deutsche Welle","Podcast","Indie rock","G-Funk","Dubstep","Garage rock","Psybient"],aG=(t,e)=>{var d;const n=t.filePos;e.raw??(e.raw={}),(d=e.raw).TAG??(d.TAG=de(t,ef-3)),t.filePos=n;const r=ho(t,30);r&&(e.title??(e.title=r));const i=ho(t,30);i&&(e.artist??(e.artist=i));const s=ho(t,30);s&&(e.album??(e.album=s));const a=ho(t,4),o=Number.parseInt(a,10);Number.isInteger(o)&&o>0&&(e.date??(e.date=new Date(String(o))));const c=de(t,30);let u;if(c[28]===0&&c[29]!==0){const f=c[29];f>0&&(e.trackNumber??(e.trackNumber=f)),t.skip(-30),u=ho(t,28),t.skip(2)}else t.skip(-30),u=ho(t,30);u&&(e.comment??(e.comment=u));const l=ce(t);l<fo.length&&(e.genre??(e.genre=fo[l]))},ho=(t,e)=>{const n=de(t,e),r=za(n.indexOf(0),n.length),i=n.subarray(0,r);let s="";for(let a=0;a<i.length;a++)s+=String.fromCharCode(i[a]);return s.trimEnd()},Ls=t=>{const e=t.filePos,n=_t(t,3),r=ce(t),i=ce(t),s=ce(t),a=J(t);if(n!=="ID3"||r===255||i===255||(a&2155905152)!==0)return t.filePos=e,null;const o=ag(a);return{majorVersion:r,revision:i,flags:s,size:o}},dA=(t,e,n)=>{var s,a,o,c,u;if(![2,3,4].includes(e.majorVersion)){console.warn(`Unsupported ID3v2 major version: ${e.majorVersion}`);return}const r=de(t,e.size),i=new oG(e,r);if(e.flags&lo.Footer&&i.removeFooter(),e.flags&lo.Unsynchronisation&&e.majorVersion===3&&i.ununsynchronizeAll(),e.flags&lo.ExtendedHeader){const l=i.readU32();e.majorVersion===3?i.pos+=l:i.pos+=l-4}for(;i.pos<=i.bytes.length-i.frameHeaderSize();){const l=i.readId3V2Frame();if(!l)break;const d=i.pos,f=i.pos+l.size;let h=!1,m=!1,p=!1;if(e.majorVersion===3?(h=!!(l.flags&64),m=!!(l.flags&128)):e.majorVersion===4&&(h=!!(l.flags&4),m=!!(l.flags&8),p=!!(l.flags&2)||!!(e.flags&lo.Unsynchronisation)),h){console.warn(`Skipping encrypted ID3v2 frame ${l.id}`),i.pos=f;continue}if(m){console.warn(`Skipping compressed ID3v2 frame ${l.id}`),i.pos=f;continue}if(p&&i.ununsynchronizeRegion(i.pos,f),n.raw??(n.raw={}),l.id==="TXXX"){const g=(s=n.raw).TXXX??(s.TXXX={}),A=i.readId3V2TextEncoding(),y=i.readId3V2Text(A,f),w=i.readId3V2Text(A,f);g[y]??(g[y]=w)}else l.id[0]==="T"?(a=n.raw)[o=l.id]??(a[o]=i.readId3V2EncodingAndText(f)):(c=n.raw)[u=l.id]??(c[u]=i.readBytes(l.size));switch(i.pos=d,l.id){case"TIT2":case"TT2":n.title??(n.title=i.readId3V2EncodingAndText(f));break;case"TIT3":case"TT3":n.description??(n.description=i.readId3V2EncodingAndText(f));break;case"TPE1":case"TP1":n.artist??(n.artist=i.readId3V2EncodingAndText(f));break;case"TALB":case"TAL":n.album??(n.album=i.readId3V2EncodingAndText(f));break;case"TPE2":case"TP2":n.albumArtist??(n.albumArtist=i.readId3V2EncodingAndText(f));break;case"TRCK":case"TRK":{const A=i.readId3V2EncodingAndText(f).split("/"),y=Number.parseInt(A[0],10),w=A[1]&&Number.parseInt(A[1],10);Number.isInteger(y)&&y>0&&(n.trackNumber??(n.trackNumber=y)),w&&Number.isInteger(w)&&w>0&&(n.tracksTotal??(n.tracksTotal=w))}break;case"TPOS":case"TPA":{const A=i.readId3V2EncodingAndText(f).split("/"),y=Number.parseInt(A[0],10),w=A[1]&&Number.parseInt(A[1],10);Number.isInteger(y)&&y>0&&(n.discNumber??(n.discNumber=y)),w&&Number.isInteger(w)&&w>0&&(n.discsTotal??(n.discsTotal=w))}break;case"TCON":case"TCO":{const g=i.readId3V2EncodingAndText(f);let A=/^\((\d+)\)/.exec(g);if(A){const y=Number.parseInt(A[1]);if(fo[y]!==void 0){n.genre??(n.genre=fo[y]);break}}if(A=/^\d+$/.exec(g),A){const y=Number.parseInt(A[0]);if(fo[y]!==void 0){n.genre??(n.genre=fo[y]);break}}n.genre??(n.genre=g)}break;case"TDRC":case"TDAT":{const g=i.readId3V2EncodingAndText(f),A=new Date(g);Number.isNaN(A.getTime())||(n.date??(n.date=A))}break;case"TYER":case"TYE":{const g=i.readId3V2EncodingAndText(f),A=Number.parseInt(g,10);Number.isInteger(A)&&(n.date??(n.date=new Date(String(A))))}break;case"USLT":case"ULT":{const g=i.readU8();i.pos+=3,i.readId3V2Text(g,f),n.lyrics??(n.lyrics=i.readId3V2Text(g,f))}break;case"COMM":case"COM":{const g=i.readU8();i.pos+=3,i.readId3V2Text(g,f),n.comment??(n.comment=i.readId3V2Text(g,f))}break;case"APIC":case"PIC":{const g=i.readId3V2TextEncoding();let A;if(e.majorVersion===2){const S=i.readAscii(3);A=S==="PNG"?"image/png":S==="JPG"?"image/jpeg":"image/*"}else A=i.readId3V2Text(g,f);const y=i.readU8(),w=i.readId3V2Text(g,f).trimEnd(),E=f-i.pos;if(E>=0){const S=i.readBytes(E);n.images||(n.images=[]),n.images.push({data:S,mimeType:A,kind:y===3?"coverFront":y===4?"coverBack":"unknown",de
809scription:w})}}break;default:i.pos+=l.size;break}i.pos=f}};class oG{constructor(e,n){this.header=e,this.bytes=n,this.pos=0,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength)}frameHeaderSize(){return this.header.majorVersion===2?6:10}ununsynchronizeAll(){const e=[];for(let n=0;n<this.bytes.length;n++){const r=this.bytes[n];e.push(r),r===255&&n!==this.bytes.length-1&&this.bytes[n]===0&&n++}this.bytes=new Uint8Array(e),this.view=new DataView(this.bytes.buffer)}ununsynchronizeRegion(e,n){const r=[];for(let a=e;a<n;a++){const o=this.bytes[a];r.push(o),o===255&&a!==n-1&&this.bytes[a+1]===0&&a++}const i=this.bytes.subarray(0,e),s=this.bytes.subarray(n);this.bytes=new Uint8Array(i.length+r.length+s.length),this.bytes.set(i,0),this.bytes.set(r,i.length),this.bytes.set(s,i.length+r.length),this.view=new DataView(this.bytes.buffer)}removeFooter(){this.bytes=this.bytes.subarray(0,this.bytes.length-ai),this.view=new DataView(this.bytes.buffer)}readBytes(e){const n=this.bytes.subarray(this.pos,this.pos+e);return this.pos+=e,n}readU8(){const e=this.view.getUint8(this.pos);return this.pos+=1,e}readU16(){const e=this.view.getUint16(this.pos,!1);return this.pos+=2,e}readU24(){const e=this.view.getUint16(this.pos,!1),n=this.view.getUint8(this.pos+2);return this.pos+=3,e*256+n}readU32(){const e=this.view.getUint32(this.pos,!1);return this.pos+=4,e}readAscii(e){let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(this.view.getUint8(this.pos+r));return this.pos+=e,n}readId3V2Frame(){if(this.header.majorVersion===2){const e=this.readAscii(3);if(e==="\0\0\0")return null;const n=this.readU24();return{id:e,size:n,flags:0}}else{const e=this.readAscii(4);if(e==="\0\0\0\0")return null;const n=this.readU32();let r=this.header.majorVersion===4?ag(n):n;const i=this.readU16(),s=this.pos,a=o=>{const c=this.pos+o;if(c>this.bytes.length)return!1;if(c<=this.bytes.length-this.frameHeaderSize()){this.pos+=o;const u=this.readAscii(4);if(u!=="\0\0\0\0"&&!/[0-9A-Z]{4}/.test(u))return!1}return!0};if(!a(r)){const o=this.header.majorVersion===4?n:ag(n);a(o)&&(r=o)}return this.pos=s,{id:e,size:r,flags:i}}}readId3V2TextEncoding(){const e=this.readU8();if(e>3)throw new Error(`Unsupported text encoding: ${e}`);return e}readId3V2Text(e,n){const r=this.pos,i=this.readBytes(n-this.pos);switch(e){case jt.ISO_8859_1:{let s="";for(let a=0;a<i.length;a++){const o=i[a];if(o===0){this.pos=r+a+1;break}s+=String.fromCharCode(o)}return s}case jt.UTF_16_WITH_BOM:if(i[0]===255&&i[1]===254){const s=new TextDecoder("utf-16le"),a=za(i.findIndex((o,c)=>o===0&&i[c+1]===0&&c%2===0),i.length);return this.pos=r+Math.min(a+2,i.length),s.decode(i.subarray(2,a))}else if(i[0]===254&&i[1]===255){const s=new TextDecoder("utf-16be"),a=za(i.findIndex((o,c)=>o===0&&i[c+1]===0&&c%2===0),i.length);return this.pos=r+Math.min(a+2,i.length),s.decode(i.subarray(2,a))}else{const s=za(i.findIndex(a=>a===0),i.length);return this.pos=r+Math.min(s+1,i.length),xn.decode(i.subarray(0,s))}case jt.UTF_16_BE_NO_BOM:{const s=new TextDecoder("utf-16be"),a=za(i.findIndex((o,c)=>o===0&&i[c+1]===0&&c%2===0),i.length);return this.pos=r+Math.min(a+2,i.length),s.decode(i.subarray(0,a))}case jt.UTF_8:{const s=za(i.findIndex(a=>a===0),i.length);return this.pos=r+Math.min(s+1,i.length),xn.decode(i.subarray(0,s))}}}readId3V2EncodingAndText(e){if(this.pos>=e)return"";const n=this.readId3V2TextEncoding();return this.readId3V2Text(n,e)}}class fA{constructor(e){this.helper=new Uint8Array(8),this.helperView=_e(this.helper),this.writer=e}writeId3V2Tag(e){const n=this.writer.getPos();this.writeAscii("ID3"),this.writeU8(4),this.writeU8(0),this.writeU8(0),this.writeSynchsafeU32(0);const r=this.writer.getPos(),i=new Set;for(const{key:o,value:c}of Qa(e))switch(o){case"title":this.writeId3V2TextFrame("TIT2",c),i.add("TIT2");break;case"description":this.writeId3V2TextFrame("TIT3",c),i.add("TIT3");break;case"artist":this.writeId3V2TextFrame("TPE1",c),i.add("TPE1");break;case"album":this.writeId3V2TextFrame("TALB",c),i.add("TALB");break;case"albumArtist":this.writeId3V2TextFrame("TPE2",c),i.add("TPE2");break;case"trackNumber":{const u=e.tracksTotal!==void 0?`${c}/${e.tracksTotal}`:c.toString();this.writeId3V2TextFrame("TRCK",u),i.add("TRCK")}break;case"discNumber":{const u=e.discsTotal!==void 0?`${c}/${e.discsTotal}`:c.toString();this.writeId3V2TextFrame("TPOS",u),i.add("TPOS")}break;case"genre":this.writeId3V2TextFrame("TCON",c),i.add("TCON");break;case"date":this.writeId3V2TextFrame("TDRC",c.toISOString().slice(0,10)),i.add("TDRC");break;case"lyrics":this.writeId3V2LyricsFrame(c),i.add("USLT");break;case"comment":this.writeId3V2CommentFrame(c),i.add("COMM");break;case"images":{const u={coverFront:3,coverBack:4,unknown:0};for(const l of c){const d=u[l.kind]??0,f=l.description??"";this.writeId3V2ApicFrame(l.mimeType,d,f,l.data)}}break;case"tracksTotal":case"discsTotal":break;case"raw":break;default:rn(o)}if(e.raw)for(const o in e.raw){const c=e.raw[o];if(c==null||o.length!==4||i.has(o))continue;let u;if(typeof c=="string")if(Yr(c)){u=new Uint8Array(c.length+2),u[0]=jt.ISO_8859_1;for(let d=0;d<c.length;d++)u[d+1]=c.charCodeAt(d)}else{const d=tt.encode(c);u=new Uint8Array(d.byteLength+2),u[0]=jt.UTF_8,u.set(d,1)}else if(c instanceof Uint8Array)u=c;else if(o==="TXXX"&&bI(c)){for(const l in c){const d=c[l],f=Yr(l)&&Yr(d),h=f?null:tt.encode(l),m=f?null:tt.encode(d),p=f?l.length:h.byteLength,g=f?d.length:m.byteLength,A=1+p+1+g+1;this.writeAscii("TXXX"),this.writeSynchsafeU32(A),this.writeU16(0),this.writeU8(f?jt.ISO_8859_1:jt.UTF_8),f?(this.writeIsoString(l),this.writeIsoString(d)):(this.writer.write(h),this.writeU8(0),this.writer.write(m),this.writeU8(0))}continue}else continue;this.writeAscii(o),this.writeSynchsafeU32(u.byteLength),this.writeU16(0),this.writer.write(u)}const s=this.writer.getPos(),a=s-r;return this.writer.seek(n+6),this.writeSynchsafeU32(a),this.writer.seek(s),a+10}writeU8(e){this.helper[0]=e,this.writer.write(this.helper.subarray(0,1))}writeU16(e){this.helperView.setUint16(0,e,!1),this.writer.write(this.helper.subarray(0,2))}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeAscii(e){for(let n=0;n<e.length;n++)this.helper[n]=e.charCodeAt(n);this.writer.write(this.helper.subarray(0,e.length))}writeSynchsafeU32(e){this.writeU32(aV(e))}writeIsoString(e){const n=new Uint8Array(e.length+1);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);this.writer.write(n)}writeUtf8String(e){const n=tt.encode(e);this.writer.write(n),this.writeU8(0)}writeId3V2TextFrame(e,n){const r=Yr(n),s=1+(r?n.length:tt.encode(n).byteLength)+1;this.writeAscii(e),this.writeSynchsafeU32(s),this.writeU16(0),this.writeU8(r?jt.ISO_8859_1:jt.UTF_8),r?this.writeIsoString(n):this.writeUtf8String(n)}writeId3V2LyricsFrame(e){const n=Yr(e),r="",i=4+r.length+1+e.length+1;this.writeAscii("USLT"),this.writeSynchsafeU32(i),this.writeU16(0),this.writeU8(n?jt.ISO_8859_1:jt.UTF_8),this.writeAscii("und"),n?(this.writeIsoString(r),this.writeIsoString(e)):(this.writeUtf8String(r),this.writeUtf8String(e))}writeId3V2CommentFrame(e){const n=Yr(e),r=n?e.length:tt.encode(e).byteLength,i="",s=4+i.length+1+r+1;this.writeAscii("COMM"),this.writeSynchsafeU32(s),this.writeU16(0),this.writeU8(n?jt.ISO_8859_1:jt.UTF_8),this.writeU8(117),this.writeU8(110),this.writeU8(100),n?(this.writeIsoString(i),this.writeIsoString(e)):(this.writeUtf8String(i),this.writeUtf8String(e))}writeId3V2ApicFrame(e,n,r,i){const s=Yr(e)&&Yr(r),a=s?r.length:tt.encode(r).byteLength,o=1+e.length+1+1+a+1+i.byteLength;this.writeAscii("APIC"),this.writeSynchsafeU32(o),this.writeU16(0),this.writeU8(s?jt.ISO_8859_1:jt.UTF_8),s?this.writeIsoString(e):this.writeUtf8String(e),this.writeU8(n),s?this.writeIsoString(r):this.writeUtf8String(r),this.writer.write(i)}}/*!
810 * Copyright (c) 2026-present, Vanilagy and contributors
811 *
812 * This Source Code Form is subject to the terms of the Mozilla Public
813 * License, v. 2.0. If a copy of the MPL was not distributed with this
814 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
815 */class oi{constructor(e){this.mutex=new ks,this.trackTimestampInfo=new WeakMap,this.output=e}onTrackClose(e){}validateTimestamp(e,n,r){if(n<0)throw new Error(`Timestamps must be non-negative (got ${n}s).`);let i=this.trackTimestampInfo.get(e);if(i){if(r&&(i.maxTimestampBeforeLastKeyPacket=i.maxTimestamp),i.maxTimestampBeforeLastKeyPacket!==null&&n<i.maxTimestampBeforeLastKeyPacket)throw new Error(`Timestamps cannot be smaller than the largest timestamp of the previous GOP (a GOP begins with a key packet and ends right before the next key packet). Got ${n}s, but largest timestamp is ${i.maxTimestampBeforeLastKeyPacket}s.`);i.maxTimestamp=Math.max(i.maxTimestamp,n)}else{if(!r)throw new Error("First packet must be a key packet.");i={maxTimestamp:n,maxTimestampBeforeLastKeyPacket:null},this.trackTimestampInfo.set(e,i)}}}/*!
816 * Copyright (c) 2026-present, Vanilagy and contributors
817 *
818 * This Source Code Form is subject to the terms of the Mozilla Public
819 * License, v. 2.0. If a copy of the MPL was not distributed with this
820 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
821 */class cG extends oi{constructor(e,n){super(e),this.header=null,this.headerBitstream=null,this.inputIsAdts=null,this.format=n}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(!0),Cc(this.output._metadataTags)||new fA(this.writer).writeId3V2Tag(this.output._metadataTags),e()}async getMimeType(){return"audio/aac"}async addEncodedVideoPacket(){throw new Error("ADTS does not support video.")}async addEncodedAudioPacket(e,n,r){var s;const i=await this.mutex.acquire();
821try{if(this.validateTimestamp(e,n.timestamp,n.type==="key"),this.inputIsAdts===null){Li(r);const a=(s=r==null?void 0:r.decoderConfig)==null?void 0:s.description;if(this.inputIsAdts=!a,!this.inputIsAdts){const o=xc(dt(a)),c=EI(o);this.header=c.header,this.headerBitstream=c.bitstream}}if(this.inputIsAdts){const a=this.writer.getPos();this.writer.write(n.data),this.format._options.onFrame&&this.format._options.onFrame(n.data,a)}else{b(this.header);const a=n.data.byteLength+this.header.byteLength;SI(this.headerBitstream,a);const o=this.writer.getPos();if(this.writer.write(this.header),this.writer.write(n.data),this.format._options.onFrame){const c=new Uint8Array(a);c.set(this.header,0),c.set(n.data,this.header.byteLength),this.format._options.onFrame(c,o)}}await this.writer.flush()}finally{i()}}async addSubtitleCue(){throw new Error("ADTS does not support subtitles.")}async finalize(){(await this.mutex.acquire())()}}/*!
822 * Copyright (c) 2026-present, Vanilagy and contributors
823 *
824 * This Source Code Form is subject to the terms of the Mozilla Public
825 * License, v. 2.0. If a copy of the MPL was not distributed with this
826 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
827 */const Kx=new Uint8Array([102,76,97,67]),uG=38,lG=34;class dG extends oi{constructor(e,n){super(e),this.metadataWritten=!1,this.blockSizes=[],this.frameSizes=[],this.sampleRate=null,this.channels=null,this.bitsPerSample=null,this.format=n}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(!!this.format._options.appendOnly),this.writer.write(Kx),e()}writeHeader({bitsPerSample:e,minimumBlockSize:n,maximumBlockSize:r,minimumFrameSize:i,maximumFrameSize:s,sampleRate:a,channels:o,totalSamples:c}){b(this.writer.getPos()===4);const u=!Cc(this.output._metadataTags),l=new Me(new Uint8Array(4));l.writeBits(1,+!u),l.writeBits(7,$r.STREAMINFO),l.writeBits(24,lG),this.writer.write(l.bytes);const d=new Me(new Uint8Array(18));if(d.writeBits(16,n),d.writeBits(16,r),d.writeBits(24,i),d.writeBits(24,s),d.writeBits(20,a),d.writeBits(3,o-1),d.writeBits(5,e-1),c>=2**32)throw new Error("This muxer only supports writing up to 2 ** 32 samples");d.writeBits(4,0),d.writeBits(32,c),this.writer.write(d.bytes),this.writer.write(new Uint8Array(16))}writePictureBlock(e){var o,c,u;const n=32+e.mimeType.length+(((o=e.description)==null?void 0:o.length)??0)+e.data.length,r=new Uint8Array(n);let i=0;const s=_e(r);s.setUint32(i,e.kind==="coverFront"?3:e.kind==="coverBack"?4:0),i+=4,s.setUint32(i,e.mimeType.length),i+=4,r.set(tt.encode(e.mimeType),8),i+=e.mimeType.length,s.setUint32(i,((c=e.description)==null?void 0:c.length)??0),i+=4,r.set(tt.encode(e.description??""),i),i+=((u=e.description)==null?void 0:u.length)??0,i+=16,s.setUint32(i,e.data.length),i+=4,r.set(e.data,i),i+=e.data.length,b(i===n);const a=new Me(new Uint8Array(4));a.writeBits(1,0),a.writeBits(7,$r.PICTURE),a.writeBits(24,n),this.writer.write(a.bytes),this.writer.write(r)}writeVorbisCommentAndPictureBlock(){if(this.format._options.appendOnly||this.writer.seek(uG+Kx.byteLength),Cc(this.output._metadataTags)){this.metadataWritten=!0;return}const e=this.output._metadataTags.images??[];for(const i of e)this.writePictureBlock(i);const n=pg(new Uint8Array(0),this.output._metadataTags,!1),r=new Me(new Uint8Array(4));r.writeBits(1,1),r.writeBits(7,$r.VORBIS_COMMENT),r.writeBits(24,n.length),this.writer.write(r.bytes),this.writer.write(n),this.metadataWritten=!0}async getMimeType(){return"audio/flac"}async addEncodedVideoPacket(){throw new Error("FLAC does not support video.")}async addEncodedAudioPacket(e,n,r){const i=await this.mutex.acquire();try{if(this.validateTimestamp(e,n.timestamp,n.type==="key"),this.sampleRate===null){Li(r),b(r),b(r.decoderConfig),b(r.decoderConfig.description),this.sampleRate=r.decoderConfig.sampleRate,this.channels=r.decoderConfig.numberOfChannels;const d=new Me(dt(r.decoderConfig.description));d.skipBits(167);const f=d.readBits(5)+1;this.bitsPerSample=f,this.format._options.appendOnly&&this.writeHeader({minimumBlockSize:16,maximumBlockSize:65535,minimumFrameSize:0,maximumFrameSize:0,sampleRate:this.sampleRate,channels:this.channels,bitsPerSample:this.bitsPerSample,totalSamples:0})}this.metadataWritten||this.writeVorbisCommentAndPictureBlock();const s=an.tempFromBytes(n.data);s.skip(2);const a=de(s,2),o=new Me(a),c=kC(o.readBits(4));if(c===null)throw new Error("Invalid FLAC frame: Invalid block size.");IC(s);const u=CC(s,c);this.format._options.appendOnly||(this.blockSizes.push(u),this.frameSizes.push(n.data.length));const l=this.writer.getPos();this.writer.write(n.data),this.format._options.onFrame&&this.format._options.onFrame(n.data,l),await this.writer.flush()}finally{i()}}addSubtitleCue(){throw new Error("FLAC does not support subtitles.")}async finalize(){const e=await this.mutex.acquire();if(!this.format._options.appendOnly){let n=1/0,r=0,i=1/0,s=0,a=0;for(let o=0;o<this.blockSizes.length;o++)i=Math.min(i,this.frameSizes[o]),s=Math.max(s,this.frameSizes[o]),r=Math.max(r,this.blockSizes[o]),a+=this.blockSizes[o],o!==this.blockSizes.length-1&&(n=Math.min(n,this.blockSizes[o]));b(this.sampleRate!==null),b(this.channels!==null),b(this.bitsPerSample!==null),this.writer.seek(4),this.writeHeader({minimumBlockSize:n,maximumBlockSize:r,minimumFrameSize:i,maximumFrameSize:s,sampleRate:this.sampleRate,channels:this.channels,bitsPerSample:this.bitsPerSample,totalSamples:a})}e()}}/*!
828 * Copyright (c) 2026-present, Vanilagy and contributors
829 *
830 * This Source Code Form is subject to the terms of the Mozilla Public
831 * License, v. 2.0. If a copy of the MPL was not distributed with this
832 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
833 */const jc=/(?:(.+?)\n)?((?:\d{2}:)?\d{2}:\d{2}.\d{3})\s+-->\s+((?:\d{2}:)?\d{2}:\d{2}.\d{3})/g,fG=/^WEBVTT(.|\n)*?\n{2}/,tf=/<(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})>/g;class hG{constructor(e){this.preambleText=null,this.preambleEmitted=!1,this.options=e}parse(e){e=e.replaceAll(`\r
834`,`
835`).replaceAll("\r",`
836`),jc.lastIndex=0;let n;if(!this.preambleText){if(!fG.test(e))throw new Error("WebVTT preamble incorrect.");n=jc.exec(e);const r=e.slice(0,(n==null?void 0:n.index)??e.length).trimEnd();if(!r)throw new Error("No WebVTT preamble provided.");this.preambleText=r,n&&(e=e.slice(n.index),jc.lastIndex=0)}for(;n=jc.exec(e);){const r=e.slice(0,n.index),i=n[1],s=n.index+n[0].length,a=e.indexOf(`
837`,s)+1,o=e.slice(s,a).trim();let c=e.indexOf(`
838
839`,s);c===-1&&(c=e.length);const u=hA(n[2]),d=hA(n[3])-u,f=e.slice(a,c).trim();e=e.slice(c).trimStart(),jc.lastIndex=0;const h={timestamp:u/1e3,duration:d/1e3,text:f,identifier:i,settings:o,notes:r},m={};this.preambleEmitted||(m.config={description:this.preambleText},this.preambleEmitted=!0),this.options.output(h,m)}}}const pG=/(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})/,hA=t=>{const e=pG.exec(t);if(!e)throw new Error("Expected match.");return 3600*1e3*Number(e[1]||"0")+60*1e3*Number(e[2])+1e3*Number(e[3])+Number(e[4])},jx=t=>{const e=Math.floor(t/36e5),n=Math.floor(t%(3600*1e3)/(60*1e3)),r=Math.floor(t%(60*1e3)/1e3),i=t%1e3;return e.toString().padStart(2,"0")+":"+n.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+"."+i.toString().padStart(3,"0")};/*!
840 * Copyright (c) 2026-present, Vanilagy and contributors
841 *
842 * This Source Code Form is subject to the terms of the Mozilla Public
843 * License, v. 2.0. If a copy of the MPL was not distributed with this
844 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
845 */class nf{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeU64(e){this.helperView.setUint32(0,Math.floor(e/2**32),!1),this.helperView.setUint32(4,e,!1),this.writer.write(this.helper.subarray(0,8))}writeAscii(e){for(let n=0;n<e.length;n++)this.helperView.setUint8(n%8,e.charCodeAt(n)),n%8===7&&this.writer.write(this.helper);e.length%8!==0&&this.writer.write(this.helper.subarray(0,e.length%8))}writeBox(e){if(this.offsets.set(e,this.writer.getPos()),e.contents&&!e.children)this.writeBoxHeader(e,e.size??e.contents.byteLength+8),this.writer.write(e.contents);else{const n=this.writer.getPos();if(this.writeBoxHeader(e,0),e.contents&&this.writer.write(e.contents),e.children)for(const s of e.children)s&&this.writeBox(s);const r=this.writer.getPos(),i=e.size??r-n;this.writer.seek(n),this.writeBoxHeader(e,i),this.writer.seek(r)}}writeBoxHeader(e,n){this.writeU32(e.largeSize?1:n),this.writeAscii(e.type),e.largeSize&&this.writeU64(n)}measureBoxHeader(e){return 8+(e.largeSize?8:0)}patchBox(e){const n=this.offsets.get(e);b(n!==void 0);const r=this.writer.getPos();this.writer.seek(n),this.writeBox(e),this.writer.seek(r)}measureBox(e){if(e.contents&&!e.children)return this.measureBoxHeader(e)+e.contents.byteLength;{let n=this.measureBoxHeader(e);if(e.contents&&(n+=e.contents.byteLength),e.children)for(const r of e.children)r&&(n+=this.measureBox(r));return n}}}const Re=new Uint8Array(8),Yn=new DataView(Re.buffer),vt=t=>[(t%256+256)%256],me=t=>(Yn.setUint16(0,t,!1),[Re[0],Re[1]]),pA=t=>(Yn.setInt16(0,t,!1),[Re[0],Re[1]]),$x=t=>
845(Yn.setUint32(0,t,!1),[Re[1],Re[2],Re[3]]),j=t=>(Yn.setUint32(0,t,!1),[Re[0],Re[1],Re[2],Re[3]]),ci=t=>(Yn.setInt32(0,t,!1),[Re[0],Re[1],Re[2],Re[3]]),Sr=t=>(Yn.setUint32(0,Math.floor(t/2**32),!1),Yn.setUint32(4,t,!1),[Re[0],Re[1],Re[2],Re[3],Re[4],Re[5],Re[6],Re[7]]),mG=t=>(Yn.setInt32(0,Math.floor(t/2**32),!1),Yn.setUint32(4,t,!1),[Re[0],Re[1],Re[2],Re[3],Re[4],Re[5],Re[6],Re[7]]),Xx=t=>(Yn.setInt16(0,2**8*t,!1),[Re[0],Re[1]]),cr=t=>(Yn.setInt32(0,2**16*t,!1),[Re[0],Re[1],Re[2],Re[3]]),mA=t=>(Yn.setInt32(0,2**30*t,!1),[Re[0],Re[1],Re[2],Re[3]]),gA=(t,e)=>{const n=[];let r=t;do{let i=r&127;r>>=7,n.length>0&&(i|=128),n.push(i)}while(r>0||e);return n.reverse()},rt=(t,e=!1)=>{const n=Array(t.length).fill(null).map((r,i)=>t.charCodeAt(i));return e&&n.push(0),n},Jx=t=>{const e=t*(Math.PI/180),n=Math.round(Math.cos(e)),r=Math.round(Math.sin(e));return[n,r,0,-r,n,0,0,0,1]},Zx=Jx(0),ev=t=>[cr(t[0]),cr(t[1]),mA(t[2]),cr(t[3]),cr(t[4]),mA(t[5]),cr(t[6]),cr(t[7]),mA(t[8])],pe=(t,e,n)=>({type:t,contents:e&&new Uint8Array(e.flat(10)),children:n}),Ye=(t,e,n,r,i)=>pe(t,[vt(e),$x(n),r??[]],i),gG=t=>t.isQuickTime?pe("ftyp",[rt("qt  "),j(512),rt("qt  ")]):t.fragmented?t.cmaf?pe("ftyp",[rt("iso5"),j(512),rt("iso5"),rt("iso6"),rt("mp41"),rt("cmfc"),rt("dash")]):pe("ftyp",[rt("iso5"),j(512),rt("iso5"),rt("iso6"),rt("mp41")]):pe("ftyp",[rt("isom"),j(512),rt("isom"),t.holdsAvc?rt("avc1"):[],rt("mp41")]),tv=()=>pe("styp",[rt("iso5"),j(0),rt("iso5"),rt("iso6"),rt("mp41"),rt("cmfc"),rt("dash")]),nv=(t,e)=>{let n=t.maxWrittenEndTimestamp-t.minWrittenTimestamp;return Number.isFinite(n)||(n=0),Ye("sidx",1,0,[j(1),j(lr),Sr(Et(t.minWrittenTimestamp,lr)),Sr(0),me(0),me(1),j(e&2147483647),j(Et(n,lr)),j(0)])},rf=t=>({type:"mdat",largeSize:t}),AG=t=>({type:"free",size:t}),$c=t=>pe("moov",void 0,[yG(t.creationTime,t.trackDatas),...t.trackDatas.map(e=>wG(e,t.creationTime)),t.isFragmented?tq(t.trackDatas):null,pq(t)]),yG=(t,e)=>{const n=Math.max(0,...e.map(a=>Et(sf(a),lr)+Et(a.startTimestampOffset??0,lr))),r=Math.max(0,...e.map(a=>a.track.id))+1,i=!Mi(t)||!Mi(n),s=i?Sr:j;return Ye("mvhd",+i,0,[s(t),s(t),j(lr),s(n),cr(1),Xx(1),Array(10).fill(0),ev(Zx),Array(24).fill(0),j(r)])},sf=t=>{if(t.samples.length===0)return 0;let e=1/0,n=-1/0;for(let r=0;r<t.samples.length;r++){const i=t.samples[r];i.timestamp<e&&(e=i.timestamp),i.timestamp+i.duration>n&&(n=i.timestamp+i.duration)}return e===1/0?0:n-e},wG=(t,e)=>{const n=xq(t),r=t.startTimestampOffset!==null&&t.startTimestampOffset>0;return pe("trak",void 0,[bG(t,e),r?EG(t,t.startTimestampOffset):null,SG(t,e),n.name!==void 0?pe("udta",void 0,[pe("name",[...tt.encode(n.name)])]):null])},bG=(t,e)=>{var o;const n=Et(sf(t),lr)+Et(t.startTimestampOffset??0,lr),r=!Mi(e)||!Mi(n),i=r?Sr:j;let s;if(t.type==="video"){const c=t.track.metadata.rotation;s=Jx(c??0)}else s=Zx;let a=2;return((o=t.track.metadata.disposition)==null?void 0:o.default)!==!1&&(a|=1),Ye("tkhd",+r,a,[i(e),i(e),j(t.track.id),j(0),i(n),Array(8).fill(0),me(0),me(t.track.id),Xx(t.type==="audio"?1:0),me(0),ev(s),cr(t.type==="video"?t.info.width:0),cr(t.type==="video"?t.info.height:0)])},EG=(t,e)=>{const n=Et(e,lr),r=Et(sf(t),lr),i=!Mi(n)||!Mi(r),s=i?Sr:j,a=i?mG:ci;return pe("edts",void 0,[Ye("elst",i?1:0,0,[j(2),s(n),a(-1),cr(1),s(r),a(0),cr(1)])])},SG=(t,e)=>pe("mdia",void 0,[_G(t,e),AA(!0,TG[t.type],kG[t.type]),IG(t)]),_G=(t,e)=>{const n=Et(sf(t),t.timescale),r=!Mi(e)||!Mi(n),i=r?Sr:j;return Ye("mdhd",+r,0,[i(e),i(e),j(t.timescale),i(n),me(uv(t.track.metadata.languageCode??Kt)),me(0)])},TG={video:"vide",audio:"soun",subtitle:"text"},kG={video:"MediabunnyVideoHandler",audio:"MediabunnySoundHandler",subtitle:"MediabunnyTextHandler"},AA=(t,e,n,r="\0\0\0\0")=>Ye("hdlr",0,0,[t?rt("mhlr"):j(0),rt(e),rt(r),j(0),j(0),rt(n,!0)]),IG=t=>pe("minf",void 0,[CG[t.type](),xG(),PG(t)]),CG={video:()=>Ye("vmhd",0,1,[me(0),me(0),me(0),me(0)]),audio:()=>Ye("smhd",0,0,[me(0),me(0)]),subtitle:()=>Ye("nmhd",0,0)},xG=()=>pe("dinf",void 0,[vG()]),vG=()=>Ye("dref",0,0,[j(1)],[BG()]),BG=()=>Ye("url ",0,1),PG=t=>{const e=t.compositionTimeOffsetTable.length>1||t.compositionTimeOffsetTable.some(n=>n.sampleCompositionTimeOffset!==0);return pe("stbl",void 0,[RG(t),KG(t),e?ZG(t):null,e?eq(t):null,$G(t),XG(t),JG(t),jG(t)])},RG=t=>{let e;if(t.type==="video")e=FG(yq(t.track.source._codec,t.info.decoderConfig.codec),t);else if(t.type==="audio"){const n=cv(t.track.source._codec,t.muxer.isQuickTime);b(n),e=LG(n,t)}else t.type==="subtitle"&&(e=qG(Eq[t.track.source._codec],t));return b(e),Ye("stsd",0,0,[j(1)],[e])},FG=(t,e)=>pe(t,[Array(6).fill(0),me(1),me(0),me(0),Array(12).fill(0),me(e.info.width),me(e.info.height),j(4718592),j(4718592),j(0),me(1),Array(32).fill(0),me(24),pA(65535)],[wq[e.track.source._codec](e),MG(e),cI(e.info.decoderConfig.colorSpace)?DG(e):null]),MG=t=>t.info.pixelAspectRatio.num===t.info.pixelAspectRatio.den?null:pe("pasp",[j(t.info.pixelAspectRatio.num),j(t.info.pixelAspectRatio.den)]),DG=t=>pe("colr",[rt("nclx"),me(Ss[t.info.decoderConfig.colorSpace.primaries]),me(_s[t.info.decoderConfig.colorSpace.transfer]),me(Ts[t.info.decoderConfig.colorSpace.matrix]),vt((t.info.decoderConfig.colorSpace.fullRange?1:0)<<7)]),OG=t=>t.info.decoderConfig&&pe("avcC",[...dt(t.info.decoderConfig.description)]),NG=t=>t.info.decoderConfig&&pe("hvcC",[...dt(t.info.decoderConfig.description)]),rv=t=>{var f,h,m,p;if(!t.info.decoderConfig)return null;const e=t.info.decoderConfig,n=e.codec.split("."),r=Number(n[1]),i=Number(n[2]),s=Number(n[3]),a=n[4]?Number(n[4]):1,o=n[8]?Number(n[8]):Number(((f=e.colorSpace)==null?void 0:f.fullRange)??0),c=(s<<4)+(a<<1)+o,u=n[5]?Number(n[5]):(h=e.colorSpace)!=null&&h.primaries?Ss[e.colorSpace.primaries]:2,l=n[6]?Number(n[6]):(m=e.colorSpace)!=null&&m.transfer?_s[e.colorSpace.transfer]:2,d=n[7]?Number(n[7]):(p=e.colorSpace)!=null&&p.matrix?Ts[e.colorSpace.matrix]:2;return Ye("vpcC",1,0,[vt(r),vt(i),vt(c),vt(u),vt(l),vt(d),me(0)])},UG=t=>pe("av1C",xI(t.info.decoderConfig.codec)),LG=(t,e)=>{var a;let n=0,r,i=16;const s=Nt.includes(e.track.source._codec);if(s){const o=e.track.source._codec,{sampleSize:c}=sr(o);i=8*c,i>16&&(n=1)}if(e.muxer.isQuickTime&&(n=1),n===0)r=[Array(6).fill(0),me(1),me(n),me(0),j(0),me(e.info.numberOfChannels),me(i),me(0),me(0),me(e.info.sampleRate<2**16?e.info.sampleRate:0),me(0)];else{const o=s?0:-2;r=[Array(6).fill(0),me(1),me(n),me(0),j(0),me(e.info.numberOfChannels),me(Math.min(i,16)),pA(o),me(0),me(e.info.sampleRate<2**16?e.info.sampleRate:0),me(0),s?[j(1),j(i/8),j(e.info.numberOfChannels*i/8)]:[j(0),j(0),j(0)],j(2)]}return pe(t,r,[((a=bq(e.track.source._codec,e.muxer.isQuickTime))==null?void 0:a(e))??null])},yA=t=>{let e;switch(t.track.source._codec){case"aac":e=64;break;case"mp3":e=107;break;case"vorbis":e=221;break;default:throw new Error(`Unhandled audio codec: ${t.track.source._codec}`)}let n=[...vt(e),...vt(21),...$x(0),...j(0),...j(0)];if(t.info.decoderConfig.description){const r=dt(t.info.decoderConfig.description);n=[...n,...vt(5),...gA(r.byteLength),...r]}return n=[...me(1),...vt(0),...vt(4),...gA(n.length),...n,...vt(6),...vt(1),...vt(2)],n=[...vt(3),...gA(n.length),...n],Ye("esds",0,0,n)},Yi=t=>pe("wave",void 0,[zG(t),QG(t),pe("\0\0\0\0")]),zG=t=>pe("frma",[rt(cv(t.track.source._codec,t.muxer.isQuickTime))]),QG=t=>{const{littleEndian:e}=sr(t.track.source._codec);return pe("enda",[me(+e)])},HG=t=>{var c;let e=t.info.numberOfChannels,n=3840,r=t.info.sampleRate,i=0,s=0,a=new Uint8Array(0);const o=(c=t.info.decoderConfig)==null?void 0:c.description;if(o){b(o.byteLength>=18);const u=dt(o),l=xd(u);e=l.outputChannelCount,n=l.preSkip,r=l.inputSampleRate,i=l.outputGain,s=l.channelMappingFamily,l.channelMappingTable&&(a=l.channelMappingTable)}return pe("dOps",[vt(0),vt(e),me(n),j(r),pA(i),vt(s),...a])},WG=t=>{var r;const e=(r=t.info.decoderConfig)==null?void 0:r.description;b(e);const n=dt(e);return Ye("dfLa",0,0,[...n.subarray(4)])},_r=t=>{const{littleEndian:e,sampleSize:n}=sr(t.track.source._codec),r=+e;return Ye("pcmC",0,0,[vt(r),vt(8*n)])},VG=t=>{const e=WI(t.info.firstPacket.data);if(!e)throw new Error("Couldn't extract AC-3 frame info from the audio packet. Ensure the packets contain valid AC-3 sync frames (as specified in ETSI TS 102 366).");const n=new Uint8Array(3),r=new Me(n);return r.writeBits(2,e.fscod),r.writeBits(5,e.bsid),r.writeBits(3,e.b
vendor: 17,966 bytes, lines 845-857
845smod),r.writeBits(3,e.acmod),r.writeBits(1,e.lfeon),r.writeBits(5,e.bitRateCode),r.writeBits(5,0),pe("dac3",[...n])},GG=t=>{const e=GI(t.info.firstPacket.data);if(!e)throw new Error("Couldn't extract E-AC-3 frame info from the audio packet. Ensure the packets contain valid E-AC-3 sync frames (as specified in ETSI TS 102 366).");let n=16;for(const a of e.substreams)n+=23,a.numDepSub>0?n+=9:n+=1;const r=Math.ceil(n/8),i=new Uint8Array(r),s=new Me(i);s.writeBits(13,e.dataRate),s.writeBits(3,e.substreams.length-1);for(const a of e.substreams)s.writeBits(2,a.fscod),s.writeBits(5,a.bsid),s.writeBits(1,0),s.writeBits(1,0),s.writeBits(3,a.bsmod),s.writeBits(3,a.acmod),s.writeBits(1,a.lfeon),s.writeBits(3,0),s.writeBits(4,a.numDepSub),a.numDepSub>0?s.writeBits(9,a.chanLoc):s.writeBits(1,0);return pe("dec3",[...i])},qG=(t,e)=>pe(t,[Array(6).fill(0),me(1)],[Sq[e.track.source._codec](e)]),YG=t=>pe("vttC",[...tt.encode(t.info.config.description)]),KG=t=>Ye("stts",0,0,[j(t.timeToSampleTable.length),t.timeToSampleTable.map(e=>[j(e.sampleCount),j(e.sampleDelta)])]),jG=t=>{if(t.samples.every(n=>n.type==="key"))return null;const e=[...t.samples.entries()].filter(([,n])=>n.type==="key");return Ye("stss",0,0,[j(e.length),e.map(([n])=>j(n+1))])},$G=t=>Ye("stsc",0,0,[j(t.compactlyCodedChunkTable.length),t.compactlyCodedChunkTable.map(e=>[j(e.firstChunk),j(e.samplesPerChunk),j(1)])]),XG=t=>{if(t.type==="audio"&&t.info.requiresPcmTransformation){const{sampleSize:e}=sr(t.track.source._codec);return Ye("stsz",0,0,[j(e*t.info.numberOfChannels),j(t.samples.reduce((n,r)=>n+Et(r.duration,t.timescale),0))])}return Ye("stsz",0,0,[j(0),j(t.samples.length),t.samples.map(e=>j(e.size))])},JG=t=>t.finalizedChunks.length>0&&yt(t.finalizedChunks).offset>=2**32?Ye("co64",0,0,[j(t.finalizedChunks.length),t.finalizedChunks.map(e=>Sr(e.offset))]):Ye("stco",0,0,[j(t.finalizedChunks.length),t.finalizedChunks.map(e=>j(e.offset))]),ZG=t=>Ye("ctts",1,0,[j(t.compositionTimeOffsetTable.length),t.compositionTimeOffsetTable.map(e=>[j(e.sampleCount),ci(e.sampleCompositionTimeOffset)])]),eq=t=>{let e=1/0,n=-1/0,r=1/0,i=-1/0;b(t.compositionTimeOffsetTable.length>0),b(t.samples.length>0);for(let a=0;a<t.compositionTimeOffsetTable.length;a++){const o=t.compositionTimeOffsetTable[a];e=Math.min(e,o.sampleCompositionTimeOffset),n=Math.max(n,o.sampleCompositionTimeOffset)}for(let a=0;a<t.samples.length;a++){const o=t.samples[a];r=Math.min(r,Et(o.timestamp,t.timescale)),i=Math.max(i,Et(o.timestamp+o.duration,t.timescale))}const s=Math.max(-e,0);return i>=2**31?null:Ye("cslg",0,0,[ci(s),ci(e),ci(n),ci(r),ci(i)])},tq=t=>pe("mvex",void 0,t.map(nq)),nq=t=>Ye("trex",0,0,[j(t.track.id),j(1),j(0),j(0),j(0)]),iv=(t,e)=>pe("moof",void 0,[rq(t),...e.map(iq)]),rq=t=>Ye("mfhd",0,0,[j(t)]),sv=t=>{let e=0,n=0;const r=0,i=0,s=t.type==="delta";return n|=+s,s?e|=1:e|=2,e<<24|n<<16|r<<8|i},iq=t=>pe("traf",void 0,[sq(t),aq(t),oq(t)]),sq=t=>{b(t.currentChunk);let e=0;e|=8,e|=16,e|=32,e|=131072;const n=t.currentChunk.samples[1]??t.currentChunk.samples[0],r={duration:n.timescaleUnitsToNextSample,size:n.size,flags:sv(n)};return Ye("tfhd",0,e,[j(t.track.id),j(r.duration),j(r.size),j(r.flags)])},aq=t=>(b(t.currentChunk),Ye("tfdt",1,0,[Sr(Et(t.currentChunk.startTimestamp,t.timescale))])),oq=t=>{b(t.currentChunk);const e=t.currentChunk.samples.map(p=>p.timescaleUnitsToNextSample),n=t.currentChunk.samples.map(p=>p.size),r=t.currentChunk.samples.map(sv),i=t.currentChunk.samples.map(p=>Et(p.timestamp-p.decodeTimestamp,t.timescale)),s=new Set(e),a=new Set(n),o=new Set(r),c=new Set(i),u=o.size===2&&r[0]!==r[1],l=s.size>1,d=a.size>1,f=!u&&o.size>1,h=c.size>1||[...c].some(p=>p!==0);let m=0;return m|=1,m|=4*+u,m|=256*+l,m|=512*+d,m|=1024*+f,m|=2048*+h,Ye("trun",1,m,[j(t.currentChunk.samples.length),j(t.currentChunk.offset-t.currentChunk.moofOffset||0),u?j(r[0]):[],t.currentChunk.samples.map((p,g)=>[l?j(e[g]):[],d?j(n[g]):[],f?j(r[g]):[],h?ci(i[g]):[]])])},cq=t=>pe("mfra",void 0,[...t.map(uq),lq()]),uq=(t,e)=>Ye("tfra",1,0,[j(t.track.id),j(63),j(t.finalizedChunks.length),t.finalizedChunks.map(r=>[Sr(Et(r.samples[0].timestamp,t.timescale)),Sr(r.moofOffset),j(e+1),j(1),j(1)])]),lq=()=>Ye("mfro",0,0,[j(0)]),dq=()=>pe("vtte"),fq=(t,e,n,r,i)=>pe("vttc",void 0,[i!==null?pe("vsid",[ci(i)]):null,n!==null?pe("iden",[...tt.encode(n)]):null,e!==null?pe("ctim",[...tt.encode(jx(e))]):null,r!==null?pe("sttg",[...tt.encode(r)]):null,pe("payl",[...tt.encode(t)])]),hq=t=>pe("vtta",[...tt.encode(t)]),pq=t=>{const e=[],n=t.format._options.metadataFormat??"auto",r=t.output._metadataTags;if(n==="mdir"||n==="auto"&&!t.isQuickTime){const i=gq(r);i&&e.push(i)}else if(n==="mdta"){const i=Aq(r);i&&e.push(i)}else(n==="udta"||n==="auto"&&t.isQuickTime)&&mq(e,t.output._metadataTags);return e.length===0?null:pe("udta",void 0,e)},mq=(t,e)=>{for(const{key:n,value:r}of Qa(e))switch(n){case"title":t.push(Tr("©nam",r));break;case"description":t.push(Tr("©des",r));break;case"artist":t.push(Tr("©ART",r));break;case"album":t.push(Tr("©alb",r));break;case"albumArtist":t.push(Tr("albr",r));break;case"genre":t.push(Tr("©gen",r));break;case"date":t.push(Tr("©day",r.toISOString().slice(0,10)));break;case"comment":t.push(Tr("©cmt",r));break;case"lyrics":t.push(Tr("©lyr",r));break;case"raw":break;case"discNumber":case"discsTotal":case"trackNumber":case"tracksTotal":case"images":break;default:rn(n)}if(e.raw)for(const n in e.raw){const r=e.raw[n];r==null||n.length!==4||t.some(i=>i.type===n)||(typeof r=="string"?t.push(Tr(n,r)):r instanceof Uint8Array&&t.push(pe(n,Array.from(r))))}},Tr=(t,e)=>{const n=tt.encode(e);return pe(t,[me(n.length),me(uv("und")),Array.from(n)])},av={"image/jpeg":13,"image/png":14,"image/bmp":27},ov=(t,e)=>{const n=[];for(const{key:r,value:i}of Qa(t))switch(r){case"title":n.push({key:e?"title":"©nam",value:ur(i)});break;case"description":n.push({key:e?"description":"©des",value:ur(i)});break;case"artist":n.push({key:e?"artist":"©ART",value:ur(i)});break;case"album":n.push({key:e?"album":"©alb",value:ur(i)});break;case"albumArtist":n.push({key:e?"album_artist":"aART",value:ur(i)});break;case"comment":n.push({key:e?"comment":"©cmt",value:ur(i)});break;case"genre":n.push({key:e?"genre":"©gen",value:ur(i)});break;case"lyrics":n.push({key:e?"lyrics":"©lyr",value:ur(i)});break;case"date":n.push({key:e?"date":"©day",value:ur(i.toISOString().slice(0,10))});break;case"images":for(const s of i)s.kind==="coverFront"&&n.push({key:"covr",value:pe("data",[j(av[s.mimeType]??0),j(0),Array.from(s.data)])});break;case"trackNumber":if(e){const s=t.tracksTotal!==void 0?`${i}/${t.tracksTotal}`:i.toString();n.push({key:"track",value:ur(s)})}else n.push({key:"trkn",value:pe("data",[j(0),j(0),me(0),me(i),me(t.tracksTotal??0),me(0)])});break;case"discNumber":e||n.push({key:"disc",value:pe("data",[j(0),j(0),me(0),me(i),me(t.discsTotal??0),me(0)])});break;case"tracksTotal":case"discsTotal":break;case"raw":break;default:rn(r)}if(t.raw)for(const r in t.raw){const i=t.raw[r];i==null||!e&&r.length!==4||n.some(s=>s.key===r)||(typeof i=="string"?n.push({key:r,value:ur(i)}):i instanceof Uint8Array?n.push({key:r,value:pe("data",[j(0),j(0),Array.from(i)])}):i instanceof Is&&n.push({key:r,value:pe("data",[j(av[i.mimeType]??0),j(0),Array.from(i.data)])}))}return n},gq=t=>{const e=ov(t,!1);return e.length===0?null:Ye("meta",0,0,void 0,[AA(!1,"mdir","","appl"),pe("ilst",void 0,e.map(n=>pe(n.key,void 0,[n.value])))])},Aq=t=>{const e=ov(t,!0);return e.length===0?null:pe("meta",void 0,[AA(!1,"mdta",""),Ye("keys",0,0,[j(e.length)],e.map(n=>pe("mdta",[...tt.encode(n.key)]))),pe("ilst",void 0,e.map((n,r)=>{const i=String.fromCharCode(...j(r+1));return pe(i,void 0,[n.value])}))])},ur=t=>pe("data",[j(1),j(0),...tt.encode(t)]),yq=(t,e)=>{switch(t){case"avc":return e.startsWith("avc3")?"avc3":"avc1";case"hevc":return"hvc1";case"vp8":return"vp08";case"vp9":return"vp09";case"av1":return"av01"}},wq={avc:OG,hevc:NG,vp8:rv,vp9:rv,av1:UG},cv=(t,e)=>{switch(t){case"aac":return"mp4a";case"mp3":return"mp4a";case"opus":return"Opus";case"vorbis":return"mp4a";case"flac":return"fLaC";case"ulaw":return"ulaw";case"alaw":return"alaw";case"pcm-u8":return"raw ";case"pcm-s8":return"sowt";case"ac3":return"ac-3";case"eac3":return"ec-3"}if(e)switch(t){case"pcm-s16":return"sowt";case"pcm-s16be":return"twos";case"pcm-s24":return"in24";case"pcm-s24be":return"in24";case"pcm-s32":return"in32";case"pcm-s32be":return"in32";case"pcm-f32":return"fl32";case"pcm-f32be":return"fl32";case"pcm-f64":return"fl64";case"pcm-f64be":return"fl64"}else switch(t){case"pcm-s16":return"ipcm";case"pcm-s16be":return"ipcm";case"pcm-s24":return"ipcm";case"pcm-s24be":return"ipcm";case"pcm-s32":return"ipcm";case"pcm-s32be":return"ipcm";case"pcm-f32":return"fpcm";case"pcm-f32be":return"fpcm";case"pcm-f64":return"fpcm";case"pcm-f64be":return"fpcm"}},bq=(t,e)=>{switch(t){case"aac":return yA;case"mp3":return yA;case"opus":return HG;case"vorbis":return yA;case"flac":return WG;case"ac3":return VG;case"eac3":return GG}if(e)switch(t){case"pcm-s24":return Yi;case"pcm-s24be":return Yi;case"pcm-s32":return Yi;case"pcm-s32be":return Yi;case"pcm-f32":return Yi;case"pcm-f32be":return Yi;case"pcm-f64":return Yi;case"pcm-f64be":return Yi}else switch(t){case"pcm-s16":return _r;case"pcm-s16be":return _r;case"pcm-s24":return _r;case"pcm-s24be":return _r;case"pcm-s32":return _r;case"pcm-s32be":return _r;case"pcm-f32":return _r;case"pcm-f32be":return _r;case"pcm-f64":return _r;case"pcm-f64be":return _r}return null},Eq={webvtt:"wvtt"},Sq={webvtt:YG},uv=t=>{b(t.length===3);let e=0;for(let n=0;n<3;n++)e<<=5,e+=t.charCodeAt(n)-96;return e};/*!
846 * Copyright (c) 2026-present, Vanilagy and contributors
847 *
848 * This Source Code Form is subject to the terms of the Mozilla Public
849 * License, v. 2.0. If a copy of the MPL was not distributed with this
850 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
851 */class Xc{constructor(e,n){if(this.finalized=!1,this.started=!1,this.pos=0,this.trackedWrites=null,this.trackedStart=-1,this.trackedEnd=-1,e._writerAcquired)throw new Error("Can't have multiple Writers for the same Target.");this.target=e,e._setMonotonicity(n),e._writerAcquired=!0}start(){b(!this.started),this.target._start(),this.started=!0}write(e){b(this.started&&!this.finalized),this.maybeTrackWrites(e),this.target._write(e,this.pos),this.pos+=e.byteLength}seek(e){this.pos=e}getPos(){return this.pos}async flush(){return b(this.started&&!this.finalized),this.target._flush()}async finalize(){b(this.started&&!this.finalized),await this.target._finalize(),this.finalized=!0}maybeTrackWrites(e){if(!this.trackedWrites)return;let n=this.getPos();if(n<this.trackedStart){if(n+e.byteLength<=this.trackedStart)return;e=e.subarray(this.trackedStart-n),n=0}const r=n+e.byteLength-this.trackedStart;let i=this.trackedWrites.byteLength;for(;i<r;)i*=2;if(i!==this.trackedWrites.byteLength){const s=new Uint8Array(i);s.set(this.trackedWrites,0),this.trackedWrites=s}this.trackedWrites.set(e,n-this.trackedStart),this.trackedEnd=Math.max(this.trackedEnd,n+e.byteLength)}startTrackingWrites(){this.trackedWrites=new Uint8Array(2**10),this.trackedStart=this.getPos(),this.trackedEnd=this.trackedStart}stopTrackingWrites(){if(!this.trackedWrites)throw new Error("Internal error: Can't get tracked writes since nothing was tracked.");const n={data:this.trackedWrites.subarray(0,this.trackedEnd-this.trackedStart),start:this.trackedStart,end:this.trackedEnd};return this.trackedWrites=null,n}}/*!
852 * Copyright (c) 2026-present, Vanilagy and contributors
853 *
854 * This Source Code Form is subject to the terms of the Mozilla Public
855 * License, v. 2.0. If a copy of the MPL was not distributed with this
856 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
857 */const lv=typeof Od<"u"?Od:void 0;class Sn extends Ic{constructor(){super(...arguments),this._writerAcquired=!1,this._monotonicity=null,this.onwrite=null}_setMonotonicity(e){this._monotonicity!==!1&&(this._monotonicity=e)}_dispatchWrite(e,n){var r;(r=this.onwrite)==null||r.call(this,e,n),this._emit("write",{start:e,end:n})}slice(e){if(!Number.isInteger(e)||e<0)throw new TypeError("offset must be a non-negative integer.");return new dv(this,e)}}const wA=2**16,bA=2**32;class af extends Sn{constructor(e={}){if(super(),this.buffer=null,this._maxPos=0,!e||typeof e!="object")throw new TypeError("BufferTarget options, when provided, must be an object.");if(e.onFinalize!==void 0&&typeof e.onFinalize!="function")throw new TypeError("options.onFinalize, when provided, must be a function.");if(this._options=e,this._supportsResize="resize"in new ArrayBuffer(0),this._supportsResize)try{this._buffer=new ArrayBuffer(wA,{maxByteLength:bA})}catch{this._buffer=new ArrayBuffer(wA),this._supportsResize=!1}else this._buffer=new ArrayBuffer(wA);this._bytes=new Uint8Array(this._buffer)}_ensureSize(e){let n=this._buffer.byteLength;for(;n<e;)n*=2;if(n!==this._buffer.byteLength){if(n>bA)throw new Error(`ArrayBuffer exceeded maximum size of ${bA} bytes. Please consider using another target.`);if(this._supportsResize)this._buffer.resize(n);else{const r=new ArrayBuffer(n),i=new Uint8Array(r);i.set(this._bytes,0),this._buffer=r,this._bytes=i}}}_start(){}_write(e,n){this._ensureSize(n+e.byteLength),this._bytes.set(e,n),this._maxPos=Math.max(this._maxPos,n+e.byteLength),this._dispatchWrite(n,n+e.byteLength)}async _flush(){}async _finalize(){this.buffer=this._buffer.slice(0,this._maxPos),this._options.onFinalize&&await this._options.onFinalize(this.buffer),this._emit("finalized")}async _close(){}_getSlice(e,n){return this._bytes.slice(e,n)}}const _q=2**24,Tq=2;class EA extends Sn{constructor(e,n={}){if(super(),this._sections=[],this._lastWriteEnd=0,this._lastFlushEnd=0,this._streamWriter=null,this._writeError=null,this._chunks=[],!(e instanceof WritableStream))throw new TypeError("StreamTarget requires a WritableStream instance.");if(n!=null&&typeof n!="object")throw new TypeError("StreamTarget options, when provided, must be an object.");if(n.chunked!==void 0&&typeof n.chunked!="boolean")throw new TypeError("options.chunked, when provided, must be a boolean.");if(n.chunkSize!==void 0&&(!Number.isInteger(n.chunkSize)||n.chunkSize<1024))throw new TypeError("options.chunkSize, when provided, must be an integer and not smaller than 1024.");this._writable=e,this._options=n,this._chunked=n.chunked??!1,this._chunkSize=n.chunkSize??_q}_start(){this._streamWriter=this._writable.getWriter()}_write(e,n){if(n>this._lastWriteEnd){const r=n-this._lastWriteEnd;this._write(new Uint8Array(r),this._lastWriteEnd)}this._sections.push({data:e.slice(),start:n}),this._lastWriteEnd=Math.max(this._lastWriteEnd,n+e.byteLength),this._dispatchWrite(n,n+e.byteLength)}async _flush(){if(this._writeError!==null)throw this._writeError;if(b(this._streamWriter),this._sections.length===0)return;const e=[],n=[...this._sections].sort((r,i)=>r.start-i.start);e.push({start:n[0].start,size:n[0].data.byteLength});for(let r=1;r<n.length;r++){const i=e[e.length-1],s=n[r];s.start<=i.start+i.size?i.size=Math.max(i.size,s.start+s.data.byteLength-i.start):e.push({start:s.start,size:s.data.byteLength})}for(const r of e){r.data=new Uint8Array(r.size);for(const i of this._sections)r.start<=i.start&&i.start<r.start+r.size&&r.data.set(i.data,i.start-r.start);if(this._streamWriter.desiredSize!==null&&this._streamWriter.desiredSize<=0&&await this._streamWriter.ready,this._chunked)this._writeDataIntoChunks(r.data,r.start),this._tryToFlushChunks();else{if(this._monotonicity===!0&&r.start!==this._lastFlushEnd)throw new Error("Internal error: Monotonicity violation.");this._streamWriter.write({type:"write",data:r.data,position:r.start}).catch(i=>{this._writeError??(this._writeError=i)}),this._lastFlushEnd=r.start+r.data.byteLength}}this._sections.length=0}_writeDataIntoChunks(e,n){let r=this._chunks.findIndex(c=>c.start<=n&&n<c.start+this._chunkSize);r===-1&&(r=this._createChunk(n));const i=this._chunks[r],s=n-i.start,a=e.subarray(0,Math.min(this._chunkSize-s,e.byteLength));i.data.set(a,s);const o={start:s,end:s+a.byteLength};if(this._insertSectionIntoChunk(i,o),i.written[0].start===0&&i.written[0].end===this._chunkSize&&(i.shouldFlush=!0),this._chunks.length>Tq){for(let c=0;c<this._chunks.length-1;c++)this._chunks[c].shouldFlush=!0;this._tryToFlushChunks()}a.byteLength<e.byteLength&&this._writeDataIntoChunks(e.subarray(a.byteLength),n+a.byteLength)}_insertSectionIntoChunk(e,n){let r=0,i=e.written.length-1,s=-1;for(;r<=i;){const a=Math.floor(r+(i-r+1)/2);e.written[a].start<=n.start?(r=a+1,s=a):i=a-1}for(e.written.splice(s+1,0,n),(s===-1||e.written[s].end<n.start)&&s++;s<e.written.length-1&&e.written[s].end>=e.written[s+1].start;)e.written[s].end=Math.max(e.written[s].end,e.written[s+1].end),e.written.splice(s+1,1)}_createChunk(e){const r={start:Math.floor(e/this._chunkSize)*this._chunkSize,data:new Uint8Array(this._chunkSize),written:[],shouldFlush:!1};return this._chunks.push(r),this._chunks.sort((i,s)=>i.start-s.start),this._chunks.indexOf(r)}_tryToFlushChunks(e=!1){b(this._streamWriter);for(let n=0;n<this._chunks.length;n++){const r=this._chunks[n];if(!(!r.shouldFlush&&!e)){for(const i of r.written){const s=r.start+i.start;if(this._monotonicity===!0&&s!==this._lastFlushEnd)throw new Error("Internal error: Monotonicity violation.");this._streamWriter.write({type:"write",data:r.data.subarray(i.start,i.end),position:s}).catch(a=>{this._writeError??(this._writeError=a)}),this._lastFlushEnd=r.start+i.end}this._chunks.splice(n--,1)}}}async _finalize(){if(this._chunked&&this._tryToFlushChunks(!0),this._writeError!==null)throw this._writeError;b(this._streamWriter),await this._streamWriter.ready,await this._streamWriter.close(),this._emit("finalized")}async _close(){var e;return(e=this._streamWriter)==null?void 0:e.close()}}class kq extends Sn{constructor(e){super(),this._writer=null,this._nextWritePos=0,this._writable=e,this._streamTarget=new EA(new WritableStream({start:()=>{this._writer=this._writable.getWriter()},write:n=>
857{if(this._monotonicity!==!0)throw new Error("AppendOnlyStreamTarget requires that data be written monotonically (always appended to the end). You must use a format that guarantees this behavior.");return b(n.position===this._nextWritePos),this._nextWritePos+=n.data.byteLength,b(this._writer),this._writer.write(n.data)},close:()=>{var n;return(n=this._writer)==null?void 0:n.close()}}))}_start(){this._streamTarget._start()}_write(e,n){this._streamTarget._write(e,n)}_flush(){return this._streamTarget._flush()}_finalize(){return this._streamTarget._finalize()}_close(){return this._streamTarget._close()}_setMonotonicity(e){super._setMonotonicity(e),this._streamTarget._setMonotonicity(e)}}class Iq extends Sn{constructor(e,n={}){if(typeof e!="string")throw new TypeError("filePath must be a string.");if(!n||typeof n!="object")throw new TypeError("options must be an object.");if(!lv.fs)throw new Error("FilePathTarget is only available in server-side environments (Node.js, Bun, Deno).");super(),this._fileHandle=null;const r=new WritableStream({start:async()=>{this._fileHandle=await lv.fs.open(e,"w")},write:async i=>{b(this._fileHandle),await this._fileHandle.write(i.data,0,i.data.byteLength,i.position)},close:async()=>{this._fileHandle&&(await this._fileHandle.close(),this._fileHandle=null)}});this._streamTarget=new EA(r,{chunked:!0,...n})}_start(){this._streamTarget._start()}_write(e,n){this._streamTarget._write(e,n),this._dispatchWrite(n,n+e.byteLength)}async _flush(){return this._streamTarget._flush()}async _finalize(){await this._streamTarget._finalize(),this._emit("finalized")}async _close(){return this._streamTarget._close()}_setMonotonicity(e){super._setMonotonicity(e),this._streamTarget._setMonotonicity(e)}}class SA extends Sn{_start(){}_write(e,n){this._dispatchWrite(n,n+e.byteLength)}async _flush(){}async _finalize(){this._emit("finalized")}async _close(){}}class dv extends Sn{constructor(e,n){super(),this._baseTarget=e,this._offset=n}_start(){}_write(e,n){this._baseTarget._write(e,this._offset+n),this._dispatchWrite(n,n+e.byteLength)}_flush(){return this._baseTarget._flush()}async _finalize(){this._emit("finalized")}async _close(){}_setMonotonicity(e){super._setMonotonicity(e),this._baseTarget._setMonotonicity(e)}}class ui{constructor(e,n){if(this.rootPath=e,this.getTarget=n,typeof e!="string")throw new TypeError("rootPath must be a string.");if(typeof n!="function")throw new TypeError("getTarget must be a function.")}}/*!
858 * Copyright (c) 2026-present, Vanilagy and contributors
859 *
860 * This Source Code Form is subject to the terms of the Mozilla Public
861 * License, v. 2.0. If a copy of the MPL was not distributed with this
862 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
863 */const lr=57600,Cq=2082844800,xq=t=>{const e={},n=t.track;return n.metadata.name!==void 0&&(e.name=n.metadata.name),e},Et=(t,e,n=!0)=>{const r=t*e;return n?Math.round(r):r};class vq extends oi{constructor(e,n){super(e),this.writer=null,this.boxWriter=null,this.initWriter=null,this.initBoxWriter=null,this.auxTarget=new af,this.auxWriter=new Xc(this.auxTarget,!1),this.auxBoxWriter=new nf(this.auxWriter),this.mdat=null,this.ftypSize=null,this.trackDatas=[],this.allTracksKnown=wt(),this.creationTime=Math.floor(Date.now()/1e3)+Cq,this.finalizedChunks=[],this.nextFragmentNumber=1,this.maxWrittenTimestamp=-1/0,this.minWrittenTimestamp=1/0,this.maxWrittenEndTimestamp=-1/0,this.segmentHeaderSize=null,this.format=n,this.isQuickTime=n instanceof DA,this.isCmaf=n instanceof MA,this.minimumFragmentDuration=n._options.minimumFragmentDuration??(n instanceof MA?1/0:1)}async start(){var r;const e=await this.mutex.acquire();if(this.isCmaf?(this.fastStart="fragmented",this.isFragmented=!0):(this.writer=await this.output._getRootWriter(i=>this.format._options.fastStart!==void 0?this.format._options.fastStart==="fragmented":i instanceof af),this.boxWriter=new nf(this.writer),this.fastStart=this.format._options.fastStart??(this.writer.target instanceof af?"in-memory":!1),this.isFragmented=this.fastStart==="fragmented"),this.isCmaf){if(!this.output._hasInitTarget())throw new Error("CMAF outputs require the initTarget field in OutputOptions to be set; the init segment will be written to it.");const i=await this.output._getInitTarget(),s=new Xc(i,!0);
863s.start(),this.initWriter=s,this.initBoxWriter=new nf(s)}const n=this.output._tracks.some(i=>i.isVideoTrack()&&i.source._codec==="avc");{const i=this.initBoxWriter??this.boxWriter;if(b(i),this.format._options.onFtyp&&i.writer.startTrackingWrites(),i.writeBox(gG({isQuickTime:this.isQuickTime,holdsAvc:n,fragmented:this.isFragmented,cmaf:this.isCmaf})),this.format._options.onFtyp){const{data:s,start:a}=i.writer.stopTrackingWrites();this.format._options.onFtyp(s,a)}this.ftypSize=i.writer.getPos(),this.isCmaf&&await this.initWriter.flush()}if(this.fastStart!=="in-memory")if(this.fastStart==="reserve"){for(const i of this.output._tracks)if(i.metadata.maximumPacketCount===void 0)throw new Error("All tracks must specify maximumPacketCount in their metadata when using fastStart: 'reserve'.")}else this.isFragmented||(b(this.writer),b(this.boxWriter),this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=rf(!0),this.boxWriter.writeBox(this.mdat));await((r=this.writer)==null?void 0:r.flush()),e()}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(n=>n.track===e))return!1;return!0}async getMimeType(){await this.allTracksKnown.promise;const e=this.trackDatas.map(n=>n.type==="video"||n.type==="audio"?n.info.decoderConfig.codec:{webvtt:"wvtt"}[n.track.source._codec]);return KI({isQuickTime:this.isQuickTime,hasVideo:this.trackDatas.some(n=>n.type==="video"),hasAudio:this.trackDatas.some(n=>n.type==="audio"),codecStrings:e})}getVideoTrackData(e,n,r){const i=this.trackDatas.find(f=>f.track===e);if(i)return i;bd(r),b(r),b(r.decoderConfig);const s={...r.decoderConfig};b(s.codedWidth!==void 0),b(s.codedHeight!==void 0);let a=!1;if(e.source._codec==="avc"&&!s.description){const f=lg(n.data);if(!f)throw new Error("Couldn't extract an AVCDecoderConfigurationRecord from the AVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.264) when not providing a description, or provide a description (must be an AVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in AVCC format.");s.description=cV(f),a=!0}else if(e.source._codec==="hevc"&&!s.description){const f=fg(n.data);if(!f)throw new Error("Couldn't extract an HEVCDecoderConfigurationRecord from the HEVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.265) when not providing a description, or provide a description (must be an HEVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in HEVC format.");s.description=gV(f),a=!0}const o=OW(1/(e.metadata.frameRate??lr),1e6).den,c=s.displayAspectWidth,u=s.displayAspectHeight,l=c===void 0||u===void 0?{num:1,den:1}
863:Tc({num:c*s.codedHeight,den:u*s.codedWidth}),d={muxer:this,track:e,type:"video",info:{width:s.codedWidth,height:s.codedHeight,pixelAspectRatio:l,decoderConfig:s,requiresAnnexBTransformation:a},timescale:o,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,startTimestampOffset:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],closed:!1};return this.trackDatas.push(d),this.trackDatas.sort((f,h)=>f.track.id-h.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),d}getAudioTrackData(e,n,r){const i=this.trackDatas.find(c=>c.track===e);if(i)return i;Li(r),b(r),b(r.decoderConfig);const s={...r.decoderConfig};let a=!1;if(e.source._codec==="aac"&&!s.description){const c=ri(an.tempFromBytes(n.data));if(!c)throw new Error("Couldn't parse ADTS header from the AAC packet. Make sure the packets are in ADTS format (as specified in ISO 13818-7) when not providing a description, or provide a description (must be an AudioSpecificConfig as specified in ISO 14496-3) and ensure the packets are raw AAC data.");const u=Oi[c.samplingFrequencyIndex],l=Ga[c.channelConfiguration];if(u===void 0||l===void 0)throw new Error("Invalid ADTS frame header.");s.description=eg({objectType:c.objectType,sampleRate:u,numberOfChannels:l}),a=!0}const o={muxer:this,track:e,type:"audio",info:{numberOfChannels:r.decoderConfig.numberOfChannels,sampleRate:r.decoderConfig.sampleRate,decoderConfig:s,requiresPcmTransformation:!this.isFragmented&&Nt.includes(e.source._codec),expectedNextPcmPacketTimestamp:null,requiresAdtsStripping:a,firstPacket:n},timescale:s.sampleRate,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,startTimestampOffset:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],closed:!1};return this.trackDatas.push(o),this.trackDatas.sort((c,u)=>c.track.id-u.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),o}getSubtitleTrackData(e,n){const r=this.trackDatas.find(s=>s.track===e);if(r)return r;PI(n),b(n),b(n.config);const i={muxer:this,track:e,type:"subtitle",info:{config:n.config},timescale:1e3,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,startTimestampOffset:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],closed:!1,lastCueEndTimestamp:0,cueQueue:[],nextSourceId:0,cueToSourceId:new WeakMap};return this.trackDatas.push(i),this.trackDatas.sort((s,a)=>s.track.id-a.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),i}async addEncodedVideoPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getVideoTrackData(e,n,r);let a=n.data;if(s.info.requiresAnnexBTransformation){const c=[...Ya(a)].map(u=>a.subarray(u.offset,u.offset+u.length));if(c.length===0)throw new Error("Failed to transform packet data. Make sure all packets are provided in Annex B format, as specified in ITU-T-REC-H.264 and ITU-T-REC-H.265.");a=ug(c,4)}this.validateTimestamp(s.track,n.timestamp,n.type==="key");const o=this.createSampleForTrack(s,a,n.timestamp,n.duration,n.type);await this.registerSample(s,o)}finally{i()}}async addEncodedAudioPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getAudioTrackData(e,n,r);let a=n.data;if(s.info.requiresAdtsStripping){const l=ri(an.tempFromBytes(a));if(!l)throw new Error("Expected ADTS frame, didn't get one.");const d=l.crcCheck===null?Dc:Vi;a=a.subarray(d)}this.validateTimestamp(s.track,n.timestamp,n.type==="key");let o=n.timestamp,c=n.duration;if(s.info.requiresPcmTransformation){const d=sr(s.info.decoderConfig.codec).sampleSize*s.info.numberOfChannels;if(c=a.byteLength/d/s.info.sampleRate,s.info.expectedNextPcmPacketTimestamp!==null){const f=o-s.info.expectedNextPcmPacketTimestamp;if(f<.01)o=s.info.expectedNextPcmPacketTimestamp;else{const h=await this.padWithSilence(s,s.info.expectedNextPcmPacketTimestamp,f);o=s.info.expectedNextPcmPacketTimestamp+h}}s.info.expectedNextPcmPacketTimestamp=o+c}const u=this.createSampleForTrack(s,a,o,c,n.type);await this.registerSample(s,u)}finally{i()}}async padWithSilence(e,n,r){const i=Et(r,e.timescale);if(r=i/e.timescale,i>0){const{sampleSize:s,silentValue:a}=sr(e.info.decoderConfig.codec),o=i*e.info.numberOfChannels,c=new Uint8Array(s*o).fill(a),u=this.createSampleForTrack(e,new Uint8Array(c.buffer),n,r,"key");await this.registerSample(e,u)}return r}async addSubtitleCue(e,n,r){const i=await this.mutex.acquire();try{const s=this.getSubtitleTrackData(e,r);this.validateTimestamp(s.track,n.timestamp,!0),e.source._codec==="webvtt"&&(s.cueQueue.push(n),await this.processWebVTTCues(s,n.timestamp))}finally{i()}}async processWebVTTCues(e,n){for(;e.cueQueue.length>0;){const r=new Set([]);for(const u of e.cueQueue)b(u.timestamp<=n),b(e.lastCueEndTimestamp<=u.timestamp+u.duration),r.add(Math.max(u.timestamp,e.lastCueEndTimestamp)),r.add(u.timestamp+u.duration);const i=[...r].sort((u,l)=>u-l),s=i[0],a=i[1]??s;if(n<a)break;if(e.lastCueEndTimestamp<s){this.auxWriter.seek(0);const u=dq();this.auxBoxWriter.writeBox(u);const l=this.auxTarget._getSlice(0,this.auxWriter.getPos()),d=this.createSampleForTrack(e,l,e.lastCueEndTimestamp,s-e.lastCueEndTimestamp,"key");await this.registerSample(e,d),e.lastCueEndTimestamp=s}this.auxWriter.seek(0);for(let u=0;u<e.cueQueue.length;u++){const l=e.cueQueue[u];
vendor: 4,789 bytes, line 863
863if(l.timestamp>=a)break;tf.lastIndex=0;const d=tf.test(l.text),f=l.timestamp+l.duration;let h=e.cueToSourceId.get(l);if(h===void 0&&a<f&&(h=e.nextSourceId++,e.cueToSourceId.set(l,h)),l.notes){const p=hq(l.notes);this.auxBoxWriter.writeBox(p)}const m=fq(l.text,d?s:null,l.identifier??null,l.settings??null,h??null);this.auxBoxWriter.writeBox(m),f===a&&e.cueQueue.splice(u--,1)}const o=this.auxTarget._getSlice(0,this.auxWriter.getPos()),c=this.createSampleForTrack(e,o,s,a-s,"key");await this.registerSample(e,c),e.lastCueEndTimestamp=a}}createSampleForTrack(e,n,r,i,s){return{timestamp:r,decodeTimestamp:r,duration:i,data:n,size:n.byteLength,type:s,timescaleUnitsToNextSample:Et(i,e.timescale)}}processTimestamps(e,n){if(e.timestampProcessingQueue.length===0)return;if(e.type==="audio"&&e.info.requiresPcmTransformation){this.isFragmented||(e.startTimestampOffset??(e.startTimestampOffset=e.timestampProcessingQueue[0].timestamp));let i=0;for(let s=0;s<e.timestampProcessingQueue.length;s++){const a=e.timestampProcessingQueue[s],o=Et(a.duration,e.timescale);i+=o}if(e.timeToSampleTable.length===0)e.timeToSampleTable.push({sampleCount:i,sampleDelta:1});else{const s=yt(e.timeToSampleTable);s.sampleCount+=i}e.timestampProcessingQueue.length=0;return}const r=e.timestampProcessingQueue.map(i=>i.timestamp).sort((i,s)=>i-s);this.isFragmented||(e.startTimestampOffset??(e.startTimestampOffset=r[0]));for(let i=0;i<e.timestampProcessingQueue.length;i++){const s=e.timestampProcessingQueue[i];s.decodeTimestamp=r[i];const a=Et(s.timestamp-s.decodeTimestamp,e.timescale),o=Et(s.duration,e.timescale);if(e.lastTimescaleUnits!==null){b(e.lastSample);const c=Et(s.decodeTimestamp,e.timescale,!1),u=Math.round(c-e.lastTimescaleUnits);if(b(u>=0),e.lastTimescaleUnits+=u,e.lastSample.timescaleUnitsToNextSample=u,!this.isFragmented){let l=yt(e.timeToSampleTable);if(b(l),l.sampleCount===1){l.sampleDelta=u;const f=e.timeToSampleTable[e.timeToSampleTable.length-2];f&&f.sampleDelta===u&&(f.sampleCount++,e.timeToSampleTable.pop(),l=f)}else l.sampleDelta!==u&&(l.sampleCount--,e.timeToSampleTable.push(l={sampleCount:1,sampleDelta:u}));l.sampleDelta===o?l.sampleCount++:e.timeToSampleTable.push({sampleCount:1,sampleDelta:o});const d=yt(e.compositionTimeOffsetTable);b(d),d.sampleCompositionTimeOffset===a?d.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:a})}}else e.lastTimescaleUnits=Et(s.decodeTimestamp,e.timescale,!1),this.isFragmented||(e.timeToSampleTable.push({sampleCount:1,sampleDelta:o}),e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:a}));e.lastSample=s}if(e.timestampProcessingQueue.length=0,b(e.lastSample),b(e.lastTimescaleUnits!==null),n!==void 0&&e.lastSample.timescaleUnitsToNextSample===0){b(n.type==="key");const i=Et(n.timestamp,e.timescale,!1),s=Math.round(i-e.lastTimescaleUnits);e.lastSample.timescaleUnitsToNextSample=s}}async registerSample(e,n){n.type==="key"&&this.processTimestamps(e,n),e.timestampProcessingQueue.push(n),this.isFragmented?(e.sampleQueue.push(n),await this.interleaveSamples()):this.fastStart==="reserve"?await this.registerSampleFastStartReserve(e,n):await this.addSampleToTrack(e,n)}async addSampleToTrack(e,n){if(!this.isFragmented&&(e.samples.push(n),this.fastStart==="reserve")){const i=e.track.metadata.maximumPacketCount;if(b(i!==void 0),e.samples.length>i)throw new Error(`Track #${e.track.id} has already reached the maximum packet count (${i}). Either add less packets or increase the maximum packet count.`)}let r=!1;if(!e.currentChunk)r=!0;else{e.currentChunk.startTimestamp=Math.min(e.currentChunk.startTimestamp,n.timestamp);const i=n.timestamp-e.currentChunk.startTimestamp;if(this.isFragmented){const s=this.trackDatas.every(a=>{if(e===a)return n.type==="key";const o=a.sampleQueue[0];return o?o.type==="key":a.closed});i>=this.minimumFragmentDuration&&s&&n.timestamp>this.maxWrittenTimestamp&&(r=!0,await this.finalizeFragment())}else r=i>=.5}r&&(e.currentChunk&&await this.finalizeCurrentChunk(e),e.currentChunk={startTimestamp:n.timestamp,samples:[],offset:null,moofOffset:null}),b(e.currentChunk),e.currentChunk.samples.push(n),this.isFragmented&&(this.maxWrittenTimestamp=Math.max(this.maxWrittenTimestamp,n.timestamp),this.maxWrittenEndTimestamp=Math.max(this.maxWrittenEndTimestamp,n.timestamp+n.duration),this.minWrittenTimestamp=Math.min(this.minWrittenTimestamp,n.timestamp))}async finalizeCurrentChunk(e){if(b(!this.isFragmented),b(this.writer),!e.currentChunk)return;e.finalizedChunks.push(e.currentChunk),this.finalizedChunks.push(e.currentChunk);let n=e.currentChunk.samples.length;if(e.type==="audio"&&e.info.requiresPcmTransformation&&(n=e.currentChunk.samples.reduce((r,i)=>r+Et(i.duration,e.timescale),0)),(e.compactlyCodedChunkTable.length===0||yt
863(e.compactlyCodedChunkTable).samplesPerChunk!==n)&&e.compactlyCodedChunkTable.push({firstChunk:e.finalizedChunks.length,samplesPerChunk:n}),this.fastStart==="in-memory"){e.currentChunk.offset=0;return}e.currentChunk.offset=this.writer.getPos();for(const r of e.currentChunk.samples)b(r.data),this.writer.write(r.data),r.data=null;await this.writer.flush()}async interleaveSamples(e=!1){if(b(this.isFragmented),!(!e&&!this.allTracksAreKnown()))e:for(;;){let n=null,r=1/0;for(const s of this.trackDatas){if(!e&&s.sampleQueue.length===0&&!s.closed)break e;s.sampleQueue.length>0&&s.sampleQueue[0].timestamp<r&&(n=s,r=s.sampleQueue[0].timestamp)}if(!n)break;const i=n.sampleQueue.shift();await this.addSampleToTrack(n,i)}}async finalizeFragment(e=!this.isCmaf){b(this.isFragmented);const n=this.nextFragmentNumber++;if(n===1){const h=this.initBoxWriter??this.boxWriter;b(h),this.format._options.onMoov&&h.writer.startTrackingWrites();const m=$c(this);if(h.writeBox(m),this.format._options.onMoov){const{data:p,start:g}=h.writer.stopTrackingWrites();this.format._options.onMoov(p,g)}if(this.isCmaf){b(this.initWriter),await this.initWriter.flush(),await this.initWriter.finalize(),this.writer=await this.output._getRootWriter(!0),this.boxWriter=new nf(this.writer);const p=this.boxWriter.measureBox(tv()),g=this.boxWriter.measureBox(nv(this,0));this.segmentHeaderSize=p+g,this.writer.seek(this.segmentHeaderSize)}}b(this.writer),b(this.boxWriter);const r=this.trackDatas.filter(h=>h.currentChunk),i=iv(n,r),s=this.writer.getPos(),a=s+this.boxWriter.measureBox(i);let o=a+Jr,c=1/0;for(const h of r){h.currentChunk.offset=o,h.currentChunk.moofOffset=s;for(const m of h.currentChunk.samples)o+=m.size;c=Math.min(c,h.currentChunk.startTimestamp)}const u=o-a,l=u>=2**32;if(l)for(const h of r)h.currentChunk.offset+=vs-Jr;this.format._options.onMoof&&this.writer.startTrackingWrites();const d=iv(n,r);if(this.boxWriter.writeBox(d),this.format._options.onMoof){const{data:h,start:m}=this.writer.stopTrackingWrites();this.format._options.onMoof(h,m,c)}b(this.writer.getPos()===a),this.format._options.onMdat&&this.writer.startTrackingWrites();const f=rf(l);f.size=u,this.boxWriter.writeBox(f),this.writer.seek(a+(l?vs:Jr));for(const h of r)for(const m of h.currentChunk.samples)this.writer.write(m.data),m.data=null;if(this.format._options.onMdat){const{data:h,start:m}=this.writer.stopTrackingWrites();this.format._options.onMdat(h,m)}for(const h of r)h.finalizedChunks.push(h.currentChunk),this.finalizedChunks.push(h.currentChunk),h.currentChunk=null;e&&await this.writer.flush()}async registerSampleFastStartReserve(e,n){if(b(this.writer),b(this.boxWriter),this.allTracksAreKnown()){if(!this.mdat){const r=$c(this),s=this.boxWriter.measureBox(r)+this.computeSampleTableSizeUpperBound()+4096;b(this.ftypSize!==null),this.writer.seek(this.ftypSize+s),this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=rf(!0),this.boxWriter.writeBox(this.mdat);for(const a of this.trackDatas){for(const o of a.sampleQueue)await this.addSampleToTrack(a,o);a.sampleQueue.length=0}}await this.addSampleToTrack(e,n)}else e.sampleQueue.push(n)}computeSampleTableSizeUpperBound(){b(this.fastStart==="reserve");let e=0;for(const n of this.trackDatas){const r=n.track.metadata.maximumPacketCount;b(r!==void 0),e+=8*Math.ceil(2/3*r),e+=4*r,e+=8*Math.ceil(2/3*r),e+=12*Math.ceil(2/3*r),e+=4*r,e+=8*r}return e}async onTrackClose(e){const n=await this.mutex.acquire(),r=this.trackDatas.find(i=>i.track===e);r&&(r.closed=!0,r.type==="subtitle"&&e.source._codec==="webvtt"&&await this.processWebVTTCues(r,1/0),this.processTimestamps(r)),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),this.isFragmented&&await this.interleaveSamples(),n()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const n of this.trackDatas)n.closed=!0,n.type==="subtitle"&&n.track.source._codec==="webvtt"&&await this.processWebVTTCues(n,1/0),this.processTimestamps(n);if(this.isFragmented)await this.interleaveSamples(!0),await this.finalizeFragment(!1);else for(const n of this.trackDatas){await this.finalizeCurrentChunk(n),b(n.startTimestampOffset!==null);for(let r=0;r<n.samples.length;r++){const i=n.samples[r];i.timestamp-=n.startTimestampOffset,i.decodeTimestamp-=n.startTimestampOffset}}if(b(this.writer),b(this.boxWriter),this.fastStart==="in-memory"){this.mdat=rf(!1);let n;for(let i=0;i<2;i++){const s=$c(this),a=this.boxWriter.measureBox(s);n=this.boxWriter.measureBox(this.mdat);let o=this.writer.getPos()+a+n;for(const c of this.finalizedChunks){c.offset=o;for(const{data:u}of c.samples)b(u),o+=u.byteLength,n+=u.byteLength}if(o<2**32)break;n>=2**32&&(this.mdat.largeSize=!0)}this.format._options.onMoov&&this.writer.startTrackingWrites();const r=$c(this);if(this.boxWriter.writeBox(r),this.format._options.onMoov){const{data:i,start:s}=this.writer.stopTrackingWrites();this.format._options.onMoov(i,s)}this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat.size=n,this.boxWriter.writeBox(this.mdat);for(const i of this.finalizedChunks)for(const s of i.samples)b(s.data),this.writer.write(s.data),s.data=null;if(this.format._options.onMdat){const{data:i,start:s}=this.writer.stopTrackingWrites();this.format._options.onMdat(i,s)}}else if(this.isFragmented)if(this.isCmaf){const n=this.segmentHeaderSize!==null?this.writer.getPos()-this.segmentHeaderSize:0;this.writer.seek(0),this.boxWriter.writeBox(tv()),this.boxWriter.writeBox(nv(this,n))}else{const n=this.writer.getPos(),r=cq(this.trackDatas);this.boxWriter.writeBox(r);const i=this.writer.getPos()-n;this.writer.seek(this.writer.getPos()-4),this.boxWriter.writeU32(i)}else{b(this.mdat);const n=this.boxWriter.offsets.get(this.mdat);b(n!==void 0);const r=this.writer.getPos()-n;if(this.mdat.size=r,this.mdat.largeSize=r>=2**32,this.boxWriter.patchBox(this.mdat),this.format._options.onMdat){const{data:s,start:a}=this.writer.stopTrackingWrites();this.format._options.onMdat(s,a)}const i=$c(this);if(this.fastStart==="reserve"){b(this.ftypSize!==null),this.writer.seek(this.ftypSize),this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(i);const s=this.boxWriter.offsets.get(this.mdat)-this.writer.getPos();this.boxWriter.writeBox(AG(s))}else this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(i);if(this.format._options.onMoov){const{data:s,start:a}=this.writer.stopTrackingWrites();this.format._options.onMoov(s,a)}}e()}}/*!
864 * Copyright (c) 2026-present, Vanilagy and contributors
865 *
866 * This Source Code Form is subject to the terms of the Mozilla Public
867 * License, v. 2.0. If a copy of the MPL was not distributed with this
868 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
869 */const Bq=-32768,Pq=2**15-1,fv="Mediabunny",hv=6,pv=5,Rq={video:1,audio:2,subtitle:17};class Fq extends oi{constructor(e,n){super(e),this.trackDatas=[],this.allTracksKnown=wt(),this.segment=null,this.segmentInfo=null,this.seekHead=null,this.tracksElement=null,this.tagsElement=null,this.attachmentsElement=null,this.segmentDuration=null,this.cues=null,this.currentCluster=null,this.currentClusterStartMsTimestamp=null,this.currentClusterMa
869xMsTimestamp=null,this.trackDatasInCurrentCluster=new Map,this.startTimestamp=1/0,this.endTimestamp=-1/0,this.format=n}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(!!this.format._options.appendOnly),this.ebmlWriter=new DV(this.writer),this.writeEBMLHeader(),this.createSegmentInfo(),this.createCues(),await this.writer.flush(),e()}writeEBMLHeader(){this.format._options.onEbmlHeader&&this.writer.startTrackingWrites();const e={id:R.EBML,data:[{id:R.EBMLVersion,data:1},{id:R.EBMLReadVersion,data:1},{id:R.EBMLMaxIDLength,data:4},{id:R.EBMLMaxSizeLength,data:8},{id:R.DocType,data:this.format instanceof NA?"webm":"matroska"},{id:R.DocTypeVersion,data:2},{id:R.DocTypeReadVersion,data:2}]};if(this.ebmlWriter.writeEBML(e),this.format._options.onEbmlHeader){const{data:n,start:r}=this.writer.stopTrackingWrites();this.format._options.onEbmlHeader(n,r)}}maybeCreateSeekHead(e){if(this.format._options.appendOnly)return;const n=new Uint8Array([28,83,187,107]),r=new Uint8Array([21,73,169,102]),i=new Uint8Array([22,84,174,107]),s=new Uint8Array([25,65,164,105]),a=new Uint8Array([18,84,195,103]),o={id:R.SeekHead,data:[{id:R.Seek,data:[{id:R.SeekID,data:n},{id:R.SeekPosition,size:5,data:e?this.ebmlWriter.offsets.get(this.cues)-this.segmentDataOffset:0}]},{id:R.Seek,data:[{id:R.SeekID,data:r},{id:R.SeekPosition,size:5,data:e?this.ebmlWriter.offsets.get(this.segmentInfo)-this.segmentDataOffset:0}]},{id:R.Seek,data:[{id:R.SeekID,data:i},{id:R.SeekPosition,size:5,data:e?this.ebmlWriter.offsets.get(this.tracksElement)-this.segmentDataOffset:0}]},this.attachmentsElement?{id:R.Seek,data:[{id:R.SeekID,data:s},{id:R.SeekPosition,size:5,data:e?this.ebmlWriter.offsets.get(this.attachmentsElement)-this.segmentDataOffset:0}]}:null,this.tagsElement?{id:R.Seek,data:[{id:R.SeekID,data:a},{id:R.SeekPosition,size:5,data:e?this.ebmlWriter.offsets.get(this.tagsElement)-this.segmentDataOffset:0}]}:null]};this.seekHead=o}createSegmentInfo(){const e={id:R.Duration,data:new Sg(0)};this.segmentDuration=e;const n={id:R.Info,data:[{id:R.TimestampScale,data:1e6},{id:R.MuxingApp,data:fv},{id:R.WritingApp,data:fv},this.format._options.appendOnly?null:e]};this.segmentInfo=n}createTracks(){var n,r,i,s,a,o;const e={id:R.Tracks,data:[]};this.tracksElement=e;for(const c of this.trackDatas){const u=Bn[c.track.source._codec];b(u);let l=0;if(c.type==="audio"&&c.track.source._codec==="opus"){l=1e6*80;const d=c.info.decoderConfig.description;if(d){const f=dt(d),h=xd(f);l=Math.round(1e9*(h.preSkip/qa))}}e.data.push({id:R.TrackEntry,data:[{id:R.TrackNumber,data:c.track.id},{id:R.TrackUID,data:c.track.id},{id:R.TrackType,data:Rq[c.type]},((n=c.track.metadata.disposition)==null?void 0:n.default)===!1?{id:R.FlagDefault,data:0}:null,(r=c.track.metadata.disposition)!=null&&r.forced?{id:R.FlagForced,data:1}:null,(i=c.track.metadata.disposition)!=null&&i.hearingImpaired?{id:R.FlagHearingImpaired,data:1}:null,(s=c.track.metadata.disposition)!=null&&s.visuallyImpaired?{id:R.FlagVisualImpaired,data:1}:null,(a=c.track.metadata.disposition)!=null&&a.original?{id:R.FlagOriginal,data:1}:null,(o=c.track.metadata.disposition)!=null&&o.commentary?{id:R.FlagCommentary,data:1}:null,{id:R.FlagLacing,data:0},{id:R.Language,data:c.track.metadata.languageCode??Kt},{id:R.CodecID,data:u},{id:R.CodecDelay,data:0},{id:R.SeekPreRoll,data:l},c.track.metadata.name!==void 0?{id:R.Name,data:new Hi(c.track.metadata.name)}:null,c.type==="video"?this.videoSpecificTrackInfo(c):null,c.type==="audio"?this.audioSpecificTrackInfo(c):null,c.type==="subtitle"?this.subtitleSpecificTrackInfo(c):null]})}}videoSpecificTrackInfo(e){const{frameRate:n,rotation:r}=e.track.metadata,i=[e.info.decoderConfig.description?{id:R.CodecPrivate,data:dt(e.info.decoderConfig.description)}:null,n?{id:R.DefaultDuration,data:1e9/n}:null],s=r?Na(-r):0,a=!!e.info.aspectRatio&&e.info.aspectRatio.num*e.info.height!==e.info.aspectRatio.den*e.info.width,o=e.info.decoderConfig.colorSpace,c={id:R.Video,data:[{id:R.PixelWidth,data:e.info.width},{id:R.PixelHeight,data:e.info.height},a?{id:R.DisplayWidth,data:e.info.aspectRatio.num}:null,a?{id:R.DisplayHeight,data:e.info.aspectRatio.den}:null,a?{id:R.DisplayUnit,data:3}:null,e.info.alphaMode?{id:R.AlphaMode,data:1}:null,cI(o)?{id:R.Colour,data:[{id:R.MatrixCoefficients,data:Ts[o.matrix]},{id:R.TransferCharacteristics,data:_s[o.transfer]},{id:R.Primaries,data:Ss[o.primaries]},{id:R.Range,data:o.fullRange?2:1}]}:null,s?{id:R.Projection,data:[{id:R.ProjectionType,data:0},{id:R.ProjectionPoseRoll,data:new Eg((s+180)%360-180)}]}:null]};return i.push(c),i}audioSpecificTrackInfo(e){const n=Nt.includes(e.track.source._codec)?sr(e.track.source._codec):null;
869return[e.info.decoderConfig.description?{id:R.CodecPrivate,data:dt(e.info.decoderConfig.description)}:null,{id:R.Audio,data:[{id:R.SamplingFrequency,data:new Eg(e.info.sampleRate)},{id:R.Channels,data:e.info.numberOfChannels},n?{id:R.BitDepth,data:8*n.sampleSize}:null]}]}subtitleSpecificTrackInfo(e){return[{id:R.CodecPrivate,data:tt.encode(e.info.config.description)}]}maybeCreateTags(){const e=[],n=(s,a)=>{e.push({id:R.SimpleTag,data:[{id:R.TagName,data:new Hi(s)},typeof a=="string"?{id:R.TagString,data:new Hi(a)}:{id:R.TagBinary,data:a}]})},r=this.output._metadataTags,i=new Set;for(const{key:s,value:a}of Qa(r))switch(s){case"title":n("TITLE",a),i.add("TITLE");break;case"description":n("DESCRIPTION",a),i.add("DESCRIPTION");break;case"artist":n("ARTIST",a),i.add("ARTIST");break;case"album":n("ALBUM",a),i.add("ALBUM");break;case"albumArtist":n("ALBUM_ARTIST",a),i.add("ALBUM_ARTIST");break;case"genre":n("GENRE",a),i.add("GENRE");break;case"comment":n("COMMENT",a),i.add("COMMENT");break;case"lyrics":n("LYRICS",a),i.add("LYRICS");break;case"date":n("DATE",a.toISOString().slice(0,10)),i.add("DATE");break;case"trackNumber":{const o=r.tracksTotal!==void 0?`${a}/${r.tracksTotal}`:a.toString();n("PART_NUMBER",o),i.add("PART_NUMBER")}break;case"discNumber":{const o=r.discsTotal!==void 0?`${a}/${r.discsTotal}`:a.toString();n("DISC",o),i.add("DISC")}break;case"tracksTotal":case"discsTotal":break;case"images":case"raw":break;default:rn(s)}if(r.raw)for(const s in r.raw){const a=r.raw[s];a==null||i.has(s)||(typeof a=="string"||a instanceof Uint8Array)&&n(s,a)}e.length!==0&&(this.tagsElement={id:R.Tags,data:[{id:R.Tag,data:[{id:R.Targets,data:[{id:R.TargetTypeValue,data:50},{id:R.TargetType,data:"MOVIE"}]},...e]}]})}maybeCreateAttachments(){const e=this.output._metadataTags,n=[],r=new Set,i=e.images??[];for(const s of i){let a=s.name;a===void 0&&(a=(s.kind==="coverFront"?"cover":s.kind==="coverBack"?"back":"image")+(UW(s.mimeType)??""));let o;for(;;){o=0n;for(let c=0;c<8;c++)o<<=8n,o|=BigInt(Math.floor(Math.random()*256));if(o!==0n&&!r.has(o))break}r.add(o),n.push({id:R.AttachedFile,data:[s.description!==void 0?{id:R.FileDescription,data:new Hi(s.description)}:null,{id:R.FileName,data:new Hi(a)},{id:R.FileMediaType,data:s.mimeType},{id:R.FileData,data:s.data},{id:R.FileUID,data:o}]})}for(const[s,a]of Object.entries(e.raw??{}))!(a instanceof yd)||!/^\d+$/.test(s)||i.find(c=>c.mimeType===a.mimeType&&mI(c.data,a.data))||n.push({id:R.AttachedFile,data:[a.description!==void 0?{id:R.FileDescription,data:new Hi(a.description)}:null,{id:R.FileName,data:new Hi(a.name??"")},{id:R.FileMediaType,data:a.mimeType??""},{id:R.FileData,data:a.data},{id:R.FileUID,data:BigInt(s)}]});n.length!==0&&(this.attachmentsElement={id:R.Attachments,data:n})}createSegment(){this.createTracks(),this.maybeCreateTags(),this.maybeCreateAttachments(),this.maybeCreateSeekHead(!1);const e={id:R.Segment,size:this.format._options.appendOnly?-1:hv,data:[this.seekHead,this.segmentInfo,this.tracksElement,this.attachmentsElement,this.tagsElement]};if(this.segment=e,this.format._options.onSegmentHeader&&this.writer.startTrackingWrites(),this.ebmlWriter.writeEBML(e),this.format._options.onSegmentHeader){const{data:n,start:r}=this.writer.stopTrackingWrites();this.format._options.onSegmentHeader(n,r)}}createCues(){this.cues={id:R.Cues,data:[]}}get segmentDataOffset(){return b(this.segment),this.ebmlWriter.dataOffsets.get(this.segment)}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(n=>n.track===e))return!1;return!0}async getMimeType(){await this.allTracksKnown.promise;const e=this.trackDatas.map(n=>n.type==="video"||n.type==="audio"?n.info.decoderConfig.codec:{webvtt:"wvtt"}[n.track.source._codec]);return mC({isWebM:this.format instanceof NA,hasVideo:this.trackDatas.some(n=>n.type==="video"),hasAudio:this.trackDatas.some(n=>n.type==="audio"),codecStrings:e})}getVideoTrackData(e,n,r){const i=this.trackDatas.find(u=>u.track===e);if(i)return i;bd(r),b(r),b(r.decoderConfig),b(r.decoderConfig.codedWidth!==void 0),b(r.decoderConfig.codedHeight!==void 0);const s=r.decoderConfig.displayAspectWidth,a=r.decoderConfig.displayAspectHeight,o=s===void 0||a===void 0?null:Tc({num:s,den:a}),c={track:e,type:"video",info:{width:r.decoderConfig.codedWidth,height:r.decoderConfig.codedHeight,aspectRatio:o,decoderConfig:r.decoderConfig,alphaMode:!!n.sideData.alpha},chunkQueue:[],lastWrittenMsTimestamp:null,closed:!1}
869;return e.source._codec==="vp9"?c.info.decoderConfig={...c.info.decoderConfig,description:new Uint8Array(YW(c.info.decoderConfig.codec))}:e.source._codec==="av1"&&(c.info.decoderConfig={...c.info.decoderConfig,description:new Uint8Array(xI(c.info.decoderConfig.codec))}),this.trackDatas.push(c),this.trackDatas.sort((u,l)=>u.track.id-l.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),c}getAudioTrackData(e,n,r){const i=this.trackDatas.find(c=>c.track===e);if(i)return i;Li(r),b(r),b(r.decoderConfig);const s={...r.decoderConfig};let a=!1;if(e.source._codec==="aac"&&!s.description){const c=ri(an.tempFromBytes(n.data));if(!c)throw new Error("Couldn't parse ADTS header from the AAC packet. Make sure the packets are in ADTS format (as specified in ISO 13818-7) when not providing a description, or provide a description (must be an AudioSpecificConfig as specified in ISO 14496-3) and ensure the packets are raw AAC data.");const u=Oi[c.samplingFrequencyIndex],l=Ga[c.channelConfiguration];if(u===void 0||l===void 0)throw new Error("Invalid ADTS frame header.");s.description=eg({objectType:c.objectType,sampleRate:u,numberOfChannels:l}),a=!0}const o={track:e,type:"audio",info:{numberOfChannels:r.decoderConfig.numberOfChannels,sampleRate:r.decoderConfig.sampleRate,decoderConfig:s,requiresAdtsStripping:a},chunkQueue:[],lastWrittenMsTimestamp:null,closed:!1};return this.trackDatas.push(o),this.trackDatas.sort((c,u)=>c.track.id-u.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),o}getSubtitleTrackData(e,n){const r=this.trackDatas.find(s=>s.track===e);if(r)return r;PI(n),b(n),b(n.config);const i={track:e,type:"subtitle",info:{config:n.config},chunkQueue:[],lastWrittenMsTimestamp:null,closed:!1};return this.trackDatas.push(i),this.trackDatas.sort((s,a)=>s.track.id-a.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),i}async addEncodedVideoPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getVideoTrackData(e,n,r),a=n.type==="key";this.validateTimestamp(s.track,n.timestamp,a);let o=n.timestamp,c=n.duration;e.metadata.frameRate!==void 0&&(o=La(o,e.metadata.frameRate),c=La(c,e.metadata.frameRate));const u=s.info.alphaMode?n.sideData.alpha??null:null,l=this.createInternalChunk(n.data,o,c,n.type,u);e.source._codec==="vp9"&&this.fixVP9ColorSpace(s,l),s.chunkQueue.push(l),await this.interleaveChunks()}finally{i()}}async addEncodedAudioPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getAudioTrackData(e,n,r);let a=n.data;if(s.info.requiresAdtsStripping){const u=ri(an.tempFromBytes(a));if(!u)throw new Error("Expected ADTS frame, didn't get one.");const l=u.crcCheck===null?Dc:Vi;a=a.subarray(l)}const o=n.type==="key";this.validateTimestamp(s.track,n.timestamp,o);const c=this.createInternalChunk(a,n.timestamp,n.duration,n.type);s.chunkQueue.push(c),await this.interleaveChunks()}finally{i()}}async addSubtitleCue(e,n,r){const i=await this.mutex.acquire();try{const s=this.getSubtitleTrackData(e,r);this.validateTimestamp(s.track,n.timestamp,!0);let a=n.text;const o=Math.round(n.timestamp*1e3);tf.lastIndex=0,a=a.replace(tf,d=>{const h=hA(d.slice(1,-1))-o;return`<${jx(h)}>`});const c=tt.encode(a),u=`${n.settings??""}
870${n.identifier??""}
871${n.notes??""}`,l=this.createInternalChunk(c,n.timestamp,n.duration,"key",u.trim()?tt.encode(u):null);s.chunkQueue.push(l),await this.interleaveChunks()}finally{i()}}async interleaveChunks(e=!1){if(!(!e&&!this.allTracksAreKnown())){e:for(;;){let n=null,r=1/0;for(const s of this.trackDatas){if(!e&&s.chunkQueue.length===0&&!s.closed)break e;s.chunkQueue.length>0&&s.chunkQueue[0].timestamp<r&&(n=s,r=s.chunkQueue[0].timestamp)}if(!n)break;const i=n.chunkQueue.shift();this.writeBlock(n,i)}e||await this.writer.flush()}}fixVP9ColorSpace(e,n){if(n.type!=="key"||!e.info.decoderConfig.colorSpace||!e.info.decoderConfig.colorSpace.matrix)return;const r=new Me(n.data);r.skipBits(2);const i=r.readBits(1),a=(r.readBits(1)<<1)+i;if(a===3&&r.skipBits(1),r.readBits(1)||r.readBits(1)!==0||(r.skipBits(2),r.readBits(24)!==4817730))return;a>=2&&r.skipBits(1);const l={rgb:7,bt709:2,bt470bg:1,smpte170m:3}[e.info.decoderConfig.colorSpace.matrix];TW(n.data,r.pos,r.pos+3,l)}createInternalChunk(e,n,r,i,s=null){return{data:e,type:i,timestamp:n,duration:r,additions:s}}writeBlock(e,n){this.segment||this.createSegment();const r=Math.round(1e3*n.timestamp),i=this.trackDatas.every(l=>
871{if(e===l)return n.type==="key";const d=l.chunkQueue[0];return d?d.type==="key":l.closed});let s=!1;if(!this.currentCluster)s=!0;else{b(this.currentClusterStartMsTimestamp!==null),b(this.currentClusterMaxMsTimestamp!==null);const l=r-this.currentClusterStartMsTimestamp;s=i&&r>this.currentClusterMaxMsTimestamp&&l>=1e3*(this.format._options.minimumClusterDuration??1)||l>Pq}s&&this.createNewCluster(r);const a=r-this.currentClusterStartMsTimestamp;if(a<Bq)return;const o=new Uint8Array(4),c=new DataView(o.buffer);c.setUint8(0,128|e.track.id),c.setInt16(1,a,!1);const u=Math.round(1e3*n.duration);if(n.additions){const l={id:R.BlockGroup,data:[{id:R.Block,data:[o,n.data]},n.type==="delta"?{id:R.ReferenceBlock,data:new cC(e.lastWrittenMsTimestamp-r)}:null,n.additions?{id:R.BlockAdditions,data:[{id:R.BlockMore,data:[{id:R.BlockAddID,data:1},{id:R.BlockAdditional,data:n.additions}]}]}:null,u>0?{id:R.BlockDuration,data:u}:null]};this.ebmlWriter.writeEBML(l)}else{c.setUint8(3,+(n.type==="key")<<7);const l={id:R.SimpleBlock,data:[o,n.data]};this.ebmlWriter.writeEBML(l)}this.startTimestamp=Math.min(this.startTimestamp,r),this.endTimestamp=Math.max(this.endTimestamp,r+u),e.lastWrittenMsTimestamp=r,this.trackDatasInCurrentCluster.has(e)||this.trackDatasInCurrentCluster.set(e,{firstMsTimestamp:r}),this.currentClusterMaxMsTimestamp=Math.max(this.currentClusterMaxMsTimestamp,r)}createNewCluster(e){this.currentCluster&&this.finalizeCurrentCluster(),this.format._options.onCluster&&this.writer.startTrackingWrites(),this.currentCluster={id:R.Cluster,size:this.format._options.appendOnly?-1:pv,data:[{id:R.Timestamp,data:e}]},this.ebmlWriter.writeEBML(this.currentCluster),this.currentClusterStartMsTimestamp=e,this.currentClusterMaxMsTimestamp=e,this.trackDatasInCurrentCluster.clear()}finalizeCurrentCluster(){if(b(this.currentCluster),!this.format._options.appendOnly){const i=this.writer.getPos()-this.ebmlWriter.dataOffsets.get(this.currentCluster),s=this.writer.getPos();this.writer.seek(this.ebmlWriter.offsets.get(this.currentCluster)+4),this.ebmlWriter.writeVarInt(i,pv),this.writer.seek(s)}if(this.format._options.onCluster){b(this.currentClusterStartMsTimestamp!==null);const{data:i,start:s}=this.writer.stopTrackingWrites();this.format._options.onCluster(i,s,this.currentClusterStartMsTimestamp/1e3)}const e=this.ebmlWriter.offsets.get(this.currentCluster)-this.segmentDataOffset,n=new Map;for(const[i,{firstMsTimestamp:s}]of this.trackDatasInCurrentCluster)n.has(s)||n.set(s,[]),n.get(s).push(i);const r=[...n.entries()].sort((i,s)=>i[0]-s[0]);for(const[i,s]of r)b(this.cues),this.cues.data.push({id:R.CuePoint,data:[{id:R.CueTime,data:i},...s.map(a=>({id:R.CueTrackPositions,data:[{id:R.CueTrack,data:a.track.id},{id:R.CueClusterPosition,data:e}]}))]})}async onTrackClose(e){const n=await this.mutex.acquire(),r=this.trackDatas.find(i=>i.track===e);r&&(r.closed=!0),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),await this.interleaveChunks(),n()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const n of this.trackDatas)n.closed=!0;if(this.segment||this.createSegment(),await this.interleaveChunks(!0),this.currentCluster&&this.finalizeCurrentCluster(),b(this.cues),this.ebmlWriter.writeEBML(this.cues),!this.format._options.appendOnly){const n=this.writer.getPos()-this.segmentDataOffset;this.writer.seek(this.ebmlWriter.offsets.get(this.segment)+4),this.ebmlWriter.writeVarInt(n,hv);const r=this.startTimestamp===1/0?0:this.endTimestamp-this.startTimestamp;this.segmentDuration.data=new Sg(r),this.writer.seek(this.ebmlWriter.offsets.get(this.segmentDuration)),this.ebmlWriter.writeEBML(this.segmentDuration),b(this.seekHead),this.writer.seek(this.ebmlWriter.offsets.get(this.seekHead)),this.maybeCreateSeekHead(!0),this.ebmlWriter.writeEBML(this.seekHead)}e()}}/*!
872 * Copyright (c) 2026-present, Vanilagy and contributors
873 *
874 * This Source Code Form is subject to the terms of the Mozilla Public
875 * License, v. 2.0. If a copy of the MPL was not distributed with this
876 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
877 */class Mq{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer)}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeXingFrame(e){const n=this.writer.getPos(),r=255,i=224|e.mpegVersionId<<3|e.layer<<1;let s;e.mpegVersionId&2?s=e.mpegVersionId&1?0:1:s=1;const a=0,o=155;let c=-1;const u=s*16*4+e.layer*16;for(let g=0;g<16;g++){const A=rg[u+g];
877if(sg(s,e.layer,1e3*A,e.sampleRate,a)>=o){c=g;break}}if(c===-1)throw new Error("No suitable bitrate found.");const l=c<<4|e.frequencyIndex<<2|a<<1,d=e.channel<<6|e.modeExtension<<4|e.copyright<<3|e.original<<2|e.emphasis;this.helper[0]=r,this.helper[1]=i,this.helper[2]=l,this.helper[3]=d,this.writer.write(this.helper.subarray(0,4));const f=Sd(e.mpegVersionId,e.channel);this.writer.seek(n+f),this.writeU32(Ed);let h=0;e.frameCount!==null&&(h|=xs.FrameCount),e.fileSize!==null&&(h|=xs.FileSize),e.toc!==null&&(h|=xs.Toc),this.writeU32(h),this.writeU32(e.frameCount??0),this.writeU32(e.fileSize??0),this.writer.write(e.toc??new Uint8Array(100));const m=rg[u+c],p=sg(s,e.layer,1e3*m,e.sampleRate,a);this.writer.seek(n+p)}}/*!
878 * Copyright (c) 2026-present, Vanilagy and contributors
879 *
880 * This Source Code Form is subject to the terms of the Mozilla Public
881 * License, v. 2.0. If a copy of the MPL was not distributed with this
882 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
883 */class Dq extends oi{constructor(e,n){super(e),this.xingFrameData=null,this.frameCount=0,this.framePositions=[],this.xingFramePos=null,this.format=n}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(this.format._options.xingHeader===!1),this.mp3Writer=new Mq(this.writer),Cc(this.output._metadataTags)||new fA(this.writer).writeId3V2Tag(this.output._metadataTags),e()}async getMimeType(){return"audio/mpeg"}async addEncodedVideoPacket(){throw new Error("MP3 does not support video.")}async addEncodedAudioPacket(e,n){const r=await this.mutex.acquire();try{const i=this.format._options.xingHeader!==!1;if(!this.xingFrameData&&i){const s=_e(n.data);if(s.byteLength<4)throw new Error("Invalid MP3 header in sample.");const a=s.getUint32(0,!1),o=_d(a,null).header;if(!o)throw new Error("Invalid MP3 header in sample.");const c=Sd(o.mpegVersionId,o.channel);if(s.byteLength>=c+4){const u=s.getUint32(c,!1);if(u===Ed||u===ig)return}this.xingFrameData={mpegVersionId:o.mpegVersionId,layer:o.layer,frequencyIndex:o.frequencyIndex,sampleRate:o.sampleRate,channel:o.channel,modeExtension:o.modeExtension,copyright:o.copyright,original:o.original,emphasis:o.emphasis,frameCount:null,fileSize:null,toc:null},this.xingFramePos=this.writer.getPos(),this.mp3Writer.writeXingFrame(this.xingFrameData),this.frameCount++}this.validateTimestamp(e,n.timestamp,n.type==="key"),i&&this.framePositions.push(this.writer.getPos()),this.writer.write(n.data),this.frameCount++,await this.writer.flush()}finally{r()}}async addSubtitleCue(){throw new Error("MP3 does not support subtitles.")}async finalize(){if(!this.xingFrameData||this.xingFramePos===null)return;const e=await this.mutex.acquire(),r=this.writer.getPos()-this.xingFramePos;this.writer.seek(this.xingFramePos);const i=new Uint8Array(100);for(let s=0;s<100;s++){const a=Math.floor(this.framePositions.length*(s/100)),o=this.framePositions[a]-this.xingFramePos;i[s]=256*(o/r)}if(this.xingFrameData.frameCount=this.frameCount,this.xingFrameData.fileSize=r,this.xingFrameData.toc=i,this.format._options.onXingFrame&&this.writer.startTrackingWrites(),this.mp3Writer.writeXingFrame(this.xingFrameData),this.format._options.onXingFrame){const{data:s,start:a}=this.writer.stopTrackingWrites();this.format._options.onXingFrame(s,a)}e()}}/*!
884 * Copyright (c) 2026-present, Vanilagy and contributors
885 *
886 * This Source Code Form is subject to the terms of the Mozilla Public
887 * License, v. 2.0. If a copy of the MPL was not distributed with this
888 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
889 */const Oq=8192;class Nq extends oi{constructor(e,n){super(e),this.trackDatas=[],this.bosPagesWritten=!1,this.allTracksKnown=wt(),this.pageBytes=new Uint8Array(SC),this.pageView=new DataView(this.pageBytes.buffer),this.format=n}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(!0),e()}async getMimeType(){return await this.allTracksKnown.promise,EC({codecStrings:this.trackDatas.map(e=>e.codecInfo.codec)})}addEncodedVideoPacket(){throw new Error("Video tracks are not supported.")}getTrackData(e,n){const r=this.trackDatas.find(a=>a.track===e);if(r)return r;let i;do i=Math.floor(2**32*Math.random());while(this.trackDatas.some(a=>a.serialNumber===i));b(e.source._codec==="vorbis"||e.source._codec==="opus"),Li(n),b(n),b(n.decoderConfig);const s={track:e,serialNumber:i,internalSampleRate:e.source._codec==="opus"?qa:n.decoderConfig.sampleRate,codecInfo:{codec:e.source._codec,vorbisInfo:null,opusInfo:null},vorbisLastBlocksize:null,packetQueue:[],currentTimestampInSamples:0,pagesWritten:0,currentGranulePosition:0,
889currentLacingValues:[],currentPageData:[],currentPageSize:27,currentPageStartsWithFreshPacket:!0,currentPageStartTimestampInSamples:0,closed:!1};return this.queueHeaderPackets(s,n),this.trackDatas.push(s),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),s}queueHeaderPackets(e,n){if(b(n.decoderConfig),e.track.source._codec==="vorbis"){b(n.decoderConfig.description);const r=dt(n.decoderConfig.description);if(r[0]!==2)throw new TypeError("First byte of Vorbis decoder description must be 2.");let i=1;const s=()=>{let p=0;for(;;){const g=r[i++];if(g===void 0)throw new TypeError("Vorbis decoder description is too short.");if(p+=g,g<255)return p}},a=s(),o=s();if(r.length-i<=0)throw new TypeError("Vorbis decoder description is too short.");const u=r.subarray(i,i+=a);i+=o;const l=r.subarray(i),d=new Uint8Array(7);d[0]=3,d[1]=118,d[2]=111,d[3]=114,d[4]=98,d[5]=105,d[6]=115;const f=pg(d,this.output._metadataTags,!0);e.packetQueue.push({data:u,timestampInSamples:0,durationInSamples:0,forcePageFlush:!0},{data:f,timestampInSamples:0,durationInSamples:0,forcePageFlush:!1},{data:l,timestampInSamples:0,durationInSamples:0,forcePageFlush:!0});const m=_e(u).getUint8(28);e.codecInfo.vorbisInfo={blocksizes:[1<<(m&15),1<<(m>>4)],modeBlockflags:HI(l).modeBlockflags}}else if(e.track.source._codec==="opus"){if(!n.decoderConfig.description)throw new TypeError("For Ogg, Opus decoder description is required.");const r=dt(n.decoderConfig.description),i=new Uint8Array(8),s=_e(i);s.setUint32(0,1332770163,!1),s.setUint32(4,1415669619,!1);const a=pg(i,this.output._metadataTags,!0);e.packetQueue.push({data:r,timestampInSamples:0,durationInSamples:0,forcePageFlush:!0},{data:a,timestampInSamples:0,durationInSamples:0,forcePageFlush:!0}),e.codecInfo.opusInfo={preSkip:xd(r).preSkip}}}async addEncodedAudioPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getTrackData(e,r);this.validateTimestamp(s.track,n.timestamp,n.type==="key");const a=s.currentTimestampInSamples,{durationInSamples:o,vorbisBlockSize:c}=bC(n.data,s.codecInfo,s.vorbisLastBlocksize);s.currentTimestampInSamples+=o,s.vorbisLastBlocksize=c,s.packetQueue.push({data:n.data,timestampInSamples:a,durationInSamples:o,forcePageFlush:!1}),await this.interleavePages()}finally{i()}}addSubtitleCue(){throw new Error("Subtitle tracks are not supported.")}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(n=>n.track===e))return!1;return!0}async interleavePages(e=!1){if(!this.bosPagesWritten){if(!this.allTracksAreKnown()&&!e)return;for(const n of this.trackDatas)for(;n.packetQueue.length>0;){const r=n.packetQueue.shift();if(this.writePacket(n,r,!1),r.forcePageFlush)break}this.bosPagesWritten=!0}e:for(;;){let n=null,r=1/0;for(const a of this.trackDatas){if(!e&&a.packetQueue.length<=1&&!a.closed)break e;a.packetQueue.length>0&&a.packetQueue[0].timestampInSamples<r&&(n=a,r=a.packetQueue[0].timestampInSamples)}if(!n)break;const i=n.packetQueue.shift(),s=n.packetQueue.length===0;this.writePacket(n,i,s)}e||await this.writer.flush()}writePacket(e,n,r){const i=n.timestampInSamples+n.durationInSamples;if(this.format._options.maximumPageDuration!==void 0){const u=this.format._options.maximumPageDuration*e.internalSampleRate;e.currentLacingValues.length>0&&i-e.currentPageStartTimestampInSamples>u&&this.writePage(e,!1)}let s=n.data.length,a=0,o=0;for(;;){e.currentLacingValues.length===0&&a>0&&(e.currentPageStartsWithFreshPacket=!1);const u=Math.min(255,s);e.currentLacingValues.push(u),e.currentPageSize++,o+=u;const l=s<255;if(e.currentLacingValues.length===255){const d=n.data.subarray(a,o);if(a=o,e.currentPageData.push(d),e.currentPageSize+=d.length,this.writePage(e,r&&l),l)return}if(l)break;s-=255}const c=n.data.subarray(a);e.currentPageData.push(c),e.currentPageSize+=c.length,e.currentGranulePosition=i,(e.currentPageSize>=Oq||n.forcePageFlush)&&this.writePage(e,r)}writePage(e,n){this.pageView.setUint32(0,vg,!0),this.pageView.setUint8(4,0);let r=0;e.currentPageStartsWithFreshPacket||(r|=1),e.pagesWritten===0&&(r|=2),n&&(r|=4),this.pageView.setUint8(5,r);const i=e.currentLacingValues.every(c=>c===255)?-1:e.currentGranulePosition;PW(this.pageView,6,i),this.pageView.setUint32(14,e.serialNumber,!0),this.pageView.setUint32(18,e.pagesWritten,!0),this.pageView.setUint32(22,0,!0),this.pageView.setUint8(26,e.currentLacingValues.length),this.pageBytes.set(e.currentLacingValues,27);let s=27+e.currentLacingValues.length;for(const c of e.currentPageData)this.pageBytes.set(c,s),s+=c.length;const a=this.pageBytes.subarray(0,s),o=wC(a);if(this.pageView.setUint32(22,o,!0),e.pagesWritten++,e.currentLacingValues.length=0,e.currentPageData.length=0,e.currentPageSize=27,e.currentPageStartsWithFreshPacket=!0,e.currentPageStartTimestampInSamples=e.currentGranulePosition,this.format._options.onPage&&this.writer.startTrackingWrites(),this.writer.write(a),this.format._options.onPage){const{data:c,start:u}=this.writer.stopTrackingWrites();this.format._options.onPage(c,u,e.track.source)}}async onTrackClose(e){const n=await this.mutex.acquire(),r=this.trackDatas.find(i=>i.track===e);r&&(r.closed=!0),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),await this.interleavePages(),n()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const n of this.trackDatas)n.closed=!0;await this.interleavePages(!0);for(const n of this.trackDatas)n.currentLacingValues.length>0&&this.writePage(n,!0);e()}}/*!
890 * Copyright (c) 2026-present, Vanilagy and contributors
891 *
892 * This Source Code Form is subject to the terms of the Mozilla Public
893 * License, v. 2.0. If a copy of the MPL was not distributed with this
894 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
895 */const Uq=0,mv=4096,gv=256,Lq=224,Av=192,yv=new Uint8Array([9,240]),wv=new Uint8Array([70,1]);class zq extends oi{constructor(e,n){super(e),this.trackDatas=[],this.tablesWritten=!1,this.continuityCounters=new Map,this.packetBuffer=new Uint8Array(hn),this.packetView=_e(this.packetBuffer),this.allTracksKnown=wt(),this.videoTrackIndex=0,this.audioTrackIndex=0,this.adaptationFieldBuffer=new Uint8Array(184),this.payloadBuffer=new Uint8Array(184),this.format=n}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(!0),e()}async getMimeType(){return await this.allTracksKnown.promise,xC(this.trackDatas.map(e=>e.codecString))}getVideoTrackData(e,n){const r=this.trackDatas.find(u=>u.track===e);if(r)return r;bd(n),b(n==null?void 0:n.decoderConfig);const i=e.source._codec;b(i==="avc"||i==="hevc");const s=i==="avc"?27:36,a=gv+this.trackDatas.length,o=Lq+this.videoTrackIndex++,c={track:e,pid:a,streamType:s,streamId:o,codecString:n.decoderConfig.codec,timestampProcessingQueue:[],packetQueue:[],inputIsAnnexB:null,inputIsAdts:null,avcDecoderConfig:null,hevcDecoderConfig:null,adtsHeader:null,adtsHeaderBitstream:null,firstPacketWritten:!1,closed:!1}
895;return this.trackDatas.push(c),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),c}getAudioTrackData(e,n){const r=this.trackDatas.find(u=>u.track===e);if(r)return r;Li(n),b(n==null?void 0:n.decoderConfig);const i=e.source._codec;b(i==="aac"||i==="mp3"||i==="ac3"||i==="eac3");let s,a;switch(i){case"aac":s=15,a=Av+this.audioTrackIndex++;break;case"mp3":s=3,a=Av+this.audioTrackIndex++;break;case"ac3":s=129,a=189;break;case"eac3":s=135,a=189;break}const o=gv+this.trackDatas.length,c={track:e,pid:o,streamType:s,streamId:a,codecString:n.decoderConfig.codec,timestampProcessingQueue:[],packetQueue:[],inputIsAnnexB:null,inputIsAdts:null,avcDecoderConfig:null,hevcDecoderConfig:null,adtsHeader:null,adtsHeaderBitstream:null,firstPacketWritten:!1,closed:!1};return this.trackDatas.push(c),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),c}async addEncodedVideoPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getVideoTrackData(e,r);this.validateTimestamp(s.track,n.timestamp,n.type==="key");const a=this.prepareVideoPacket(s,n,r);n.type==="key"&&await this.flushTimestampQueue(s),s.timestampProcessingQueue.push({data:a,presentationTimestamp:n.timestamp,decodeTimestamp:null,isKeyframe:n.type==="key"})}finally{i()}}async addEncodedAudioPacket(e,n,r){const i=await this.mutex.acquire();try{const s=this.getAudioTrackData(e,r);this.validateTimestamp(s.track,n.timestamp,n.type==="key");const a=this.prepareAudioPacket(s,n,r);n.type==="key"&&await this.flushTimestampQueue(s),s.timestampProcessingQueue.push({data:a,presentationTimestamp:n.timestamp,decodeTimestamp:null,isKeyframe:n.type==="key"})}finally{i()}}async addSubtitleCue(){throw new Error("MPEG-TS does not support subtitles.")}prepareVideoPacket(e,n,r){var s;const i=e.track.source._codec;if(e.inputIsAnnexB===null){const a=(s=r==null?void 0:r.decoderConfig)==null?void 0:s.description;if(e.inputIsAnnexB=!a,!e.inputIsAnnexB){const o=dt(a);i==="avc"?e.avcDecoderConfig=MI(o):e.hevcDecoderConfig=AV(o)}}return e.inputIsAnnexB?this.prepareAnnexBVideoPacket(n.data,i):this.prepareLengthPrefixedVideoPacket(e,n,i)}prepareAnnexBVideoPacket(e,n){const r=[];for(const s of Ya(e)){const a=e.subarray(s.offset,s.offset+s.length);(n==="avc"?Ka(a[0])===Vn.AUD:zi(a[0])===Rt.AUD_NUT)||r.push(a)}const i=n==="avc"?yv:wv;return r.unshift(i),Id(r)}prepareLengthPrefixedVideoPacket(e,n,r){const i=n.data,s=r==="avc"?e.avcDecoderConfig.lengthSizeMinusOne+1:e.hevcDecoderConfig.lengthSizeMinusOne+1,a=[];for(const c of og(i,s)){const u=i.subarray(c.offset,c.offset+c.length);(r==="avc"?Ka(u[0])===Vn.AUD:zi(u[0])===Rt.AUD_NUT)||a.push(u)}if(n.type==="key")if(r==="avc"){const c=e.avcDecoderConfig;for(const u of c.pictureParameterSets)a.unshift(u);for(const u of c.sequenceParameterSets)a.unshift(u)}else{const c=e.hevcDecoderConfig;for(const u of c.arrays)if(u.nalUnitType===Rt.PPS_NUT)for(const l of u.nalUnits)a.unshift(l);for(const u of c.arrays)if(u.nalUnitType===Rt.SPS_NUT)for(const l of u.nalUnits)a.unshift(l);for(const u of c.arrays)if(u.nalUnitType===Rt.VPS_NUT)for(const l of u.nalUnits)a.unshift(l)}const o=r==="avc"?yv:wv;return a.unshift(o),Id(a)}prepareAudioPacket(e,n,r){var c;const i=e.track.source._codec;if(i==="mp3"||i==="ac3"||i==="eac3")return n.data;if(e.inputIsAdts===null){const u=(c=r==null?void 0:r.decoderConfig)==null?void 0:c.description;if(e.inputIsAdts=!u,!e.inputIsAdts){const l=xc(dt(u)),d=EI(l);e.adtsHeader=d.header,e.adtsHeaderBitstream=d.bitstream}}if(e.inputIsAdts)return n.data;b(e.adtsHeader),b(e.adtsHeaderBitstream);const s=e.adtsHeader,a=n.data.byteLength+s.byteLength;SI(e.adtsHeaderBitstream,a);const o=new Uint8Array(a);return o.set(s,0),o.set(n.data,s.byteLength),o}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(n=>n.track===e))return!1;return!0}async flushTimestampQueue(e,n=!0){if(e.timestampProcessingQueue.length===0)return;const r=e.timestampProcessingQueue.map(i=>i.presentationTimestamp).sort((i,s)=>i-s);for(let i=0;i<e.timestampProcessingQueue.length;i++){const s=e.timestampProcessingQueue[i];s.decodeTimestamp=r[i],e.packetQueue.push(s)}e.timestampProcessingQueue.length=0,n&&await this.interleavePackets()}
895async interleavePackets(e=!1){if(!this.tablesWritten){if(!this.allTracksAreKnown()&&!e)return;this.writeTables()}e:for(;;){let n=null,r=1/0;for(const s of this.trackDatas){if(!e&&s.packetQueue.length===0&&!s.closed)break e;s.packetQueue.length>0&&s.packetQueue[0].presentationTimestamp<r&&(n=s,r=s.packetQueue[0].presentationTimestamp)}if(!n)break;const i=n.packetQueue.shift();this.writePesPacket(n,i)}e||await this.writer.flush()}writeTables(){b(!this.tablesWritten),this.writePsiSection(Uq,zs),this.writePsiSection(mv,Hq(this.trackDatas)),this.tablesWritten=!0}writePsiSection(e,n){let r=0,i=!0;for(;r<n.length;){const a=184-(i?1:0),o=n.length-r,c=Math.min(a,o);let u;i?(u=this.payloadBuffer.subarray(0,1+c),u[0]=0,u.set(n.subarray(r,r+c),1)):u=n.subarray(r,r+c),this.writeTsPacket(e,i,null,u),r+=c,i=!1}}writePesPacket(e,n){const r=e.track.type==="video",i=r?10:5,s=new Uint8Array(9+i),a=_e(s),o=new Me(s.subarray(9));pd(a,0,1,!1),s[3]=e.streamId;const c=e.track.type==="video"?0:Math.min(8+n.data.length,65535);a.setUint16(4,c,!1),a.setUint8(6,132),a.setUint8(7,r?192:128),a.setUint8(8,i);const u=Math.round(n.presentationTimestamp*ar);if(o.pos=0,o.writeBits(4,r?3:2),o.writeBits(3,u>>>30&7),o.writeBits(1,1),o.writeBits(15,u>>>15&32767),o.writeBits(1,1),o.writeBits(15,u&32767),o.writeBits(1,1),r){b(n.decodeTimestamp!==null);const h=Math.round(n.decodeTimestamp*ar);o.writeBits(4,1),o.writeBits(3,h>>>30&7),o.writeBits(1,1),o.writeBits(15,h>>>15&32767),o.writeBits(1,1),o.writeBits(15,h&32767),o.writeBits(1,1)}const l=s.length+n.data.length;let d=0,f=!0;for(;d<l;){const h=f,m=l-d,p=f&&n.isKeyframe,g=f&&!e.firstPacketWritten,A=Math.max(0,184-m);let y;p||g?y=Math.max(2,A):y=A;let w=null;if(y>0){const _=this.adaptationFieldBuffer;y===1?_[0]=0:(_[0]=y-1,_[1]=Number(g)<<7|Number(p)<<6,_.fill(255,2,y)),w=_.subarray(0,y)}const E=Math.min(184-y,m),S=this.payloadBuffer.subarray(0,E);let k=0;if(d<s.length){const _=Math.min(s.length-d,E);S.set(s.subarray(d,d+_),0),k=_}const T=Math.max(0,d-s.length),C=T+(E-k);k<E&&S.set(n.data.subarray(T,C),k),this.writeTsPacket(e.pid,h,w,S),d+=E,f=!1}e.firstPacketWritten=!0}writeTsPacket(e,n,r,i){const s=this.continuityCounters.get(e)??0,a=i.length>0,o=r?a?3:2:a?1:0;this.packetBuffer[0]=71,this.packetView.setUint16(1,(n?16384:0)|e&8191,!1),this.packetBuffer[3]=o<<4|s&15,a&&this.continuityCounters.set(e,s+1&15);let c=4;r&&(this.packetBuffer.set(r,c),c+=r.length),this.packetBuffer.set(i,c),c+=i.length,c<hn&&this.packetBuffer.fill(255,c);const u=this.writer.getPos();this.writer.write(this.packetBuffer),this.format._options.onPacket&&this.format._options.onPacket(this.packetBuffer.slice(),u)}async onTrackClose(e){const n=await this.mutex.acquire(),r=this.trackDatas.find(i=>i.track===e);r&&(r.closed=!0,await this.flushTimestampQueue(r,!1)),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),await this.interleavePackets(),n()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const n of this.trackDatas)n.closed=!0,await this.flushTimestampQueue(n,!1);await this.interleavePackets(!0),e()}}const Qq=79764919,bv=new Uint32Array(256);for(let t=0;t<256;t++){let e=t<<24;for(let n=0;n<8;n++)e=e&2147483648?e<<1^Qq:e<<1;bv[t]=e>>>0&4294967295}const Ev=t=>{let e=4294967295;for(let n=0;n<t.length;n++){const r=t[n];e=(e<<8^bv[e>>>24^r])>>>0}return e},zs=new Uint8Array(16);{const t=_e(zs);zs[0]=0,t.setUint16(1,45069,!1),t.setUint16(3,1,!1),zs[5]=193,zs[6]=0,zs[7]=0,t.setUint16(8,1,!1),t.setUint16(10,57344|mv&8191,!1),t.setUint32(12,Ev(zs.subarray(0,12)),!1)}const Hq=t=>{let e=0;for(const c of t)e+=5,c.streamType===129?e+=Bd.length:c.streamType===135&&(e+=Pd.length);const n=9+e+4,r=new Uint8Array(3+n-4),i=_e(r);r[0]=2,i.setUint16(1,45056|n&4095,!1),i.setUint16(3,1,!1),r[5]=193,r[6]=0,r[7]=0,i.setUint16(8,65535,!1),i.setUint16(10,61440,!1);let s=12;for(const c of t)r[s++]=c.streamType,i.setUint16(s,57344|c.pid&8191,!1),s+=2,c.streamType===129?(i.setUint16(s,61440|Bd.length,!1),s+=2,r.set(Bd,s),s+=Bd.length):c.streamType===135?(i.setUint16(s,61440|Pd.length,!1),s+=2,r.set(Pd,s),s+=Pd.length):(i.setUint16(s,61440,!1),s+=2);const a=Ev(r),o=new Uint8Array(r.length+4);return o.set(r,0),_e(o).setUint32(r.length,a,!1),o};/*!
896 * Copyright (c) 2026-present, Vanilagy and contributors
897 *
898 * This Source Code Form is subject to the terms of the Mozilla Public
899 * License, v. 2.0. If a copy of the MPL was not distributed with this
900 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
901 */class Wq{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer)}writeU16(e){this.helperView.setUint16(0,e,!0),this.writer.write(this.helper.subarray(0,2))}writeU32(e){this.helperView.setUint32(0,e,!0),this.writer.write(this.helper.subarray(0,4))}writeU64(e){this.helperView.setUint32(0,e,!0),this.helperView.setUint32(4,Math.floor(e/2**32),!0),this.writer.write(this.helper)}writeAscii(e){this.writer.write(new TextEncoder().encode(e))}}/*!
902 * Copyright (c) 2026-present, Vanilagy and contributors
903 *
904 * This Source Code Form is subject to the terms of the Mozilla Public
905 * License, v. 2.0. If a copy of the MPL was not distributed with this
906 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
907 */class Vq extends oi{constructor(e,n){super(e),this.headerWritten=!1,this.dataSize=0,this.sampleRate=null,this.sampleCount=0,this.riffSizePos=null,this.dataSizePos=null,this.ds64RiffSizePos=null,this.ds64DataSizePos=null,this.ds64SampleCountPos=null,this.format=n,this.isRf64=!!n._options.large}async start(){const e=await this.mutex.acquire();this.writer=await this.output._getRootWriter(!1),this.riffWriter=new Wq(this.writer),e()}async getMimeType(){return"audio/wav"}async addEncodedVideoPacket(){throw new Error("WAVE does not support video.")}async addEncodedAudioPacket(e,n,r){const i=await this.mutex.acquire();try{if(this.headerWritten||(Li(r),b(r),b(r.decoderConfig),this.writeHeader(e,r.decoderConfig),this.sampleRate=r.decoderConfig.sampleRate,this.headerWritten=!0),this.validateTimestamp(e,n.timestamp,n.type==="
907key"),!this.isRf64&&this.writer.getPos()+n.data.byteLength>=2**32)throw new Error("Adding more audio data would exceed the maximum RIFF size of 4 GiB. To write larger files, use RF64 by setting `large: true` in the WavOutputFormatOptions.");this.writer.write(n.data),this.dataSize+=n.data.byteLength,this.sampleCount+=Math.round(n.duration*this.sampleRate),await this.writer.flush()}finally{i()}}async addSubtitleCue(){throw new Error("WAVE does not support subtitles.")}writeHeader(e,n){this.format._options.onHeader&&this.writer.startTrackingWrites();let r;const i=e.source._codec,s=sr(i);s.dataType==="ulaw"?r=Pn.MULAW:s.dataType==="alaw"?r=Pn.ALAW:s.dataType==="float"?r=Pn.IEEE_FLOAT:r=Pn.PCM;const a=n.numberOfChannels,o=n.sampleRate,c=s.sampleSize*a;if(this.riffWriter.writeAscii(this.isRf64?"RF64":"RIFF"),this.isRf64?this.riffWriter.writeU32(4294967295):(this.riffSizePos=this.writer.getPos(),this.riffWriter.writeU32(0)),this.riffWriter.writeAscii("WAVE"),this.isRf64&&(this.riffWriter.writeAscii("ds64"),this.riffWriter.writeU32(28),this.ds64RiffSizePos=this.writer.getPos(),this.riffWriter.writeU64(0),this.ds64DataSizePos=this.writer.getPos(),this.riffWriter.writeU64(0),this.ds64SampleCountPos=this.writer.getPos(),this.riffWriter.writeU64(0),this.riffWriter.writeU32(0)),this.riffWriter.writeAscii("fmt "),this.riffWriter.writeU32(16),this.riffWriter.writeU16(r),this.riffWriter.writeU16(a),this.riffWriter.writeU32(o),this.riffWriter.writeU32(o*c),this.riffWriter.writeU16(c),this.riffWriter.writeU16(8*s.sampleSize),!Cc(this.output._metadataTags)){const u=this.format._options.metadataFormat??"info";u==="info"?this.writeInfoChunk(this.output._metadataTags):u==="id3"?this.writeId3Chunk(this.output._metadataTags):rn(u)}if(this.riffWriter.writeAscii("data"),this.isRf64?this.riffWriter.writeU32(4294967295):(this.dataSizePos=this.writer.getPos(),this.riffWriter.writeU32(0)),this.format._options.onHeader){const{data:u,start:l}=this.writer.stopTrackingWrites();this.format._options.onHeader(u,l)}}writeInfoChunk(e){const n=this.writer.getPos();this.riffWriter.writeAscii("LIST"),this.riffWriter.writeU32(0),this.riffWriter.writeAscii("INFO");const r=new Set,i=(o,c)=>{if(!Yr(c)){console.warn(`Didn't write tag '${o}' because '${c}' is not ISO 8859-1-compatible.`);return}const u=c.length+1,l=new Uint8Array(u);for(let d=0;d<c.length;d++)l[d]=c.charCodeAt(d);this.riffWriter.writeAscii(o),this.riffWriter.writeU32(u),this.writer.write(l),u&1&&this.writer.write(new Uint8Array(1)),r.add(o)};for(const{key:o,value:c}of Qa(e))switch(o){case"title":i("INAM",c),r.add("INAM");break;case"artist":i("IART",c),r.add("IART");break;case"album":i("IPRD",c),r.add("IPRD");break;case"trackNumber":{const u=e.tracksTotal!==void 0?`${c}/${e.tracksTotal}`:c.toString();i("ITRK",u),r.add("ITRK")}break;case"genre":i("IGNR",c),r.add("IGNR");break;case"date":i("ICRD",c.toISOString().slice(0,10)),r.add("ICRD");break;case"comment":i("ICMT",c),r.add("ICMT");break;case"albumArtist":case"discNumber":case"tracksTotal":case"discsTotal":case"description":case"lyrics":case"images":break;case"raw":break;default:rn(o)}if(e.raw)for(const o in e.raw){const c=e.raw[o];c==null||o.length!==4||r.has(o)||typeof c=="string"&&i(o,c)}const s=this.writer.getPos(),a=s-n-8;this.writer.seek(n+4),this.riffWriter.writeU32(a),this.writer.seek(s),a&1&&this.writer.write(new Uint8Array(1))}writeId3Chunk(e){const n=this.writer.getPos();this.riffWriter.writeAscii("ID3 "),this.riffWriter.writeU32(0);const i=new fA(this.writer).writeId3V2Tag(e),s=this.writer.getPos();this.writer.seek(n+4),this.riffWriter.writeU32(i),this.writer.seek(s),i&1&&this.writer.write(new Uint8Array(1))}async finalize(){const e=await this.mutex.acquire(),n=this.writer.getPos();this.isRf64?(b(this.ds64RiffSizePos!==null),this.writer.seek(this.ds64RiffSizePos),this.riffWriter.writeU64(n-8),b(this.ds64DataSizePos!==null),this.writer.seek(this.ds64DataSizePos),this.riffWriter.writeU64(this.dataSize),b(this.ds64SampleCountPos!==null),this.writer.seek(this.ds64SampleCountPos),this.riffWriter.writeU64(this.sampleCount)):(b(this.riffSizePos!==null),this.writer.seek(this.riffSizePos),this.riffWriter.writeU32(n-8),b(this.dataSizePos!==null),this.writer.seek(this.dataSizePos),this.riffWriter.writeU32(this.dataSize)),e()}}/*!
908 * Copyright (c) 2026-present, Vanilagy and contributors
909 *
910 * This Source Code Form is subject to the terms of the Mozilla Public
911 * License, v. 2.0. If a copy of the MPL was not distributed with this
912 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
913 */class Sv{constructor(e){this.sourceSampleRate=null,this.sourceNumberOfChannels=null,this.maxWrittenFrame=null,this.targetSampleRate=e.targetSampleRate,this.targetNumberOfChannels=e.targetNumberOfChannels,this.endTime=e.endTime,this.onSample=e.onSample,this.bufferSizeInFrames=Math.floor(this.targetSampleRate*5),this.bufferSizeInSamples=this.bufferSizeInFrames*this.targetNumberOfChannels,this.outputBuffer=new Float32Array(this.bufferSizeInSamples),this.bufferStartFrame=Math.floor(e.startTime*this.targetSampleRate),this.timestampOffset=e.startTime-this.bufferStartFrame/this.targetSampleRate}doChannelMixerSetup(){b(this.sourceNumberOfChannels!==null);const e=this.sourceNumberOfChannels,n=this.targetNumberOfChannels;e===1&&n===2?this.channelMixer=(r,i)=>r[i*e]:e===1&&n===4?this.channelMixer=(r,i,s)=>r[i*e]*+(s<2):e===1&&n===6?this.channelMixer=(r,i,s)=>r[i*e]*+(s===2):e===2&&n===1?this.channelMixer=(r,i)=>{const s=i*e;return .5*(r[s]+r[s+1])}:e===2&&n===4?this.channelMixer=(r,i,s)=>r[i*e+s]*+(s<2):e===2&&n===6?this.channelMixer=(r,i,s)=>r[i*e+s]*+(s<2):e===4&&n===1?this.channelMixer=(r,i)=>{const s=i*e;return .25*(r[s]+r[s+1]+r[s+2]+r[s+3])}:e===4&&n===2?this.channelMixer=(r,i,s)=>{const a=i*e;return .5*(r[a+s]+r[a+s+2])}:e===4&&n===6?this.channelMixer=(r,i,s)=>{const a=i*e;return s<2?r[a+s]:s===2||s===3?0:r[a+s-2]}:e===6&&n===1?this.channelMixer=(r,i)=>{const s=i*e;return Math.SQRT1_2*(r[s]+r[s+1])+r[s+2]+.5*(r[s+4]+r[s+5])}:e===6&&n===2?this.channelMixer=(r,i,s)=>{const a=i*e;return r[a+s]+Math.SQRT1_2*(r[a+2]+r[a+s+4])}:e===6&&n===4?this.channelMixer=(r,i,s)=>{const a=i*e;return s<2?r[a+s]+Math.SQRT1_2*r[a+2]:r[a+s+2]}:this.channelMixer=(r,i,s)=>s<e?r[i*e+s]:0}ensureTempBufferSize(e){let n=this.tempSourceBuffer.length;for(;n<e;)n*=2;if(n!==this.tempSourceBuffer.length){const r=new Float32Array(n);r.set(this.tempSourceBuffer),this.tempSourceBuffer=r}}async add(e){this.sourceSampleRate===null&&(this.sourceSampleRate=e.sampleRate,this.sourceNumberOfChannels=e.numberOfChannels,this.tempSourceBuffer=new Float32Array(this.sourceSampleRate*this.sourceNumberOfChannels),this.doChannelMixerSetup());const n=e.numberOfFrames*e.numberOfChannels;this.ensureTempBufferSize(n);const r=e.allocationSize({planeIndex:0,format:"f32"}),i=new Float32Array(this.tempSourceBuffer.buffer,0,r/4);e.copyTo(i,{planeIndex:0,format:"f32"});const s=e.timestamp,a=Math.min(e.timestamp+e.duration,this.endTime),o=Math.floor(s*this.targetSampleRate),c=Math.ceil(a*this.targetSampleRate);for(let u=o;u<c;u++){if(u<this.bufferStartFrame)continue;for(;u>=this.bufferStartFrame+this.bufferSizeInFrames;)await this.finalizeCurrentBuffer(),this.bufferStartFrame+=this.bufferSizeInFrames;const l=u-this.bufferStartFrame;b(l<this.bufferSizeInFrames);const h=(u/this.targetSampleRate-s)*this.sourceSampleRate,m=Math.floor(h),p=Math.ceil(h),g=h-m;for(let A=0;A<this.targetNumberOfChannels;A++){let y=0,w=0;m>=0&&m<e.numberOfFrames&&(y=this.channelMixer(i,m,A)),p>=0&&p<e.numberOfFrames&&(w=this.channelMixer(i,p,A));const E=y+g*(w-y),S=l*this.targetNumberOfChannels+A;this.outputBuffer[S]+=E}this.maxWrittenFrame===null?this.maxWrittenFrame=l:this.maxWrittenFrame=Math.max(this.maxWrittenFrame,l)}}async finalizeCurrentBuffer(){if(this.maxWrittenFrame===null)return;const e=(this.maxWrittenFrame+1)*this.targetNumberOfChannels,n=new Float32Array(e);n.set(this.outputBuffer.subarray(0,e));const r=this.bufferStartFrame/this.targetSampleRate,i=new Wt({format:"f32",sampleRate:this.targetSampleRate,numberOfChannels:this.targetNumberOfChannels,timestamp:r+this.timestampOffset,data:n});await this.onSample(i),this.outputBuffer.fill(0),this.maxWrittenFrame=null}finalize(){return this.finalizeCurrentBuffer()}}/*!
914 * Copyright (c) 2026-present, Vanilagy and contributors
915 *
916 * This Source Code Form is subject to the terms of the Mozilla Public
917 * License, v. 2.0. If a copy of the MPL was not distributed with this
918 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
919 */class of{constructor(){this._connectedTrack=null,this._closingPromise=null,this._closed=!1}
919_ensureValidAdd(){if(!this._connectedTrack)throw new Error("Source is not connected to an output track.");if(this._connectedTrack.output.state==="canceled")throw new Error("Output has been canceled.");if(this._connectedTrack.output.state==="finalizing"||this._connectedTrack.output.state==="finalized")throw new Error("Output has been finalized.");if(this._connectedTrack.output.state==="pending")throw new Error("Output has not started.");if(this._closed)throw new Error("Source is closed.")}async _start(){}async _flushAndClose(e){}close(){if(this._closingPromise)return;const e=this._connectedTrack;if(!e)throw new Error("Cannot call close without connecting the source to an output track.");if(e.output.state==="pending")throw new Error("Cannot call close before output has been started.");this._closingPromise=(async()=>{await this._flushAndClose(!1),this._closed=!0,!(e.output.state==="finalizing"||e.output.state==="finalized")&&e.output._muxer.onTrackClose(e)})()}async _flushOrWaitForOngoingClose(e){return this._closingPromise??(this._closingPromise=(async()=>{await this._flushAndClose(e),this._closed=!0})())}}class po extends of{constructor(e){if(super(),this._connectedTrack=null,!xt.includes(e))throw new TypeError(`Invalid video codec '${e}'. Must be one of: ${xt.join(", ")}.`);this._codec=e}}const _A=(t,e)=>{if(t.metadata.hasOnlyKeyPackets&&e.type!=="key")throw new Error("Cannot add non-key packets to a hasOnlyKeyPackets video track.")};class TA extends po{constructor(e){super(e)}add(e,n){if(!(e instanceof nt))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be added.");if(n!==void 0&&(!n||typeof n!="object"))throw new TypeError("meta, when provided, must be an object.");return this._ensureValidAdd(),_A(this._connectedTrack,e),this._connectedTrack.output._muxer.addEncodedVideoPacket(this._connectedTrack,e,n)}}class kA{constructor(e,n){this.source=e,this.encodingConfig=n,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastMultipleOfKeyFrameInterval=-1,this.emittedEncoderPackets=0,this.codedWidth=null,this.co
919dedHeight=null,this.outputWidth=null,this.outputHeight=null,this.frameRateLastSample=null,this.frameRateLastTimestamp=null,this.frameRateLastEndTimestamp=null,this.preciseTimings=[],this.customEncoder=null,this.customEncoderCallSerializer=new Ec,this.customEncoderQueueSize=0,this.alphaEncoder=null,this.splitter=null,this.splitterCreationFailed=!1,this.alphaFrameQueue=[],this.error=null,this.lastMuxerPromise=Promise.resolve()}async add(e,n,r){var s,a,o,c,u,l,d,f,h,m,p,g;const i=e;try{this.checkForEncoderError(),this.source._ensureValidAdd();const A=this.encodingConfig,y=A.sizeChangeBehavior??"deny";let w=!1;if(this.codedWidth!==null&&this.codedHeight!==null){if((e.codedWidth!==this.codedWidth||e.codedHeight!==this.codedHeight)&&(w=!0,y==="deny"))throw new Error(`Video sample size must remain constant. Expected ${this.codedWidth}x${this.codedHeight}, got ${e.codedWidth}x${e.codedHeight}. To allow the sample size to change over time, set \`sizeChangeBehavior\` to a value other than 'deny' in the encoding options.`)}else this.codedWidth=e.codedWidth,this.codedHeight=e.codedHeight;if(((s=A.transform)==null?void 0:s.width)!==void 0||((a=A.transform)==null?void 0:a.height)!==void 0||((o=A.transform)==null?void 0:o.rotate)!==void 0||((c=A.transform)==null?void 0:c.crop)!==void 0||((u=A.transform)==null?void 0:u.force)===!0||w&&y!=="passThrough"){let T=(l=A.transform)==null?void 0:l.width,C=(d=A.transform)==null?void 0:d.height,_=((f=A.transform)==null?void 0:f.fit)??"fill";w&&y!=="passThrough"&&(b(this.outputWidth),b(this.outputHeight),b(y!=="deny"),T=this.outputWidth,C=this.outputHeight,_=y);const x=await e.transform({width:T,height:C,roundDimensionsTo:2,crop:(h=A.transform)==null?void 0:h.crop,rotate:(m=A.transform)==null?void 0:m.rotate,fit:_,alpha:A.alpha});(this.outputWidth===null||this.outputHeight===null)&&(this.outputWidth=x.displayWidth,this.outputHeight=x.displayHeight),n&&e.close(),e=x,n=!0}else(this.outputWidth===null||this.outputHeight===null)&&(this.outputWidth=e.codedWidth,this.outputHeight=e.codedHeight);const k=(p=A.transform)==null?void 0:p.frameRate;if(k!==void 0){const T=e.timestamp+e.duration,C=hI(e.timestamp,k);if(this.frameRateLastSample!==null)if(C<=this.frameRateLastTimestamp){this.frameRateLastSample.close(),this.frameRateLastSample=e.clone(),this.frameRateLastEndTimestamp=T;return}else await this.padFrameRate(C,r);e===i&&(e=e.clone(),n=!0),e.setTimestamp(C),e.setDuration(1/k),(g=this.frameRateLastSample)==null||g.close(),this.frameRateLastSample=e.clone(),this.frameRateLastTimestamp=C,this.frameRateLastEndTimestamp=T}await this.processAndEncode(e,r)}finally{n&&e.close()}}async processAndEncode(e,n){var s;const r=this.encodingConfig;let i;if((s=r.transform)!=null&&s.process){let a=r.transform.process(e);if(a instanceof Promise&&(a=await a),a===null)return;Array.isArray(a)||(a=[a]),i=a.map(o=>o instanceof Ft?o:typeof VideoFrame<"u"&&o instanceof VideoFrame?new Ft(o):new Ft(o,{timestamp:e.timestamp,duration:e.duration}))}else i=[e];try{for(const a of i){this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(a),this.encoderInitialized||await this.ensureEncoderPromise),b(this.encoderInitialized);const o=this.encodingConfig.keyFrameInterval??2,c=Math.floor(a.timestamp/o),u={...n,keyFrame:(n==null?void 0:n.keyFrame)||o===0||c!==this.lastMultipleOfKeyFrameInterval};if(this.lastMultipleOfKeyFrameInterval=c,this.customEncoder){this.customEncoderQueueSize++;const l=a.clone(),d=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(l,u)).then(()=>this.customEncoderQueueSize--).catch(f=>this.error??(this.error=f)).finally(()=>{l.close()});this.customEncoderQueueSize>=4&&await d}else{b(this.encoder);const l=a.toVideoFrame(),d=Ge(this.preciseTimings,l.timestamp,h=>h.microsecondTimestamp),f=d!==-1?this.preciseTimings[d]:null;if(f&&f.microsecondTimestamp===l.timestamp?(f.timestamp!==a.timestamp&&(f.timestampIsValid=!1),f.duration!==a.duration&&(f.durationIsValid=!1)):(this.preciseTimings.splice(d+1,0,{microsecondTimestamp:l.timestamp,timestamp:a.timestamp,duration:a.duration,timestampIsValid:!0,durationIsValid:!0}),this.preciseTimings.length>128&&this.preciseTimings.shift()),!this.alphaEncoder)this.encoder.encode(l,u),l.close();else if(!!l.format&&!l.format.includes("A")||this.splitterCreationFailed)this.alphaFrameQueue.push(null),this.encoder.encode(l,u),l.close();else{const m=l.displayWidth,p=l.displayHeight;this.splitter||(this.splitter=new cf(m,p));const{colorFrame:g,alphaFrame:A}=await this.splitter.update(l);this.alphaFrameQueue.push(A),this.encoder.encode(g,u),g.close()}this.encoder.encodeQueueSize>=4&&await new Promise(h=>this.encoder.addEventListener("dequeue",h,{once:!0}))}await this.lastMuxerPromise}}finally{for(const a of i)a!==e&&a.close()}}async padFrameRate(e,n){const r=this.encodingConfig.transform.frameRate;b(this.frameRateLastSample);const i=Math.round((e-this.frameRateLastTimestamp)*r);for(let s=1;s<i;s++){const a=this.frameRateLastSample.clone();a.setTimestamp(this.frameRateLastTimestamp+s/r),a.setDuration(1/r),await this.processAndEncode(a,n),a.close()}}ensureEncoder(e){this.ensureEncoderPromise=(async()=>{var i,s,a;const n=Fx({...this.encodingConfig,width:e.codedWidth,height:e.codedHeight,squarePixelWidth:e.squarePixelWidth,squarePixelHeight:e.squarePixelHeight,framerate:(i=this.source._connectedTrack)==null?void 0:i.metadata.frameRate});(a=(s=this.encodingConfig).onEncoderConfig)==null||a.call(s,n);const r=Kd.find(o=>o.supports(this.encodingConfig.codec,n));if(r)this.customEncoder=new r,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=n,this.customEncoder.onPacket=(o,c)=>{var u,l;if(!(o instanceof nt))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(c!==void 0&&(!c||typeof c!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");_A(this.source._connectedTrack,o),(l=(u=this.encodingConfig).onEncodedPacket)==null||l.call(u,o,c),this.lastMuxerPromise=this.muxer.addEncodedVideoPacket(this.source._connectedTrack,o,c).catch(d=>{this.error??(this.error=d)})},await this.customEncoder.init();else{if(typeof VideoEncoder>"u")throw new Error("VideoEncoder is not supported by this browser.");if(n.alpha="discard",this.encodingConfig.alpha==="keep"&&(n.latencyMode="quality"),(n.width%2===1||n.height%2===1)&&(this.encodingConfig.codec==="avc"||this.encodingConfig.codec==="hevc"))throw new Error(`The dimensions ${n.width}x${n.height} are not supported for codec '${this.encodingConfig.codec}'; both width and height must be even numbers. Make sure to round your dimensions to the nearest even number.`);if(!(await VideoEncoder.isConfigSupported(n)).supported)throw new Error(`This specific encoder configuration (${n.codec}, ${n.bitrate} bps, ${n.width}x${n.height}, hardware acceleration: ${n.hardwareAcceleration??"no-preference"}) is not supported by this browser. Consider using another codec or changing your video parameters.`);const u=[],l=[];let d=0,f=0;const h=(p,g,A)=>{var T,C;const y={};if(g){const _=new Uint8Array(g.byteLength);g.copyTo(_),y.alpha=_}
919let w=nt.fromEncodedChunk(p,y);const E=Ge(this.preciseTimings,p.timestamp,_=>_.microsecondTimestamp),S=E!==-1?this.preciseTimings[E]:null;let k=null;this.emittedEncoderPackets===0&&w.type==="delta"&&(A!=null&&A.decoderConfig)&&(k=vd(this.encodingConfig.codec,A.decoderConfig,w.data)),(S&&S.microsecondTimestamp===p.timestamp||k!==null)&&(w=w.clone({timestamp:S!=null&&S.timestampIsValid?S.timestamp:void 0,duration:S!=null&&S.durationIsValid?S.duration:void 0,type:k??void 0})),_A(this.source._connectedTrack,w),(C=(T=this.encodingConfig).onEncodedPacket)==null||C.call(T,w,A),this.lastMuxerPromise=this.muxer.addEncodedVideoPacket(this.source._connectedTrack,w,A).catch(_=>{this.error??(this.error=_)}),this.emittedEncoderPackets++},m=new Error("Encoding error").stack;if(this.encoder=new VideoEncoder({output:(p,g)=>{if(!this.alphaEncoder){h(p,null,g);return}const A=this.alphaFrameQueue.shift();b(A!==void 0),A?(this.alphaEncoder.encode(A,{keyFrame:p.type==="key"}),f++,A.close(),u.push({chunk:p,meta:g})):f===0?h(p,null,g):(l.push(d+f),u.push({chunk:p,meta:g}))},error:p=>{p.stack=m,this.error??(this.error=p)}}),this.encoder.configure(n),this.encodingConfig.alpha==="keep"){const p=new Error("Encoding error").stack;this.alphaEncoder=new VideoEncoder({output:(g,A)=>{f--;const y=u.shift();for(b(y!==void 0),h(y.chunk,g,y.meta),d++;l.length>0&&l[0]===d;){l.shift();const w=u.shift();b(w!==void 0),h(w.chunk,null,w.meta)}},error:g=>{g.stack=p,this.error??(this.error=g)}}),this.alphaEncoder.configure(n)}}b(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}async flushAndClose(e){var n,r,i;if(e||this.checkForEncoderError(),!e&&this.frameRateLastSample){const s=this.encodingConfig.transform.frameRate,a=hI(this.frameRateLastEndTimestamp,s);await this.padFrameRate(a)}(n=this.frameRateLastSample)==null||n.close(),this.frameRateLastSample=null,this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||(await this.encoder.flush(),await((r=this.alphaEncoder)==null?void 0:r.flush())),this.encoder.state!=="closed"&&this.encoder.close(),this.alphaEncoder&&this.alphaEncoder.state!=="closed"&&this.alphaEncoder.close(),this.alphaFrameQueue.forEach(s=>s==null?void 0:s.close()),(i=this.splitter)==null||i.close()),e||this.checkForEncoderError()}getQueueSize(){var e;return this.customEncoder?this.customEncoderQueueSize:((e=this.encoder)==null?void 0:e.encodeQueueSize)??0}checkForEncoderError(){if(this.error)throw this.error}}let _v=!1;class cf{constructor(e,n){this.canvas=null,this.gl=null,this.colorProgram=null,this.alphaProgram=null,this.vao=null,this.sourceTexture=null,this.alphaResolutionLocation=null,this.worker=null,this.pendingRequests=new Map,this.nextRequestId=0;const r=typeof OffscreenCanvas<"u"||typeof document<"u"&&typeof document.createElement=="function";if(!cf.forceCpu&&r&&!_v)try{typeof OffscreenCanvas<"u"?this.canvas=new OffscreenCanvas(e,n):(this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=n);const i=this.canvas.getContext("webgl2",{alpha:!0});if(!i)throw new Error("Couldn't acquire WebGL 2 context.");this.gl=i,this.colorProgram=this.createColorProgram(),this.alphaProgram=this.createAlphaProgram(),this.vao=this.createVAO(),this.sourceTexture=this.createTexture(),this.alphaResolutionLocation=this.gl.getUniformLocation(this.alphaProgram,"u_resolution"),this.gl.useProgram(this.colorProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.colorProgram,"u_sourceTexture"),0),this.gl.useProgram(this.alphaProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.alphaProgram,"u_sourceTexture"),0)}catch(i){this.gl=null,this.canvas=null,_v=!0,console.warn("Falling back to CPU for color/alpha splitting.",i)}}async update(e){return this.gl?this.updateGpu(e):this.updateCpu(e)}updateGpu(e){b(this.gl),b(this.canvas),(e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.sourceTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e);const n=this.runColorProgram(e),r=this.runAlphaProgram(e);return e.close(),{colorFrame:n,alphaFrame:r}}createVertexShader(){return b(this.gl),this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
920			in vec2 a_position;
921			in vec2 a_texCoord;
922			out vec2 v_texCoord;
923			
924			void main() {
925				gl_Position = vec4(a_position, 0.0, 1.0);
926				v_texCoord = a_texCoord;
927			}
928		`)}createColorProgram(){b(this.gl);const e=this.createVertexShader(),n=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
929			precision highp float;
930			
931			uniform sampler2D u_sourceTexture;
932			in vec2 v_texCoord;
933			out vec4 fragColor;
934			
935			void main() {
936				vec4 source = texture(u_sourceTexture, v_texCoord);
937				fragColor = vec4(source.rgb, 1.0);
938			}
939		`),r=this.gl.createProgram();return this.gl.attachShader(r,e),this.gl.attachShader(r,n),this.gl.linkProgram(r),r}createAlphaProgram(){b(this.gl);const e=this.createVertexShader(),n=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
940			precision highp float;
941			
942			uniform sampler2D u_sourceTexture;
943			uniform vec2 u_resolution; // The width and height of the canvas
944			in vec2 v_texCoord;
945			out vec4 fragColor;
946
947			// This function determines the value for a single byte in the YUV stream
948			float getByteValue(float byteOffset) {
949				float width = u_resolution.x;
950				float height = u_resolution.y;
951
952				float yPlaneSize = width * height;
953
954				if (byteOffset < yPlaneSize) {
955					// This byte is in the luma plane. Find the corresponding pixel coordinates to sample from
956					float y = floor(byteOffset / width);
957					float x = mod(byteOffset, width);
958					
959					// Add 0.5 to sample the center of the texel
960					vec2 sampleCoord = (vec2(x, y) + 0.5) / u_resolution;
961					
962					// The luma value is the alpha from the source texture
963					return texture(u_sourceTexture, sampleCoord).a;
964				} else {
965					// Write a fixed value for chroma and beyond
966					return 128.0 / 255.0;
967				}
968			}
969			
970			void main() {
971				// Each fragment writes 4 bytes (R, G, B, A)
972				float pixelIndex = floor(gl_FragCoord.y) * u_resolution.x + floor(gl_FragCoord.x);
973				float baseByteOffset = pixelIndex * 4.0;
974
975				vec4 result;
976				for (int i = 0; i < 4; i++) {
977					float currentByteOffset = baseByteOffset + float(i);
978					result[i] = getByteValue(currentByteOffset);
979				}
980				
981				fragColor = result;
982			}
983		`),r=this.gl.createProgram();return this.gl.attachShader(r,e),this.gl.attachShader(r,n),this.gl.linkProgram(r),r}createShader(e,n){b(this.gl);const r=this.gl.createShader(e);return this.gl.shaderSource(r,n),this.gl.compileShader(r),this.gl.getShaderParameter(r,this.gl.COMPILE_STATUS)||console.error("Shader compile error:",this.gl.getShaderInfoLog(r)),r}createVAO(){b(this.gl),b(this.colorProgram);const e=this.gl.createVertexArray();this.gl.bindVertexArray(e);const n=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),r=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,r),this.gl.bufferData(this.gl.ARRAY_BUFFER,n,this.gl.STATIC_DRAW);const i=this.gl.getAttribLocation(this.colorProgram,"a_position"),s=this.gl.getAttribLocation(this.colorProgram,"a_texCoord");return this.gl.enableVertexAttribArray(i),this.gl.vertexAttribPointer(i,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(s),this.gl.vertexAttribPointer(s,2,this.gl.FLOAT,!1,16,8),e}createTexture(){b(this.gl);const e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}runColorProgram(e){return b(this.gl),b(this.canvas),this.gl.useProgram(this.colorProgram),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),new VideoFrame(this.canvas,{timestamp:e.timestamp,duration:e.duration??void 0,alpha:"discard"})}runAlphaProgram(e){b(this.gl),b(this.canvas),this.gl.useProgram(this.alphaProgram),this.gl.uniform2f(this.alphaResolutionLocation,this.canvas.width,this.canvas.height),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const{width:n,height:r}=this.canvas,i=Math.ceil(n/2)*Math.ceil(r/2),s=n*r+i*2,a=Math.ceil(s/(n*4));let o=new Uint8Array(4*n*a);this.gl.readPixels(0,0,n,a,this.gl.RGBA,this.gl.UNSIGNED_BYTE,o),o=o.subarray(0,s),b(o[n*r]===128),b(o[o.length-1]===128);
983const c={format:"I420",codedWidth:n,codedHeight:r,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[o.buffer]};return new VideoFrame(o,c)}updateCpu(e){if(!this.worker){const i=new Blob([`(${Gq.toString()})()`],{type:"application/javascript"}),s=URL.createObjectURL(i);this.worker=new Worker(s),URL.revokeObjectURL(s),this.worker.addEventListener("message",a=>{const o=a.data,c=this.pendingRequests.get(o.id);c&&(this.pendingRequests.delete(o.id),"error"in o?c.reject(new Error(o.error)):c.resolve({colorFrame:o.colorFrame,alphaFrame:o.alphaFrame}))}),this.worker.addEventListener("error",a=>{const o=new Error(a.message||"Color/alpha splitter worker error.");for(const c of this.pendingRequests.values())c.reject(o);this.pendingRequests.clear()})}const n=this.nextRequestId++,r=wt();return this.pendingRequests.set(n,r),this.worker.postMessage({id:n,sourceFrame:e},{transfer:[e]}),r.promise}close(){var n,r,i;(r=(n=this.gl)==null?void 0:n.getExtension("WEBGL_lose_context"))==null||r.loseContext(),this.gl=null,this.canvas=null,(i=this.worker)==null||i.terminate(),this.worker=null;const e=new Error("Color/alpha splitter closed.");for(const s of this.pendingRequests.values())s.reject(e);this.pendingRequests.clear()}}cf.forceCpu=!0;const Gq=()=>{let t=null,e=Promise.resolve();self.addEventListener("message",s=>{const{id:a,sourceFrame:o}=s.data;e=e.then(async()=>{try{const{colorFrame:c,alphaFrame:u}=await n(o);self.postMessage({id:a,colorFrame:c,alphaFrame:u},{transfer:[c,u]})}catch(c){self.postMessage({id:a,error:c.message})}finally{o.close()}})});const n=async s=>{const a=s.format;if(!a)throw new Error("CPU color/alpha splitting requires a known VideoFrame format.");const o=s.codedWidth,c=s.codedHeight,u=s.allocationSize();if((!t||t.byteLength!==u)&&(t=new Uint8Array(u)),await s.copyTo(t),a==="RGBA"||a==="BGRA")return r(t,o,c,a,s);if(a==="I420A"||a==="I420AP10"||a==="I420AP12"||a==="I422A"||a==="I422AP10"||a==="I422AP12"||a==="I444A"||a==="I444AP10"||a==="I444AP12")return i(t,o,c,a,s);throw new Error(`CPU color/alpha splitting does not support format '${a}'.`)},r=(s,a,o,c,u)=>{const l=a*o,d=Math.ceil(a/2),f=Math.ceil(o/2),h=l+d*f*2,m=new Uint8Array(h);for(let y=0,w=3;y<l;y++,w+=4)m[y]=s[w];m.fill(128,l);const p=new VideoFrame(s,{format:c==="RGBA"?"RGBX":"BGRX",codedWidth:a,codedHeight:o,timestamp:u.timestamp,duration:u.duration??void 0}),g={format:"I420",codedWidth:a,codedHeight:o,timestamp:u.timestamp,duration:u.duration??void 0,transfer:[m.buffer]},A=new VideoFrame(m,g);return{colorFrame:p,alphaFrame:A}},i=(s,a,o,c,u)=>{const l=c.includes("P10"),d=c.includes("P12"),f=l||d?2:1;let h,m;c.startsWith("I420")?(h=Math.ceil(a/2),m=Math.ceil(o/2)):c.startsWith("I422")?(h=Math.ceil(a/2),m=o):(h=a,m=o);const p=a*o,g=h*m,A=p*f,y=g*f,w=p*f,E=A+y*2,S=c.replace("A",""),k=Math.ceil(a/2),T=Math.ceil(o/2),C=k*T,_=C*f,x=w+2*_,P=new Uint8Array(x),v=E;P.set(s.subarray(v,v+w),0);const M=w,D=l?512:d?2048:128;f===1?P.fill(D,M):new Uint16Array(P.buffer,M,2*C).fill(D);const O=l?"I420P10":d?"I420P12":"I420",N=new VideoFrame(s.subarray(0,E),{format:S,codedWidth:a,codedHeight:o,timestamp:u.timestamp,duration:u.duration??void 0}),Q={format:O,codedWidth:a,codedHeight:o,timestamp:u.timestamp,duration:u.duration??void 0,transfer:[P.buffer]},G=new VideoFrame(P,Q);return{colorFrame:N,alphaFrame:G}}};class IA extends po{constructor(e){eA(e),super(e.codec),this._encoder=new kA(this,e)}add(e,n){if(!(e instanceof Ft))throw new TypeError("videoSample must be a VideoSample.");return this._encoder.add(e,!1,n)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class qq extends po{constructor(e,n){if(!(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas))throw new TypeError("canvas must be an HTMLCanvasElement or OffscreenCanvas.");eA(n),super(n.codec),this._encoder=new kA(this,n),this._canvas=e}add(e,n=0,r){if(!Number.isFinite(e)||e<0)throw new TypeError("timestamp must be a non-negative number.");if(!Number.isFinite(n)||n<0)throw new TypeError("duration must be a non-negative number.");const i=new Ft(this._canvas,{timestamp:e,duration:n});
983return this._encoder.add(i,!0,r)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class Yq extends po{get errorPromise(){return this._errorPromiseAccessed=!0,this._promiseWithResolvers.promise}get paused(){return this._paused}constructor(e,n,r={}){if(!(e instanceof MediaStreamTrack)||e.kind!=="video")throw new TypeError("track must be a video MediaStreamTrack.");if(eA(n),typeof r!="object"||!r)throw new TypeError("options must be an object.");if(r.frameRate!=null&&(typeof r.frameRate!="number"||r.frameRate<=0))throw new TypeError("options.frameRate, when provided, must be either a positive number or null.");if(r.timestampBase!==void 0&&r.timestampBase!=="synced-zero"&&r.timestampBase!=="zero"&&r.timestampBase!=="unix")throw new TypeError("options.timestampBase, when provided, must be one of 'synced-zero', 'zero', or 'unix'.");n={...n,latencyMode:"realtime"},super(n.codec),this._abortController=null,this._workerTrackId=null,this._workerListener=null,this._promiseWithResolvers=wt(),this._errorPromiseAccessed=!1,this._paused=!1,this._lastVideoFrame=null,this._timerHandle=null,this._videoElement=null,this._options=r,this._encoder=new kA(this,n),this._track=e}async _start(){this._errorPromiseAccessed||console.warn("Make sure not to ignore the `errorPromise` field on MediaStreamVideoTrackSource, so that any internal errors get bubbled up properly.");const e=this._options.frameRate!==void 0?this._options.frameRate:this._track.getSettings().frameRate??null;this._abortController=new AbortController;let n=null,r=null,i=0,s=!1,a=null,o=0;const c=()=>{if(b(e!==null),!this._lastVideoFrame)return;b(r!==null),b(n!==null);const d=performance.now();for(;d-r>1e3/e;){r+=1e3/e;const f=n+i/e,h=new VideoFrame(this._videoElement??this._lastVideoFrame,{timestamp:1e6*f,duration:1e6/e});l(h,d)}};e!==null&&(this._timerHandle=WW(c,4));const u=d=>{var f;if(e===null)l(d);else{const h=performance.now();this._lastVideoFrame?(c(),(f=this._lastVideoFrame)==null||f.close(),this._lastVideoFrame=d):(l(d.clone(),h),r=h,this._lastVideoFrame=d)}},l=(d,f=performance.now())=>{if(s){d.close();return}i++;const h=d.timestamp/1e6;if(this._paused){if(n!==null){if(a!==null&&this._options.timestampBase!=="unix"){const g=h-a;o-=g}a=h}d.close();return}if(n===null){n=h;let p;const g=this._options.timestampBase??"synced-zero";if(g==="unix")p=Date.now()/1e3;else if(g==="zero")p=0;else{const A=this._connectedTrack.output;A._firstMediaStreamTimestamp===null?(A._firstMediaStreamTimestamp=f/1e3,p=0):p=f/1e3-A._firstMediaStreamTimestamp}o=p-n}if(a=h,this._encoder.getQueueSize()>=8){d.close();return}const m=new Ft(d,{timestamp:h+o});this._encoder.add(m,!0).catch(p=>{var g;s=!0,(g=this._abortController)==null||g.abort(),this._promiseWithResolvers.reject(p),this._workerTrackId!==null&&PA({type:"stopTrack",trackId:this._workerTrackId})})};if(typeof MediaStreamTrackProcessor<"u"){const d=new MediaStreamTrackProcessor({track:this._track}),f=new WritableStream({write:u});d.readable.pipeTo(f,{signal:this._abortController.signal}).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||this._promiseWithResolvers.reject(h)})}else if(await Zq())this._workerTrackId=Xq++,PA({type:"videoTrack",trackId:this._workerTrackId,track:this._track}),this._workerListener=f=>{const h=f.data;h.type==="videoFrame"&&h.trackId===this._workerTrackId?u(h.videoFrame):h.type==="error"&&h.trackId===this._workerTrackId&&this._promiseWithResolvers.reject(h.error)},dr.addEventListener("message",this._workerListener);else if(e!==null){const f=document.createElement("video");f.style.position="fixed",f.style.left="-10000px",f.style.top="-10000px",f.style.width="1px",f.style.height="1px",f.style.opacity="0",f.style.pointerEvents="none",f.muted=!0,f.srcObject=new MediaStream([this._track]),document.body.appendChild(f),this._videoElement=f,f.addEventListener("loadeddata",()=>{if(s||!this._videoElement)return;const h=new VideoFrame(f,{timestamp:1e3*performance.now()});u(h),h.close()},{once:!0}),f.play().catch(h=>{s=!0,this._promiseWithResolvers.reject(h)})}else throw new Error("When no explicit frame rate is set, MediaStreamTrackProcessor is required; but it's not supported by this browser.")}pause(){this._paused=!0}resume(){this._paused=!1}async _flushAndClose(e){var n;this._abortController&&(this._abortController.abort(),this._abortController=null),this._timerHandle&&VW(this._timerHandle),(n=this._lastVideoFrame)==null||n.close(),this._videoElement&&(this._videoElement.srcObject=null,this._videoElement.remove(),this._videoElement=null),this._workerTrackId!==null&&(b(this._workerListener),PA({type:"stopTrack",trackId:this._workerTrackId}),await new Promise(r=>{const i=s=>{const a=s.data;a.type==="trackStopped"&&a.trackId===this._workerTrackId&&(b(this._workerListener),dr.removeEventListener("message",this._workerListener),dr.removeEventListener("message",i),r())};dr.addEventListener("message",i)})),await this._encoder.flushAndClose(e)}}class mo extends of{constructor(e){if(super(),this._connectedTrack=null,!Ut.includes(e))throw new TypeError(`Invalid audio codec '${e}'. Must be one of: ${Ut.join(", ")}.`);this._codec=e}}class CA extends mo{constructor(e){super(e)}add(e,n){if(!(e instanceof nt))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be added.");if(n!==void 0&&(!n||typeof n!="object"))throw new TypeError("meta, when provided, must be an object.");return this._ensureValidAdd(),this._connectedTrack.output._muxer.addEncodedAudioPacket(this._connectedTrack,e,n)}}class xA{constructor(e,n){this.source=e,this.encodingConfig=n,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastNumberOfChannels=null,this.lastSampleRate=null,this.isPcmEncoder=!1,this.outputSampleSize=null,this.writeOutputValue=null,this.customEncoder=null,this.customEncoderCallSerializer
983=new Ec,this.customEncoderQueueSize=0,this.lastEndSampleIndex=null,this.resampler=null,this.error=null,this.lastMuxerPromise=Promise.resolve()}async add(e,n){var r,i;try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.lastNumberOfChannels!==null&&this.lastSampleRate!==null){if(e.numberOfChannels!==this.lastNumberOfChannels||e.sampleRate!==this.lastSampleRate)throw new Error(`Audio parameters must remain constant. Expected ${this.lastNumberOfChannels} channels at ${this.lastSampleRate} Hz, got ${e.numberOfChannels} channels at ${e.sampleRate} Hz.`)}else this.lastNumberOfChannels=e.numberOfChannels,this.lastSampleRate=e.sampleRate;const s=this.encodingConfig;((r=s.transform)==null?void 0:r.numberOfChannels)!==void 0||((i=s.transform)==null?void 0:i.sampleRate)!==void 0?(this.resampler||(this.resampler=new Sv({targetNumberOfChannels:s.transform.numberOfChannels??e.numberOfChannels,targetSampleRate:s.transform.sampleRate??e.sampleRate,startTime:e.timestamp,endTime:1/0,onSample:async o=>{await this.processAndEncode(o,!0)}})),await this.resampler.add(e)):await this.processAndEncode(e,n)}finally{n&&e.close()}}async processAndEncode(e,n){var i,s;const r=this.encodingConfig;if(((i=r.transform)==null?void 0:i.sampleFormat)!==void 0&&Bx(e.format)!==r.transform.sampleFormat){const a=Px(e,r.transform.sampleFormat);n&&e.close(),e=a,n=!0}if((s=r.transform)!=null&&s.process){let a=r.transform.process(e);if(a instanceof Promise&&(a=await a),a===null)return;Array.isArray(a)||(a=[a]);for(const o of a){if(!(o instanceof Wt))throw new TypeError("The audio process function must return an AudioSample, null, or an array of AudioSamples.");await this.encodeSample(o,!0)}n&&e.close()}else await this.encodeSample(e,n)}async encodeSample(e,n){try{this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),b(this.encoderInitialized);{const r=Math.round(e.timestamp*e.sampleRate),i=Math.round((e.timestamp+e.duration)*e.sampleRate);if(this.lastEndSampleIndex===null)this.lastEndSampleIndex=i;else{const s=r-this.lastEndSampleIndex;if(s>=64){const a=new Wt({data:new Float32Array(s*e.numberOfChannels),format:"f32-planar",sampleRate:e.sampleRate,numberOfChannels:e.numberOfChannels,numberOfFrames:s,timestamp:this.lastEndSampleIndex/e.sampleRate});await this.encodeSample(a,!0)}this.lastEndSampleIndex+=e.numberOfFrames}}if(this.customEncoder){this.customEncoderQueueSize++;const r=e.clone(),i=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(r)).then(()=>this.customEncoderQueueSize--).catch(s=>this.error??(this.error=s)).finally(()=>{r.close()});this.customEncoderQueueSize>=4&&await i,await this.lastMuxerPromise}else if(this.isPcmEncoder)await this.doPcmEncoding(e,n);else{b(this.encoder);const r=e.toAudioData();this.encoder.encode(r),r.close(),n&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(i=>this.encoder.addEventListener("dequeue",i,{once:!0})),await this.lastMuxerPromise}}finally{n&&e.close()}}async doPcmEncoding(e,n){var f,h;b(this.outputSampleSize),b(this.writeOutputValue);const{numberOfChannels:r,numberOfFrames:i,sampleRate:s,timestamp:a}=e,o=2048,c=[];for(let m=0;m<i;m+=o){const p=Math.min(o,e.numberOfFrames-m),g=p*r*this.outputSampleSize,A=new ArrayBuffer(g),y=new DataView(A);c.push({frameCount:p,view:y})}const u=e.allocationSize({planeIndex:0,format:"f32-planar"}),l=new Float32Array(u/Float32Array.BYTES_PER_ELEMENT);for(let m=0;m<r;m++){e.copyTo(l,{planeIndex:m,format:"f32-planar"});for(let p=0;p<c.length;p++){const{frameCount:g,view:A}=c[p];for(let y=0;y<g;y++)this.writeOutputValue(A,(y*r+m)*this.outputSampleSize,l[p*o+y])}}n&&e.close();const d={decoderConfig:{codec:this.encodingConfig.codec,numberOfChannels:r,sampleRate:s}};for(let m=0;m<c.length;m++){const{frameCount:p,view:g}=c[m],A=g.buffer,y=m*o,w=new nt(new Uint8Array(A),"key",a+y/s,p/s);(h=(f=this.encodingConfig).onEncodedPacket)==null||h.call(f,w,d),await this.muxer.addEncodedAudioPacket(this.source._connectedTrack,w,d)}}ensureEncoder(e){this.ensureEncoderPromise=(async()=>{var a,o;const{numberOfChannels:n,sampleRate:r}=e,i=Dx({numberOfChannels:n,sampleRate:r,...this.encodingConfig});(o=(a=this.encodingConfig).onEncoderConfig)==null||o.call(a,i);const s=jd.find(c=>c.supports(this.encodingConfig.codec,i));if(s)this.customEncoder=new s,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=i,this.customEncoder.onPacket=(c,u)=>{var l,d;if(!(c instanceof nt))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(u!==void 0&&(!u||typeof u!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");(d=(l=this.encodingConfig).onEncodedPacket)==null||d.call(l,c,u),this.lastMuxerPromise=this.muxer.addEncodedAudioPacket(this.source._connectedTrack,c,u).cat
983ch(f=>{this.error??(this.error=f)})},await this.customEncoder.init();else if(Nt.includes(this.encodingConfig.codec))this.initPcmEncoder();else{if(typeof AudioEncoder>"u")throw new Error("AudioEncoder is not supported by this browser.");if(!(await AudioEncoder.isConfigSupported(i)).supported)throw new Error(`This specific encoder configuration (${i.codec}, ${i.bitrate} bps, ${i.numberOfChannels} channels, ${i.sampleRate} Hz) is not supported by this browser. Consider using another codec or changing your audio parameters.`);const u=new Error("Encoding error").stack;this.encoder=new AudioEncoder({output:(l,d)=>{var h,m;if(this.encodingConfig.codec==="aac"&&(d!=null&&d.decoderConfig)){let p=!1;if(!d.decoderConfig.description||d.decoderConfig.description.byteLength<2?p=!0:p=xc(dt(d.decoderConfig.description)).objectType===0,p){const g=Number(yt(i.codec.split(".")));d.decoderConfig.description=eg({objectType:g,numberOfChannels:d.decoderConfig.numberOfChannels,sampleRate:d.decoderConfig.sampleRate})}}let f=nt.fromEncodedChunk(l);f=f.clone({timestamp:La(f.timestamp,i.sampleRate),duration:l.duration!=null?La(f.duration,i.sampleRate):void 0}),(m=(h=this.encodingConfig).onEncodedPacket)==null||m.call(h,f,d),this.lastMuxerPromise=this.muxer.addEncodedAudioPacket(this.source._connectedTrack,f,d).catch(p=>{this.error??(this.error=p)})},error:l=>{l.stack=u,this.error??(this.error=l)}}),this.encoder.configure(i)}b(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}initPcmEncoder(){this.isPcmEncoder=!0;const e=this.encodingConfig.codec,{dataType:n,sampleSize:r,littleEndian:i}=sr(e);switch(this.outputSampleSize=r,r){case 1:n==="unsigned"?this.writeOutputValue=(s,a,o)=>s.setUint8(a,Yt((o+1)*127.5,0,255)):n==="signed"?this.writeOutputValue=(s,a,o)=>{s.setInt8(a,Yt(Math.round(o*128),-128,127))}:n==="ulaw"?this.writeOutputValue=(s,a,o)=>{const c=Yt(Math.floor(o*32767),-32768,32767);s.setUint8(a,W5(c))}:n==="alaw"?this.writeOutputValue=(s,a,o)=>{const c=Yt(Math.floor(o*32767),-32768,32767);s.setUint8(a,G5(c))}:b(!1);break;case 2:n==="unsigned"?this.writeOutputValue=(s,a,o)=>s.setUint16(a,Yt((o+1)*32767.5,0,65535),i):n==="signed"?this.writeOutputValue=(s,a,o)=>s.setInt16(a,Yt(Math.round(o*32767),-32768,32767),i):b(!1);break;case 3:n==="unsigned"?this.writeOutputValue=(s,a,o)=>pd(s,a,Yt((o+1)*83886075e-1,0,16777215),i):n==="signed"?this.writeOutputValue=(s,a,o)=>BW(s,a,Yt(Math.round(o*8388607),-8388608,8388607),i):b(!1);break;case 4:n==="unsigned"?this.writeOutputValue=(s,a,o)=>s.setUint32(a,Yt((o+1)*21474836475e-1,0,4294967295),i):n==="signed"?this.writeOutputValue=(s,a,o)=>s.setInt32(a,Yt(Math.round(o*2147483647),-2147483648,2147483647),i):n==="float"?this.writeOutputValue=(s,a,o)=>s.setFloat32(a,o,i):b(!1);break;case 8:n==="float"?this.writeOutputValue=(s,a,o)=>s.setFloat64(a,o,i):b(!1);break;default:rn(r),b(!1)}}async flushAndClose(e){e||this.checkForEncoderError(),!e&&this.resampler&&await this.resampler.finalize(),this.resampler=null,this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||await this.encoder.flush(),this.encoder.state!=="closed"&&this.encoder.close()),e||this.checkForEncoderError()}getQueueSize(){var e;return this.customEncoder?this.customEncoderQueueSize:this.isPcmEncoder?0:((e=this.encoder)==null?void 0:e.encodeQueueSize)??0}checkForEncoderError(){if(this.error)throw this.error}}class vA extends mo{constructor(e){tA(e),super(e.codec),this._encoder=new xA(this,e)}add(e){if(!(e instanceof Wt))throw new TypeError("audioSample must be an AudioSample.");return this._encoder.add(e,!1)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class Kq extends mo{constructor(e){tA(e),super(e.codec),this._accumulatedTime=0,this._encoder=new xA(this,e)}async add(e){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const n=Wt._fromAudioBuffer(e,this._accumulatedTime);this._accumulatedTime+=e.duration;for(const r of n)await this._encoder.add(r,!0)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class jq extends mo{get errorPromise(){return this._errorPromiseAccessed=!0,this._promiseWithResolvers.promise}get paused(){return this._paused}constructor(e,n,r={}){if(!(e instanceof MediaStreamTrack)||e.kind!=="audio")throw new TypeError("track must be an audio MediaStreamTrack.");
983if(tA(n),typeof r!="object"||!r)throw new TypeError("options must be an object.");if(r.timestampBase!==void 0&&r.timestampBase!=="synced-zero"&&r.timestampBase!=="zero"&&r.timestampBase!=="unix")throw new TypeError("options.timestampBase, when provided, must be one of 'synced-zero', 'zero', or 'unix'.");super(n.codec),this._abortController=null,this._audioContext=null,this._scriptProcessorNode=null,this._promiseWithResolvers=wt(),this._errorPromiseAccessed=!1,this._paused=!1,this._options=r,this._encoder=new xA(this,n),this._track=e}async _start(){this._errorPromiseAccessed||console.warn("Make sure not to ignore the `errorPromise` field on MediaStreamAudioTrackSource, so that any internal errors get bubbled up properly."),this._abortController=new AbortController;let e=null,n=!1,r=null,i=0;const s=a=>{if(n){a.close();return}const o=a.timestamp;if(this._paused){if(e!==null){if(r!==null&&this._options.timestampBase!=="unix"){const u=o-r;i-=u}r=o}a.close();return}if(e===null){e=a.timestamp;let c;const u=this._options.timestampBase??"synced-zero";if(u==="unix")c=Date.now()/1e3;else if(u==="zero")c=0;else{const l=this._connectedTrack.output;l._firstMediaStreamTimestamp===null?(l._firstMediaStreamTimestamp=performance.now()/1e3,c=0):c=performance.now()/1e3-l._firstMediaStreamTimestamp}i=c-e}if(r=o,this._encoder.getQueueSize()>=8){a.close();return}a.setTimestamp(o+i),this._encoder.add(a,!0).catch(c=>{var u,l;n=!0,(u=this._abortController)==null||u.abort(),this._promiseWithResolvers.reject(c),(l=this._audioContext)==null||l.suspend()})};if(typeof MediaStreamTrackProcessor<"u"){const a=new MediaStreamTrackProcessor({track:this._track}),o=new WritableStream({write:c=>s(new Wt(c))});a.readable.pipeTo(o,{signal:this._abortController.signal}).catch(c=>{c instanceof DOMException&&c.name==="AbortError"||this._promiseWithResolvers.reject(c)})}else{const a=window.AudioContext||window.webkitAudioContext;this._audioContext=new a({sampleRate:this._track.getSettings().sampleRate});const o=this._audioContext.createMediaStreamSource(new MediaStream([this._track]));this._scriptProcessorNode=this._audioContext.createScriptProcessor(4096),this._audioContext.state==="suspended"&&await this._audioContext.resume(),o.connect(this._scriptProcessorNode),this._scriptProcessorNode.connect(this._audioContext.destination);let c=0;this._scriptProcessorNode.onaudioprocess=u=>{const l=Wt._fromAudioBuffer(u.inputBuffer,c);c+=u.inputBuffer.duration;for(const d of l)s(d)}}}pause(){this._paused=!0}resume(){this._paused=!1}async _flushAndClose(e){this._abortController&&(this._abortController.abort(),this._abortController=null),this._audioContext&&(b(this._scriptProcessorNode),this._scriptProcessorNode.disconnect(),await this._audioContext.suspend()),await this._encoder.flushAndClose(e)}}const $q=()=>{const t=(r,i)=>{i?self.postMessage(r,{transfer:i}):self.postMessage(r)};t({type:"support",supported:typeof MediaStreamTrackProcessor<"u"});const e=new Map,n=new Map;self.addEventListener("message",r=>{const i=r.data;switch(i.type){case"videoTrack":{n.set(i.trackId,i.track);const s=new MediaStreamTrackProcessor({track:i.track}),a=new WritableStream({write:c=>{if(!n.has(i.trackId)){c.close();return}t({type:"videoFrame",trackId:i.trackId,videoFrame:c},[c])}}),o=new AbortController;e.set(i.trackId,o),s.readable.pipeTo(a,{signal:o.signal}).catch(c=>{c instanceof DOMException&&c.name==="AbortError"||t({type:"error",trackId:i.trackId,error:c})})}break;case"stopTrack":{const s=e.get(i.trackId);s&&(s.abort(),e.delete(i.trackId));const a=n.get(i.trackId);a==null||a.stop(),n.delete(i.trackId),t({type:"trackStopped",trackId:i.trackId})}break;default:rn(i)}})};let Xq=0,dr=null;const Jq=()=>{const t=new Blob([`(${$q.toString()})()`],{type:"application/javascript"}),e=URL.createObjectURL(t);dr=new Worker(e)};let BA=null;const Zq=async()=>BA!==null?BA:(dr||Jq(),new Promise(t=>{b(dr);const e=n=>{const r=n.data;r.type==="support"&&(BA=r.supported,dr.removeEventListener("message",e),t(r.supported))};dr.addEventListener("message",e)})),PA=(t,e)=>{b(dr),dr.postMessage(t)};class RA extends of{constructor(e){if(super(),this._connectedTrack=null,!ir.includes(e))throw new TypeError(`Invalid subtitle codec '${e}'. Must be one of: ${ir.join(", ")}.`);this._codec=e}}class eY extends RA{constructor(e){super(e),this._error=null,this._lastMuxerPromise=Promise.resolve(),this._parser=new hG({codec:e,output:(n,r)=>{this._lastMuxerPromise=this._connectedTrack.output._muxer.addSubtitleCue(this._connectedTrack,n,r).catch(i=>{this._error??(this._error=i)})}})}add(e){if(typeof e!="string")throw new TypeError("text must be a string.");return this._checkForError(),this._ensureValidAdd(),this._parser.parse(e),this._lastMuxerPromise}_checkForError(){if(this._error)throw this._error}async _flushAndClose(e){e||this._checkForError()}}/*!
984 * Copyright (c) 2026-present, Vanilagy and contributors
985 *
986 * This Source Code Form is subject to the terms of the Mozilla Public
987 * License, v. 2.0. If a copy of the MPL was not distributed with this
988 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
989 */class tY extends oi{constructor(e,n){if(!(e._target instanceof ui))throw new TypeError("HLS outputs require `OutputOptions.target` to be a PathedTarget.");super(e),this.trackDatas=[],this.isRelativeToUnixEpoch=!1,this.numWrittenMasterPlaylists=0,this.playlists=[],this.playlistDeclarations=[],this.format=n,this.targetSegmentDuration=n._options.targetDuration??2,this.singleFilePerPlaylist=n._options.singleFilePerPlaylist??!1,this.isLive=n._options.live??!1,this.maxLiveSegmentCount=n._options.maxLiveSegmentCount??1/0,this.globalTargetDuration=this.targetSegmentDuration,this.getPlaylistPath=n._options.getPlaylistPath??(({n:r})=>`playlist-${r}
989.m3u8`),this.getSegmentPath=n._options.getSegmentPath??(r=>r.isSingleFile?`segments-${r.playlist.n}${r.format.fileExtension}`:`segment-${r.playlist.n}-${r.n}${r.format.fileExtension}`),this.getInitPath=n._options.getInitPath??(r=>`init-${r.n}${r.segmentFormat.fileExtension}`)}async start(){const e=await this.mutex.acquire(),n=this.output._tracks.some(g=>g.metadata.isRelativeToUnixEpoch),r=this.output._tracks.some(g=>!g.metadata.isRelativeToUnixEpoch);if(n&&r)throw new Error("All tracks must agree on `relativeToUnixEpoch`: some tracks are relative to the Unix epoch and some are not.");this.isRelativeToUnixEpoch=n;const i=new Map,s=[];let a=!1,o=!1,c=!1;for(const g of this.output._tracks){g.type==="video"&&(a=!0);const A=new Map;for(const y of this.output._tracks){if(g===y||!g.canBePairedWith(y))continue;if(g.type===y.type){o||(console.warn(`Illegal pairing of two ${g.type} tracks detected, which is not possible in HLS; treating them as unpaired.`),o=!0);continue}if(g.isVideoTrack()&&g.metadata.hasOnlyKeyPackets||y.isVideoTrack()&&y.metadata.hasOnlyKeyPackets){c||(console.warn("A key-packets-only video track is pairable with another track, which is not possible in HLS; treating them as unpaired."),c=!0);continue}let w=A.get(y.source._codec);w||A.set(y.source._codec,w=[]),w.push(y)}for(const[,y]of A){const w=y.map(k=>k.id).join("-");s.find(k=>k.key===w)||s.push({name:y[0].type+"-"+(s.length+1),key:w,tracks:y,needsEmit:!1,firstNoUri:!1});let S=i.get(g);S||i.set(g,S=[]),S.push(w)}}const u=a?"video":"audio",l=[],d=[],f=[];for(const g of this.output._tracks){const A=i.get(g);if(A){if(b(A.length>0),g.type!==u)continue;for(const y of A){const w=s.find(E=>E.key===y);if(b(w),A.length===1&&w.tracks.length===1){const E=i.get(w.tracks[0]);if(b(E!==void 0),E.length===1){const S=s.find(k=>k.key===E[0]);if(S.tracks.length===1){b(S.tracks[0]===g),l.push({tracks:[g,w.tracks[0]],linkedGroup:null});continue}}}l.push({tracks:[g],linkedGroup:w}),w.needsEmit=!0}}else g.type==="video"?d.push(g):g.type==="audio"&&f.push(g)}const h=({metadata:g})=>{var y,w,E;let A="";return A+=`${g.languageCode??Kt}-`,A+=`${g.name??""}-`,A+=`${((y=g.disposition)==null?void 0:y.default)??!0}-`,A+=`${((w=g.disposition)==null?void 0:w.primary)??!1}-`,A+=`${((E=g.disposition)==null?void 0:E.forced)??!1}-`,A};if(d.length>0)if(new Set(d.map(h)).size>1){const A={key:d.map(y=>y.id).join("-"),name:"video-"+(s.length+1),tracks:d,needsEmit:!0,firstNoUri:!0};s.push(A),l.push({tracks:[d[0]],linkedGroup:A})}else for(const A of d)l.push({tracks:[A],linkedGroup:null});if(f.length>0)if(new Set(f.map(h)).size>1){const A={key:f.map(y=>y.id).join("-"),name:"audio-"+(s.length+1),tracks:f,needsEmit:!0,firstNoUri:!0};s.push(A),l.push({tracks:[f[0]],linkedGroup:A})}else for(const A of f)l.push({tracks:[A],linkedGroup:null});const m=g=>{const A=[];let y=0,w=0,E=!1,S=null,k=-1/0;for(const T of g)T.isVideoTrack()?(y++,E||(E=(T.metadata.rotation??0)!==0)):T.isAudioTrack()&&w++,A.push(T.source._codec);for(const T of Wa(this.format._options.segmentFormat)){const C=T.getSupportedCodecs(),_=T.getSupportedTrackCounts();if(A.some(P=>!C.includes(P))||y<_.video.min||y>_.video.max||w<_.audio.min||w>_.audio.max)continue;let x=0;E&&T.supportsVideoRotationMetadata&&x++,x>k&&(S=T,k=x)}return b(S),S},p=async g=>{if(g.some(S=>this.playlists.some(k=>k.tracks.includes(S))))throw new Error("Internal error: track is already registered in a playlist.");const A=m(g),y=this.playlists.length+1,w=await this.getPlaylistPath({n:y,tracks:g,segmentFormat:A});nY(w);const E={id:this.playlists.length+1,path:w,tracks:g,segmentFormat:A,currentSegmentStartTimestamp:null,currentSegmentStartTimestampIsFixed:!1,nextSegmentId:1,initSegment:null,writtenSegments:[],peakBitrate:null,averageBitrate:null,mediaSequence:0,done:!1,singleFile:null,mutex:new ks};return this.playlists.push(E),E};for(const g of s)if(g.needsEmit)for(let A=0;A<g.tracks.length;A++){const y=g.tracks[A];let w=this.playlists.find(E=>E.tracks[0].id===y.id);w??(w=await p([y])),this.playlistDeclarations.push({playlist:w,groupId:g.name,noUri:g.firstNoUri&&A===0,references:[]})}for(const g of l){let A=this.playlists.find(y=>y.tracks[0].id===g.tracks[0].id);A??(A=await p(g.tracks)),this.playlistDeclarations.push({playlist:A,groupId:null,noUri:!1,references:g.linkedGroup?this.playlistDeclarations.filter(y=>y.groupId===g.linkedGroup.name):[]})}e()}async getMimeType(){return ro}allTracksAreKnown(e){for(const n of e.tracks)if(!n.source._closed&&!this.trackDatas.some(r=>r.track===n))return!1;return!0}async onTrackClose(e){const n=this.trackDatas.find(s=>s.track===e);n&&(n.closed=!0);const r=this.playlists.find(s=>s.tracks.includes(e));b(r);const i=await r.mutex.acquire();try{await this.advancePlaylist(r)}finally{i()}}getVideoTrackData(e,n){let r=this.trackDatas.find(s=>s.track===e);if(r)return r;bd(n),b(n),b(n==null?void 0:n.decoderConfig);const i=this.playlists.filter(s=>s.tracks.includes(e));return b(i.length===1),r={track:e,packets:[],playlist:i[0],closed:!1,info:{type:"video",decoderConfig:n.decoderConfig}},this.trackDatas.push(r),r}getAudioTrackData(e,n){let r=this.trackDatas.find(s=>s.track===e);if(r)return r;Li(n),b(n),b(n==null?void 0:n.decoderConfig);const i=this.playlists.filter(s=>s.tracks.includes(e));return b(i.length===1),r={track:e,packets:[],playlist:i[0],closed:!1,info:{type:"audio",decoderConfig:n.decoderConfig}},this.trackDatas.push(r),r}async addEncodedVideoPacket(e,n,r){const i=this.getVideoTrackData(e,r),s=i.playlist,a=await s.mutex.acquire();
989try{this.validateTimestamp(e,n.timestamp,n.type==="key"),i.packets.push(n),s.currentSegmentStartTimestamp===null?s.currentSegmentStartTimestamp=n.timestamp:s.currentSegmentStartTimestampIsFixed||(s.currentSegmentStartTimestamp=Math.min(s.currentSegmentStartTimestamp,n.timestamp)),await this.advancePlaylist(s)}finally{a()}}async addEncodedAudioPacket(e,n,r){const i=this.getAudioTrackData(e,r),s=i.playlist,a=await s.mutex.acquire();try{this.validateTimestamp(e,n.timestamp,n.type==="key"),i.packets.push(n),s.currentSegmentStartTimestamp===null?s.currentSegmentStartTimestamp=n.timestamp:s.currentSegmentStartTimestampIsFixed||(s.currentSegmentStartTimestamp=Math.min(s.currentSegmentStartTimestamp,n.timestamp)),await this.advancePlaylist(s)}finally{a()}}async addSubtitleCue(e,n,r){throw new Error("Unreachable.")}async advancePlaylist(e){var s,a,o,c;if(b(!e.done),!this.allTracksAreKnown(e))return;if(e.currentSegmentStartTimestamp===null){await this.onPlaylistDone(e);return}const n=this.trackDatas.filter(u=>e.tracks.includes(u.track)),r=n.find(u=>u.info.type==="video"),i=n.find(u=>u.info.type==="audio");for(;;){const u=e.currentSegmentStartTimestamp+this.targetSegmentDuration;let l=0,d=0;if(r&&(!r.closed||r.packets.length>0)){const T=r.packets.every(x=>x.timestamp<u);let C=null,_=null;if(T){if(!r.closed)return}else for(let x=0;x<r.packets.length;x++){const P=r.packets[x];if(C!==null&&P.timestamp>u)break;x>0&&P.type==="key"&&(C=P,_=x)}if(_!==null){if(l=_,i){const x=i.packets.findIndex(P=>P.timestamp>=C.timestamp);if(x!==-1)d=x;else if(i.closed)d=i.packets.length;else return}}else{if(!r.closed)return;l=r.packets.length;const x=zW(r.packets,v=>v.timestamp),P=r.packets[x];if(b(P),i)if(P.timestamp<u){const v=i.packets.findIndex(M=>M.timestamp>=u);if(v!==-1)d=v;else if(i.closed)d=i.packets.length;else return}else{const v=i.packets.findIndex(M=>M.timestamp>P.timestamp);if(v!==-1)d=v;else if(i.closed)d=i.packets.length;else return}}}else if(i&&(!i.closed||i.packets.length>0))if(i.packets.every(C=>C.timestamp<u))if(i.closed)d=i.packets.length;else return;else{const C=fd(i.packets,_=>_.timestamp<=u);d=Math.max(C,1)}if(l===0&&d===0){n.every(C=>C.closed)&&await this.onPlaylistDone(e);return}let f=null,h,m;b(this.output._target instanceof ui);const p=this.output._target;if(this.singleFilePerPlaylist)if(e.singleFile===null){const T={n:e.nextSegmentId,format:e.segmentFormat,isSingleFile:!0,playlist:uf(e)};
989h=await this.getSegmentPath(T),Tv(h),m=en(en(p.rootPath,e.path),h);const C=await this.output._getTarget({path:m,isRoot:!1,mimeType:e.segmentFormat.mimeType});C._start(),e.singleFile={target:C,path:h,nextOffset:0,info:T}}else h=e.singleFile.path,m=en(en(p.rootPath,e.path),h);else f={n:e.nextSegmentId,format:e.segmentFormat,isSingleFile:!1,playlist:uf(e)},h=await this.getSegmentPath(f),Tv(h),m=en(en(p.rootPath,e.path),h),e.nextSegmentId++;let g=0,A=null;const y=new df({format:e.segmentFormat,target:new ui(m,async T=>{const C={...T,isRoot:!1};if(T.isRoot)if(e.singleFile){const _=e.singleFile.target.slice(e.singleFile.nextOffset);return _.on("write",({end:x})=>g=Math.max(g,x)),_}else{const _=await this.output._getTarget(C);return A=_,_.on("write",({end:x})=>g=Math.max(g,x)),_}return this.output._getTarget(C)}),initTarget:async()=>{if(e.initSegment)return new SA;if(e.singleFile){e.initSegment={path:e.singleFile.path,duration:0,timestamp:0,byteSize:0,byteOffset:0,info:null};const T=e.singleFile.target.slice(e.singleFile.nextOffset);return T.on("write",({end:C})=>{e.initSegment.byteSize=Math.max(e.initSegment.byteSize,C)}),T.on("finalized",()=>{e.singleFile.nextOffset=e.initSegment.byteSize}),T}else{const T=uf(e),C=await this.getInitPath(T);rY(C),e.initSegment={path:C,duration:0,timestamp:0,byteSize:0,byteOffset:null,info:null};const _=en(en(p.rootPath,e.path),C),x=await this.output._getTarget({path:_,isRoot:!1,mimeType:e.segmentFormat.mimeType});return x.on("write",({end:P})=>{e.initSegment.byteSize=Math.max(e.initSegment.byteSize,P)}),x.on("finalized",()=>{var P,v;(v=(P=this.format._options).onInit)==null||v.call(P,x,T)}),x}}});let w=-1/0;try{let T=null,C=null;if(r&&(T=new TA(r.track.source._codec),y.addVideoTrack(T,r.track.metadata)),i&&(C=new CA(i.track.source._codec),y.addAudioTrack(C,i.track.metadata)),await y.start(),r){b(T);const _={decoderConfig:r.info.decoderConfig};for(let x=0;x<l;x++){const P=r.packets[x];await T.add(P,_),w=Math.max(w,P.timestamp+P.duration)}}if(i){b(C);const _={decoderConfig:i.info.decoderConfig};for(let x=0;x<d;x++){const P=i.packets[x];await C.add(P,_),w=Math.max(w,P.timestamp+P.duration)}}await y.finalize()}catch(T){throw await y.cancel(),T}f&&(b(A),(a=(s=this.format._options).onSegment)==null||a.call(s,A,f)),l>0&&(b(r),r.packets.splice(0,l)),d>0&&(b(i),i.packets.splice(0,d));let E=1/0;r&&r.packets.length>0&&(E=r.packets[0].timestamp),i&&i.packets.length>0&&(E=Math.min(E,i.packets[0].timestamp));const S=E<1/0?E:w;b(Number.isFinite(S));const k=S-e.currentSegmentStartTimestamp;if(b(k>=0),e.writtenSegments.push({path:h,duration:k,timestamp:e.currentSegmentStartTimestamp,byteSize:g,byteOffset:e.singleFile?e.singleFile.nextOffset:null,info:f??null}),this.globalTargetDuration=Math.max(this.globalTargetDuration,k),e.currentSegmentStartTimestamp=S,e.currentSegmentStartTimestampIsFixed=!0,e.singleFile&&(e.singleFile.nextOffset+=g),this.isLive){for(;e.writtenSegments.length>this.maxLiveSegmentCount;){const T=e.writtenSegments.shift();e.mediaSequence++,this.singleFilePerPlaylist||(b(T.info),(c=(o=this.format._options).onSegmentPopped)==null||c.call(o,T.path,T.info))}await this.writePlaylist(e),await this.tryWriteMasterPlaylist()}}}async onPlaylistDone(e){var n,r;b(!e.done),e.done=!0,e.singleFile&&(await e.singleFile.target._flush(),await e.singleFile.target._finalize(),(r=(n=this.format._options).onSegment)==null||r.call(n,e.singleFile.target,e.singleFile.info)),await this.writePlaylist(e),this.isLive&&e.writtenSegments.length===0&&await this.tryWriteMasterPlaylist()}updatePlaylistBitrates(e){const n=e.writtenSegments;let r=0,i=0,s=0;for(let a=0;a<n.length;a++){s+=n[a].duration;let o=0,c=0;for(let u=a;u<n.length&&(o+=n[u].byteSize,c+=n[u].duration,c>=.5*this.globalTargetDuration&&c<=1.5*this.globalTargetDuration&&(r=Math.max(r,8*o/c)),!(c>1.5*this.globalTargetDuration));u++);}if(r===0)for(const a of n){const o=a.duration||1;r=Math.max(r,8*a.byteSize/o)}for(const a of n)i+=8*a.byteSize;e.peakBitrate=r,e.averageBitrate=i/(s||1)}async writePlaylist(e){var d,f;b(this.output._target instanceof ui);const n=this.output._target;this.updatePlaylistBitrates(e);let r=!1;for(const h of e.writtenSegments)r||(r=h.byteOffset!==null);const i=e.tracks[0].isVideoTrack()&&e.tracks[0].metadata.hasOnlyKeyPackets;let s=3;(i||r)&&(s=4),e.initSegment&&(s=5),e.initSegment&&!i&&(s=6);const a=this.isLive?this.targetSegmentDuration:this.globalTargetDuration,o=en(n.rootPath,e.path),c=`#EXTM3U
990#EXT-X-VERSION:${s}
991`+(this.isLive?"":`#EXT-X-PLAYLIST-TYPE:VOD
992`)+`#EXT-X-TARGETDURATION:${Math.ceil(a)}
993`+(Number.isFinite(this.maxLiveSegmentCount)?`#EXT-X-MEDIA-SEQUENCE:${e.mediaSequence}
994`:"")+`#EXT-X-INDEPENDENT-SEGMENTS
995`+(i?`#EXT-X-I-FRAMES-ONLY
996`:"")+(e.initSegment?`#EXT-X-MAP:URI="${e.initSegment.path}
996"`+(e.initSegment.byteOffset!==null?`,BYTERANGE="${e.initSegment.byteSize}@${e.initSegment.byteOffset}"`:"")+`
997`:"")+`
998`+e.writtenSegments.map(h=>`#EXTINF:${+h.duration.toFixed(12)},
999`+(this.isRelativeToUnixEpoch?`#EXT-X-PROGRAM-DATE-TIME:${new Date(1e3*h.timestamp).toISOString()}
1000`:"")+(h.byteOffset!==null?`#EXT-X-BYTERANGE:${h.byteSize}@${h.byteOffset}
1001`:"")+`${h.path}
1002`).join("")+(e.done?(e.writtenSegments.length>0?`
1003`:"")+`#EXT-X-ENDLIST
1004`:"");(f=(d=this.format._options).onPlaylist)==null||f.call(d,c,uf(e));const u=await this.output._getTarget({path:o,isRoot:!1,mimeType:ro}),l=new Xc(u,!0);l.start(),l.write(tt.encode(c)),await l.flush(),await l.finalize()}async writeMasterPlaylist(){var c,u;b(this.output._target instanceof ui);const e=this.output._target;let n=`#EXTM3U
1005`,r=!1,i=null,s=0,a=!1;for(const l of this.playlistDeclarations)if(l.groupId===null){const d=l.playlist.tracks[0].isVideoTrack()&&l.playlist.tracks[0].metadata.hasOnlyKeyPackets,f=[];for(const y of l.playlist.tracks){const w=this.trackDatas.find(S=>S.track===y),E=(w==null?void 0:w.info.decoderConfig.codec)??y.source._codec;f.push(E)}let h=0,m=0;if(l.references.length>0){const w=l.references[0].playlist.tracks[0],E=this.trackDatas.find(k=>k.track===w),S=(E==null?void 0:E.info.decoderConfig.codec)??w.source._codec;f.push(S);for(const k of l.references)b(k.playlist.peakBitrate!==null),h=Math.max(h,k.playlist.peakBitrate),m=Math.max(m,k.playlist.averageBitrate??0)}b(l.playlist.peakBitrate!==null);const p=l.playlist.peakBitrate+h,g=(l.playlist.averageBitrate??0)+m;r||(n+=`
1006`,r=!0),d?n+="#EXT-X-I-FRAME-STREAM-INF:":n+="#EXT-X-STREAM-INF:",n+=`BANDWIDTH=${Math.ceil(p)}`,g>0&&(n+=`,AVERAGE-BANDWIDTH=${Math.ceil(g)}`),n+=`,CODECS="${f.join(",")}"`;const A=l.playlist.tracks.find(y=>y.isVideoTrack());if(A!=null&&A.isVideoTrack()){const y=this.trackDatas.find(E=>E.track===A),w=y==null?void 0:y.info.decoderConfig;if(w){let E=w.displayAspectWidth??w.codedWidth,S=w.displayAspectHeight??w.codedHeight;E!==void 0&&S!==void 0&&(A.metadata.rotation!==void 0&&A.metadata.rotation%180===90&&([E,S]=[S,E]),n+=`,RESOLUTION=${E}x${S}`)}!d&&A.metadata.frameRate!==void 0&&(n+=`,FRAME-RATE=${+A.metadata.frameRate.toFixed(3)}`)}if(!d){const y=new Map;for(const w of l.references){b(w.groupId!==null);const E=w.playlist.tracks[0].type;y.set(E,w.groupId)}for(const[w,E]of y)n+=`,${w.toUpperCase()}="${E}"`}d?(n+=`,URI="${l.playlist.path}"`,n+=`
1007`):(n+=`
1008`,n+=`${l.playlist.path}
1009`)}else{b(l.playlist.tracks.length===1);const d=l.playlist.tracks[0],f=d.type;let h=d.metadata.name??null;const m=d.metadata.languageCode,p=d.metadata.disposition;(i===null||l.groupId!==i)&&(s=0,n+=`
1010`,a=!1),i=l.groupId,s++,n+=`#EXT-X-MEDIA:TYPE=${f.toUpperCase()},GROUP-ID="${l.groupId}"`,h!==null&&/[\n\r"]/.test(h)&&(console.warn("Dropping track name since it includes a line feed, carriage return, or double quote character, which are not allowed in HLS playlist attributes."),h=null),h??(h=`${m??l.groupId}-${s}`),n+=`,NAME="${h}"`,m!==void 0&&(n+=`,LANGUAGE="${m}"`);const g=(p==null?void 0:p.primary)??!1,A=(p==null?void 0:p.default)??!0,y=(p==null?void 0:p.forced)??!1;if(g&&!a&&(n+=",DEFAULT=YES",a=!0),(g||A)&&(n+=",AUTOSELECT=YES"),y&&(n+=",FORCED=YES"),f==="audio"){const w=this.trackDatas.find(S=>S.track===d),E=w==null?void 0:w.info.decoderConfig;E&&(n+=`,CHANNELS="${E.numberOfChannels}"`)}l.noUri||(n+=`,URI="${l.playlist.path}"`),n+=`
1011`}(u=(c=this.format._options).onMaster)==null||u.call(c,n);const o=await this.mutex.acquire();try{let l;if(this.numWrittenMasterPlaylists===0)l=await this.output._getRootWriter(!0);else{const d=await this.output._getTarget({path:e.rootPath,isRoot:!0,mimeType:ro});l=new Xc(d,!0),l.start()}l.write(tt.encode(n)),await l.flush(),await l.finalize(),this.numWrittenMasterPlaylists++}finally{o()}}async tryWriteMasterPlaylist(){b(this.isLive);for(const e of this.playlists)if(e.writtenSegments.length===0&&!e.done)return;await this.writeMasterPlaylist()}async finalize(){(await Promise.all(this.playlists.map(n=>n.mutex.acquire()))).forEach(n=>n());for(const n of this.trackDatas)n.closed=!0;await Promise.all(this.playlists.map(n=>n.done?Promise.resolve():this.advancePlaylist(n))),this.isLive||await this.writeMasterPlaylist()}}const nY=t=>{if(typeof t!="string")throw new TypeError("options.getPlaylistPath must return or resolve to a string");if(/[\n\r"]/.test(t))throw new TypeError("Playlist paths cannot contain line feed, carriage return, or double quote characters.")},Tv=t=>{if(typeof t!="string")throw new TypeError("options.getSegmentPath must return or resolve to a string");if(/[\n\r"]/.test(t))throw new TypeError("Segment paths cannot contain line feed or carriage return characters.")},rY=t=>{if(typeof t!="string")throw new TypeError("options.getInitPath must return or resolve to a string");if(/[\n\r"]/.test(t))throw new TypeError("Init paths cannot contain line feed, carriage return, or double quote characters.")},uf=t=>({n:t.id,tracks:t.tracks,segmentFormat:t.segmentFormat});/*!
1012 * Copyright (c) 2026-present, Vanilagy and contributors
1013 *
1014 * This Source Code Form is subject to the terms of the Mozilla Public
1015 * License, v. 2.0. If a copy of the MPL was not distributed with this
1016 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
1017 */class Mn{getSupportedVideoCodecs(){return this.getSupportedCodecs().filter(e=>xt.includes(e))}getSupportedAudioCodecs(){return this.getSupportedCodecs().filter(e=>Ut.includes(e))}getSupportedSubtitleCodecs(){return this.getSupportedCodecs().filter(e=>ir.includes(e))}_codecUnsupportedHint(e){return""}}class lf extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.fastStart!==void 0&&![!1,"in-memory","reserve","fragmented"].includes(e.fastStart))throw new TypeError("options.fastStart, when provided, must be false, 'in-memory', 'reserve', or 'fragmented'.");if(e.minimumFragmentDuration!==void 0&&(!Number.isFinite(e.minimumFragmentDuration)||e.minimumFragmentDuration<0))throw new TypeError("options.minimumFragmentDuration, when provided, must be a non-negative number.");if(e.onFtyp!==void 0&&typeof e.onFtyp!="function")throw new TypeError("options.onFtyp, when provided, must be a function.");if(e.onMoov!==void 0&&typeof e.onMoov!="function")throw new TypeError("options.onMoov, when provided, must be a function.");if(e.onMdat!==void 0&&typeof e.onMdat!="function")throw new TypeError("options.onMdat, when provided, must be a function.");if(e.onMoof!==void 0&&typeof e.onMoof!="function")throw new TypeError("options.onMoof, when provided, must be a function.");if(e.metadataFormat!==void 0&&!["mdir","mdta","udta","auto"].includes(e.metadataFormat))throw new TypeError("options.metadataFormat, when provided, must be either 'auto', 'mdir', 'mdta', or 'udta'.");super(),this._options=e}getSupportedTrackCounts(){return{video:{min:0,max:4294967295},audio:{min:0,max:4294967295},subtitle:{min:0,max:4294967295},total:{min:1,max:4294967295}}}get supportsVideoRotationMetadata(){return!0}get supportsTimestampedMediaData(){return!0}_createMuxer(e){return new vq(e,this)}}class FA extends lf{constructor(e){super(e)}get _name(){return"MP4"}get fileExtension(){return".mp4"}get mimeType(){return"video/mp4"}getSupportedCodecs(){return[...xt,...Ni,"pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be",...ir]}_codecUnsupportedHint(e){return new DA().getSupportedCodecs().includes(e)?" Switching to MOV will grant support for this codec.":""}}class MA extends lf{constructor(e){super(e)}get _name(){return"CMAF"}get fileExtension(){return".m4s"}get mimeType(){return"video/mp4"}getSupportedCodecs(){return[...xt,...Ni,"pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be",...ir]}}class DA extends lf{constructor(e){super(e)}get _name(){return"MOV"}get fileExtension(){return".mov"}get mimeType(){return"video/quicktime"}getSupportedCodecs(){return[...xt,...Ut]}_codecUnsupportedHint(e){return new FA().getSupportedCodecs().includes(e)?" Switching to MP4 will grant support for this codec.":""}}class OA extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.appendOnly!==void 0&&typeof e.appendOnly!="boolean")throw new TypeError("options.appendOnly, when provided, must be a boolean.");if(e.minimumClusterDuration!==void 0&&(!Number.isFinite(e.minimumClusterDuration)||e.minimumClusterDuration<0))throw new TypeError("options.minimumClusterDuration, when provided, must be a non-negative number.");if(e.onEbmlHeader!==void 0&&typeof e.onEbmlHeader!="function")throw new TypeError("options.onEbmlHeader, when provided, must be a function.");if(e.onSegmentHeader!==void 0&&typeof e.onSegmentHeader!="function")throw new TypeError("options.onHeader, when provided, must be a function.");if(e.onCluster!==void 0&&typeof e.onCluster!="function")throw new TypeError("options.onCluster, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new Fq(e,this)}get _name(){return"Matroska"}getSupportedTrackCounts(){return{video:{min:0,max:127},audio:{min:0,max:127},subtitle:{min:0,max:127},total:{min:1,max:127}}}get fileExtension(){return".mkv"}get mimeType(){return"video/x-matroska"}getSupportedCodecs(){return[...xt,...Ni,...Nt.filter(e=>!["pcm-s8","pcm-f32be","pcm-f64be","ulaw","alaw"].includes(e)),...ir]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!0}}class NA extends OA{constructor(e){super(e)}getSupportedCodecs(){return[...xt.filter(e=>["vp8","vp9","av1"].includes(e)),...Ut.filter(e=>["opus","vorbis"].includes(e)),...ir]}get _name(){return"WebM"}get fileExtension(){return".webm"}get mimeType(){return"video/webm"}_codecUnsupportedHint(e){return new OA().getSupportedCodecs().includes(e)?" Switching to MKV will grant support for this codec.":""}}class iY extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.xingHeader!==void 0&&typeof e.xingHeader!="boolean")throw new TypeError("options.xingHeader, when provided, must be a boolean.");if(e.onXingFrame!==void 0&&typeof e.onXingFrame!="function")throw new TypeError("options.onXingFrame, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new Dq(e,this)}get _name(){return"MP3"}getSupportedTrackCounts(){return{video:{min:0,max:0},audio:{min:1,max:1},subtitle:{min:0,max:0},total:{min:1,max:1}}}get fileExtension(){return".mp3"}get mimeType(){return"audio/mpeg"}getSupportedCodecs(){return["mp3"]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!1}}class sY extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.large!==void 0&&typeof e.large!="boolean")throw new TypeError("options.large, when provided, must be a boolean.");if(e.metadataFormat!==void 0&&!["info","id3"].includes(e.metadataFormat))throw new TypeError("options.metadataFormat, when provided, must be either 'info' or 'id3'.");if(e.onHeader!==void 0&&typeof e.onHeader!="function")throw new TypeError("options.onHeader, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new Vq(e,this)}get _name(){return"WAVE"}getSupportedTrackCounts(){return{video:{min:0,max:0},audio:{min:1,max:1},subtitle:{min:0,max:0},total:{min:1,max:1}}}get fileExtension(){return".wav"}get mimeType(){return"audio/wav"}getSupportedCodecs(){return[...Nt.filter(e=>["pcm-s16","pcm-s24","pcm-s32","pcm-f32","pcm-u8","ulaw","alaw"].includes(e))]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!1}}class aY extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.maximumPageDuration!==void 0&&(!Number.isFinite(e.maximumPageDuration)||e.maximumPageDuration<=0))throw new TypeError("options.maximumPageDuration, when provided, must be a positive number.");if(e.onPage!==void 0&&typeof e.onPage!="function")throw new TypeError("options.onPage, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new Nq(e,this)}get _name(){return"Ogg"}getSupportedTrackCounts(){return{video:{min:0,max:0},audio:{min:0,max:4294967296},subtitle:{min:0,max:0},total:{min:1,max:4294967296}}}get fileExtension(){return".ogg"}get mimeType(){return"application/ogg"}getSupportedCodecs(){return[...Ut.filter(e=>["vorbis","opus"].includes(e))]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!1}}class oY extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.onFrame!==void 0&&typeof e.onFrame!="function")throw new TypeError("options.onFrame, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new cG(e,this)}get _name(){return"ADTS"}getSupportedTrackCounts(){return{video:{min:0,max:0},audio:{min:1,max:1},subtitle:{min:0,max:0},total:{min:1,max:1}}}get fileExtension(){return".aac"}get mimeType(){return"audio/aac"}getSupportedCodecs(){return["aac"]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!1}}class cY extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.appendOnly!==void 0&&typeof e.appendOnly!="boolean")throw new TypeError("options.appendOnly, when provided, must be a boolean.");super(),this._options=e}_createMuxer(e){return new dG(e,this)}get _name(){return"FLAC"}getSupportedTrackCounts(){return{video:{min:0,max:0},audio:{min:1,max:1},subtitle:{min:0,max:0},total:{min:1,max:1}}}get fileExtension(){return".flac"}get mimeType(){return"audio/flac"}getSupportedCodecs(){return["flac"]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!1}}class uY extends Mn{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.onPacket!==void 0&&typeof e.onPacket!="function")throw new TypeError("options.onPacket, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new zq(e,this)}get _name(){return"MPEG-TS"}getSupportedTrackCounts(){return{video:{min:0,max:16},audio:{min:0,max:32},subtitle:{min:0,max:0},total:{min:1,max:48}}}get fileExtension(){return".ts"}get mimeType(){return"video/MP2T"}getSupportedCodecs(){return[...xt.filter(e=>["avc","hevc"].includes(e)),...Ut.filter(e=>["aac","mp3","ac3","eac3"].includes(e))]}get supportsVideoRotationMetadata(){return!1}get supportsTimestampedMediaData(){return!0}}class lY extends Mn{constructor(e){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.segmentFormat instanceof Mn)&&(!Array.isArray(e.segmentFormat)||e.segmentFormat.length===0||!e.segmentFormat.every(n=>n instanceof Mn)))throw new TypeError("options.segmentFormat must be an OutputFormat or a non-empty array of OutputFormat instances.");if(e.targetDuration!==void 0&&(typeof e.targetDuration!="number"||e.targetDuration<=0))throw new TypeError("options.targetDuration, when provided, must be a positive number.");if(e.singleFilePerPlaylist!==void 0&&typeof e.singleFilePerPlaylist!="boolean")throw new TypeError("options.singleFilePerPlaylist, when provided, must be a boolean.");if(e.live!==void 0&&typeof e.live!="boolean")throw new TypeError("options.live, when provided, must be a boolean.");if(e.maxLiveSegmentCount!==void 0&&(typeof e.maxLiveSegmentCount!="number"||e.maxLiveSegmentCount<1||Number.isFinite(e.maxLiveSegmentCount)&&!Number.isInteger(e.maxLiveSegmentCount)))throw new TypeError("options.maxLiveSegmentCount, when provided, must be a positive integer or Infinity.");if(e.getPlaylistPath!==void 0&&typeof e.getPlaylistPath!="function")throw new TypeError("options.getPlaylistPath, when provided, must be a function.");
1017if(e.getSegmentPath!==void 0&&typeof e.getSegmentPath!="function")throw new TypeError("options.getSegmentPath, when provided, must be a function.");if(e.getInitPath!==void 0&&typeof e.getInitPath!="function")throw new TypeError("options.getInitPath, when provided, must be a function.");if(e.onMaster!==void 0&&typeof e.onMaster!="function")throw new TypeError("options.onMaster, when provided, must be a function.");if(e.onPlaylist!==void 0&&typeof e.onPlaylist!="function")throw new TypeError("options.onPlaylist, when provided, must be a function.");if(e.onSegment!==void 0&&typeof e.onSegment!="function")throw new TypeError("options.onSegment, when provided, must be a function.");if(e.onInit!==void 0&&typeof e.onInit!="function")throw new TypeError("options.onInit, when provided, must be a function.");if(e.onSegmentPopped!==void 0&&typeof e.onSegmentPopped!="function")throw new TypeError("options.onSegmentPopped, when provided, must be a function.");super(),this._options=e}_createMuxer(e){return new tY(e,this)}get _name(){return"HTTP Live Streaming (HLS)"}get fileExtension(){return".m3u8"}get mimeType(){return ro}getSupportedCodecs(){return[...new Set(Wa(this._options.segmentFormat).flatMap(n=>n.getSupportedCodecs()))]}getSupportedTrackCounts(){let e=!1,n=!1,r=!1;for(const i of Wa(this._options.segmentFormat)){const s=i.getSupportedTrackCounts();e||(e=s.video.max>0),n||(n=s.audio.max>0),r||(r=s.subtitle.max>0)}return{video:{min:0,max:e?1/0:0},audio:{min:0,max:n?1/0:0},subtitle:{min:0,max:0},total:{min:1,max:1/0}}}get supportsVideoRotationMetadata(){return Wa(this._options.segmentFormat).some(e=>e.supportsVideoRotationMetadata)}get supportsTimestampedMediaData(){return!0}_codecUnsupportedHint(e){return" Using different segment formats may grant support for this codec."}}/*!
1018 * Copyright (c) 2026-present, Vanilagy and contributors
1019 *
1020 * This Source Code Form is subject to the terms of the Mozilla Public
1021 * License, v. 2.0. If a copy of the MPL was not distributed with this
1022 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
1023 */const kv=["video","audio","subtitle"];class go{constructor(e,n,r,i,s){this.id=e,this.output=n,this.type=r,this.source=i,this.metadata=s}isVideoTrack(){return this.type==="video"}isAudioTrack(){return this.type==="audio"}isSubtitleTrack(){return this.type==="subtitle"}canBePairedWith(e){if(!(e instanceof go))throw new TypeError("other must be an OutputTrack.");if(this===e)return!1;const n=Wa(this.metadata.group),r=Wa(e.metadata.group);for(const i of n)if(this.type!==e.type&&r.some(o=>i===o)||r.some(o=>i._pairedGroups.has(o)))return!0;return!1}}class Iv extends go{constructor(e,n,r,i){super(e,n,"video",r,i)}}class Cv extends go{constructor(e,n,r,i){super(e,n,"audio",r,i)}}class xv extends go{constructor(e,n,r,i){super(e,n,"subtitle",r,i)}}class Kn{constructor(){this._pairedGroups=new Set}pairWith(e){if(!(e instanceof Kn))throw new TypeError("other must be an OutputTrackGroup.");if(this===e)throw new TypeError("Cannot pair a group with itself.");this._pairedGroups.add(e),e._pairedGroups.add(this)}}const UA=t=>{if(!t||typeof t!="object")throw new TypeError("metadata must be an object.");if(t.languageCode!==void 0&&!bc(t.languageCode))throw new TypeError("metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.");if(t.name!==void 0&&typeof t.name!="string")throw new TypeError("metadata.name, when provided, must be a string.");if(t.disposition!==void 0&&qW(t.disposition),t.maximumPacketCount!==void 0&&(!Number.isInteger(t.maximumPacketCount)||t.maximumPacketCount<0))throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.");if(t.group!==void 0&&!(t.group instanceof Kn)&&(!Array.isArray(t.group)||t.group.some(e=>!(e instanceof Kn))))throw new TypeError("metadata.group, when provided, must be an OutputTrackGroup instance or an array of OutputTrackGroup instances.")};class df extends Ic{get target(){const e="Output.target cannot be used when using PathedTarget with an async callback. Use the 'target' event instead.";if(this._rootTargetPromise)throw new TypeError(e);const n=this._getRootTarget();if(n instanceof Promise)throw new TypeError(e);return n}constructor(e){if(super(),this.state="pending",this.defaultTrackGroup=new Kn,this._onFinalize=null,this._unfinalizedTargets=new Set,this._rootWriterPromise=null,this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new ks,this._metadataTags={},this._rootTarget=null,this._rootTargetPromise=null,this._firstMediaStreamTimestamp=null,!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.format instanceof Mn))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof Sn||e.target instanceof ui))throw new TypeError("options.target must be a Target or a PathedTarget.");if(e.target instanceof Sn&&this._rememberTarget(e.target),e.initTarget!==void 0&&!(e.initTarget instanceof Sn)&&typeof e.initTarget!="function")throw new Error("options.initTarget, when provided, must be a Target or a function that returns or resolves to a Target.");if(e.onFinalize!==void 0&&typeof e.onFinalize!="function")throw new TypeError("options.onFinalize, when provided, must be a function.");this.format=e.format,this._target=e.target,this._onFinalize=e.onFinalize??null,this._initTarget=e.initTarget??null,this._initTarget instanceof Sn&&this._rememberTarget(this._initTarget),this._muxer=e.format._createMuxer(this)}_getTargetValidated(e){b(this._target instanceof ui);const n=this._target.getTarget(e),r=i=>{if(!(i instanceof Sn))throw new TypeError("getTarget must return a Target.");return i};return n instanceof Promise?n.then(r):r(n)}async _getTarget(e){b(this._target instanceof ui);const n=await this._getTargetValidated(e);return this._emit("target",{target:n,request:e,isRoot:e.isRoot}),this.state==="canceled"?await n._close():this._rememberTarget(n),n}_rememberTarget(e){this._unfinalizedTargets.add(e),e.on("finalized",()=>this._unfinalizedTargets.delete(e),{once:!0})}
1023async _getInitTarget(){if(b(this._initTarget!==null),this._initTarget instanceof Sn)return this._initTarget;const e=await this._initTarget();return this.state==="canceled"?await e._close():this._rememberTarget(e),e}_hasInitTarget(){return this._initTarget!==null}_getRootTarget(){if(this._rootTarget)return this._rootTarget;if(this._rootTargetPromise)return this._rootTargetPromise;if(this._target instanceof Sn)return this._emit("target",{target:this._target,request:null,isRoot:!0}),this._rootTarget=this._target,this._target;const e={path:this._target.rootPath,isRoot:!0,mimeType:this.format.mimeType},n=this._getTargetValidated(e),r=i=>(this.state==="canceled"?i._close():this._rememberTarget(i),this._emit("target",{target:i,request:e,isRoot:!0}),this._rootTarget=i,i);return n instanceof Promise?this._rootTargetPromise=n.then(r):r(n)}_getRootWriter(e){return this._rootWriterPromise??(this._rootWriterPromise=(async()=>{const n=await this._getRootTarget(),r=new Xc(n,typeof e=="boolean"?e:e(n));return r.start(),r})())}addVideoTrack(e,n={}){if(!(e instanceof po))throw new TypeError("source must be a VideoSource.");if(UA(n),n.rotation!==void 0&&![0,90,180,270].includes(n.rotation))throw new TypeError(`Invalid video rotation: ${n.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&n.rotation)throw new Error(`${this.format._name} does not support video rotation metadata.`);if(n.frameRate!==void 0&&(!Number.isFinite(n.frameRate)||n.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${n.frameRate}. Must be a positive number.`);const r={...n};return r.group??(r.group=this.defaultTrackGroup),this._addTrack(new Iv(this._tracks.length+1,this,e,r))}addAudioTrack(e,n={}){if(!(e instanceof mo))throw new TypeError("source must be an AudioSource.");UA(n);const r={...n};return r.group??(r.group=this.defaultTrackGroup),this._addTrack(new Cv(this._tracks.length+1,this,e,r))}addSubtitleTrack(e,n={}){if(!(e instanceof RA))throw new TypeError("source must be a SubtitleSource.");UA(n);const r={...n};return r.group??(r.group=this.defaultTrackGroup),this._addTrack(new xv(this._tracks.length+1,this,e,r))}setMetadataTags(e){if(Zm(e),this.state!=="pending")throw new Error("Cannot set metadata tags after output has been started or canceled.");this._metadataTags=e}_addTrack(e){if(this.state!=="pending")throw new Error("Cannot add track after output has been started or canceled.");if(e.source._connectedTrack)throw new Error("Source is already used for a track.");const n=this.format.getSupportedTrackCounts(),r=this._tracks.reduce((a,o)=>a+(o.type===e.type?1:0),0),i=n[e.type].max;if(r===i)throw new Error(i===0?`${this.format._name} does not support ${e.type} tracks.`:`${this.format._name} does not support more than ${i} ${e.type} track${i===1?"":"s"}.`);const s=n.total.max;if(this._tracks.length===s)throw new Error(`${this.format._name} does not support more than ${s} tracks${s===1?"":"s"} in total.`);if(e.isVideoTrack()){const a=this.format.getSupportedVideoCodecs();if(a.length===0)throw new Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(e.source._codec));if(!a.includes(e.source._codec))throw new Error(`Codec '${e.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${a.map(o=>`'${o}'`).join(", ")}.`+this.format._codecUnsupportedHint(e.source._codec))}else if(e.isAudioTrack()){const a=this.format.getSupportedAudioCodecs();if(a.length===0)throw new Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(e.source._codec));if(!a.includes(e.source._codec))throw new Error(`Codec '${e.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${a.map(o=>`'${o}'`).join(", ")}.`+this.format._codecUnsupportedHint(e.source._codec))}else if(e.isSubtitleTrack()){const a=this.format.getSupportedSubtitleCodecs();if(a.length===0)throw new Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(e.source._codec));if(!a.includes(e.source._codec))throw new Error(`Codec '${e.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${a.map(o=>`'${o}'`).join(", ")}.`+this.format._codecUnsupportedHint(e.source._codec))}return this._tracks.push(e),e.source._connectedTrack=e,e}
1023async start(){const e=this.format.getSupportedTrackCounts();for(const r of kv){const i=this._tracks.reduce((a,o)=>a+(o.type===r?1:0),0),s=e[r].min;if(i<s)throw new Error(s===e[r].max?`${this.format._name} requires exactly ${s} ${r} track${s===1?"":"s"}.`:`${this.format._name} requires at least ${s} ${r} track${s===1?"":"s"}.`)}const n=e.total.min;if(this._tracks.length<n)throw new Error(n===e.total.max?`${this.format._name} requires exactly ${n} track${n===1?"":"s"}.`:`${this.format._name} requires at least ${n} track${n===1?"":"s"}.`);if(this.state==="canceled")throw new Error("Output has been canceled.");return this._startPromise?(console.warn("Output has already been started."),this._startPromise):this._startPromise=(async()=>{this.state="started";const r=await this._mutex.acquire();try{await this._muxer.start();const i=this._tracks.map(s=>s.source._start());await Promise.all(i)}finally{r()}})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){if(this._cancelPromise)return console.warn("Output has already been canceled."),this._cancelPromise;if(this.state==="finalizing"||this.state==="finalized"){this.state==="finalized"&&console.warn("Output has already been finalized.");return}return this._cancelPromise=(async()=>{this.state="canceled";const e=await this._mutex.acquire();try{const n=this._tracks.map(r=>r.source._flushOrWaitForOngoingClose(!0));await Promise.all(n),await Promise.all([...this._unfinalizedTargets].map(r=>r._close())),this._unfinalizedTargets.clear()}finally{e()}})()}async finalize(){if(this.state==="pending")throw new Error("Cannot finalize before starting.");if(this.state==="canceled")throw new Error("Cannot finalize after canceling.");return this._finalizePromise?(console.warn("Output has already been finalized."),this._finalizePromise):this._finalizePromise=(async()=>{this.state="finalizing";const e=await this._mutex.acquire();try{const n=this._tracks.map(r=>r.source._flushOrWaitForOngoingClose(!1));if(await Promise.all(n),await this._muxer.finalize(),this._rootWriterPromise){const r=await this._rootWriterPromise;r.finalized||(await r.flush(),await r.finalize())}this._onFinalize&&await this._onFinalize(),this.state="finalized"}finally{e()}})()}}/*!
1024 * Copyright (c) 2026-present, Vanilagy and contributors
1025 *
1026 * This Source Code Form is subject to the terms of the Mozilla Public
1027 * License, v. 2.0. If a copy of the MPL was not distributed with this
1028 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
1029 */const ff=t=>{if(!t||typeof t!="object")throw new TypeError("options.video, when provided, must be an object.");if((t==null?void 0:t.discard)!==void 0&&typeof t.discard!="boolean")throw new TypeError("options.video.discard, when provided, must be a boolean.");if((t==null?void 0:t.forceTranscode)!==void 0&&typeof t.forceTranscode!="boolean")throw new TypeError("options.video.forceTranscode, when provided, must be a boolean.");if((t==null?void 0:t.codec)!==void 0&&!xt.includes(t.codec))throw new TypeError(`options.video.codec, when provided, must be one of: ${xt.join(", ")}.`);if((t==null?void 0:t.bitrate)!==void 0&&!(t.bitrate instanceof wn)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("options.video.bitrate, when provided, must be a positive integer or a quality.");if((t==null?void 0:t.width)!==void 0&&(!Number.isInteger(t.width)||t.width<=0))throw new TypeError("options.video.width, when provided, must be a positive integer.");if((t==null?void 0:t.height)!==void 0&&(!Number.isInteger(t.height)||t.height<=0))throw new TypeError("options.video.height, when provided, must be a positive integer.");if((t==null?void 0:t.fit)!==void 0&&!["fill","contain","cover"].includes(t.fit))throw new TypeError("options.video.fit, when provided, must be one of 'fill', 'contain', or 'cover'.");if((t==null?void 0:t.width)!==void 0&&t.height!==void 0&&t.fit===void 0)throw new TypeError("When both options.video.width and options.video.height are provided, options.video.fit must also be provided.");if((t==null?void 0:t.rotate)!==void 0&&![0,90,180,270].includes(t.rotate))throw new TypeError("options.video.rotate, when provided, must be 0, 90, 180 or 270.");
1029if((t==null?void 0:t.allowRotationMetadata)!==void 0&&typeof t.allowRotationMetadata!="boolean")throw new TypeError("options.video.allowRotationMetadata, when provided, must be a boolean.");if((t==null?void 0:t.crop)!==void 0&&zc(t.crop,"options.video."),(t==null?void 0:t.frameRate)!==void 0&&(!Number.isFinite(t.frameRate)||t.frameRate<=0))throw new TypeError("options.video.frameRate, when provided, must be a finite positive number.");if((t==null?void 0:t.alpha)!==void 0&&!["discard","keep"].includes(t.alpha))throw new TypeError("options.video.alpha, when provided, must be either 'discard' or 'keep'.");if((t==null?void 0:t.keyFrameInterval)!==void 0&&(!Number.isFinite(t.keyFrameInterval)||t.keyFrameInterval<0))throw new TypeError("options.video.keyFrameInterval, when provided, must be a non-negative number.");if((t==null?void 0:t.process)!==void 0&&typeof t.process!="function")throw new TypeError("options.video.process, when provided, must be a function.");if((t==null?void 0:t.processedWidth)!==void 0&&(!Number.isInteger(t.processedWidth)||t.processedWidth<=0))throw new TypeError("options.video.processedWidth, when provided, must be a positive integer.");if((t==null?void 0:t.processedHeight)!==void 0&&(!Number.isInteger(t.processedHeight)||t.processedHeight<=0))throw new TypeError("options.video.processedHeight, when provided, must be a positive integer.");if((t==null?void 0:t.hardwareAcceleration)!==void 0&&!["no-preference","prefer-hardware","prefer-software"].includes(t.hardwareAcceleration))throw new TypeError("options.video.hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.");if((t==null?void 0:t.group)!==void 0&&!(t.group instanceof Kn||Array.isArray(t.group)&&t.group.every(e=>e instanceof Kn)))throw new TypeError("options.video.group, when provided, must be an OutputTrackGroup or an array of OutputTrackGroups.")},hf=t=>{if(!t||typeof t!="object")throw new TypeError("options.audio, when provided, must be an object.");if((t==null?void 0:t.discard)!==void 0&&typeof t.discard!="boolean")throw new TypeError("options.audio.discard, when provided, must be a boolean.");if((t==null?void 0:t.forceTranscode)!==void 0&&typeof t.forceTranscode!="boolean")throw new TypeError("options.audio.forceTranscode, when provided, must be a boolean.");if((t==null?void 0:t.codec)!==void 0&&!Ut.includes(t.codec))throw new TypeError(`options.audio.codec, when provided, must be one of: ${Ut.join(", ")}.`);if((t==null?void 0:t.bitrate)!==void 0&&!(t.bitrate instanceof wn)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("options.audio.bitrate, when provided, must be a positive integer or a quality.");if((t==null?void 0:t.numberOfChannels)!==void 0&&(!Number.isInteger(t.numberOfChannels)||t.numberOfChannels<=0))throw new TypeError("options.audio.numberOfChannels, when provided, must be a positive integer.");if((t==null?void 0:t.sampleRate)!==void 0&&(!Number.isInteger(t.sampleRate)||t.sampleRate<=0))throw new TypeError("options.audio.sampleRate, when provided, must be a positive integer.");if((t==null?void 0:t.sampleFormat)!==void 0&&!["u8","s16","s32","f32"].includes(t.sampleFormat))throw new TypeError("options.audio.sampleFormat, when provided, must be one of: u8, s16, s32, f32.");if((t==null?void 0:t.process)!==void 0&&typeof t.process!="function")throw new TypeError("options.audio.process, when provided, must be a function.");if((t==null?void 0:t.processedNumberOfChannels)!==void 0&&(!Number.isInteger(t.processedNumberOfChannels)||t.processedNumberOfChannels<=0))throw new TypeError("options.audio.processedNumberOfChannels, when provided, must be a positive integer.");if((t==null?void 0:t.processedSampleRate)!==void 0&&(!Number.isInteger(t.processedSampleRate)||t.processedSampleRate<=0))throw new TypeError("options.audio.processedSampleRate, when provided, must be a positive integer.");if((t==null?void 0:t.group)!==void 0&&!(t.group instanceof Kn||Array.isArray(t.group)&&t.group.every(e=>e instanceof Kn)))throw new TypeError("options.audio.group, when provided, must be an OutputTrackGroup or an array of OutputTrackGroups.")},LA=2,zA=48e3;class QA{static async init(e){const n=new QA(e);return await n._init(),n}constructor(e){var i,s,a;if(this._addedCounts={video:0,audio:0,subtitle:0},this._totalTrackCount=0,this._nextOutputTrackId=0,this._outputTrackIds=[],this._outputOwnTrackGroups=[],this._trackPromises=[],this._executed=!1,this._synchronizer=new dY,this._totalDuration=null,this._maxTimestamps=new Map,this._canceled=!1,this.onProgress=void 0,this._computeProgress=!1,this._lastProgress=0,this.isValid=!1,this.utilizedTracks=[],this.discardedTracks=[],!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.input instanceof Yc))throw new TypeError("options.input must be an Input.");if(!(e.output instanceof df))throw new TypeError("options.output must be an Output.");if(e.tracks!==void 0&&e.tracks!=="all"&&e.tracks!=="primary")throw new TypeError("options.tracks, when provided, must be either 'all' or 'primary'.");if(e.output._tracks.length>0||Object.keys(e.output._metadataTags).length>0||e.output.state!=="pending")throw new TypeError("options.output must be fresh: no tracks or metadata tags added and not started.");
1029if(e.video!==void 0&&typeof e.video!="function")if(Array.isArray(e.video))for(const o of e.video)ff(o);else ff(e.video);if(e.audio!==void 0&&typeof e.audio!="function")if(Array.isArray(e.audio))for(const o of e.audio)hf(o);else hf(e.audio);if(e.trim!==void 0&&(!e.trim||typeof e.trim!="object"))throw new TypeError("options.trim, when provided, must be an object.");if(((i=e.trim)==null?void 0:i.start)!==void 0&&!Number.isFinite(e.trim.start))throw new TypeError("options.trim.start, when provided, must be a finite number.");if(((s=e.trim)==null?void 0:s.end)!==void 0&&!Number.isFinite(e.trim.end))throw new TypeError("options.trim.end, when provided, must be a finite number.");if(((a=e.trim)==null?void 0:a.start)!==void 0&&e.trim.end!==void 0&&e.trim.start>=e.trim.end)throw new TypeError("options.trim.start must be less than options.trim.end.");if(e.tags!==void 0&&(typeof e.tags!="object"||!e.tags)&&typeof e.tags!="function")throw new TypeError("options.tags, when provided, must be an object or a function.");if(typeof e.tags=="object"&&Zm(e.tags),e.showWarnings!==void 0&&typeof e.showWarnings!="boolean")throw new TypeError("options.showWarnings, when provided, must be a boolean.");this._options=e,this.input=e.input,this.output=e.output;const{promise:n,resolve:r}=wt();this._started=n,this._start=r}async _init(){var h,m;const e=await this.input.getFormat();let n,r=this._options.tracks;if(r===void 0&&(r=e.name.includes("(HLS)")?"primary":"all"),r==="all")n=await this.input.getTracks();else if(r==="primary"){const p=await this.input.getPrimaryVideoTrack(),g=await this.input.getPrimaryAudioTrack();n=[p,g].filter(A=>A!==null)}else rn(r),b(!1);const i=this.output.format.getSupportedTrackCounts();let s=1,a=1;const o=[],c=[];for(const p of n){let g;if(p.isVideoTrack())if(this._options.video)if(typeof this._options.video=="function"){const w=await this._options.video(p,s)??{};if(Array.isArray(w))for(const E of w)ff(E);else ff(w);g=Array.isArray(w)?w:[w],s++}else g=Array.isArray(this._options.video)?this._options.video:[this._options.video];else g=[{}];else if(p.isAudioTrack())if(this._options.audio)if(typeof this._options.audio=="function"){const w=await this._options.audio(p,a)??{};if(Array.isArray(w))for(const E of w)hf(E);else hf(w);g=Array.isArray(w)?w:[w],a++}else g=Array.isArray(this._options.audio)?this._options.audio:[this._options.audio];else g=[{}];else b(!1);const A=g.filter(w=>w.discard);for(const w of A)this.discardedTracks.push({track:p,reason:"discarded_by_user",trackOptions:w});if(g.length===A.length){g.length===0&&this.discardedTracks.push({track:p,reason:"discarded_by_user",trackOptions:{}});continue}const y=g.filter(w=>!w.discard);o.push(p),c.push(y)}((h=this._options.trim)==null?void 0:h.start)!==void 0?this._startTimestamp=this._options.trim.start:this._startTimestamp=Math.max(await this.input.getFirstTimestamp(o),0),this._endTimestamp=Math.max(((m=this._options.trim)==null?void 0:m.end)??1/0,this._startTimestamp);for(let p=0;p<o.length;p++){const g=o[p],A=c[p];for(const y of A){if(this._totalTrackCount===i.total.max){this.discardedTracks.push({track:g,reason:"max_track_count_reached",trackOptions:y});continue}if(this._addedCounts[g.type]===i[g.type].max){this.discardedTracks.push({track:g,reason:"max_track_count_of_type_reached",trackOptions:y});continue}const w=this._nextOutputTrackId++;g.isVideoTrack()?await this._processVideoTrack(g,y,w):g.isAudioTrack()?await this._processAudioTrack(g,y,w):b(!1)}}for(let p=0;p<this.utilizedTracks.length-1;p++)for(let g=p+1;g<this.utilizedTracks.length;g++){const A=this.utilizedTracks[p],y=this.utilizedTracks[g],w=this._outputOwnTrackGroups[p],E=this._outputOwnTrackGroups[g];b(w!==void 0),b(E!==void 0),w&&E&&A.canBePairedWith(y)&&w.pairWith(E)}const u=await this.input.getMetadataTags();let l;if(this._options.tags){const p=typeof this._options.tags=="function"?await this._options.tags(u):this._options.tags;Zm(p),l=p}else l=u;const d=e.mimeType===this.output.format.mimeType,f=u.raw===l.raw;if(u.raw&&f&&!d&&delete l.raw,this.output.setMetadataTags(l),this.isValid=this._totalTrackCount>=i.total.min&&this._addedCounts.video>=i.video.min&&this._addedCounts.audio>=i.audio.min&&this._addedCounts.subtitle>=i.subtitle.min,this._options.showWarnings??!0){const p=[],g=this.discardedTracks.filter(A=>A.reason!=="discarded_by_user");g.length>0&&p.push("Some tracks had to be discarded from the conversion:",g),this.isValid||(p.length>0&&p.push(`
1030
1031`),p.push(this._getInvalidityExplanation().join(""))),p.length>0&&console.warn(...p)}}_getInvalidityExplanation(){const e=[];
1031if(this.discardedTracks.length===0)e.push("Due to missing tracks, this conversion cannot be executed.");else{const n=this.discardedTracks.every(r=>r.reason==="discarded_by_user"||r.reason==="no_encodable_target_codec")&&this.discardedTracks.some(r=>r.reason==="no_encodable_target_codec");if(e.push("Due to discarded tracks, this conversion cannot be executed."),n){const r=this.discardedTracks.flatMap(s=>s.reason==="discarded_by_user"?[]:s.track.type==="video"?this.output.format.getSupportedVideoCodecs():s.track.type==="audio"?this.output.format.getSupportedAudioCodecs():this.output.format.getSupportedSubtitleCodecs()),i=[...new Set(r)];i.length===1?e.push(`
1032Tracks were discarded because your environment is not able to encode '${i[0]}'.`):e.push(`
1033Tracks were discarded because your environment is not able to encode any of the following codecs: ${i.map(s=>`'${s}'`).join(", ")}.`),i.includes("mp3")&&e.push(`
1034The @mediabunny/mp3-encoder extension package provides support for encoding MP3.`),i.includes("aac")&&e.push(`
1035The @mediabunny/aac-encoder extension package provides support for encoding AAC.`),(i.includes("ac3")||i.includes("eac3"))&&e.push(`
1036The @mediabunny/ac3 extension package provides support for encoding and decoding AC-3/E-AC-3.`),i.includes("flac")&&e.push(`
1037The @mediabunny/flac-encoder extension package provides support for encoding FLAC.`)}else e.push(`
1038Check the discardedTracks field for more info.`)}return e}async execute(){var e,n;if(!this.isValid)throw new Error(`Cannot execute this conversion because its output configuration is invalid. Make sure to always check the isValid field before executing a conversion.
1039`+this._getInvalidityExplanation().join(""));if(this._executed)throw new Error("Conversion cannot be executed twice.");this._executed=!0;for(const r of this._outputTrackIds)this._synchronizer.declareTrack(r);if(this.onProgress){const i=[...new Set(this.utilizedTracks)].map(async a=>await a.isLive()?1/0:await a.getDurationFromMetadata()??await a.computeDuration()),s=Math.max(0,...await Promise.all(i));this._computeProgress=!0,this._totalDuration=Math.min(s-this._startTimestamp,this._endTimestamp-this._startTimestamp);for(const a of this._outputTrackIds)this._maxTimestamps.set(a,0);(e=this.onProgress)==null||e.call(this,0,0)}await this.output.start(),this._start();try{await Promise.all(this._trackPromises)}catch(r){throw this._canceled||this.cancel(),r}if(this._canceled)throw new vv;if(await this.output.finalize(),this._computeProgress){const r=Math.min(...this._maxTimestamps.values());(n=this.onProgress)==null||n.call(this,1,r)}}async cancel(){if(!(this.output.state==="finalizing"||this.output.state==="finalized")){if(this._canceled){console.warn("Conversion already canceled.");return}this._canceled=!0,await this.output.cancel()}}async _processVideoTrack(e,n,r){const i=await e.getCodec();if(!i){this.discardedTracks.push({track:e,reason:"unknown_source_codec",trackOptions:n});return}let s;const a=await e.getRotation(),o=Na(a+(n.rotate??0));let c=o;const u=this.output.format.supportsVideoRotationMetadata&&(n.allowRotationMetadata??!0),l=await e.getSquarePixelWidth(),d=await e.getSquarePixelHeight(),[f,h]=o%180===0?[l,d]:[d,l];let m=n.crop;m&&(m=Qd(m,f,h));const[p,g]=m?[m.width,m.height]:[f,h];let A=p,y=g;const w=A/y;n.width!==void 0&&n.height===void 0?(A=Va(n.width),y=Va(Math.round(A/w))):n.width===void 0&&n.height!==void 0?(y=Va(n.height),A=Va(Math.round(y*w))):n.width!==void 0&&n.height!==void 0&&(A=Va(n.width),y=Va(n.height));const E=await e.getFirstTimestamp();let S=this.output.format.getSupportedVideoCodecs();const k=!!n.forceTranscode||E<this._startTimestamp||!!n.frameRate||n.keyFrameInterval!==void 0||n.process!==void 0||n.bitrate!==void 0||!S.includes(i)||n.codec&&n.codec!==i||A!==p||y!==g||o!==0&&!u||!!m,T=n.alpha??"discard";if(k){if(!await e.canDecode()){this.discardedTracks.push({track:e,reason:"undecodable_source_codec",trackOptions:n});return}n.codec&&(S=S.filter(N=>N===n.codec));const P=n.bitrate??nA,v=await Ux(S,{width:n.process&&n.processedWidth?n.processedWidth:A,height:n.process&&n.processedHeight?n.processedHeight:y,bitrate:P});if(!v){this.discardedTracks.push({track:e,reason:"no_encodable_target_co
1039dec",trackOptions:n});return}const M={codec:v,bitrate:P,keyFrameInterval:n.keyFrameInterval,sizeChangeBehavior:n.fit??"passThrough",alpha:T,hardwareAcceleration:n.hardwareAcceleration,transform:{}};b(M.transform);let D=A!==p||y!==g||o!==0&&(!u||n.process!==void 0)||!!m||l!==await e.getCodedWidth()||d!==await e.getCodedHeight();if(!D){const N=new df({format:new FA,target:new SA}),Q=new IA(M);N.addVideoTrack(Q),await N.start();const V=await new Xd(e).getSample(E);if(V)try{await Q.add(V),V.close(),await N.finalize()}catch(Z){console.info("Error when probing encoder support. Falling back to rerender path.",Z),D=!0,N.cancel()}else await N.cancel()}n.frameRate&&(M.transform.frameRate=n.frameRate),D&&(c=0,M.transform.width=A,M.transform.height=y,M.transform.fit=n.fit??"fill",M.transform.rotate=Na(o-a),M.transform.crop=m,M.transform.alpha=T);const O=new IA(M);s=O,this._trackPromises.push((async()=>{await this._started;const N=new Xd(e);for await(const Q of N.samples(this._startTimestamp,this._endTimestamp)){if(this._canceled){Q.close();return}const G=Math.max(Q.timestamp-this._startTimestamp,0);Q.setTimestamp(G),await this._registerVideoSample(n,r,O,Q),Q.close()}O.close(),this._synchronizer.closeTrack(r)})())}else{const x=new TA(i);s=x,this._trackPromises.push((async()=>{await this._started;const P=new ao(e),M={decoderConfig:await e.getDecoderConfig()??void 0};for await(const D of P.packets(void 0,void 0,{verifyKeyPackets:!0})){if(this._canceled)return;if(D.timestamp>=this._endTimestamp)break;const O=D.clone({timestamp:D.timestamp-this._startTimestamp,sideData:T==="discard"?{}:D.sideData});b(O.timestamp>=0),this._reportProgress(r,O.timestamp+O.duration),await x.add(O,M),this._synchronizer.shouldWait(r,O.timestamp)&&await this._synchronizer.wait(O.timestamp)}x.close(),this._synchronizer.closeTrack(r)})())}let C=null;n.group||(C=new Kn);const _=await e.getLanguageCode();this.output.addVideoTrack(s,{frameRate:n.frameRate,languageCode:bc(_)?_:void 0,name:await e.getName()??void 0,disposition:await e.getDisposition(),rotation:c,group:C??n.group}),this._addedCounts.video++,this._totalTrackCount++,this.utilizedTracks.push(e),this._outputTrackIds.push(r),this._outputOwnTrackGroups.push(C)}async _registerVideoSample(e,n,r,i){if(this._canceled)return;this._reportProgress(n,i.timestamp+i.duration);let s;if(!e.process)s=[i];else{let a=e.process(i);a instanceof Promise&&(a=await a),Array.isArray(a)||(a=a===null?[]:[a]),s=a.map(o=>o instanceof Ft?o:typeof VideoFrame<"u"&&o instanceof VideoFrame?new Ft(o):new Ft(o,{timestamp:i.timestamp,duration:i.duration}))}try{for(const a of s){if(this._canceled)break;await r.add(a),this._synchronizer.shouldWait(n,a.timestamp)&&await this._synchronizer.wait(a.timestamp)}}finally{for(const a of s)a!==i&&a.close()}}async _processAudioTrack(e,n,r){const i=await e.getCodec();if(!i){this.discardedTracks.push({track:e,reason:"unknown_source_codec",trackOptions:n});return}let s;const a=await e.getNumberOfChannels(),o=await e.getSampleRate(),c=await e.getFirstTimestamp();let u=n.numberOfChannels??a,l=n.sampleRate??o,d=u!==a||l!==o||c<this._startTimestamp||c>this._startTimestamp&&!this.output.format.supportsTimestampedMediaData,f=this.output.format.getSupportedAudioCodecs();if(!n.forceTranscode&&!n.bitrate&&!d&&f.includes(i)&&(!n.codec||n.codec===i)&&!n.process&&n.sampleFormat===void 0){const p=new CA(i);s=p,this._trackPromises.push((async()=>{await this._started;const g=new ao(e),y={decoderConfig:await e.getDecoderConfig()??void 0};for await(const w of g.packets()){if(this._canceled)return;if(w.timestamp>=this._endTimestamp)break;const E=w.clone({timestamp:w.timestamp-this._startTimestamp});b(E.timestamp>=0),this._reportProgress(r,E.timestamp+E.duration),await p.add(E,y),this._synchronizer.shouldWait(r,E.timestamp)&&await this._synchronizer.wait(E.timestamp)}p.close(),this._synchronizer.closeTrack(r)})())}else{if(!await e.canDecode()){this.discardedTracks.push({track:e,reason:"undecodable_source_codec",trackOptions:n});return}let g=null;n.codec&&(f=f.filter(w=>w===n.codec));const A=n.bitrate??nA,y=await Yd(f,{numberOfChannels:n.process&&n.processedNumberOfChannels?n.processedNumberOfChannels:u,sampleRate:n.process&&n.processedSampleRate?n.processedSampleRate:l,bitrate:A});if(!y.some(w=>Ni.includes(w))&&f.some(w=>Ni.includes(w))&&(u!==LA||l!==zA)){const E=(await Yd(f,{numberOfChannels:LA,sampleRate:zA,bitrate:A})).find(S=>Ni.includes(S));E&&(d=!0,g=E,u=LA,l=zA)}else g=y[0]??null;if(g===null){this.discardedTracks.push({track:e,reason:"no_encodable_target_co
1039dec",trackOptions:n});return}if(d)s=this._resampleAudio(e,n,r,g,u,l,A);else{const w=new vA({codec:g,bitrate:A});s=w,this._trackPromises.push((async()=>{await this._started;const E=new Jd(e);for await(const S of E.samples(void 0,this._endTimestamp)){if(this._canceled){S.close();return}S.setTimestamp(S.timestamp-this._startTimestamp),await this._registerAudioSample(n,r,w,S),S.close()}w.close(),this._synchronizer.closeTrack(r)})())}}let h=null;n.group||(h=new Kn);const m=await e.getLanguageCode();this.output.addAudioTrack(s,{languageCode:bc(m)?m:void 0,name:await e.getName()??void 0,disposition:await e.getDisposition(),group:h??n.group}),this._addedCounts.audio++,this._totalTrackCount++,this.utilizedTracks.push(e),this._outputTrackIds.push(r),this._outputOwnTrackGroups.push(h)}async _registerAudioSample(e,n,r,i){if(this._canceled)return;let s=i;e.sampleFormat!==void 0&&Bx(s.format)!==e.sampleFormat&&(s=Px(s,e.sampleFormat)),this._reportProgress(n,s.timestamp+s.duration);let a;if(!e.process)a=[s];else{let o=e.process(s);if(o instanceof Promise&&(o=await o),Array.isArray(o)||(o=o===null?[]:[o]),!o.every(c=>c instanceof Wt))throw new TypeError("The audio process function must return an AudioSample, null, or an array of AudioSamples.");a=o}try{for(const o of a){if(this._canceled)break;await r.add(o),this._synchronizer.shouldWait(n,o.timestamp)&&await this._synchronizer.wait(o.timestamp)}}finally{s!==i&&s.close();for(const o of a)o!==i&&o.close()}}_resampleAudio(e,n,r,i,s,a,o){const c=new vA({codec:i,bitrate:o});return this._trackPromises.push((async()=>{await this._started;const u=new Sv({targetNumberOfChannels:s,targetSampleRate:a,startTime:this._startTimestamp,endTime:this._endTimestamp,onSample:async f=>{b(f.timestamp>=this._startTimestamp),f.setTimestamp(f.timestamp-this._startTimestamp),await this._registerAudioSample(n,r,c,f),f.close()}}),d=new Jd(e).samples(this._startTimestamp,this._endTimestamp);for await(const f of d){if(this._canceled){f.close();return}await u.add(f),f.close()}await u.finalize(),c.close(),this._synchronizer.closeTrack(r)})()),c}_reportProgress(e,n){var s;if(!this._computeProgress)return;b(this._totalDuration!==null),this._maxTimestamps.set(e,Math.max(n,this._maxTimestamps.get(e)));const r=Math.min(...this._maxTimestamps.values()),i=Yt(r/this._totalDuration,0,1);i!==this._lastProgress&&(this._lastProgress=i,(s=this.onProgress)==null||s.call(this,i,r))}}class vv extends Error{constructor(e="Conversion has been canceled."){super(e),this.name="ConversionCanceledError"}}const Bv=1;class dY{constructor(){this.maxTimestamps=new Map,this.resolvers=[]}declareTrack(e){this.maxTimestamps.set(e,0)}shouldWait(e,n){const r=this.maxTimestamps.get(e);b(r!==void 0),this.maxTimestamps.set(e,Math.max(n,r));const i=this.computeMinAndMaybeResolve();return n-i>Bv}wait(e){const{promise:n,resolve:r}=wt();return this.resolvers.push({timestamp:e,resolve:r}),n}closeTrack(e){this.maxTimestamps.delete(e),this.computeMinAndMaybeResolve()}computeMinAndMaybeResolve(){let e=1/0;for(const[,n]of this.maxTimestamps)e=Math.min(e,n);for(let n=0;n<this.resolvers.length;n++){const r=this.resolvers[n];r.timestamp-e<Bv&&(r.resolve(),this.resolvers.splice(n,1),n--)}return e}}/*!
1040 * Copyright (c) 2026-present, Vanilagy and contributors
1041 *
1042 * This Source Code Form is subject to the terms of the Mozilla Public
1043 * License, v. 2.0. If a copy of the MPL was not distributed with this
1044 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
1045 */const Pv=Symbol.for("mediabunny loaded");globalThis[Pv]&&console.error(`[WARNING]
1046Mediabunny was loaded twice. This will likely cause Mediabunny not to work correctly. Check if multiple dependencies are importing different versions of Mediabunny, or if something is being bundled incorrectly.`),globalThis[Pv]=!0;var fY=Object.freeze({__proto__:null,ADTS:Vg,ALL_FORMATS:g5,ALL_TRACK_TYPES:kv,AUDIO_CODECS:Ut,AdtsInputFormat:px,AdtsOutputFormat:oY,AppendOnlyStreamTarget:kq,AttachedFile:yd,AudioBufferSink:J5,AudioBufferSource:Kq,AudioSample:Wt,AudioSampleResource:io,AudioSampleSink:Jd,AudioSampleSource:vA,AudioSource:mo,BaseMediaSampleSink:sA,BlobSource:u5,BufferSource:c5,BufferTarget:af,CanvasSink:j5,CanvasSource:qq,CmafOutputFormat:MA,ConcurrentRunner:GW,Conversion:QA,ConversionCanceledError:vv,CustomAudioDecoder:zx,CustomAudioEncoder:Hx,CustomPathedSource:jC,CustomSource:Dg,CustomVideoDecoder:Lx,CustomVideoEncoder:Qx,EncodedAudioPacketSource:CA,EncodedPacket:nt,EncodedPacketSink:ao,EncodedVideoPacketSource:TA,EventEmitter:Ic,FLAC:bx,FilePathSource:Mg,FilePathTarget:Iq,FlacInputFormat:hx,FlacOutputFormat:cY,HLS:qg,HLS_FORMATS:A5,HlsInputFormat:zg,HlsOutputFormat:lY,Input:Yc,InputAudioTrack:Gc,InputDisposedError:bn,InputFormat:or,InputTrack:oo,InputVideoTrack:Vc,IsobmffInputFormat:Ug,IsobmffOutputFormat:lf,MATROSKA:gx,MP3:Wg,MP4:Qg,MPEG_TS:Gg,MatroskaInputFormat:Lg,MediaSource:of,MediaStreamAudioTrackSource:jq,MediaStreamVideoTrackSource:Yq,MkvOutputFormat:OA,MovOutputFormat:DA,Mp3InputFormat:lx,Mp3OutputFormat:iY,Mp4InputFormat:ox,Mp4OutputFormat:FA,MpegTsInputFormat:mx,MpegTsOutputFormat:uY,NON_PCM_AUDIO_CODECS:Ni,NullTarget:SA,OGG:wx,OggInputFormat:fx,OggOutputFormat:aY,Output:df,OutputAudioTrack:Cv,OutputFormat:Mn,OutputSubt
1046itleTrack:xv,OutputTrack:go,OutputTrackGroup:Kn,OutputVideoTrack:Iv,PCM_AUDIO_CODECS:Nt,PathedSource:Ms,PathedTarget:ui,QTFF:Hg,QUALITY_HIGH:nA,QUALITY_LOW:M5,QUALITY_MEDIUM:D5,QUALITY_VERY_HIGH:O5,QUALITY_VERY_LOW:F5,Quality:wn,QuickTimeInputFormat:cx,RangedSource:JC,RangedTarget:dv,ReadableStreamSource:XC,RichImageData:Is,SUBTITLE_CODECS:ir,Source:Rn,SourceRef:Nd,StreamSource:f5,StreamTarget:EA,SubtitleSource:RA,Target:Sn,TextSubtitleSource:eY,UnsupportedInputFormatError:uA,UrlSource:Fg,VIDEO_CODECS:xt,VIDEO_SAMPLE_PIXEL_FORMATS:Ld,VideoSample:Ft,VideoSampleColorSpace:zd,VideoSampleResource:Gi,VideoSampleSink:Xd,VideoSampleSource:IA,VideoSource:po,WAVE:yx,WEBM:Ax,WavOutputFormat:sY,WaveInputFormat:dx,WebMInputFormat:ux,WebMOutputFormat:NA,asc:Z5,canDecode:E5,canDecodeAudio:$g,canDecodeVideo:jg,canEncode:N5,canEncodeAudio:Gd,canEncodeSubtitles:qd,canEncodeVideo:Vd,desc:oA,getDecodableAudioCodecs:Sx,getDecodableCodecs:S5,getDecodableVideoCodecs:Ex,getEncodableAudioCodecs:Yd,getEncodableCodecs:U5,getEncodableSubtitleCodecs:Nx,getEncodableVideoCodecs:Ox,getFirstEncodableAudioCodec:L5,getFirstEncodableSubtitleCodec:z5,getFirstEncodableVideoCodec:Ux,prefer:co,registerDecoder:Q5,registerEncoder:H5,registerVideoSampleTransformer:I5})})();
1047!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f565609a-a009-50f5-b783-d35ced4c129a")}catch(e){}}()
1048//# debugId=f565609a-a009-50f5-b783-d35ced4c129a
1049//# sourceMappingURL=upload-entry-worker-with-sentry.worker-DN2vIHJW.js.map

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.