You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
698 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
"use strict";var VL=Object.create;var Wo=Object.defineProperty;var FL=Object.getOwnPropertyDescriptor;var zL=Object.getOwnPropertyNames;var UL=Object.getPrototypeOf,jL=Object.prototype.hasOwnProperty;var HL=(t,e,n)=>e in t?Wo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ue=(t,e)=>()=>(t&&(e=t(t=0)),e);var pt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kt=(t,e)=>{for(var n in e)Wo(t,n,{get:e[n],enumerable:!0})},Ix=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zL(e))!jL.call(t,r)&&r!==n&&Wo(t,r,{get:()=>e[r],enumerable:!(i=FL(e,r))||i.enumerable});return t};var $=(t,e,n)=>(n=t!=null?VL(UL(t)):{},Ix(e||!t||!t.__esModule?Wo(n,"default",{value:t,enumerable:!0}):n,t)),qL=t=>Ix(Wo({},"__esModule",{value:!0}),t);var _=(t,e,n)=>(HL(t,typeof e!="symbol"?e+"":e,n),n),fg=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var k=(t,e,n)=>(fg(t,e,"read from private field"),n?n.call(t):e.get(t)),V=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},we=(t,e,n,i)=>(fg(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);var M=(t,e,n)=>(fg(t,e,"access private method"),n);var n0=pt(ie=>{"use strict";var Yo=Symbol.for("react.element"),nI=Symbol.for("react.portal"),iI=Symbol.for("react.fragment"),rI=Symbol.for("react.strict_mode"),sI=Symbol.for("react.profiler"),aI=Symbol.for("react.provider"),oI=Symbol.for("react.context"),lI=Symbol.for("react.forward_ref"),cI=Symbol.for("react.suspense"),uI=Symbol.for("react.memo"),dI=Symbol.for("react.lazy"),Wx=Symbol.iterator;function pI(t){return t===null||typeof t!="object"?null:(t=Wx&&t[Wx]||t["@@iterator"],typeof t=="function"?t:null)}var Yx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Qx=Object.assign,Xx={};function ea(t,e,n){this.props=t,this.context=e,this.refs=Xx,this.updater=n||Yx}ea.prototype.isReactComponent={};ea.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ea.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Zx(){}Zx.prototype=ea.prototype;function wg(t,e,n){this.props=t,this.context=e,this.refs=Xx,this.updater=n||Yx}var bg=wg.prototype=new Zx;bg.constructor=wg;Qx(bg,ea.prototype);bg.isPureReactComponent=!0;var Kx=Array.isArray,Jx=Object.prototype.hasOwnProperty,xg={current:null},e0={key:!0,ref:!0,__self:!0,__source:!0};function t0(t,e,n){var i,r={},s=null,a=null;if(e!=null)for(i in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)Jx.call(e,i)&&!e0.hasOwnProperty(i)&&(r[i]=e[i]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];r.children=l}if(t&&t.defaultProps)for(i in o=t.defaultProps,o)r[i]===void 0&&(r[i]=o[i]);return{$$typeof:Yo,type:t,key:s,ref:a,props:r,_owner:xg.current}}function hI(t,e){return{$$typeof:Yo,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function kg(t){return typeof t=="object"&&t!==null&&t.$$typeof===Yo}function fI(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Gx=/\/+/g;function _g(t,e){return typeof t=="object"&&t!==null&&t.key!=null?fI(""+t.key):e.toString(36)}function ld(t,e,n,i,r){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case Yo:case nI:a=!0}}if(a)return a=t,r=r(a),t=i===""?"."+_g(a,0):i,Kx(r)?(n="",t!=null&&(n=t.replace(Gx,"$&/")+"/"),ld(r,e,n,"",function(c){return c})):r!=null&&(kg(r)&&(r=hI(r,n+(!r.key||a&&a.key===r.key?"":(""+r.key).replace(Gx,"$&/")+"/")+t)),e.push(r)),1;if(a=0,i=i===""?".":i+":",Kx(t))for(var o=0;o<t.length;o++){s=t[o];var l=i+_g(s,o);a+=ld(s,e,n,l,r)}else if(l=pI(t),typeof l=="function")for(t=l.call(t),o=0;!(s=t.next()).done;)s=s.value,l=i+_g(s,o++),a+=ld(s,e,n,l,r);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function od(t,e,n){if(t==null)return t;var i=[],r=0;return ld(t,i,"","",function(s){return e.call(n,s,r++)}),i}function mI(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var St={current:null},cd={transition:null},gI={ReactCurrentDispatcher:St,ReactCurrentBatchConfig:cd,ReactCurrentOwner:xg};ie.Children={map:od,forEach:function(t,e,n){od(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return od(t,function(){e++}),e},toArray:function(t){return od(t,function(e){return e})||[]},only:function(t){if(!kg(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ie.Component=ea;ie.Fragment=iI;ie.Profiler=sI;ie.PureComponent=wg;ie.StrictMode=rI;ie.Suspense=cI;ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gI;ie.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=Qx({},t.props),r=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=xg.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)Jx.call(e,l)&&!e0.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){o=Array(l);for(var c=0;c<l;c++)o[c]=arguments[c+2];i.children=o}return{$$typeof:Yo,type:t.type,key:r,ref:s,props:i,_owner:a}};ie.createContext=function(t){return t={$$typeof:oI,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:aI,_context:t},t.Consumer=t};ie.createElement=t0;ie.createFactory=function(t){var e=t0.bind(null,t);return e.type=t,e};ie.createRef=function(){return{current:null}};ie.forwardRef=function(t){return{$$typeof:lI,render:t}};ie.isValidElement=kg;ie.lazy=function(t){return{$$typeof:dI,_payload:{_status:-1,_result:t},_init:mI}};ie.memo=function(t,e){return{$$typeof:uI,type:t,compare:e===void 0?null:e}};ie.startTransition=function(t){var e=cd.transition;cd.transition={};try{t()}finally{cd.transition=e}};ie.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};ie.useCallback=function(t,e){return St.current.useCallback(t,e)};ie.useContext=function(t){return St.current.useContext(t)};ie.useDebugValue=function(){};ie.useDeferredValue=function(t){return St.current.useDeferredValue(t)};ie.useEffect=function(t,e){return St.current.useEffect(t,e)};ie.useId=function(){return St.current.useId()};ie.useImperativeHandle=function(t,e,n){return St.current.useImperativeHandle(t,e,n)};ie.useInsertionEffect=function(t,e){return St.current.useInsertionEffect(t,e)};ie.useLayoutEffect=function(t,e){return St.current.useLayoutEffect(t,e)};ie.useMemo=function(t,e){return St.current.useMemo(t,e)};ie.useReducer=function(t,e,n){return St.current.useReducer(t,e,n)};ie.useRef=function(t){return St.current.useRef(t)};ie.useState=function(t){return St.current.useState(t)};ie.useSyncExternalStore=function(t,e,n){return St.current.useSyncExternalStore(t,e,n)};ie.useTransition=function(){return St.current.useTransition()};ie.version="18.2.0"});var j=pt((Az,i0)=>{"use strict";i0.exports=n0()});var h0=pt(ge=>{"use strict";function Pg(t,e){var n=t.length;t.push(e);e:for(;0<n;){var i=n-1>>>1,r=t[i];if(0<ud(r,e))t[i]=e,t[n]=r,n=i;else break e}}function Wn(t){return t.length===0?null:t[0]}function pd(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;e:for(var i=0,r=t.length,s=r>>>1;i<s;){var a=2*(i+1)-1,o=t[a],l=a+1,c=t[l];if(0>ud(o,n))l<r&&0>ud(c,o)?(t[i]=c,t[l]=n,i=l):(t[i]=o,t[a]=n,i=a);else if(l<r&&0>ud(c,n))t[i]=c,t[l]=n,i=l;else break e}}return e}function ud(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(r0=performance,ge.unstable_now=function(){return r0.now()}):(Tg=Date,s0=Tg.now(),ge.unstable_now=function(){return Tg.now()-s0});var r0,Tg,s0,ui=[],dr=[],vI=1,wn=null,ht=3,hd=!1,as=!1,Xo=!1,l0=typeof setTimeout=="function"?setTimeout:null,c0=typeof clearTimeout=="function"?clearTimeout:null,a0=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Cg(t){for(var e=Wn(dr);e!==null;){if(e.callback===null)pd(dr);else if(e.startTime<=t)pd(dr),e.sortIndex=e.expirationTime,Pg(ui,e);else break;e=Wn(dr)}}function $g(t){if(Xo=!1,Cg(t),!as)if(Wn(ui)!==null)as=!0,Rg(Mg);else{var e=Wn(dr);e!==null&&Lg($g,e.startTime-t)}}function Mg(t,e){as=!1,Xo&&(Xo=!1,c0(Zo),Zo=-1),hd=!0;var n=ht;try{for(Cg(e),wn=Wn(ui);wn!==null&&(!(wn.expirationTime>e)||t&&!p0());){var i=wn.callback;if(typeof i=="function"){wn.callback=null,ht=wn.priorityLevel;var r=i(wn.expirationTime<=e);e=ge.unstable_now(),typeof r=="function"?wn.callback=r:wn===Wn(ui)&&pd(ui),Cg(e)}else pd(ui);wn=Wn(ui)}if(wn!==null)var s=!0;else{var a=Wn(dr);a!==null&&Lg($g,a.startTime-e),s=!1}return s}finally{wn=null,ht=n,hd=!1}}var fd=!1,dd=null,Zo=-1,u0=5,d0=-1;function p0(){return!(ge.unstable_now()-d0<u0)}function Eg(){if(dd!==null){var t=ge.unstable_now();d0=t;var e=!0;try{e=dd(!0,t)}finally{e?Qo():(fd=!1,dd=null)}}else fd=!1}var Qo;typeof a0=="function"?Qo=function(){a0(Eg)}:typeof MessageChannel<"u"?(Sg=new MessageChannel,o0=Sg.port2,Sg.port1.onmessage=Eg,Qo=function(){o0.postMessage(null)}):Qo=function(){l0(Eg,0)};var Sg,o0;function Rg(t){dd=t,fd||(fd=!0,Qo())}function Lg(t,e){Zo=l0(function(){t(ge.unstable_now())},e)}ge.unstable_IdlePriority=5;ge.unstable_ImmediatePriority=1;ge.unstable_LowPriority=4;ge.unstable_NormalPriority=3;ge.unstable_Profiling=null;ge.unstable_UserBlockingPriority=2;ge.unstable_cancelCallback=function(t){t.callback=null};ge.unstable_continueExecution=function(){as||hd||(as=!0,Rg(Mg))};ge.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):u0=0<t?Math.floor(1e3/t):5};ge.unstable_getCurrentPriorityLevel=function(){return ht};ge.unstable_getFirstCallbackNode=function(){return Wn(ui)};ge.unstable_next=function(t){switch(ht){case 1:case 2:case 3:var e=3;break;default:e=ht}var n=ht;ht=e;try{return t()}finally{ht=n}};ge.unstable_pauseExecution=function(){};ge.unstable_requestPaint=function(){};ge.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=ht;ht=t;try{return e()}finally{ht=n}};ge.unstable_scheduleCallback=function(t,e,n){var i=ge.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?i+n:i):n=i,t){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5e3}return r=n+r,t={id:vI++,callback:e,priorityLevel:t,startTime:n,expirationTime:r,sortIndex:-1},n>i?(t.sortIndex=n,Pg(dr,t),Wn(ui)===null&&t===Wn(dr)&&(Xo?(c0(Zo),Zo=-1):Xo=!0,Lg($g,n-i))):(t.sortIndex=r,Pg(ui,t),as||hd||(as=!0,Rg(Mg))),t};ge.unstable_shouldYield=p0;ge.unstable_wrapCallback=function(t){var e=ht;return function(){var n=ht;ht=e;try{return t.apply(this,arguments)}finally{ht=n}}}});var m0=pt((Dz,f0)=>{"use strict";f0.exports=h0()});var bE=pt(on=>{"use strict";var xk=j(),sn=m0();function P(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var kk=new Set,wl={};function _s(t,e){ba(t,e),ba(t+"Capture",e)}function ba(t,e){for(wl[t]=e,t=0;t<e.length;t++)kk.add(e[t])}var Vi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tv=Object.prototype.hasOwnProperty,yI=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g0={},v0={};function _I(t){return tv.call(v0,t)?!0:tv.call(g0,t)?!1:yI.test(t)?v0[t]=!0:(g0[t]=!0,!1)}function wI(t,e,n,i){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function bI(t,e,n,i){if(e===null||typeof e>"u"||wI(t,e,n,i))return!0;if(i)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function $t(t,e,n,i,r,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lt[t]=new $t(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lt[e]=new $t(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lt[t]=new $t(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lt[t]=new $t(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lt[t]=new $t(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lt[t]=new $t(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lt[t]=new $t(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lt[t]=new $t(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lt[t]=new $t(t,5,!1,t.toLowerCase(),null,!1,!1)});var Kv=/[\-:]([a-z])/g;function Gv(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Kv,Gv);lt[e]=new $t(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Kv,Gv);lt[e]=new $t(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Kv,Gv);lt[e]=new $t(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lt[t]=new $t(t,1,!1,t.toLowerCase(),null,!1,!1)});lt.xlinkHref=new $t("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lt[t]=new $t(t,1,!1,t.toLowerCase(),null,!0,!0)});function Yv(t,e,n,i){var r=lt.hasOwnProperty(e)?lt[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(bI(e,n,r,i)&&(n=null),i||r===null?_I(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):r.mustUseProperty?t[r.propertyName]=n===null?r.type===3?!1:"":n:(e=r.attributeName,i=r.attributeNamespace,n===null?t.removeAttribute(e):(r=r.type,n=r===3||r===4&&n===!0?"":""+n,i?t.setAttributeNS(i,e,n):t.setAttribute(e,n))))}var ji=xk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,md=Symbol.for("react.element"),ia=Symbol.for("react.portal"),ra=Symbol.for("react.fragment"),Qv=Symbol.for("react.strict_mode"),nv=Symbol.for("react.profiler"),Tk=Symbol.for("react.provider"),Ek=Symbol.for("react.context"),Xv=Symbol.for("react.forward_ref"),iv=Symbol.for("react.suspense"),rv=Symbol.for("react.suspense_list"),Zv=Symbol.for("react.memo"),hr=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var Sk=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var y0=Symbol.iterator;function Jo(t){return t===null||typeof t!="object"?null:(t=y0&&t[y0]||t["@@iterator"],typeof t=="function"?t:null)}var Re=Object.assign,Ig;function ol(t){if(Ig===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Ig=e&&e[1]||""}return`
`+Ig+t}var Ag=!1;function Ng(t,e){if(!t||Ag)return"";Ag=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var i=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){i=c}t.call(e.prototype)}else{try{throw Error()}catch(c){i=c}t()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var r=c.stack.split(`
`),s=i.stack.split(`
`),a=r.length-1,o=s.length-1;1<=a&&0<=o&&r[a]!==s[o];)o--;for(;1<=a&&0<=o;a--,o--)if(r[a]!==s[o]){if(a!==1||o!==1)do if(a--,o--,0>o||r[a]!==s[o]){var l=`
`+r[a].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=a&&0<=o);break}}}finally{Ag=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ol(t):""}function xI(t){switch(t.tag){case 5:return ol(t.type);case 16:return ol("Lazy");case 13:return ol("Suspense");case 19:return ol("SuspenseList");case 0:case 2:case 15:return t=Ng(t.type,!1),t;case 11:return t=Ng(t.type.render,!1),t;case 1:return t=Ng(t.type,!0),t;default:return""}}function sv(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ra:return"Fragment";case ia:return"Portal";case nv:return"Profiler";case Qv:return"StrictMode";case iv:return"Suspense";case rv:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Ek:return(t.displayName||"Context")+".Consumer";case Tk:return(t._context.displayName||"Context")+".Provider";case Xv:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Zv:return e=t.displayName||null,e!==null?e:sv(t.type)||"Memo";case hr:e=t._payload,t=t._init;try{return sv(t(e))}catch{}}return null}function kI(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return sv(e);case 8:return e===Qv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Pr(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Pk(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function TI(t){var e=Pk(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){i=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(a){i=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function gd(t){t._valueTracker||(t._valueTracker=TI(t))}function Ck(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Pk(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function qd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function av(t,e){var n=e.checked;return Re({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function _0(t,e){var n=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;n=Pr(e.value!=null?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function $k(t,e){e=e.checked,e!=null&&Yv(t,"checked",e,!1)}function ov(t,e){$k(t,e);var n=Pr(e.value),i=e.type;if(n!=null)i==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(i==="submit"||i==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lv(t,e.type,n):e.hasOwnProperty("defaultValue")&&lv(t,e.type,Pr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function w0(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function lv(t,e,n){(e!=="number"||qd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ll=Array.isArray;function ma(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r<n.length;r++)e["$"+n[r]]=!0;for(n=0;n<t.length;n++)r=e.hasOwnProperty("$"+t[n].value),t[n].selected!==r&&(t[n].selected=r),r&&i&&(t[n].defaultSelected=!0)}else{for(n=""+Pr(n),e=null,r=0;r<t.length;r++){if(t[r].value===n){t[r].selected=!0,i&&(t[r].defaultSelected=!0);return}e!==null||t[r].disabled||(e=t[r])}e!==null&&(e.selected=!0)}}function cv(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(P(91));return Re({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function b0(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(P(92));if(ll(n)){if(1<n.length)throw Error(P(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Pr(n)}}function Mk(t,e){var n=Pr(e.value),i=Pr(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),i!=null&&(t.defaultValue=""+i)}function x0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Rk(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function uv(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Rk(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var vd,Lk=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,i,r){MSApp.execUnsafeLocalFunction(function(){return t(e,n,i,r)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(vd=vd||document.createElement("div"),vd.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=vd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function bl(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},EI=["Webkit","ms","Moz","O"];Object.keys(dl).forEach(function(t){EI.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dl[e]=dl[t]})});function Ik(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dl.hasOwnProperty(t)&&dl[t]?(""+e).trim():e+"px"}function Ak(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var i=n.indexOf("--")===0,r=Ik(n,e[n],i);n==="float"&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}var SI=Re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dv(t,e){if(e){if(SI[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(P(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(P(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(P(61))}if(e.style!=null&&typeof e.style!="object")throw Error(P(62))}}function pv(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hv=null;function Jv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fv=null,ga=null,va=null;function k0(t){if(t=Fl(t)){if(typeof fv!="function")throw Error(P(280));var e=t.stateNode;e&&(e=yp(e),fv(t.stateNode,t.type,e))}}function Nk(t){ga?va?va.push(t):va=[t]:ga=t}function Dk(){if(ga){var t=ga,e=va;if(va=ga=null,k0(t),e)for(t=0;t<e.length;t++)k0(e[t])}}function Ok(t,e){return t(e)}function Vk(){}var Dg=!1;function Fk(t,e,n){if(Dg)return t(e,n);Dg=!0;try{return Ok(t,e,n)}finally{Dg=!1,(ga!==null||va!==null)&&(Vk(),Dk())}}function xl(t,e){var n=t.stateNode;if(n===null)return null;var i=yp(n);if(i===null)return null;n=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(P(231,e,typeof n));return n}var mv=!1;if(Vi)try{ta={},Object.defineProperty(ta,"passive",{get:function(){mv=!0}}),window.addEventListener("test",ta,ta),window.removeEventListener("test",ta,ta)}catch{mv=!1}var ta;function PI(t,e,n,i,r,s,a,o,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var pl=!1,Bd=null,Wd=!1,gv=null,CI={onError:function(t){pl=!0,Bd=t}};function $I(t,e,n,i,r,s,a,o,l){pl=!1,Bd=null,PI.apply(CI,arguments)}function MI(t,e,n,i,r,s,a,o,l){if($I.apply(this,arguments),pl){if(pl){var c=Bd;pl=!1,Bd=null}else throw Error(P(198));Wd||(Wd=!0,gv=c)}}function ws(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function zk(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function T0(t){if(ws(t)!==t)throw Error(P(188))}function RI(t){var e=t.alternate;if(!e){if(e=ws(t),e===null)throw Error(P(188));return e!==t?null:t}for(var n=t,i=e;;){var r=n.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){n=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===n)return T0(r),t;if(s===i)return T0(r),e;s=s.sibling}throw Error(P(188))}if(n.return!==i.return)n=r,i=s;else{for(var a=!1,o=r.child;o;){if(o===n){a=!0,n=r,i=s;break}if(o===i){a=!0,i=r,n=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===n){a=!0,n=s,i=r;break}if(o===i){a=!0,i=s,n=r;break}o=o.sibling}if(!a)throw Error(P(189))}}if(n.alternate!==i)throw Error(P(190))}if(n.tag!==3)throw Error(P(188));return n.stateNode.current===n?t:e}function Uk(t){return t=RI(t),t!==null?jk(t):null}function jk(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=jk(t);if(e!==null)return e;t=t.sibling}return null}var Hk=sn.unstable_scheduleCallback,E0=sn.unstable_cancelCallback,LI=sn.unstable_shouldYield,II=sn.unstable_requestPaint,Oe=sn.unstable_now,AI=sn.unstable_getCurrentPriorityLevel,ey=sn.unstable_ImmediatePriority,qk=sn.unstable_UserBlockingPriority,Kd=sn.unstable_NormalPriority,NI=sn.unstable_LowPriority,Bk=sn.unstable_IdlePriority,fp=null,fi=null;function DI(t){if(fi&&typeof fi.onCommitFiberRoot=="function")try{fi.onCommitFiberRoot(fp,t,void 0,(t.current.flags&128)===128)}catch{}}var Xn=Math.clz32?Math.clz32:FI,OI=Math.log,VI=Math.LN2;function FI(t){return t>>>=0,t===0?32:31-(OI(t)/VI|0)|0}var yd=64,_d=4194304;function cl(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Gd(t,e){var n=t.pendingLanes;if(n===0)return 0;var i=0,r=t.suspendedLanes,s=t.pingedLanes,a=n&268435455;if(a!==0){var o=a&~r;o!==0?i=cl(o):(s&=a,s!==0&&(i=cl(s)))}else a=n&~r,a!==0?i=cl(a):s!==0&&(i=cl(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=i;0<e;)n=31-Xn(e),r=1<<n,i|=t[n],e&=~r;return i}function zI(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function UI(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,r=t.expirationTimes,s=t.pendingLanes;0<s;){var a=31-Xn(s),o=1<<a,l=r[a];l===-1?(!(o&n)||o&i)&&(r[a]=zI(o,e)):l<=e&&(t.expiredLanes|=o),s&=~o}}function vv(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Wk(){var t=yd;return yd<<=1,!(yd&4194240)&&(yd=64),t}function Og(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Ol(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Xn(e),t[e]=n}function jI(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0<n;){var r=31-Xn(n),s=1<<r;e[r]=0,i[r]=-1,t[r]=-1,n&=~s}}function ty(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-Xn(n),r=1<<i;r&e|t[i]&e&&(t[i]|=e),n&=~r}}var pe=0;function Kk(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Gk,ny,Yk,Qk,Xk,yv=!1,wd=[],_r=null,wr=null,br=null,kl=new Map,Tl=new Map,mr=[],HI="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function S0(t,e){switch(t){case"focusin":case"focusout":_r=null;break;case"dragenter":case"dragleave":wr=null;break;case"mouseover":case"mouseout":br=null;break;case"pointerover":case"pointerout":kl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tl.delete(e.pointerId)}}function el(t,e,n,i,r,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Fl(e),e!==null&&ny(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),t)}function qI(t,e,n,i,r){switch(e){case"focusin":return _r=el(_r,t,e,n,i,r),!0;case"dragenter":return wr=el(wr,t,e,n,i,r),!0;case"mouseover":return br=el(br,t,e,n,i,r),!0;case"pointerover":var s=r.pointerId;return kl.set(s,el(kl.get(s)||null,t,e,n,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Tl.set(s,el(Tl.get(s)||null,t,e,n,i,r)),!0}return!1}function Zk(t){var e=cs(t.target);if(e!==null){var n=ws(e);if(n!==null){if(e=n.tag,e===13){if(e=zk(n),e!==null){t.blockedOn=e,Xk(t.priority,function(){Yk(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ad(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=_v(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);hv=i,n.target.dispatchEvent(i),hv=null}else return e=Fl(n),e!==null&&ny(e),t.blockedOn=n,!1;e.shift()}return!0}function P0(t,e,n){Ad(t)&&n.delete(e)}function BI(){yv=!1,_r!==null&&Ad(_r)&&(_r=null),wr!==null&&Ad(wr)&&(wr=null),br!==null&&Ad(br)&&(br=null),kl.forEach(P0),Tl.forEach(P0)}function tl(t,e){t.blockedOn===e&&(t.blockedOn=null,yv||(yv=!0,sn.unstable_scheduleCallback(sn.unstable_NormalPriority,BI)))}function El(t){function e(r){return tl(r,t)}if(0<wd.length){tl(wd[0],t);for(var n=1;n<wd.length;n++){var i=wd[n];i.blockedOn===t&&(i.blockedOn=null)}}for(_r!==null&&tl(_r,t),wr!==null&&tl(wr,t),br!==null&&tl(br,t),kl.forEach(e),Tl.forEach(e),n=0;n<mr.length;n++)i=mr[n],i.blockedOn===t&&(i.blockedOn=null);for(;0<mr.length&&(n=mr[0],n.blockedOn===null);)Zk(n),n.blockedOn===null&&mr.shift()}var ya=ji.ReactCurrentBatchConfig,Yd=!0;function WI(t,e,n,i){var r=pe,s=ya.transition;ya.transition=null;try{pe=1,iy(t,e,n,i)}finally{pe=r,ya.transition=s}}function KI(t,e,n,i){var r=pe,s=ya.transition;ya.transition=null;try{pe=4,iy(t,e,n,i)}finally{pe=r,ya.transition=s}}function iy(t,e,n,i){if(Yd){var r=_v(t,e,n,i);if(r===null)qg(t,e,i,Qd,n),S0(t,i);else if(qI(r,t,e,n,i))i.stopPropagation();else if(S0(t,i),e&4&&-1<HI.indexOf(t)){for(;r!==null;){var s=Fl(r);if(s!==null&&Gk(s),s=_v(t,e,n,i),s===null&&qg(t,e,i,Qd,n),s===r)break;r=s}r!==null&&i.stopPropagation()}else qg(t,e,i,null,n)}}var Qd=null;function _v(t,e,n,i){if(Qd=null,t=Jv(i),t=cs(t),t!==null)if(e=ws(t),e===null)t=null;else if(n=e.tag,n===13){if(t=zk(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Qd=t,null}function Jk(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(AI()){case ey:return 1;case qk:return 4;case Kd:case NI:return 16;case Bk:return 536870912;default:return 16}default:return 16}}var vr=null,ry=null,Nd=null;function eT(){if(Nd)return Nd;var t,e=ry,n=e.length,i,r="value"in vr?vr.value:vr.textContent,s=r.length;for(t=0;t<n&&e[t]===r[t];t++);var a=n-t;for(i=1;i<=a&&e[n-i]===r[s-i];i++);return Nd=r.slice(t,1<i?1-i:void 0)}function Dd(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function bd(){return!0}function C0(){return!1}function an(t){function e(n,i,r,s,a){this._reactName=n,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(n=t[o],this[o]=n?n(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?bd:C0,this.isPropagationStopped=C0,this}return Re(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=bd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=bd)},persist:function(){},isPersistent:bd}),e}var Ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sy=an(Ca),Vl=Re({},Ca,{view:0,detail:0}),GI=an(Vl),Vg,Fg,nl,mp=Re({},Vl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ay,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==nl&&(nl&&t.type==="mousemove"?(Vg=t.screenX-nl.screenX,Fg=t.screenY-nl.screenY):Fg=Vg=0,nl=t),Vg)},movementY:function(t){return"movementY"in t?t.movementY:Fg}}),$0=an(mp),YI=Re({},mp,{dataTransfer:0}),QI=an(YI),XI=Re({},Vl,{relatedTarget:0}),zg=an(XI),ZI=Re({},Ca,{animationName:0,elapsedTime:0,pseudoElement:0}),JI=an(ZI),eA=Re({},Ca,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),tA=an(eA),nA=Re({},Ca,{data:0}),M0=an(nA),iA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rA={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},sA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aA(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=sA[t])?!!e[t]:!1}function ay(){return aA}var oA=Re({},Vl,{key:function(t){if(t.key){var e=iA[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Dd(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?rA[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ay,charCode:function(t){return t.type==="keypress"?Dd(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Dd(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),lA=an(oA),cA=Re({},mp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),R0=an(cA),uA=Re({},Vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ay}),dA=an(uA),pA=Re({},Ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),hA=an(pA),fA=Re({},mp,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),mA=an(fA),gA=[9,13,27,32],oy=Vi&&"CompositionEvent"in window,hl=null;Vi&&"documentMode"in document&&(hl=document.documentMode);var vA=Vi&&"TextEvent"in window&&!hl,tT=Vi&&(!oy||hl&&8<hl&&11>=hl),L0=" ",I0=!1;function nT(t,e){switch(t){case"keyup":return gA.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iT(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sa=!1;function yA(t,e){switch(t){case"compositionend":return iT(e);case"keypress":return e.which!==32?null:(I0=!0,L0);case"textInput":return t=e.data,t===L0&&I0?null:t;default:return null}}function _A(t,e){if(sa)return t==="compositionend"||!oy&&nT(t,e)?(t=eT(),Nd=ry=vr=null,sa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return tT&&e.locale!=="ko"?null:e.data;default:return null}}var wA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function A0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!wA[t.type]:e==="textarea"}function rT(t,e,n,i){Nk(i),e=Xd(e,"onChange"),0<e.length&&(n=new sy("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var fl=null,Sl=null;function bA(t){mT(t,0)}function gp(t){var e=la(t);if(Ck(e))return t}function xA(t,e){if(t==="change")return e}var sT=!1;Vi&&(Vi?(kd="oninput"in document,kd||(Ug=document.createElement("div"),Ug.setAttribute("oninput","return;"),kd=typeof Ug.oninput=="function"),xd=kd):xd=!1,sT=xd&&(!document.documentMode||9<document.documentMode));var xd,kd,Ug;function N0(){fl&&(fl.detachEvent("onpropertychange",aT),Sl=fl=null)}function aT(t){if(t.propertyName==="value"&&gp(Sl)){var e=[];rT(e,Sl,t,Jv(t)),Fk(bA,e)}}function kA(t,e,n){t==="focusin"?(N0(),fl=e,Sl=n,fl.attachEvent("onpropertychange",aT)):t==="focusout"&&N0()}function TA(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return gp(Sl)}function EA(t,e){if(t==="click")return gp(e)}function SA(t,e){if(t==="input"||t==="change")return gp(e)}function PA(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Jn=typeof Object.is=="function"?Object.is:PA;function Pl(t,e){if(Jn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!tv.call(e,r)||!Jn(t[r],e[r]))return!1}return!0}function D0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function O0(t,e){var n=D0(t);t=0;for(var i;n;){if(n.nodeType===3){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=D0(n)}}function oT(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?oT(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function lT(){for(var t=window,e=qd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=qd(t.document)}return e}function ly(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function CA(t){var e=lT(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&oT(n.ownerDocument.documentElement,n)){if(i!==null&&ly(n)){if(e=i.start,t=i.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!t.extend&&s>i&&(r=i,i=s,s=r),r=O0(n,s);var a=O0(n,i);r&&a&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var $A=Vi&&"documentMode"in document&&11>=document.documentMode,aa=null,wv=null,ml=null,bv=!1;function V0(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bv||aa==null||aa!==qd(i)||(i=aa,"selectionStart"in i&&ly(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ml&&Pl(ml,i)||(ml=i,i=Xd(wv,"onSelect"),0<i.length&&(e=new sy("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=aa)))}function Td(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var oa={animationend:Td("Animation","AnimationEnd"),animationiteration:Td("Animation","AnimationIteration"),animationstart:Td("Animation","AnimationStart"),transitionend:Td("Transition","TransitionEnd")},jg={},cT={};Vi&&(cT=document.createElement("div").style,"AnimationEvent"in window||(delete oa.animationend.animation,delete oa.animationiteration.animation,delete oa.animationstart.animation),"TransitionEvent"in window||delete oa.transitionend.transition);function vp(t){if(jg[t])return jg[t];if(!oa[t])return t;var e=oa[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in cT)return jg[t]=e[n];return t}var uT=vp("animationend"),dT=vp("animationiteration"),pT=vp("animationstart"),hT=vp("transitionend"),fT=new Map,F0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function $r(t,e){fT.set(t,e),_s(e,[t])}for(Ed=0;Ed<F0.length;Ed++)Sd=F0[Ed],z0=Sd.toLowerCase(),U0=Sd[0].toUpperCase()+Sd.slice(1),$r(z0,"on"+U0);var Sd,z0,U0,Ed;$r(uT,"onAnimationEnd");$r(dT,"onAnimationIteration");$r(pT,"onAnimationStart");$r("dblclick","onDoubleClick");$r("focusin","onFocus");$r("focusout","onBlur");$r(hT,"onTransitionEnd");ba("onMouseEnter",["mouseout","mouseover"]);ba("onMouseLeave",["mouseout","mouseover"]);ba("onPointerEnter",["pointerout","pointerover"]);ba("onPointerLeave",["pointerout","pointerover"]);_s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_s("onBeforeInput",["compositionend","keypress","textInput","paste"]);_s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ul="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),MA=new Set("cancel close invalid load scroll toggle".split(" ").concat(ul));function j0(t,e,n){var i=t.type||"unknown-event";t.currentTarget=n,MI(i,e,void 0,t),t.currentTarget=null}function mT(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var i=t[n],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var a=i.length-1;0<=a;a--){var o=i[a],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==s&&r.isPropagationStopped())break e;j0(r,o,c),s=l}else for(a=0;a<i.length;a++){if(o=i[a],l=o.instance,c=o.currentTarget,o=o.listener,l!==s&&r.isPropagationStopped())break e;j0(r,o,c),s=l}}}if(Wd)throw t=gv,Wd=!1,gv=null,t}function be(t,e){var n=e[Sv];n===void 0&&(n=e[Sv]=new Set);var i=t+"__bubble";n.has(i)||(gT(e,t,2,!1),n.add(i))}function Hg(t,e,n){var i=0;e&&(i|=4),gT(n,t,i,e)}var Pd="_reactListening"+Math.random().toString(36).slice(2);function Cl(t){if(!t[Pd]){t[Pd]=!0,kk.forEach(function(n){n!=="selectionchange"&&(MA.has(n)||Hg(n,!1,t),Hg(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Pd]||(e[Pd]=!0,Hg("selectionchange",!1,e))}}function gT(t,e,n,i){switch(Jk(e)){case 1:var r=WI;break;case 4:r=KI;break;default:r=iy}n=r.bind(null,e,n,t),r=void 0,!mv||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?t.addEventListener(e,n,{capture:!0,passive:r}):t.addEventListener(e,n,!0):r!==void 0?t.addEventListener(e,n,{passive:r}):t.addEventListener(e,n,!1)}function qg(t,e,n,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var a=i.tag;if(a===3||a===4){var o=i.stateNode.containerInfo;if(o===r||o.nodeType===8&&o.parentNode===r)break;if(a===4)for(a=i.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;a=a.return}for(;o!==null;){if(a=cs(o),a===null)return;if(l=a.tag,l===5||l===6){i=s=a;continue e}o=o.parentNode}}i=i.return}Fk(function(){var c=s,u=Jv(n),d=[];e:{var p=fT.get(t);if(p!==void 0){var h=sy,y=t;switch(t){case"keypress":if(Dd(n)===0)break e;case"keydown":case"keyup":h=lA;break;case"focusin":y="focus",h=zg;break;case"focusout":y="blur",h=zg;break;case"beforeblur":case"afterblur":h=zg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=$0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=QI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=dA;break;case uT:case dT:case pT:h=JI;break;case hT:h=hA;break;case"scroll":h=GI;break;case"wheel":h=mA;break;case"copy":case"cut":case"paste":h=tA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=R0}var v=(e&4)!==0,w=!v&&t==="scroll",m=v?p!==null?p+"Capture":null:p;v=[];for(var f=c,g;f!==null;){g=f;var x=g.stateNode;if(g.tag===5&&x!==null&&(g=x,m!==null&&(x=xl(f,m),x!=null&&v.push($l(f,x,g)))),w)break;f=f.return}0<v.length&&(p=new h(p,y,null,n,u),d.push({event:p,listeners:v}))}}if(!(e&7)){e:{if(p=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",p&&n!==hv&&(y=n.relatedTarget||n.fromElement)&&(cs(y)||y[Fi]))break e;if((h||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=c,y=y?cs(y):null,y!==null&&(w=ws(y),y!==w||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=c),h!==y)){if(v=$0,x="onMouseLeave",m="onMouseEnter",f="mouse",(t==="pointerout"||t==="pointerover")&&(v=R0,x="onPointerLeave",m="onPointerEnter",f="pointer"),w=h==null?p:la(h),g=y==null?p:la(y),p=new v(x,f+"leave",h,n,u),p.target=w,p.relatedTarget=g,x=null,cs(u)===c&&(v=new v(m,f+"enter",y,n,u),v.target=g,v.relatedTarget=w,x=v),w=x,h&&y)t:{for(v=h,m=y,f=0,g=v;g;g=na(g))f++;for(g=0,x=m;x;x=na(x))g++;for(;0<f-g;)v=na(v),f--;for(;0<g-f;)m=na(m),g--;for(;f--;){if(v===m||m!==null&&v===m.alternate)break t;v=na(v),m=na(m)}v=null}else v=null;h!==null&&H0(d,p,h,v,!1),y!==null&&w!==null&&H0(d,w,y,v,!0)}}e:{if(p=c?la(c):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var E=xA;else if(A0(p))if(sT)E=SA;else{E=TA;var L=kA}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(E=EA);if(E&&(E=E(t,c))){rT(d,E,n,u);break e}L&&L(t,p,c),t==="focusout"&&(L=p._wrapperState)&&L.controlled&&p.type==="number"&&lv(p,"number",p.value)}switch(L=c?la(c):window,t){case"focusin":(A0(L)||L.contentEditable==="true")&&(aa=L,wv=c,ml=null);break;case"focusout":ml=wv=aa=null;break;case"mousedown":bv=!0;break;case"contextmenu":case"mouseup":case"dragend":bv=!1,V0(d,n,u);break;case"selectionchange":if($A)break;case"keydown":case"keyup":V0(d,n,u)}var R;if(oy)e:{switch(t){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else sa?nT(t,n)&&(I="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(tT&&n.locale!=="ko"&&(sa||I!=="onCompositionStart"?I==="onCompositionEnd"&&sa&&(R=eT()):(vr=u,ry="value"in vr?vr.value:vr.textContent,sa=!0)),L=Xd(c,I),0<L.length&&(I=new M0(I,t,null,n,u),d.push({event:I,listeners:L}),R?I.data=R:(R=iT(n),R!==null&&(I.data=R)))),(R=vA?yA(t,n):_A(t,n))&&(c=Xd(c,"onBeforeInput"),0<c.length&&(u=new M0("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=R))}mT(d,e)})}function $l(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Xd(t,e){for(var n=e+"Capture",i=[];t!==null;){var r=t,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=xl(t,n),s!=null&&i.unshift($l(t,s,r)),s=xl(t,e),s!=null&&i.push($l(t,s,r))),t=t.return}return i}function na(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function H0(t,e,n,i,r){for(var s=e._reactName,a=[];n!==null&&n!==i;){var o=n,l=o.alternate,c=o.stateNode;if(l!==null&&l===i)break;o.tag===5&&c!==null&&(o=c,r?(l=xl(n,s),l!=null&&a.unshift($l(n,l,o))):r||(l=xl(n,s),l!=null&&a.push($l(n,l,o)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var RA=/\r\n?/g,LA=/\u0000|\uFFFD/g;function q0(t){return(typeof t=="string"?t:""+t).replace(RA,`
`).replace(LA,"")}function Cd(t,e,n){if(e=q0(e),q0(t)!==e&&n)throw Error(P(425))}function Zd(){}var xv=null,kv=null;function Tv(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ev=typeof setTimeout=="function"?setTimeout:void 0,IA=typeof clearTimeout=="function"?clearTimeout:void 0,B0=typeof Promise=="function"?Promise:void 0,AA=typeof queueMicrotask=="function"?queueMicrotask:typeof B0<"u"?function(t){return B0.resolve(null).then(t).catch(NA)}:Ev;function NA(t){setTimeout(function(){throw t})}function Bg(t,e){var n=e,i=0;do{var r=n.nextSibling;if(t.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(i===0){t.removeChild(r),El(e);return}i--}else n!=="$"&&n!=="$?"&&n!=="$!"||i++;n=r}while(n);El(e)}function xr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function W0(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var $a=Math.random().toString(36).slice(2),hi="__reactFiber$"+$a,Ml="__reactProps$"+$a,Fi="__reactContainer$"+$a,Sv="__reactEvents$"+$a,DA="__reactListeners$"+$a,OA="__reactHandles$"+$a;function cs(t){var e=t[hi];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Fi]||n[hi]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=W0(t);t!==null;){if(n=t[hi])return n;t=W0(t)}return e}t=n,n=t.parentNode}return null}function Fl(t){return t=t[hi]||t[Fi],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function la(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(P(33))}function yp(t){return t[Ml]||null}var Pv=[],ca=-1;function Mr(t){return{current:t}}function xe(t){0>ca||(t.current=Pv[ca],Pv[ca]=null,ca--)}function ve(t,e){ca++,Pv[ca]=t.current,t.current=e}var Cr={},vt=Mr(Cr),jt=Mr(!1),fs=Cr;function xa(t,e){var n=t.type.contextTypes;if(!n)return Cr;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in n)r[s]=e[s];return i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function Ht(t){return t=t.childContextTypes,t!=null}function Jd(){xe(jt),xe(vt)}function K0(t,e,n){if(vt.current!==Cr)throw Error(P(168));ve(vt,e),ve(jt,n)}function vT(t,e,n){var i=t.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return n;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(P(108,kI(t)||"Unknown",r));return Re({},n,i)}function ep(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Cr,fs=vt.current,ve(vt,t),ve(jt,jt.current),!0}function G0(t,e,n){var i=t.stateNode;if(!i)throw Error(P(169));n?(t=vT(t,e,fs),i.__reactInternalMemoizedMergedChildContext=t,xe(jt),xe(vt),ve(vt,t)):xe(jt),ve(jt,n)}var Ai=null,_p=!1,Wg=!1;function yT(t){Ai===null?Ai=[t]:Ai.push(t)}function VA(t){_p=!0,yT(t)}function Rr(){if(!Wg&&Ai!==null){Wg=!0;var t=0,e=pe;try{var n=Ai;for(pe=1;t<n.length;t++){var i=n[t];do i=i(!0);while(i!==null)}Ai=null,_p=!1}catch(r){throw Ai!==null&&(Ai=Ai.slice(t+1)),Hk(ey,Rr),r}finally{pe=e,Wg=!1}}return null}var ua=[],da=0,tp=null,np=0,bn=[],xn=0,ms=null,Ni=1,Di="";function os(t,e){ua[da++]=np,ua[da++]=tp,tp=t,np=e}function _T(t,e,n){bn[xn++]=Ni,bn[xn++]=Di,bn[xn++]=ms,ms=t;var i=Ni;t=Di;var r=32-Xn(i)-1;i&=~(1<<r),n+=1;var s=32-Xn(e)+r;if(30<s){var a=r-r%5;s=(i&(1<<a)-1).toString(32),i>>=a,r-=a,Ni=1<<32-Xn(e)+r|n<<r|i,Di=s+t}else Ni=1<<s|n<<r|i,Di=t}function cy(t){t.return!==null&&(os(t,1),_T(t,1,0))}function uy(t){for(;t===tp;)tp=ua[--da],ua[da]=null,np=ua[--da],ua[da]=null;for(;t===ms;)ms=bn[--xn],bn[xn]=null,Di=bn[--xn],bn[xn]=null,Ni=bn[--xn],bn[xn]=null}var rn=null,nn=null,Pe=!1,Qn=null;function wT(t,e){var n=kn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Y0(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,rn=t,nn=xr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,rn=t,nn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=ms!==null?{id:Ni,overflow:Di}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=kn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,rn=t,nn=null,!0):!1;default:return!1}}function Cv(t){return(t.mode&1)!==0&&(t.flags&128)===0}function $v(t){if(Pe){var e=nn;if(e){var n=e;if(!Y0(t,e)){if(Cv(t))throw Error(P(418));e=xr(n.nextSibling);var i=rn;e&&Y0(t,e)?wT(i,n):(t.flags=t.flags&-4097|2,Pe=!1,rn=t)}}else{if(Cv(t))throw Error(P(418));t.flags=t.flags&-4097|2,Pe=!1,rn=t}}}function Q0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;rn=t}function $d(t){if(t!==rn)return!1;if(!Pe)return Q0(t),Pe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Tv(t.type,t.memoizedProps)),e&&(e=nn)){if(Cv(t))throw bT(),Error(P(418));for(;e;)wT(t,e),e=xr(e.nextSibling)}if(Q0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(P(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){nn=xr(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}nn=null}}else nn=rn?xr(t.stateNode.nextSibling):null;return!0}function bT(){for(var t=nn;t;)t=xr(t.nextSibling)}function ka(){nn=rn=null,Pe=!1}function dy(t){Qn===null?Qn=[t]:Qn.push(t)}var FA=ji.ReactCurrentBatchConfig;function Gn(t,e){if(t&&t.defaultProps){e=Re({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}var ip=Mr(null),rp=null,pa=null,py=null;function hy(){py=pa=rp=null}function fy(t){var e=ip.current;xe(ip),t._currentValue=e}function Mv(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function _a(t,e){rp=t,py=pa=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ut=!0),t.firstContext=null)}function En(t){var e=t._currentValue;if(py!==t)if(t={context:t,memoizedValue:e,next:null},pa===null){if(rp===null)throw Error(P(308));pa=t,rp.dependencies={lanes:0,firstContext:t}}else pa=pa.next=t;return e}var us=null;function my(t){us===null?us=[t]:us.push(t)}function xT(t,e,n,i){var r=e.interleaved;return r===null?(n.next=n,my(e)):(n.next=r.next,r.next=n),e.interleaved=n,zi(t,i)}function zi(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var fr=!1;function gy(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function kT(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Oi(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function kr(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,se&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,zi(t,n)}return r=i.interleaved,r===null?(e.next=e,my(i)):(e.next=r.next,r.next=e),i.interleaved=e,zi(t,n)}function Od(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,ty(t,n)}}function X0(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?r=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?r=s=e:s=s.next=e}else r=s=e;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function sp(t,e,n,i){var r=t.updateQueue;fr=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=t.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;a=0,u=c=l=null,o=s;do{var p=o.lane,h=o.eventTime;if((i&p)===p){u!==null&&(u=u.next={eventTime:h,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=t,v=o;switch(p=e,h=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){d=y.call(h,d,p);break e}d=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,p=typeof y=="function"?y.call(h,d,p):y,p==null)break e;d=Re({},d,p);break e;case 2:fr=!0}}o.callback!==null&&o.lane!==0&&(t.flags|=64,p=r.effects,p===null?r.effects=[o]:p.push(o))}else h={eventTime:h,lane:p,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,a|=p;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;p=o,o=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do a|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);vs|=a,t.lanes=a,t.memoizedState=d}}function Z0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var i=t[e],r=i.callback;if(r!==null){if(i.callback=null,i=n,typeof r!="function")throw Error(P(191,r));r.call(i)}}}var TT=new xk.Component().refs;function Rv(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:Re({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var wp={isMounted:function(t){return(t=t._reactInternals)?ws(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var i=Ct(),r=Er(t),s=Oi(i,r);s.payload=e,n!=null&&(s.callback=n),e=kr(t,s,r),e!==null&&(Zn(e,t,r,i),Od(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=Ct(),r=Er(t),s=Oi(i,r);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=kr(t,s,r),e!==null&&(Zn(e,t,r,i),Od(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ct(),i=Er(t),r=Oi(n,i);r.tag=2,e!=null&&(r.callback=e),e=kr(t,r,i),e!==null&&(Zn(e,t,i,n),Od(e,t,i))}};function J0(t,e,n,i,r,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,s,a):e.prototype&&e.prototype.isPureReactComponent?!Pl(n,i)||!Pl(r,s):!0}function ET(t,e,n){var i=!1,r=Cr,s=e.contextType;return typeof s=="object"&&s!==null?s=En(s):(r=Ht(e)?fs:vt.current,i=e.contextTypes,s=(i=i!=null)?xa(t,r):Cr),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=wp,t.stateNode=e,e._reactInternals=t,i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function ek(t,e,n,i){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&wp.enqueueReplaceState(e,e.state,null)}function Lv(t,e,n,i){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs=TT,gy(t);var s=e.contextType;typeof s=="object"&&s!==null?r.context=En(s):(s=Ht(e)?fs:vt.current,r.context=xa(t,s)),r.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Rv(t,e,s,n),r.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&wp.enqueueReplaceState(r,r.state,null),sp(t,n,r,i),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308)}function il(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(P(309));var i=n.stateNode}if(!i)throw Error(P(147,t));var r=i,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var o=r.refs;o===TT&&(o=r.refs={}),a===null?delete o[s]:o[s]=a},e._stringRef=s,e)}if(typeof t!="string")throw Error(P(284));if(!n._owner)throw Error(P(290,t))}return t}function Md(t,e){throw t=Object.prototype.toString.call(e),Error(P(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function tk(t){var e=t._init;return e(t._payload)}function ST(t){function e(m,f){if(t){var g=m.deletions;g===null?(m.deletions=[f],m.flags|=16):g.push(f)}}function n(m,f){if(!t)return null;for(;f!==null;)e(m,f),f=f.sibling;return null}function i(m,f){for(m=new Map;f!==null;)f.key!==null?m.set(f.key,f):m.set(f.index,f),f=f.sibling;return m}function r(m,f){return m=Sr(m,f),m.index=0,m.sibling=null,m}function s(m,f,g){return m.index=g,t?(g=m.alternate,g!==null?(g=g.index,g<f?(m.flags|=2,f):g):(m.flags|=2,f)):(m.flags|=1048576,f)}function a(m){return t&&m.alternate===null&&(m.flags|=2),m}function o(m,f,g,x){return f===null||f.tag!==6?(f=Jg(g,m.mode,x),f.return=m,f):(f=r(f,g),f.return=m,f)}function l(m,f,g,x){var E=g.type;return E===ra?u(m,f,g.props.children,x,g.key):f!==null&&(f.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===hr&&tk(E)===f.type)?(x=r(f,g.props),x.ref=il(m,f,g),x.return=m,x):(x=Hd(g.type,g.key,g.props,null,m.mode,x),x.ref=il(m,f,g),x.return=m,x)}function c(m,f,g,x){return f===null||f.tag!==4||f.stateNode.containerInfo!==g.containerInfo||f.stateNode.implementation!==g.implementation?(f=ev(g,m.mode,x),f.return=m,f):(f=r(f,g.children||[]),f.return=m,f)}function u(m,f,g,x,E){return f===null||f.tag!==7?(f=hs(g,m.mode,x,E),f.return=m,f):(f=r(f,g),f.return=m,f)}function d(m,f,g){if(typeof f=="string"&&f!==""||typeof f=="number")return f=Jg(""+f,m.mode,g),f.return=m,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case md:return g=Hd(f.type,f.key,f.props,null,m.mode,g),g.ref=il(m,null,f),g.return=m,g;case ia:return f=ev(f,m.mode,g),f.return=m,f;case hr:var x=f._init;return d(m,x(f._payload),g)}if(ll(f)||Jo(f))return f=hs(f,m.mode,g,null),f.return=m,f;Md(m,f)}return null}function p(m,f,g,x){var E=f!==null?f.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return E!==null?null:o(m,f,""+g,x);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case md:return g.key===E?l(m,f,g,x):null;case ia:return g.key===E?c(m,f,g,x):null;case hr:return E=g._init,p(m,f,E(g._payload),x)}if(ll(g)||Jo(g))return E!==null?null:u(m,f,g,x,null);Md(m,g)}return null}function h(m,f,g,x,E){if(typeof x=="string"&&x!==""||typeof x=="number")return m=m.get(g)||null,o(f,m,""+x,E);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case md:return m=m.get(x.key===null?g:x.key)||null,l(f,m,x,E);case ia:return m=m.get(x.key===null?g:x.key)||null,c(f,m,x,E);case hr:var L=x._init;return h(m,f,g,L(x._payload),E)}if(ll(x)||Jo(x))return m=m.get(g)||null,u(f,m,x,E,null);Md(f,x)}return null}function y(m,f,g,x){for(var E=null,L=null,R=f,I=f=0,z=null;R!==null&&I<g.length;I++){R.index>I?(z=R,R=null):z=R.sibling;var A=p(m,R,g[I],x);if(A===null){R===null&&(R=z);break}t&&R&&A.alternate===null&&e(m,R),f=s(A,f,I),L===null?E=A:L.sibling=A,L=A,R=z}if(I===g.length)return n(m,R),Pe&&os(m,I),E;if(R===null){for(;I<g.length;I++)R=d(m,g[I],x),R!==null&&(f=s(R,f,I),L===null?E=R:L.sibling=R,L=R);return Pe&&os(m,I),E}for(R=i(m,R);I<g.length;I++)z=h(R,m,I,g[I],x),z!==null&&(t&&z.alternate!==null&&R.delete(z.key===null?I:z.key),f=s(z,f,I),L===null?E=z:L.sibling=z,L=z);return t&&R.forEach(function(oe){return e(m,oe)}),Pe&&os(m,I),E}function v(m,f,g,x){var E=Jo(g);if(typeof E!="function")throw Error(P(150));if(g=E.call(g),g==null)throw Error(P(151));for(var L=E=null,R=f,I=f=0,z=null,A=g.next();R!==null&&!A.done;I++,A=g.next()){R.index>I?(z=R,R=null):z=R.sibling;var oe=p(m,R,A.value,x);if(oe===null){R===null&&(R=z);break}t&&R&&oe.alternate===null&&e(m,R),f=s(oe,f,I),L===null?E=oe:L.sibling=oe,L=oe,R=z}if(A.done)return n(m,R),Pe&&os(m,I),E;if(R===null){for(;!A.done;I++,A=g.next())A=d(m,A.value,x),A!==null&&(f=s(A,f,I),L===null?E=A:L.sibling=A,L=A);return Pe&&os(m,I),E}for(R=i(m,R);!A.done;I++,A=g.next())A=h(R,m,I,A.value,x),A!==null&&(t&&A.alternate!==null&&R.delete(A.key===null?I:A.key),f=s(A,f,I),L===null?E=A:L.sibling=A,L=A);return t&&R.forEach(function(ee){return e(m,ee)}),Pe&&os(m,I),E}function w(m,f,g,x){if(typeof g=="object"&&g!==null&&g.type===ra&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case md:e:{for(var E=g.key,L=f;L!==null;){if(L.key===E){if(E=g.type,E===ra){if(L.tag===7){n(m,L.sibling),f=r(L,g.props.children),f.return=m,m=f;break e}}else if(L.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===hr&&tk(E)===L.type){n(m,L.sibling),f=r(L,g.props),f.ref=il(m,L,g),f.return=m,m=f;break e}n(m,L);break}else e(m,L);L=L.sibling}g.type===ra?(f=hs(g.props.children,m.mode,x,g.key),f.return=m,m=f):(x=Hd(g.type,g.key,g.props,null,m.mode,x),x.ref=il(m,f,g),x.return=m,m=x)}return a(m);case ia:e:{for(L=g.key;f!==null;){if(f.key===L)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){n(m,f.sibling),f=r(f,g.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else e(m,f);f=f.sibling}f=ev(g,m.mode,x),f.return=m,m=f}return a(m);case hr:return L=g._init,w(m,f,L(g._payload),x)}if(ll(g))return y(m,f,g,x);if(Jo(g))return v(m,f,g,x);Md(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,f!==null&&f.tag===6?(n(m,f.sibling),f=r(f,g),f.return=m,m=f):(n(m,f),f=Jg(g,m.mode,x),f.return=m,m=f),a(m)):n(m,f)}return w}var Ta=ST(!0),PT=ST(!1),zl={},mi=Mr(zl),Rl=Mr(zl),Ll=Mr(zl);function ds(t){if(t===zl)throw Error(P(174));return t}function vy(t,e){switch(ve(Ll,e),ve(Rl,t),ve(mi,zl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:uv(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=uv(e,t)}xe(mi),ve(mi,e)}function Ea(){xe(mi),xe(Rl),xe(Ll)}function CT(t){ds(Ll.current);var e=ds(mi.current),n=uv(e,t.type);e!==n&&(ve(Rl,t),ve(mi,n))}function yy(t){Rl.current===t&&(xe(mi),xe(Rl))}var $e=Mr(0);function ap(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Kg=[];function _y(){for(var t=0;t<Kg.length;t++)Kg[t]._workInProgressVersionPrimary=null;Kg.length=0}var Vd=ji.ReactCurrentDispatcher,Gg=ji.ReactCurrentBatchConfig,gs=0,Me=null,Qe=null,et=null,op=!1,gl=!1,Il=0,zA=0;function ft(){throw Error(P(321))}function wy(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Jn(t[n],e[n]))return!1;return!0}function by(t,e,n,i,r,s){if(gs=s,Me=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Vd.current=t===null||t.memoizedState===null?qA:BA,t=n(i,r),gl){s=0;do{if(gl=!1,Il=0,25<=s)throw Error(P(301));s+=1,et=Qe=null,e.updateQueue=null,Vd.current=WA,t=n(i,r)}while(gl)}if(Vd.current=lp,e=Qe!==null&&Qe.next!==null,gs=0,et=Qe=Me=null,op=!1,e)throw Error(P(300));return t}function xy(){var t=Il!==0;return Il=0,t}function pi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?Me.memoizedState=et=t:et=et.next=t,et}function Sn(){if(Qe===null){var t=Me.alternate;t=t!==null?t.memoizedState:null}else t=Qe.next;var e=et===null?Me.memoizedState:et.next;if(e!==null)et=e,Qe=t;else{if(t===null)throw Error(P(310));Qe=t,t={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},et===null?Me.memoizedState=et=t:et=et.next=t}return et}function Al(t,e){return typeof e=="function"?e(t):e}function Yg(t){var e=Sn(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var i=Qe,r=i.baseQueue,s=n.pending;if(s!==null){if(r!==null){var a=r.next;r.next=s.next,s.next=a}i.baseQueue=r=s,n.pending=null}if(r!==null){s=r.next,i=i.baseState;var o=a=null,l=null,c=s;do{var u=c.lane;if((gs&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:t(i,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(o=l=d,a=i):l=l.next=d,Me.lanes|=u,vs|=u}c=c.next}while(c!==null&&c!==s);l===null?a=i:l.next=o,Jn(i,e.memoizedState)||(Ut=!0),e.memoizedState=i,e.baseState=a,e.baseQueue=l,n.lastRenderedState=i}if(t=n.interleaved,t!==null){r=t;do s=r.lane,Me.lanes|=s,vs|=s,r=r.next;while(r!==t)}else r===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Qg(t){var e=Sn(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var i=n.dispatch,r=n.pending,s=e.memoizedState;if(r!==null){n.pending=null;var a=r=r.next;do s=t(s,a.action),a=a.next;while(a!==r);Jn(s,e.memoizedState)||(Ut=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,i]}function $T(){}function MT(t,e){var n=Me,i=Sn(),r=e(),s=!Jn(i.memoizedState,r);if(s&&(i.memoizedState=r,Ut=!0),i=i.queue,ky(IT.bind(null,n,i,t),[t]),i.getSnapshot!==e||s||et!==null&&et.memoizedState.tag&1){if(n.flags|=2048,Nl(9,LT.bind(null,n,i,r,e),void 0,null),tt===null)throw Error(P(349));gs&30||RT(n,e,r)}return r}function RT(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Me.updateQueue,e===null?(e={lastEffect:null,stores:null},Me.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function LT(t,e,n,i){e.value=n,e.getSnapshot=i,AT(e)&&NT(t)}function IT(t,e,n){return n(function(){AT(e)&&NT(t)})}function AT(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Jn(t,n)}catch{return!0}}function NT(t){var e=zi(t,1);e!==null&&Zn(e,t,1,-1)}function nk(t){var e=pi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:t},e.queue=t,t=t.dispatch=HA.bind(null,Me,t),[e.memoizedState,t]}function Nl(t,e,n,i){return t={tag:t,create:e,destroy:n,deps:i,next:null},e=Me.updateQueue,e===null?(e={lastEffect:null,stores:null},Me.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t)),t}function DT(){return Sn().memoizedState}function Fd(t,e,n,i){var r=pi();Me.flags|=t,r.memoizedState=Nl(1|e,n,void 0,i===void 0?null:i)}function bp(t,e,n,i){var r=Sn();i=i===void 0?null:i;var s=void 0;if(Qe!==null){var a=Qe.memoizedState;if(s=a.destroy,i!==null&&wy(i,a.deps)){r.memoizedState=Nl(e,n,s,i);return}}Me.flags|=t,r.memoizedState=Nl(1|e,n,s,i)}function ik(t,e){return Fd(8390656,8,t,e)}function ky(t,e){return bp(2048,8,t,e)}function OT(t,e){return bp(4,2,t,e)}function VT(t,e){return bp(4,4,t,e)}function FT(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function zT(t,e,n){return n=n!=null?n.concat([t]):null,bp(4,4,FT.bind(null,e,t),n)}function Ty(){}function UT(t,e){var n=Sn();e=e===void 0?null:e;var i=n.memoizedState;return i!==null&&e!==null&&wy(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function jT(t,e){var n=Sn();e=e===void 0?null:e;var i=n.memoizedState;return i!==null&&e!==null&&wy(e,i[1])?i[0]:(t=t(),n.memoizedState=[t,e],t)}function HT(t,e,n){return gs&21?(Jn(n,e)||(n=Wk(),Me.lanes|=n,vs|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ut=!0),t.memoizedState=n)}function UA(t,e){var n=pe;pe=n!==0&&4>n?n:4,t(!0);var i=Gg.transition;Gg.transition={};try{t(!1),e()}finally{pe=n,Gg.transition=i}}function qT(){return Sn().memoizedState}function jA(t,e,n){var i=Er(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},BT(t))WT(e,n);else if(n=xT(t,e,n,i),n!==null){var r=Ct();Zn(n,t,i,r),KT(n,e,i)}}function HA(t,e,n){var i=Er(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(BT(t))WT(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,n);if(r.hasEagerState=!0,r.eagerState=o,Jn(o,a)){var l=e.interleaved;l===null?(r.next=r,my(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=xT(t,e,r,i),n!==null&&(r=Ct(),Zn(n,t,i,r),KT(n,e,i))}}function BT(t){var e=t.alternate;return t===Me||e!==null&&e===Me}function WT(t,e){gl=op=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function KT(t,e,n){if(n&4194240){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,ty(t,n)}}var lp={readContext:En,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useInsertionEffect:ft,useLayoutEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useMutableSource:ft,useSyncExternalStore:ft,useId:ft,unstable_isNewReconciler:!1},qA={readContext:En,useCallback:function(t,e){return pi().memoizedState=[t,e===void 0?null:e],t},useContext:En,useEffect:ik,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Fd(4194308,4,FT.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Fd(4194308,4,t,e)},useInsertionEffect:function(t,e){return Fd(4,2,t,e)},useMemo:function(t,e){var n=pi();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=pi();return e=n!==void 0?n(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=jA.bind(null,Me,t),[i.memoizedState,t]},useRef:function(t){var e=pi();return t={current:t},e.memoizedState=t},useState:nk,useDebugValue:Ty,useDeferredValue:function(t){return pi().memoizedState=t},useTransition:function(){var t=nk(!1),e=t[0];return t=UA.bind(null,t[1]),pi().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=Me,r=pi();if(Pe){if(n===void 0)throw Error(P(407));n=n()}else{if(n=e(),tt===null)throw Error(P(349));gs&30||RT(i,e,n)}r.memoizedState=n;var s={value:n,getSnapshot:e};return r.queue=s,ik(IT.bind(null,i,s,t),[t]),i.flags|=2048,Nl(9,LT.bind(null,i,s,n,e),void 0,null),n},useId:function(){var t=pi(),e=tt.identifierPrefix;if(Pe){var n=Di,i=Ni;n=(i&~(1<<32-Xn(i)-1)).toString(32)+n,e=":"+e+"R"+n,n=Il++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=zA++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},BA={readContext:En,useCallback:UT,useContext:En,useEffect:ky,useImperativeHandle:zT,useInsertionEffect:OT,useLayoutEffect:VT,useMemo:jT,useReducer:Yg,useRef:DT,useState:function(){return Yg(Al)},useDebugValue:Ty,useDeferredValue:function(t){var e=Sn();return HT(e,Qe.memoizedState,t)},useTransition:function(){var t=Yg(Al)[0],e=Sn().memoizedState;return[t,e]},useMutableSource:$T,useSyncExternalStore:MT,useId:qT,unstable_isNewReconciler:!1},WA={readContext:En,useCallback:UT,useContext:En,useEffect:ky,useImperativeHandle:zT,useInsertionEffect:OT,useLayoutEffect:VT,useMemo:jT,useReducer:Qg,useRef:DT,useState:function(){return Qg(Al)},useDebugValue:Ty,useDeferredValue:function(t){var e=Sn();return Qe===null?e.memoizedState=t:HT(e,Qe.memoizedState,t)},useTransition:function(){var t=Qg(Al)[0],e=Sn().memoizedState;return[t,e]},useMutableSource:$T,useSyncExternalStore:MT,useId:qT,unstable_isNewReconciler:!1};function Sa(t,e){try{var n="",i=e;do n+=xI(i),i=i.return;while(i);var r=n}catch(s){r=`
Error generating stack: `+s.message+`
`+s.stack}return{value:t,source:e,stack:r,digest:null}}function Xg(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Iv(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var KA=typeof WeakMap=="function"?WeakMap:Map;function GT(t,e,n){n=Oi(-1,n),n.tag=3,n.payload={element:null};var i=e.value;return n.callback=function(){up||(up=!0,Hv=i),Iv(t,e)},n}function YT(t,e,n){n=Oi(-1,n),n.tag=3;var i=t.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;n.payload=function(){return i(r)},n.callback=function(){Iv(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Iv(t,e),typeof i!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function rk(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new KA;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(n)||(r.add(n),t=oN.bind(null,t,e,n),e.then(t,t))}function sk(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function ak(t,e,n,i,r){return t.mode&1?(t.flags|=65536,t.lanes=r,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Oi(-1,1),e.tag=2,kr(n,e,1))),n.lanes|=1),t)}var GA=ji.ReactCurrentOwner,Ut=!1;function Pt(t,e,n,i){e.child=t===null?PT(e,null,n,i):Ta(e,t.child,n,i)}function ok(t,e,n,i,r){n=n.render;var s=e.ref;return _a(e,r),i=by(t,e,n,i,s,r),n=xy(),t!==null&&!Ut?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Ui(t,e,r)):(Pe&&n&&cy(e),e.flags|=1,Pt(t,e,i,r),e.child)}function lk(t,e,n,i,r){if(t===null){var s=n.type;return typeof s=="function"&&!Ly(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,QT(t,e,s,i,r)):(t=Hd(n.type,null,i,e,e.mode,r),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&r)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:Pl,n(a,i)&&t.ref===e.ref)return Ui(t,e,r)}return e.flags|=1,t=Sr(s,i),t.ref=e.ref,t.return=e,e.child=t}function QT(t,e,n,i,r){if(t!==null){var s=t.memoizedProps;if(Pl(s,i)&&t.ref===e.ref)if(Ut=!1,e.pendingProps=i=s,(t.lanes&r)!==0)t.flags&131072&&(Ut=!0);else return e.lanes=t.lanes,Ui(t,e,r)}return Av(t,e,n,i,r)}function XT(t,e,n){var i=e.pendingProps,r=i.children,s=t!==null?t.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ve(fa,tn),tn|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ve(fa,tn),tn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:n,ve(fa,tn),tn|=i}else s!==null?(i=s.baseLanes|n,e.memoizedState=null):i=n,ve(fa,tn),tn|=i;return Pt(t,e,r,n),e.child}function ZT(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Av(t,e,n,i,r){var s=Ht(n)?fs:vt.current;return s=xa(e,s),_a(e,r),n=by(t,e,n,i,s,r),i=xy(),t!==null&&!Ut?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Ui(t,e,r)):(Pe&&i&&cy(e),e.flags|=1,Pt(t,e,n,r),e.child)}function ck(t,e,n,i,r){if(Ht(n)){var s=!0;ep(e)}else s=!1;if(_a(e,r),e.stateNode===null)zd(t,e),ET(e,n,i),Lv(e,n,i,r),i=!0;else if(t===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=En(c):(c=Ht(n)?fs:vt.current,c=xa(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==i||l!==c)&&ek(e,a,i,c),fr=!1;var p=e.memoizedState;a.state=p,sp(e,i,a,r),l=e.memoizedState,o!==i||p!==l||jt.current||fr?(typeof u=="function"&&(Rv(e,n,u,i),l=e.memoizedState),(o=fr||J0(e,n,o,i,p,l,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),a.props=i,a.state=l,a.context=c,i=o):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{a=e.stateNode,kT(t,e),o=e.memoizedProps,c=e.type===e.elementType?o:Gn(e.type,o),a.props=c,d=e.pendingProps,p=a.context,l=n.contextType,typeof l=="object"&&l!==null?l=En(l):(l=Ht(n)?fs:vt.current,l=xa(e,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||p!==l)&&ek(e,a,i,l),fr=!1,p=e.memoizedState,a.state=p,sp(e,i,a,r);var y=e.memoizedState;o!==d||p!==y||jt.current||fr?(typeof h=="function"&&(Rv(e,n,h,i),y=e.memoizedState),(c=fr||J0(e,n,c,i,p,y,l)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(i,y,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(i,y,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=y),a.props=i,a.state=y,a.context=l,i=c):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),i=!1)}return Nv(t,e,n,i,s,r)}function Nv(t,e,n,i,r,s){ZT(t,e);var a=(e.flags&128)!==0;if(!i&&!a)return r&&G0(e,n,!1),Ui(t,e,s);i=e.stateNode,GA.current=e;var o=a&&typeof n.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,t!==null&&a?(e.child=Ta(e,t.child,null,s),e.child=Ta(e,null,o,s)):Pt(t,e,o,s),e.memoizedState=i.state,r&&G0(e,n,!0),e.child}function JT(t){var e=t.stateNode;e.pendingContext?K0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&K0(t,e.context,!1),vy(t,e.containerInfo)}function uk(t,e,n,i,r){return ka(),dy(r),e.flags|=256,Pt(t,e,n,i),e.child}var Dv={dehydrated:null,treeContext:null,retryLane:0};function Ov(t){return{baseLanes:t,cachePool:null,transitions:null}}function eE(t,e,n){var i=e.pendingProps,r=$e.current,s=!1,a=(e.flags&128)!==0,o;if((o=a)||(o=t!==null&&t.memoizedState===null?!1:(r&2)!==0),o?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(r|=1),ve($e,r&1),t===null)return $v(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=i.children,t=i.fallback,s?(i=e.mode,s=e.child,a={mode:"hidden",children:a},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=Tp(a,i,0,null),t=hs(t,i,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Ov(n),e.memoizedState=Dv,t):Ey(e,a));if(r=t.memoizedState,r!==null&&(o=r.dehydrated,o!==null))return YA(t,e,a,i,o,r,n);if(s){s=i.fallback,a=e.mode,r=t.child,o=r.sibling;var l={mode:"hidden",children:i.children};return!(a&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Sr(r,l),i.subtreeFlags=r.subtreeFlags&14680064),o!==null?s=Sr(o,s):(s=hs(s,a,n,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,a=t.child.memoizedState,a=a===null?Ov(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=t.childLanes&~n,e.memoizedState=Dv,i}return s=t.child,t=s.sibling,i=Sr(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=n),i.return=e,i.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=i,e.memoizedState=null,i}function Ey(t,e){return e=Tp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Rd(t,e,n,i){return i!==null&&dy(i),Ta(e,t.child,null,n),t=Ey(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function YA(t,e,n,i,r,s,a){if(n)return e.flags&256?(e.flags&=-257,i=Xg(Error(P(422))),Rd(t,e,a,i)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=Tp({mode:"visible",children:i.children},r,0,null),s=hs(s,r,a,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Ta(e,t.child,null,a),e.child.memoizedState=Ov(a),e.memoizedState=Dv,s);if(!(e.mode&1))return Rd(t,e,a,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var o=i.dgst;return i=o,s=Error(P(419)),i=Xg(s,i,void 0),Rd(t,e,a,i)}if(o=(a&t.childLanes)!==0,Ut||o){if(i=tt,i!==null){switch(a&-a){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|a)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,zi(t,r),Zn(i,t,r,-1))}return Ry(),i=Xg(Error(P(421))),Rd(t,e,a,i)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=lN.bind(null,t),r._reactRetry=e,null):(t=s.treeContext,nn=xr(r.nextSibling),rn=e,Pe=!0,Qn=null,t!==null&&(bn[xn++]=Ni,bn[xn++]=Di,bn[xn++]=ms,Ni=t.id,Di=t.overflow,ms=e),e=Ey(e,i.children),e.flags|=4096,e)}function dk(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),Mv(t.return,e,n)}function Zg(t,e,n,i,r){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r)}function tE(t,e,n){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(Pt(t,e,i.children,n),i=$e.current,i&2)i=i&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&dk(t,n,e);else if(t.tag===19)dk(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}i&=1}if(ve($e,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(n=e.child,r=null;n!==null;)t=n.alternate,t!==null&&ap(t)===null&&(r=n),n=n.sibling;n=r,n===null?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),Zg(e,!1,r,n,s);break;case"backwards":for(n=null,r=e.child,e.child=null;r!==null;){if(t=r.alternate,t!==null&&ap(t)===null){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}Zg(e,!0,n,null,s);break;case"together":Zg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function zd(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Ui(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),vs|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(P(153));if(e.child!==null){for(t=e.child,n=Sr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Sr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function QA(t,e,n){switch(e.tag){case 3:JT(e),ka();break;case 5:CT(e);break;case 1:Ht(e.type)&&ep(e);break;case 4:vy(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;ve(ip,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(ve($e,$e.current&1),e.flags|=128,null):n&e.child.childLanes?eE(t,e,n):(ve($e,$e.current&1),t=Ui(t,e,n),t!==null?t.sibling:null);ve($e,$e.current&1);break;case 19:if(i=(n&e.childLanes)!==0,t.flags&128){if(i)return tE(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ve($e,$e.current),i)break;return null;case 22:case 23:return e.lanes=0,XT(t,e,n)}return Ui(t,e,n)}var nE,Vv,iE,rE;nE=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Vv=function(){};iE=function(t,e,n,i){var r=t.memoizedProps;if(r!==i){t=e.stateNode,ds(mi.current);var s=null;switch(n){case"input":r=av(t,r),i=av(t,i),s=[];break;case"select":r=Re({},r,{value:void 0}),i=Re({},i,{value:void 0}),s=[];break;case"textarea":r=cv(t,r),i=cv(t,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(t.onclick=Zd)}dv(n,i);var a;n=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var o=r[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(wl.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(o=r?.[c],i.hasOwnProperty(c)&&l!==o&&(l!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(n||(n={}),n[a]=l[a])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(wl.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&be("scroll",t),s||o===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};rE=function(t,e,n,i){n!==i&&(e.flags|=4)};function rl(t,e){if(!Pe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function mt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,i=0;if(e)for(var r=t.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=t,r=r.sibling;else for(r=t.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=t,r=r.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function XA(t,e,n){var i=e.pendingProps;switch(uy(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(e),null;case 1:return Ht(e.type)&&Jd(),mt(e),null;case 3:return i=e.stateNode,Ea(),xe(jt),xe(vt),_y(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&($d(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Qn!==null&&(Wv(Qn),Qn=null))),Vv(t,e),mt(e),null;case 5:yy(e);var r=ds(Ll.current);if(n=e.type,t!==null&&e.stateNode!=null)iE(t,e,n,i,r),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(P(166));return mt(e),null}if(t=ds(mi.current),$d(e)){i=e.stateNode,n=e.type;var s=e.memoizedProps;switch(i[hi]=e,i[Ml]=s,t=(e.mode&1)!==0,n){case"dialog":be("cancel",i),be("close",i);break;case"iframe":case"object":case"embed":be("load",i);break;case"video":case"audio":for(r=0;r<ul.length;r++)be(ul[r],i);break;case"source":be("error",i);break;case"img":case"image":case"link":be("error",i),be("load",i);break;case"details":be("toggle",i);break;case"input":_0(i,s),be("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},be("invalid",i);break;case"textarea":b0(i,s),be("invalid",i)}dv(n,s),r=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];a==="children"?typeof o=="string"?i.textContent!==o&&(s.suppressHydrationWarning!==!0&&Cd(i.textContent,o,t),r=["children",o]):typeof o=="number"&&i.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&Cd(i.textContent,o,t),r=["children",""+o]):wl.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&be("scroll",i)}switch(n){case"input":gd(i),w0(i,s,!0);break;case"textarea":gd(i),x0(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=Zd)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{a=r.nodeType===9?r:r.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Rk(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof i.is=="string"?t=a.createElement(n,{is:i.is}):(t=a.createElement(n),n==="select"&&(a=t,i.multiple?a.multiple=!0:i.size&&(a.size=i.size))):t=a.createElementNS(t,n),t[hi]=e,t[Ml]=i,nE(t,e,!1,!1),e.stateNode=t;e:{switch(a=pv(n,i),n){case"dialog":be("cancel",t),be("close",t),r=i;break;case"iframe":case"object":case"embed":be("load",t),r=i;break;case"video":case"audio":for(r=0;r<ul.length;r++)be(ul[r],t);r=i;break;case"source":be("error",t),r=i;break;case"img":case"image":case"link":be("error",t),be("load",t),r=i;break;case"details":be("toggle",t),r=i;break;case"input":_0(t,i),r=av(t,i),be("invalid",t);break;case"option":r=i;break;case"select":t._wrapperState={wasMultiple:!!i.multiple},r=Re({},i,{value:void 0}),be("invalid",t);break;case"textarea":b0(t,i),r=cv(t,i),be("invalid",t);break;default:r=i}dv(n,r),o=r;for(s in o)if(o.hasOwnProperty(s)){var l=o[s];s==="style"?Ak(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Lk(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&bl(t,l):typeof l=="number"&&bl(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(wl.hasOwnProperty(s)?l!=null&&s==="onScroll"&&be("scroll",t):l!=null&&Yv(t,s,l,a))}switch(n){case"input":gd(t),w0(t,i,!1);break;case"textarea":gd(t),x0(t);break;case"option":i.value!=null&&t.setAttribute("value",""+Pr(i.value));break;case"select":t.multiple=!!i.multiple,s=i.value,s!=null?ma(t,!!i.multiple,s,!1):i.defaultValue!=null&&ma(t,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(t.onclick=Zd)}switch(n){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return mt(e),null;case 6:if(t&&e.stateNode!=null)rE(t,e,t.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(P(166));if(n=ds(Ll.current),ds(mi.current),$d(e)){if(i=e.stateNode,n=e.memoizedProps,i[hi]=e,(s=i.nodeValue!==n)&&(t=rn,t!==null))switch(t.tag){case 3:Cd(i.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Cd(i.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[hi]=e,e.stateNode=i}return mt(e),null;case 13:if(xe($e),i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Pe&&nn!==null&&e.mode&1&&!(e.flags&128))bT(),ka(),e.flags|=98560,s=!1;else if(s=$d(e),i!==null&&i.dehydrated!==null){if(t===null){if(!s)throw Error(P(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(P(317));s[hi]=e}else ka(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;mt(e),s=!1}else Qn!==null&&(Wv(Qn),Qn=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(i=i!==null,i!==(t!==null&&t.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(t===null||$e.current&1?Xe===0&&(Xe=3):Ry())),e.updateQueue!==null&&(e.flags|=4),mt(e),null);case 4:return Ea(),Vv(t,e),t===null&&Cl(e.stateNode.containerInfo),mt(e),null;case 10:return fy(e.type._context),mt(e),null;case 17:return Ht(e.type)&&Jd(),mt(e),null;case 19:if(xe($e),s=e.memoizedState,s===null)return mt(e),null;if(i=(e.flags&128)!==0,a=s.rendering,a===null)if(i)rl(s,!1);else{if(Xe!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=ap(t),a!==null){for(e.flags|=128,rl(s,!1),i=a.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=n,n=e.child;n!==null;)s=n,t=i,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,t=a.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return ve($e,$e.current&1|2),e.child}t=t.sibling}s.tail!==null&&Oe()>Pa&&(e.flags|=128,i=!0,rl(s,!1),e.lanes=4194304)}else{if(!i)if(t=ap(a),t!==null){if(e.flags|=128,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),rl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Pe)return mt(e),null}else 2*Oe()-s.renderingStartTime>Pa&&n!==1073741824&&(e.flags|=128,i=!0,rl(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(n=s.last,n!==null?n.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Oe(),e.sibling=null,n=$e.current,ve($e,i?n&1|2:n&1),e):(mt(e),null);case 22:case 23:return My(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?tn&1073741824&&(mt(e),e.subtreeFlags&6&&(e.flags|=8192)):mt(e),null;case 24:return null;case 25:return null}throw Error(P(156,e.tag))}function ZA(t,e){switch(uy(e),e.tag){case 1:return Ht(e.type)&&Jd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ea(),xe(jt),xe(vt),_y(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return yy(e),null;case 13:if(xe($e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(P(340));ka()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return xe($e),null;case 4:return Ea(),null;case 10:return fy(e.type._context),null;case 22:case 23:return My(),null;case 24:return null;default:return null}}var Ld=!1,gt=!1,JA=typeof WeakSet=="function"?WeakSet:Set,N=null;function ha(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){De(t,e,i)}else n.current=null}function Fv(t,e,n){try{n()}catch(i){De(t,e,i)}}var pk=!1;function eN(t,e){if(xv=Yd,t=lT(),ly(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,l=-1,c=0,u=0,d=t,p=null;t:for(;;){for(var h;d!==n||r!==0&&d.nodeType!==3||(o=a+r),d!==s||i!==0&&d.nodeType!==3||(l=a+i),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)p=d,d=h;for(;;){if(d===t)break t;if(p===n&&++c===r&&(o=a),p===s&&++u===i&&(l=a),(h=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=h}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(kv={focusedElem:t,selectionRange:n},Yd=!1,N=e;N!==null;)if(e=N,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,N=t;else for(;N!==null;){e=N;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var v=y.memoizedProps,w=y.memoizedState,m=e.stateNode,f=m.getSnapshotBeforeUpdate(e.elementType===e.type?v:Gn(e.type,v),w);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(P(163))}}catch(x){De(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,N=t;break}N=e.return}return y=pk,pk=!1,y}function vl(t,e,n){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&Fv(e,n,s)}r=r.next}while(r!==i)}}function xp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var i=n.create;n.destroy=i()}n=n.next}while(n!==e)}}function zv(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function sE(t){var e=t.alternate;e!==null&&(t.alternate=null,sE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[hi],delete e[Ml],delete e[Sv],delete e[DA],delete e[OA])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function aE(t){return t.tag===5||t.tag===3||t.tag===4}function hk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||aE(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Uv(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Zd));else if(i!==4&&(t=t.child,t!==null))for(Uv(t,e,n),t=t.sibling;t!==null;)Uv(t,e,n),t=t.sibling}function jv(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(t=t.child,t!==null))for(jv(t,e,n),t=t.sibling;t!==null;)jv(t,e,n),t=t.sibling}var at=null,Yn=!1;function pr(t,e,n){for(n=n.child;n!==null;)oE(t,e,n),n=n.sibling}function oE(t,e,n){if(fi&&typeof fi.onCommitFiberUnmount=="function")try{fi.onCommitFiberUnmount(fp,n)}catch{}switch(n.tag){case 5:gt||ha(n,e);case 6:var i=at,r=Yn;at=null,pr(t,e,n),at=i,Yn=r,at!==null&&(Yn?(t=at,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):at.removeChild(n.stateNode));break;case 18:at!==null&&(Yn?(t=at,n=n.stateNode,t.nodeType===8?Bg(t.parentNode,n):t.nodeType===1&&Bg(t,n),El(t)):Bg(at,n.stateNode));break;case 4:i=at,r=Yn,at=n.stateNode.containerInfo,Yn=!0,pr(t,e,n),at=i,Yn=r;break;case 0:case 11:case 14:case 15:if(!gt&&(i=n.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Fv(n,e,a),r=r.next}while(r!==i)}pr(t,e,n);break;case 1:if(!gt&&(ha(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(o){De(n,e,o)}pr(t,e,n);break;case 21:pr(t,e,n);break;case 22:n.mode&1?(gt=(i=gt)||n.memoizedState!==null,pr(t,e,n),gt=i):pr(t,e,n);break;default:pr(t,e,n)}}function fk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new JA),e.forEach(function(i){var r=cN.bind(null,t,i);n.has(i)||(n.add(i),i.then(r,r))})}}function Kn(t,e){var n=e.deletions;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i];try{var s=t,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 5:at=o.stateNode,Yn=!1;break e;case 3:at=o.stateNode.containerInfo,Yn=!0;break e;case 4:at=o.stateNode.containerInfo,Yn=!0;break e}o=o.return}if(at===null)throw Error(P(160));oE(s,a,r),at=null,Yn=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){De(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)lE(e,t),e=e.sibling}function lE(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Kn(e,t),di(t),i&4){try{vl(3,t,t.return),xp(3,t)}catch(v){De(t,t.return,v)}try{vl(5,t,t.return)}catch(v){De(t,t.return,v)}}break;case 1:Kn(e,t),di(t),i&512&&n!==null&&ha(n,n.return);break;case 5:if(Kn(e,t),di(t),i&512&&n!==null&&ha(n,n.return),t.flags&32){var r=t.stateNode;try{bl(r,"")}catch(v){De(t,t.return,v)}}if(i&4&&(r=t.stateNode,r!=null)){var s=t.memoizedProps,a=n!==null?n.memoizedProps:s,o=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{o==="input"&&s.type==="radio"&&s.name!=null&&$k(r,s),pv(o,a);var c=pv(o,s);for(a=0;a<l.length;a+=2){var u=l[a],d=l[a+1];u==="style"?Ak(r,d):u==="dangerouslySetInnerHTML"?Lk(r,d):u==="children"?bl(r,d):Yv(r,u,d,c)}switch(o){case"input":ov(r,s);break;case"textarea":Mk(r,s);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?ma(r,!!s.multiple,h,!1):p!==!!s.multiple&&(s.defaultValue!=null?ma(r,!!s.multiple,s.defaultValue,!0):ma(r,!!s.multiple,s.multiple?[]:"",!1))}r[Ml]=s}catch(v){De(t,t.return,v)}}break;case 6:if(Kn(e,t),di(t),i&4){if(t.stateNode===null)throw Error(P(162));r=t.stateNode,s=t.memoizedProps;try{r.nodeValue=s}catch(v){De(t,t.return,v)}}break;case 3:if(Kn(e,t),di(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{El(e.containerInfo)}catch(v){De(t,t.return,v)}break;case 4:Kn(e,t),di(t);break;case 13:Kn(e,t),di(t),r=t.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Cy=Oe())),i&4&&fk(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(gt=(c=gt)||u,Kn(e,t),gt=c):Kn(e,t),di(t),i&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(N=t,u=t.child;u!==null;){for(d=N=u;N!==null;){switch(p=N,h=p.child,p.tag){case 0:case 11:case 14:case 15:vl(4,p,p.return);break;case 1:ha(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){i=p,n=p.return;try{e=i,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(v){De(i,n,v)}}break;case 5:ha(p,p.return);break;case 22:if(p.memoizedState!==null){gk(d);continue}}h!==null?(h.return=p,N=h):gk(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{r=d.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(o=d.stateNode,l=d.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=Ik("display",a))}catch(v){De(t,t.return,v)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(v){De(t,t.return,v)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Kn(e,t),di(t),i&4&&fk(t);break;case 21:break;default:Kn(e,t),di(t)}}function di(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(aE(n)){var i=n;break e}n=n.return}throw Error(P(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(bl(r,""),i.flags&=-33);var s=hk(t);jv(t,s,r);break;case 3:case 4:var a=i.stateNode.containerInfo,o=hk(t);Uv(t,o,a);break;default:throw Error(P(161))}}catch(l){De(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function tN(t,e,n){N=t,cE(t,e,n)}function cE(t,e,n){for(var i=(t.mode&1)!==0;N!==null;){var r=N,s=r.child;if(r.tag===22&&i){var a=r.memoizedState!==null||Ld;if(!a){var o=r.alternate,l=o!==null&&o.memoizedState!==null||gt;o=Ld;var c=gt;if(Ld=a,(gt=l)&&!c)for(N=r;N!==null;)a=N,l=a.child,a.tag===22&&a.memoizedState!==null?vk(r):l!==null?(l.return=a,N=l):vk(r);for(;s!==null;)N=s,cE(s,e,n),s=s.sibling;N=r,Ld=o,gt=c}mk(t,e,n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,N=s):mk(t,e,n)}}function mk(t){for(;N!==null;){var e=N;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:gt||xp(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!gt)if(n===null)i.componentDidMount();else{var r=e.elementType===e.type?n.memoizedProps:Gn(e.type,n.memoizedProps);i.componentDidUpdate(r,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&Z0(e,s,i);break;case 3:var a=e.updateQueue;if(a!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}Z0(e,a,n)}break;case 5:var o=e.stateNode;if(n===null&&e.flags&4){n=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&El(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}gt||e.flags&512&&zv(e)}catch(p){De(e,e.return,p)}}if(e===t){N=null;break}if(n=e.sibling,n!==null){n.return=e.return,N=n;break}N=e.return}}function gk(t){for(;N!==null;){var e=N;if(e===t){N=null;break}var n=e.sibling;if(n!==null){n.return=e.return,N=n;break}N=e.return}}function vk(t){for(;N!==null;){var e=N;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{xp(4,e)}catch(l){De(e,n,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){De(e,r,l)}}var s=e.return;try{zv(e)}catch(l){De(e,s,l)}break;case 5:var a=e.return;try{zv(e)}catch(l){De(e,a,l)}}}catch(l){De(e,e.return,l)}if(e===t){N=null;break}var o=e.sibling;if(o!==null){o.return=e.return,N=o;break}N=e.return}}var nN=Math.ceil,cp=ji.ReactCurrentDispatcher,Sy=ji.ReactCurrentOwner,Tn=ji.ReactCurrentBatchConfig,se=0,tt=null,He=null,ot=0,tn=0,fa=Mr(0),Xe=0,Dl=null,vs=0,kp=0,Py=0,yl=null,zt=null,Cy=0,Pa=1/0,Ii=null,up=!1,Hv=null,Tr=null,Id=!1,yr=null,dp=0,_l=0,qv=null,Ud=-1,jd=0;function Ct(){return se&6?Oe():Ud!==-1?Ud:Ud=Oe()}function Er(t){return t.mode&1?se&2&&ot!==0?ot&-ot:FA.transition!==null?(jd===0&&(jd=Wk()),jd):(t=pe,t!==0||(t=window.event,t=t===void 0?16:Jk(t.type)),t):1}function Zn(t,e,n,i){if(50<_l)throw _l=0,qv=null,Error(P(185));Ol(t,n,i),(!(se&2)||t!==tt)&&(t===tt&&(!(se&2)&&(kp|=n),Xe===4&&gr(t,ot)),qt(t,i),n===1&&se===0&&!(e.mode&1)&&(Pa=Oe()+500,_p&&Rr()))}function qt(t,e){var n=t.callbackNode;UI(t,e);var i=Gd(t,t===tt?ot:0);if(i===0)n!==null&&E0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=i&-i,t.callbackPriority!==e){if(n!=null&&E0(n),e===1)t.tag===0?VA(yk.bind(null,t)):yT(yk.bind(null,t)),AA(function(){!(se&6)&&Rr()}),n=null;else{switch(Kk(i)){case 1:n=ey;break;case 4:n=qk;break;case 16:n=Kd;break;case 536870912:n=Bk;break;default:n=Kd}n=vE(n,uE.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function uE(t,e){if(Ud=-1,jd=0,se&6)throw Error(P(327));var n=t.callbackNode;if(wa()&&t.callbackNode!==n)return null;var i=Gd(t,t===tt?ot:0);if(i===0)return null;if(i&30||i&t.expiredLanes||e)e=pp(t,i);else{e=i;var r=se;se|=2;var s=pE();(tt!==t||ot!==e)&&(Ii=null,Pa=Oe()+500,ps(t,e));do try{sN();break}catch(o){dE(t,o)}while(!0);hy(),cp.current=s,se=r,He!==null?e=0:(tt=null,ot=0,e=Xe)}if(e!==0){if(e===2&&(r=vv(t),r!==0&&(i=r,e=Bv(t,r))),e===1)throw n=Dl,ps(t,0),gr(t,i),qt(t,Oe()),n;if(e===6)gr(t,i);else{if(r=t.current.alternate,!(i&30)&&!iN(r)&&(e=pp(t,i),e===2&&(s=vv(t),s!==0&&(i=s,e=Bv(t,s))),e===1))throw n=Dl,ps(t,0),gr(t,i),qt(t,Oe()),n;switch(t.finishedWork=r,t.finishedLanes=i,e){case 0:case 1:throw Error(P(345));case 2:ls(t,zt,Ii);break;case 3:if(gr(t,i),(i&130023424)===i&&(e=Cy+500-Oe(),10<e)){if(Gd(t,0)!==0)break;if(r=t.suspendedLanes,(r&i)!==i){Ct(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=Ev(ls.bind(null,t,zt,Ii),e);break}ls(t,zt,Ii);break;case 4:if(gr(t,i),(i&4194240)===i)break;for(e=t.eventTimes,r=-1;0<i;){var a=31-Xn(i);s=1<<a,a=e[a],a>r&&(r=a),i&=~s}if(i=r,i=Oe()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*nN(i/1960))-i,10<i){t.timeoutHandle=Ev(ls.bind(null,t,zt,Ii),i);break}ls(t,zt,Ii);break;case 5:ls(t,zt,Ii);break;default:throw Error(P(329))}}}return qt(t,Oe()),t.callbackNode===n?uE.bind(null,t):null}function Bv(t,e){var n=yl;return t.current.memoizedState.isDehydrated&&(ps(t,e).flags|=256),t=pp(t,e),t!==2&&(e=zt,zt=n,e!==null&&Wv(e)),t}function Wv(t){zt===null?zt=t:zt.push.apply(zt,t)}function iN(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var i=0;i<n.length;i++){var r=n[i],s=r.getSnapshot;r=r.value;try{if(!Jn(s(),r))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function gr(t,e){for(e&=~Py,e&=~kp,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Xn(e),i=1<<n;t[n]=-1,e&=~i}}function yk(t){if(se&6)throw Error(P(327));wa();var e=Gd(t,0);if(!(e&1))return qt(t,Oe()),null;var n=pp(t,e);if(t.tag!==0&&n===2){var i=vv(t);i!==0&&(e=i,n=Bv(t,i))}if(n===1)throw n=Dl,ps(t,0),gr(t,e),qt(t,Oe()),n;if(n===6)throw Error(P(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ls(t,zt,Ii),qt(t,Oe()),null}function $y(t,e){var n=se;se|=1;try{return t(e)}finally{se=n,se===0&&(Pa=Oe()+500,_p&&Rr())}}function ys(t){yr!==null&&yr.tag===0&&!(se&6)&&wa();var e=se;se|=1;var n=Tn.transition,i=pe;try{if(Tn.transition=null,pe=1,t)return t()}finally{pe=i,Tn.transition=n,se=e,!(se&6)&&Rr()}}function My(){tn=fa.current,xe(fa)}function ps(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,IA(n)),He!==null)for(n=He.return;n!==null;){var i=n;switch(uy(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&Jd();break;case 3:Ea(),xe(jt),xe(vt),_y();break;case 5:yy(i);break;case 4:Ea();break;case 13:xe($e);break;case 19:xe($e);break;case 10:fy(i.type._context);break;case 22:case 23:My()}n=n.return}if(tt=t,He=t=Sr(t.current,null),ot=tn=e,Xe=0,Dl=null,Py=kp=vs=0,zt=yl=null,us!==null){for(e=0;e<us.length;e++)if(n=us[e],i=n.interleaved,i!==null){n.interleaved=null;var r=i.next,s=n.pending;if(s!==null){var a=s.next;s.next=r,i.next=a}n.pending=i}us=null}return t}function dE(t,e){do{var n=He;try{if(hy(),Vd.current=lp,op){for(var i=Me.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}op=!1}if(gs=0,et=Qe=Me=null,gl=!1,Il=0,Sy.current=null,n===null||n.return===null){Xe=1,Dl=e,He=null;break}e:{var s=t,a=n.return,o=n,l=e;if(e=ot,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=o,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=sk(a);if(h!==null){h.flags&=-257,ak(h,a,o,s,e),h.mode&1&&rk(s,c,e),e=h,l=c;var y=e.updateQueue;if(y===null){var v=new Set;v.add(l),e.updateQueue=v}else y.add(l);break e}else{if(!(e&1)){rk(s,c,e),Ry();break e}l=Error(P(426))}}else if(Pe&&o.mode&1){var w=sk(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),ak(w,a,o,s,e),dy(Sa(l,o));break e}}s=l=Sa(l,o),Xe!==4&&(Xe=2),yl===null?yl=[s]:yl.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var m=GT(s,l,e);X0(s,m);break e;case 1:o=l;var f=s.type,g=s.stateNode;if(!(s.flags&128)&&(typeof f.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Tr===null||!Tr.has(g)))){s.flags|=65536,e&=-e,s.lanes|=e;var x=YT(s,o,e);X0(s,x);break e}}s=s.return}while(s!==null)}fE(n)}catch(E){e=E,He===n&&n!==null&&(He=n=n.return);continue}break}while(!0)}function pE(){var t=cp.current;return cp.current=lp,t===null?lp:t}function Ry(){(Xe===0||Xe===3||Xe===2)&&(Xe=4),tt===null||!(vs&268435455)&&!(kp&268435455)||gr(tt,ot)}function pp(t,e){var n=se;se|=2;var i=pE();(tt!==t||ot!==e)&&(Ii=null,ps(t,e));do try{rN();break}catch(r){dE(t,r)}while(!0);if(hy(),se=n,cp.current=i,He!==null)throw Error(P(261));return tt=null,ot=0,Xe}function rN(){for(;He!==null;)hE(He)}function sN(){for(;He!==null&&!LI();)hE(He)}function hE(t){var e=gE(t.alternate,t,tn);t.memoizedProps=t.pendingProps,e===null?fE(t):He=e,Sy.current=null}function fE(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=ZA(n,e),n!==null){n.flags&=32767,He=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Xe=6,He=null;return}}else if(n=XA(n,e,tn),n!==null){He=n;return}if(e=e.sibling,e!==null){He=e;return}He=e=t}while(e!==null);Xe===0&&(Xe=5)}function ls(t,e,n){var i=pe,r=Tn.transition;try{Tn.transition=null,pe=1,aN(t,e,n,i)}finally{Tn.transition=r,pe=i}return null}function aN(t,e,n,i){do wa();while(yr!==null);if(se&6)throw Error(P(327));n=t.finishedWork;var r=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(P(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(jI(t,s),t===tt&&(He=tt=null,ot=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Id||(Id=!0,vE(Kd,function(){return wa(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Tn.transition,Tn.transition=null;var a=pe;pe=1;var o=se;se|=4,Sy.current=null,eN(t,n),lE(n,t),CA(kv),Yd=!!xv,kv=xv=null,t.current=n,tN(n,t,r),II(),se=o,pe=a,Tn.transition=s}else t.current=n;if(Id&&(Id=!1,yr=t,dp=r),s=t.pendingLanes,s===0&&(Tr=null),DI(n.stateNode,i),qt(t,Oe()),e!==null)for(i=t.onRecoverableError,n=0;n<e.length;n++)r=e[n],i(r.value,{componentStack:r.stack,digest:r.digest});if(up)throw up=!1,t=Hv,Hv=null,t;return dp&1&&t.tag!==0&&wa(),s=t.pendingLanes,s&1?t===qv?_l++:(_l=0,qv=t):_l=0,Rr(),null}function wa(){if(yr!==null){var t=Kk(dp),e=Tn.transition,n=pe;try{if(Tn.transition=null,pe=16>t?16:t,yr===null)var i=!1;else{if(t=yr,yr=null,dp=0,se&6)throw Error(P(331));var r=se;for(se|=4,N=t.current;N!==null;){var s=N,a=s.child;if(N.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l<o.length;l++){var c=o[l];for(N=c;N!==null;){var u=N;switch(u.tag){case 0:case 11:case 15:vl(8,u,s)}var d=u.child;if(d!==null)d.return=u,N=d;else for(;N!==null;){u=N;var p=u.sibling,h=u.return;if(sE(u),u===c){N=null;break}if(p!==null){p.return=h,N=p;break}N=h}}}var y=s.alternate;if(y!==null){var v=y.child;if(v!==null){y.child=null;do{var w=v.sibling;v.sibling=null,v=w}while(v!==null)}}N=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,N=a;else e:for(;N!==null;){if(s=N,s.flags&2048)switch(s.tag){case 0:case 11:case 15:vl(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,N=m;break e}N=s.return}}var f=t.current;for(N=f;N!==null;){a=N;var g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,N=g;else e:for(a=f;N!==null;){if(o=N,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:xp(9,o)}}catch(E){De(o,o.return,E)}if(o===a){N=null;break e}var x=o.sibling;if(x!==null){x.return=o.return,N=x;break e}N=o.return}}if(se=r,Rr(),fi&&typeof fi.onPostCommitFiberRoot=="function")try{fi.onPostCommitFiberRoot(fp,t)}catch{}i=!0}return i}finally{pe=n,Tn.transition=e}}return!1}function _k(t,e,n){e=Sa(n,e),e=GT(t,e,1),t=kr(t,e,1),e=Ct(),t!==null&&(Ol(t,1,e),qt(t,e))}function De(t,e,n){if(t.tag===3)_k(t,t,n);else for(;e!==null;){if(e.tag===3){_k(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Tr===null||!Tr.has(i))){t=Sa(n,t),t=YT(e,t,1),e=kr(e,t,1),t=Ct(),e!==null&&(Ol(e,1,t),qt(e,t));break}}e=e.return}}function oN(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),e=Ct(),t.pingedLanes|=t.suspendedLanes&n,tt===t&&(ot&n)===n&&(Xe===4||Xe===3&&(ot&130023424)===ot&&500>Oe()-Cy?ps(t,0):Py|=n),qt(t,e)}function mE(t,e){e===0&&(t.mode&1?(e=_d,_d<<=1,!(_d&130023424)&&(_d=4194304)):e=1);var n=Ct();t=zi(t,e),t!==null&&(Ol(t,e,n),qt(t,n))}function lN(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),mE(t,n)}function cN(t,e){var n=0;switch(t.tag){case 13:var i=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(P(314))}i!==null&&i.delete(e),mE(t,n)}var gE;gE=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||jt.current)Ut=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ut=!1,QA(t,e,n);Ut=!!(t.flags&131072)}else Ut=!1,Pe&&e.flags&1048576&&_T(e,np,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;zd(t,e),t=e.pendingProps;var r=xa(e,vt.current);_a(e,n),r=by(null,e,i,t,r,n);var s=xy();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ht(i)?(s=!0,ep(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,gy(e),r.updater=wp,e.stateNode=r,r._reactInternals=e,Lv(e,i,t,n),e=Nv(null,e,i,!0,s,n)):(e.tag=0,Pe&&s&&cy(e),Pt(null,e,r,n),e=e.child),e;case 16:i=e.elementType;e:{switch(zd(t,e),t=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=dN(i),t=Gn(i,t),r){case 0:e=Av(null,e,i,t,n);break e;case 1:e=ck(null,e,i,t,n);break e;case 11:e=ok(null,e,i,t,n);break e;case 14:e=lk(null,e,i,Gn(i.type,t),n);break e}throw Error(P(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Gn(i,r),Av(t,e,i,r,n);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Gn(i,r),ck(t,e,i,r,n);case 3:e:{if(JT(e),t===null)throw Error(P(387));i=e.pendingProps,s=e.memoizedState,r=s.element,kT(t,e),sp(e,i,null,n);var a=e.memoizedState;if(i=a.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Sa(Error(P(423)),e),e=uk(t,e,i,n,r);break e}else if(i!==r){r=Sa(Error(P(424)),e),e=uk(t,e,i,n,r);break e}else for(nn=xr(e.stateNode.containerInfo.firstChild),rn=e,Pe=!0,Qn=null,n=PT(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ka(),i===r){e=Ui(t,e,n);break e}Pt(t,e,i,n)}e=e.child}return e;case 5:return CT(e),t===null&&$v(e),i=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,Tv(i,r)?a=null:s!==null&&Tv(i,s)&&(e.flags|=32),ZT(t,e),Pt(t,e,a,n),e.child;case 6:return t===null&&$v(e),null;case 13:return eE(t,e,n);case 4:return vy(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Ta(e,null,i,n):Pt(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Gn(i,r),ok(t,e,i,r,n);case 7:return Pt(t,e,e.pendingProps,n),e.child;case 8:return Pt(t,e,e.pendingProps.children,n),e.child;case 12:return Pt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,a=r.value,ve(ip,i._currentValue),i._currentValue=a,s!==null)if(Jn(s.value,a)){if(s.children===r.children&&!jt.current){e=Ui(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Oi(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Mv(s.return,n,e),o.lanes|=n;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(P(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Mv(a,n,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Pt(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,_a(e,n),r=En(r),i=i(r),e.flags|=1,Pt(t,e,i,n),e.child;case 14:return i=e.type,r=Gn(i,e.pendingProps),r=Gn(i.type,r),lk(t,e,i,r,n);case 15:return QT(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Gn(i,r),zd(t,e),e.tag=1,Ht(i)?(t=!0,ep(e)):t=!1,_a(e,n),ET(e,i,r),Lv(e,i,r,n),Nv(null,e,i,!0,t,n);case 19:return tE(t,e,n);case 22:return XT(t,e,n)}throw Error(P(156,e.tag))};function vE(t,e){return Hk(t,e)}function uN(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kn(t,e,n,i){return new uN(t,e,n,i)}function Ly(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dN(t){if(typeof t=="function")return Ly(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Xv)return 11;if(t===Zv)return 14}return 2}function Sr(t,e){var n=t.alternate;return n===null?(n=kn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Hd(t,e,n,i,r,s){var a=2;if(i=t,typeof t=="function")Ly(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case ra:return hs(n.children,r,s,e);case Qv:a=8,r|=8;break;case nv:return t=kn(12,n,e,r|2),t.elementType=nv,t.lanes=s,t;case iv:return t=kn(13,n,e,r),t.elementType=iv,t.lanes=s,t;case rv:return t=kn(19,n,e,r),t.elementType=rv,t.lanes=s,t;case Sk:return Tp(n,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Tk:a=10;break e;case Ek:a=9;break e;case Xv:a=11;break e;case Zv:a=14;break e;case hr:a=16,i=null;break e}throw Error(P(130,t==null?t:typeof t,""))}return e=kn(a,n,e,r),e.elementType=t,e.type=i,e.lanes=s,e}function hs(t,e,n,i){return t=kn(7,t,i,e),t.lanes=n,t}function Tp(t,e,n,i){return t=kn(22,t,i,e),t.elementType=Sk,t.lanes=n,t.stateNode={isHidden:!1},t}function Jg(t,e,n){return t=kn(6,t,null,e),t.lanes=n,t}function ev(t,e,n){return e=kn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function pN(t,e,n,i,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Og(0),this.expirationTimes=Og(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Og(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Iy(t,e,n,i,r,s,a,o,l){return t=new pN(t,e,n,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=kn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},gy(s),t}function hN(t,e,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ia,key:i==null?null:""+i,children:t,containerInfo:e,implementation:n}}function yE(t){if(!t)return Cr;t=t._reactInternals;e:{if(ws(t)!==t||t.tag!==1)throw Error(P(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Ht(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(P(171))}if(t.tag===1){var n=t.type;if(Ht(n))return vT(t,n,e)}return e}function _E(t,e,n,i,r,s,a,o,l){return t=Iy(n,i,!0,t,r,s,a,o,l),t.context=yE(null),n=t.current,i=Ct(),r=Er(n),s=Oi(i,r),s.callback=e??null,kr(n,s,r),t.current.lanes=r,Ol(t,r,i),qt(t,i),t}function Ep(t,e,n,i){var r=e.current,s=Ct(),a=Er(r);return n=yE(n),e.context===null?e.context=n:e.pendingContext=n,e=Oi(s,a),e.payload={element:t},i=i===void 0?null:i,i!==null&&(e.callback=i),t=kr(r,e,a),t!==null&&(Zn(t,r,a,s),Od(t,r,a)),a}function hp(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function wk(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Ay(t,e){wk(t,e),(t=t.alternate)&&wk(t,e)}function fN(){return null}var wE=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ny(t){this._internalRoot=t}Sp.prototype.render=Ny.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(P(409));Ep(t,e,null,null)};Sp.prototype.unmount=Ny.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ys(function(){Ep(null,t,null,null)}),e[Fi]=null}};function Sp(t){this._internalRoot=t}Sp.prototype.unstable_scheduleHydration=function(t){if(t){var e=Qk();t={blockedOn:null,target:t,priority:e};for(var n=0;n<mr.length&&e!==0&&e<mr[n].priority;n++);mr.splice(n,0,t),n===0&&Zk(t)}};function Dy(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Pp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function bk(){}function mN(t,e,n,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=hp(a);s.call(c)}}var a=_E(e,i,t,0,null,!1,!1,"",bk);return t._reactRootContainer=a,t[Fi]=a.current,Cl(t.nodeType===8?t.parentNode:t),ys(),a}for(;r=t.lastChild;)t.removeChild(r);if(typeof i=="function"){var o=i;i=function(){var c=hp(l);o.call(c)}}var l=Iy(t,0,!1,null,null,!1,!1,"",bk);return t._reactRootContainer=l,t[Fi]=l.current,Cl(t.nodeType===8?t.parentNode:t),ys(function(){Ep(e,l,n,i)}),l}function Cp(t,e,n,i,r){var s=n._reactRootContainer;if(s){var a=s;if(typeof r=="function"){var o=r;r=function(){var l=hp(a);o.call(l)}}Ep(e,a,t,r)}else a=mN(n,e,t,r,i);return hp(a)}Gk=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=cl(e.pendingLanes);n!==0&&(ty(e,n|1),qt(e,Oe()),!(se&6)&&(Pa=Oe()+500,Rr()))}break;case 13:ys(function(){var i=zi(t,1);if(i!==null){var r=Ct();Zn(i,t,1,r)}}),Ay(t,1)}};ny=function(t){if(t.tag===13){var e=zi(t,134217728);if(e!==null){var n=Ct();Zn(e,t,134217728,n)}Ay(t,134217728)}};Yk=function(t){if(t.tag===13){var e=Er(t),n=zi(t,e);if(n!==null){var i=Ct();Zn(n,t,e,i)}Ay(t,e)}};Qk=function(){return pe};Xk=function(t,e){var n=pe;try{return pe=t,e()}finally{pe=n}};fv=function(t,e,n){switch(e){case"input":if(ov(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var r=yp(i);if(!r)throw Error(P(90));Ck(i),ov(i,r)}}}break;case"textarea":Mk(t,n);break;case"select":e=n.value,e!=null&&ma(t,!!n.multiple,e,!1)}};Ok=$y;Vk=ys;var gN={usingClientEntryPoint:!1,Events:[Fl,la,yp,Nk,Dk,$y]},sl={findFiberByHostInstance:cs,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},vN={bundleType:sl.bundleType,version:sl.version,rendererPackageName:sl.rendererPackageName,rendererConfig:sl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ji.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Uk(t),t===null?null:t.stateNode},findFiberByHostInstance:sl.findFiberByHostInstance||fN,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(al=__REACT_DEVTOOLS_GLOBAL_HOOK__,!al.isDisabled&&al.supportsFiber))try{fp=al.inject(vN),fi=al}catch{}var al;on.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gN;on.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dy(e))throw Error(P(200));return hN(t,e,null,n)};on.createRoot=function(t,e){if(!Dy(t))throw Error(P(299));var n=!1,i="",r=wE;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Iy(t,1,!1,null,null,n,!1,i,r),t[Fi]=e.current,Cl(t.nodeType===8?t.parentNode:t),new Ny(e)};on.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(P(188)):(t=Object.keys(t).join(","),Error(P(268,t)));return t=Uk(e),t=t===null?null:t.stateNode,t};on.flushSync=function(t){return ys(t)};on.hydrate=function(t,e,n){if(!Pp(e))throw Error(P(200));return Cp(null,t,e,!0,n)};on.hydrateRoot=function(t,e,n){if(!Dy(t))throw Error(P(405));var i=n!=null&&n.hydratedSources||null,r=!1,s="",a=wE;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),e=_E(e,null,t,1,n??null,r,!1,s,a),t[Fi]=e.current,Cl(t),i)for(t=0;t<i.length;t++)n=i[t],r=n._getVersion,r=r(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,r]:e.mutableSourceEagerHydrationData.push(n,r);return new Sp(e)};on.render=function(t,e,n){if(!Pp(e))throw Error(P(200));return Cp(null,t,e,!1,n)};on.unmountComponentAtNode=function(t){if(!Pp(t))throw Error(P(40));return t._reactRootContainer?(ys(function(){Cp(null,null,t,!1,function(){t._reactRootContainer=null,t[Fi]=null})}),!0):!1};on.unstable_batchedUpdates=$y;on.unstable_renderSubtreeIntoContainer=function(t,e,n,i){if(!Pp(n))throw Error(P(200));if(t==null||t._reactInternals===void 0)throw Error(P(38));return Cp(t,e,n,!1,i)};on.version="18.2.0-next-9e3b772b8-20220608"});var Ul=pt((Vz,kE)=>{"use strict";function xE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xE)}catch(t){console.error(t)}}xE(),kE.exports=bE()});var jl=pt(Oy=>{"use strict";var TE=Ul();Oy.createRoot=TE.createRoot,Oy.hydrateRoot=TE.hydrateRoot;var Fz});var CE=pt(PE=>{"use strict";var Ma=j();function yN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _N=typeof Object.is=="function"?Object.is:yN,wN=Ma.useState,bN=Ma.useEffect,xN=Ma.useLayoutEffect,kN=Ma.useDebugValue;function TN(t,e){var n=e(),i=wN({inst:{value:n,getSnapshot:e}}),r=i[0].inst,s=i[1];return xN(function(){r.value=n,r.getSnapshot=e,Vy(r)&&s({inst:r})},[t,n,e]),bN(function(){return Vy(r)&&s({inst:r}),t(function(){Vy(r)&&s({inst:r})})},[t]),kN(n),n}function Vy(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_N(t,n)}catch{return!0}}function EN(t,e){return e()}var SN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?EN:TN;PE.useSyncExternalStore=Ma.useSyncExternalStore!==void 0?Ma.useSyncExternalStore:SN});var ME=pt((Hz,$E)=>{"use strict";$E.exports=CE()});var LE=pt(RE=>{"use strict";var Mp=j(),PN=ME();function CN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var $N=typeof Object.is=="function"?Object.is:CN,MN=PN.useSyncExternalStore,RN=Mp.useRef,LN=Mp.useEffect,IN=Mp.useMemo,AN=Mp.useDebugValue;RE.useSyncExternalStoreWithSelector=function(t,e,n,i,r){var s=RN(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=IN(function(){function l(h){if(!c){if(c=!0,u=h,h=i(h),r!==void 0&&a.hasValue){var y=a.value;if(r(y,h))return d=y}return d=h}if(y=d,$N(u,h))return y;var v=i(h);return r!==void 0&&r(y,v)?y:(u=h,d=v)}var c=!1,u,d,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,i,r]);var o=MN(t,s[0],s[1]);return LN(function(){a.hasValue=!0,a.value=o},[o]),AN(o),o}});var AE=pt((Bz,IE)=>{"use strict";IE.exports=LE()});function HN(){Vp=!0,queueMicrotask(ZE)}function ZE(){if(!Ra.length){Vp=!1;return}qy=!0;for(let t=0;t<Ra.length;t++)Ra[t].$st!==Aa&&qN(Ra[t]);Ra=[],Vp=!1,qy=!1}function qN(t){let e=[t];for(;t=t[cn];)t.$e&&t.$st!==Aa&&e.push(t);for(let n=e.length-1;n>=0;n--)i_(e[n])}function JE(t){let e=Rt();return Yl(e,t.length?t.bind(null,Gl.bind(e)):t,null)}function C(t){return Yl(Mt,t,null)}function Na(t){return Yl(null,t,null)}function ti(){qy||ZE()}function Kl(){return Mt}function nt(t,e){try{return Yl(e,t,null)}catch(n){Zy(e,n);return}}function Xy(t,e=Mt){return e?.$cx[t]}function BN(t,e,n=Mt){n&&(n.$cx={...n.$cx,[t]:e})}function WN(t){Mt&&(Mt.$eh=Mt.$eh?[t,...Mt.$eh]:[t])}function G(t){if(!t||!Mt)return t||jN;let e=Mt;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==Up&&(t.call(null),jp(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function Gl(t=!0){if(this.$st===Up)return;let e=t?this.$ps||this[cn]:this,n=this.$ns,i=null;for(;n&&n[cn]===this;)Gl.call(n,!0),BE(n),i=n.$ns,n.$ns=null,n=i;t&&BE(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function BE(t){t.$st=Up,t.$d&&eS(t),t.$s&&Dp(t,0),t.$ps&&(t.$ps.$ns=null),t[cn]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=Qy,t.$eh=null}function eS(t){try{if(Array.isArray(t.$d))for(let e=t.$d.length-1;e>=0;e--){let n=t.$d[e];n.call(n)}else t.$d.call(t.$d);t.$d=null}catch(e){Zy(t,e)}}function Yl(t,e,n){let i=Mt,r=La;Mt=t,La=n;try{return e.call(t)}finally{Mt=i,La=r}}function Zy(t,e){if(!t||!t.$eh)throw e;let n=0,i=t.$eh.length,r=WE(e);for(n=0;n<i;n++)try{t.$eh[n](r);break}catch(s){r=WE(s)}if(n===i)throw r}function WE(t){return t instanceof Error?t:Error(JSON.stringify(t))}function Jy(){return this.$st===Up?this.$v:(La&&!this.$e&&(!Cn&&La.$s&&La.$s[ln]==this?ln++:Cn?Cn.push(this):Cn=[this]),this.$c&&i_(this),this.$v)}function tS(t){let e=jp(t)?t(this.$v):t;if(this.$ch(this.$v,e)&&(this.$v=e,this.$o))for(let n=0;n<this.$o.length;n++)rS(this.$o[n],Wl);return this.$v}function Rt(){return new e_}function n_(t,e,n){return new nS(t,e,n)}function KN(t,e){return t!==e}function jp(t){return typeof t=="function"}function i_(t){if(t.$st===XE)for(let e=0;e<t.$s.length&&(i_(t.$s[e]),t.$st!==Wl);e++);t.$st===Wl?iS(t):t.$st=Aa}function KE(t){t.$ns&&t.$ns[cn]===t&&Gl.call(t,!1),t.$d&&eS(t),t.$eh=t[cn]?t[cn].$eh:null}function iS(t){let e=Cn,n=ln;Cn=null,ln=0;try{KE(t);let i=Yl(t,t.$c,t);if(Cn){if(t.$s&&Dp(t,ln),t.$s&&ln>0){t.$s.length=ln+Cn.length;for(let s=0;s<Cn.length;s++)t.$s[ln+s]=Cn[s]}else t.$s=Cn;let r;for(let s=ln;s<t.$s.length;s++)r=t.$s[s],r.$o?r.$o.push(t):r.$o=[t]}else t.$s&&ln<t.$s.length&&(Dp(t,ln),t.$s.length=ln);!t.$e&&t.$i?tS.call(t,i):(t.$v=i,t.$i=!0)}catch(i){Zy(t,i),t.$st===Wl&&(KE(t),t.$s&&Dp(t,0));return}Cn=e,ln=n,t.$st=Aa}function rS(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===Aa&&(Ra.push(t),Vp||HN()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)rS(t.$o[n],XE)}function Dp(t,e){let n,i;for(let r=e;r<t.$s.length;r++)n=t.$s[r],n.$o&&(i=n.$o.indexOf(t),n.$o[i]=n.$o[n.$o.length-1],n.$o.pop())}function O(t,e){let n=n_(t,null,e),i=Jy.bind(n);return i[cn]=!0,i.set=tS.bind(n),i}function sS(t){return jp(t)&&cn in t}function gi(t,e){let n=n_(e?.initial,t,e),i=Jy.bind(n);return i[cn]=!0,i}function aS(t,e){let n=n_(null,function(){let r=t();return jp(r)&&G(r),null},void 0);return n.$e=!0,iS(n),Gl.bind(n,!0)}function GN(t){let e=()=>t();return e[cn]=!0,e}function r_(t){return sS(t)&&"set"in t}function Kt(...t){}function vi(t){return t===null}function Le(t){return typeof t>"u"}function s_(t){return vi(t)||Le(t)}function Ql(t){return t?.constructor===Object}function Be(t){return typeof t=="number"&&!Number.isNaN(t)}function U(t){return typeof t=="string"}function a_(t){return typeof t=="boolean"}function yt(t){return typeof t=="function"}function qe(t){return Array.isArray(t)}function YN(t){return U(t)?new RegExp(t):t}function QN(t){return Wt?!1:t===window}function XN(t,e){return typeof process<"u",Kt}function Hp(t){return!!t?.[lS]}function JN(t){return t.originEvent}function cS(t,e){if(Hp(t))return t.triggers.walk(e)}function o_(t,e){return Hp(t)?t.triggers.findType(e):void 0}function uS(t,e){return!!o_(t,e)}function dS(t,e){e&&t.triggers.add(e)}function S(t,e,n,i){return Wt?Kt:(t.addEventListener(e,n,i),G(()=>t.removeEventListener(e,n,i)))}function Xl(t){return!!t?.type.startsWith("pointer")}function Da(t){return!!t?.type.startsWith("touch")}function l_(t){return/^(click|mouse)/.test(t?.type??"")}function qi(t){return!!t?.type.startsWith("key")}function e2(t){return qi(t)&&t.key==="Enter"}function t2(t){return qi(t)&&t.key==="Escape"}function Zl(t){return qi(t)&&(t.key==="Enter"||t.key===" ")}function c_(t){return t instanceof Node}function n2(t){return c_(t)&&t.nodeType===1}function i2(t){return c_(t)&&t.nodeType===11}function r2(){return document.createDocumentFragment()}function s2(t){return Wt?t:document.createComment(t)}function J(t,e,n){if(t)if(!n&&n!==""&&n!==0)t.removeAttribute(e);else{let i=n===!0?"":n+"";t.getAttribute(e)!==i&&t.setAttribute(e,i)}else return}function ct(t,e,n){if(t)!n&&n!==0?t.style.removeProperty(e):t.style.setProperty(e,n+"");else return}function a2(t,e,n){t.classList[n?"add":"remove"](e)}function o2(t,e){let n=e?`slot[name="${e}"]`:"slot:not([name])",r=t.shadowRoot?.querySelector(n)?.assignedNodes({flatten:!0})??[];return Array.prototype.filter.call(r,s=>s.nodeType==1)}function l2(t){let e=t.firstChild,n=e.getAttribute("shadowroot");e.parentNode.attachShadow({mode:n}).appendChild(e.content),e.remove()}function c2(t){return yt(t)?t():t}function By(t){let e=t;for(;typeof e=="function";)e=e.call(this);return e}function yi(t){return{id:Symbol(),provide:t}}function It(t,e,n=Kl()){let i=!Le(e);BN(t.id,i?e:t.provide?.(),n)}function Ie(t){return Xy(t.id)}function $n(t){return!Le(Xy(t.id))}function u2(t){let e={};for(let n of Object.keys(t)){let i=t[n];e[n]=O(i,i)}return e}function u_(t,e){return JE(()=>{Bl.$$=new zp(t,Kl(),e);let n=new t;return Bl.$$.e=n,Bl.$$=null,n})}function te(t,e,n){t[Uy]||(t[Uy]=new Set),t[Uy].add(e)}function Ae(t,e,n){t[jy]||(t[jy]=new Set),t[jy].add(e)}function xs(t){return Ie(t)}function Oa(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function d2(t){return Jl(t.replace(/([A-Z])/g," $1"))}function Bp(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function hS(t){return fS(t).replace(/\s/g,"")}function fS(t){return Jl(t.replace(/-./g,e=>" "+e[1].toUpperCase()))}function Jl(t){return t.charAt(0).toUpperCase()+t.slice(1)}function p2(t){return t.charAt(0).toLowerCase()+t.slice(1)}function f2(t){return t.replace(h2,"")}function Wp(t,...e){return ue.createElement(ks.Provider,{value:t},...e)}function Kp(){return ue.useContext(ks).current}function Gp(t){let e=Kp();return ue.useMemo(()=>Xy(t.id,e),[e])}function m2(){return gS}function g2(t,e){var n;return n=class extends gS{},n.F=t,n.T=e,n}function d_(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function re(...t){return e=>t.forEach(n=>d_(n,e))}function v2(t,e){let n=ue.forwardRef((i,r)=>{let s=ue.useContext(ks),a=ue.useRef(null),o=ue.useRef();if(!o.current){let w=_2(),m=QE(t,w,i,s.current);w.e=m,o.current=w,a.current=m.scope}function l(){let w=o.current,m=s.current;if(window.cancelAnimationFrame(w.ea),w.ea=-1,w.e.$$.o){let f=QE(t,w,i,m);w.e=f,w.Q=!1,w.da=!1,a.current=f.scope}return w.a&&YE(w,w.a),w.da||(d_(r,w.e),w.da=!0),()=>Op(w)}function c(w){let m=o.current;if(!m.da){m.a=w;return}window.cancelAnimationFrame(m.K),m.K=window.requestAnimationFrame(()=>{let f=o.current;f.K=-1,f.a!==w&&(Op(f),w&&YE(f,w),f.a=w)})}ue.useEffect(()=>{let w=o.current;return window.cancelAnimationFrame(w.ea),w.ea=-1,function(){yt(i.children)&&(window.cancelAnimationFrame(w.K),w.K=-1,window.cancelAnimationFrame(w.E),w.E=-1,window.cancelAnimationFrame(w.ea),w.ea=window.requestAnimationFrame(()=>{w.ea=-1,Op(w),w.e.$$.p(),w.e.$$[qp]=null,w.J={},w._={},a.current=null}))}},[]),ue.useEffect(ti);let u=o.current,{children:d,...p}=i,h={},y=u.aa,v=Object.keys(p);u.J={};for(let w of[...y,...v])if(e.props.has(w))u.e.$props[w].set(v.includes(w)?p[w]:t.props?.[w]);else if(e.events?.has(w)||e.eventsRE?.test(w))u.J[w]=p[w];else if(e.domEvents?.has(w)||e.domEventsRE?.test(w)){let m=Oa(w.slice(2));u._[m]=p[w],v.includes(w)?u.a&&!u.ca?.has(m)&&(u.ca||(u.ca=new Set),u.ca.add(m),u.a.addEventListener(m,u.ba)):(u.a?.removeEventListener(m,u.ba),u.ca?.delete(m))}else h[w]=p[w];return u.aa=v,Wp(a,ue.createElement(y2,{effect:l}),yt(d)?d?.({...h,suppressHydrationWarning:!0,ref:c},u.e):d)});return n.displayName=t.name+"Bridge",n}function y2({effect:t}){return ue.useEffect(t,[]),null}function _2(){let t={a:null,aa:[],J:{},_:{},K:-1,E:-1,ea:-1,Q:!1,da:!1,ca:null,ba(e){let n=Le(e.detail)?[e]:[e.detail,e];t._[e.type]?.(...n)}};return t}function YE(t,e){if(!(t.a===e&&t.Q)){if(t.Q&&Op(t),t._){t.ca||(t.ca=new Set);for(let n of Object.keys(t._))t.ca.has(n)||(e.addEventListener(n,t.ba),t.ca.add(n))}t.e.$$.x(e),t.E=window.requestAnimationFrame(()=>{t.e.$$.y(),t.E=-1}),t.Q=!0}}function Op(t){if(t.Q&&(window.cancelAnimationFrame(t.E),t.E=-1,t.e.$$.s(),t.Q=!1,t.a&&t.ca)){for(let e of t.ca)t.a.removeEventListener(e,t.ba);t.ca.clear()}}function w2(t){let e=GE.get(t.type),n=Le(t.detail)?[t]:[t.detail,t];e||GE.set(t.type,e=`on${hS(t.type)}`),this.J[e]?.(...n)}function QE(t,e,n,i){let r=u_(t,{props:n,scope:i});return r.$$[qp]=w2.bind(e),r.$$.w(),r}function vS(t,e=!1){let n=typeof t;if(n!=="string")return!e&&n==="function"?vS(t()):e&&n==="boolean"?t+"":t;let i=e?'"':"<",r=e?"&quot;":"&lt;",s=t.indexOf(i),a=t.indexOf("&");if(s<0&&a<0)return t;let o=0,l="";for(;s>=0&&a>=0;)s<a?(o<s&&(l+=t.substring(o,s)),l+=r,o=s+1,s=t.indexOf(i,o)):(o<a&&(l+=t.substring(o,a)),l+="&amp;",o=a+1,a=t.indexOf("&",o));if(s>=0)do o<s&&(l+=t.substring(o,s)),l+=r,o=s+1,s=t.indexOf(i,o);while(s>=0);else for(;a>=0;)o<a&&(l+=t.substring(o,a)),l+="&amp;",o=a+1,a=t.indexOf("&",o);return o<t.length?l+t.substring(o):l}function k2(t,e){let n=e.trim().split(x2);for(let i of n)t.add(i)}function S2(t,e){let n=e.trim().split(E2);for(let i=0;i<n.length;i++){if(n[i]==="")continue;let[r,s]=n[i].split(T2);t.set(r,s)}}function C2(t,e){function n(i){let r=ue.useContext(ks),s=u_(t,{props:i,scope:r.current}),a=new Wy(s),o={},{style:l={},children:c,forwardRef:u,...d}=i;if(e.props.size)for(let p of Object.keys(d))e.props.has(p)||(o[p]=d[p]);else o=d;if(a.setup(),a.hasAttribute("style")){for(let[p,h]of a.style.tokens)l[p.startsWith("--")?p:Bp(p)]=h;a.removeAttribute("style")}for(let[p,h]of a.attributes.tokens){let y=P2[p];y&&(y in o||(o[y]=h),a.removeAttribute(p))}return Wp({current:s.$$.d},yt(c)?c?.({...Object.fromEntries(a.attributes.tokens),...o,style:l},s):c,ue.createElement(()=>(a.destroy(),null)))}return n.displayName=t.name+"Bridge",n}function Lr(t){return Gp(t)}function he(t,e){let[,n]=ue.useState();return ue.useEffect(()=>aS(()=>{t(),n({})}),[e??t]),t()}function Va(t){return t?"true":"false"}function yS(t){let e=[];for(let n=0;n<t.length;n++)qe(t[n])?e.push(...yS(t[n])):(t[n]||t[n]===0)&&e.push(t[n]);return e}function ec(){let t=new Set;return{add(...e){for(let n of e)t.add(n)},empty(){for(let e of t)e();t.clear()}}}function p_(){let t=ec();return G(t.empty),t}function $2(t){return t()}function M2(t,e){for(let n of t)n(e)}function tc(t){return Object.keys(t)}function R2(...t){let e={};for(let n=0;n<t.length;n++){let i=t[n];i&&Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}return e}function _S(t,e){let n={};for(let i of e)Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i));return n}function L2(t,e){return _S(t,tc(t).filter(n=>!e.includes(n)))}function Bi(){let t,e;return{promise:new Promise((i,r)=>{t=i,e=r}),resolve:t,reject:e}}function I2(t,e,n){let i=new Promise((r,s)=>{let a=setTimeout(()=>{clearTimeout(a),s(n)},e)});return Promise.race([t,i])}function h_(t){return new Promise(e=>setTimeout(e,t))}function A2(t){return Wt?Promise.resolve():new Promise(e=>{window.requestAnimationFrame(n=>{t?.(n),e()})})}function Ir(t){if(Wt)return Kt;let e=-1,n;function i(...r){n=r,!(e>=0)&&(e=window.requestAnimationFrame(()=>{t.apply(this,n),e=-1,n=void 0}))}return i}function f_(t,e){return Wt?Promise.resolve():new Promise(n=>{N2(i=>{t?.(i),n()},e)})}function m_(t){let[,e]=ue.useState(),n=ue.useRef(null);return n.current==null&&(n.current={state:{},$update:O({}),props:new Set}),ue.useEffect(()=>{let{state:i,$update:r,props:s}=n.current;return b(()=>{for(let a of s){let o=t[a]();i[a]=qe(o)?[...o]:o}r(),e({})})},[t]),ue.useMemo(()=>{let{state:i,$update:r,props:s}=n.current,a=!1;return s.clear(),new Proxy(i,{get(o,l){if(!s.has(l)&&l in t){s.add(l);let c=t[l]();i[l]=qe(c)?[...c]:c,a||(r.set({}),a=!0,queueMicrotask(()=>a=!1))}return i[l]},set(o,l,c){return l in t||(i[l]=c),!0}})},[t])}function X(t,e){return Wt?C2(t,{props:new Set(Object.keys(t.props||{}))}):v2(t,{props:new Set(Object.keys(t.props||{})),events:new Set(e?.events),eventsRE:e?.eventsRegex,domEvents:e?.domEvents,domEventsRE:e?.domEventsRegex})}var ue,Wt,cn,Vp,qy,Mt,La,Cn,ln,Ra,Qy,jN,Aa,XE,Wl,Up,e_,bs,nS,t_,b,oS,ZN,lS,q,Fp,Ia,Uy,jy,qp,pS,Hy,zp,Bl,Lt,B,ei,h2,ks,mS,gS,GE,b2,x2,T2,E2,Wy,Ky,Gy,Yy,P2,N2,Ts,At=Ue(()=>{"use strict";"use client";ue=$(j(),1),Wt=typeof document>"u",cn=Symbol(0),Vp=!1,qy=!1,Mt=null,La=null,Cn=null,ln=0,Ra=[],Qy={},jN=()=>{},Aa=0,XE=1,Wl=2,Up=3;e_=function(){this[cn]=null,this.$ns=null,this.$ps=null,Mt&&Mt.append(this)},bs=e_.prototype;bs.$cx=Qy;bs.$eh=null;bs.$c=null;bs.$d=null;bs.append=function(t){if(t[cn]=this,t.$ps=this,this.$ns)if(t.$ns){let e=t.$ns;for(;e.$ns;)e=e.$ns;e.$ns=this.$ns,this.$ns.$ps=e}else t.$ns=this.$ns,this.$ns.$ps=t;this.$ns=t,t.$cx=t.$cx===Qy?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};bs.dispose=function(){Gl.call(this)};nS=function(e,n,i){e_.call(this),this.$st=n?Wl:Aa,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,n&&(this.$c=n),i&&i.dirty&&(this.$ch=i.dirty)},t_=nS.prototype;Object.setPrototypeOf(t_,bs);t_.$ch=KN;t_.call=Jy;b=Wt?XN:aS;ZN=Wt?class{}:Event,lS=Symbol("DOM_EVENT"),q=class extends ZN{constructor(e,...n){super(e,n[0]),this[oS]=!0,this.triggers=new Fp,this.detail=n[0]?.detail;let i=n[0]?.trigger;i&&this.triggers.add(i)}get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){return this.triggers.origin?.isTrusted??!1}};oS=lS;Fp=class{constructor(){this.chain=[]}get source(){return this.chain[0]}get origin(){return this.chain[this.chain.length-1]}add(e){this.chain.push(e),Hp(e)&&this.chain.push(...e.triggers)}remove(e){return this.chain.splice(this.chain.indexOf(e),1)[0]}has(e){return this.chain.some(n=>n===e)}hasType(e){return!!this.findType(e)}findType(e){return this.chain.find(n=>n.type===e)}walk(e){for(let n of this.chain){let i=e(n);if(i)return[n,i]}}[Symbol.iterator](){return this.chain.values()}};Ia=class extends EventTarget{addEventListener(e,n,i){return super.addEventListener(e,n,i)}removeEventListener(e,n,i){return super.removeEventListener(e,n,i)}};Uy=Symbol(0),jy=Symbol(0),qp=Symbol(0),Hy={},zp=class{constructor(e,n,i){this[pS]=null,this.$el=O(null),this.a=null,this.d=null,this.f=null,this.g=null,this.e=null,this.o=!1,this.i=Hy,this.b=null,this.c=null,this.l=[],this.m=[],this.j=[],this.n=[],this.d=n,i?.scope&&i.scope.append(n);let r=e.state,s=e.props;if(r&&(this.h=r.create(),this.k=new Proxy(this.h,{get:(a,o)=>this.h[o]()}),It(r,this.h)),s&&(this.i=u2(s),i?.props))for(let a of Object.keys(i.props))this.i[a]?.set(i.props[a]);G(this.p.bind(this))}w(){nt(()=>{for(let e of this.l)e()},this.d)}x(e){this.a||(this.a=e,this.$el.set(e),nt(()=>{this.f=Rt(),nt(()=>{for(let n of this.m)n(this.a);this.q(),this.r()},this.f)},this.d),e.dispatchEvent(new Event("attached")))}s(){this.f?.dispose(),this.f=null,this.g=null,this.a=null,this.$el.set(null)}y(){!this.a||!this.f||!this.j.length||nt(()=>{this.g=Rt(),nt(()=>{for(let e of this.j)e(this.a)},this.g)},this.f)}z(){this.g?.dispose(),this.g=null}p(){if(this.o)return;this.o=!0,nt(()=>{for(let n of this.n)n(this.a)},this.d);let e=this.a;this.s(),this.d.dispose(),this.l.length=0,this.m.length=0,this.j.length=0,this.n.length=0,this.e=null,this.b=null,this.c=null,this.i=Hy,this.d=null,this.k=Hy,this.h=null,e&&delete e.$}t(e){e.onSetup&&this.l.push(e.onSetup.bind(e)),e.onAttach&&this.m.push(e.onAttach.bind(e)),e.onConnect&&this.j.push(e.onConnect.bind(e)),e.onDestroy&&this.n.push(e.onDestroy.bind(e))}q(){if(this.b)for(let e of Object.keys(this.b))Wt?J(this.a,e,By.call(this.e,this.b[e])):yt(this.b[e])?b(this.u.bind(this,e)):J(this.a,e,this.b[e])}r(){if(this.c)for(let e of Object.keys(this.c))Wt?ct(this.a,e,By.call(this.e,this.c[e])):yt(this.c[e])?b(this.v.bind(this,e)):ct(this.a,e,this.c[e])}u(e){J(this.a,e,this.b[e].call(this.e))}v(e){ct(this.a,e,this.c[e].call(this.e))}};pS=qp;Bl={$$:null};Lt=class extends EventTarget{constructor(){super(),Bl.$$&&this.attach(Bl)}get el(){return this.$$.a}get $el(){return this.$$.$el()}get scope(){return this.$$.d}get attachScope(){return this.$$.f}get connectScope(){return this.$$.g}get $props(){return this.$$.i}get $state(){return this.$$.h}get state(){return this.$$.k}attach({$$:e}){return this.$$=e,e.t(this),this}addEventListener(e,n,i){this.listen(e,n,i)}removeEventListener(e,n,i){this.el?.removeEventListener(e,n,i)}setAttributes(e){this.$$.b||(this.$$.b={}),Object.assign(this.$$.b,e)}setStyles(e){this.$$.c||(this.$$.c={}),Object.assign(this.$$.c,e)}setCSSVars(e){this.setStyles(e)}createEvent(e,...n){return new q(e,n[0])}dispatch(e,...n){if(Wt||!this.el)return!1;let i=e instanceof Event?e:new q(e,n[0]);return Object.defineProperty(i,"target",{get:()=>this.$$.e}),Na(()=>(this.$$[qp]?.(i),this.el.dispatchEvent(i)))}dispatchEvent(e){return this.dispatch(e)}listen(e,n,i){return Wt||!this.el?Kt:S(this.el,e,n,i)}},B=class extends Lt{subscribe(e){return nt(()=>b(()=>e(this.state)),this.$$.d)}destroy(){this.$$.p()}};ei=class{constructor(e){this.id=Symbol(0),this.record=e,this.A=Object.getOwnPropertyDescriptors(e)}create(){let e={},n=new Proxy(e,{get:(i,r)=>e[r]()});for(let i of Object.keys(this.record)){let r=this.A[i].get;e[i]=r?gi(r.bind(n)):O(this.record[i])}return e}reset(e,n){for(let i of Object.keys(e))!this.A[i].get&&(!n||n(i))&&e[i].set(this.record[i])}};h2=/;\s*$/;ks=ue.createContext({current:null});ks.displayName="Scope";mS=class extends ue.Component{constructor(e,n){super(e),this.d={current:Rt()},n&&n.append(this.d.current);let i=this.constructor;i.F&&It(i.F,i.T?.(),this.d.current)}render(){return Wp(this.d,this.props?.children)}};mS.contextType=ks;gS=mS;GE=new Map;b2=Symbol(0),x2=/\s+/;T2=/\s*:\s*/,E2=/\s*;\s*/;Wy=class{constructor(e){this.keepAlive=!1,this.forwardKeepAlive=!0,this.attributes=new Ky,this.style=new Gy,this.classList=new Yy,this.$=e}get $props(){return this.$.$$.i}get $state(){return this.$.$$.h}get state(){return this.$.state}setup(){let e=this.$.$$;nt(()=>{this.hasAttribute("class")&&k2(this.classList.tokens,this.getAttribute("class")),this.hasAttribute("style")&&S2(this.style.tokens,this.getAttribute("style")),e.w(),e.x(this),this.classList.length>0&&this.setAttribute("class",this.classList.toString()),this.style.length>0&&this.setAttribute("style",this.style.toString()),this.keepAlive&&this.setAttribute("keep-alive","")},e.d)}getAttribute(e){return this.attributes.getAttribute(e)}setAttribute(e,n){this.attributes.setAttribute(e,n)}hasAttribute(e){return this.attributes.hasAttribute(e)}removeAttribute(e){return this.attributes.removeAttribute(e)}[b2](){}addEventListener(){}removeEventListener(){}dispatchEvent(){return!1}subscribe(){return Kt}destroy(){this.$.destroy()}},Ky=class{constructor(){this.Z=new Map}get length(){return this.Z.size}get tokens(){return this.Z}getAttribute(e){return this.Z.get(e)??null}hasAttribute(e){return this.Z.has(e)}setAttribute(e,n){this.Z.set(e,n+"")}removeAttribute(e){this.Z.delete(e)}toString(){if(this.Z.size===0)return"";let e="";for(let[n,i]of this.Z)e+=` ${n}="${vS(i,!0)}"`;return e}},Gy=class{constructor(){this.Z=new Map}get length(){return this.Z.size}get tokens(){return this.Z}getPropertyValue(e){return this.Z.get(e)??""}setProperty(e,n){this.Z.set(e,n??"")}removeProperty(e){let n=this.Z.get(e);return this.Z.delete(e),n??""}toString(){if(this.Z.size===0)return"";let e="";for(let[n,i]of this.Z)e+=`${n}: ${i};`;return e}},Yy=class{constructor(){this.Z=new Set}get length(){return this.Z.size}get tokens(){return this.Z}add(...e){for(let n of e)this.Z.add(n)}contains(e){return this.Z.has(e)}remove(e){this.Z.delete(e)}replace(e,n){return this.Z.has(e)?(this.Z.delete(e),this.Z.add(n),!0):!1}toggle(e,n){return n!==!0&&(this.Z.has(e)||n===!1)?(this.Z.delete(e),!1):(this.Z.add(e),!0)}toString(){return Array.from(this.Z).join(" ")}},P2={acceptcharset:"acceptCharset","accept-charset":"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autocorrect:"autoCorrect",autofocus:"autoFocus",autoplay:"autoPlay",autosave:"autoSave",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classID",classname:"className",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",controlslist:"controlsList",crossorigin:"crossOrigin",dangerouslysetinnerhtml:"dangerouslySetInnerHTML",datetime:"dateTime",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback",enctype:"encType",enterkeyhint:"enterKeyHint",fetchpriority:"fetchPriority",for:"htmlFor",formmethod:"formMethod",formaction:"formAction",formenctype:"formEncType",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",htmlfor:"htmlFor",httpequiv:"httpEquiv","http-equiv":"httpEquiv",imagesizes:"imageSizes",imagesrcset:"imageSrcSet",innerhtml:"innerHTML",inputmode:"inputMode",itemid:"itemID",itemprop:"itemProp",itemref:"itemRef",itemscope:"itemScope",itemtype:"itemType",keyparams:"keyParams",keytype:"keyType",marginwidth:"marginWidth",marginheight:"marginHeight",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",nomodule:"noModule",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"};N2=Wt?Kt:typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):Kt;Ts=Object.freeze({__proto__:null,Component:B,DOMEvent:q,EventTriggers:Fp,EventsTarget:Ia,Instance:zp,ReactScopeContext:ks,State:ei,ViewController:Lt,WithScope:Wp,animationFrameThrottle:Ir,appendTriggerEvent:dS,ariaBool:Va,attachDeclarativeShadowDOM:l2,camelToKebabCase:Oa,camelToTitleCase:d2,composeRefs:re,computed:gi,createComment:s2,createComponent:u_,createContext:yi,createDisposalBin:ec,createFragment:r2,createReactComponent:X,createReactContextProvider:g2,createReactScopeProvider:m2,createRegex:YN,createScope:Rt,deferredPromise:Bi,effect:b,findTriggerEvent:o_,flattenArray:yS,getOriginEvent:JN,getScope:Kl,getSlottedChildren:o2,hasProvidedContext:$n,hasTriggerEvent:uS,isArray:qe,isBoolean:a_,isDOMElement:n2,isDOMEvent:Hp,isDOMFragment:i2,isDOMNode:c_,isFunction:yt,isKeyboardClick:Zl,isKeyboardEvent:qi,isMouseEvent:l_,isNil:s_,isNull:vi,isNumber:Be,isObject:Ql,isPointerEvent:Xl,isReadSignal:sS,isString:U,isTouchEvent:Da,isUndefined:Le,isWindow:QN,isWriteSignal:r_,kebabToCamelCase:Bp,kebabToPascalCase:hS,kebabToTitleCase:fS,keysOf:tc,listenEvent:S,lowercaseFirstLetter:p2,mergeProperties:R2,method:Ae,noop:Kt,omit:L2,onDispose:G,onError:WN,peek:C,pick:_S,prop:te,provideContext:It,readonly:GN,root:JE,run:$2,runAll:M2,scoped:nt,setAttribute:J,setRef:d_,setStyle:ct,signal:O,tick:ti,timedPromise:I2,toggleClass:a2,trimTrailingSemicolon:f2,untrack:Na,unwrap:c2,unwrapDeep:By,uppercaseFirstChar:Jl,useContext:Ie,useDisposalBin:p_,useReactContext:Gp,useReactScope:Kp,useSignal:he,useSignalRecord:m_,useState:xs,useStateContext:Lr,waitAnimationFrame:A2,waitIdlePeriod:f_,waitTimeout:h_,walkTriggerEventChain:cS,wasEnterKeyPressed:e2,wasEscapeKeyPressed:t2})});var wS={};kt(wS,{SRTParser:()=>Yp,default:()=>V2});function V2(){return new Yp}var D2,O2,Yp,bS=Ue(()=>{"use strict";nc();D2=/,/g,O2="-->",Yp=class extends za{parse(e,n){if(e==="")this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null),this.c=Fa.None;else if(this.c===Fa.Cue)this.a.text+=(this.a.text?`
`:"")+e;else if(e.includes(O2)){let i=this.o(e,n);i&&(this.a=new Wi(i[0],i[1],i[2].join(" ")),this.a.id=this.l,this.c=Fa.Cue)}this.l=e}o(e,n){return super.o(e.replace(D2,"."),n)}}});var g_={};kt(g_,{ParseErrorBuilder:()=>F2});var F2,v_=Ue(()=>{"use strict";nc();F2={p(){return new Gt({code:Mn.BadSignature,reason:"missing WEBVTT file header",line:1})},q(t,e){return new Gt({code:Mn.BadTimestamp,reason:`cue start timestamp \`${t}\` is invalid on line ${e}`,line:e})},r(t,e){return new Gt({code:Mn.BadTimestamp,reason:`cue end timestamp \`${t}\` is invalid on line ${e}`,line:e})},s(t,e,n){return new Gt({code:Mn.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${t}\` on line ${n}`,line:n})},w(t,e,n){return new Gt({code:Mn.BadSettingValue,reason:`invalid value for cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},v(t,e,n){return new Gt({code:Mn.UnknownSetting,reason:`unknown cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},u(t,e,n){return new Gt({code:Mn.BadSettingValue,reason:`invalid value for region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},t(t,e,n){return new Gt({code:Mn.UnknownSetting,reason:`unknown region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},T(t,e){return new Gt({code:Mn.BadFormat,reason:`format missing for \`${t}\` block on line ${e}`,line:e})}}});var PS={};kt(PS,{SSAParser:()=>Zp,default:()=>z2});function __(t){let e=parseInt(t.replace("&H",""),16);if(e>=0){let i=(e>>24&255^255)/255,r=e>>16&255,s=e>>8&255;return"rgba("+[e&255,s,r,i].join(",")+")"}return null}function w_(t,e,n){let i=Math.ceil(2*Math.PI*t),r="";for(let s=0;s<i;s++){let a=2*Math.PI*s/i;r+=t*Math.cos(a)+"px "+e*Math.sin(a)+"px 0 "+n+(s==i-1?"":",")}return r}function z2(){return new Zp}var Qp,xS,kS,Xp,TS,ES,SS,y_,Zp,CS=Ue(()=>{"use strict";nc();Qp=/^Format:[\s\t]*/,xS=/^Style:[\s\t]*/,kS=/^Dialogue:[\s\t]*/,Xp=/[\s\t]*,[\s\t]*/,TS=/\{[^}]+\}/g,ES=/\\N/g,SS=/^\[(.*)[\s\t]?Styles\]$/,y_=/^\[(.*)[\s\t]?Events\]$/,Zp=class{constructor(){_(this,"f");_(this,"O",0);_(this,"a",null);_(this,"j",[]);_(this,"k",[]);_(this,"N",null);_(this,"d");_(this,"P",{})}async init(e){this.f=e,e.errors&&(this.d=(await Promise.resolve().then(()=>(v_(),g_))).ParseErrorBuilder)}parse(e,n){if(this.O)switch(this.O){case 1:if(e==="")this.O=0;else if(xS.test(e))if(this.N){let i=e.replace(xS,"").split(Xp);this.S(i)}else this.e(this.d?.T("Style",n));else Qp.test(e)?this.N=e.replace(Qp,"").split(Xp):y_.test(e)&&(this.N=null,this.O=2);break;case 2:if(e==="")this.Q();else if(kS.test(e))if(this.Q(),this.N){let i=e.replace(kS,"").split(Xp),r=this.U(i,n);r&&(this.a=r)}else this.e(this.d?.T("Dialogue",n));else this.a?this.a.text+=`
`+e.replace(TS,"").replace(ES,`
`):Qp.test(e)?this.N=e.replace(Qp,"").split(Xp):SS.test(e)?(this.N=null,this.O=1):y_.test(e)&&(this.N=null)}else e===""||(SS.test(e)?(this.N=null,this.O=1):y_.test(e)&&(this.N=null,this.O=2))}done(){return{metadata:{},cues:this.j,regions:[],errors:this.k}}Q(){this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null)}S(e){let n="Default",i={},r,s="center",a="bottom",o,l=1.2,c,u,d=3,p=[];for(let h=0;h<this.N.length;h++){let y=this.N[h],v=e[h];switch(y){case"Name":n=v;break;case"Fontname":i["font-family"]=v;break;case"Fontsize":i["font-size"]=`calc(${v} / var(--overlay-height))`;break;case"PrimaryColour":let w=__(v);w&&(i["--cue-color"]=w);break;case"BorderStyle":d=parseInt(v,10);break;case"BackColour":u=__(v);break;case"OutlineColour":let m=__(v);m&&(c=m);break;case"Bold":parseInt(v)&&(i["font-weight"]="bold");break;case"Italic":parseInt(v)&&(i["font-style"]="italic");break;case"Underline":parseInt(v)&&(i["text-decoration"]="underline");break;case"StrikeOut":parseInt(v)&&(i["text-decoration"]="line-through");break;case"Spacing":i["letter-spacing"]=v+"px";break;case"AlphaLevel":i.opacity=parseFloat(v);break;case"ScaleX":p.push(`scaleX(${parseFloat(v)/100})`);break;case"ScaleY":p.push(`scaleY(${parseFloat(v)/100})`);break;case"Angle":p.push(`rotate(${v}deg)`);break;case"Shadow":l=parseInt(v,10)*1.2;break;case"MarginL":i["--cue-width"]="auto",i["--cue-left"]=parseFloat(v)+"px";break;case"MarginR":i["--cue-width"]="auto",i["--cue-right"]=parseFloat(v)+"px";break;case"MarginV":o=parseFloat(v);break;case"Outline":r=parseInt(v,10);break;case"Alignment":let f=parseInt(v,10);switch(f>=4&&(a=f>=7?"top":"center"),f%3){case 1:s="start";break;case 2:s="center";break;case 3:s="end";break}}}if(i.R=a,i["--cue-white-space"]="normal",i["--cue-line-height"]="normal",i["--cue-text-align"]=s,a==="center"?(i["--cue-top"]="50%",p.push("translateY(-50%)")):i[`--cue-${a}`]=(o||0)+"px",d===1&&(i["--cue-padding-y"]="0"),(d===1||u)&&(i["--cue-bg-color"]=d===1?"none":u),d===3&&c&&(i["--cue-outline"]=`${r}px solid ${c}`),d===1&&typeof r=="number"){let h=u??"#000";i["--cue-text-shadow"]=[c&&w_(r*1.2,l*1.2,c),c?w_(r*(r/2),l*(r/2),h):w_(r,l,h)].filter(Boolean).join(", ")}p.length&&(i["--cue-transform"]=p.join(" ")),this.P[n]=i}U(e,n){let i=this.V(e),r=this.o(i.Start,i.End,n);if(!r)return;let s=new Wi(r[0],r[1],""),a={...this.P[i.Style]||{}},o=i.Name?`<v ${i.Name}>`:"",l=a.R,c=i.MarginL&&parseFloat(i.MarginL),u=i.MarginR&&parseFloat(i.MarginR),d=i.MarginV&&parseFloat(i.MarginV);return c&&(a["--cue-width"]="auto",a["--cue-left"]=c+"px"),u&&(a["--cue-width"]="auto",a["--cue-right"]=u+"px"),d&&l!=="center"&&(a[`--cue-${l}`]=d+"px"),s.text=o+e.slice(this.N.length-1).join(", ").replace(TS,"").replace(ES,`
`),delete a.R,Object.keys(a).length&&(s.style=a),s}V(e){let n={};for(let i=0;i<this.N.length;i++)n[this.N[i]]=e[i];return n}o(e,n,i){let r=Ki(e),s=Ki(n);if(r!==null&&s!==null&&s>r)return[r,s];r===null&&this.e(this.d?.q(e,i)),s===null&&this.e(this.d?.r(n,i)),r!=null&&s!==null&&s>r&&this.e(this.d?.s(r,s,i))}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}}});async function AS(t,e){let n=new ReadableStream({start(i){let r=t.split(IS);for(let s of r)i.enqueue(s);i.close()}});return nh(n,e)}async function nh(t,e){let n=e?.type??"vtt",i;if(typeof n=="string")switch(n){case"srt":i=(await Promise.resolve().then(()=>(bS(),wS))).default;break;case"ssa":case"ass":i=(await Promise.resolve().then(()=>(CS(),PS))).default;break;default:i=(await Promise.resolve().then(function(){return rD})).default}else i=n;let r,s=t.getReader(),a=i(),o=!!e?.strict||!!e?.errors;await a.init({strict:!1,...e,errors:o,type:n,cancel(){s.cancel(),r=a.done(!0)}});let l=1;for(;;){let{value:c,done:u}=await s.read();if(u){a.parse("",l),r=a.done(!1);break}a.parse(c,l),l++}return r}async function NS(t,e){let n=await t;if(!n.ok||!n.body)return{metadata:{},cues:[],regions:[],errors:[void 0]};let i=n.headers.get("content-type")||"",r=i.match(/text\/(.*?)(?:;|$)/)?.[1],s=i.match(/charset=(.*?)(?:;|$)/)?.[1];return T_(n.body,{type:r,encoding:s,...e})}async function T_(t,{encoding:e="utf-8",...n}={}){let i=t.pipeThrough(new x_(e));return nh(i,n)}function H2(t){let e=parseInt(t,10);return Number.isNaN(e)?null:e}function rc(t){let e=parseInt(t.replace(j2,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function MS(t){if(!t.includes($S))return null;let[e,n]=t.split($S).map(rc);return e!==null&&n!==null?[e,n]:null}function q2(t){let e=parseFloat(t);return Number.isNaN(e)?null:e}function Ki(t){let e=t.match(nD);if(!e)return null;let n=e[1]?parseInt(e[1],10):0,i=parseInt(e[2],10),r=parseInt(e[3],10),s=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,a=n*3600+i*60+r+s/1e3;return n<0||i<0||r<0||s<0||i>59||r>59?null:a}function iD(){return new za}function S_(t){let e="",n=1,i=[],r=[],s;for(let c=0;c<t.text.length;c++){let u=t.text[c];switch(n){case 1:u==="<"?(l(),n=2):e+=u;break;case 2:switch(u){case`
`:case" ":case" ":a(),n=4;break;case".":a(),n=3;break;case"/":n=5;break;case">":a(),n=1;break;default:!e&&sD.test(u)&&(n=6),e+=u;break}break;case 3:switch(u){case" ":case" ":case`
`:o(),s&&s.class?.trim(),n=4;break;case".":o();break;case">":o(),s&&s.class?.trim(),n=1;break;default:e+=u}break;case 4:u===">"?(e=e.replace(aD," "),s?.type==="v"?s.voice=b_(e):s?.type==="lang"&&(s.lang=b_(e)),e="",n=1):e+=u;break;case 5:u===">"&&(e="",s=r.pop(),n=1);break;case 6:if(u===">"){let d=Ki(e);d!==null&&d>=t.startTime&&d<=t.endTime&&(e="timestamp",a(),s.time=d),e="",n=1}else e+=u;break}}function a(){if(uD.has(e)){let c=s;s=dD(e),c?(r[r.length-1]!==c&&r.push(c),c.children.push(s)):i.push(s)}e="",n=1}function o(){if(s&&e){let c=e.replace("bg_","");cD.has(c)?s[e.startsWith("bg_")?"bgColor":"color"]=c:s.class=s.class?s.class+" "+e:e}e=""}function l(){if(!e)return;let c={type:"text",data:b_(e)};s?s.children.push(c):i.push(c),e=""}return n===1&&l(),i}function dD(t){return{tagName:DS[t],type:t,children:[]}}function b_(t){return t.replace(lD,e=>oD[e]||"'")}function Nt(t,e,n){t.style.setProperty(`--${e}`,n+"")}function Ar(t,e,n=!0){t.setAttribute(`data-${e}`,n===!0?"":n+"")}function Jp(t,e){t.setAttribute("data-part",e)}function pD(t){return parseFloat(getComputedStyle(t).lineHeight)||0}function OS(t){if(E_)throw Error("[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`");let e=document.createElement("template");return e.innerHTML=ih(t),{cue:t,content:e.content}}function ih(t,e=0){return rh(S_(t),e)}function rh(t,e=0){let n,i="";for(let r of t)if(r.type==="text")i+=r.data;else{let s=r.type==="timestamp";n={},n.class=r.class,n.title=r.type==="v"&&r.voice,n.lang=r.type==="lang"&&r.lang,n["data-part"]=r.type==="v"&&"voice",s&&(n["data-part"]="timed",n["data-time"]=r.time,n["data-future"]=r.time>e,n["data-past"]=r.time<e),n.style=`${r.color?`color: ${r.color};`:""}${r.bgColor?`background-color: ${r.bgColor};`:""}`;let a=Object.entries(n).filter(o=>o[1]).map(o=>`${o[0]}="${o[1]===!0?"":o[1]}"`).join(" ");i+=`<${r.tagName}${a?" "+a:""}>${rh(r.children)}</${r.tagName}>`}return i}function P_(t,e){if(!E_)for(let n of t.querySelectorAll('[data-part="timed"]')){let i=Number(n.getAttribute("data-time"));Number.isNaN(i)||(i>e?Ar(n,"future"):n.removeAttribute("data-future"),i<e?Ar(n,"past"):n.removeAttribute("data-past"))}}function hD(t,e){let n=null,i;function r(){s(),t(...i),i=void 0}function s(){clearTimeout(n),n=null}function a(){i=[].slice.call(arguments),s(),n=setTimeout(r,e)}return a}function C_(t){return t instanceof HTMLElement?{top:t.offsetTop,width:t.clientWidth,height:t.clientHeight,left:t.offsetLeft,right:t.offsetLeft+t.clientWidth,bottom:t.offsetTop+t.clientHeight}:{...t}}function eh(t,e,n){switch(e){case"+x":t.left+=n,t.right+=n;break;case"-x":t.left-=n,t.right-=n;break;case"+y":t.top+=n,t.bottom+=n;break;case"-y":t.top-=n,t.bottom-=n;break}}function fD(t,e){return t.left<=e.right&&t.right>=e.left&&t.top<=e.bottom&&t.bottom>=e.top}function mD(t,e){for(let n=0;n<e.length;n++)if(fD(t,e[n]))return e[n];return null}function LS(t,e){return e.top>=0&&e.bottom<=t.height&&e.left>=0&&e.right<=t.width}function gD(t,e,n){switch(n){case"+x":return e.left<0;case"-x":return e.right>t.width;case"+y":return e.top<0;case"-y":return e.bottom>t.height}}function vD(t,e){let n=Math.max(0,Math.min(t.width,e.right)-Math.max(0,e.left)),i=Math.max(0,Math.min(t.height,e.bottom)-Math.max(0,e.top));return n*i/(t.height*t.width)}function $_(t,e){return{top:e.top/t.height,left:e.left/t.width,right:(t.width-e.right)/t.width,bottom:(t.height-e.bottom)/t.height}}function VS(t,e){return e.top=e.top*t.height,e.left=e.left*t.width,e.right=t.width-e.right*t.width,e.bottom=t.height-e.bottom*t.height,e}function zS(t,e,n,i){let r=$_(e,n);for(let s of FS)Nt(t,`${i}-${s}`,r[s]*100+"%")}function US(t,e,n,i){let r=1,s,a={...e};for(let o=0;o<i.length;o++){for(;gD(t,e,i[o])||LS(t,e)&&mD(e,n);)eh(e,i[o],1);if(LS(t,e))return e;let l=vD(t,e);r>l&&(s={...e},r=l),e={...a}}return s||a}function yD(t,e,n,i){let r=n.firstElementChild,s=bD(e),a,o=[];if(n[Nr]||(n[Nr]=_D(t,n)),a=VS(t,{...n[Nr]}),n[sc])o=[n[sc]==="top"?"+y":"-y","+x","-x"];else if(e.snapToLines){let l;switch(e.vertical){case"":o=["+y","-y"],l="height";break;case"rl":o=["+x","-x"],l="width";break;case"lr":o=["-x","+x"],l="width";break}let c=pD(r),u=c*Math.round(s),d=t[l]+c,p=o[0];Math.abs(u)>d&&(u=u<0?-1:1,u*=Math.ceil(d/c)*c),s<0&&(u+=e.vertical===""?t.height:t.width,o=o.reverse()),eh(a,p,u)}else{let l=e.vertical==="",c=l?"+y":"+x",u=l?a.height:a.width;eh(a,c,(l?t.height:t.width)*s/100),eh(a,c,e.lineAlign==="center"?u/2:e.lineAlign==="end"?u:0),o=l?["-y","+y","-x","+x"]:["-x","+x","-y","+y"]}return a=US(t,a,i,o),zS(n,t,a,"cue"),a}function _D(t,e){let n=C_(e),i=wD(e);if(e[sc]=!1,i.top&&(n.top=i.top,n.bottom=i.top+n.height,e[sc]="top"),i.bottom){let r=t.height-i.bottom;n.top=r-n.height,n.bottom=r,e[sc]="bottom"}return i.left&&(n.left=i.left),i.right&&(n.right=t.width-i.right),$_(t,n)}function wD(t){let e={};for(let n of FS)e[n]=parseFloat(t.style.getPropertyValue(`--cue-${n}`));return e}function bD(t){return t.line==="auto"?t.snapToLines?-1:100:t.line}function xD(t){if(t.position==="auto")switch(t.align){case"start":case"left":return 0;case"right":case"end":return 100;default:return 50}return t.position}function kD(t,e){if(t.positionAlign==="auto")switch(t.align){case"start":return e==="ltr"?"line-left":"line-right";case"end":return e==="ltr"?"line-right":"line-left";case"center":return"center";default:return`line-${t.align}`}return t.positionAlign}function ED(t,e,n,i){let r=Array.from(n.querySelectorAll('[data-part="cue-display"]')),s=0,a=Math.max(0,r.length-e.lines);for(let l=r.length-1;l>=a;l--)s+=r[l].offsetHeight;Nt(n,"region-height",s+"px"),n[Nr]||(n[Nr]=$_(t,C_(n)));let o={...n[Nr]};return o=VS(t,o),o.width=n.clientWidth,o.height=s,o.right=o.left+o.width,o.bottom=o.top+s,o=US(t,o,i,TD),zS(n,t,o,"region"),o}var Mn,Gt,IS,x_,k_,ac,E_,U2,Wi,oc,$S,j2,B2,RS,W2,Ua,K2,G2,Y2,Q2,ic,X2,Z2,J2,eD,tD,nD,Fa,za,rD,sD,aD,DS,oD,lD,cD,uD,Nr,FS,sc,TD,th,nc=Ue(()=>{"use strict";Mn={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5},Gt=class extends Error{constructor(n){super(n.reason);_(this,"code");_(this,"line");this.code=n.code,this.line=n.line}},IS=/\r?\n|\r/gm,x_=class{constructor(e){_(this,"writable");_(this,"readable");let n=new k_(e);this.writable=new WritableStream({write(i){n.transform(i)},close(){n.close()}}),this.readable=new ReadableStream({start(i){n.onLine=r=>i.enqueue(r),n.onClose=()=>i.close()}})}},k_=class{constructor(e){_(this,"x","");_(this,"y");_(this,"onLine");_(this,"onClose");this.y=new TextDecoder(e)}transform(e){this.x+=this.y.decode(e,{stream:!0});let n=this.x.split(IS);this.x=n.pop()||"";for(let i=0;i<n.length;i++)this.onLine(n[i].trim())}close(){this.x&&this.onLine(this.x.trim()),this.x="",this.onClose()}};ac=class extends EventTarget{constructor(n,i,r){super();_(this,"id","");_(this,"startTime");_(this,"endTime");_(this,"text");_(this,"pauseOnExit",!1);this.startTime=n,this.endTime=i,this.text=r}addEventListener(n,i,r){super.addEventListener(n,i,r)}removeEventListener(n,i,r){super.removeEventListener(n,i,r)}},E_=typeof document>"u",U2=E_?ac:window.VTTCue,Wi=class extends U2{constructor(){super(...arguments);_(this,"region",null);_(this,"vertical","");_(this,"snapToLines",!0);_(this,"line","auto");_(this,"lineAlign","start");_(this,"position","auto");_(this,"positionAlign","auto");_(this,"size",100);_(this,"align","center");_(this,"style")}},oc=class{constructor(){_(this,"id","");_(this,"width",100);_(this,"lines",3);_(this,"regionAnchorX",0);_(this,"regionAnchorY",100);_(this,"viewportAnchorX",0);_(this,"viewportAnchorY",100);_(this,"scroll","")}},$S=",",j2="%";B2="WEBVTT",RS=",",W2="%",Ua=/[:=]/,K2=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,G2="NOTE",Y2="REGION",Q2=/^REGION:?[\s\t]+/,ic=/[\s\t]+/,X2="-->",Z2=/[\s\t]*-->[\s\t]+/,J2=/start|center|end|left|right/,eD=/start|center|end/,tD=/line-(?:left|right)|center|auto/,nD=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/,Fa=(t=>(t[t.None=0]="None",t[t.Header=1]="Header",t[t.Cue=2]="Cue",t[t.Region=3]="Region",t[t.Note=4]="Note",t))(Fa||{}),za=class{constructor(){_(this,"f");_(this,"c",0);_(this,"g",{});_(this,"h",{});_(this,"j",[]);_(this,"a",null);_(this,"b",null);_(this,"k",[]);_(this,"d");_(this,"l","")}async init(e){this.f=e,e.strict&&(this.c=1),e.errors&&(this.d=(await Promise.resolve().then(()=>(v_(),g_))).ParseErrorBuilder)}parse(e,n){if(e==="")this.a?(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null):this.b?(this.h[this.b.id]=this.b,this.f.onRegion?.(this.b),this.b=null):this.c===1&&(this.i(e,n),this.f.onHeaderMetadata?.(this.g)),this.c=0;else if(this.c)switch(this.c){case 1:this.i(e,n);break;case 2:if(this.a){let i=this.a.text.length>0;!i&&K2.test(e)?this.m(e.split(ic),n):this.a.text+=(i?`
`:"")+e}break;case 3:this.n(e.split(ic),n);break}else if(e.startsWith(G2))this.c=4;else if(e.startsWith(Y2))this.c=3,this.b=new oc,this.n(e.replace(Q2,"").split(ic),n);else if(e.includes(X2)){let i=this.o(e,n);i&&(this.a=new Wi(i[0],i[1],""),this.a.id=this.l,this.m(i[2],n)),this.c=2}else n===1&&this.i(e,n);this.l=e}done(){return{metadata:this.g,cues:this.j,regions:Object.values(this.h),errors:this.k}}i(e,n){if(n>1){if(Ua.test(e)){let[i,r]=e.split(Ua);i&&(this.g[i]=(r||"").replace(ic,""))}}else e.startsWith(B2)?this.c=1:this.e(this.d?.p())}o(e,n){let[i,r=""]=e.split(Z2),[s,...a]=r.split(ic),o=Ki(i),l=Ki(s);if(o!==null&&l!==null&&l>o)return[o,l,a];o===null&&this.e(this.d?.q(i,n)),l===null&&this.e(this.d?.r(s,n)),o!=null&&l!==null&&l>o&&this.e(this.d?.s(o,l,n))}n(e,n){let i;for(let r=0;r<e.length;r++)if(Ua.test(e[r])){i=!1;let[s,a]=e[r].split(Ua);switch(s){case"id":this.b.id=a;break;case"width":let o=rc(a);o!==null?this.b.width=o:i=!0;break;case"lines":let l=H2(a);l!==null?this.b.lines=l:i=!0;break;case"regionanchor":let c=MS(a);c!==null?(this.b.regionAnchorX=c[0],this.b.regionAnchorY=c[1]):i=!0;break;case"viewportanchor":let u=MS(a);u!==null?(this.b.viewportAnchorX=u[0],this.b.viewportAnchorY=u[1]):i=!0;break;case"scroll":a==="up"?this.b.scroll="up":i=!0;break;default:this.e(this.d?.t(s,a,n))}i&&this.e(this.d?.u(s,a,n))}}m(e,n){let i;for(let r=0;r<e.length;r++)if(i=!1,Ua.test(e[r])){let[s,a]=e[r].split(Ua);switch(s){case"region":let o=this.h[a];o&&(this.a.region=o);break;case"vertical":a==="lr"||a==="rl"?(this.a.vertical=a,this.a.region=null):i=!0;break;case"line":let[l,c]=a.split(RS);if(l.includes(W2)){let y=rc(l);y!==null?(this.a.line=y,this.a.snapToLines=!1):i=!0}else{let y=q2(l);y!==null?this.a.line=y:i=!0}eD.test(c)?this.a.lineAlign=c:c&&(i=!0),this.a.line!=="auto"&&(this.a.region=null);break;case"position":let[u,d]=a.split(RS),p=rc(u);p!==null?this.a.position=p:i=!0,d&&tD.test(d)?this.a.positionAlign=d:d&&(i=!0);break;case"size":let h=rc(a);h!==null?(this.a.size=h,h<100&&(this.a.region=null)):i=!0;break;case"align":J2.test(a)?this.a.align=a:i=!0;break;default:this.e(this.d?.v(s,a,n))}i&&this.e(this.d?.w(s,a,n))}}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}};rD=Object.freeze({__proto__:null,VTTBlock:Fa,VTTParser:za,default:iD,parseVTTTimestamp:Ki}),sD=/[0-9]/,aD=/[\s\t]+/,DS={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},oD={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":"\xA0","&lrm;":"\u200E","&rlm;":"\u200F"},lD=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,cD=new Set(["white","lime","cyan","red","yellow","magenta","blue","black"]),uD=new Set(Object.keys(DS));Nr=Symbol(0);FS=["top","left","right","bottom"];sc=Symbol(0);TD=["-y","+y","-x","+x"];th=class{constructor(e,n){_(this,"overlay");_(this,"z");_(this,"A",0);_(this,"C","ltr");_(this,"B",[]);_(this,"D",!1);_(this,"E");_(this,"h",new Map);_(this,"j",new Map);_(this,"K",hD(()=>{this.D=!1,this.G();for(let e of this.h.values())e[Nr]=null;for(let e of this.j.values())e&&(e[Nr]=null);this.H(!0)},50));this.overlay=e,this.dir=n?.dir??"ltr",e.setAttribute("translate","yes"),e.setAttribute("aria-live","off"),e.setAttribute("aria-atomic","true"),Jp(e,"captions"),this.G(),this.E=new ResizeObserver(this.I.bind(this)),this.E.observe(e)}get dir(){return this.C}set dir(e){this.C=e,Ar(this.overlay,"dir",e)}get currentTime(){return this.A}set currentTime(e){this.A=e,this.update()}changeTrack({regions:e,cues:n}){this.reset(),this.J(e);for(let i of n)this.j.set(i,null);this.update()}addCue(e){this.j.set(e,null),this.update()}removeCue(e){this.j.delete(e),this.update()}update(e=!1){this.H(e)}reset(){this.j.clear(),this.h.clear(),this.B=[],this.overlay.textContent=""}destroy(){this.reset(),this.E.disconnect()}I(){this.D=!0,this.K()}G(){this.z=C_(this.overlay),Nt(this.overlay,"overlay-width",this.z.width+"px"),Nt(this.overlay,"overlay-height",this.z.height+"px")}H(e=!1){if(!this.j.size||this.D)return;let n,i=[...this.j.keys()].filter(s=>this.A>=s.startTime&&this.A<=s.endTime).sort((s,a)=>s.startTime!==a.startTime?s.startTime-a.startTime:s.endTime-a.endTime),r=i.map(s=>s.region);for(let s=0;s<this.B.length;s++){if(n=this.B[s],i[s]===n)continue;if(n.region&&!r.includes(n.region)){let o=this.h.get(n.region.id);o&&(o.removeAttribute("data-active"),e=!0)}let a=this.j.get(n);a&&(a.remove(),e=!0)}for(let s=0;s<i.length;s++){n=i[s];let a=this.j.get(n);a||this.j.set(n,a=this.L(n));let o=this.F(n)&&this.h.get(n.region.id);o&&!o.hasAttribute("data-active")&&(requestAnimationFrame(()=>Ar(o,"active")),e=!0),a.isConnected||((o||this.overlay).append(a),e=!0)}if(e){let s=[],a=new Set;for(let o=i.length-1;o>=0;o--){if(n=i[o],a.has(n.region||n))continue;let l=this.F(n),c=l?this.h.get(n.region.id):this.j.get(n);l?s.push(ED(this.z,n.region,c,s)):s.push(yD(this.z,n,c,s)),a.add(l?n.region:n)}}P_(this.overlay,this.A),this.B=i}J(e){if(e)for(let n of e){let i=this.M(n);this.h.set(n.id,i),this.overlay.append(i)}}M(e){let n=document.createElement("div");return Jp(n,"region"),Ar(n,"id",e.id),Ar(n,"scroll",e.scroll),Nt(n,"region-width",e.width+"%"),Nt(n,"region-anchor-x",e.regionAnchorX),Nt(n,"region-anchor-y",e.regionAnchorY),Nt(n,"region-viewport-anchor-x",e.viewportAnchorX),Nt(n,"region-viewport-anchor-y",e.viewportAnchorY),Nt(n,"region-lines",e.lines),n}L(e){let n=document.createElement("div"),i=xD(e),r=kD(e,this.C);if(Jp(n,"cue-display"),e.vertical!==""&&Ar(n,"vertical"),Nt(n,"cue-text-align",e.align),e.style)for(let a of Object.keys(e.style))n.style.setProperty(a,e.style[a]);if(this.F(e))Nt(n,"cue-offset",`${i-(r==="line-right"?100:r==="center"?50:0)}%`);else if(Nt(n,"cue-writing-mode",e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl"),!e.style?.["--cue-width"]){let a=i;r==="line-left"?a=100-i:r==="center"&&i<=50?a=i*2:r==="center"&&i>50&&(a=(100-i)*2);let o=e.size<a?e.size:a;e.vertical===""?Nt(n,"cue-width",o+"%"):Nt(n,"cue-height",o+"%")}let s=document.createElement("div");return Jp(s,"cue"),e.id&&Ar(s,"id",e.id),s.innerHTML=ih(e),n.append(s),n}F(e){return e.region&&e.size===100&&e.vertical===""&&e.line==="auto"}}});var lc={};kt(lc,{CaptionsRenderer:()=>th,ParseError:()=>Gt,ParseErrorCode:()=>Mn,TextCue:()=>ac,VTTCue:()=>Wi,VTTRegion:()=>oc,createVTTCueTemplate:()=>OS,parseByteStream:()=>T_,parseResponse:()=>NS,parseText:()=>AS,parseTextStream:()=>nh,parseVTTTimestamp:()=>Ki,renderVTTCueString:()=>ih,renderVTTTokensString:()=>rh,tokenizeVTTCue:()=>S_,updateTimedVTTCueNodes:()=>P_});var cc=Ue(()=>{"use strict";nc()});var _i,uc=Ue(()=>{"use strict";"use client";At();_i=class{constructor(e){this._callback=e}_start(){Le(this._id)&&this._loop()}_stop(){Be(this._id)&&window.cancelAnimationFrame(this._id),this._id=void 0}_loop(){this._id=window.requestAnimationFrame(()=>{Le(this._id)||(this._callback(),this._loop())})}}});var M_,R_,ja,L_=Ue(()=>{"use strict";"use client";At();Yt();uc();M_=class{constructor(e,n){this._provider=e,this._ctx=n,this._disposal=p_(),this._waiting=!1,this._attachedLoadStart=!1,this._attachedCanPlay=!1,this._timeRAF=new _i(this._onAnimationFrame.bind(this)),this._handlers=void 0,this._handleDevEvent=void 0,this._attachInitialListeners(),b(this._attachTimeUpdate.bind(this)),G(this._onDispose.bind(this))}get _media(){return this._provider.media}get _notify(){return this._ctx.delegate._notify}_onDispose(){this._attachedLoadStart=!1,this._attachedCanPlay=!1,this._timeRAF._stop(),this._disposal.empty()}_onAnimationFrame(){let e=this._media.currentTime;this._ctx.$state.realCurrentTime()!==e&&this._updateCurrentTime(e)}_attachInitialListeners(){this._attachEventListener("loadstart",this._onLoadStart),this._attachEventListener("abort",this._onAbort),this._attachEventListener("emptied",this._onEmptied),this._attachEventListener("error",this._onError),this._attachEventListener("volumechange",this._onVolumeChange)}_attachLoadStartListeners(){this._attachedLoadStart||(this._disposal.add(this._attachEventListener("loadeddata",this._onLoadedData),this._attachEventListener("loadedmetadata",this._onLoadedMetadata),this._attachEventListener("canplay",this._onCanPlay),this._attachEventListener("canplaythrough",this._onCanPlayThrough),this._attachEventListener("durationchange",this._onDurationChange),this._attachEventListener("play",this._onPlay),this._attachEventListener("progress",this._onProgress),this._attachEventListener("stalled",this._onStalled),this._attachEventListener("suspend",this._onSuspend)),this._attachedLoadStart=!0)}_attachCanPlayListeners(){this._attachedCanPlay||(this._disposal.add(this._attachEventListener("pause",this._onPause),this._attachEventListener("playing",this._onPlaying),this._attachEventListener("ratechange",this._onRateChange),this._attachEventListener("seeked",this._onSeeked),this._attachEventListener("seeking",this._onSeeking),this._attachEventListener("ended",this._onEnded),this._attachEventListener("waiting",this._onWaiting)),this._attachedCanPlay=!0)}_attachEventListener(e,n){return S(this._media,e,n.bind(this))}_onDevEvent(e){}_updateCurrentTime(e,n){let i={currentTime:Math.min(e,this._ctx.$state.seekableEnd()),played:this._media.played};this._notify("time-update",i,n)}_onLoadStart(e){if(this._media.networkState===3){this._onAbort(e);return}this._attachLoadStartListeners(),this._notify("load-start",void 0,e)}_onAbort(e){this._notify("abort",void 0,e)}_onEmptied(){this._notify("emptied",void 0,event)}_onLoadedData(e){this._notify("loaded-data",void 0,e)}_onLoadedMetadata(e){this._attachCanPlayListeners(),this._notify("loaded-metadata",void 0,e),I_&&Es(this._ctx.$state.source())&&this._ctx.delegate._ready(this._getCanPlayDetail(),e)}_getCanPlayDetail(){return{provider:C(this._ctx.$provider),duration:this._media.duration,buffered:this._media.buffered,seekable:this._media.seekable}}_onPlay(e){this._ctx.$state.canPlay&&this._notify("play",void 0,e)}_onPause(e){this._media.readyState===1&&!this._waiting||(this._waiting=!1,this._timeRAF._stop(),this._notify("pause",void 0,e))}_onCanPlay(e){this._ctx.delegate._ready(this._getCanPlayDetail(),e)}_onCanPlayThrough(e){this._ctx.$state.started()||this._notify("can-play-through",this._getCanPlayDetail(),e)}_onPlaying(e){this._waiting=!1,this._notify("playing",void 0,e),this._timeRAF._start()}_onStalled(e){this._notify("stalled",void 0,e),this._media.readyState<3&&(this._waiting=!0,this._notify("waiting",void 0,e))}_onWaiting(e){this._media.readyState<3&&(this._waiting=!0,this._notify("waiting",void 0,e))}_onEnded(e){this._timeRAF._stop(),this._updateCurrentTime(this._media.duration,e),this._notify("end",void 0,e),this._ctx.$state.loop()&&s_(this._media.controls)&&(this._media.controls=!1)}_attachTimeUpdate(){this._ctx.$state.paused()&&S(this._media,"timeupdate",this._onTimeUpdate.bind(this))}_onTimeUpdate(e){this._updateCurrentTime(this._media.currentTime,e)}_onDurationChange(e){this._ctx.$state.ended()&&this._updateCurrentTime(this._media.duration,e),this._notify("duration-change",this._media.duration,e)}_onVolumeChange(e){let n={volume:this._media.volume,muted:this._media.muted};this._notify("volume-change",n,e)}_onSeeked(e){this._updateCurrentTime(this._media.currentTime,e),this._notify("seeked",this._media.currentTime,e),Math.trunc(this._media.currentTime)===Math.trunc(this._media.duration)&&sh(this._media.duration)>sh(this._media.currentTime)&&(this._updateCurrentTime(this._media.duration,e),this._media.ended||this._ctx.player.dispatch(new q("media-play-request",{trigger:e})))}_onSeeking(e){this._notify("seeking",this._media.currentTime,e)}_onProgress(e){let n={buffered:this._media.buffered,seekable:this._media.seekable};this._notify("progress",n,e)}_onSuspend(e){this._notify("suspend",void 0,e)}_onRateChange(e){this._notify("rate-change",this._media.playbackRate,e)}_onError(e){let n=this._media.error;if(!n)return;let i={message:n.message,code:n.code,mediaError:n};this._notify("error",i,e)}},R_=class{constructor(e,n){this._provider=e,this._ctx=n,this._nativeTracks.onaddtrack=this._onAddNativeTrack.bind(this),this._nativeTracks.onremovetrack=this._onRemoveNativeTrack.bind(this),this._nativeTracks.onchange=this._onChangeNativeTrack.bind(this),S(this._ctx.audioTracks,"change",this._onChangeTrack.bind(this))}get _nativeTracks(){return this._provider.media.audioTracks}_onAddNativeTrack(e){let n=e.track;if(n.label==="")return;let i={id:n.id.toString(),label:n.label,language:n.language,kind:n.kind,selected:!1};this._ctx.audioTracks[Y._add](i,e),n.enabled&&(i.selected=!0)}_onRemoveNativeTrack(e){let n=this._ctx.audioTracks.getById(e.track.id);n&&this._ctx.audioTracks[Y._remove](n,e)}_onChangeNativeTrack(e){let n=this._getEnabledNativeTrack();if(!n)return;let i=this._ctx.audioTracks.getById(n.id);i&&this._ctx.audioTracks[Y._select](i,!0,e)}_getEnabledNativeTrack(){return Array.from(this._nativeTracks).find(e=>e.enabled)}_onChangeTrack(e){let{current:n}=e.detail;if(!n)return;let i=this._nativeTracks.getTrackById(n.id);if(i){let r=this._getEnabledNativeTrack();r&&(r.enabled=!1),i.enabled=!0}}},ja=class{constructor(e,n){this._media=e,this._ctx=n,this.scope=Rt(),this._currentSrc=null}setup(){new M_(this,this._ctx),"audioTracks"in this.media&&new R_(this,this._ctx),G(()=>{this._media.setAttribute("src",""),this._media.load()})}get type(){return""}get media(){return this._media}get currentSrc(){return this._currentSrc}setPlaybackRate(e){this._media.playbackRate=e}async play(){return this._media.play()}async pause(){return this._media.pause()}setMuted(e){this._media.muted=e}setVolume(e){this._media.volume=e}setCurrentTime(e){this._media.currentTime=e}setPlaysInline(e){J(this._media,"playsinline",e)}async loadSource({src:e,type:n},i){this._media.preload=i||"",A_(e)?this._media.srcObject=e:(this._media.srcObject=null,this._media.src=U(e)?this._appendMediaFragment(e):window.URL.createObjectURL(e)),this._media.load(),this._currentSrc={src:e,type:n}}_appendMediaFragment(e){let{clipStartTime:n,clipEndTime:i}=this._ctx.$state,r=n(),s=i();return r>0&&s>0?`${e}#t=${r},${s}`:r>0?`${e}#t=${r}`:s>0?`${e}#t=0,${s}`:e}}});var jS={};kt(jS,{AudioProvider:()=>N_});var TU,N_,HS=Ue(()=>{"use strict";"use client";L_();TU=$(j(),1),N_=class extends ja{constructor(){super(...arguments),this.$$PROVIDER_TYPE="AUDIO"}get type(){return"audio"}setup(){super.setup(),this.type==="audio"&&this._ctx.delegate._notify("provider-setup",this)}get audio(){return this._media}}});var qS={};kt(qS,{VideoProvider:()=>dc});function SD(t,e){return Array.from(t.children).find(n=>n.track===e)}var CU,D_,O_,V_,F_,z_,U_,j_,dc,H_=Ue(()=>{"use strict";"use client";At();Yt();L_();CU=$(j(),1),D_=class{constructor(e,n){this._video=e,this._ctx=n,e.textTracks.onaddtrack=this._onAddTrack.bind(this),G(this._onDispose.bind(this))}_onAddTrack(e){let n=e.track;if(!n||SD(this._video,n))return;let i=new un({id:n.id,kind:n.kind,label:n.label,language:n.language,type:"vtt"});i[K._native]={track:n},i[K._readyState]=2,i[K._nativeHLS]=!0;let r=0,s=a=>{if(n.cues)for(let o=r;o<n.cues.length;o++)i.addCue(n.cues[o],a),r++};s(e),n.oncuechange=s,this._ctx.textTracks.add(i,e),i.setMode(n.mode,e)}_onDispose(){this._video.textTracks.onaddtrack=null;for(let e of this._ctx.textTracks){let n=e[K._native]?.track;n?.oncuechange&&(n.oncuechange=null)}}};O_=class{constructor(e,n){this._video=e,this._media=n,this._onChange=(i,r)=>{this._media.delegate._notify("picture-in-picture-change",i,r)},S(this._video,"enterpictureinpicture",this._onEnter.bind(this)),S(this._video,"leavepictureinpicture",this._onExit.bind(this))}get active(){return document.pictureInPictureElement===this._video}get supported(){return oh(this._video)}async enter(){return this._video.requestPictureInPicture()}exit(){return document.exitPictureInPicture()}_onEnter(e){this._onChange(!0,e)}_onExit(e){this._onChange(!1,e)}},V_=class{constructor(e,n){this._video=e,this._media=n,this._mode="inline",S(this._video,"webkitpresentationmodechanged",this._onModeChange.bind(this))}get _supported(){return lh(this._video)}async _setPresentationMode(e){this._mode!==e&&this._video.webkitSetPresentationMode(e)}_onModeChange(e){let n=this._mode;this._mode=this._video.webkitPresentationMode,this._media.player?.dispatch(new q("video-presentation-change",{detail:this._mode,trigger:e})),["fullscreen","picture-in-picture"].forEach(i=>{(this._mode===i||n===i)&&this._media.delegate._notify(`${i}-change`,this._mode===i,e)})}},F_=class{constructor(e){this._presentation=e}get active(){return this._presentation._mode==="fullscreen"}get supported(){return this._presentation._supported}async enter(){this._presentation._setPresentationMode("fullscreen")}async exit(){this._presentation._setPresentationMode("inline")}},z_=class{constructor(e){this._presentation=e}get active(){return this._presentation._mode==="picture-in-picture"}get supported(){return this._presentation._supported}async enter(){this._presentation._setPresentationMode("picture-in-picture")}async exit(){this._presentation._setPresentationMode("inline")}},U_=class{constructor(e,n){this._video=e,this._ctx=n,this._supported=O(!1),this._setup()}get supported(){return this._supported()}_setup(){D||!this._video.remote||!this._canPrompt||(this._video.remote.watchAvailability(e=>{this._supported.set(e)}).catch(()=>{this._supported.set(!1)}),b(this._watchSupported.bind(this)))}_watchSupported(){if(!this._supported())return;let e=["connecting","connect","disconnect"],n=this._onStateChange.bind(this);n(),S(this._video,"playing",n);for(let i of e)S(this._video.remote,i,n)}async prompt(){if(!this.supported)throw Error("Not supported on this platform.");return this._video.remote.prompt()}_onStateChange(e){let n=this._video.remote.state;if(n===this._state)return;let i={type:this._type,state:n};this._ctx.delegate._notify("remote-playback-change",i,e),this._state=n}},j_=class extends U_{constructor(){super(...arguments),this._type="airplay"}get _canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}},dc=class extends ja{constructor(e,n){super(e,n),this.$$PROVIDER_TYPE="VIDEO",nt(()=>{if(this.airPlay=new j_(e,n),lh(e)){let i=new V_(e,n);this.fullscreen=new F_(i),this.pictureInPicture=new z_(i)}else oh(e)&&(this.pictureInPicture=new O_(e,n))},this.scope)}get type(){return"video"}setup(){super.setup(),ah(this.video)&&new D_(this.video,this._ctx),this._ctx.textRenderers._attachVideo(this.video),G(()=>{this._ctx.textRenderers._attachVideo(null)}),this.type==="video"&&this._ctx.delegate._notify("provider-setup",this)}get video(){return this._media}}});var BS={};kt(BS,{HLSProvider:()=>ch});async function CD(t,e={}){if(!Le(t)){if(e.onLoadStart?.(),t.prototype&&t.prototype!==Function)return e.onLoaded?.(t),t;try{let n=(await t())?.default;if(n&&n.isSupported)e.onLoaded?.(n);else throw Error("");return n}catch(n){e.onLoadError?.(n)}}}async function $D(t,e={}){if(U(t)){e.onLoadStart?.();try{if(await dh(t),!yt(window.Hls))throw Error("");let n=window.Hls;return e.onLoaded?.(n),n}catch(n){e.onLoadError?.(n)}}}var IU,PD,q_,B_,MD,ch,WS=Ue(()=>{"use strict";"use client";At();Yt();H_();uc();IU=$(j(),1),PD=t=>Oa(t),q_=class{constructor(e,n){this._video=e,this._ctx=n,this._instance=null,this._stopLiveSync=null,this._config={},this._callbacks=new Set,this._retryLoadingTimer=-1}get instance(){return this._instance}setup(e){let{streamType:n}=this._ctx.$state,i=C(n).includes("live"),r=C(n).includes("ll-");this._instance=new e({lowLatencyMode:r,backBufferLength:r?4:i?8:void 0,renderTextTracksNatively:!1,...this._config});let s=this._dispatchHLSEvent.bind(this);for(let a of Object.values(e.Events))this._instance.on(a,s);this._instance.on(e.Events.ERROR,this._onError.bind(this));for(let a of this._callbacks)a(this._instance);this._ctx.player.dispatch("hls-instance",{detail:this._instance}),this._instance.attachMedia(this._video),this._instance.on(e.Events.FRAG_LOADING,this._onFragLoading.bind(this)),this._instance.on(e.Events.AUDIO_TRACK_SWITCHED,this._onAudioSwitch.bind(this)),this._instance.on(e.Events.LEVEL_SWITCHED,this._onLevelSwitched.bind(this)),this._instance.on(e.Events.LEVEL_LOADED,this._onLevelLoaded.bind(this)),this._instance.on(e.Events.NON_NATIVE_TEXT_TRACKS_FOUND,this._onTracksFound.bind(this)),this._instance.on(e.Events.CUES_PARSED,this._onCuesParsed.bind(this)),this._ctx.qualities[dn._enableAuto]=this._enableAutoQuality.bind(this),S(this._ctx.qualities,"change",this._onQualityChange.bind(this)),S(this._ctx.audioTracks,"change",this._onAudioChange.bind(this)),this._stopLiveSync=b(this._liveSync.bind(this))}_liveSync(){if(!this._ctx.$state.live())return;let e=new _i(this._liveSyncPosition.bind(this));return e._start(),e._stop.bind(e)}_liveSyncPosition(){this._ctx.$state.liveSyncPosition.set(this._instance?.liveSyncPosition??1/0)}_dispatchHLSEvent(e,n){this._ctx.player?.dispatch(new q(PD(e),{detail:n}))}_onTracksFound(e,n){let i=new q(e,{detail:n}),r=-1;for(let s=0;s<n.tracks.length;s++){let a=n.tracks[s],o=a.subtitleTrack??a.closedCaptions,l=new un({id:`hls-${a.kind}${s}`,src:o?.url,label:a.label,language:o?.lang,kind:a.kind,default:a.default});l[K._readyState]=2,l[K._onModeChange]=()=>{l.mode==="showing"?(this._instance.subtitleTrack=s,r=s):r===s&&(this._instance.subtitleTrack=-1,r=-1)},this._ctx.textTracks.add(l,i)}}_onCuesParsed(e,n){let i=this._ctx.textTracks.getById(`hls-${n.track}`);if(!i)return;let r=new q(e,{detail:n});for(let s of n.cues)s.positionAlign="auto",i.addCue(s,r)}_onAudioSwitch(e,n){let i=this._ctx.audioTracks[n.id];if(i){let r=new q(e,{detail:n});this._ctx.audioTracks[Y._select](i,!0,r)}}_onLevelSwitched(e,n){let i=this._ctx.qualities[n.level];if(i){let r=new q(e,{detail:n});this._ctx.qualities[Y._select](i,!0,r)}}_onLevelLoaded(e,n){if(this._ctx.$state.canPlay())return;let{type:i,live:r,totalduration:s,targetduration:a}=n.details,o=new q(e,{detail:n});this._ctx.delegate._notify("stream-type-change",r?i==="EVENT"&&Number.isFinite(s)&&a>=10?"live:dvr":"live":"on-demand",o),this._ctx.delegate._notify("duration-change",s,o);let l=this._instance.media;this._instance.currentLevel===-1&&this._ctx.qualities[dn._setAuto](!0,o);for(let c of this._instance.audioTracks){let u={id:c.id.toString(),label:c.name,language:c.lang||"",kind:"main"};this._ctx.audioTracks[Y._add](u,o)}for(let c of this._instance.levels){let u={id:c.id?.toString()??c.height+"p",width:c.width,height:c.height,codec:c.codecSet,bitrate:c.bitrate};this._ctx.qualities[Y._add](u,o)}l.dispatchEvent(new q("canplay",{trigger:o}))}_onError(e,n){if(n.fatal)switch(n.type){case"networkError":this._onNetworkError(n.error);break;case"mediaError":this._instance?.recoverMediaError();break;default:this._onFatalError(n.error);break}}_onFragLoading(){this._retryLoadingTimer>=0&&this._clearRetryTimer()}_onNetworkError(e){this._clearRetryTimer(),this._instance?.startLoad(),this._retryLoadingTimer=window.setTimeout(()=>{this._retryLoadingTimer=-1,this._onFatalError(e)},5e3)}_clearRetryTimer(){clearTimeout(this._retryLoadingTimer),this._retryLoadingTimer=-1}_onFatalError(e){this._instance?.destroy(),this._instance=null,this._ctx.delegate._notify("error",{message:e.message,code:1,error:e})}_enableAutoQuality(){this._instance&&(this._instance.currentLevel=-1)}_onQualityChange(){let{qualities:e}=this._ctx;!this._instance||e.auto||(this._instance[e.switch+"Level"]=e.selectedIndex,pc&&(this._video.currentTime=this._video.currentTime))}_onAudioChange(){let{audioTracks:e}=this._ctx;this._instance&&this._instance.audioTrack!==e.selectedIndex&&(this._instance.audioTrack=e.selectedIndex)}_loadSource(e){U(e.src)&&(this._clearRetryTimer(),this._instance?.loadSource(e.src))}_destroy(){this._clearRetryTimer(),this._ctx&&(this._ctx.qualities[dn._enableAuto]=void 0),this._instance?.destroy(),this._instance=null,this._stopLiveSync?.(),this._stopLiveSync=null}},B_=class{constructor(e,n,i){this._lib=e,this._ctx=n,this._callback=i,this._startLoading()}async _startLoading(){let e={onLoadStart:this._onLoadStart.bind(this),onLoaded:this._onLoaded.bind(this),onLoadError:this._onLoadError.bind(this)},n=await $D(this._lib,e);if(Le(n)&&!U(this._lib)&&(n=await CD(this._lib,e)),!n)return null;if(!n.isSupported()){let i="[vidstack] `hls.js` is not supported in this environment";return this._ctx.player.dispatch(new q("hls-unsupported")),this._ctx.delegate._notify("error",{message:i,code:4}),null}return n}_onLoadStart(){this._ctx.player.dispatch(new q("hls-lib-load-start"))}_onLoaded(e){this._ctx.player.dispatch(new q("hls-lib-loaded",{detail:e})),this._callback(e)}_onLoadError(e){let n=wi(e);this._ctx.player.dispatch(new q("hls-lib-load-error",{detail:n})),this._ctx.delegate._notify("error",{message:n.message,code:4,error:n})}};MD="https://cdn.jsdelivr.net",ch=class extends dc{constructor(){super(...arguments),this.$$PROVIDER_TYPE="HLS",this._ctor=null,this._controller=new q_(this.video,this._ctx),this._library=`${MD}/npm/hls.js@^1.5.0/dist/hls.min.js`}get ctor(){return this._ctor}get instance(){return this._controller.instance}get type(){return"hls"}get canLiveSync(){return!0}get config(){return this._controller._config}set config(e){this._controller._config=e}get library(){return this._library}set library(e){this._library=e}preconnect(){U(this._library)&&ni(this._library)}setup(){super.setup(),new B_(this._library,this._ctx,e=>{this._ctor=e,this._controller.setup(e),this._ctx.delegate._notify("provider-setup",this);let n=C(this._ctx.$state.source);n&&this.loadSource(n)})}async loadSource(e,n){U(e.src)&&(this._media.preload=n||"",this._controller._loadSource(e),this._currentSrc=e)}onInstance(e){let n=this._controller.instance;return n&&e(n),this._controller._callbacks.add(e),()=>this._controller._callbacks.delete(e)}destroy(){this._controller._destroy()}};ch.supported=uh()});function qa(t,e=3e3){let n=Bi();return setTimeout(()=>{let i=t();i&&n.reject(i)},e),n}var Ha,W_=Ue(()=>{"use strict";"use client";At();Yt();Ha=class{constructor(e){this._iframe=e,this._src=O(""),this.referrerPolicy=null,e.setAttribute("frameBorder","0"),e.setAttribute("aria-hidden","true"),e.setAttribute("allow","autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"),this.referrerPolicy!==null&&e.setAttribute("referrerpolicy",this.referrerPolicy)}get iframe(){return this._iframe}setup(){S(window,"message",this._onWindowMessage.bind(this)),S(this._iframe,"load",this._onLoad.bind(this)),b(this._watchSrc.bind(this))}_watchSrc(){let e=this._src();if(!e.length){this._iframe.setAttribute("src","");return}let n=C(()=>this._buildParams());this._iframe.setAttribute("src",KS(e,n))}_postMessage(e,n){D||this._iframe.contentWindow?.postMessage(JSON.stringify(e),n??"*")}_onWindowMessage(e){let n=this._getOrigin();if((e.source===null||e.source===this._iframe?.contentWindow)&&(!U(n)||n===e.origin)){try{let r=JSON.parse(e.data);r&&this._onMessage(r,e);return}catch{}e.data&&this._onMessage(e.data,e)}}}});var GS={};kt(GS,{getVimeoVideoInfo:()=>Y_,resolveVimeoVideoId:()=>G_});function G_(t){let e=t.match(RD);return{videoId:e?.[1],hash:e?.[2]}}async function Y_(t,e){if(K_.has(t))return K_.get(t);if(ph.has(t))return ph.get(t);let n=`https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${t}`,i=window.fetch(n,{mode:"cors",signal:e.signal}).then(r=>r.json()).then(r=>{let s=/vimeocdn.com\/video\/(.*)?_/,a=r?.thumbnail_url?.match(s)?.[1],o=a?`https://i.vimeocdn.com/video/${a}_1920x1080.webp`:"",l={title:r?.title??"",duration:r?.duration??0,poster:o,pro:r.account_type!=="basic"};return K_.set(t,l),l}).finally(()=>ph.delete(t));return ph.set(t,i),i}var RD,K_,ph,Q_=Ue(()=>{"use strict";"use client";RD=/(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:\?hash=(.*))?/,K_=new Map,ph=new Map});var YS={};kt(YS,{VimeoProvider:()=>X_});var jU,LD,X_,QS=Ue(()=>{"use strict";"use client";At();Yt();uc();W_();Q_();jU=$(j(),1),LD=["bufferend","bufferstart","durationchange","ended","enterpictureinpicture","error","fullscreenchange","leavepictureinpicture","loaded","playProgress","loadProgress","pause","play","playbackratechange","qualitychange","seeked","seeking","timeupdate","volumechange","waiting"],X_=class extends Ha{constructor(e,n){super(e),this._ctx=n,this.$$PROVIDER_TYPE="VIMEO",this.scope=Rt(),this._played=0,this._playedRange=new le(0,0),this._seekableRange=new le(0,0),this._playPromise=null,this._pausePromise=null,this._videoInfoPromise=null,this._videoId=O(""),this._pro=O(!1),this._hash=null,this._currentSrc=null,this._currentCue=null,this._timeRAF=new _i(this._onAnimationFrame.bind(this)),this._chaptersTrack=null,this.cookies=!1,this.title=!0,this.byline=!0,this.portrait=!0,this.color="00ADEF",this._skipTimeUpdates=!1}get _notify(){return this._ctx.delegate._notify}get type(){return"vimeo"}get currentSrc(){return this._currentSrc}get videoId(){return this._videoId()}get hash(){return this._hash}get isPro(){return this._pro()}preconnect(){ni(this._getOrigin())}setup(){super.setup(),b(this._watchVideoId.bind(this)),b(this._watchVideoInfo.bind(this)),b(this._watchPro.bind(this)),this._notify("provider-setup",this)}destroy(){this._reset(),this._remote("destroy")}async play(){let{paused:e}=this._ctx.$state;return this._playPromise||(this._playPromise=qa(()=>{if(this._playPromise=null,e())return"Timed out."}),this._remote("play")),this._playPromise.promise}async pause(){let{paused:e}=this._ctx.$state;return this._pausePromise||(this._pausePromise=qa(()=>{if(this._pausePromise=null,!e())return"Timed out."}),this._remote("pause")),this._pausePromise.promise}setMuted(e){this._remote("setMuted",e)}setCurrentTime(e){this._remote("seekTo",e),this._notify("seeking",e)}setVolume(e){this._remote("setVolume",e),this._remote("setMuted",C(this._ctx.$state.muted))}setPlaybackRate(e){this._remote("setPlaybackRate",e)}async loadSource(e){if(!U(e.src)){this._currentSrc=null,this._hash=null,this._videoId.set("");return}let{videoId:n,hash:i}=G_(e.src);this._videoId.set(n??""),this._hash=i??null,this._currentSrc=e}_watchVideoId(){this._reset();let e=this._videoId();if(!e){this._src.set("");return}this._src.set(`${this._getOrigin()}/video/${e}`),this._notify("load-start")}_watchVideoInfo(){let e=this._videoId();if(!e)return;let n=Bi(),i=new AbortController;return this._videoInfoPromise=n,Y_(e,i).then(r=>{n.resolve(r)}).catch(r=>{n.reject(),this._notify("error",{message:`Failed to fetch vimeo video info for id \`${e}\`.`,code:1,error:wi(r)})}),()=>{n.reject(),i.abort()}}_watchPro(){let e=this._pro(),{$state:n,qualities:i}=this._ctx;if(n.canSetPlaybackRate.set(e),i[Y._setReadonly](!e),e)return S(i,"change",()=>{if(i.auto)return;let r=i.selected?.id;r&&this._remote("setQuality",r)})}_getOrigin(){return"https://player.vimeo.com"}_buildParams(){let{$iosControls:e}=this._ctx,{keyDisabled:n}=this._ctx.$props,{controls:i,playsInline:r}=this._ctx.$state,s=i()||e();return{title:this.title,byline:this.byline,color:this.color,portrait:this.portrait,controls:s,h:this.hash,keyboard:s&&!n(),transparent:!0,playsinline:r(),dnt:!this.cookies}}_onAnimationFrame(){this._remote("getCurrentTime")}_onTimeUpdate(e,n){if(this._skipTimeUpdates&&e===0)return;let{realCurrentTime:i,realDuration:r,paused:s,bufferedEnd:a}=this._ctx.$state;if(i()===e)return;let o=i(),l={currentTime:e,played:this._getPlayedRange(e)};this._notify("time-update",l,n),Math.abs(o-e)>1.5&&(this._notify("seeking",e,n),!s()&&a()<e&&this._notify("waiting",void 0,n)),r()-e<.01&&(this._notify("end",void 0,n),this._skipTimeUpdates=!0,setTimeout(()=>{this._skipTimeUpdates=!1},500))}_getPlayedRange(e){return this._played>=e?this._playedRange:this._playedRange=new le(0,this._played=e)}_onSeeked(e,n){this._notify("seeked",e,n)}_onReady(e){let n=this._videoId();this._videoInfoPromise?.promise.then(i=>{if(!i)return;let{title:r,poster:s,duration:a,pro:o}=i,{$iosControls:l}=this._ctx,{controls:c}=this._ctx.$state,u=c()||l();this._pro.set(o),this._seekableRange=new le(0,a),this._notify("title-change",r,e),this._notify("poster-change",s,e),this._notify("duration-change",a,e);let d={buffered:new le(0,0),seekable:this._seekableRange,duration:a};this._ctx.delegate._ready(d,e),u||this._remote("_hideOverlay"),this._remote("getQualities"),this._remote("getChapters")}).catch(i=>{n===this._videoId()&&this._notify("error",{message:"Failed to fetch oembed data",code:2,error:wi(i)})})}_onMethod(e,n,i){switch(e){case"getCurrentTime":this._onTimeUpdate(n,i);break;case"getBuffered":qe(n)&&n.length&&this._onLoadProgress(n[n.length-1][1],i);break;case"setMuted":this._onVolumeChange(C(this._ctx.$state.volume),n,i);break;case"getChapters":this._onChaptersChange(n);break;case"getQualities":this._onQualitiesChange(n,i);break}}_attachListeners(){for(let e of LD)this._remote("addEventListener",e)}_onPause(e){this._timeRAF._stop(),this._notify("pause",void 0,e),this._pausePromise?.resolve(),this._pausePromise=null}_onPlay(e){this._timeRAF._start(),this._notify("play",void 0,e),this._playPromise?.resolve(),this._playPromise=null}_onPlayProgress(e){let{paused:n}=this._ctx.$state;n()||this._notify("playing",void 0,e)}_onLoadProgress(e,n){let i={buffered:new le(0,e),seekable:this._seekableRange};this._notify("progress",i,n)}_onBufferStart(e){this._notify("waiting",void 0,e)}_onBufferEnd(e){let{paused:n}=this._ctx.$state;n()||this._notify("playing",void 0,e)}_onWaiting(e){let{paused:n}=this._ctx.$state;n()&&this._notify("play",void 0,e),this._notify("waiting",void 0,e)}_onVolumeChange(e,n,i){let r={volume:e,muted:n};this._notify("volume-change",r,i)}_onChaptersChange(e){if(this._removeChapters(),!e.length)return;let n=new un({kind:"chapters",default:!0}),{realDuration:i}=this._ctx.$state;for(let r=0;r<e.length;r++){let s=e[r],a=e[r+1];n.addCue(new window.VTTCue(s.startTime,a?.startTime??i(),s.title))}this._chaptersTrack=n,this._ctx.textTracks.add(n)}_removeChapters(){this._chaptersTrack&&(this._ctx.textTracks.remove(this._chaptersTrack),this._chaptersTrack=null)}_onQualitiesChange(e,n){this._ctx.qualities[dn._enableAuto]=e.some(i=>i.id==="auto")?()=>{this._remote("setQuality","auto")}:void 0;for(let i of e){if(i.id==="auto")continue;let r=+i.id.slice(0,-1);isNaN(r)||this._ctx.qualities[Y._add]({id:i.id,width:r*(16/9),height:r,codec:"avc1,h.264",bitrate:-1},n)}this._onQualityChange(e.find(i=>i.active),n)}_onQualityChange({id:e}={},n){if(!e)return;let i=e==="auto",r=this._ctx.qualities.toArray().find(s=>s.id===e);i?(this._ctx.qualities[dn._setAuto](i,n),this._ctx.qualities[Y._select](void 0,!0,n)):this._ctx.qualities[Y._select](r,!0,n)}_onEvent(e,n,i){switch(e){case"ready":this._attachListeners();break;case"loaded":this._onReady(i);break;case"play":this._onPlay(i);break;case"playProgress":this._onPlayProgress(i);break;case"pause":this._onPause(i);break;case"loadProgress":this._onLoadProgress(n.seconds,i);break;case"waiting":this._onWaiting(i);break;case"bufferstart":this._onBufferStart(i);break;case"bufferend":this._onBufferEnd(i);break;case"volumechange":this._onVolumeChange(n.volume,C(this._ctx.$state.muted),i);break;case"durationchange":this._seekableRange=new le(0,n.duration),this._notify("duration-change",n.duration,i);break;case"playbackratechange":this._notify("rate-change",n.playbackRate,i);break;case"qualitychange":this._onQualityChange(n,i);break;case"fullscreenchange":this._notify("fullscreen-change",n.fullscreen,i);break;case"enterpictureinpicture":this._notify("picture-in-picture-change",!0,i);break;case"leavepictureinpicture":this._notify("picture-in-picture-change",!1,i);break;case"ended":this._notify("end",void 0,i);break;case"error":this._onError(n,i);break;case"seek":case"seeked":this._onSeeked(n.seconds,i);break}}_onError(e,n){if(e.method==="setPlaybackRate"&&this._pro.set(!1),e.method==="play"){this._playPromise?.reject(e.message);return}}_onMessage(e,n){e.event?this._onEvent(e.event,e.data,n):e.method&&this._onMethod(e.method,e.value,n)}_onLoad(){}_remote(e,n){return this._postMessage({method:e,value:n})}_reset(){this._timeRAF._stop(),this._played=0,this._playedRange=new le(0,0),this._seekableRange=new le(0,0),this._playPromise=null,this._pausePromise=null,this._videoInfoPromise=null,this._currentCue=null,this._pro.set(!1),this._removeChapters()}}});var XS={};kt(XS,{findYouTubePoster:()=>AD,resolveYouTubeVideoId:()=>J_});function J_(t){return t.match(ID)?.[1]}async function AD(t,e){if(Z_.has(t))return Z_.get(t);if(hh.has(t))return hh.get(t);let n=new Promise(async i=>{let r=["maxresdefault","sddefault","hqdefault"];for(let s of r)for(let a of[!0,!1]){let o=ND(t,s,a);if((await fetch(o,{mode:"no-cors",signal:e.signal})).status<400){Z_.set(t,o),i(o);return}}}).catch(()=>"").finally(()=>hh.delete(t));return hh.set(t,n),n}function ND(t,e,n){return`https://i.ytimg.com/${n?"vi_webp":"vi"}/${t}/${e}.${n?"webp":"jpg"}`}var ID,Z_,hh,ew=Ue(()=>{"use strict";"use client";ID=/(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/,Z_=new Map,hh=new Map});var ZS={};kt(ZS,{YouTubeProvider:()=>tw});var KU,Ss,tw,JS=Ue(()=>{"use strict";"use client";At();Yt();W_();ew();KU=$(j(),1),Ss={_Unstarted:-1,_Ended:0,_Playing:1,_Paused:2,_Buffering:3,_Cued:5},tw=class extends Ha{constructor(e,n){super(e),this._ctx=n,this.$$PROVIDER_TYPE="YOUTUBE",this.scope=Rt(),this._videoId=O(""),this._state=-1,this._seekingTimer=-1,this._pausedSeeking=!1,this._played=0,this._playedRange=new le(0,0),this._currentSrc=null,this._playPromise=null,this._pausePromise=null,this.language="en",this.color="red",this.cookies=!1}get _notify(){return this._ctx.delegate._notify}get currentSrc(){return this._currentSrc}get type(){return"youtube"}get videoId(){return this._videoId()}preconnect(){ni(this._getOrigin())}setup(){super.setup(),b(this._watchVideoId.bind(this)),this._notify("provider-setup",this)}async play(){let{paused:e}=this._ctx.$state;return this._playPromise||(this._playPromise=qa(()=>{if(this._playPromise=null,e())return"Timed out."}),this._remote("playVideo")),this._playPromise.promise}async pause(){let{paused:e}=this._ctx.$state;return this._pausePromise||(this._pausePromise=qa(()=>{this._pausePromise=null,e()}),this._remote("pauseVideo")),this._pausePromise.promise}setMuted(e){e?this._remote("mute"):this._remote("unMute")}setCurrentTime(e){this._pausedSeeking=this._ctx.$state.paused(),this._remote("seekTo",e),this._notify("seeking",e)}setVolume(e){this._remote("setVolume",e*100)}setPlaybackRate(e){this._remote("setPlaybackRate",e)}async loadSource(e){if(!U(e.src)){this._currentSrc=null,this._videoId.set("");return}let n=J_(e.src);this._videoId.set(n??""),this._currentSrc=e}_getOrigin(){return this.cookies?"https://www.youtube.com":"https://www.youtube-nocookie.com"}_watchVideoId(){this._reset();let e=this._videoId();if(!e){this._src.set("");return}this._src.set(`${this._getOrigin()}/embed/${e}`),this._notify("load-start")}_buildParams(){let{keyDisabled:e}=this._ctx.$props,{$iosControls:n}=this._ctx,{controls:i,muted:r,playsInline:s}=this._ctx.$state,a=i()||n();return{autoplay:0,cc_lang_pref:this.language,cc_load_policy:a?1:void 0,color:this.color,controls:a?1:0,disablekb:!a||e()?1:0,enablejsapi:1,fs:1,hl:this.language,iv_load_policy:a?1:3,mute:r()?1:0,playsinline:s()?1:0}}_remote(e,n){this._postMessage({event:"command",func:e,args:n?[n]:void 0})}_onLoad(){window.setTimeout(()=>this._postMessage({event:"listening"}),100)}_onReady(e){this._notify("loaded-metadata"),this._notify("loaded-data"),this._ctx.delegate._ready(void 0,e)}_onPause(e){this._pausePromise?.resolve(),this._pausePromise=null,this._notify("pause",void 0,e)}_onTimeUpdate(e,n){let{duration:i,realCurrentTime:r}=this._ctx.$state,s=this._state===Ss._Ended,a=s?i():e,o={currentTime:a,played:this._getPlayedRange(a)};this._notify("time-update",o,n),!s&&Math.abs(a-r())>1&&this._notify("seeking",a,n)}_getPlayedRange(e){return this._played>=e?this._playedRange:this._playedRange=new le(0,this._played=e)}_onProgress(e,n,i){let r={buffered:new le(0,e),seekable:n};this._notify("progress",r,i);let{seeking:s,realCurrentTime:a}=this._ctx.$state;s()&&e>a()&&this._onSeeked(i)}_onSeeked(e){let{paused:n,realCurrentTime:i}=this._ctx.$state;window.clearTimeout(this._seekingTimer),this._seekingTimer=window.setTimeout(()=>{this._notify("seeked",i(),e),this._seekingTimer=-1},n()?100:0),this._pausedSeeking=!1}_onEnded(e){let{seeking:n}=this._ctx.$state;n()&&this._onSeeked(e),this._notify("end",void 0,e)}_onStateChange(e,n){let{started:i,paused:r,seeking:s}=this._ctx.$state,a=e===Ss._Playing,o=e===Ss._Buffering,l=(r()||this._playPromise)&&(o||a);if(o&&this._notify("waiting",void 0,n),s()&&a&&this._onSeeked(n),!i()&&l&&this._pausedSeeking){this._playPromise?.reject("invalid internal play operation"),this._playPromise=null,a&&(this.pause(),this._pausedSeeking=!1);return}switch(l&&(this._playPromise?.resolve(),this._playPromise=null,this._notify("play",void 0,n)),e){case Ss._Cued:this._onReady(n);break;case Ss._Playing:this._notify("playing",void 0,n);break;case Ss._Paused:this._onPause(n);break;case Ss._Ended:this._onEnded(n);break}this._state=e}_onMessage({info:e},n){if(!e)return;let{title:i,intrinsicDuration:r,playbackRate:s}=this._ctx.$state;if(Ql(e.videoData)&&e.videoData.title!==i()&&this._notify("title-change",e.videoData.title,n),Be(e.duration)&&e.duration!==r()){if(Be(e.videoLoadedFraction)){let a=e.progressState?.loaded??e.videoLoadedFraction*e.duration,o=new le(0,e.duration);this._onProgress(a,o,n)}this._notify("duration-change",e.duration,n)}if(Be(e.playbackRate)&&e.playbackRate!==s()&&this._notify("rate-change",e.playbackRate,n),e.progressState){let{current:a,seekableStart:o,seekableEnd:l,loaded:c,duration:u}=e.progressState;this._onTimeUpdate(a,n),this._onProgress(c,new le(o,l),n),u!==r()&&this._notify("duration-change",u,n)}if(Be(e.volume)&&a_(e.muted)){let a={muted:e.muted,volume:e.volume/100};this._notify("volume-change",a,n)}Be(e.playerState)&&e.playerState!==this._state&&this._onStateChange(e.playerState,n)}_reset(){this._state=-1,this._seekingTimer=-1,this._played=0,this._playedRange=new le(0,0),this._playPromise=null,this._pausePromise=null,this._pausedSeeking=!1}}});var tP={};kt(tP,{GoogleCastProvider:()=>sw});var ZU,iw,nw,eP,rw,sw,nP=Ue(()=>{"use strict";"use client";At();Yt();uc();ow();ZU=$(j(),1),iw=class{constructor(e){this._info=new chrome.cast.media.MediaInfo(e.src,e.type)}build(){return this._info}_setStreamType(e){return e.includes("live")?this._info.streamType=chrome.cast.media.StreamType.LIVE:this._info.streamType=chrome.cast.media.StreamType.BUFFERED,this}_setTracks(e){return this._info.tracks=e.map(this._buildCastTrack),this}_setMetadata(e,n){return this._info.metadata=new chrome.cast.media.GenericMediaMetadata,this._info.metadata.title=e,this._info.metadata.images=[{url:n}],this}_buildCastTrack(e,n){let i=new chrome.cast.media.Track(n,chrome.cast.media.TrackType.TEXT);return i.name=e.label,i.trackContentId=e.src,i.trackContentType="text/vtt",i.language=e.language,i.subtype=e.kind.toUpperCase(),i}},nw=chrome.cast.media.TrackType.TEXT,eP=chrome.cast.media.TrackType.AUDIO,rw=class{constructor(e,n,i){this._cast=e,this._ctx=n,this._onNewLocalTracks=i}_setup(){let e=this._syncRemoteActiveIds.bind(this);S(this._ctx.audioTracks,"change",e),S(this._ctx.textTracks,"mode-change",e),b(this._syncLocalTracks.bind(this))}_getLocalTextTracks(){return this._ctx.$state.textTracks().filter(e=>e.src&&e.type==="vtt")}_getLocalAudioTracks(){return this._ctx.$state.audioTracks()}_getRemoteTracks(e){let n=this._cast.mediaInfo?.tracks??[];return e?n.filter(i=>i.type===e):n}_getRemoteActiveIds(){let e=[],n=this._getLocalAudioTracks().find(r=>r.selected),i=this._getLocalTextTracks().filter(r=>r.mode==="showing");if(n){let r=this._getRemoteTracks(eP),s=this._findRemoteTrack(r,n);s&&e.push(s.trackId)}if(i?.length){let r=this._getRemoteTracks(nw);if(r.length)for(let s of i){let a=this._findRemoteTrack(r,s);a&&e.push(a.trackId)}}return e}_syncLocalTracks(){let e=this._getLocalTextTracks();if(!this._cast.isMediaLoaded)return;let n=this._getRemoteTracks(nw);for(let i of e)if(!this._findRemoteTrack(n,i)){Na(()=>this._onNewLocalTracks?.());break}}_syncRemoteTracks(e){if(!this._cast.isMediaLoaded)return;let n=this._getLocalAudioTracks(),i=this._getLocalTextTracks(),r=this._getRemoteTracks(eP),s=this._getRemoteTracks(nw);for(let a of r){if(this._findLocalTrack(n,a))continue;let l={id:a.trackId.toString(),label:a.name,language:a.language,kind:a.subtype??"main",selected:!1};this._ctx.audioTracks[Y._add](l,e)}for(let a of s){if(this._findLocalTrack(i,a))continue;let l={id:a.trackId.toString(),src:a.trackContentId,label:a.name,language:a.language,kind:a.subtype.toLowerCase()};this._ctx.textTracks.add(l,e)}}_syncRemoteActiveIds(e){if(!this._cast.isMediaLoaded)return;let n=this._getRemoteActiveIds(),i=new chrome.cast.media.EditTracksInfoRequest(n);this._editTracksInfo(i).catch(r=>{})}_editTracksInfo(e){let n=fc();return new Promise((i,r)=>n?.editTracksInfo(e,i,r))}_findLocalTrack(e,n){return e.find(i=>this._isMatch(i,n))}_findRemoteTrack(e,n){return e.find(i=>this._isMatch(n,i))}_isMatch(e,n){return n.name===e.label&&n.language===e.language&&n.subtype.toLowerCase()===e.kind.toLowerCase()}},sw=class{constructor(e,n){this._player=e,this._ctx=n,this.$$PROVIDER_TYPE="GOOGLE_CAST",this.scope=Rt(),this._currentSrc=null,this._state="disconnected",this._currentTime=0,this._played=0,this._playedRange=new le(0,0),this._seekableRange=new le(0,0),this._timeRAF=new _i(this._onAnimationFrame.bind(this)),this._reloadInfo=null,this._isIdle=!1,this._tracks=new rw(this._player,this._ctx,this._onNewLocalTracks.bind(this))}get _notify(){return this._ctx.delegate._notify}get type(){return"google-cast"}get currentSrc(){return this._currentSrc}get player(){return this._player}get cast(){return Ps()}get session(){return hc()}get media(){return fc()}get hasActiveSession(){return fh(this._currentSrc)}setup(){this._attachCastContextEventListeners(),this._attachCastPlayerEventListeners(),this._tracks._setup(),this._notify("provider-setup",this)}_attachCastContextEventListeners(){aw(cast.framework.CastContextEventType.CAST_STATE_CHANGED,this._onCastStateChange.bind(this))}_attachCastPlayerEventListeners(){let e=cast.framework.RemotePlayerEventType,n={[e.IS_CONNECTED_CHANGED]:this._onCastStateChange,[e.IS_MEDIA_LOADED_CHANGED]:this._onMediaLoadedChange,[e.CAN_CONTROL_VOLUME_CHANGED]:this._onCanControlVolumeChange,[e.CAN_SEEK_CHANGED]:this._onCanSeekChange,[e.DURATION_CHANGED]:this._onDurationChange,[e.IS_MUTED_CHANGED]:this._onVolumeChange,[e.VOLUME_LEVEL_CHANGED]:this._onVolumeChange,[e.IS_PAUSED_CHANGED]:this._onPausedChange,[e.LIVE_SEEKABLE_RANGE_CHANGED]:this._onProgress,[e.PLAYER_STATE_CHANGED]:this._onPlayerStateChange};this._playerEventHandlers=n;let i=this._onRemotePlayerEvent.bind(this);for(let r of tc(n))this._player.controller.addEventListener(r,i);G(()=>{for(let r of tc(n))this._player.controller.removeEventListener(r,i)})}async play(){if(!(!this._player.isPaused&&!this._isIdle)){if(this._isIdle){await this._reload(!1,0);return}this._player.controller?.playOrPause()}}async pause(){this._player.isPaused||this._player.controller?.playOrPause()}getMediaStatus(e){return new Promise((n,i)=>{this.media?.getStatus(e,n,i)})}setMuted(e){(e&&!this._player.isMuted||!e&&this._player.isMuted)&&this._player.controller?.muteOrUnmute()}setCurrentTime(e){this._player.currentTime=e,this._notify("seeking",e),this._player.controller?.seek()}setVolume(e){this._player.volumeLevel=e,this._player.controller?.setVolumeLevel()}async loadSource(e){if(this._reloadInfo?.src!==e&&(this._reloadInfo=null),fh(e)){this._resumeSession(),this._currentSrc=e;return}this._notify("load-start");let n=this._buildLoadRequest(e),i=await this.session.loadMedia(n);if(i){this._currentSrc=null,this._notify("error",Error(mh(i)));return}this._currentSrc=e}destroy(){this._reset(),this._endSession()}_reset(){this._reloadInfo||(this._played=0,this._playedRange=new le(0,0),this._seekableRange=new le(0,0)),this._timeRAF._stop(),this._currentTime=0,this._reloadInfo=null}_resumeSession(){let e=new q("resume-session",{detail:this.session});this._onMediaLoadedChange(e);let{muted:n,volume:i,remotePlaybackInfo:r}=this._ctx.$state,s=r();this.setCurrentTime(Math.max(this._player.currentTime,s?.savedState?.currentTime??0)),this.setMuted(n()),this.setVolume(i()),s?.savedState?.paused===!1&&this.play()}_endSession(){this.cast.endCurrentSession(!0);let{remotePlaybackLoader:e}=this._ctx.$state;e.set(null)}_disconnectFromReceiver(){this._ctx.$state.remotePlaybackInfo.set({savedState:{paused:this._player.isPaused,currentTime:this._player.currentTime}}),this._endSession()}_onAnimationFrame(){this._onCurrentTimeChange()}_onRemotePlayerEvent(e){this._playerEventHandlers[e.type].call(this,e)}_onCastStateChange(e){let n=this.cast.getCastState(),i=n===cast.framework.CastState.CONNECTED?"connected":n===cast.framework.CastState.CONNECTING?"connecting":"disconnected";if(this._state===i)return;let r={type:"google-cast",state:i},s=this._createEvent(e);this._state=i,this._notify("remote-playback-change",r,s),i==="disconnected"&&this._disconnectFromReceiver()}_onMediaLoadedChange(e){if(!!!this._player.isMediaLoaded)return;let i=C(this._ctx.$state.source);Promise.resolve().then(()=>{if(i!==C(this._ctx.$state.source)||!this._player.isMediaLoaded)return;this._reset();let r=this._player.duration;this._seekableRange=new le(0,r);let s={provider:this,duration:r,buffered:this._playedRange,seekable:this._getSeekableRange()},a=this._createEvent(e);this._notify("loaded-metadata",void 0,a),this._notify("loaded-data",void 0,a),this._notify("can-play",s,a),this._onCanControlVolumeChange(),this._onCanSeekChange(e);let{volume:o,muted:l}=this._ctx.$state;this.setVolume(o()),this.setMuted(l()),this._timeRAF._start(),this._tracks._syncRemoteTracks(a),this._tracks._syncRemoteActiveIds(a)})}_onCanControlVolumeChange(){this._ctx.$state.canSetVolume.set(this._player.canControlVolume)}_onCanSeekChange(e){let n=this._createEvent(e);this._notify("stream-type-change",this._getStreamType(),n)}_getStreamType(){return this._player.mediaInfo?.streamType===chrome.cast.media.StreamType.LIVE?this._player.canSeek?"live:dvr":"live":"on-demand"}_onCurrentTimeChange(){if(this._reloadInfo)return;let e=this._player.currentTime;if(e===this._currentTime)return;let n=this._played,i=this._getPlayedRange(e),r={currentTime:e,played:i};this._notify("time-update",r),e>n&&this._onProgress(),this._ctx.$state.seeking()&&this._notify("seeked",e),this._currentTime=e}_getPlayedRange(e){return this._played>=e?this._playedRange:this._playedRange=new le(0,this._played=e)}_onDurationChange(e){if(!this._player.isMediaLoaded||this._reloadInfo)return;let n=this._player.duration,i=this._createEvent(e);this._seekableRange=new le(0,n),this._notify("duration-change",n,i)}_onVolumeChange(e){if(!this._player.isMediaLoaded)return;let n={muted:this._player.isMuted,volume:this._player.volumeLevel},i=this._createEvent(e);this._notify("volume-change",n,i)}_onPausedChange(e){let n=this._createEvent(e);this._player.isPaused?this._notify("pause",void 0,n):this._notify("play",void 0,n)}_onProgress(e){let n={seekable:this._getSeekableRange(),buffered:this._playedRange},i=e?this._createEvent(e):void 0;this._notify("progress",n,i)}_onPlayerStateChange(e){let n=this._player.playerState,i=chrome.cast.media.PlayerState;if(this._isIdle=n===i.IDLE,n===i.PAUSED)return;let r=this._createEvent(e);switch(n){case i.PLAYING:this._notify("playing",void 0,r);break;case i.BUFFERING:this._notify("waiting",void 0,r);break;case i.IDLE:this._timeRAF._stop(),this._notify("pause"),this._notify("end");break}}_getSeekableRange(){return this._player.liveSeekableRange?new le(this._player.liveSeekableRange.start,this._player.liveSeekableRange.end):this._seekableRange}_createEvent(e){return e instanceof Event?e:new q(e.type,{detail:e})}_buildMediaInfo(e){let{streamType:n,title:i,poster:r}=this._ctx.$state;return new iw(e)._setMetadata(i(),r())._setStreamType(n())._setTracks(this._tracks._getLocalTextTracks()).build()}_buildLoadRequest(e){let n=this._buildMediaInfo(e),i=new chrome.cast.media.LoadRequest(n),r=this._ctx.$state.remotePlaybackInfo();return i.autoplay=(this._reloadInfo?.paused??r?.savedState?.paused)===!1,i.currentTime=this._reloadInfo?.time??r?.savedState?.currentTime??0,i}async _reload(e,n){let i=C(this._ctx.$state.source);this._reloadInfo={src:i,paused:e,time:n},await this.loadSource(i)}_onNewLocalTracks(){this._reload(this._player.isPaused,this._player.currentTime).catch(e=>{})}}});var rP={};kt(rP,{a:()=>Ps,b:()=>hc,c:()=>mh,d:()=>zD,g:()=>fc,h:()=>fh,l:()=>aw});function DD(){return"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"}function OD(){return!!window.cast?.framework}function VD(){return!!window.chrome?.cast?.isAvailable}function iP(){return Ps().getCastState()===cast.framework.CastState.CONNECTED}function Ps(){return window.cast.framework.CastContext.getInstance()}function hc(){return Ps().getCurrentSession()}function fc(){return hc()?.getSessionObj().media[0]}function fh(t){return fc()?.media.contentId===t?.src}function FD(){return{language:"en-US",autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,resumeSavedSession:!0,androidReceiverCompatible:!0}}function mh(t){return`Google Cast Error Code: ${t}`}function aw(t,e){return sP(Ps(),t,e)}var lw,zD,ow=Ue(()=>{"use strict";"use client";Yt();At();lw=class{constructor(){this.name="google-cast"}get cast(){return Ps()}mediaType(){return"video"}canPlay(e){return pc&&!gh&&vh(e)}async prompt(e){let n;try{let i=await this._loadCastFramework(e);this._player||(this._player=new cast.framework.RemotePlayer,new cast.framework.RemotePlayerController(this._player)),n=e.player.createEvent("google-cast-prompt-open",{trigger:i}),e.player.dispatchEvent(n),this._notifyRemoteStateChange(e,"connecting",n),await this._showPrompt(C(e.$props.googleCast)),e.$state.remotePlaybackInfo.set({deviceName:hc()?.getCastDevice().friendlyName}),iP()&&this._notifyRemoteStateChange(e,"connected",n)}catch(i){let r=wi(i);throw this._notifyRemoteStateChange(e,iP()?"connected":"disconnected",new q("google-cast-prompt-error",{detail:r})),r}finally{e.player.dispatch("google-cast-prompt-close",{trigger:n})}}async load(e){if(D)throw Error("[vidstack] can not load google cast provider server-side");if(!this._player)throw Error("[vidstack] google cast player was not initialized");return new(await Promise.resolve().then(()=>(nP(),tP))).GoogleCastProvider(this._player,e)}async _loadCastFramework(e){if(OD())return;let n=e.player.createEvent("google-cast-load-start");e.player.dispatch(n),await dh(DD()),await customElements.whenDefined("google-cast-launcher");let i=e.player.createEvent("google-cast-loaded",{trigger:n});if(e.player.dispatch(i),!VD())throw Error("Cast not available.");return i}async _showPrompt(e){this._setOptions(e);let n=await this.cast.requestSession();if(n)throw Error(mh(n))}_setOptions(e){this.cast?.setOptions({...FD(),...e})}_notifyRemoteStateChange(e,n,i){let r={type:"google-cast",state:n};e.delegate._notify("remote-playback-change",r,i)}},zD=Object.freeze({__proto__:null,GoogleCastLoader:lw})});function $P(){return kh}function cw(t){if(Cs.fullscreenElement===t)return!0;try{return t.matches(Cs.fullscreenPseudoClass)}catch{return!1}}function uP(){if(!kh)throw Error("[vidstack] no fullscreen API")}function Iw(){return MP()&&yt(screen.orientation.unlock)}function MP(){return!D&&!Le(window.screen.orientation)&&!Le(window.screen.orientation.lock)}function JD(t,e){return D?!1:(t||(t=document.createElement("audio")),t.canPlayType(e).length>0)}function eO(t,e){return D?!1:(t||(t=document.createElement("video")),t.canPlayType(e).length>0)}function ah(t){return D?!1:(t||(t=document.createElement("video")),t.canPlayType("application/vnd.apple.mpegurl").length>0)}function oh(t){return D?!1:!!document.pictureInPictureEnabled&&!t?.disablePictureInPicture}function lh(t){return D?!1:yt(t?.webkitSupportsPresentationMode)&&yt(t?.webkitSetPresentationMode)}async function RP(){let t=document.createElement("video");return t.volume=.5,await h_(0),t.volume===.5}function tO(){return D?void 0:window?.ManagedMediaSource??window?.MediaSource??window?.WebKitMediaSource}function nO(){return D?void 0:window?.SourceBuffer??window?.WebKitSourceBuffer}function uh(){if(D)return!1;let t=tO();if(Le(t))return!1;let e=t&&yt(t.isTypeSupported)&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),n=nO(),i=Le(n)||!Le(n.prototype)&&yt(n.prototype.appendBuffer)&&yt(n.prototype.remove);return!!e&&!!i}function hw(t){if(!t.length)return null;let e=t.start(0);for(let n=1;n<t.length;n++){let i=t.start(n);i<e&&(e=i)}return e}function fw(t){if(!t.length)return null;let e=t.end(0);for(let n=1;n<t.length;n++){let i=t.end(n);i>e&&(e=i)}return e}function KS(t,e){let n=new URLSearchParams;for(let i of Object.keys(e))n.set(i,e[i]+"");return t+"?"+n.toString()}function ni(t,e="preconnect"){if(D)return!1;let n=document.querySelector(`link[href="${t}"]`);if(!vi(n))return!0;let i=document.createElement("link");return i.rel=e,i.href=t,i.crossOrigin="true",document.head.append(i),!0}function dh(t){if(yh[t])return yh[t].promise;let e=Bi(),n=document.querySelector(`script[src="${t}"]`);if(!vi(n))return e.resolve(),e.promise;let i=document.createElement("script");return i.src=t,i.onload=()=>{e.resolve(),delete yh[t]},i.onerror=()=>{e.reject(),delete yh[t]},setTimeout(()=>document.head.append(i),0),e.promise}function Eh(t){return t==="use-credentials"?"include":U(t)?"same-origin":void 0}function Sh(t,e){return e>=t.startTime&&e<t.endTime}function io(t,e,n){let i=null;function r(){let s=U(e)?[e]:e,a=t.toArray().find(o=>s.includes(o.kind)&&o.mode==="showing");if(a!==i){if(!a){n(null),i=null;return}a.readyState==2?n(a):(n(null),a.addEventListener("load",()=>n(a),{once:!0})),i=a}}return r(),S(t,"mode-change",r)}function We(t){return uO.test(t.kind)}function AP(t,e,n){let i=U(t)?JSON.parse(t):t,r=[],s=[];return i.regions&&n&&(r=i.regions.map(a=>Object.assign(new n,a))),(i.cues||qe(i))&&(s=(qe(i)?i:i.cues).filter(a=>Be(a.startTime)&&Be(a.endTime)).map(a=>Object.assign(new e(0,0,""),a))),{regions:r,cues:s}}function NP(t){Vs.reset(t,e=>dO.has(e)),ti()}function ce(){return Ie(au)}function DP(t){return t.split("-")[0]}function pO(t){return t.split("-")[1]}function hO(t){return t==="x"?"y":"x"}function fO(t){return t==="y"?"height":"width"}function OP(t){return["top","bottom"].includes(DP(t))?"y":"x"}function mO(t){return hO(OP(t))}function VP(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function mP(t,e,n){let{reference:i,floating:r}=t,s=OP(e),a=mO(e),o=fO(a),l=DP(e),c=s==="y",u=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,p=i[o]/2-r[o]/2,h;switch(l){case"top":h={x:u,y:i.y-r.height};break;case"bottom":h={x:u,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:d};break;case"left":h={x:i.x-r.width,y:d};break;default:h={x:i.x,y:i.y}}switch(pO(e)){case"start":h[a]-=p*(n&&c?-1:1);break;case"end":h[a]+=p*(n&&c?-1:1);break}return h}function Or(t){return FP(t)?(t.nodeName||"").toLowerCase():"#document"}function hn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function tr(t){var e;return(e=(FP(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function FP(t){return t instanceof Node||t instanceof hn(t).Node}function Qi(t){return t instanceof Element||t instanceof hn(t).Element}function bi(t){return t instanceof HTMLElement||t instanceof hn(t).HTMLElement}function gP(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof hn(t).ShadowRoot}function ou(t){let{overflow:e,overflowX:n,overflowY:i,display:r}=Ln(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(r)}function vO(t){return["table","td","th"].includes(Or(t))}function Nw(t){let e=Dw(),n=Ln(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function zP(t){let e=Ya(t);for(;bi(e)&&!hf(e);){if(Nw(e))return e;e=Ya(e)}return null}function Dw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function hf(t){return["html","body","#document"].includes(Or(t))}function Ln(t){return hn(t).getComputedStyle(t)}function ff(t){return Qi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Ya(t){if(Or(t)==="html")return t;let e=t.assignedSlot||t.parentNode||gP(t)&&t.host||tr(t);return gP(e)?e.host:e}function UP(t){let e=Ya(t);return hf(e)?t.ownerDocument?t.ownerDocument.body:t.body:bi(e)&&ou(e)?e:UP(e)}function yc(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let r=UP(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),a=hn(r);return s?e.concat(a,a.visualViewport||[],ou(r)?r:[],a.frameElement&&n?yc(a.frameElement):[]):e.concat(r,yc(r,[],n))}function jP(t){let e=Ln(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,r=bi(t),s=r?t.offsetWidth:n,a=r?t.offsetHeight:i,o=Ph(n)!==s||Ph(i)!==a;return o&&(n=s,i=a),{width:n,height:i,$:o}}function Ow(t){return Qi(t)?t:t.contextElement}function Wa(t){let e=Ow(t);if(!bi(e))return Dr(1);let n=e.getBoundingClientRect(),{width:i,height:r,$:s}=jP(e),a=(s?Ph(n.width):n.width)/i,o=(s?Ph(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}function HP(t){let e=hn(t);return!Dw()||!e.visualViewport?yO:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _O(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==hn(t)?!1:e}function $s(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let r=t.getBoundingClientRect(),s=Ow(t),a=Dr(1);e&&(i?Qi(i)&&(a=Wa(i)):a=Wa(t));let o=_O(s,n,i)?HP(s):Dr(0),l=(r.left+o.x)/a.x,c=(r.top+o.y)/a.y,u=r.width/a.x,d=r.height/a.y;if(s){let p=hn(s),h=i&&Qi(i)?hn(i):i,y=p.frameElement;for(;y&&i&&h!==p;){let v=Wa(y),w=y.getBoundingClientRect(),m=Ln(y),f=w.left+(y.clientLeft+parseFloat(m.paddingLeft))*v.x,g=w.top+(y.clientTop+parseFloat(m.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=f,c+=g,y=hn(y).frameElement}}return VP({width:u,height:d,x:l,y:c})}function qP(t){let e=!1,n=0,i=0;function r(a){try{e=e||t.matches(a)}catch{}}wO.forEach(a=>{r(a)});let s=zP(t);if(e&&s){let a=s.getBoundingClientRect();n=a.x,i=a.y}return[e,n,i]}function bO(t){let{elements:e,rect:n,offsetParent:i,strategy:r}=t,s=tr(i),[a]=e?qP(e.floating):[!1];if(i===s||a)return n;let o={scrollLeft:0,scrollTop:0},l=Dr(1),c=Dr(0),u=bi(i);if((u||!u&&r!=="fixed")&&((Or(i)!=="body"||ou(s))&&(o=ff(i)),bi(i))){let d=$s(i);l=Wa(i),c.x=d.x+i.clientLeft,c.y=d.y+i.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-o.scrollLeft*l.x+c.x,y:n.y*l.y-o.scrollTop*l.y+c.y}}function xO(t){return Array.from(t.getClientRects())}function BP(t){return $s(tr(t)).left+ff(t).scrollLeft}function kO(t){let e=tr(t),n=ff(t),i=t.ownerDocument.body,r=Ba(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Ba(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),a=-n.scrollLeft+BP(t),o=-n.scrollTop;return Ln(i).direction==="rtl"&&(a+=Ba(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:a,y:o}}function TO(t,e){let n=hn(t),i=tr(t),r=n.visualViewport,s=i.clientWidth,a=i.clientHeight,o=0,l=0;if(r){s=r.width,a=r.height;let c=Dw();(!c||c&&e==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:s,height:a,x:o,y:l}}function EO(t,e){let n=$s(t,!0,e==="fixed"),i=n.top+t.clientTop,r=n.left+t.clientLeft,s=bi(t)?Wa(t):Dr(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:a,height:o,x:l,y:c}}function vP(t,e,n){let i;if(e==="viewport")i=TO(t,n);else if(e==="document")i=kO(tr(t));else if(Qi(e))i=EO(e,n);else{let r=HP(t);i={...e,x:e.x-r.x,y:e.y-r.y}}return VP(i)}function WP(t,e){let n=Ya(t);return n===e||!Qi(n)||hf(n)?!1:Ln(n).position==="fixed"||WP(n,e)}function SO(t,e){let n=e.get(t);if(n)return n;let i=yc(t,[],!1).filter(o=>Qi(o)&&Or(o)!=="body"),r=null,s=Ln(t).position==="fixed",a=s?Ya(t):t;for(;Qi(a)&&!hf(a);){let o=Ln(a),l=Nw(a);!l&&o.position==="fixed"&&(r=null),(s?!l&&!r:!l&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||ou(a)&&!l&&WP(t,a))?i=i.filter(u=>u!==a):r=o,a=Ya(a)}return e.set(t,i),i}function PO(t){let{element:e,boundary:n,rootBoundary:i,strategy:r}=t,a=[...n==="clippingAncestors"?SO(e,this._c):[].concat(n),i],o=a[0],l=a.reduce((c,u)=>{let d=vP(e,u,r);return c.top=Ba(d.top,c.top),c.right=mw(d.right,c.right),c.bottom=mw(d.bottom,c.bottom),c.left=Ba(d.left,c.left),c},vP(e,o,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function CO(t){let{width:e,height:n}=jP(t);return{width:e,height:n}}function $O(t,e,n,i){let r=bi(e),s=tr(e),a=n==="fixed",o=$s(t,!0,a,e),l={scrollLeft:0,scrollTop:0},c=Dr(0);if(r||!r&&!a)if((Or(e)!=="body"||ou(s))&&(l=ff(e)),r){let v=$s(e,!0,a,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&(c.x=BP(s));let u=o.left+l.scrollLeft-c.x,d=o.top+l.scrollTop-c.y,[p,h,y]=qP(i);return p&&(u+=h,d+=y,r&&(u+=e.clientLeft,d+=e.clientTop)),{x:u,y:d,width:o.width,height:o.height}}function yP(t,e){return!bi(t)||Ln(t).position==="fixed"?null:e?e(t):t.offsetParent}function KP(t,e){let n=hn(t);if(!bi(t))return n;let i=yP(t,e);for(;i&&vO(i)&&Ln(i).position==="static";)i=yP(i,e);return i&&(Or(i)==="html"||Or(i)==="body"&&Ln(i).position==="static"&&!Nw(i))?n:i||zP(t)||n}function RO(t){return Ln(t).direction==="rtl"}function IO(t,e){let n=null,i,r=tr(t);function s(){var o;clearTimeout(i),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();let{left:c,top:u,width:d,height:p}=t.getBoundingClientRect();if(o||e(),!d||!p)return;let h=_h(u),y=_h(r.clientWidth-(c+d)),v=_h(r.clientHeight-(u+p)),w=_h(c),f={rootMargin:-h+"px "+-y+"px "+-v+"px "+-w+"px",threshold:Ba(0,mw(1,l))||1},g=!0;function x(E){let L=E[0].intersectionRatio;if(L!==l){if(!g)return a();L?a(!1,L):i=setTimeout(()=>{a(!1,1e-7)},100)}g=!1}try{n=new IntersectionObserver(x,{...f,root:r.ownerDocument})}catch{n=new IntersectionObserver(x,f)}n.observe(t)}return a(!0),s}function AO(t,e,n,i){i===void 0&&(i={});let{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=Ow(t),u=r||s?[...c?yc(c):[],...yc(e)]:[];u.forEach(m=>{r&&m.addEventListener("scroll",n,{passive:!0}),s&&m.addEventListener("resize",n)});let d=c&&o?IO(c,n):null,p=-1,h=null;a&&(h=new ResizeObserver(m=>{let[f]=m;f&&f.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var g;(g=h)==null||g.observe(e)})),n()}),c&&!l&&h.observe(c),h.observe(e));let y,v=l?$s(t):null;l&&w();function w(){let m=$s(t);v&&(m.x!==v.x||m.y!==v.y||m.width!==v.width||m.height!==v.height)&&n(),v=m,y=requestAnimationFrame(w)}return n(),()=>{var m;u.forEach(f=>{r&&f.removeEventListener("scroll",n),s&&f.removeEventListener("resize",n)}),d?.(),(m=h)==null||m.disconnect(),h=null,l&&cancelAnimationFrame(y)}}function sP(t,e,n){if(t)return S(t,e,n)}function ye(t,e,n){t.hasAttribute(e)||t.setAttribute(e,n)}function zr(t,e){if(t.hasAttribute("aria-label")||t.hasAttribute("data-no-label"))return;function n(){J(t,"aria-label",e())}D?n():b(n)}function GP(t,e,n){for(;e;){if(e===t)return!0;if(n?.(e))break;e=e.parentElement}return!1}function Vr(t,e){S(t,"pointerup",n=>{n.button===0&&e(n)}),S(t,"keydown",n=>{Zl(n)&&e(n)})}function Vw(t){return Da(t)&&(t.touches.length>1||t.changedTouches.length>1)}function Ch(t){if(D)return t();let e=Kl(),n=window.requestAnimationFrame(()=>{nt(t,e),n=-1});return()=>void window.cancelAnimationFrame(n)}function YP(t,e,n,{offsetVarName:i,xOffset:r,yOffset:s,...a}){if(!t)return;let o=n.replace(" ","-").replace("-center","");if(ct(t,"visibility",e?null:"hidden"),!e)return;let l=u=>n.includes("left")?`calc(-1 * ${u})`:u,c=u=>n.includes("top")?`calc(-1 * ${u})`:u;return AO(e,t,()=>{NO(e,t,{placement:o,...a}).then(({x:u,y:d})=>{Object.assign(t.style,{top:`calc(${d+"px"} + ${c(s?s+"px":`var(--${i}-y-offset, 0px)`)})`,left:`calc(${u+"px"} + ${l(r?r+"px":`var(--${i}-x-offset, 0px)`)})`})})})}function DO(t){return getComputedStyle(t).animationName!=="none"}function OO(t,e,n){var i=null,r=null,s=n&&n.leading,a=n&&n.trailing;s==null&&(s=!0),a==null&&(a=!s),s==!0&&(a=!1);var o=function(){i&&(clearTimeout(i),i=null)},l=function(){var u=r;o(),u&&u()},c=function(){var u=s&&!i,d=this,p=arguments;if(r=function(){return t.apply(d,p)},i||(i=setTimeout(function(){if(i=null,a)return r()},e)),u)return u=!1,r()};return c.cancel=o,c.flush=l,c}function VO(t,e,n){var i=null,r=null,s=function(){i&&(clearTimeout(i),r=null,i=null)},a=function(){var l=r;s(),l&&l()},o=function(){if(!e)return t.apply(this,arguments);var l=this,c=arguments,u=n&&!i;if(s(),r=function(){t.apply(l,c)},i=setTimeout(function(){if(i=null,!u){var d=r;return r=null,d()}},e),u)return r()};return o.cancel=s,o.flush=a,o}function ro(t){return t?.$$PROVIDER_TYPE==="VIDEO"}function QP(t){return!D&&t instanceof HTMLAudioElement}function XP(t){return!D&&t instanceof HTMLVideoElement}function ZP(t){return QP(t)||XP(t)}function HO(t){return t.replace(/Shift\+(\d)/g,(e,n)=>jO[n-1])}function zw({src:t,type:e}){return U(t)?e1.test(t)||t1.has(e)||t.startsWith("blob:")&&e==="audio/object":e==="audio/object"}function Uw(t){return U(t.src)?n1.test(t.src)||i1.has(t.type)||t.src.startsWith("blob:")&&t.type==="video/object"||Es(t)&&(D||ah()):t.type==="video/object"}function Es({src:t,type:e}){return U(t)&&r1.test(t)||s1.has(e)}function vh(t){return U(t.src)&&(zw(t)||Uw(t)||Es(t))}function A_(t){return!D&&typeof window.MediaStream<"u"&&t instanceof window.MediaStream}function wi(t){return t instanceof Error?t:Error(JSON.stringify(t))}function Gi(t,e){if(!t)throw Error(e||"Assertion failed.")}function dw(t,e){if(!(t&&e))throw Error("[vidstack] media not ready")}function bP(t,e){if(!e?.supported)throw Error("[vidstack] no fullscreen support")}function Dt(t,e=2){return Number(t.toFixed(e))}function sh(t){return String(t).split(".")[1]?.length??0}function jw(t,e,n){return Math.max(t,Math.min(n,e))}function wh(t,e){J(t,"data-focus",e),J(t,"data-hocus",e)}function xP(t,e){J(t,"data-hocus",e),J(t,"data-hover",e)}function c1(t,e){return fetch(t,e).then(n=>n.text()).then(n=>{let i=XO(n);if(i)return c1(/^https?:/.test(i)?i:new URL(i,t).href,e);let r=/EXT-X-PLAYLIST-TYPE:\s*VOD/.test(n)?"on-demand":"live";return r==="live"&&ZO(n)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(n)||n.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":r})}function XO(t){let e=t.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return e?e[0].split(`
`)[1].trim():null}function ZO(t){let e=t.split(`
`);for(let n of e)if(n.startsWith("#EXT-X-TARGETDURATION")){let i=parseFloat(n.split(":")[1]);if(!isNaN(i))return i}return-1}function kP(t){return(qe(t)?t:[!U(t)&&"src"in t?t:{src:t}]).map(({src:e,type:n,...i})=>({src:e,type:n??(U(e)?u1.get(e):null)??(!U(e)||e.startsWith("blob:")?"video/object":e.includes("youtube")?"video/youtube":e.includes("vimeo")?"video/vimeo":"?"),...i})).sort(e=>e.type==="?"?1:-1)}function TP(t,e){return t?.src===e?.src&&t?.type===e?.type}function a3(t){return t?"true":"false"}function Xt(t){return()=>a3(t())}function EP(t,e,n){let i=e-t,r=n-t;return i>0?r/i:0}function o3(t,e,n,i){return jw(t,Dt(n,sh(i)),e)}function l3(t,e,n,i){let r=jw(0,n,1),s=e-t,a=s*r,o=a/i,l=i*o;return t+l}function pw(t,e){let n=String(t),i=n.length;if(i<e){let s=e-i;return`${"0".repeat(s)}${t}`}return n}function d1(t){let e=Math.trunc(t/3600),n=Math.trunc(t%3600/60),i=Math.trunc(t%60),r=Number((t-Math.trunc(t)).toPrecision(3));return{hours:e,minutes:n,seconds:i,fraction:r}}function Ur(t,e=null,n=null,i=!1){let{hours:r,minutes:s,seconds:a}=d1(t),o=e?pw(r,2):r,l=n||vi(n)&&t>=3600?pw(s,2):s,c=pw(a,2);return r>0||i?`${o}:${l}:${c}`:`${l}:${c}`}function kc(t){let e=[],{hours:n,minutes:i,seconds:r}=d1(t);return n>0&&e.push(`${n} hour`),i>0&&e.push(`${i} min`),(r>0||e.length===0)&&e.push(`${r} sec`),e.join(" ")}function Hw(t,{clamp:e,offset:n,orientation:i}){let r=getComputedStyle(t),s=parseFloat(r.width),a=parseFloat(r.height),o={top:null,right:null,bottom:null,left:null};if(o[i==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${n}px))`,i==="horizontal"){let l=s/2;if(!e)o.left=`calc(var(--slider-pointer) - ${l}px)`;else{let c=`max(0px, calc(var(--slider-pointer) - ${l}px))`,u=`calc(100% - ${s}px)`;o.left=`min(${c}, ${u})`}}else{let l=a/2;if(!e)o.bottom=`calc(var(--slider-pointer) - ${l}px)`;else{let c=`max(${l}px, calc(var(--slider-pointer) - ${l}px))`,u=`calc(100% - ${a}px)`;o.bottom=`min(${c}, ${u})`}}Object.assign(t.style,o)}function j3(t){return ke.isValidElement(t)&&t.type===U3}function H3(t,e){let n={...e};for(let i in e){let r=t[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...o)=>{s(...o),r(...o)}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...t,...n}}function f1(t){return t?.$$PROVIDER_TYPE==="REMOTION"}function _e(t,e){let n=Lr(Vs);return he((e?.current?.$state||n||B3)[t])}var ke,UD,jD,HD,qD,BD,WD,KD,GD,YD,QD,XD,Y,aP,vc,pn,oP,lP,cP,Qt,Rn,Cs,kh,Th,D,ZD,gh,dP,pc,I_,LP,Aw,le,yh,iO,rO,sO,aO,oO,lO,cO,K,pP,hP,fP,un,uO,Vs,dO,au,Ga,mw,Ba,Ph,_h,Dr,gO,yO,wO,MO,LO,NO,Xi,$h,lu,Mh,gw,Rh,Fw,Lh,mc,Ih,Ah,FO,zO,dn,Nh,JP,_P,UO,wP,vw,jO,Dh,e1,t1,n1,i1,r1,s1,Oh,_c,a1,l1,Vh,Fh,uw,qO,BO,zh,yw,_w,Uh,ww,bw,WO,xw,kw,KO,jh,fn,GO,YO,Te,fe,QO,u1,Ew,Sw,JO,e3,t3,Qa,Hh,qh,Bh,Ka,n3,Wh,Kh,wc,it,i3,r3,s3,bc,Gh,Yh,Qh,Xh,Zh,Jh,ef,tf,nf,mf,SP,Pw,xc,gf,xi,Zi,Yi,bh,rf,Xa,sf,c3,u3,d3,Ms,p3,h3,f3,Za,Tc,Ec,Ja,m3,g3,vf,Ji,ut,v3,PP,Cw,y3,_3,cu,w3,er,b3,x3,k3,Rs,af,of,gc,Sc,$w,Fr,T3,E3,p1,eo,S3,P3,C3,to,$3,M3,qw,Ls,R3,L3,Bw,Is,I3,A3,Ww,As,N3,D3,Kw,Ns,O3,V3,Gw,Ds,lf,Mw,cf,Pc,Cc,F3,z3,Rw,Os,uf,$c,Mc,df,Rc,Lc,Ic,Ac,Nc,Dc,Oc,Vc,Fc,zc,Uc,jc,Hc,qc,Bc,Wc,Kc,Gc,Yc,Qc,Xc,Zc,Jc,eu,tu,nu,iu,ru,pf,no,su,h1,Lw,U3,q3,H,CP,B3,Yt=Ue(()=>{"use strict";"use client";ke=$(j(),1);At();jD=Symbol(0);UD=jD;HD=Symbol(0),qD=Symbol(0),BD=Symbol(0),WD=Symbol(0),KD=Symbol(0),GD=Symbol(0),YD=Symbol(0),QD=Symbol(0),XD=Symbol(0),Y={_add:HD,_remove:qD,_reset:BD,_select:WD,_readonly:KD,_setReadonly:GD,_onReset:YD,_onRemove:QD,_onUserSelect:XD},vc=class extends Ia{constructor(){super(...arguments),this._items=[],this[aP]=!1}get length(){return this._items.length}get readonly(){return this[Y._readonly]}toArray(){return[...this._items]}[(aP=Y._readonly,Symbol.iterator)](){return this._items.values()}[Y._add](e,n){let i=this._items.length;""+i in this||Object.defineProperty(this,i,{get(){return this._items[i]}}),!this._items.includes(e)&&(this._items.push(e),this.dispatchEvent(new q("add",{detail:e,trigger:n})))}[Y._remove](e,n){let i=this._items.indexOf(e);i>=0&&(this[Y._onRemove]?.(e,n),this._items.splice(i,1),this.dispatchEvent(new q("remove",{detail:e,trigger:n})))}[Y._reset](e){for(let n of[...this._items])this[Y._remove](n,e);this._items=[],this[Y._setReadonly](!1,e),this[Y._onReset]?.()}[Y._setReadonly](e,n){this[Y._readonly]!==e&&(this[Y._readonly]=e,this.dispatchEvent(new q("readonly-change",{detail:e,trigger:n})))}},pn={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},oP=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],lP=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],cP=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],Qt=typeof window<"u"&&typeof window.document<"u"?window.document:{},Rn="fullscreenEnabled"in Qt&&Object.keys(pn)||oP[0]in Qt&&oP||lP[0]in Qt&&lP||cP[0]in Qt&&cP||[],Cs={requestFullscreen:function(t){return t[Rn[pn.requestFullscreen]]()},requestFullscreenFunction:function(t){return t[Rn[pn.requestFullscreen]]},get exitFullscreen(){return Qt[Rn[pn.exitFullscreen]].bind(Qt)},get fullscreenPseudoClass(){return":"+Rn[pn.fullscreen]},addEventListener:function(t,e,n){return Qt.addEventListener(Rn[pn[t]],e,n)},removeEventListener:function(t,e,n){return Qt.removeEventListener(Rn[pn[t]],e,n)},get fullscreenEnabled(){return!!Qt[Rn[pn.fullscreenEnabled]]},set fullscreenEnabled(t){},get fullscreenElement(){return Qt[Rn[pn.fullscreenElement]]},set fullscreenElement(t){},get onfullscreenchange(){return Qt[("on"+Rn[pn.fullscreenchange]).toLowerCase()]},set onfullscreenchange(t){return Qt[("on"+Rn[pn.fullscreenchange]).toLowerCase()]=t},get onfullscreenerror(){return Qt[("on"+Rn[pn.fullscreenerror]).toLowerCase()]},set onfullscreenerror(t){return Qt[("on"+Rn[pn.fullscreenerror]).toLowerCase()]=t}},kh=Cs.fullscreenEnabled,Th=class extends Lt{constructor(){super(...arguments),this._listening=!1,this._active=!1}get active(){return this._active}get supported(){return kh}onConnect(){S(Cs,"fullscreenchange",this._onFullscreenChange.bind(this)),S(Cs,"fullscreenerror",this._onFullscreenError.bind(this)),G(this._onDisconnect.bind(this))}async _onDisconnect(){kh&&await this.exit()}_onFullscreenChange(e){let n=cw(this.el);n!==this._active&&(n||(this._listening=!1),this._active=n,this.dispatch("fullscreen-change",{detail:n,trigger:e}))}_onFullscreenError(e){this._listening&&(this.dispatch("fullscreen-error",{detail:null,trigger:e}),this._listening=!1)}async enter(){try{return this._listening=!0,!this.el||cw(this.el)?void 0:(uP(),Cs.requestFullscreen(this.el))}catch(e){throw this._listening=!1,e}}async exit(){if(!(!this.el||!cw(this.el)))return uP(),Cs.exitFullscreen()}};D=typeof document>"u",ZD=D?"":navigator?.userAgent.toLowerCase()||"",gh=!D&&/iphone|ipad|ipod|ios|crios|fxios/i.test(ZD),dP=!D&&/(iphone|ipod)/gi.test(navigator?.platform||""),pc=!D&&!!window.chrome,I_=!D&&(!!window.safari||gh);LP=class IP extends Lt{constructor(){super(...arguments),this._type=O(this._getScreenOrientation()),this._locked=O(!1)}get type(){return this._type()}get locked(){return this._locked()}get portrait(){return this._type().startsWith("portrait")}get landscape(){return this._type().startsWith("landscape")}get supported(){return IP.supported}onConnect(){if(this.supported)S(screen.orientation,"change",this._onOrientationChange.bind(this));else{let e=window.matchMedia("(orientation: landscape)");e.onchange=this._onOrientationChange.bind(this),G(()=>e.onchange=null)}G(this._onDisconnect.bind(this))}async _onDisconnect(){this.supported&&this._locked()&&await this.unlock()}_onOrientationChange(e){this._type.set(this._getScreenOrientation()),this.dispatch("orientation-change",{detail:{orientation:C(this._type),lock:this._currentLock},trigger:e})}async lock(e){C(this._locked)||this._currentLock===e||(this._assertScreenOrientationAPI(),await screen.orientation.lock(e),this._locked.set(!0),this._currentLock=e)}async unlock(){C(this._locked)&&(this._assertScreenOrientationAPI(),this._currentLock=void 0,await screen.orientation.unlock(),this._locked.set(!1))}_assertScreenOrientationAPI(){if(!this.supported)throw Error("[vidstack] no orientation API")}_getScreenOrientation(){return D?"portrait-primary":this.supported?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"}};LP.supported=Iw();Aw=LP,le=class{get length(){return this._ranges.length}constructor(e,n){qe(e)?this._ranges=e:!Le(e)&&!Le(n)?this._ranges=[[e,n]]:this._ranges=[]}start(e){return this._ranges[e][0]??1/0}end(e){return this._ranges[e][1]??1/0}};yh={};iO=Symbol(0),rO=Symbol(0),sO=Symbol(0),aO=Symbol(0),oO=Symbol(0),lO=Symbol(0),cO=Symbol(0),K={_crossOrigin:iO,_readyState:rO,_updateActiveCues:sO,_canLoad:aO,_onModeChange:oO,_native:lO,_nativeHLS:cO};un=class extends Ia{constructor(e){super(),this.id="",this.label="",this.language="",this.default=!1,this._canLoad=!1,this._currentTime=0,this._mode="disabled",this._metadata={},this._regions=[],this._cues=[],this._activeCues=[],this[pP]=0,this[hP]=null,this[fP]=null;for(let n of Object.keys(e))this[n]=e[n];this.type||(this.type="vtt"),!D&&e.content?Promise.resolve().then(()=>(cc(),lc)).then(({parseText:n,VTTCue:i,VTTRegion:r})=>{!U(e.content)||e.type==="json"?(this._parseJSON(e.content,i,r),this.readyState!==3&&this._readyState()):n(e.content,{type:e.type}).then(({cues:s,regions:a})=>{this._cues=s,this._regions=a,this._readyState()})}):e.src||(this[K._readyState]=2)}static createId(e){return`id::${e.type}-${e.kind}-${e.src??e.label}`}get metadata(){return this._metadata}get regions(){return this._regions}get cues(){return this._cues}get activeCues(){return this._activeCues}get readyState(){return this[K._readyState]}get mode(){return this._mode}set mode(e){this.setMode(e)}addCue(e,n){let i=0,r=this._cues.length;for(i=0;i<r&&!(e.endTime<=this._cues[i].startTime);i++);i===r?this._cues.push(e):this._cues.splice(i,0,e),n?.type!=="cuechange"&&this[K._native]?.track.addCue(e),this.dispatchEvent(new q("add-cue",{detail:e,trigger:n})),Sh(e,this._currentTime)&&this[K._updateActiveCues](this._currentTime,n)}removeCue(e,n){let i=this._cues.indexOf(e);if(i>=0){let r=this._activeCues.includes(e);this._cues.splice(i,1),this[K._native]?.track.removeCue(e),this.dispatchEvent(new q("remove-cue",{detail:e,trigger:n})),r&&this[K._updateActiveCues](this._currentTime,n)}}setMode(e,n){this._mode!==e&&(this._mode=e,e==="disabled"?(this._activeCues=[],this._activeCuesChanged()):this.readyState===2?this[K._updateActiveCues](this._currentTime,n):this._load(),this.dispatchEvent(new q("mode-change",{detail:this,trigger:n})),this[K._onModeChange]?.())}[(pP=K._readyState,hP=K._onModeChange,fP=K._native,K._updateActiveCues)](e,n){if(this._currentTime=e,this.mode==="disabled"||!this._cues.length)return;let i=[];for(let s=0,a=this._cues.length;s<a;s++){let o=this._cues[s];Sh(o,e)&&i.push(o)}let r=i.length!==this._activeCues.length;if(!r){for(let s=0;s<i.length;s++)if(!this._activeCues.includes(i[s])){r=!0;break}}this._activeCues=i,r&&this._activeCuesChanged(n)}[K._canLoad](){this._canLoad=!0,this._mode!=="disabled"&&this._load()}async _load(){if(!(!this._canLoad||!this.src||this[K._readyState]>0)){this[K._readyState]=1,this.dispatchEvent(new q("load-start"));try{let{parseResponse:e,VTTCue:n,VTTRegion:i}=await Promise.resolve().then(()=>(cc(),lc)),r=this[K._crossOrigin]?.(),s=fetch(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:Eh(r)});if(this.type==="json")this._parseJSON(await(await s).text(),n,i);else{let{errors:a,metadata:o,regions:l,cues:c}=await e(s,{type:this.type,encoding:this.encoding});if(a[0]?.code===0)throw a[0];this._metadata=o,this._regions=l,this._cues=c}this._readyState()}catch(e){this._errorState(e)}}}_readyState(){if(this[K._readyState]=2,!this.src||this.type!=="vtt"){let n=this[K._native]?.track;if(n)for(let i of this._cues)n.addCue(i)}let e=new q("load");this[K._updateActiveCues](this._currentTime,e),this.dispatchEvent(e)}_errorState(e){this[K._readyState]=3,this.dispatchEvent(new q("error",{detail:e}))}_parseJSON(e,n,i){try{let{regions:r,cues:s}=AP(e,n,i);this._regions=r,this._cues=s}catch(r){this._errorState(r)}}_activeCuesChanged(e){this.dispatchEvent(new q("cue-change",{trigger:e}))}},uO=/captions|subtitles/;Vs=new ei({artist:"",audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,buffered:new le,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:Iw(),canPictureInPicture:!1,canPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,controlsVisible:!1,crossOrigin:null,ended:!1,error:null,fullscreen:!1,loop:!1,logLevel:"silent",mediaType:"unknown",muted:!1,paused:!0,played:new le,playing:!1,playsInline:!1,pictureInPicture:!1,preload:"metadata",playbackRate:1,qualities:[],quality:null,autoQuality:!1,canSetQuality:!0,canSetPlaybackRate:!0,canSetVolume:!1,seekable:new le,seeking:!1,source:{src:"",type:""},sources:[],started:!1,textTracks:[],textTrack:null,get hasCaptions(){return this.textTracks.filter(We).length>0},volume:1,waiting:!1,realCurrentTime:0,get currentTime(){return this.clipStartTime>0?Math.max(0,Math.min(this.realCurrentTime-this.clipStartTime,this.duration)):this.realCurrentTime},providedDuration:-1,intrinsicDuration:0,get realDuration(){return this.providedDuration>0?this.providedDuration:this.intrinsicDuration},get duration(){return this.clipEndTime>0?this.clipEndTime-this.clipStartTime:Math.max(0,this.realDuration-this.clipStartTime)},get title(){return this.providedTitle||this.inferredTitle},get poster(){return this.providedPoster||this.inferredPoster},get viewType(){return this.providedViewType!=="unknown"?this.providedViewType:this.inferredViewType},get streamType(){return this.providedStreamType!=="unknown"?this.providedStreamType:this.inferredStreamType},get currentSrc(){return this.source},get bufferedStart(){let t=hw(this.buffered)??0;return Math.max(0,t-this.clipStartTime)},get bufferedEnd(){let t=fw(this.buffered)??0;return Math.min(this.duration,Math.max(0,t-this.clipStartTime))},get seekableStart(){let t=hw(this.seekable)??0;return Math.max(0,t-this.clipStartTime)},get seekableEnd(){let t=this.canPlay?fw(this.seekable)??1/0:0;return this.clipEndTime>0?Math.min(this.clipEndTime,Math.max(0,t-this.clipStartTime)):t},get seekableWindow(){return Math.max(0,this.seekableEnd-this.seekableStart)},canAirPlay:!1,canGoogleCast:!1,remotePlaybackState:"disconnected",remotePlaybackType:"none",remotePlaybackLoader:null,remotePlaybackInfo:null,get isAirPlayConnected(){return this.remotePlaybackType==="airplay"&&this.remotePlaybackState==="connected"},get isGoogleCastConnected(){return this.remotePlaybackType==="google-cast"&&this.remotePlaybackState==="connected"},pointer:"fine",orientation:"landscape",width:0,height:0,mediaWidth:0,mediaHeight:0,lastKeyboardAction:null,userBehindLiveEdge:!1,liveEdgeTolerance:10,minLiveDVRWindow:60,get canSeek(){return/unknown|on-demand|:dvr/.test(this.streamType)&&Number.isFinite(this.seekableWindow)&&(!this.live||/:dvr/.test(this.streamType)&&this.seekableWindow>=this.minLiveDVRWindow)},get live(){return this.streamType.includes("live")||!Number.isFinite(this.realDuration)},get liveEdgeStart(){return this.live&&Number.isFinite(this.seekableEnd)?Math.max(0,(this.liveSyncPosition??this.seekableEnd)-this.liveEdgeTolerance):0},get liveEdge(){return this.live&&(!this.canSeek||!this.userBehindLiveEdge&&this.currentTime>=this.liveEdgeStart)},get liveEdgeWindow(){return this.live&&Number.isFinite(this.seekableEnd)?this.seekableEnd-this.liveEdgeStart:0},autoPlaying:!1,providedTitle:"",inferredTitle:"",providedPoster:"",inferredPoster:"",inferredViewType:"unknown",providedViewType:"unknown",providedStreamType:"unknown",inferredStreamType:"unknown",liveSyncPosition:null}),dO=new Set(["audioTrack","audioTracks","autoPlayError","autoPlaying","autoQuality","buffered","canPlay","ended","error","inferredPoster","inferredStreamType","inferredTitle","intrinsicDuration","liveSyncPosition","paused","played","playing","qualities","quality","realCurrentTime","seekable","seeking","started","userBehindLiveEdge","waiting"]);au=yi();Ga=class{constructor(e=void 0){this._logger=e,this._target=null,this._player=null,this._prevTrackIndex=-1}setTarget(e){this._target=e}getPlayer(e){return this._player?this._player:((e??this._target)?.dispatchEvent(new q("find-media-player",{detail:n=>void(this._player=n),bubbles:!0,composed:!0})),this._player)}setPlayer(e){this._player=e}startLoading(e){this._dispatchRequest("media-start-loading",e)}startLoadingPoster(e){this._dispatchRequest("media-poster-start-loading",e)}requestAirPlay(e){this._dispatchRequest("media-airplay-request",e)}requestGoogleCast(e){this._dispatchRequest("media-google-cast-request",e)}play(e){this._dispatchRequest("media-play-request",e)}pause(e){this._dispatchRequest("media-pause-request",e)}mute(e){this._dispatchRequest("media-mute-request",e)}unmute(e){this._dispatchRequest("media-unmute-request",e)}enterFullscreen(e,n){this._dispatchRequest("media-enter-fullscreen-request",n,e)}exitFullscreen(e,n){this._dispatchRequest("media-exit-fullscreen-request",n,e)}lockScreenOrientation(e,n){this._dispatchRequest("media-orientation-lock-request",n,e)}unlockScreenOrientation(e){this._dispatchRequest("media-orientation-unlock-request",e)}enterPictureInPicture(e){this._dispatchRequest("media-enter-pip-request",e)}exitPictureInPicture(e){this._dispatchRequest("media-exit-pip-request",e)}seeking(e,n){this._dispatchRequest("media-seeking-request",n,e)}seek(e,n){this._dispatchRequest("media-seek-request",n,e)}seekToLiveEdge(e){this._dispatchRequest("media-live-edge-request",e)}changeVolume(e,n){this._dispatchRequest("media-volume-change-request",n,Math.max(0,Math.min(1,e)))}changeAudioTrack(e,n){this._dispatchRequest("media-audio-track-change-request",n,e)}changeQuality(e,n){this._dispatchRequest("media-quality-change-request",n,e)}requestAutoQuality(e){this.changeQuality(-1,e)}changeTextTrackMode(e,n,i){this._dispatchRequest("media-text-track-change-request",i,{index:e,mode:n})}changePlaybackRate(e,n){this._dispatchRequest("media-rate-change-request",n,e)}resumeControls(e){this._dispatchRequest("media-resume-controls-request",e)}pauseControls(e){this._dispatchRequest("media-pause-controls-request",e)}togglePaused(e){let n=this.getPlayer(e?.target);n&&(n.state.paused?this.play(e):this.pause(e))}toggleControls(e){let n=this.getPlayer(e?.target);n&&(n.controls.showing?n.controls.hide(0,e):n.controls.show(0,e))}toggleMuted(e){let n=this.getPlayer(e?.target);n&&(n.state.muted?this.unmute(e):this.mute(e))}toggleFullscreen(e,n){let i=this.getPlayer(n?.target);i&&(i.state.fullscreen?this.exitFullscreen(e,n):this.enterFullscreen(e,n))}togglePictureInPicture(e){let n=this.getPlayer(e?.target);n&&(n.state.pictureInPicture?this.exitPictureInPicture(e):this.enterPictureInPicture(e))}disableCaptions(e){let n=this.getPlayer(e?.target);if(!n)return;let i=n.state.textTracks,r=n.state.textTrack;if(r){let s=i.indexOf(r);this.changeTextTrackMode(s,"disabled",e)}}toggleCaptions(e){let n=this.getPlayer(e?.target);if(!n)return;let i=n.state.textTracks,r=n.state.textTrack;if(r){let s=i.indexOf(r);this.changeTextTrackMode(s,"disabled",e),this._prevTrackIndex=s}else{let s=this._prevTrackIndex;(!i[s]||!We(i[s]))&&(s=-1),s===-1&&(s=i.findIndex(a=>We(a)&&a.default)),s===-1&&(s=i.findIndex(a=>We(a))),s>=0&&this.changeTextTrackMode(s,"showing",e),this._prevTrackIndex=-1}}_dispatchRequest(e,n,i){let r=new q(e,{bubbles:!0,composed:!0,cancelable:!0,detail:i,trigger:n}),s=n?.target||null;s&&s instanceof B&&(s=s.el),s=!s||s===document||s===window||s===document.body||this._player?.el&&s instanceof Node&&!this._player.el.contains(s)?this._target??this.getPlayer()?.el:s??this._target,this._player?e==="media-play-request"&&!this._player.state.canLoad?s?.dispatchEvent(r):this._player.canPlayQueue._enqueue(e,()=>s?.dispatchEvent(r)):s?.dispatchEvent(r)}_noPlayerWarning(e){}},mw=Math.min,Ba=Math.max,Ph=Math.round,_h=Math.floor,Dr=t=>({x:t,y:t});gO=async(t,e,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e)),c=await a.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:d}=mP(c,i,l),p=i,h={},y=0;for(let v=0;v<o.length;v++){let{name:w,fn:m}=o[v],{x:f,y:g,data:x,reset:E}=await m({x:u,y:d,initialPlacement:i,placement:p,strategy:r,middlewareData:h,rects:c,platform:a,elements:{reference:t,floating:e}});u=f??u,d=g??d,h={...h,[w]:{...h[w],...x}},E&&y<=50&&(y++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(c=E.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:r}):E.rects),{x:u,y:d}=mP(c,p,l)),v=-1)}return{x:u,y:d,placement:p,strategy:r,middlewareData:h}};yO=Dr(0);wO=[":popover-open",":modal"];MO=async function(t){let e=this.getOffsetParent||KP,n=this.getDimensions;return{reference:$O(t.reference,await e(t.floating),t.strategy,t.floating),floating:{x:0,y:0,...await n(t.floating)}}};LO={convertOffsetParentRelativeRectToViewportRelativeRect:bO,getDocumentElement:tr,getClippingRect:PO,getOffsetParent:KP,getElementRects:MO,getClientRects:xO,getDimensions:CO,getScale:Wa,isElement:Qi,isRTL:RO};NO=(t,e,n)=>{let i=new Map,r={platform:LO,...n},s={...r.platform,_c:i};return gO(t,e,{...r,platform:s})};Xi=class extends Lt{},$h=class extends Xi{constructor(){super(...arguments),this._idleTimer=-2,this._pausedTracking=!1,this._hideOnMouseLeave=O(!1),this._isMouseOutside=O(!1),this._focusedItem=null,this.defaultDelay=2e3}get hideOnMouseLeave(){let{hideControlsOnMouseLeave:e}=this.$props;return this._hideOnMouseLeave()||e()}set hideOnMouseLeave(e){this._hideOnMouseLeave.set(e)}get showing(){return this.$state.controlsVisible()}show(e=0,n){this._clearIdleTimer(),this._pausedTracking||this._changeVisibility(!0,e,n)}hide(e=this.defaultDelay,n){this._clearIdleTimer(),this._pausedTracking||this._changeVisibility(!1,e,n)}pause(e){this._pausedTracking=!0,this._clearIdleTimer(),this._changeVisibility(!0,0,e)}resume(e){this._pausedTracking=!1,!this.$state.paused()&&this._changeVisibility(!1,this.defaultDelay,e)}onConnect(){b(this._watchMouse.bind(this)),b(this._watchPaused.bind(this));let e=this._onPlay.bind(this),n=this._onPause.bind(this);this.listen("can-play",i=>this.show(0,i)),this.listen("play",e),this.listen("pause",n),this.listen("auto-play-fail",n)}_watchMouse(){let{started:e,pointer:n,paused:i}=this.$state;if(!e()||n()!=="fine")return;let r=this.hideOnMouseLeave;(!r||!this._isMouseOutside())&&b(()=>{i()||this.listen("pointermove",this._onStopIdle.bind(this))}),r&&(this.listen("mouseenter",this._onMouseEnter.bind(this)),this.listen("mouseleave",this._onMouseLeave.bind(this)))}_watchPaused(){let{paused:e,started:n,autoPlayError:i}=this.$state;if(e()||i()&&!n())return;let r=this._onStopIdle.bind(this);b(()=>{let s=this.$state.pointer(),a=s==="coarse",o=[a?"touchend":"pointerup","keydown"];for(let l of o)this.listen(l,r,{passive:!1})})}_onPlay(e){this.show(0,e),this.hide(void 0,e)}_onPause(e){this.show(0,e)}_onMouseEnter(e){this._isMouseOutside.set(!1),this.show(0,e),this.hide(void 0,e)}_onMouseLeave(e){this._isMouseOutside.set(!0),this.hide(0,e)}_clearIdleTimer(){window.clearTimeout(this._idleTimer),this._idleTimer=-1}_onStopIdle(e){e.MEDIA_GESTURE||this._pausedTracking||Vw(e)||(qi(e)&&(e.key==="Escape"?(this.el?.focus(),this._focusedItem=null):this._focusedItem&&(e.preventDefault(),requestAnimationFrame(()=>{this._focusedItem?.focus(),this._focusedItem=null}))),this.show(0,e),this.hide(this.defaultDelay,e))}_changeVisibility(e,n,i){if(n===0){this._onChange(e,i);return}this._idleTimer=window.setTimeout(()=>{this.scope&&this._onChange(e&&!this._pausedTracking,i)},n)}_onChange(e,n){this.$state.controlsVisible()!==e&&(this.$state.controlsVisible.set(e),!e&&document.activeElement&&this.el?.contains(document.activeElement)&&(this._focusedItem=document.activeElement,requestAnimationFrame(()=>this.el?.focus())),this.dispatch("controls-change",{detail:e,trigger:n}))}},lu=OO;Mh=class{constructor(){this.playerId="vds-player",this.mediaId=null,this._data={volume:null,muted:null,time:null,lang:null,captions:null,rate:null},this.saveTime=lu(()=>{if(D||!this.mediaId)return;let e=(this._data.time??0).toString();localStorage.setItem(this.mediaId,e)},1e3)}async getVolume(){return this._data.volume}async setVolume(e){this._data.volume=e,this.save()}async getMuted(){return this._data.muted}async setMuted(e){this._data.muted=e,this.save()}async getTime(){return this._data.time}async setTime(e){this._data.time=e,this.saveTime()}async getLang(){return this._data.lang}async setLang(e){this._data.lang=e,this.save()}async getCaptions(){return this._data.captions}async setCaptions(e){this._data.captions=e,this.save()}async getPlaybackRate(){return this._data.rate}async setPlaybackRate(e){this._data.rate=e,this.save()}onChange(e,n,i="vds-player"){let r=i?localStorage.getItem(i):null,s=n?localStorage.getItem(n):null;this.playerId=i,this.mediaId=n,this._data={volume:null,muted:null,lang:null,captions:null,...r?JSON.parse(r):{},time:s?+s:null}}save(){if(D||!this.playerId)return;let e=JSON.stringify({...this._data,time:void 0});localStorage.setItem(this.playerId,e)}},gw=class{constructor(){this.priority=0,this._display=!0,this._video=null,this._track=null,this._tracks=new Set}canRender(e,n){return!!n}attach(e){this._video=e,e&&(e.textTracks.onchange=this._onChange.bind(this))}addTrack(e){this._tracks.add(e),this._attachTrack(e)}removeTrack(e){e[K._native]?.remove?.(),e[K._native]=null,this._tracks.delete(e)}changeTrack(e){let n=e?.[K._native];n&&n.track.mode!=="showing"&&(n.track.mode="showing"),this._track=e}setDisplay(e){this._display=e,this._onChange()}detach(){this._video&&(this._video.textTracks.onchange=null);for(let e of this._tracks)this.removeTrack(e);this._tracks.clear(),this._video=null,this._track=null}_attachTrack(e){var i;if(!this._video)return;let n=e[i=K._native]??(e[i]=this._createTrackElement(e));n instanceof HTMLElement&&(this._video.append(n),n.track.mode=n.default?"showing":"hidden")}_createTrackElement(e){let n=document.createElement("track"),i=e.default||e.mode==="showing",r=e.src&&e.type==="vtt";if(n.id=e.id,r)n.src=e.src;else{let s=function(){URL.revokeObjectURL(this.src),this.removeEventListener("load",s),this.removeEventListener("error",s)},a=new Blob([`WEBVTT
`],{type:"text/vtt"});n.src=URL.createObjectURL(a),n.addEventListener("load",s),n.addEventListener("error",s)}return n.label=e.label,n.kind=e.kind,n.default=i,e.language&&(n.srclang=e.language),i&&!r&&this._copyCues(e,n.track),n}_copyCues(e,n){if(!(e.src&&e.type==="vtt"||n.cues?.length))for(let i of e.cues)n.addCue(i)}_onChange(e){for(let n of this._tracks){let i=n[K._native]?.track;if(!i)continue;if(!this._display){i.mode="disabled";continue}let r=i.mode==="showing";r&&this._copyCues(n,i),n.setMode(r?"showing":"disabled",e)}}},Rh=class{constructor(e){this._media=e,this._video=null,this._renderers=[],this._nativeDisplay=!1,this._nativeRenderer=null,this._customRenderer=null;let n=e.textTracks;this._textTracks=n,b(this._watchControls.bind(this)),G(this._detach.bind(this)),S(n,"add",this._onAddTrack.bind(this)),S(n,"remove",this._onRemoveTrack.bind(this)),S(n,"mode-change",this._update.bind(this))}_watchControls(){let{$state:e,$iosControls:n}=this._media;this._nativeDisplay=e.controls()||n(),this._update()}add(e){this._renderers.push(e),this._update()}remove(e){e.detach(),this._renderers.splice(this._renderers.indexOf(e),1),this._update()}_attachVideo(e){requestAnimationFrame(()=>{if(this._video=e,e){this._nativeRenderer=new gw,this._nativeRenderer.attach(e);for(let n of this._textTracks)this._addNativeTrack(n)}this._update()})}_addNativeTrack(e){We(e)&&this._nativeRenderer?.addTrack(e)}_removeNativeTrack(e){We(e)&&this._nativeRenderer?.removeTrack(e)}_onAddTrack(e){this._addNativeTrack(e.detail)}_onRemoveTrack(e){this._removeNativeTrack(e.detail)}_update(){let e=this._textTracks.selected;if(this._video&&(this._nativeDisplay||e?.[K._nativeHLS])){this._customRenderer?.changeTrack(null),this._nativeRenderer?.setDisplay(!0),this._nativeRenderer?.changeTrack(e);return}if(this._nativeRenderer?.setDisplay(!1),this._nativeRenderer?.changeTrack(null),!e){this._customRenderer?.changeTrack(null);return}let n=this._renderers.sort((i,r)=>i.priority-r.priority).find(i=>i.canRender(e,this._video));this._customRenderer!==n&&(this._customRenderer?.detach(),n?.attach(this._video),this._customRenderer=n??null),n?.changeTrack(e)}_detach(){this._nativeRenderer?.detach(),this._nativeRenderer=null,this._customRenderer?.detach(),this._customRenderer=null}},Fw=VO;Lh=class extends vc{constructor(){super(),this._canLoad=!1,this._defaults={},this._storage=null,this._preferredLang=null,this._selectCaptions=Fw(async()=>{if(!this._canLoad||this.selected||await this._storage?.getCaptions()===!1)return;!this._preferredLang&&this._storage&&(this._preferredLang=await this._storage.getLang());let e=this._preferredLang&&this._items.find(i=>We(i)&&i.language===this._preferredLang),n=this._defaults.captions;e?e.mode="showing":n&&n&&(n.mode="showing"),this._storage?.setLang?.(this._preferredLang??n?.language??null)},300),this._onTrackModeChangeBind=this._onTrackModeChange.bind(this)}get selected(){return this._items.find(n=>n.mode==="showing"&&We(n))??null}get preferredLang(){return this._preferredLang}set preferredLang(e){this._preferredLang=e}add(e,n){let i=e instanceof un,r=i?e:new un(e),s=e.kind==="captions"||e.kind==="subtitles"?"captions":e.kind;return this._defaults[s]&&e.default&&delete e.default,r.addEventListener("mode-change",this._onTrackModeChangeBind),this[Y._add](r,n),r[K._crossOrigin]=this[K._crossOrigin],this._canLoad&&r[K._canLoad](),e.default&&(this._defaults[s]=r,s!=="captions"?r.mode="showing":this._selectCaptions()),this}remove(e,n){if(this._items.includes(e))return e===this._defaults[e.kind]&&delete this._defaults[e.kind],e.mode="disabled",e[K._onModeChange]=null,e.removeEventListener("mode-change",this._onTrackModeChangeBind),this[Y._remove](e,n),this}clear(e){for(let n of[...this._items])this.remove(n,e);return this}getById(e){return this._items.find(n=>n.id===e)??null}getByKind(e){let n=Array.isArray(e)?e:[e];return this._items.filter(i=>n.includes(i.kind))}[K._canLoad](){if(!this._canLoad){for(let e of this._items)e[K._canLoad]();this._canLoad=!0,this._selectCaptions()}}_onTrackModeChange(e){let n=e.detail;if(this._storage&&We(n)&&(this._storage.setCaptions?.(n.mode==="showing"),this._storage?.setLang?.(this._preferredLang??n?.language??null)),n.mode==="showing"){let i=We(n)?["captions","subtitles"]:[n.kind];for(let r of this._items)r.mode==="showing"&&r!=n&&i.includes(r.kind)&&(r.mode="disabled")}this.dispatchEvent(new q("mode-change",{detail:e.detail,trigger:e}))}setStorage(e){this._storage=e}},mc=Symbol(0),Ih=class extends vc{get selected(){return this._items.find(e=>e.selected)??null}get selectedIndex(){return this._items.findIndex(e=>e.selected)}[Y._onRemove](e,n){this[Y._select](e,!1,n)}[Y._add](e,n){e[mc]=!1,Object.defineProperty(e,"selected",{get(){return this[mc]},set:i=>{this.readonly||(this[Y._onUserSelect]?.(),this[Y._select](e,i))}}),super[Y._add](e,n)}[Y._select](e,n,i){if(n===e?.[mc])return;let r=this.selected;e&&(e[mc]=n),(n?r!==e:r===e)&&(r&&(r[mc]=!1),this.dispatchEvent(new q("change",{detail:{prev:r,current:this.selected},trigger:i})))}},Ah=class extends Ih{getById(e){return e===""?null:this._items.find(n=>n.id===e)??null}},FO=Symbol(0),zO=Symbol(0),dn={_setAuto:FO,_enableAuto:zO},Nh=class extends Ih{constructor(){super(...arguments),this._auto=!1,this.switch="current"}get auto(){return this._auto||this.readonly}[Y._onUserSelect](){this[dn._setAuto](!1)}[Y._onReset](e){this[dn._setAuto](!1,e)}autoSelect(e){this.readonly||this._auto||!this[dn._enableAuto]||(this[dn._enableAuto]?.(),this[dn._setAuto](!0,e))}[dn._setAuto](e,n){this._auto!==e&&(this._auto=e,this.dispatchEvent(new q("auto-change",{detail:e,trigger:n})))}};JP={togglePaused:"k Space",toggleMuted:"m",toggleFullscreen:"f",togglePictureInPicture:"i",toggleCaptions:"c",seekBackward:"j J ArrowLeft",seekForward:"l L ArrowRight",volumeUp:"ArrowUp",volumeDown:"ArrowDown",speedUp:">",slowDown:"<"},_P=new Set(["Shift","Alt","Meta","Control"]),UO='button, [role="button"]',wP='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]',vw=class extends Xi{constructor(e){super(),this._media=e,this._timeSlider=null}onConnect(){b(this._onTargetChange.bind(this))}_onTargetChange(){let{keyDisabled:e,keyTarget:n}=this.$props;if(e())return;let i=n()==="player"?this.el:document,r=O(!1);i===this.el?(this.listen("focusin",()=>r.set(!0)),this.listen("focusout",s=>{this.el.contains(s.target)||r.set(!1)})):(C(r)||r.set(document.querySelector("[data-media-player]")===this.el),S(document,"focusin",s=>{let a=s.composedPath().find(o=>o instanceof Element&&o.localName==="media-player");a!==void 0&&r.set(this.el===a)})),b(()=>{r()&&(S(i,"keyup",this._onKeyUp.bind(this)),S(i,"keydown",this._onKeyDown.bind(this)),S(i,"keydown",this._onPreventVideoKeys.bind(this),{capture:!0}))})}_onKeyUp(e){let n=document.activeElement;if(!e.key||!this.$state.canSeek()||n?.matches(wP))return;let{method:i,value:r}=this._getMatchingMethod(e);if(!U(r)&&!qe(r)){r?.callback(e);return}i?.startsWith("seek")&&(e.preventDefault(),e.stopPropagation(),this._timeSlider?(this._forwardTimeKeyboardEvent(e,i==="seekForward"),this._timeSlider=null):(this._media.remote.seek(this._seekTotal,e),this._seekTotal=void 0)),i?.startsWith("volume")&&this.el.querySelector("[data-media-volume-slider]")?.dispatchEvent(new KeyboardEvent("keyup",{key:i==="volumeUp"?"Up":"Down",shiftKey:e.shiftKey,trigger:e}))}_onKeyDown(e){if(!e.key||_P.has(e.key))return;let n=document.activeElement;if(n?.matches(wP)||Zl(e)&&n?.matches(UO))return;let{method:i,value:r}=this._getMatchingMethod(e);if(!U(r)&&!qe(r)){r?.callback(e);return}if(!i&&!e.metaKey&&/[0-9]/.test(e.key)){e.preventDefault(),e.stopPropagation(),this._media.remote.seek(this.$state.duration()/10*Number(e.key),e);return}if(i){switch(e.preventDefault(),e.stopPropagation(),i){case"seekForward":case"seekBackward":this._seeking(e,i,i==="seekForward");break;case"volumeUp":case"volumeDown":let s=this.el.querySelector("[data-media-volume-slider]");if(s)s.dispatchEvent(new KeyboardEvent("keydown",{key:i==="volumeUp"?"Up":"Down",shiftKey:e.shiftKey,trigger:e}));else{let o=e.shiftKey?.1:.05;this._media.remote.changeVolume(this.$state.volume()+(i==="volumeUp"?+o:-o),e)}break;case"toggleFullscreen":this._media.remote.toggleFullscreen("prefer-media",e);break;case"speedUp":case"slowDown":let a=this.$state.playbackRate();this._media.remote.changePlaybackRate(Math.max(.25,Math.min(2,a+(i==="speedUp"?.25:-.25))),e);break;default:this._media.remote[i]?.(e)}this.$state.lastKeyboardAction.set({action:i,event:e})}}_onPreventVideoKeys(e){ZP(e.target)&&this._getMatchingMethod(e).method&&e.preventDefault()}_getMatchingMethod(e){let n={...this.$props.keyShortcuts(),...this._media.ariaKeys},i=Object.keys(n).find(r=>{let s=n[r],a=qe(s)?s.join(" "):U(s)?s:s?.keys;return(qe(a)?a:a?.split(" "))?.some(o=>HO(o).replace(/Control/g,"Ctrl").split("+").every(l=>_P.has(l)?e[l.toLowerCase()+"Key"]:e.key===l.replace("Space"," ")))});return{method:i,value:i?n[i]:null}}_calcSeekAmount(e,n){let i=e.shiftKey?10:5;return this._seekTotal=Math.max(0,Math.min((this._seekTotal??this.$state.currentTime())+(n==="seekForward"?+i:-i),this.$state.duration()))}_forwardTimeKeyboardEvent(e,n){this._timeSlider?.dispatchEvent(new KeyboardEvent(e.type,{key:n?"Right":"Left",shiftKey:e.shiftKey,trigger:e}))}_seeking(e,n,i){this.$state.canSeek()&&(this._timeSlider||(this._timeSlider=this.el.querySelector("[data-media-time-slider]")),this._timeSlider?this._forwardTimeKeyboardEvent(e,i):this._media.remote.seeking(this._calcSeekAmount(e,n),e))}},jO=["!","@","#","$","%","^","&","*","(",")"];Dh=class extends Lt{constructor(e){super(),this._shortcut=e}onAttach(e){let{$props:n,ariaKeys:i}=ce(),r=e.getAttribute("aria-keyshortcuts");if(r){i[this._shortcut]=r,D||G(()=>{delete i[this._shortcut]});return}let s=n.keyShortcuts()[this._shortcut];if(s){let a=qe(s)?s.join(" "):U(s)?s:s?.keys;e.setAttribute("aria-keyshortcuts",qe(a)?a.join(" "):a)}}},e1=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,t1=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp4","audio/webm","audio/flac"]),n1=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,i1=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),r1=/\.(m3u8)($|\?)/i,s1=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]);Oh=class{constructor(){this.name="audio"}canPlay(e){return zw(e)?D||e.type==="?"||JD(this.target,e.type):!1}mediaType(){return"audio"}async load(e){if(D)throw Error("[vidstack] can not load audio provider server-side");return new(await Promise.resolve().then(()=>(HS(),jS))).AudioProvider(this.target,e)}},_c=class{constructor(){this.name="video"}canPlay(e){return Uw(e)?D||e.type==="?"||eO(this.target,e.type):!1}mediaType(){return"video"}async load(e){if(D)throw Error("[vidstack] can not load video provider server-side");return new(await Promise.resolve().then(()=>(H_(),qS))).VideoProvider(this.target,e)}},a1=class o1 extends _c{constructor(){super(...arguments),this.name="hls"}canPlay(e){return o1.supported&&Es(e)}async load(e){if(D)throw Error("[vidstack] can not load hls provider server-side");return new(await Promise.resolve().then(()=>(WS(),BS))).HLSProvider(this.target,e)}};a1.supported=uh();l1=a1,Vh=class{constructor(){this.name="vimeo"}preconnect(){let e=["https://i.vimeocdn.com","https://f.vimeocdn.com","https://fresnel.vimeocdn.com"];for(let n of e)ni(n)}canPlay(e){return U(e.src)&&e.type==="video/vimeo"}mediaType(){return"video"}async load(e){if(D)throw Error("[vidstack] can not load vimeo provider server-side");return new(await Promise.resolve().then(()=>(QS(),YS))).VimeoProvider(this.target,e)}async loadPoster(e,n,i){let{resolveVimeoVideoId:r,getVimeoVideoInfo:s}=await Promise.resolve().then(()=>(Q_(),GS));if(!U(e.src))return null;let{videoId:a}=r(e.src);return a?s(a,i).then(o=>o?o.poster:null):null}},Fh=class{constructor(){this.name="youtube"}preconnect(){let e=["https://www.google.com","https://i.ytimg.com","https://googleads.g.doubleclick.net","https://static.doubleclick.net"];for(let n of e)ni(n)}canPlay(e){return U(e.src)&&e.type==="video/youtube"}mediaType(){return"video"}async load(e){if(D)throw Error("[vidstack] can not load youtube provider server-side");return new(await Promise.resolve().then(()=>(JS(),ZS))).YouTubeProvider(this.target,e)}async loadPoster(e,n,i){let{findYouTubePoster:r,resolveYouTubeVideoId:s}=await Promise.resolve().then(()=>(ew(),XS)),a=U(e.src)&&s(e.src);return a?r(a,i):null}},uw=Symbol(0),qO=["autoPlay","canAirPlay","canFullscreen","canGoogleCast","canLoad","canLoadPoster","canPictureInPicture","canPlay","canSeek","ended","fullscreen","isAirPlayConnected","isGoogleCastConnected","live","liveEdge","loop","mediaType","muted","paused","pictureInPicture","playing","playsInline","remotePlaybackState","remotePlaybackType","seeking","started","streamType","viewType","waiting"],BO={artist:"",autoplay:!1,autoPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,currentTime:0,crossorigin:null,crossOrigin:null,duration:-1,fullscreenOrientation:"landscape",googleCast:{},load:"visible",posterLoad:"visible",logLevel:"silent",loop:!1,muted:!1,paused:!0,playsinline:!1,playsInline:!1,playbackRate:1,poster:"",preload:"metadata",preferNativeHLS:!1,src:"",title:"",controlsDelay:2e3,hideControlsOnMouseLeave:!1,viewType:"unknown",streamType:"unknown",volume:1,liveEdgeTolerance:10,minLiveDVRWindow:60,keyDisabled:!1,keyTarget:"player",keyShortcuts:JP,storage:null},zh=class extends Xi{constructor(e,n){super(),this._type=e,this._callback=n}async onAttach(e){if(D)return;let n=this.$props[this._type]();if(n==="eager")requestAnimationFrame(this._callback);else if(n==="idle")f_(this._callback);else if(n==="visible"){let i,r=new IntersectionObserver(s=>{this.scope&&s[0].isIntersecting&&(i?.(),i=void 0,this._callback())});r.observe(e),i=G(()=>r.disconnect())}}},yw=class{constructor(e,n){this._handle=e,this._media=n,this._notify=(i,...r)=>{D||this._handle(new q(i,{detail:r?.[0],trigger:r?.[1]}))}}async _ready(e,n){if(!D)return Na(async()=>{this._media;let{autoPlay:i,canPlay:r,started:s,duration:a,seekable:o,buffered:l,remotePlaybackInfo:c,playsInline:u}=this._media.$state;if(r())return;let d={duration:e?.duration??a(),seekable:e?.seekable??o(),buffered:e?.buffered??l(),provider:this._media.$provider()};this._notify("can-play",d,n),ti();let p=this._media.$provider(),{storage:h}=this._media,{muted:y,volume:v,clipStartTime:w,playbackRate:m}=this._media.$props,f=c()?.savedState?.currentTime,g=c()?.savedState?.paused===!1,x=f??await h?.getTime()??w(),E=g||i();p&&(p.setVolume(await h?.getVolume()??v()),p.setMuted(await h?.getMuted()??y()),p.setPlaybackRate?.(await h?.getPlaybackRate()??m()),p.setPlaysInline?.(u()),x>0&&p.setCurrentTime(x)),r()&&E&&!s()&&await this._attemptAutoplay(n),c.set(null)})}async _attemptAutoplay(e){let{player:n,$state:{autoPlaying:i,muted:r}}=this._media;i.set(!0);let s=new q("auto-play-attempt",{trigger:e});try{await n.play(s)}catch{}}},_w=class{constructor(){this._queue=new Map}_enqueue(e,n){this._queue.set(e,n)}_serve(e){let n=this._peek(e);return this._queue.delete(e),n}_peek(e){return this._queue.get(e)}_delete(e){this._queue.delete(e)}_clear(){this._queue.clear()}},Uh=class{constructor(){this._serving=!1,this._pending=Bi(),this._queue=new Map}get _size(){return this._queue.size}get _isServing(){return this._serving}async _waitForFlush(){this._serving||await this._pending.promise}_enqueue(e,n){if(this._serving){n();return}this._queue.delete(e),this._queue.set(e,n)}_serve(e){this._queue.get(e)?.(),this._queue.delete(e)}_start(){this._flush(),this._serving=!0,this._queue.size>0&&this._flush()}_stop(){this._serving=!1}_reset(){this._stop(),this._queue.clear(),this._release()}_flush(){for(let e of this._queue.keys())this._serve(e);this._release()}_release(){this._pending.resolve(),this._pending=Bi()}};ww=class extends Xi{constructor(e,n,i){super(),this._stateMgr=e,this._request=n,this._media=i,this._providerQueue=new Uh,this._wasPIPActive=!1,this._$provider=i.$provider,this._controls=new $h,this._fullscreen=new Th,this._orientation=new Aw}onAttach(){this.listen("fullscreen-change",this._onFullscreenChange.bind(this))}onConnect(){let e=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=this._handleRequest.bind(this);for(let i of e)i.startsWith("media-")&&this.listen(i,n);this._attachLoadPlayListener(),b(this._watchProvider.bind(this)),b(this._onControlsDelayChange.bind(this)),b(this._onAirPlaySupportChange.bind(this)),b(this._onGoogleCastSupportChange.bind(this)),b(this._onFullscreenSupportChange.bind(this)),b(this._onPiPSupportChange.bind(this))}onDestroy(){this._providerQueue._reset()}_attachLoadPlayListener(){let{load:e}=this.$props,{canLoad:n}=this.$state;if(e()!=="play"||n())return;let i=this.listen("media-play-request",r=>{this._handleLoadPlayStrategy(r),i()})}_watchProvider(){let e=this._$provider(),n=this.$state.canPlay();return e&&n&&this._providerQueue._start(),()=>{this._providerQueue._stop()}}_handleRequest(e){e.stopPropagation(),!e.defaultPrevented&&this[e.type]&&(C(this._$provider)?this[e.type](e):this._providerQueue._enqueue(e.type,()=>{C(this._$provider)&&this[e.type](e)}))}async _play(e){if(D)return;let{canPlay:n,paused:i,autoPlaying:r}=this.$state;if(!this._handleLoadPlayStrategy(e)&&!(!C(i)&&!this._request._looping)){e&&this._request._queue._enqueue("media-play-request",e);try{let s=C(this._$provider);return dw(s,C(n)),await s.play()}catch(s){let a=this.createEvent("play-fail",{detail:wi(s),trigger:e});throw a.autoPlay=r(),this._stateMgr._handle(a),s}}}_handleLoadPlayStrategy(e){let{load:n}=this.$props,{canLoad:i}=this.$state;if(n()==="play"&&!i()){let r=this.createEvent("media-start-loading",{trigger:e});return this.dispatchEvent(r),this._providerQueue._enqueue("media-play-request",async()=>{try{await this._play(r)}catch{}}),!0}return!1}async _pause(e){if(D)return;let{canPlay:n,paused:i}=this.$state;if(!C(i)){e&&this._request._queue._enqueue("media-pause-request",e);try{let r=C(this._$provider);return dw(r,C(n)),await r.pause()}catch(r){throw this._request._queue._delete("media-pause-request"),r}}}_seekToLiveEdge(e){if(D)return;let{canPlay:n,live:i,liveEdge:r,canSeek:s,liveSyncPosition:a,seekableEnd:o,userBehindLiveEdge:l}=this.$state;if(l.set(!1),C(()=>!i()||r()||!s()))return;let c=C(this._$provider);dw(c,C(n)),e&&this._request._queue._enqueue("media-seek-request",e);let u=o()-2;c.setCurrentTime(Math.min(u,a()??u))}async _enterFullscreen(e="prefer-media",n){if(D)return;let i=this._getFullscreenAdapter(e);if(bP(e,i),!i.active)return C(this.$state.pictureInPicture)&&(this._wasPIPActive=!0,await this._exitPictureInPicture(n)),n&&this._request._queue._enqueue("media-enter-fullscreen-request",n),i.enter()}async _exitFullscreen(e="prefer-media",n){if(D)return;let i=this._getFullscreenAdapter(e);if(bP(e,i),!!i.active){n&&this._request._queue._enqueue("media-exit-fullscreen-request",n);try{let r=await i.exit();return this._wasPIPActive&&C(this.$state.canPictureInPicture)&&await this._enterPictureInPicture(),r}finally{this._wasPIPActive=!1}}}_getFullscreenAdapter(e){let n=C(this._$provider);return e==="prefer-media"&&this._fullscreen.supported||e==="media"?this._fullscreen:n?.fullscreen}async _enterPictureInPicture(e){if(!D&&(this._throwIfPIPNotSupported(),!this.$state.pictureInPicture()))return e&&this._request._queue._enqueue("media-enter-pip-request",e),await this._$provider().pictureInPicture.enter()}async _exitPictureInPicture(e){if(!D&&(this._throwIfPIPNotSupported(),!!this.$state.pictureInPicture()))return e&&this._request._queue._enqueue("media-exit-pip-request",e),await this._$provider().pictureInPicture.exit()}_throwIfPIPNotSupported(){if(!this.$state.canPictureInPicture())throw Error("[vidstack] no pip support")}_onControlsDelayChange(){this._controls.defaultDelay=this.$props.controlsDelay()}_onAirPlaySupportChange(){let{canAirPlay:e}=this.$state,n=!!this._$provider()?.airPlay?.supported;e.set(n)}_onGoogleCastSupportChange(){let{canGoogleCast:e,source:n}=this.$state,i=pc&&!gh&&vh(n());e.set(i)}_onFullscreenSupportChange(){let{canFullscreen:e}=this.$state,n=this._fullscreen.supported||!!this._$provider()?.fullscreen?.supported;e.set(n)}_onPiPSupportChange(){let{canPictureInPicture:e}=this.$state,n=!!this._$provider()?.pictureInPicture?.supported;e.set(n)}async"media-airplay-request"(e){try{await this._requestAirPlay(e)}catch{}}async _requestAirPlay(e){try{let n=this._$provider()?.airPlay;if(!n?.supported)throw Error("No AirPlay adapter.");return e&&this._request._queue._enqueue("media-airplay-request",e),await n.prompt()}catch(n){throw this._request._queue._delete("media-airplay-request"),n}}async"media-google-cast-request"(e){try{await this._requestGoogleCast(e)}catch{}}async _requestGoogleCast(e){try{let{canGoogleCast:n}=this.$state;if(!C(n))throw new Error("Cast not available.");if(ni("https://www.gstatic.com"),!this._googleCastLoader){let r=await Promise.resolve().then(()=>(ow(),rP)).then(function(s){return s.d});this._googleCastLoader=new r.GoogleCastLoader}await this._googleCastLoader.prompt(this._media),e&&this._request._queue._enqueue("media-google-cast-request",e);let i=C(this.$state.remotePlaybackState)!=="disconnected";i&&this.$state.remotePlaybackInfo.set(r=>({...r,savedState:{paused:C(this.$state.paused),currentTime:C(this.$state.currentTime)}})),this.$state.remotePlaybackLoader.set(i?this._googleCastLoader:null)}catch(n){throw this._request._queue._delete("media-google-cast-request"),n}}"media-audio-track-change-request"(e){if(this._media.audioTracks.readonly)return;let n=e.detail,i=this._media.audioTracks[n];if(i){let r=e.type;this._request._queue._enqueue(r,e),i.selected=!0}}async"media-enter-fullscreen-request"(e){try{await this._enterFullscreen(e.detail,e)}catch(n){this._onFullscreenError(n,e)}}async"media-exit-fullscreen-request"(e){try{await this._exitFullscreen(e.detail,e)}catch(n){this._onFullscreenError(n,e)}}async _onFullscreenChange(e){let n=C(this.$props.fullscreenOrientation),i=e.detail;if(!(Le(n)||!this._orientation.supported))if(i){if(this._orientation.locked)return;this.dispatch("media-orientation-lock-request",{detail:n,trigger:e})}else this._orientation.locked&&this.dispatch("media-orientation-unlock-request",{trigger:e})}_onFullscreenError(e,n){this._stateMgr._handle(this.createEvent("fullscreen-error",{detail:wi(e)}))}async"media-orientation-lock-request"(e){let n=e.type;try{this._request._queue._enqueue(n,e),await this._orientation.lock(e.detail)}catch{this._request._queue._delete(n)}}async"media-orientation-unlock-request"(e){let n=e.type;try{this._request._queue._enqueue(n,e),await this._orientation.unlock()}catch{this._request._queue._delete(n)}}async"media-enter-pip-request"(e){try{await this._enterPictureInPicture(e)}catch(n){this._onPictureInPictureError(n,e)}}async"media-exit-pip-request"(e){try{await this._exitPictureInPicture(e)}catch(n){this._onPictureInPictureError(n,e)}}_onPictureInPictureError(e,n){this._stateMgr._handle(this.createEvent("picture-in-picture-error",{detail:wi(e)}))}"media-live-edge-request"(e){let{live:n,liveEdge:i,canSeek:r}=this.$state;if(!(!n()||i()||!r())){this._request._queue._enqueue("media-seek-request",e);try{this._seekToLiveEdge()}catch{this._request._queue._delete("media-seek-request")}}}async"media-loop-request"(e){try{this._request._looping=!0,this._request._replaying=!0,await this._play(e)}catch{this._request._looping=!1}}async"media-pause-request"(e){if(!this.$state.paused())try{await this._pause(e)}catch{}}async"media-play-request"(e){if(this.$state.paused())try{await this._play(e)}catch{}}"media-rate-change-request"(e){let{playbackRate:n,canSetPlaybackRate:i}=this.$state;if(n()===e.detail||!i())return;let r=this._$provider();r?.setPlaybackRate&&(this._request._queue._enqueue("media-rate-change-request",e),r.setPlaybackRate(e.detail))}"media-quality-change-request"(e){if(this._media.qualities.readonly)return;this._request._queue._enqueue("media-quality-change-request",e);let n=e.detail;if(n<0)this._media.qualities.autoSelect(e);else{let i=this._media.qualities[n];i&&(i.selected=!0)}}"media-pause-controls-request"(e){let n=e.type;this._request._queue._enqueue(n,e),this._controls.pause(e)}"media-resume-controls-request"(e){let n=e.type;this._request._queue._enqueue(n,e),this._controls.resume(e)}"media-seek-request"(e){let{seekableStart:n,seekableEnd:i,ended:r,canSeek:s,live:a,userBehindLiveEdge:o,clipStartTime:l}=this.$state;r()&&(this._request._replaying=!0);let c=e.type;this._request._seeking=!1,this._request._queue._delete(c);let u=Math.min(Math.max(n()+.1,e.detail+l()),i()-.1);!Number.isFinite(u)||!s()||(this._request._queue._enqueue(c,e),this._$provider().setCurrentTime(u),a()&&e.isOriginTrusted&&Math.abs(i()-u)>=2&&o.set(!0))}"media-seeking-request"(e){let n=e.type;this._request._queue._enqueue(n,e),this.$state.seeking.set(!0),this._request._seeking=!0}"media-start-loading"(e){if(this.$state.canLoad())return;let n=e.type;this._request._queue._enqueue(n,e),this._stateMgr._handle(this.createEvent("can-load"))}"media-poster-start-loading"(e){if(this.$state.canLoadPoster())return;let n=e.type;this._request._queue._enqueue(n,e),this._stateMgr._handle(this.createEvent("can-load-poster"))}"media-text-track-change-request"(e){let{index:n,mode:i}=e.detail,r=this._media.textTracks[n];if(r){let s=e.type;this._request._queue._enqueue(s,e),r.setMode(i,e)}}"media-mute-request"(e){if(this.$state.muted())return;let n=e.type;this._request._queue._enqueue(n,e),this._$provider().setMuted(!0)}"media-unmute-request"(e){let{muted:n,volume:i}=this.$state;if(!n())return;let r=e.type;this._request._queue._enqueue(r,e),this._media.$provider().setMuted(!1),i()===0&&(this._request._queue._enqueue(r,e),this._$provider().setVolume(.25))}"media-volume-change-request"(e){let{muted:n,volume:i}=this.$state,r=e.detail;if(i()===r)return;let s=e.type;this._request._queue._enqueue(s,e),this._$provider().setVolume(r),r>0&&n()&&(this._request._queue._enqueue(s,e),this._$provider().setMuted(!1))}_logError(e,n,i){}};bw=class{constructor(){this._seeking=!1,this._looping=!1,this._replaying=!1,this._queue=new _w}},WO=new Set(["auto-play","auto-play-fail","can-load","sources-change","source-change","load-start","abort","error","loaded-metadata","loaded-data","can-play","play","play-fail","pause","playing","seeking","seeked","waiting"]),xw=class extends Xi{constructor(e,n){super(),this._request=e,this._media=n,this._trackedEvents=new Map,this._clipEnded=!1,this._firingWaiting=!1,this._isPlayingOnDisconnect=!1,this.seeking=lu(i=>{let{seeking:r,realCurrentTime:s,paused:a}=this.$state;r.set(!0),s.set(i.detail),this._satisfyRequest("media-seeking-request",i),a()&&(this._waitingTrigger=i,this._fireWaiting())},150,{leading:!0}),this._fireWaiting=Fw(()=>{if(!this._waitingTrigger)return;this._firingWaiting=!0;let{waiting:i,playing:r}=this.$state;i.set(!0),r.set(!1);let s=this.createEvent("waiting",{trigger:this._waitingTrigger});this._trackedEvents.set("waiting",s),this.dispatch(s),this._waitingTrigger=void 0,this._firingWaiting=!1},300)}onAttach(e){e.setAttribute("aria-busy","true"),this.listen("fullscreen-change",this["fullscreen-change"].bind(this)),this.listen("fullscreen-error",this["fullscreen-error"].bind(this)),this.listen("orientation-change",this["orientation-change"].bind(this))}onConnect(e){b(this._watchCanSetVolume.bind(this)),this._addTextTrackListeners(),this._addQualityListeners(),this._addAudioTrackListeners(),this._resumePlaybackOnConnect(),G(this._pausePlaybackOnDisconnect.bind(this))}_handle(e){if(!this.scope)return;let n=e.type;this[e.type]?.(e),D||(WO.has(n)&&this._trackedEvents.set(n,e),this.dispatch(e))}_resumePlaybackOnConnect(){this._isPlayingOnDisconnect&&(requestAnimationFrame(()=>{this.scope&&this._media.remote.play(new q("dom-connect"))}),this._isPlayingOnDisconnect=!1)}_pausePlaybackOnDisconnect(){this._isPlayingOnDisconnect||(this._isPlayingOnDisconnect=!this._media.$state.paused(),this._media.$provider()?.pause())}_resetTracking(){this._stopWaiting(),this._clipEnded=!1,this._request._replaying=!1,this._request._looping=!1,this._firingWaiting=!1,this._waitingTrigger=void 0,this._trackedEvents.clear()}_satisfyRequest(e,n){let i=this._request._queue._serve(e);i&&(n.request=i,n.triggers.add(i))}_addTextTrackListeners(){this._onTextTracksChange(),this._onTextTrackModeChange();let e=this._media.textTracks;S(e,"add",this._onTextTracksChange.bind(this)),S(e,"remove",this._onTextTracksChange.bind(this)),S(e,"mode-change",this._onTextTrackModeChange.bind(this))}_addQualityListeners(){let e=this._media.qualities;S(e,"add",this._onQualitiesChange.bind(this)),S(e,"remove",this._onQualitiesChange.bind(this)),S(e,"change",this._onQualityChange.bind(this)),S(e,"auto-change",this._onAutoQualityChange.bind(this)),S(e,"readonly-change",this._onCanSetQualityChange.bind(this))}_addAudioTrackListeners(){let e=this._media.audioTracks;S(e,"add",this._onAudioTracksChange.bind(this)),S(e,"remove",this._onAudioTracksChange.bind(this)),S(e,"change",this._onAudioTrackChange.bind(this))}_onTextTracksChange(e){let{textTracks:n}=this.$state;n.set(this._media.textTracks.toArray()),this.dispatch("text-tracks-change",{detail:n(),trigger:e})}_onTextTrackModeChange(e){e&&this._satisfyRequest("media-text-track-change-request",e);let n=this._media.textTracks.selected,{textTrack:i}=this.$state;i()!==n&&(i.set(n),this.dispatch("text-track-change",{detail:n,trigger:e}))}_onAudioTracksChange(e){let{audioTracks:n}=this.$state;n.set(this._media.audioTracks.toArray()),this.dispatch("audio-tracks-change",{detail:n(),trigger:e})}_onAudioTrackChange(e){let{audioTrack:n}=this.$state;n.set(this._media.audioTracks.selected),e&&this._satisfyRequest("media-audio-track-change-request",e),this.dispatch("audio-track-change",{detail:n(),trigger:e})}_onQualitiesChange(e){let{qualities:n}=this.$state;n.set(this._media.qualities.toArray()),this.dispatch("qualities-change",{detail:n(),trigger:e})}_onQualityChange(e){let{quality:n}=this.$state;n.set(this._media.qualities.selected),e&&this._satisfyRequest("media-quality-change-request",e),this.dispatch("quality-change",{detail:n(),trigger:e})}_onAutoQualityChange(){this.$state.autoQuality.set(this._media.qualities.auto)}_onCanSetQualityChange(){this.$state.canSetQuality.set(!this._media.qualities.readonly)}_watchCanSetVolume(){let{canSetVolume:e,isGoogleCastConnected:n}=this.$state;if(n()){e.set(!1);return}RP().then(e.set)}"provider-change"(e){let n=this._media.$provider(),i=e.detail;n?.type!==i?.type&&(n?.destroy?.(),n?.scope?.dispose(),this._media.$provider.set(e.detail),n&&e.detail===null&&this._resetMediaState(e))}"provider-loader-change"(e){}"auto-play"(e){this.$state.autoPlayError.set(null)}"auto-play-fail"(e){this.$state.autoPlayError.set(e.detail),this._resetTracking()}"can-load"(e){this.$state.canLoad.set(!0),this._trackedEvents.set("can-load",e),this._media.textTracks[K._canLoad](),this._satisfyRequest("media-start-loading",e)}"can-load-poster"(e){this.$state.canLoadPoster.set(!0),this._trackedEvents.set("can-load-poster",e),this._satisfyRequest("media-poster-start-loading",e)}"media-type-change"(e){let n=this._trackedEvents.get("source-change");n&&e.triggers.add(n);let i=this.$state.viewType();this.$state.mediaType.set(e.detail);let r=this.$state.providedViewType(),s=r==="unknown"?e.detail:r;i!==s&&(D?this.$state.inferredViewType.set(s):setTimeout(()=>{requestAnimationFrame(()=>{this.scope&&(this.$state.inferredViewType.set(e.detail),this.dispatch("view-type-change",{detail:s,trigger:e}))})},0))}"stream-type-change"(e){let n=this._trackedEvents.get("source-change");n&&e.triggers.add(n);let{streamType:i,inferredStreamType:r}=this.$state;r.set(e.detail),e.detail=i()}"rate-change"(e){let{storage:n}=this._media,{canPlay:i}=this.$state;this.$state.playbackRate.set(e.detail),this._satisfyRequest("media-rate-change-request",e),i()&&n?.setPlaybackRate?.(e.detail)}"remote-playback-change"(e){let{remotePlaybackState:n,remotePlaybackType:i}=this.$state,{type:r,state:s}=e.detail,a=s==="connected";i.set(r),n.set(s);let o=r==="airplay"?"media-airplay-request":"media-google-cast-request";if(a)this._satisfyRequest(o,e);else{let l=this._request._queue._peek(o);l&&(e.request=l,e.triggers.add(l))}}"sources-change"(e){this.$state.sources.set(e.detail)}"source-change"(e){let n=this._trackedEvents.get("sources-change");n&&e.triggers.add(n),this._resetMediaState(e),this._trackedEvents.set(e.type,e),this.$state.source.set(e.detail),this.el?.setAttribute("aria-busy","true")}_resetMediaState(e){this._media.audioTracks[Y._reset](e),this._media.qualities[Y._reset](e),this._resetTracking(),NP(this._media.$state)}abort(e){let n=this._trackedEvents.get("source-change");n&&e.triggers.add(n);let i=this._trackedEvents.get("can-load");i&&!e.triggers.hasType("can-load")&&e.triggers.add(i)}"load-start"(e){let n=this._trackedEvents.get("source-change");n&&e.triggers.add(n)}error(e){this.$state.error.set(e.detail);let n=this._trackedEvents.get("abort");n&&e.triggers.add(n)}"loaded-metadata"(e){let n=this._trackedEvents.get("load-start");n&&e.triggers.add(n)}"loaded-data"(e){let n=this._trackedEvents.get("load-start");n&&e.triggers.add(n)}"can-play"(e){let n=this._trackedEvents.get("loaded-metadata");n&&e.triggers.add(n),this._onCanPlayDetail(e.detail),this.el?.setAttribute("aria-busy","false")}"can-play-through"(e){this._onCanPlayDetail(e.detail);let n=this._trackedEvents.get("can-play");n&&e.triggers.add(n)}_onCanPlayDetail(e){let{seekable:n,seekableEnd:i,buffered:r,intrinsicDuration:s,canPlay:a}=this.$state;a.set(!0),r.set(e.buffered),n.set(e.seekable),s.set(i())}"duration-change"(e){let{live:n,intrinsicDuration:i}=this.$state,r=e.detail;n()||i.set(Number.isNaN(r)?0:r)}progress(e){let{buffered:n,seekable:i,live:r,intrinsicDuration:s,seekableEnd:a}=this.$state,o=e.detail;n.set(o.buffered),i.set(o.seekable),r()&&(s.set(a),this.dispatch("duration-change",{detail:a(),trigger:e}))}play(e){let{paused:n,autoPlayError:i,ended:r,autoPlaying:s,playsInline:a,pointer:o,muted:l,viewType:c}=this.$state;if(this._resetPlaybackIfNeeded(),!n()&&!this._request._looping){e.stopImmediatePropagation();return}e.autoPlay=s();let u=this._trackedEvents.get("waiting");u&&e.triggers.add(u),this._satisfyRequest("media-play-request",e),this._trackedEvents.set("play",e),n.set(!1),i.set(null),e.autoPlay&&(this._handle(this.createEvent("auto-play",{detail:{muted:l()},trigger:e})),s.set(!1)),(r()||this._request._replaying)&&(this._request._replaying=!1,r.set(!1),this._handle(this.createEvent("replay",{trigger:e}))),!a()&&c()==="video"&&o()==="coarse"&&this._media.remote.enterFullscreen("prefer-media",e),this._request._looping&&e.stopImmediatePropagation()}_resetPlaybackIfNeeded(e){if(!C(this._media.$provider))return;let{ended:i,seekableStart:r,clipStartTime:s,clipEndTime:a,realCurrentTime:o,duration:l}=this.$state,c=o()<s()||a()>0&&o()>=a()||Math.abs(o()-l())<.1||i();return c&&this.dispatch("media-seek-request",{detail:(s()>0?0:r())+.1,trigger:e}),c}"play-fail"(e){let{muted:n,autoPlaying:i}=this.$state,r=this._trackedEvents.get("play");r&&e.triggers.add(r),this._satisfyRequest("media-play-request",e);let{paused:s,playing:a}=this.$state;s.set(!0),a.set(!1),this._resetTracking(),this._trackedEvents.set("play-fail",e),e.autoPlay&&(this._handle(this.createEvent("auto-play-fail",{detail:{muted:n(),error:e.detail},trigger:e})),i.set(!1))}playing(e){let n=this._trackedEvents.get("play"),i=this._trackedEvents.get("seeked");n?e.triggers.add(n):i&&e.triggers.add(i),setTimeout(()=>this._resetTracking(),0);let{paused:r,playing:s,live:a,liveSyncPosition:o,seekableEnd:l,started:c,currentTime:u,seeking:d,ended:p}=this.$state;if(r.set(!1),s.set(!0),d.set(!1),p.set(!1),this._request._looping){e.stopImmediatePropagation(),this._request._looping=!1;return}if(a()&&!c()&&u()===0){let h=o()??l()-2;Number.isFinite(h)&&this._media.$provider().setCurrentTime(h)}this.started(e)}started(e){let{started:n}=this.$state;n()||(n.set(!0),this._handle(this.createEvent("started",{trigger:e})))}pause(e){this.el?.isConnected||(this._isPlayingOnDisconnect=!0),this._satisfyRequest("media-pause-request",e);let n=this._trackedEvents.get("seeked");if(n&&e.triggers.add(n),this._clipEnded){e.stopImmediatePropagation(),this._handle(this.createEvent("end",{trigger:e})),this._clipEnded=!1;return}if(this._request._looping){e.stopImmediatePropagation();return}this._resetTracking();let{paused:i,playing:r}=this.$state;i.set(!0),r.set(!1)}"time-update"(e){if(this._request._looping){e.stopImmediatePropagation();return}let{realCurrentTime:n,played:i,waiting:r,clipEndTime:s,loop:a}=this.$state,o=s(),l=e.detail;n.set(l.currentTime),i.set(l.played),r.set(!1);for(let c of this._media.textTracks)c[K._updateActiveCues](l.currentTime,e);o>0&&l.currentTime>=o&&(a()&&(this._request._looping=!0),this._clipEnded=!0,this.dispatch("media-pause-request",{trigger:e})),this._saveTime()}_saveTime(){let{storage:e}=this._media,{canPlay:n,realCurrentTime:i}=this.$state;n()&&e?.setTime?.(i())}"volume-change"(e){let{storage:n}=this._media,{volume:i,muted:r,canPlay:s}=this.$state,a=e.detail;i.set(a.volume),r.set(a.muted||a.volume===0),this._satisfyRequest("media-volume-change-request",e),this._satisfyRequest(a.muted?"media-mute-request":"media-unmute-request",e),s()&&(n?.setVolume?.(i()),n?.setMuted?.(r()))}seeked(e){let{seeking:n,realCurrentTime:i,paused:r,duration:s,ended:a}=this.$state;if(this._request._seeking)n.set(!0),e.stopImmediatePropagation();else if(n()){let o=this._trackedEvents.get("waiting");o&&e.triggers.add(o);let l=this._trackedEvents.get("seeking");l&&!e.triggers.has(l)&&e.triggers.add(l),r()&&this._stopWaiting(),n.set(!1),e.detail!==s()&&a.set(!1),i.set(e.detail),this._satisfyRequest("media-seek-request",e);let c=e?.originEvent;c?.isTrusted&&!/seek/.test(c.type)&&this.started(e)}}waiting(e){this._firingWaiting||this._request._seeking||(e.stopImmediatePropagation(),this._waitingTrigger=e,this._fireWaiting())}end(e){let{loop:n}=this.$state;if(n()){setTimeout(()=>{requestAnimationFrame(()=>{this.dispatch("media-loop-request",{trigger:e})})},10);return}this._onEnded(e)}_onEnded(e){let{paused:n,seeking:i,ended:r,duration:s}=this.$state;n()||this.dispatch("pause",{trigger:e}),i()&&this.dispatch("seeked",{detail:s(),trigger:e}),r.set(!0),this._resetTracking(),this.dispatch("ended",{trigger:e})}_stopWaiting(){this._fireWaiting.cancel(),this.$state.waiting.set(!1)}"fullscreen-change"(e){let n=e.detail;this.$state.fullscreen.set(n),this._satisfyRequest(n?"media-enter-fullscreen-request":"media-exit-fullscreen-request",e)}"fullscreen-error"(e){this._satisfyRequest("media-enter-fullscreen-request",e),this._satisfyRequest("media-exit-fullscreen-request",e)}"orientation-change"(e){let n=e.detail.lock;this._satisfyRequest(n?"media-orientation-lock-request":"media-orientation-unlock-request",e)}"picture-in-picture-change"(e){let n=e.detail;this.$state.pictureInPicture.set(n),this._satisfyRequest(n?"media-enter-pip-request":"media-exit-pip-request",e)}"picture-in-picture-error"(e){this._satisfyRequest("media-enter-pip-request",e),this._satisfyRequest("media-exit-pip-request",e)}"title-change"(e){e.trigger&&(e.stopImmediatePropagation(),this.$state.inferredTitle.set(e.detail))}"poster-change"(e){e.trigger&&(e.stopImmediatePropagation(),this.$state.inferredPoster.set(e.detail))}},kw=class extends Xi{onSetup(){this._init(),!D&&(b(this._watchArtist.bind(this)),b(this._watchAutoplay.bind(this)),b(this._watchClipTimes.bind(this)),b(this._watchControls.bind(this)),b(this._watchCrossOrigin.bind(this)),b(this._watchDuration.bind(this)),b(this._watchLive.bind(this)),b(this._watchLiveEdge.bind(this)),b(this._watchLiveTolerance.bind(this)),b(this._watchLoop.bind(this)),b(this._watchPlaysInline.bind(this)),b(this._watchPoster.bind(this)),b(this._watchProvidedTypes.bind(this)),b(this._watchTitle.bind(this)))}_init(){let e={duration:"providedDuration",poster:"providedPoster",streamType:"providedStreamType",title:"providedTitle",viewType:"providedViewType"},n=new Set(["currentTime","paused","playbackRate","volume"]);for(let i of Object.keys(this.$props))n.has(i)||this.$state[e[i]??i]?.set(this.$props[i]());this.$state.muted.set(this.$props.muted()||this.$props.volume()===0)}_watchProvidedTypes(){let{viewType:e,streamType:n,title:i,poster:r}=this.$props;this.$state.providedPoster.set(r()),this.$state.providedStreamType.set(n()),this.$state.providedViewType.set(e()),this.$state.providedTitle.set(i())}_watchLogLevel(){}_watchArtist(){let{artist:e}=this.$props;this.$state.artist.set(e())}_watchTitle(){let{title:e}=this.$state;this.dispatch("title-change",{detail:e()})}_watchAutoplay(){let e=this.$props.autoPlay()||this.$props.autoplay();this.$state.autoPlay.set(e),this.dispatch("auto-play-change",{detail:e})}_watchLoop(){let e=this.$props.loop();this.$state.loop.set(e),this.dispatch("loop-change",{detail:e})}_watchControls(){let e=this.$props.controls();this.$state.controls.set(e)}_watchPoster(){let{poster:e}=this.$state;this.dispatch("poster-change",{detail:e()})}_watchCrossOrigin(){let e=this.$props.crossOrigin()??this.$props.crossorigin(),n=e===!0?"":e;this.$state.crossOrigin.set(n)}_watchDuration(){let{providedDuration:e}=this.$state;e.set(this.$props.duration())}_watchPlaysInline(){let e=this.$props.playsInline()||this.$props.playsinline();this.$state.playsInline.set(e),this.dispatch("plays-inline-change",{detail:e})}_watchClipTimes(){let{clipStartTime:e,clipEndTime:n}=this.$props;this.$state.clipStartTime.set(e()),this.$state.clipEndTime.set(n())}_watchLive(){this.dispatch("live-change",{detail:this.$state.live()})}_watchLiveTolerance(){this.$state.liveEdgeTolerance.set(this.$props.liveEdgeTolerance()),this.$state.minLiveDVRWindow.set(this.$props.minLiveDVRWindow())}_watchLiveEdge(){this.dispatch("live-edge-change",{detail:this.$state.liveEdge()})}},KO=class Tw extends Xi{constructor(){super()}onConnect(){b(this._onMetadataChange.bind(this)),b(this._onPlaybackStateChange.bind(this));let e=this._handleAction.bind(this);for(let n of Tw._actions)navigator.mediaSession.setActionHandler(n,e);G(this._onDisconnect.bind(this))}_onDisconnect(){for(let e of Tw._actions)navigator.mediaSession.setActionHandler(e,null)}_onMetadataChange(){let{title:e,artist:n,poster:i}=this.$state;navigator.mediaSession.metadata=new MediaMetadata({title:e(),artist:n(),artwork:[{src:i()}]})}_onPlaybackStateChange(){let{canPlay:e,paused:n}=this.$state;navigator.mediaSession.playbackState=e()?n()?"paused":"playing":"none"}_handleAction(e){let n=new q("media-session-action",{detail:e});switch(e.action){case"play":this.dispatch("media-play-request",{trigger:n});break;case"pause":this.dispatch("media-pause-request",{trigger:n});break;case"seekto":case"seekforward":case"seekbackward":this.dispatch("media-seek-request",{detail:Be(e.seekTime)?e.seekTime:this.$state.currentTime()+(e.seekOffset??10),trigger:n});break}}};KO._actions=["play","pause","seekforward","seekbackward","seekto"];jh=O(!1);D||(S(document,"pointerdown",()=>{jh.set(!1)}),S(document,"keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||jh.set(!0)}));fn=class extends Lt{constructor(){super(...arguments),this._focused=O(!1)}onConnect(e){b(()=>{if(!jh()){this._focused.set(!1),wh(e,!1),this.listen("pointerenter",this._onPointerEnter.bind(this)),this.listen("pointerleave",this._onPointerLeave.bind(this));return}let n=document.activeElement===e;this._focused.set(n),wh(e,n),this.listen("focus",this._onFocus.bind(this)),this.listen("blur",this._onBlur.bind(this))})}focused(){return this._focused()}_onFocus(){this._focused.set(!0),wh(this.el,!0)}_onBlur(){this._focused.set(!1),wh(this.el,!1)}_onPointerEnter(){xP(this.el,!0)}_onPointerLeave(){xP(this.el,!1)}};GO=Object.defineProperty,YO=Object.getOwnPropertyDescriptor,Te=(t,e,n,i)=>{for(var r=i>1?void 0:i?YO(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&GO(e,n,r),r},fe=class xh extends B{constructor(){super(),this.canPlayQueue=new Uh,this._skipTitleUpdate=!1,new kw;let e={player:this,qualities:new Nh,audioTracks:new Ah,storage:null,$provider:O(null),$providerSetup:O(!1),$props:this.$props,$state:this.$state};e.remote=new Ga(void 0),e.remote.setPlayer(this),e.$iosControls=gi(this._isIOSControls.bind(this)),e.textTracks=new Lh,e.textTracks[K._crossOrigin]=this.$state.crossOrigin,e.textRenderers=new Rh(e),e.ariaKeys={},this._media=e,It(au,e),this.orientation=new Aw,new fn,new vw(e);let n=new bw;this._stateMgr=new xw(n,e),this._requestMgr=new ww(this._stateMgr,n,e),e.delegate=new yw(this._stateMgr._handle.bind(this._stateMgr),e),new zh("load",this.startLoading.bind(this)),new zh("posterLoad",this.startLoadingPoster.bind(this))}get _provider(){return this._media.$provider()}onSetup(){this._setupMediaAttributes(),b(this._watchCanPlay.bind(this)),b(this._watchMuted.bind(this)),b(this._watchPaused.bind(this)),b(this._watchVolume.bind(this)),b(this._watchCurrentTime.bind(this)),b(this._watchPlaysInline.bind(this)),b(this._watchPlaybackRate.bind(this))}onAttach(e){e.setAttribute("data-media-player",""),ye(e,"tabindex","0"),ye(e,"role","region"),b(this._watchStorage.bind(this)),D?this._watchTitle():b(this._watchTitle.bind(this)),D?this._watchOrientation():b(this._watchOrientation.bind(this)),S(e,"find-media-player",this._onFindPlayer.bind(this))}onConnect(e){dP&&J(e,"data-iphone","");let n=window.matchMedia("(pointer: coarse)");this._onPointerChange(n),n.onchange=this._onPointerChange.bind(this);let i=new ResizeObserver(Ir(this._onResize.bind(this)));i.observe(e),b(this._onResize.bind(this)),this.dispatch("media-player-connect",{detail:this,bubbles:!0,composed:!0}),G(()=>{i.disconnect(),n.onchange=null})}onDestroy(){this._media.player=null,this.canPlayQueue._reset()}_watchTitle(){let e=this.$el,{title:n,live:i,viewType:r,providedTitle:s}=this.$state,a=i(),o=Jl(r()),l=o!=="Unknown"?`${a?"Live ":""}${o}`:a?"Live":"Media",c=n();J(this.el,"aria-label",c?`${l} - ${c}`:l+" Player"),!D&&e?.hasAttribute("title")&&(this._skipTitleUpdate=!0,e?.removeAttribute("title"))}_watchOrientation(){let e=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(e),J(this.el,"data-orientation",e),this._onResize()}_watchCanPlay(){this.$state.canPlay()&&this._provider?this.canPlayQueue._start():this.canPlayQueue._stop()}_setupMediaAttributes(){if(xh[uw]){this.setAttributes(xh[uw]);return}let e={"data-load":function(){return this.$props.load()},"data-captions":function(){let i=this.$state.textTrack();return!!i&&We(i)},"data-ios-controls":function(){return this._media.$iosControls()},"data-controls":function(){return this.controls.showing},"data-buffering":function(){let{canLoad:i,canPlay:r,waiting:s}=this.$state;return i()&&(!r()||s())},"data-error":function(){let{error:i}=this.$state;return!!i()},"data-autoplay-error":function(){let{autoPlayError:i}=this.$state;return!!i()}},n={autoPlay:"autoplay",canAirPlay:"can-airplay",canPictureInPicture:"can-pip",pictureInPicture:"pip",playsInline:"playsinline",remotePlaybackState:"remote-state",remotePlaybackType:"remote-type",isAirPlayConnected:"airplay",isGoogleCastConnected:"google-cast"};for(let i of qO){let r="data-"+(n[i]??Oa(i));e[r]=function(){return this.$state[i]()}}delete e.title,xh[uw]=e,this.setAttributes(e)}_onFindPlayer(e){e.detail(this)}_onResize(){if(D||!this.el)return;let e=this.el.clientWidth,n=this.el.clientHeight;this.$state.width.set(e),this.$state.height.set(n),ct(this.el,"--player-width",e+"px"),ct(this.el,"--player-height",n+"px")}_onPointerChange(e){if(D)return;let n=e.matches?"coarse":"fine";J(this.el,"data-pointer",n),this.$state.pointer.set(n),this._onResize()}_isIOSControls(){let{playsInline:e,fullscreen:n}=this.$state;return dP&&!$P()&&this.$state.mediaType()==="video"&&(!e()||n())}get provider(){return this._provider}get controls(){return this._requestMgr._controls}get title(){return C(this.$state.providedTitle)}set title(e){if(this._skipTitleUpdate){this._skipTitleUpdate=!1;return}this.$state.providedTitle.set(e)}get qualities(){return this._media.qualities}get audioTracks(){return this._media.audioTracks}get textTracks(){return this._media.textTracks}get textRenderers(){return this._media.textRenderers}get paused(){return C(this.$state.paused)}set paused(e){this._queuePausedUpdate(e)}_watchPaused(){this._queuePausedUpdate(this.$props.paused())}_queuePausedUpdate(e){e?this.canPlayQueue._enqueue("paused",()=>this._requestMgr._pause()):this.canPlayQueue._enqueue("paused",()=>this._requestMgr._play())}get muted(){return C(this.$state.muted)}set muted(e){this.$props.muted.set(e)}_watchMuted(){this._queueMutedUpdate(this.$props.muted())}_queueMutedUpdate(e){this.canPlayQueue._enqueue("muted",()=>{this._provider&&this._provider.setMuted(e)})}get currentTime(){return C(this.$state.currentTime)}set currentTime(e){this._queueCurrentTimeUpdate(e)}_watchCurrentTime(){this._queueCurrentTimeUpdate(this.$props.currentTime())}_queueCurrentTimeUpdate(e){this.canPlayQueue._enqueue("currentTime",()=>{let{currentTime:n,clipStartTime:i,seekableStart:r,seekableEnd:s}=this.$state;e!==C(n)&&C(()=>{if(!this._provider)return;let a=Math.min(Math.max(r()+.1,e+i()),s()-.1);Number.isFinite(a)&&this._provider.setCurrentTime(a)})})}get volume(){return C(this.$state.volume)}set volume(e){this.$props.volume.set(e)}_watchVolume(){this._queueVolumeUpdate(this.$props.volume())}_queueVolumeUpdate(e){let n=jw(0,e,1);this.canPlayQueue._enqueue("volume",()=>{this._provider&&this._provider.setVolume(n)})}get playbackRate(){return C(this.$state.playbackRate)}set playbackRate(e){this._queuePlaybackRateUpdate(e)}_watchPlaybackRate(){this._queuePlaybackRateUpdate(this.$props.playbackRate())}_queuePlaybackRateUpdate(e){this.canPlayQueue._enqueue("rate",()=>{this._provider&&this._provider.setPlaybackRate?.(e)})}_watchPlaysInline(){this._queuePlaysInlineUpdate(this.$props.playsInline())}_queuePlaysInlineUpdate(e){this.canPlayQueue._enqueue("playsinline",()=>{this._provider&&this._provider.setPlaysInline?.(e)})}_watchStorage(){let e=this.$props.storage(),n=U(e)?new Mh:e;if(n?.onChange){let{source:i}=this.$state,r=U(e)?e:this.el?.id,s=gi(this._computeMediaId.bind(this));b(()=>n.onChange(i(),s(),r))}this._media.storage=n,this._media.textTracks.setStorage(n),G(()=>{n?.onDestroy?.(),this._media.storage=null,this._media.textTracks.setStorage(null)})}_computeMediaId(){let{clipStartTime:e,clipEndTime:n}=this.$props,{source:i}=this.$state,r=i();return r.src?`${r.src}:${e()}:${n()}`:null}async play(e){return this._requestMgr._play(e)}async pause(e){return this._requestMgr._pause(e)}async enterFullscreen(e,n){return this._requestMgr._enterFullscreen(e,n)}async exitFullscreen(e,n){return this._requestMgr._exitFullscreen(e,n)}enterPictureInPicture(e){return this._requestMgr._enterPictureInPicture(e)}exitPictureInPicture(e){return this._requestMgr._exitPictureInPicture(e)}seekToLiveEdge(e){this._requestMgr._seekToLiveEdge(e)}startLoading(e){this._media.delegate._notify("can-load",void 0,e)}startLoadingPoster(e){this._media.delegate._notify("can-load-poster",void 0,e)}requestAirPlay(e){return this._requestMgr._requestAirPlay(e)}requestGoogleCast(e){return this._requestMgr._requestGoogleCast(e)}destroy(){this._media.remote.setPlayer(null),this.dispatch("destroy")}};fe.props=BO;fe.state=Vs;Te([te],fe.prototype,"canPlayQueue",2);Te([te],fe.prototype,"provider",1);Te([te],fe.prototype,"controls",1);Te([te],fe.prototype,"orientation",2);Te([te],fe.prototype,"title",1);Te([te],fe.prototype,"qualities",1);Te([te],fe.prototype,"audioTracks",1);Te([te],fe.prototype,"textTracks",1);Te([te],fe.prototype,"textRenderers",1);Te([te],fe.prototype,"paused",1);Te([te],fe.prototype,"muted",1);Te([te],fe.prototype,"currentTime",1);Te([te],fe.prototype,"volume",1);Te([te],fe.prototype,"playbackRate",1);Te([Ae],fe.prototype,"play",1);Te([Ae],fe.prototype,"pause",1);Te([Ae],fe.prototype,"enterFullscreen",1);Te([Ae],fe.prototype,"exitFullscreen",1);Te([Ae],fe.prototype,"enterPictureInPicture",1);Te([Ae],fe.prototype,"exitPictureInPicture",1);Te([Ae],fe.prototype,"seekToLiveEdge",1);Te([Ae],fe.prototype,"startLoading",1);Te([Ae],fe.prototype,"startLoadingPoster",1);Te([Ae],fe.prototype,"requestAirPlay",1);Te([Ae],fe.prototype,"requestGoogleCast",1);QO=fe;u1=new Map,Ew=class{constructor(e,n,i,r=[]){this._domSources=e,this._media=n,this._loader=i,this._initialize=!1;let s=new l1,a=new _c,o=new Oh,l=new Fh,c=new Vh,u=[l,c];this._loaders=gi(()=>{let p=n.$state.remotePlaybackLoader(),h=n.$props.preferNativeHLS()?[...r,a,o,s,...u]:[...r,s,a,o,...u];return p?[p,...h]:h});let{$state:d}=n;d.sources.set(kP(n.$props.src()));for(let p of d.sources()){let h=this._loaders().find(v=>v.canPlay(p));if(!h)continue;let y=h.mediaType(p);this._media.$state.source.set(p),this._media.$state.mediaType.set(y),this._media.$state.inferredViewType.set(y),this._loader.set(h),this._initialize=!0}}get _notify(){return this._media.delegate._notify}connect(){let e=this._loader();this._initialize&&(this._notifySourceChange(this._media.$state.source(),e),this._notifyLoaderChange(e),this._initialize=!1),b(this._onSourcesChange.bind(this)),b(this._onSourceChange.bind(this)),b(this._onSetup.bind(this)),b(this._onLoadSource.bind(this)),b(this._onLoadPoster.bind(this))}_onSourcesChange(){this._notify("sources-change",[...kP(this._media.$props.src()),...this._domSources()])}_onSourceChange(){let{$state:e}=this._media,n=e.sources(),i=C(e.source),r=this._findNewSource(i,n);if(n[0]?.src&&!r.src&&!r.type){let{crossOrigin:a}=e,o=Eh(a()),l=new AbortController;return Promise.all(n.map(c=>U(c.src)&&c.type==="?"?fetch(c.src,{method:"HEAD",credentials:o,signal:l.signal}).then(u=>(c.type=u.headers.get("content-type")||"??",u1.set(c.src,c.type),c)).catch(()=>c):c)).then(c=>{l.signal.aborted||(this._findNewSource(C(e.source),c),ti())}),()=>l.abort()}ti()}_findNewSource(e,n){let i={src:"",type:""},r=null,s=this._loaders();for(let a of n){let o=s.find(l=>l.canPlay(a));if(o){i=a,r=o;break}}return TP(e,i)||this._notifySourceChange(i,r),r!==C(this._loader)&&this._notifyLoaderChange(r),i}_notifySourceChange(e,n){this._notify("source-change",e),this._notify("media-type-change",n?.mediaType(e)||"unknown")}_notifyLoaderChange(e){this._media.$providerSetup.set(!1),this._notify("provider-change",null),e&&C(()=>e.preconnect?.(this._media)),this._loader.set(e),this._notify("provider-loader-change",e)}_onSetup(){let e=this._media.$provider();if(!(!e||C(this._media.$providerSetup))){if(this._media.$state.canLoad()){nt(()=>e.setup(),e.scope),this._media.$providerSetup.set(!0);return}C(()=>e.preconnect?.())}}_onLoadSource(){if(!this._media.$providerSetup())return;let e=this._media.$provider(),n=this._media.$state.source(),i=C(this._media.$state.crossOrigin);if(!TP(e?.currentSrc,n)){if(this._media.$state.canLoad()){let r=new AbortController;return Es(n)?uh()||c1(n.src,{credentials:Eh(i),signal:r.signal}).then(s=>{this._notify("stream-type-change",s)}).catch(Kt):this._notify("stream-type-change","on-demand"),C(()=>{let s=C(this._media.$state.preload);return e?.loadSource(n,s).catch(a=>{})}),()=>r.abort()}try{U(n.src)&&ni(new URL(n.src).origin)}catch{}}}_onLoadPoster(){let e=this._loader(),{source:n,canLoadPoster:i}=this._media.$state;if(!e||!e.loadPoster||!n()||!i())return;let r=new AbortController,s=new q("source-change",{detail:n});return e.loadPoster(n(),this._media,r).then(a=>{this._notify("poster-change",a||"",s)}).catch(()=>{this._notify("poster-change","",s)}),()=>{r.abort()}}};Sw=class{constructor(e,n){this._domTracks=e,this._media=n,this._prevTracks=[],b(this._onTracksChange.bind(this))}_onTracksChange(){let e=this._domTracks();for(let n of this._prevTracks)if(!e.some(i=>i.id===n.id)){let i=n.id&&this._media.textTracks.getById(n.id);i&&this._media.textTracks.remove(i)}for(let n of e){let i=n.id||un.createId(n);this._media.textTracks.getById(i)||(n.id=i,this._media.textTracks.add(n))}this._prevTracks=e}},JO=Object.defineProperty,e3=Object.getOwnPropertyDescriptor,t3=(t,e,n,i)=>{for(var r=i>1?void 0:i?e3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&JO(e,n,r),r},Qa=class extends B{constructor(){super(...arguments),this._domSources=O([]),this._domTracks=O([]),this._loader=null,this._loadRafId=-1}onSetup(){this._media=ce(),this._sources=new Ew(this._domSources,this._media,this.$state.loader,this.$props.loaders())}onAttach(e){e.setAttribute("data-media-provider","")}onConnect(e){this._sources.connect(),new Sw(this._domTracks,this._media);let n=new ResizeObserver(Ir(this._onResize.bind(this)));n.observe(e);let i=new MutationObserver(this._onMutation.bind(this));i.observe(e,{attributes:!0,childList:!0}),this._onResize(),this._onMutation(),G(()=>{n.disconnect(),i.disconnect()})}load(e){window.cancelAnimationFrame(this._loadRafId),this._loadRafId=requestAnimationFrame(()=>this._runLoader(e)),G(()=>{window.cancelAnimationFrame(this._loadRafId)})}_runLoader(e){if(!this.scope)return;let n=this.$state.loader(),{$provider:i}=this._media;this._loader===n&&n?.target===e&&C(i)||(this._destroyProvider(),this._loader=n,n&&(n.target=e||null),!(!n||!e)&&n.load(this._media).then(r=>{this.scope&&C(this.$state.loader)===n&&this._media.delegate._notify("provider-change",r)}))}onDestroy(){this._loader=null,this._destroyProvider()}_destroyProvider(){this._media.delegate._notify("provider-change",null)}_onResize(){if(!this.el)return;let e=this._media.player,n=this.el.offsetWidth,i=this.el.offsetHeight;e&&(e.$state.mediaWidth.set(n),e.$state.mediaHeight.set(i),e.el&&(ct(e.el,"--media-width",n+"px"),ct(e.el,"--media-height",i+"px")))}_onMutation(){let e=[],n=[],i=this.el.children;for(let r of i)r instanceof HTMLSourceElement?e.push({src:r.src,type:r.type}):r instanceof HTMLTrackElement&&n.push({id:r.id,src:r.src,kind:r.track.kind,language:r.srclang,label:r.label,default:r.default,type:r.getAttribute("data-type")});this._domSources.set(e),this._domTracks.set(n),ti()}};Qa.props={loaders:[]};Qa.state=new ei({loader:null});t3([Ae],Qa.prototype,"load",1);Hh=class extends B{onSetup(){this._media=ce(),b(this._watchProps.bind(this))}onAttach(e){let{pictureInPicture:n,fullscreen:i}=this._media.$state;ct(e,"pointer-events","none"),ye(e,"role","group"),this.setAttributes({"data-visible":this._isShowing.bind(this),"data-fullscreen":i,"data-pip":n}),b(()=>{this.dispatch("change",{detail:this._isShowing()})}),b(this._hideControls.bind(this)),b(()=>{let r=i();for(let s of["top","right","bottom","left"])ct(e,`padding-${s}`,r&&`env(safe-area-inset-${s})`)})}_hideControls(){if(!this.el)return;let{$iosControls:e}=this._media,{controls:n}=this._media.$state,i=n()||e();J(this.el,"aria-hidden",i?"true":null),ct(this.el,"display",i?"none":null)}_watchProps(){let{controls:e}=this._media.player,{hideDelay:n,hideOnMouseLeave:i}=this.$props;e.defaultDelay=n()===2e3?this._media.$props.controlsDelay():n(),e.hideOnMouseLeave=i()}_isShowing(){let{controlsVisible:e}=this._media.$state;return e()}};Hh.props={hideDelay:2e3,hideOnMouseLeave:!1};qh=class extends B{onAttach(e){ct(e,"pointer-events","auto")}},Bh=class extends Lt{constructor(e){super(),this._delegate=e,this._showTimerId=-1,this._hideRafId=-1,this._stopAnimationEndListener=null,b(this._watchTrigger.bind(this))}onDestroy(){this._stopAnimationEndListener?.(),this._stopAnimationEndListener=null}_watchTrigger(){let e=this._delegate._trigger();if(!e){this.hide();return}let n=this.show.bind(this),i=this.hide.bind(this);this._delegate._listen(e,n,i)}show(e){this._cancelShowing(),window.cancelAnimationFrame(this._hideRafId),this._hideRafId=-1,this._stopAnimationEndListener?.(),this._stopAnimationEndListener=null,this._showTimerId=window.setTimeout(()=>{this._showTimerId=-1;let n=this._delegate._content();n&&n.style.removeProperty("display"),C(()=>this._delegate._onChange(!0,e))},this._delegate._showDelay?.()??0)}hide(e){this._cancelShowing(),C(()=>this._delegate._onChange(!1,e)),this._hideRafId=requestAnimationFrame(()=>{this._cancelShowing(),this._hideRafId=-1;let n=this._delegate._content();if(n){let i=()=>{n.style.display="none",this._stopAnimationEndListener=null};if(DO(n)){this._stopAnimationEndListener?.();let s=S(n,"animationend",i,{once:!0});this._stopAnimationEndListener=s}else i()}})}_cancelShowing(){window.clearTimeout(this._showTimerId),this._showTimerId=-1}},Ka=yi(),n3=0,Wh=class extends B{constructor(){super(),this._id=`media-tooltip-${++n3}`,this._trigger=O(null),this._content=O(null),new fn;let{showDelay:e}=this.$props;new Bh({_trigger:this._trigger,_content:this._content,_showDelay:e,_listen(n,i,r){S(n,"touchstart",s=>s.preventDefault(),{passive:!1}),b(()=>{jh()&&S(n,"focus",i),S(n,"blur",r)}),S(n,"mouseenter",i),S(n,"mouseleave",r)},_onChange:this._onShowingChange.bind(this)})}onAttach(e){e.style.setProperty("display","contents")}onSetup(){It(Ka,{_trigger:this._trigger,_content:this._content,_attachTrigger:this._attachTrigger.bind(this),_detachTrigger:this._detachTrigger.bind(this),_attachContent:this._attachContent.bind(this),_detachContent:this._detachContent.bind(this)})}_attachTrigger(e){this._trigger.set(e);let n=e.getAttribute("data-media-tooltip");n&&this.el?.setAttribute(`data-media-${n}-tooltip`,""),J(e,"data-describedby",this._id)}_detachTrigger(e){e.removeAttribute("data-describedby"),e.removeAttribute("aria-describedby"),this._trigger.set(null)}_attachContent(e){e.setAttribute("id",this._id),e.style.display="none",ye(e,"role","tooltip"),this._content.set(e)}_detachContent(e){e.removeAttribute("id"),e.removeAttribute("role"),this._content.set(null)}_onShowingChange(e){let n=this._trigger(),i=this._content();n&&J(n,"aria-describedby",e?this._id:null);for(let r of[this.el,n,i])r&&J(r,"data-visible",e)}};Wh.props={showDelay:700};Kh=class extends B{constructor(){super(),new fn}onConnect(e){G(Ch(()=>{if(!this.connectScope)return;this._attach();let n=Ie(Ka);G(()=>{let i=this._getButton();i&&n._detachTrigger(i)})}))}_attach(){let e=this._getButton(),n=Ie(Ka);e&&n._attachTrigger(e)}_getButton(){let e=this.el.firstElementChild;return e?.localName==="button"||e?.getAttribute("role")==="button"?e:this.el}},wc=class extends B{constructor(){super(),new fn;let{placement:e}=this.$props;this.setAttributes({"data-placement":e})}onAttach(e){this._attach(e),Object.assign(e.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(e){this._attach(e);let n=Ie(Ka);G(()=>n._detachContent(e)),G(Ch(()=>{this.connectScope&&b(this._watchPlacement.bind(this))}))}_attach(e){Ie(Ka)._attachContent(e)}_watchPlacement(){let{placement:e,offset:n,alignOffset:i}=this.$props;return YP(this.el,this._getTrigger(),e(),{offsetVarName:"media-tooltip",xOffset:i(),yOffset:n()})}_getTrigger(){return Ie(Ka)._trigger()}};wc.props={placement:"top center",offset:0,alignOffset:0};it=class extends Lt{constructor(e){super(),this._delegate=e,new fn,e._keyShortcut&&new Dh(e._keyShortcut)}onSetup(){let{disabled:e}=this.$props;this.setAttributes({"data-pressed":this._delegate._isPressed,"aria-pressed":this._isARIAPressed.bind(this),"aria-disabled":()=>e()?"true":null})}onAttach(e){ye(e,"tabindex","0"),ye(e,"role","button"),ye(e,"type","button")}onConnect(e){Vr(e,this._onMaybePress.bind(this));for(let n of["click","touchstart"])this.listen(n,this._onInteraction.bind(this))}_isARIAPressed(){return Va(this._delegate._isPressed())}_onPressed(e){r_(this._delegate._isPressed)&&this._delegate._isPressed.set(n=>!n)}_onMaybePress(e){if(this.$props.disabled()||this.el.hasAttribute("data-disabled")){e.preventDefault(),e.stopImmediatePropagation();return}e.preventDefault(),(this._delegate._onPress??this._onPressed).call(this,e)}_onInteraction(e){this.$props.disabled()&&(e.preventDefault(),e.stopImmediatePropagation())}};it.props={disabled:!1};i3=Object.defineProperty,r3=Object.getOwnPropertyDescriptor,s3=(t,e,n,i)=>{for(var r=i>1?void 0:i?r3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&i3(e,n,r),r},bc=class extends B{constructor(){super(),this._pressed=O(!1),new it({_isPressed:this._pressed})}get pressed(){return this._pressed()}};bc.props={disabled:!1,defaultPressed:!1};s3([te],bc.prototype,"pressed",1);Gh=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce();let{canAirPlay:e,isAirPlayConnected:n}=this._media.$state;this.setAttributes({"data-active":n,"data-supported":e,"data-state":this._getState.bind(this),"aria-hidden":Xt(()=>!e())})}onAttach(e){e.setAttribute("data-media-tooltip","airplay"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){this._media.remote.requestAirPlay(e)}_isPressed(){let{remotePlaybackType:e,remotePlaybackState:n}=this._media.$state;return e()==="airplay"&&n()!=="disconnected"}_getState(){let{remotePlaybackType:e,remotePlaybackState:n}=this._media.$state;return e()==="airplay"&&n()}_getDefaultLabel(){let{remotePlaybackState:e}=this._media.$state;return`AirPlay ${e()}`}};Gh.props=it.props;Yh=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce();let{canGoogleCast:e,isGoogleCastConnected:n}=this._media.$state;this.setAttributes({"data-active":n,"data-supported":e,"data-state":this._getState.bind(this),"aria-hidden":Xt(()=>!e())})}onAttach(e){e.setAttribute("data-media-tooltip","google-cast"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){this._media.remote.requestGoogleCast(e)}_isPressed(){let{remotePlaybackType:e,remotePlaybackState:n}=this._media.$state;return e()==="google-cast"&&n()!=="disconnected"}_getState(){let{remotePlaybackType:e,remotePlaybackState:n}=this._media.$state;return e()==="google-cast"&&n()}_getDefaultLabel(){let{remotePlaybackState:e}=this._media.$state;return`Google Cast ${e()}`}};Yh.props=it.props;Qh=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_keyShortcut:"togglePaused",_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce();let{paused:e,ended:n}=this._media.$state;this.setAttributes({"data-paused":e,"data-ended":n})}onAttach(e){e.setAttribute("data-media-tooltip","play"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){let n=this._media.remote;this._isPressed()?n.pause(e):n.play(e)}_isPressed(){let{paused:e}=this._media.$state;return!e()}_getDefaultLabel(){let{paused:e}=this._media.$state;return e()?"Play":"Pause"}};Qh.props=it.props;Xh=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_keyShortcut:"toggleCaptions",_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce(),this.setAttributes({"data-active":this._isPressed.bind(this),"data-supported":()=>!this._isHidden(),"aria-hidden":Xt(this._isHidden.bind(this))})}onAttach(e){e.setAttribute("data-media-tooltip","caption"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){this._media.remote.toggleCaptions(e)}_isPressed(){let{textTrack:e}=this._media.$state,n=e();return!!n&&We(n)}_isHidden(){let{hasCaptions:e}=this._media.$state;return!e()}_getDefaultLabel(){let{textTrack:e}=this._media.$state;return e()?"Closed-Captions Off":"Closed-Captions On"}};Xh.props=it.props;Zh=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_keyShortcut:"toggleFullscreen",_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce();let{fullscreen:e}=this._media.$state,n=this._isSupported.bind(this);this.setAttributes({"data-active":e,"data-supported":n,"aria-hidden":Xt(()=>!n())})}onAttach(e){e.setAttribute("data-media-tooltip","fullscreen"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){let n=this._media.remote,i=this.$props.target();this._isPressed()?n.exitFullscreen(i,e):n.enterFullscreen(i,e)}_isPressed(){let{fullscreen:e}=this._media.$state;return e()}_isSupported(){let{canFullscreen:e}=this._media.$state;return e()}_getDefaultLabel(){let{fullscreen:e}=this._media.$state;return e()?"Exit Fullscreen":"Enter Fullscreen"}};Zh.props={...it.props,target:"prefer-media"};Jh=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_keyShortcut:"toggleMuted",_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce(),this.setAttributes({"data-muted":this._isPressed.bind(this),"data-state":this._getState.bind(this)})}onAttach(e){e.setAttribute("data-media-mute-button",""),e.setAttribute("data-media-tooltip","mute"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){let n=this._media.remote;this._isPressed()?n.unmute(e):n.mute(e)}_isPressed(){let{muted:e,volume:n}=this._media.$state;return e()||n()===0}_getDefaultLabel(){return this._isPressed()?"Unmute":"Mute"}_getState(){let{muted:e,volume:n}=this._media.$state,i=n();if(e()||i===0)return"muted";if(i>=.5)return"high";if(i<.5)return"low"}};Jh.props=it.props;ef=class extends B{constructor(){super(),new it({_isPressed:this._isPressed.bind(this),_keyShortcut:"togglePictureInPicture",_onPress:this._onPress.bind(this)})}onSetup(){this._media=ce();let{pictureInPicture:e}=this._media.$state,n=this._isSupported.bind(this);this.setAttributes({"data-active":e,"data-supported":n,"aria-hidden":Xt(()=>!n())})}onAttach(e){e.setAttribute("data-media-tooltip","pip"),zr(e,this._getDefaultLabel.bind(this))}_onPress(e){let n=this._media.remote;this._isPressed()?n.exitPictureInPicture(e):n.enterPictureInPicture(e)}_isPressed(){let{pictureInPicture:e}=this._media.$state;return e()}_isSupported(){let{canPictureInPicture:e}=this._media.$state;return e()}_getDefaultLabel(){let{pictureInPicture:e}=this._media.$state;return e()?"Exit Picture In Picture":"Enter Picture In Picture"}};ef.props=it.props;tf=class extends B{constructor(){super(),new fn}onSetup(){this._media=ce();let{seeking:e}=this._media.$state,{seconds:n}=this.$props,i=this._isSupported.bind(this);this.setAttributes({seconds:n,"data-seeking":e,"data-supported":i,"aria-hidden":Xt(()=>!i())})}onAttach(e){ye(e,"tabindex","0"),ye(e,"role","button"),ye(e,"type","button"),e.setAttribute("data-media-tooltip","seek"),zr(e,this._getDefaultLabel.bind(this))}onConnect(e){Vr(e,this._onPress.bind(this))}_isSupported(){let{canSeek:e}=this._media.$state;return e()}_getDefaultLabel(){let{seconds:e}=this.$props;return`Seek ${e()>0?"forward":"backward"} ${e()} seconds`}_onPress(e){let{seconds:n,disabled:i}=this.$props;if(i())return;let{currentTime:r}=this._media.$state,s=r()+n();this._media.remote.seek(s,e)}};tf.props={disabled:!1,seconds:30};nf=class extends B{constructor(){super(),new fn}onSetup(){this._media=ce();let{disabled:e}=this.$props,{live:n,liveEdge:i}=this._media.$state,r=()=>!n();this.setAttributes({"data-edge":i,"data-hidden":r,"aria-disabled":Xt(()=>e()||i()),"aria-hidden":Xt(r)})}onAttach(e){ye(e,"tabindex","0"),ye(e,"role","button"),ye(e,"type","button"),e.setAttribute("data-media-tooltip","live")}onConnect(e){Vr(e,this._onPress.bind(this))}_onPress(e){let{disabled:n}=this.$props,{liveEdge:i}=this._media.$state;n()||i()||this._media.remote.seekToLiveEdge(e)}};nf.props={disabled:!1};mf=new ei({min:0,max:100,value:0,pointerValue:0,focused:!1,dragging:!1,pointing:!1,get active(){return this.dragging||this.focused||this.pointing},get fillRate(){return EP(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return EP(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});SP={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1},Pw=class extends Lt{constructor(e,n){super(),this._delegate=e,this._media=n,this._provider=null,this._touch=null,this._touchStartValue=null,this._onDocumentPointerMove=lu(i=>{this._updatePointerValue(this._getPointerValue(i),i)},20,{leading:!0})}onConnect(){if(b(this._attachEventListeners.bind(this)),b(this._attachPointerListeners.bind(this)),this._delegate._swipeGesture){let e=this._media.player.el?.querySelector("media-provider,[data-media-provider]");e&&(this._provider=e,S(e,"touchstart",this._onTouchStart.bind(this),{passive:!0}),S(e,"touchmove",this._onTouchMove.bind(this),{passive:!1}))}}_onTouchStart(e){this._touch=e.touches[0]}_onTouchMove(e){if(vi(this._touch)||Vw(e))return;let n=e.touches[0],i=n.clientX-this._touch.clientX,r=n.clientY-this._touch.clientY,s=this.$state.dragging();!s&&Math.abs(r)>20||s||Math.abs(i)>20&&(this._touch=n,this._touchStartValue=this.$state.value(),this._onStartDragging(this._touchStartValue,e))}_attachEventListeners(){this._delegate._isDisabled()||(this.listen("focus",this._onFocus.bind(this)),this.listen("pointerenter",this._onPointerEnter.bind(this)),this.listen("pointermove",this._onPointerMove.bind(this)),this.listen("pointerleave",this._onPointerLeave.bind(this)),this.listen("pointerdown",this._onPointerDown.bind(this)),this.listen("keydown",this._onKeyDown.bind(this)),this.listen("keyup",this._onKeyUp.bind(this)))}_attachPointerListeners(){this._delegate._isDisabled()||!this.$state.dragging()||(S(document,"pointerup",this._onDocumentPointerUp.bind(this)),S(document,"pointermove",this._onDocumentPointerMove.bind(this)),I_&&S(document,"touchmove",this._onDocumentTouchMove.bind(this),{passive:!1}))}_onFocus(){this._updatePointerValue(this.$state.value())}_updateValue(e,n){let{value:i,min:r,max:s,dragging:a}=this.$state,o=Math.max(r(),Math.min(e,s()));i.set(o);let l=this.createEvent("value-change",{detail:o,trigger:n});if(this.dispatch(l),this._delegate._onValueChange?.(l),a()){let c=this.createEvent("drag-value-change",{detail:o,trigger:n});this.dispatch(c),this._delegate._onDragValueChange?.(c)}}_updatePointerValue(e,n){let{pointerValue:i,dragging:r}=this.$state;i.set(e),this.dispatch("pointer-value-change",{detail:e,trigger:n}),r()&&this._updateValue(e,n)}_getPointerValue(e){let n,i=this.el.getBoundingClientRect(),{min:r,max:s}=this.$state;if(this.$props.orientation()==="vertical"){let{bottom:a,height:o}=i;n=(a-e.clientY)/o}else if(this._touch&&Be(this._touchStartValue)){let{width:a}=this._provider.getBoundingClientRect(),o=(e.clientX-this._touch.clientX)/a,l=s()-r(),c=l*Math.abs(o);n=(o<0?this._touchStartValue-c:this._touchStartValue+c)/l}else{let{left:a,width:o}=i;n=(e.clientX-a)/o}return Math.max(r(),Math.min(s(),this._delegate._roundValue(l3(r(),s(),n,this._delegate._getStep()))))}_onPointerEnter(e){this.$state.pointing.set(!0)}_onPointerMove(e){let{dragging:n}=this.$state;n()||this._updatePointerValue(this._getPointerValue(e),e)}_onPointerLeave(e){this.$state.pointing.set(!1)}_onPointerDown(e){if(e.button!==0)return;let n=this._getPointerValue(e);this._onStartDragging(n,e),this._updatePointerValue(n,e)}_onStartDragging(e,n){let{dragging:i}=this.$state;if(i())return;i.set(!0),this._media.remote.pauseControls(n);let r=this.createEvent("drag-start",{detail:e,trigger:n});this.dispatch(r),this._delegate._onDragStart?.(r)}_onStopDragging(e,n){let{dragging:i}=this.$state;if(!i())return;i.set(!1),this._media.remote.resumeControls(n);let r=this.createEvent("drag-end",{detail:e,trigger:n});this.dispatch(r),this._delegate._onDragEnd?.(r),this._touch=null,this._touchStartValue=null}_onKeyDown(e){let{key:n}=e,{min:i,max:r}=this.$state,s;if(n==="Home"||n==="PageUp"?s=i():n==="End"||n==="PageDown"?s=r():!e.metaKey&&/[0-9]/.test(n)&&(s=(r()-i())/10*Number(n)),!Le(s)){this._updatePointerValue(s,e),this._updateValue(s,e);return}let a=this._getKeyValue(e);if(Le(a))return;let o=n===this._lastDownKey;!this.$state.dragging()&&o&&this._onStartDragging(a,e),this._updatePointerValue(a,e),o||this._updateValue(a,e),this._lastDownKey=n}_onKeyUp(e){this._lastDownKey="";let{dragging:n,value:i}=this.$state;if(!n())return;let r=this._getKeyValue(e)??i();this._updatePointerValue(r),this._onStopDragging(r,e)}_getKeyValue(e){let{key:n,shiftKey:i}=e;if(!Object.keys(SP).includes(n))return;e.preventDefault(),e.stopPropagation();let{shiftKeyMultiplier:s}=this.$props,{value:a,min:o,max:l}=this.$state,c=this._delegate._getStep(),u=this._delegate._getKeyStep(),d=i?u*s():u,p=Number(SP[n]),h=d*p,y=(a()+h)/c;return Math.max(o(),Math.min(l(),Number((c*y).toFixed(3))))}_onDocumentPointerUp(e){if(e.button!==0)return;let n=this._getPointerValue(e);this._updatePointerValue(n,e),this._onStopDragging(n,e)}_onDocumentTouchMove(e){e.preventDefault()}},xc=yi(()=>({})),gf=yi(),xi=class extends Lt{constructor(e){super(),this._delegate=e,this._updateSliderVars=Ir((n,i)=>{this.el?.style.setProperty("--slider-fill",n+"%"),this.el?.style.setProperty("--slider-pointer",i+"%")})}onSetup(){this._media=ce();let e=new fn;e.attach(this),this.$state.focused=e.focused.bind(e),$n(xc)||It(xc,{default:"value"}),It(gf,{_orientation:this.$props.orientation,_disabled:this._delegate._isDisabled,_preview:O(null)}),b(this._watchValue.bind(this)),b(this._watchDisabled.bind(this)),this._setupAttrs(),new Pw(this._delegate,this._media).attach(this)}onAttach(e){ye(e,"role","slider"),ye(e,"tabindex","0"),ye(e,"autocomplete","off"),D?this._watchCSSVars():b(this._watchCSSVars.bind(this))}_watchValue(){let{dragging:e,value:n,min:i,max:r}=this.$state;C(e)||n.set(o3(i(),r(),n(),this._delegate._getStep()))}_watchDisabled(){if(!this._delegate._isDisabled())return;let{dragging:e,pointing:n}=this.$state;e.set(!1),n.set(!1)}_getARIADisabled(){return Va(this._delegate._isDisabled())}_setupAttrs(){let{orientation:e}=this.$props,{dragging:n,active:i,pointing:r}=this.$state;this.setAttributes({"data-dragging":n,"data-pointing":r,"data-active":i,"aria-disabled":this._getARIADisabled.bind(this),"aria-valuemin":this.$state.min,"aria-valuemax":this.$state.max,"aria-valuenow":this._delegate._getARIAValueNow,"aria-valuetext":this._delegate._getARIAValueText,"aria-orientation":e})}_watchCSSVars(){let{fillPercent:e,pointerPercent:n}=this.$state;this._updateSliderVars(Dt(e(),3),Dt(n(),3))}};xi.props={disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};Zi=class extends B{constructor(){super(),new xi({_getStep:this.$props.step,_getKeyStep:this.$props.keyStep,_roundValue:Math.round,_isDisabled:this.$props.disabled,_getARIAValueNow:this._getARIAValueNow.bind(this),_getARIAValueText:this._getARIAValueText.bind(this)})}onSetup(){b(this._watchValue.bind(this)),b(this._watchMinMax.bind(this))}_getARIAValueNow(){let{value:e}=this.$state;return Math.round(e())}_getARIAValueText(){let{value:e,max:n}=this.$state;return Dt(e()/n()*100,2)+"%"}_watchValue(){let{value:e}=this.$props;this.$state.value.set(e())}_watchMinMax(){let{min:e,max:n}=this.$props;this.$state.min.set(e()),this.$state.max.set(n())}};Zi.props={...xi.props,min:0,max:100,value:0};Zi.state=mf;Yi=new Map,bh=new Map,rf=class t{constructor(e,n,i){this.$src=e,this.$crossOrigin=n,this._media=i,this.$images=O([]),b(this._onLoadCues.bind(this))}static create(e,n){let i=ce();return new t(e,n,i)}_onLoadCues(){let{canLoad:e}=this._media.$state;if(!e())return;let n=this.$src(),i=new AbortController;if(n){if(U(n)&&Yi.has(n)){let r=Yi.get(n);if(Yi.delete(n),Yi.set(n,r),Yi.size>30){let s=Yi.keys().next().value;Yi.delete(s)}this.$images.set(Yi.get(n))}else if(U(n)){let r=this.$crossOrigin(),s=n+"::"+r;if(!bh.has(s)){let a=new Promise(async(o,l)=>{try{let c=await fetch(n,{signal:i.signal,credentials:Eh(r)});if(c.headers.get("content-type")==="application/json"){let d=await c.json();if(qe(d))if(d[0]&&"text"in d)o(this._processVTTCues(d));else{for(let p=0;p<d.length;p++){let h=d[p];Gi(Ql(h),!1),Gi("url"in h&&U(h.url),!1),Gi("startTime"in h&&Be(h.startTime),!1)}o(d)}else o(this._processStoryboard(d));return}Promise.resolve().then(()=>(cc(),lc)).then(async({parseResponse:d})=>{try{let{cues:p}=await d(c);o(this._processVTTCues(p))}catch(p){l(p)}})}catch(c){l(c)}}).then(o=>(i.signal.aborted||Yi.set(s,o),o)).catch(o=>{i.signal.aborted||this._onError(n,o)}).finally(()=>{U(s)&&bh.delete(s)});bh.set(s,a)}bh.get(s)?.then(a=>{i.signal.aborted||this.$images.set(a||[])})}else if(qe(n))try{this.$images.set(this._processImages(n))}catch(r){this._onError(n,r)}else try{this.$images.set(this._processStoryboard(n))}catch(r){this._onError(n,r)}return()=>{i.abort(),this.$images.set([])}}}_processImages(e){let n=this._resolveBaseUrl();return e.map((i,r)=>(Gi(i.url&&U(i.url),!1),Gi("startTime"in i&&Be(i.startTime),!1),{...i,url:U(i.url)?this._resolveURL(i.url,n):i.url}))}_processStoryboard(e){Gi(U(e.url),!1),Gi(qe(e.tiles)&&e.tiles?.length,!1);let n=new URL(e.url),i=[],r="tile_width"in e?e.tile_width:e.tileWidth,s="tile_height"in e?e.tile_height:e.tileHeight;for(let a of e.tiles)i.push({url:n,startTime:"start"in a?a.start:a.startTime,width:r,height:s,coords:{x:a.x,y:a.y}});return i}_processVTTCues(e){for(let r=0;r<e.length;r++){let s=e[r];Gi("startTime"in s&&Be(s.startTime),!1),Gi("text"in s&&U(s.text),!1)}let n=[],i=this._resolveBaseUrl();for(let r of e){let[s,a]=r.text.split("#"),o=this._resolveData(a);n.push({url:this._resolveURL(s,i),startTime:r.startTime,endTime:r.endTime,width:o?.w,height:o?.h,coords:o&&Be(o.x)&&Be(o.y)?{x:o.x,y:o.y}:void 0})}return n}_resolveBaseUrl(){let e=C(this.$src);return!U(e)||!/^https?:/.test(e)?location.href:e}_resolveURL(e,n){return/^https?:/.test(e)?new URL(e):new URL(e,n)}_resolveData(e){if(!e)return{};let[n,i]=e.split("="),r=i?.split(","),s={};if(!n||!r)return null;for(let a=0;a<n.length;a++){let o=+r[a];isNaN(o)||(s[n[a]]=o)}return s}_onError(e,n){}},Xa=class extends B{constructor(){super(...arguments),this._styleResets=[]}onSetup(){this._media=ce(),this._loader=rf.create(this.$props.src,this.$state.crossOrigin),this._watchCrossOrigin(),this.setAttributes({"data-loading":this._isLoading.bind(this),"data-error":this._hasError.bind(this),"data-hidden":this.$state.hidden,"aria-hidden":Xt(this.$state.hidden)})}onConnect(e){b(this._watchImg.bind(this)),b(this._watchHidden.bind(this)),b(this._watchCrossOrigin.bind(this)),b(this._onLoadStart.bind(this)),b(this._onFindActiveThumbnail.bind(this)),b(this._resize.bind(this))}_watchImg(){let e=this.$state.img();e&&(S(e,"load",this._onLoaded.bind(this)),S(e,"error",this._onError.bind(this)))}_watchCrossOrigin(){let{crossOrigin:e}=this.$props,{crossOrigin:n}=this.$state,{crossOrigin:i}=this._media.$state,r=e()!==null?e():i();n.set(r===!0?"anonymous":r)}_onLoadStart(){let{src:e,loading:n,error:i}=this.$state;return e()&&(n.set(!0),i.set(null)),()=>{this._resetStyles(),n.set(!1),i.set(null)}}_onLoaded(){let{loading:e,error:n}=this.$state;e.set(!1),n.set(null)}_onError(e){let{loading:n,error:i}=this.$state;n.set(!1),i.set(e)}_isLoading(){let{loading:e,hidden:n}=this.$state;return!n()&&e()}_hasError(){let{error:e}=this.$state;return!vi(e())}_watchHidden(){let{hidden:e}=this.$state,{duration:n}=this._media.$state,i=this._loader.$images();e.set(this._hasError()||!Number.isFinite(n())||i.length===0)}_getTime(){return this.$props.time()}_onFindActiveThumbnail(){let e=this._getTime(),{src:n,activeThumbnail:i}=this.$state,r=this._loader.$images(),s=-1,a=null;for(let o=r.length-1;o>=0;o--){let l=r[o];if(e>=l.startTime&&(!l.endTime||e<l.endTime)){s=o;break}}r[s]&&(a=r[s]),i.set(a),n.set(a?.url.href||"")}_resize(){if(!this.scope)return;let e=this.el,n=this.$state.img(),i=this.$state.loading(),r=this.$state.activeThumbnail();if(!n||!r||!e||i)return;let s=r.width??n.naturalWidth,a=r?.height??n.naturalHeight,{maxWidth:o,maxHeight:l,minWidth:c,minHeight:u,width:d,height:p}=getComputedStyle(this.el);c==="100%"&&(c=parseFloat(d)+""),u==="100%"&&(u=parseFloat(p)+"");let h=Math.max(parseInt(c)/s,parseInt(u)/a),y=Math.min(Math.max(parseInt(c),parseInt(o))/s,Math.max(parseInt(u),parseInt(l))/a),v=!isNaN(y)&&y<1?y:h>1?h:1;this._style(e,"--thumbnail-width",`${s*v}px`),this._style(e,"--thumbnail-height",`${a*v}px`),this._style(n,"width",`${n.naturalWidth*v}px`),this._style(n,"height",`${n.naturalHeight*v}px`),this._style(n,"transform",r.coords?`translate(-${r.coords.x*v}px, -${r.coords.y*v}px)`:""),this._style(n,"max-width","none")}_style(e,n,i){e.style.setProperty(n,i),this._styleResets.push(()=>e.style.removeProperty(n))}_resetStyles(){for(let e of this._styleResets)e();this._styleResets=[]}};Xa.props={src:null,time:0,crossOrigin:null};Xa.state=new ei({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1});sf=class extends Xa{onAttach(e){this._slider=xs(Zi.state)}_getTime(){let{duration:e,clipStartTime:n}=this._media.$state;return n()+this._slider.pointerRate()*e()}},c3=Object.defineProperty,u3=Object.getOwnPropertyDescriptor,d3=(t,e,n,i)=>{for(var r=i>1?void 0:i?u3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&c3(e,n,r),r},Ms=class extends B{get video(){return this.$state.video()}onSetup(){this._media=ce(),this._slider=xs(Zi.state),this._watchCrossOrigin(),this.setAttributes({"data-loading":this._isLoading.bind(this),"data-hidden":this.$state.hidden,"data-error":this._hasError.bind(this),"aria-hidden":Xt(this.$state.hidden)})}onAttach(e){b(this._watchVideo.bind(this)),b(this._watchSrc.bind(this)),b(this._watchCrossOrigin.bind(this)),b(this._watchHidden.bind(this)),b(this._onSrcChange.bind(this)),b(this._onUpdateTime.bind(this))}_watchVideo(){let e=this.$state.video();e&&(e.readyState>=2&&this._onCanPlay(),S(e,"canplay",this._onCanPlay.bind(this)),S(e,"error",this._onError.bind(this)))}_watchSrc(){let{src:e}=this.$state,{canLoad:n}=this._media.$state;e.set(n()?this.$props.src():null)}_watchCrossOrigin(){let{crossOrigin:e}=this.$props,{crossOrigin:n}=this.$state,{crossOrigin:i}=this._media.$state,r=e()!==null?e():i();n.set(r===!0?"anonymous":r)}_isLoading(){let{canPlay:e,hidden:n}=this.$state;return!e()&&!n()}_hasError(){let{error:e}=this.$state;return!vi(e)}_watchHidden(){let{src:e,hidden:n}=this.$state,{canLoad:i,duration:r}=this._media.$state;n.set(i()&&(!e()||this._hasError()||!Number.isFinite(r())))}_onSrcChange(){let{src:e,canPlay:n,error:i}=this.$state;e(),n.set(!1),i.set(null)}_onCanPlay(e){let{canPlay:n,error:i}=this.$state;n.set(!0),i.set(null),this.dispatch("can-play",{trigger:e})}_onError(e){let{canPlay:n,error:i}=this.$state;n.set(!1),i.set(e),this.dispatch("error",{trigger:e})}_onUpdateTime(){let{video:e,canPlay:n}=this.$state,{duration:i}=this._media.$state,{pointerRate:r}=this._slider,s=e();n()&&s&&Number.isFinite(i())&&Number.isFinite(r())&&(s.currentTime=r()*i())}};Ms.props={src:null,crossOrigin:null};Ms.state=new ei({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});d3([te],Ms.prototype,"video",1);p3=Object.defineProperty,h3=Object.getOwnPropertyDescriptor,f3=(t,e,n,i)=>{for(var r=i>1?void 0:i?h3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&p3(e,n,r),r},Za=class extends B{onSetup(){this._slider=xs(Zi.state),this._format=Ie(xc),this._text=gi(this.getValueText.bind(this))}getValueText(){let{type:e,format:n,decimalPlaces:i,padHours:r,padMinutes:s,showHours:a}=this.$props,{value:o,pointerValue:l,min:c,max:u}=this._slider,d=n()??this._format.default,p=e()==="current"?o():l();if(d==="percent"){let h=u()-c(),y=p/h*100;return(this._format.percent??Dt)(y,i())+"\uFE6A"}else return d==="time"?(this._format.time??Ur)(p,r(),s(),a()):this._format.value?.(p)??p.toFixed(2)}};Za.props={type:"pointer",format:null,showHours:!1,padHours:null,padMinutes:null,decimalPlaces:2};f3([Ae],Za.prototype,"getValueText",1);Tc=class extends B{constructor(){super(...arguments),this._updatePlacement=Ir(()=>{let{_disabled:e,_orientation:n}=this._slider;if(e())return;let i=this.el,{offset:r,noClamp:s}=this.$props;Hw(i,{clamp:!s(),offset:r(),orientation:n()})})}onSetup(){this._slider=Ie(gf);let{active:e}=xs(Zi.state);this.setAttributes({"data-visible":e})}onAttach(e){Object.assign(e.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(e){let{_preview:n}=this._slider;n.set(e),G(()=>n.set(null)),b(this._updatePlacement.bind(this));let i=new ResizeObserver(this._updatePlacement.bind(this));i.observe(e),G(()=>i.disconnect())}};Tc.props={offset:0,noClamp:!1};Ec=class extends B{constructor(){super(...arguments),this._throttleVolumeChange=lu(this._onVolumeChange.bind(this),25)}onSetup(){this._media=ce(),It(xc,{default:"percent"}),new xi({_getStep:this.$props.step,_getKeyStep:this.$props.keyStep,_isDisabled:this.$props.disabled,_roundValue:Math.round,_getARIAValueNow:this._getARIAValueNow.bind(this),_getARIAValueText:this._getARIAValueText.bind(this),_onDragValueChange:this._onDragValueChange.bind(this),_onValueChange:this._onValueChange.bind(this)}).attach(this),b(this._watchVolume.bind(this))}onAttach(e){e.setAttribute("data-media-volume-slider",""),ye(e,"aria-label","Volume");let{canSetVolume:n}=this._media.$state;this.setAttributes({"data-supported":n,"aria-hidden":Xt(()=>!n())})}_getARIAValueNow(){let{value:e}=this.$state;return Math.round(e())}_getARIAValueText(){let{value:e,max:n}=this.$state;return Dt(e()/n()*100,2)+"%"}_watchVolume(){let{muted:e,volume:n}=this._media.$state,i=e()?0:n()*100;this.$state.value.set(i),this.dispatch("value-change",{detail:i})}_onVolumeChange(e){if(!e.trigger)return;let n=Dt(e.detail/100,3);this._media.remote.changeVolume(n,e)}_onValueChange(e){this._throttleVolumeChange(e)}_onDragValueChange(e){this._throttleVolumeChange(e)}};Ec.props={...xi.props,keyStep:5,shiftKeyMultiplier:2};Ec.state=mf;Ja=class extends B{constructor(){super(),this._chapter=O(null),this._playingBeforeDragStart=!1,new xi({_swipeGesture:!0,_getStep:this._getStep.bind(this),_getKeyStep:this._getKeyStep.bind(this),_isDisabled:this._isDisabled.bind(this),_roundValue:this._roundValue,_getARIAValueNow:this._getARIAValueNow.bind(this),_getARIAValueText:this._getARIAValueText.bind(this),_onDragStart:this._onDragStart.bind(this),_onDragValueChange:this._onDragValueChange.bind(this),_onDragEnd:this._onDragEnd.bind(this),_onValueChange:this._onValueChange.bind(this)})}onSetup(){this._media=ce(),It(xc,{default:"time",value:this._formatValue.bind(this),time:this._formatTime.bind(this)}),this.setAttributes({"data-chapters":this._hasChapters.bind(this)}),this.setStyles({"--slider-progress":this._calcBufferedPercent.bind(this)}),b(this._watchCurrentTime.bind(this)),b(this._watchSeekingThrottle.bind(this))}onAttach(e){e.setAttribute("data-media-time-slider",""),ye(e,"aria-label","Seek")}onConnect(e){b(this._watchPreviewing.bind(this)),io(this._media.textTracks,"chapters",this._chapter.set)}_calcBufferedPercent(){let{bufferedEnd:e,duration:n}=this._media.$state;return Dt(Math.min(e()/Math.max(n(),1),1)*100,3)+"%"}_hasChapters(){let{duration:e}=this._media.$state;return this._chapter()?.cues.length&&Number.isFinite(e())&&e()>0}_watchSeekingThrottle(){this._dispatchSeeking=lu(this._seeking.bind(this),this.$props.seekingRequestThrottle())}_watchCurrentTime(){let{currentTime:e}=this._media.$state,{value:n,dragging:i}=this.$state,r=this._timeToPercent(e());C(i)||(n.set(r),this.dispatch("value-change",{detail:r}))}_watchPreviewing(){let e=this._media.player.el,{_preview:n}=Ie(gf);e&&n()&&J(e,"data-preview",this.$state.active())}_seeking(e,n){this._media.remote.seeking(e,n)}_seek(e,n,i){this._dispatchSeeking.cancel();let{live:r}=this._media.$state;if(r()&&n>=99){this._media.remote.seekToLiveEdge(i);return}this._media.remote.seek(e,i)}_onDragStart(e){let{pauseWhileDragging:n}=this.$props;if(n()){let{paused:i}=this._media.$state;this._playingBeforeDragStart=!i(),this._media.remote.pause(e)}}_onDragValueChange(e){this._dispatchSeeking(this._percentToTime(e.detail),e)}_onDragEnd(e){let n=e.detail;this._seek(this._percentToTime(n),n,e);let{pauseWhileDragging:i}=this.$props;i()&&this._playingBeforeDragStart&&(this._media.remote.play(e),this._playingBeforeDragStart=!1)}_onValueChange(e){let{dragging:n}=this.$state;n()||!e.trigger||this._onDragEnd(e)}_getStep(){let e=this.$props.step()/this._media.$state.duration()*100;return Number.isFinite(e)?e:1}_getKeyStep(){let e=this.$props.keyStep()/this._media.$state.duration()*100;return Number.isFinite(e)?e:1}_roundValue(e){return Dt(e,3)}_isDisabled(){let{canSeek:e}=this._media.$state;return this.$props.disabled()||!e()}_getARIAValueNow(){let{value:e}=this.$state;return Math.round(e())}_getARIAValueText(){let e=this._percentToTime(this.$state.value()),{duration:n}=this._media.$state;return Number.isFinite(e)?`${kc(e)} out of ${kc(n())}`:"live"}_percentToTime(e){let{duration:n}=this._media.$state;return Dt(e/100*n(),5)}_timeToPercent(e){let{liveEdge:n,duration:i}=this._media.$state,r=Math.max(0,Math.min(1,n()?1:Math.min(e,i())/i()));return Number.isNaN(r)?0:Number.isFinite(r)?r*100:100}_formatValue(e){let n=this._percentToTime(e),{live:i,duration:r}=this._media.$state;return Number.isFinite(n)?(i()?n-r():n).toFixed(0):"LIVE"}_formatTime(e,n,i,r){let s=this._percentToTime(e),{live:a,duration:o}=this._media.$state,l=a()?s-o():s;return Number.isFinite(s)?`${l<0?"-":""}${Ur(Math.abs(l),n,i,r)}`:"LIVE"}};Ja.props={...xi.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,seekingRequestThrottle:100};Ja.state=mf;m3=Object.defineProperty,g3=Object.getOwnPropertyDescriptor,vf=(t,e,n,i)=>{for(var r=i>1?void 0:i?g3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&m3(e,n,r),r},Ji=class extends B{constructor(){super(...arguments),this._titleRef=null,this._refs=[],this._$track=O(null),this._$cues=O([]),this._activeIndex=O(-1),this._activePointerIndex=O(-1),this._bufferedIndex=0,this._updateBufferedPercent=Ir(e=>{let n,i=this._$cues(),{clipStartTime:r}=this._media.$state,s=r(),a=this._getEndTime(i);for(let o=this._bufferedIndex;o<this._refs.length;o++)if(n=this._calcPercent(i[o],e,s,a),this._refs[o]?.style.setProperty("--chapter-progress",n+"%"),n<100){this._bufferedIndex=o;break}}),this._bufferedPercent=gi(this._calcMediaBufferedPercent.bind(this)),this._onCuesChange=Fw(()=>{let e=C(this._$track);!this.scope||!e||!e.cues.length||(this._$cues.set(this._fillGaps(e.cues)),this._activeIndex.set(0),this._bufferedIndex=0)},150,!0)}get cues(){return this._$cues()}get activeCue(){return this._$cues()[this._activeIndex()]||null}get activePointerCue(){return this._$cues()[this._activePointerIndex()]||null}onSetup(){this._media=ce(),this._sliderState=xs(Ja.state)}onAttach(e){io(this._media.textTracks,"chapters",this._setTrack.bind(this)),b(this._onTrackChange.bind(this))}onConnect(){G(()=>this._reset.bind(this))}onDestroy(){this._setTrack(null)}setRefs(e){if(this._refs=e,this._updateScope?.dispose(),this._refs.length===1){let n=this._refs[0];n.style.width="100%",n.style.setProperty("--chapter-fill","var(--slider-fill)"),n.style.setProperty("--chapter-progress","var(--slider-progress)")}else this._refs.length>0&&nt(()=>this._watch(),this._updateScope=Rt())}_setTrack(e){C(this._$track)!==e&&(this._reset(),this._$track.set(e))}_reset(){this._refs=[],this._$cues.set([]),this._activeIndex.set(-1),this._activePointerIndex.set(-1),this._bufferedIndex=0,this._updateScope?.dispose()}_watch(){this._refs.length&&(b(this._watchContainerWidths.bind(this)),b(this._watchFillPercent.bind(this)),b(this._watchPointerPercent.bind(this)),b(this._watchBufferedPercent.bind(this)))}_watchContainerWidths(){let e=this._$cues();if(!e.length)return;let n,{clipStartTime:i,clipEndTime:r}=this._media.$state,s=i(),a=r()||e[e.length-1].endTime,o=a-s,l=100;for(let c=0;c<e.length;c++)if(n=e[c],this._refs[c]){let u=c===e.length-1?l:Dt((n.endTime-Math.max(s,n.startTime))/o*100,3);this._refs[c].style.width=u+"%",l-=u}}_watchFillPercent(){let{liveEdge:e,ended:n,clipStartTime:i,clipEndTime:r}=this._media.$state,{fillPercent:s,value:a}=this._sliderState,o=this._$cues(),l=e(),c=C(this._activeIndex),u=o[c],d=l?this._$cues.length-1:this._findActiveChapterIndex(u&&u.startTime<=C(a)?c:0,s());l||n()||!u?this._updateFillPercents(0,o.length,"100%"):d>c?this._updateFillPercents(c,d,"100%"):d<c&&this._updateFillPercents(d+1,c+1,"0%");let p=l?"100%":this._calcPercent(o[d],s(),i(),this._getEndTime(o))+"%";this._updateFillPercent(this._refs[d],p),this._activeIndex.set(d)}_watchPointerPercent(){let{pointing:e,pointerPercent:n}=this._sliderState;if(!e()){this._activePointerIndex.set(-1);return}let i=this._findActiveChapterIndex(0,n());this._activePointerIndex.set(i)}_updateFillPercents(e,n,i){for(let r=e;r<n;r++)this._updateFillPercent(this._refs[r],i)}_updateFillPercent(e,n){e&&e.style.setProperty("--chapter-fill",n)}_findActiveChapterIndex(e,n){let i=0,r=this._$cues(),{clipStartTime:s}=this._media.$state,a=s(),o=this._getEndTime(r);for(let l=e;l<r.length;l++)if(i=this._calcPercent(r[l],n,a,o),i>=0&&i<100)return l;return 0}_watchBufferedPercent(){this._updateBufferedPercent(this._bufferedPercent())}_calcMediaBufferedPercent(){let{bufferedEnd:e,duration:n}=this._media.$state;return Dt(Math.min(e()/Math.max(n(),1),1),3)*100}_getEndTime(e){let{clipEndTime:n}=this._media.$state,i=n();return i>0?i:e[e.length-1]?.endTime||0}_calcPercent(e,n,i,r){if(this._$cues().length===0)return 0;let a=r-i,o=Math.max(0,e.startTime-i),l=Math.min(r,e.endTime)-i,c=o/a,u=c*100,d=Math.min(1,c+(l-o)/a)*100;return Math.max(0,Dt(n>=d?100:(n-u)/(d-u)*100,3))}_fillGaps(e){let n=[],{clipStartTime:i,clipEndTime:r,duration:s}=this._media.$state,a=i(),o=r()||1/0;e=e.filter(u=>u.startTime<=o&&u.endTime>=a);let l=e[0];l&&l.startTime>a&&n.push(new window.VTTCue(a,l.startTime,""));for(let u=0;u<e.length-1;u++){let d=e[u],p=e[u+1];if(n.push(d),p){let h=p.startTime-d.endTime;h>0&&n.push(new window.VTTCue(d.endTime,d.endTime+h,""))}}let c=e[e.length-1];return c&&(n.push(c),s()>=0&&(o===0||o!==1/0&&c.endTime<o)&&Math.abs(c.endTime-s())>1&&n.push(new window.VTTCue(c.endTime,s(),""))),n}_onTrackChange(){if(!this.scope)return;let{disabled:e}=this.$props;if(e()){this._$cues.set([]),this._activeIndex.set(0),this._bufferedIndex=0;return}let n=this._$track();if(n){let i=this._onCuesChange.bind(this);i(),G(S(n,"add-cue",i)),G(S(n,"remove-cue",i)),b(this._watchMediaDuration.bind(this))}return this._titleRef=this._findChapterTitleRef(),this._titleRef&&b(this._onChapterTitleChange.bind(this)),()=>{this._titleRef&&(this._titleRef.textContent="",this._titleRef=null)}}_watchMediaDuration(){this._media.$state.duration(),this._onCuesChange()}_onChapterTitleChange(){let e=this.activePointerCue||this.activeCue;this._titleRef&&(this._titleRef.textContent=e?.text||"")}_findParentSlider(){let e=this.el;for(;e&&e.getAttribute("role")!=="slider";)e=e.parentElement;return e}_findChapterTitleRef(){let e=this._findParentSlider();return e?e.querySelector('[data-part="chapter-title"]'):null}};Ji.props={disabled:!1};vf([te],Ji.prototype,"cues",1);vf([te],Ji.prototype,"activeCue",1);vf([te],Ji.prototype,"activePointerCue",1);vf([Ae],Ji.prototype,"setRefs",1);ut=yi(),v3=["a[href]","[tabindex]","input","select","button"].map(t=>`${t}:not([aria-hidden='true'])`).join(","),PP=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]),Cw=class{constructor(e){this._delegate=e,this._index=0,this._el=null,this._elements=[]}get _items(){return this._elements}_attachMenu(e){return S(e,"focus",this._onFocus.bind(this)),this._el=e,G(()=>{this._el=null}),this}_listen(){this._el&&(this._update(),S(this._el,"keyup",this._onKeyUp.bind(this)),S(this._el,"keydown",this._onKeyDown.bind(this)),G(()=>{this._index=0,this._elements=[]}))}_update(){this._index=0,this._elements=this._getFocusableElements()}_scroll(e=this._findActiveIndex()){let n=this._elements[e],i=this._delegate._getScrollContainer();n&&i&&requestAnimationFrame(()=>{i.scrollTop=n.offsetTop-i.offsetHeight/2+n.offsetHeight/2})}_focusAt(e){this._index=e,this._elements[e]?.focus(),this._scroll(e)}_findActiveIndex(){return this._elements.findIndex(e=>e.getAttribute("aria-checked")==="true")}_onFocus(){this._update(),setTimeout(()=>{let e=this._findActiveIndex();this._focusAt(e>=0?e:0)},100)}_onKeyUp(e){PP.has(e.key)&&(e.stopPropagation(),e.preventDefault())}_onKeyDown(e){if(PP.has(e.key))switch(e.stopPropagation(),e.preventDefault(),e.key){case"Escape":this._delegate._closeMenu(e);break;case"Tab":this._focusAt(this._nextIndex(e.shiftKey?-1:1));break;case"ArrowUp":this._focusAt(this._nextIndex(-1));break;case"ArrowDown":this._focusAt(this._nextIndex(1));break;case"Home":case"PageUp":this._focusAt(0);break;case"End":case"PageDown":this._focusAt(this._elements.length-1);break}}_nextIndex(e){let n=this._index;do n=(n+e+this._elements.length)%this._elements.length;while(this._elements[n]?.offsetParent===null);return n}_getFocusableElements(){if(!this._el)return[];let e=this._el.querySelectorAll(v3),n=[],i=r=>r.getAttribute("role")==="menu";for(let r of e)r instanceof HTMLElement&&r.offsetParent!==null&&GP(this._el,r,i)&&n.push(r);return n}},y3=Object.defineProperty,_3=Object.getOwnPropertyDescriptor,cu=(t,e,n,i)=>{for(var r=i>1?void 0:i?_3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&y3(e,n,r),r},w3=0,er=class extends B{constructor(){super(),this._expanded=O(!1),this._disabled=O(!1),this._trigger=O(null),this._content=O(null),this._isTriggerDisabled=O(!1),this._submenus=new Set,this._menuObserver=null,this._removeSubmenuBind=this._removeSubmenu.bind(this),this._onSubmenuOpenBind=this._onSubmenuOpen.bind(this),this._onSubmenuCloseBind=this._onSubmenuClose.bind(this),this._onResize=Ir(()=>{let n=C(this._content);if(!n||D)return;let i=0,r=getComputedStyle(n),s=[...n.children];for(let a of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])i+=parseFloat(r[a])||0;for(let a of s)if(a instanceof HTMLElement&&a.style.display==="contents")s.push(...a.children);else if(a.nodeType===3)i+=parseFloat(getComputedStyle(a).fontSize);else if(a instanceof HTMLElement){let o=getComputedStyle(a);if(o.display==="none")continue;i+=a.offsetHeight+(parseFloat(o.marginTop)||0)+(parseFloat(o.marginBottom)||0)}requestAnimationFrame(()=>{ct(n,"--menu-height",i+"px")})});let{showDelay:e}=this.$props;this._popper=new Bh({_trigger:this._trigger,_content:this._content,_showDelay:e,_listen:(n,i,r)=>{Vr(n,a=>{this._expanded()?r(a):i(a)});let s=this._getCloseTarget();s&&Vr(s,a=>{a.stopPropagation(),r(a)})},_onChange:this._onExpandedChange.bind(this)})}get triggerElement(){return this._trigger()}get contentElement(){return this._content()}get isSubmenu(){return!!this._parentMenu}onSetup(){this._media=ce();let e=++w3;this._menuId=`media-menu-${e}`,this._menuButtonId=`media-menu-button-${e}`,this._focus=new Cw({_getScrollContainer:this._findScrollContainer.bind(this),_closeMenu:this.close.bind(this)}),$n(ut)&&(this._parentMenu=Ie(ut)),this.setAttributes({"data-open":this._expanded,"data-submenu":this.isSubmenu,"data-disabled":this._isDisabled.bind(this)}),It(ut,{_button:this._trigger,_expanded:this._expanded,_hint:O(""),_disable:this._disable.bind(this),_attachMenuButton:this._attachMenuButton.bind(this),_attachMenuItems:this._attachMenuItems.bind(this),_attachObserver:this._attachObserver.bind(this),_disableMenuButton:this._disableMenuButton.bind(this),_addSubmenu:this._addSubmenu.bind(this)})}onAttach(e){e.style.setProperty("display","contents"),this._focus._attachMenu(e)}onConnect(e){b(this._watchExpanded.bind(this)),this.isSubmenu&&this._parentMenu?._addSubmenu(this)}onDestroy(){this._trigger.set(null),this._content.set(null),this._menuObserver=null}_watchExpanded(){let e=this._isExpanded();this.isSubmenu||this._onResize(),this._updateMenuItemsHidden(e),e&&(b(()=>{let{height:n}=this._media.$state,i=this._content();i&&ct(i,"--player-height",n()+"px")}),this._focus._listen(),this.listen("pointerup",this._onPointerUp.bind(this)),S(window,"pointerup",this._onWindowPointerUp.bind(this)))}_attachMenuButton(e){let n=e.el,i=this.isSubmenu,r=Xt(this._isDisabled.bind(this));ye(n,"tabindex",i?"-1":"0"),ye(n,"role",i?"menuitem":"button"),J(n,"id",this._menuButtonId),J(n,"aria-haspopup","menu"),J(n,"aria-expanded","false"),J(n,"data-submenu",this.isSubmenu),this.isSubmenu||this._stopClickPropagation(n);let s=()=>{J(n,"data-open",this._expanded()),J(n,"aria-disabled",r())};D?s():b(s),this._trigger.set(n),G(()=>{this._trigger.set(null)})}_attachMenuItems(e){let n=e.el;n.style.setProperty("display","none"),J(n,"id",this._menuId),ye(n,"role","menu"),ye(n,"tabindex","-1"),J(n,"data-submenu",this.isSubmenu),this._content.set(n),G(()=>this._content.set(null));let i=()=>J(n,"data-open",this._expanded());if(D?i():b(i),this._focus._attachMenu(n),this._updateMenuItemsHidden(!1),!this.isSubmenu){let r=this._onResizeTransition.bind(this);e.listen("transitionstart",r),e.listen("transitionend",r),e.listen("vds-menu-resize",this._onResize)}}_attachObserver(e){this._menuObserver=e}_stopClickPropagation(e){S(e,"click",n=>n.stopPropagation()),S(e,"pointerup",n=>n.stopPropagation())}_updateMenuItemsHidden(e){let n=C(this._content);n&&J(n,"aria-hidden",Va(!e))}_disableMenuButton(e){this._isTriggerDisabled.set(e)}_onExpandedChange(e,n){if(n?.stopPropagation(),this._expanded()===e)return;if(this._isDisabled()){e&&this._popper.hide(n);return}this.el?.dispatchEvent(new Event("vds-menu-resize",{bubbles:!0,composed:!0}));let i=this._trigger(),r=this._content();if(i&&(J(i,"aria-controls",e&&this._menuId),J(i,"aria-expanded",Va(e))),r&&J(r,"aria-labelledby",e&&this._menuButtonId),this._expanded.set(e),this._toggleMediaControls(n),ti(),qi(n)){e?r?.focus():i?.focus();for(let s of[this.el,r])s&&s.setAttribute("data-keyboard","")}else for(let s of[this.el,r])s&&s.removeAttribute("data-keyboard");this.dispatch(e?"open":"close",{trigger:n}),e?(!this.isSubmenu&&this._media.activeMenu!==this&&(this._media.activeMenu?.close(n),this._media.activeMenu=this),this._menuObserver?._onOpen?.(n)):(this.isSubmenu?setTimeout(()=>{for(let s of this._submenus)s.close(n)},300):this._media.activeMenu=null,this._menuObserver?._onClose?.(n)),e&&!qi(n)&&requestAnimationFrame(()=>{this._focus._update(),setTimeout(()=>{this._focus._scroll()},100)})}_isExpanded(){return!this._isDisabled()&&this._expanded()}_isDisabled(){return this._disabled()||this._isTriggerDisabled()}_disable(e){this._disabled.set(e)}_onPointerUp(e){e.stopPropagation()}_onWindowPointerUp(e){if(!(!(e.target instanceof Node)||this._content()?.contains(e.target))){if(this.isSubmenu)return setTimeout(this.close.bind(this,e),800);this.close(e)}}_getCloseTarget(){let e=this.el?.querySelector('[data-part="close-target"]');return this.el&&e&&GP(this.el,e,n=>n.getAttribute("role")==="menu")?e:null}_findScrollContainer(){if(this.isSubmenu){let e=this.el;for(;e&&e.tagName!=="media-menu"&&e.hasAttribute("data-submenu");)e=e.parentNode;return e}else return C(this._content)||null}_toggleMediaControls(e){this.isSubmenu||(this._expanded()?this._media.remote.pauseControls(e):this._media.remote.resumeControls(e))}_addSubmenu(e){this._submenus.add(e),S(e,"open",this._onSubmenuOpenBind),S(e,"close",this._onSubmenuCloseBind),G(this._removeSubmenuBind)}_removeSubmenu(e){this._submenus.delete(e)}_onSubmenuOpen(e){this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","true");for(let n of this._submenus)if(n!==e.target)for(let i of[n.el,n.triggerElement])i?.setAttribute("aria-hidden","true")}_onSubmenuClose(){this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","false");for(let e of this._submenus)for(let n of[e.el,e.triggerElement])n?.setAttribute("aria-hidden","false")}_onResizeTransition(e){let n=this._content();if(n&&e.propertyName==="height"){let i=e.type==="transitionstart";J(n,"data-resizing",i)}}open(e){C(this._expanded)||(this._popper.show(e),ti())}close(e){C(this._expanded)&&(this._popper.hide(e),ti())}};er.props={showDelay:0};cu([te],er.prototype,"triggerElement",1);cu([te],er.prototype,"contentElement",1);cu([te],er.prototype,"isSubmenu",1);cu([Ae],er.prototype,"open",1);cu([Ae],er.prototype,"close",1);b3=Object.defineProperty,x3=Object.getOwnPropertyDescriptor,k3=(t,e,n,i)=>{for(var r=i>1?void 0:i?x3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&b3(e,n,r),r},Rs=class extends B{get expanded(){return this._menu?._expanded()??!1}constructor(){super(),new fn}onSetup(){this._menu=Ie(ut)}onAttach(e){this._menu._attachMenuButton(this),b(this._watchDisabled.bind(this)),ye(e,"type","button")}onConnect(e){let n=Array.from(e.querySelectorAll('[data-part="hint"]')).pop();n&&b(()=>{let i=this._menu._hint();i&&(n.textContent=i)}),Vr(e,i=>{this.dispatch("select",{trigger:i})})}_watchDisabled(){this._menu._disableMenuButton(this.$props.disabled())}};Rs.props={disabled:!1};k3([te],Rs.prototype,"expanded",1);af=class extends Rs{},of=class extends B{constructor(){super(...arguments),this._target=null}onSetup(){this._media=ce(),It(gc,{_attach:this._attachElement.bind(this)})}onAttach(e){e.style.setProperty("display","contents")}onConnect(e){}onDestroy(){this._target?.remove(),this._target=null}_attachElement(e){this._portal(!1),this._target=e,Ch(()=>{Ch(()=>{this.connectScope&&b(this._watchDisabled.bind(this))})})}_watchDisabled(){let{fullscreen:e}=this._media.$state,{disabled:n}=this.$props,i=n();this._portal(i==="fullscreen"?!e():!i)}_portal(e){if(!this._target)return;let n=this._getContainer(this.$props.container());if(!n)return;let i=this._target.parentElement===n;J(this._target,"data-portal",e),e?i||(this._target.remove(),n.append(this._target)):i&&this._target.parentElement===n&&(this._target.remove(),this.el?.append(this._target))}_getContainer(e){return e instanceof HTMLElement?e:e?document.querySelector(e):document.body}};of.props={container:null,disabled:!1};gc=yi(),Sc=class extends B{constructor(){super(),new fn;let{placement:e}=this.$props;this.setAttributes({"data-placement":e})}onAttach(e){if(this._menu=Ie(ut),this._menu._attachMenuItems(this),$n(gc)){let n=Ie(gc);n&&(It(gc,null),n._attach(e),G(()=>n._attach(null)))}}onConnect(e){b(this._watchPlacement.bind(this))}_watchPlacement(){if(!this.el)return;let e=this.$props.placement();if(e){Object.assign(this.el.style,{position:"absolute",top:0,left:0,width:"max-content"});let{offset:n,alignOffset:i}=this.$props;return YP(this.el,this._getButton(),e,{offsetVarName:"media-menu",xOffset:i(),yOffset:n()})}else this.el.removeAttribute("style"),this.el.style.display="none"}_getButton(){return this._menu._button()}};Sc.props={placement:null,offset:0,alignOffset:0};$w=yi(),Fr=class extends Lt{constructor(){super(...arguments),this._group=new Set,this._value=O(""),this._controller=null,this._onChangeBind=this._onChange.bind(this)}get _values(){return Array.from(this._group).map(e=>e._value())}get value(){return this._value()}set value(e){this._onChange(e)}onSetup(){It($w,{add:this._addRadio.bind(this),remove:this._removeRadio.bind(this)})}onAttach(e){$n(ut)||ye(e,"role","radiogroup"),this.setAttributes({value:this._value})}onDestroy(){this._group.clear()}_addRadio(e){this._group.has(e)||(this._group.add(e),e._onCheck=this._onChangeBind,e._check(e._value()===this._value()))}_removeRadio(e){e._onCheck=null,this._group.delete(e)}_onChange(e,n){let i=C(this._value);if(!e||e===i)return;let r=this._findRadio(i),s=this._findRadio(e);r?._check(!1,n),s?._check(!0,n),this._value.set(e),this._onValueChange?.(e,n)}_findRadio(e){for(let n of this._group)if(e===C(n._value))return n;return null}},T3=Object.defineProperty,E3=Object.getOwnPropertyDescriptor,p1=(t,e,n,i)=>{for(var r=i>1?void 0:i?E3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&T3(e,n,r),r},eo=class extends B{get values(){return this._controller._values}get value(){return this._controller.value}set value(e){this._controller.value=e}constructor(){super(),this._controller=new Fr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){D?this._watchValue():b(this._watchValue.bind(this))}_watchValue(){this._controller.value=this.$props.value()}_onValueChange(e,n){let i=this.createEvent("change",{detail:e,trigger:n});this.dispatch(i)}};eo.props={value:""};p1([te],eo.prototype,"values",1);p1([te],eo.prototype,"value",1);S3=Object.defineProperty,P3=Object.getOwnPropertyDescriptor,C3=(t,e,n,i)=>{for(var r=i>1?void 0:i?P3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&S3(e,n,r),r},to=class extends B{constructor(){super(),this._checked=O(!1),this._controller={_value:this.$props.value,_check:this._check.bind(this),_onCheck:null},new fn}get checked(){return this._checked()}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this._checked,"aria-checked":Xt(this._checked)})}onAttach(e){let n=$n(ut);ye(e,"tabindex",n?"-1":"0"),ye(e,"role",n?"menuitemradio":"radio"),b(this._watchValue.bind(this))}onConnect(e){this._addToGroup(),Vr(e,this._onPress.bind(this)),G(this._onDisconnect.bind(this))}_onDisconnect(){nt(()=>{Ie($w).remove(this._controller)},this.connectScope)}_addToGroup(){Ie($w).add(this._controller)}_watchValue(){let{value:e}=this.$props,n=e();C(this._checked)&&this._controller._onCheck?.(n)}_onPress(e){C(this._checked)||(this._onChange(!0,e),this._onSelect(e),this._controller._onCheck?.(C(this.$props.value),e))}_check(e,n){C(this._checked)!==e&&this._onChange(e,n)}_onChange(e,n){this._checked.set(e),this.dispatch("change",{detail:e,trigger:n})}_onSelect(e){this.dispatch("select",{trigger:e})}};to.props={value:""};C3([te],to.prototype,"checked",1);$3=Object.defineProperty,M3=Object.getOwnPropertyDescriptor,qw=(t,e,n,i)=>{for(var r=i>1?void 0:i?M3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&$3(e,n,r),r},Ls=class extends B{constructor(){super(),this._index=O(0),this._track=O(null),this._cues=O([]),this._controller=new Fr,this._controller._onValueChange=this._onValueChange.bind(this)}get value(){return this._controller.value}get disabled(){return!this._cues()?.length}onSetup(){this._media=ce(),$n(ut)&&(this._menu=Ie(ut));let{thumbnails:e}=this.$props;this.setAttributes({"data-thumbnails":()=>!!e()})}onAttach(e){this._menu?._attachObserver({_onOpen:this._onOpen.bind(this)})}getOptions(){let{clipStartTime:e,clipEndTime:n}=this._media.$state,i=e(),r=n()||1/0;return this._cues().map((s,a)=>({cue:s,value:a.toString(),label:s.text,startTime:Ur(Math.max(0,s.startTime-i),!1),duration:kc(Math.min(r,s.endTime)-Math.max(i,s.startTime))}))}_onOpen(){C(()=>this._watchCurrentTime())}onConnect(e){b(this._watchValue.bind(this)),b(this._watchCurrentTime.bind(this)),b(this._watchControllerDisabled.bind(this)),b(this._watchTrack.bind(this)),io(this._media.textTracks,"chapters",this._track.set)}_watchTrack(){let e=this._track();if(!e)return;let n=this._onCuesChange.bind(this,e);return n(),S(e,"add-cue",n),S(e,"remove-cue",n),()=>{this._cues.set([])}}_onCuesChange(e){let{clipStartTime:n,clipEndTime:i}=this._media.$state,r=n(),s=i()||1/0;this._cues.set([...e.cues].filter(a=>a.startTime<=s&&a.endTime>=r))}_watchValue(){this._controller.value=this._getValue()}_watchCurrentTime(){if(!this._menu?._expanded())return;if(!this._track()){this._index.set(-1);return}let{realCurrentTime:n,clipStartTime:i,clipEndTime:r}=this._media.$state,s=i(),a=r()||1/0,o=n(),l=this._cues().findIndex(c=>Sh(c,o));if(this._index.set(l),l>=0){let c=this._cues()[l],u=this.el.querySelector("[aria-checked='true']"),d=Math.max(s,c.startTime),p=Math.min(a,c.endTime)-d,h=Math.max(0,o-d)/p*100;u&&ct(u,"--progress",Dt(h,3)+"%")}}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_getValue(){return this._index().toString()}_onValueChange(e,n){if(this.disabled||!n)return;let i=+e,r=this._cues(),{clipStartTime:s}=this._media.$state;Be(i)&&r?.[i]&&(this._index.set(i),this._media.remote.seek(r[i].startTime-s(),n),this.dispatch("change",{detail:r[i],trigger:n}))}};Ls.props={thumbnails:null};qw([te],Ls.prototype,"value",1);qw([te],Ls.prototype,"disabled",1);qw([Ae],Ls.prototype,"getOptions",1);R3=Object.defineProperty,L3=Object.getOwnPropertyDescriptor,Bw=(t,e,n,i)=>{for(var r=i>1?void 0:i?L3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&R3(e,n,r),r},Is=class extends B{get value(){return this._controller.value}get disabled(){let{audioTracks:e}=this._media.$state;return e().length===0}constructor(){super(),this._controller=new Fr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=ce(),$n(ut)&&(this._menu=Ie(ut))}onConnect(e){b(this._watchValue.bind(this)),b(this._watchControllerDisabled.bind(this)),b(this._watchHintText.bind(this))}getOptions(){let{audioTracks:e}=this._media.$state;return e().map(n=>({track:n,label:n.label,value:n.label.toLowerCase()}))}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{emptyLabel:e}=this.$props,{audioTrack:n}=this._media.$state,i=n();this._menu?._hint.set(i?.label??e())}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_getValue(){let{audioTrack:e}=this._media.$state,n=e();return n?n.label.toLowerCase():""}_onValueChange(e,n){if(this.disabled)return;let i=this._media.audioTracks.toArray().findIndex(r=>r.label.toLowerCase()===e);if(i>=0){let r=this._media.audioTracks[i];this._media.remote.changeAudioTrack(i,n),this.dispatch("change",{detail:r,trigger:n})}}};Is.props={emptyLabel:"Default"};Bw([te],Is.prototype,"value",1);Bw([te],Is.prototype,"disabled",1);Bw([Ae],Is.prototype,"getOptions",1);I3=Object.defineProperty,A3=Object.getOwnPropertyDescriptor,Ww=(t,e,n,i)=>{for(var r=i>1?void 0:i?A3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&I3(e,n,r),r},As=class extends B{get value(){return this._controller.value}get disabled(){let{hasCaptions:e}=this._media.$state;return!e()}constructor(){super(),this._controller=new Fr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=ce(),$n(ut)&&(this._menu=Ie(ut))}onConnect(e){super.onConnect?.(e),b(this._watchValue.bind(this)),b(this._watchControllerDisabled.bind(this)),b(this._watchHintText.bind(this))}getOptions(){let{offLabel:e}=this.$props,{textTracks:n}=this._media.$state;return[{value:"off",label:e},...n().filter(We).map(i=>({track:i,label:i.label,value:this._getTrackValue(i)}))]}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{offLabel:e}=this.$props,{textTrack:n}=this._media.$state,i=n();this._menu?._hint.set(i&&We(i)&&i.mode==="showing"?i.label:e())}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_getValue(){let{textTrack:e}=this._media.$state,n=e();return n&&We(n)&&n.mode==="showing"?this._getTrackValue(n):"off"}_onValueChange(e,n){if(this.disabled)return;if(e==="off"){let r=this._media.textTracks.selected;if(r){let s=this._media.textTracks.toArray().indexOf(r);this._media.remote.changeTextTrackMode(s,"disabled",n),this.dispatch("change",{detail:null,trigger:n})}return}let i=this._media.textTracks.toArray().findIndex(r=>this._getTrackValue(r)===e);if(i>=0){let r=this._media.textTracks[i];this._media.remote.changeTextTrackMode(i,"showing",n),this.dispatch("change",{detail:r,trigger:n})}}_getTrackValue(e){return e.id+":"+e.kind+"-"+e.label.toLowerCase()}};As.props={offLabel:"Off"};Ww([te],As.prototype,"value",1);Ww([te],As.prototype,"disabled",1);Ww([Ae],As.prototype,"getOptions",1);N3=Object.defineProperty,D3=Object.getOwnPropertyDescriptor,Kw=(t,e,n,i)=>{for(var r=i>1?void 0:i?D3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&N3(e,n,r),r},Ns=class extends B{get value(){return this._controller.value}get disabled(){let{rates:e}=this.$props,{canSetPlaybackRate:n}=this._media.$state;return!n()||e().length===0}constructor(){super(),this._controller=new Fr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=ce(),$n(ut)&&(this._menu=Ie(ut))}onConnect(e){b(this._watchValue.bind(this)),b(this._watchHintText.bind(this)),b(this._watchControllerDisabled.bind(this))}getOptions(){let{rates:e,normalLabel:n}=this.$props;return e().map(i=>({label:i===1?n:i+"\xD7",value:i.toString()}))}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{normalLabel:e}=this.$props,{playbackRate:n}=this._media.$state,i=n();this._menu?._hint.set(i===1?e():i+"\xD7")}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_getValue(){let{playbackRate:e}=this._media.$state;return e().toString()}_onValueChange(e,n){if(this.disabled)return;let i=+e;this._media.remote.changePlaybackRate(i,n),this.dispatch("change",{detail:i,trigger:n})}};Ns.props={normalLabel:"Normal",rates:[.25,.5,.75,1,1.25,1.5,1.75,2]};Kw([te],Ns.prototype,"value",1);Kw([te],Ns.prototype,"disabled",1);Kw([Ae],Ns.prototype,"getOptions",1);O3=Object.defineProperty,V3=Object.getOwnPropertyDescriptor,Gw=(t,e,n,i)=>{for(var r=i>1?void 0:i?V3(e,n):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&O3(e,n,r),r},Ds=class extends B{constructor(){super(),this._sortedQualities=gi(()=>{let{qualities:e}=this._media.$state;return[...e()].sort((n,i)=>i.height===n.height?i.bitrate-n.bitrate:i.height-n.height)}),this._controller=new Fr,this._controller._onValueChange=this._onValueChange.bind(this)}get value(){return this._controller.value}get disabled(){let{canSetQuality:e,qualities:n}=this._media.$state;return!e()||n().length===0}onSetup(){this._media=ce(),$n(ut)&&(this._menu=Ie(ut))}onConnect(e){b(this._watchValue.bind(this)),b(this._watchControllerDisabled.bind(this)),b(this._watchHintText.bind(this))}getOptions(){let{autoLabel:e,hideBitrate:n}=this.$props;return[{value:"auto",label:e},...this._sortedQualities().map(i=>{let r=i.bitrate>=0?`${Dt(i.bitrate/1e6,2)} Mbps`:null;return{quality:i,label:i.height+"p",value:this._getQualityId(i),bitrate:()=>n()?null:r}})]}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{autoLabel:e}=this.$props,{autoQuality:n,quality:i}=this._media.$state,r=i()?i().height+"p":"";this._menu?._hint.set(n()?e()+(r?` (${r})`:""):r)}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_onValueChange(e,n){if(this.disabled)return;if(e==="auto"){this._media.remote.changeQuality(-1,n),this.dispatch("change",{detail:"auto",trigger:n});return}let{qualities:i}=this._media.$state,r=C(i).findIndex(s=>this._getQualityId(s)===e);if(r>=0){let s=C(i)[r];this._media.remote.changeQuality(r,n),this.dispatch("change",{detail:s,trigger:n})}}_getValue(){let{quality:e,autoQuality:n}=this._media.$state;if(n())return"auto";let i=e();return i?this._getQualityId(i):"auto"}_getQualityId(e){return e.height+"_"+e.bitrate}};Ds.props={autoLabel:"Auto",hideBitrate:!1};Gw([te],Ds.prototype,"value",1);Gw([te],Ds.prototype,"disabled",1);Gw([Ae],Ds.prototype,"getOptions",1);lf=class extends B{constructor(){super(...arguments),this._provider=null,this._presses=0,this._pressTimerId=-1}onSetup(){this._media=ce();let{event:e,action:n}=this.$props;this.setAttributes({event:e,action:n})}onAttach(e){e.setAttribute("data-media-gesture",""),e.style.setProperty("pointer-events","none")}onConnect(e){this._provider=this._media.player.el?.querySelector("[data-media-provider]"),b(this._attachListener.bind(this))}_attachListener(){let e=this.$props.event(),n=this.$props.disabled();!this._provider||!e||n||(/^dbl/.test(e)&&(e=e.split(/^dbl/)[1]),(e==="pointerup"||e==="pointerdown")&&this._media.$state.pointer()==="coarse"&&(e=e==="pointerup"?"touchend":"touchstart"),S(this._provider,e,this._acceptEvent.bind(this),{passive:!1}))}_acceptEvent(e){if(this.$props.disabled()||Xl(e)&&(e.button!==0||this._media.activeMenu)||Da(e)&&this._media.activeMenu||Vw(e)||!this._inBounds(e))return;if(e.MEDIA_GESTURE=!0,e.preventDefault(),!C(this.$props.event)?.startsWith("dbl"))this._presses===0&&setTimeout(()=>{this._presses===1&&this._handleEvent(e)},250);else if(this._presses===1){queueMicrotask(()=>this._handleEvent(e)),clearTimeout(this._pressTimerId),this._presses=0;return}this._presses===0&&(this._pressTimerId=window.setTimeout(()=>{this._presses=0},275)),this._presses++}_handleEvent(e){this.el.setAttribute("data-triggered",""),requestAnimationFrame(()=>{this._isTopLayer()&&this._performAction(C(this.$props.action),e),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})}_inBounds(e){if(!this.el)return!1;if(Xl(e)||l_(e)||Da(e)){let n=Da(e)?e.changedTouches[0]??e.touches[0]:void 0,i=n?.clientX??e.clientX,r=n?.clientY??e.clientY,s=this.el.getBoundingClientRect(),a=r>=s.top&&r<=s.bottom&&i>=s.left&&i<=s.right;return e.type.includes("leave")?!a:a}return!0}_isTopLayer(){let e=this._media.player.el.querySelectorAll("[data-media-gesture][data-triggered]");return Array.from(e).sort((n,i)=>+getComputedStyle(i).zIndex-+getComputedStyle(n).zIndex)[0]===this.el}_performAction(e,n){if(!e)return;let i=new q("will-trigger",{detail:e,cancelable:!0,trigger:n});if(this.dispatchEvent(i),i.defaultPrevented)return;let[r,s]=e.replace(/:([a-z])/,"-$1").split(":");e.includes(":fullscreen")?this._media.remote.toggleFullscreen("prefer-media",n):e.includes("seek:")?this._media.remote.seek(C(this._media.$state.currentTime)+(+s||0),n):this._media.remote[Bp(r)](n),this.dispatch("trigger",{detail:e,trigger:n})}};lf.props={disabled:!1,event:void 0,action:void 0};Mw=class{constructor(e){this._renderer=e,this.priority=10,this._track=null,this._disposal=ec()}attach(){}canRender(){return!0}detach(){this._disposal.empty(),this._renderer.reset(),this._track=null}changeTrack(e){!e||this._track===e||(this._disposal.empty(),e.readyState<2?(this._renderer.reset(),this._disposal.add(S(e,"load",()=>this._changeTrack(e),{once:!0}))):this._changeTrack(e),this._disposal.add(S(e,"add-cue",n=>{this._renderer.addCue(n.detail)}),S(e,"remove-cue",n=>{this._renderer.removeCue(n.detail)})),this._track=e)}_changeTrack(e){this._renderer.changeTrack({cues:[...e.cues],regions:[...e.regions]})}},cf=class extends B{onSetup(){this._media=ce(),this.setAttributes({"aria-hidden":Xt(this._isHidden.bind(this))})}onAttach(e){e.style.setProperty("pointer-events","none")}onConnect(e){if(this._renderer){b(this._watchViewType.bind(this));return}Promise.resolve().then(()=>(cc(),lc)).then(n=>{this.connectScope&&nt(()=>{this._lib=n;let{CaptionsRenderer:i}=this._lib;this._renderer=new i(e),this._textRenderer=new Mw(this._renderer),b(this._watchViewType.bind(this))},this.connectScope)})}onDestroy(){this._textRenderer&&(this._textRenderer.detach(),this._media.textRenderers.remove(this._textRenderer)),this._renderer?.destroy()}_isHidden(){let{textTrack:e,remotePlaybackState:n}=this._media.$state,i=e();return this._media.$iosControls()||n()==="connected"||!i||!We(i)}_watchViewType(){let{viewType:e}=this._media.$state;return e()==="audio"?this._setupAudioView():this._setupVideoView()}_setupAudioView(){return b(this._onTrackChange.bind(this)),()=>{this.el.textContent=""}}_onTrackChange(){if(this._isHidden())return;let{textTrack:e}=this._media.$state;this._onCueChange(),S(e(),"cue-change",this._onCueChange.bind(this)),b(this._onUpdateTimedNodes.bind(this))}_onCueChange(){this.el.textContent="";let{realCurrentTime:e,textTrack:n}=this._media.$state,i=C(e),r=C(n).activeCues,{renderVTTCueString:s}=this._lib;for(let a of r){let o=document.createElement("div");o.setAttribute("data-part","cue"),o.innerHTML=s(a,i),this.el.append(o)}}_onUpdateTimedNodes(){let{realCurrentTime:e}=this._media.$state,{updateTimedVTTCueNodes:n}=this._lib;n(this.el,e())}_setupVideoView(){return b(this._watchTextDirection.bind(this)),b(this._watchMediaTime.bind(this)),this._media.textRenderers.add(this._textRenderer),()=>{this.el.textContent="",this._textRenderer.detach(),this._media.textRenderers.remove(this._textRenderer)}}_watchTextDirection(){this._renderer.dir=this.$props.textDir()}_watchMediaTime(){if(this._isHidden())return;let{realCurrentTime:e}=this._media.$state;this._renderer.currentTime=e()}};cf.props={textDir:"ltr"};Pc=class extends B{onSetup(){this._media=ce(),this._watchSrc(),this._watchAlt(),this._watchCrossOrigin(),this._watchHidden()}onAttach(e){e.style.setProperty("pointer-events","none"),b(this._watchImg.bind(this)),b(this._watchSrc.bind(this)),b(this._watchAlt.bind(this)),b(this._watchCrossOrigin.bind(this)),b(this._watchHidden.bind(this));let{started:n}=this._media.$state;this.setAttributes({"data-visible":()=>!n()&&!this.$state.hidden(),"data-loading":this._isLoading.bind(this),"data-error":this._hasError.bind(this),"data-hidden":this.$state.hidden})}onConnect(e){b(this._onPreconnect.bind(this)),b(this._onLoadStart.bind(this))}_hasError(){let{error:e}=this.$state;return!vi(e())}_onPreconnect(){let{canLoadPoster:e,poster:n}=this._media.$state;!e()&&n()&&ni(n(),"preconnect")}_watchHidden(){let{src:e}=this.$props,{$iosControls:n}=this._media,{poster:i}=this._media.$state;this.el&&J(this.el,"display",n()?"none":null),this.$state.hidden.set(this._hasError()||!(e()||i())||n())}_isLoading(){let{loading:e,hidden:n}=this.$state;return!n()&&e()}_watchImg(){let e=this.$state.img();e&&(S(e,"load",this._onLoad.bind(this)),S(e,"error",this._onError.bind(this)))}_watchSrc(){let{canLoadPoster:e,poster:n}=this._media.$state,i=this.$props.src(),r=i||n();i&&n()!==i&&this._media.$state.providedPoster.set(i),this.$state.src.set(e()&&r.length?r:null)}_watchAlt(){let{src:e}=this.$props,{alt:n}=this.$state,{poster:i}=this._media.$state;n.set(e()||i()?this.$props.alt():null)}_watchCrossOrigin(){let{crossOrigin:e}=this.$props,{crossOrigin:n}=this.$state,{crossOrigin:i,poster:r}=this._media.$state,s=e()!==null?e():i();n.set(/ytimg\.com|vimeo/.test(r()||"")?null:s===!0?"anonymous":s)}_onLoadStart(){let{loading:e,error:n}=this.$state,{canLoadPoster:i,poster:r}=this._media.$state;e.set(i()&&!!r()),n.set(null)}_onLoad(){let{loading:e,error:n}=this.$state;e.set(!1),n.set(null)}_onError(e){let{loading:n,error:i}=this.$state;n.set(!1),i.set(e)}};Pc.props={src:null,alt:null,crossOrigin:null};Pc.state=new ei({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});Cc=class extends B{constructor(){super(...arguments),this._invert=O(null)}onSetup(){this._media=ce(),this._watchTime();let{type:e}=this.$props;this.setAttributes({"data-type":e,"data-remainder":this._shouldInvert.bind(this)})}onAttach(e){e.hasAttribute("role")||b(this._watchRole.bind(this)),b(this._watchTime.bind(this))}onConnect(e){b(()=>{if(!this.$props.toggle()){this._invert.set(null);return}Vr(e,this._onToggle.bind(this))})}_watchTime(){let{type:e,padHours:n,padMinutes:i,showHours:r}=this.$props,s=this._getSeconds(e()),a=this._media.$state.duration(),o=this._shouldInvert();if(!Number.isFinite(s+a)){this.$state.timeText.set("LIVE");return}let l=o?Math.max(0,a-s):s,c=Ur(l,n(),i(),r());this.$state.timeText.set((o?"-":"")+c)}_watchRole(){if(!this.el)return;let{toggle:e}=this.$props;J(this.el,"role",e()?"timer":null),J(this.el,"tabindex",e()?0:null)}_getSeconds(e){let{bufferedEnd:n,duration:i,currentTime:r}=this._media.$state;switch(e){case"buffered":return n();case"duration":return i();default:return r()}}_shouldInvert(){return this.$props.remainder()&&this._invert()!==!1}_onToggle(e){if(e.preventDefault(),this._invert()===null){this._invert.set(!this.$props.remainder());return}this._invert.set(n=>!n)}};Cc.props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1};Cc.state=new ei({timeText:""});F3=yi(),z3={clickToPlay:!0,clickToFullscreen:!0,controls:["play-large","play","progress","current-time","mute+volume","captions","settings","pip","airplay","fullscreen"],customIcons:!1,displayDuration:!1,download:null,markers:null,invertTime:!0,thumbnails:null,toggleTime:!0,translations:null,seekTime:10,speed:[.5,.75,1,1.25,1.5,1.75,2,4]},Rw=class extends B{onSetup(){this._media=ce(),It(F3,{...this.$props,previewTime:O(0)})}};Rw.props=z3;Os=class extends QO{},uf=class extends Qa{},$c=class extends Hh{},Mc=class extends qh{},df=class extends bc{},Rc=class extends Xh{},Lc=class extends Zh{},Ic=class extends nf{},Ac=class extends Jh{},Nc=class extends ef{},Dc=class extends Qh{},Oc=class extends Gh{},Vc=class extends Yh{},Fc=class extends tf{},zc=class extends Wh{},Uc=class extends Kh{},jc=class extends wc{},Hc=class extends Zi{},qc=class extends Ja{},Bc=class extends Ec{},Wc=class extends sf{},Kc=class extends Za{},Gc=class extends Ms{},Yc=class extends Tc{},Qc=class extends Ji{},Xc=class extends er{},Zc=class extends Rs{},Jc=class extends Sc{},eu=class extends af{},tu=class extends eo{},nu=class extends to{},iu=class extends cf{},ru=class extends lf{},pf=class extends Pc{},no=class extends Xa{},su=class extends Cc{},h1=ke.forwardRef((t,e)=>{let{children:n,...i}=t,r=ke.Children.toArray(n),s=r.find(j3);if(s){let a=s.props.children,o=r.map(l=>l===s?ke.Children.count(a)>1?ke.Children.only(null):ke.isValidElement(a)?a.props.children:null:l);return ke.createElement(Lw,{...i,ref:e},ke.isValidElement(a)?ke.cloneElement(a,void 0,o):null)}return ke.createElement(Lw,{...i,ref:e},n)});h1.displayName="Slot";Lw=ke.forwardRef((t,e)=>{let{children:n,...i}=t;return ke.isValidElement(n)?ke.cloneElement(n,{...H3(i,n.props),ref:e?re(e,n.ref):n.ref}):ke.Children.count(n)>1?ke.Children.only(null):null});Lw.displayName="SlotClone";U3=({children:t})=>ke.createElement(ke.Fragment,null,t);q3=["button","div","span","img","video","audio"],H=q3.reduce((t,e)=>{let n=ke.forwardRef((i,r)=>{let{asChild:s,...a}=i;return ke.createElement(s?h1:e,{...a,ref:r})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});CP=Os.state.record,B3=Object.keys(CP).reduce((t,e)=>({...t,[e](){return CP[e]}}),{})});var R1={};kt(R1,{default:()=>QV});var QV,L1=Ue(()=>{"use strict";"use client";QV='<path fill-rule="evenodd" clip-rule="evenodd" d="M6 7C5.63181 7 5.33333 7.29848 5.33333 7.66667V14.8667C5.33333 14.9403 5.39361 14.9999 5.46724 15.0009C10.8844 15.0719 15.2614 19.449 15.3325 24.8661C15.3334 24.9397 15.393 25 15.4667 25H26C26.3682 25 26.6667 24.7015 26.6667 24.3333V7.66667C26.6667 7.29848 26.3682 7 26 7H6ZM17.0119 22.2294C17.0263 22.29 17.0802 22.3333 17.1425 22.3333H23.3333C23.7015 22.3333 24 22.0349 24 21.6667V10.3333C24 9.96514 23.7015 9.66667 23.3333 9.66667H8.66667C8.29848 9.66667 8 9.96514 8 10.3333V13.1909C8 13.2531 8.04332 13.3071 8.10392 13.3214C12.5063 14.3618 15.9715 17.827 17.0119 22.2294Z" fill="currentColor"/> <path d="M13.2 25C13.2736 25 13.3334 24.9398 13.3322 24.8661C13.2615 20.5544 9.77889 17.0718 5.46718 17.0011C5.39356 16.9999 5.33333 17.0597 5.33333 17.1333V18.8667C5.33333 18.9403 5.39348 18.9999 5.4671 19.0015C8.67465 19.0716 11.2617 21.6587 11.3319 24.8662C11.3335 24.9399 11.393 25 11.4667 25H13.2Z" fill="currentColor"/> <path d="M5.33333 21.1333C5.33333 21.0597 5.39332 20.9998 5.46692 21.0022C7.57033 21.0712 9.26217 22.763 9.33114 24.8664C9.33356 24.94 9.27364 25 9.2 25H6C5.63181 25 5.33333 24.7015 5.33333 24.3333V21.1333Z" fill="currentColor"/>'});var VC=pt((v9,OC)=>{"use strict";var DF={aa:{name:"Afar",nativeName:"Afaraf"},ab:{name:"Abkhaz",nativeName:"\u0430\u04A7\u0441\u0443\u0430 \u0431\u044B\u0437\u0448\u04D9\u0430"},ae:{name:"Avestan",nativeName:"avesta"},af:{name:"Afrikaans",nativeName:"Afrikaans"},ak:{name:"Akan",nativeName:"Akan"},am:{name:"Amharic",nativeName:"\u12A0\u121B\u122D\u129B"},an:{name:"Aragonese",nativeName:"aragon\xE9s"},ar:{name:"Arabic",nativeName:"\u0627\u064E\u0644\u0652\u0639\u064E\u0631\u064E\u0628\u0650\u064A\u064E\u0651\u0629\u064F"},as:{name:"Assamese",nativeName:"\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE"},av:{name:"Avaric",nativeName:"\u0430\u0432\u0430\u0440 \u043C\u0430\u0446\u04C0"},ay:{name:"Aymara",nativeName:"aymar aru"},az:{name:"Azerbaijani",nativeName:"az\u0259rbaycan dili"},ba:{name:"Bashkir",nativeName:"\u0431\u0430\u0448\u04A1\u043E\u0440\u0442 \u0442\u0435\u043B\u0435"},be:{name:"Belarusian",nativeName:"\u0431\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F \u043C\u043E\u0432\u0430"},bg:{name:"Bulgarian",nativeName:"\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438 \u0435\u0437\u0438\u043A"},bi:{name:"Bislama",nativeName:"Bislama"},bm:{name:"Bambara",nativeName:"bamanankan"},bn:{name:"Bengali",nativeName:"\u09AC\u09BE\u0982\u09B2\u09BE"},bo:{name:"Tibetan",nativeName:"\u0F56\u0F7C\u0F51\u0F0B\u0F61\u0F72\u0F42"},br:{name:"Breton",nativeName:"brezhoneg"},bs:{name:"Bosnian",nativeName:"bosanski jezik"},ca:{name:"Catalan",nativeName:"Catal\xE0"},ce:{name:"Chechen",nativeName:"\u043D\u043E\u0445\u0447\u0438\u0439\u043D \u043C\u043E\u0442\u0442"},ch:{name:"Chamorro",nativeName:"Chamoru"},co:{name:"Corsican",nativeName:"corsu"},cr:{name:"Cree",nativeName:"\u14C0\u1426\u1403\u152D\u140D\u140F\u1423"},cs:{name:"Czech",nativeName:"\u010De\u0161tina"},cu:{name:"Old Church Slavonic",nativeName:"\u0469\u0437\u044B\u043A\u044A \u0441\u043B\u043E\u0432\u0463\u043D\u044C\u0441\u043A\u044A"},cv:{name:"Chuvash",nativeName:"\u0447\u04D1\u0432\u0430\u0448 \u0447\u04D7\u043B\u0445\u0438"},cy:{name:"Welsh",nativeName:"Cymraeg"},da:{name:"Danish",nativeName:"dansk"},de:{name:"German",nativeName:"Deutsch"},dv:{name:"Divehi",nativeName:"\u078B\u07A8\u0788\u07AC\u0780\u07A8"},dz:{name:"Dzongkha",nativeName:"\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41"},ee:{name:"Ewe",nativeName:"E\u028Begbe"},el:{name:"Greek",nativeName:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},en:{name:"English",nativeName:"English"},eo:{name:"Esperanto",nativeName:"Esperanto"},es:{name:"Spanish",nativeName:"Espa\xF1ol"},et:{name:"Estonian",nativeName:"eesti"},eu:{name:"Basque",nativeName:"euskara"},fa:{name:"Persian",nativeName:"\u0641\u0627\u0631\u0633\u06CC"},ff:{name:"Fula",nativeName:"Fulfulde"},fi:{name:"Finnish",nativeName:"suomi"},fj:{name:"Fijian",nativeName:"vosa Vakaviti"},fo:{name:"Faroese",nativeName:"f\xF8royskt"},fr:{name:"French",nativeName:"Fran\xE7ais"},fy:{name:"Western Frisian",nativeName:"Frysk"},ga:{name:"Irish",nativeName:"Gaeilge"},gd:{name:"Scottish Gaelic",nativeName:"G\xE0idhlig"},gl:{name:"Galician",nativeName:"galego"},gn:{name:"Guaran\xED",nativeName:"Ava\xF1e'\u1EBD"},gu:{name:"Gujarati",nativeName:"\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0"},gv:{name:"Manx",nativeName:"Gaelg"},ha:{name:"Hausa",nativeName:"\u0647\u064E\u0648\u064F\u0633\u064E"},he:{name:"Hebrew",nativeName:"\u05E2\u05D1\u05E8\u05D9\u05EA"},hi:{name:"Hindi",nativeName:"\u0939\u093F\u0928\u094D\u0926\u0940"},ho:{name:"Hiri Motu",nativeName:"Hiri Motu"},hr:{name:"Croatian",nativeName:"Hrvatski"},ht:{name:"Haitian",nativeName:"Krey\xF2l ayisyen"},hu:{name:"Hungarian",nativeName:"magyar"},hy:{name:"Armenian",nativeName:"\u0540\u0561\u0575\u0565\u0580\u0565\u0576"},hz:{name:"Herero",nativeName:"Otjiherero"},ia:{name:"Interlingua",nativeName:"Interlingua"},id:{name:"Indonesian",nativeName:"Bahasa Indonesia"},ie:{name:"Interlingue",nativeName:"Interlingue"},ig:{name:"Igbo",nativeName:"As\u1EE5s\u1EE5 Igbo"},ii:{name:"Nuosu",nativeName:"\uA188\uA320\uA4BF Nuosuhxop"},ik:{name:"Inupiaq",nativeName:"I\xF1upiaq"},io:{name:"Ido",nativeName:"Ido"},is:{name:"Icelandic",nativeName:"\xCDslenska"},it:{name:"Italian",nativeName:"Italiano"},iu:{name:"Inuktitut",nativeName:"\u1403\u14C4\u1483\u144E\u1450\u1466"},ja:{name:"Japanese",nativeName:"\u65E5\u672C\u8A9E"},jv:{name:"Javanese",nativeName:"basa Jawa"},ka:{name:"Georgian",nativeName:"\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8"},kg:{name:"Kongo",nativeName:"Kikongo"},ki:{name:"Kikuyu",nativeName:"G\u0129k\u0169y\u0169"},kj:{name:"Kwanyama",nativeName:"Kuanyama"},kk:{name:"Kazakh",nativeName:"\u049B\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"},kl:{name:"Kalaallisut",nativeName:"kalaallisut"},km:{name:"Khmer",nativeName:"\u1781\u17C1\u1798\u179A\u1797\u17B6\u179F\u17B6"},kn:{name:"Kannada",nativeName:"\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"},ko:{name:"Korean",nativeName:"\uD55C\uAD6D\uC5B4"},kr:{name:"Kanuri",nativeName:"Kanuri"},ks:{name:"Kashmiri",nativeName:"\u0915\u0936\u094D\u092E\u0940\u0930\u0940"},ku:{name:"Kurdish",nativeName:"Kurd\xEE"},kv:{name:"Komi",nativeName:"\u043A\u043E\u043C\u0438 \u043A\u044B\u0432"},kw:{name:"Cornish",nativeName:"Kernewek"},ky:{name:"Kyrgyz",nativeName:"\u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430"},la:{name:"Latin",nativeName:"latine"},lb:{name:"Luxembourgish",nativeName:"L\xEBtzebuergesch"},lg:{name:"Ganda",nativeName:"Luganda"},li:{name:"Limburgish",nativeName:"Limburgs"},ln:{name:"Lingala",nativeName:"Ling\xE1la"},lo:{name:"Lao",nativeName:"\u0E9E\u0EB2\u0EAA\u0EB2\u0EA5\u0EB2\u0EA7"},lt:{name:"Lithuanian",nativeName:"lietuvi\u0173 kalba"},lu:{name:"Luba-Katanga",nativeName:"Kiluba"},lv:{name:"Latvian",nativeName:"latvie\u0161u valoda"},mg:{name:"Malagasy",nativeName:"fiteny malagasy"},mh:{name:"Marshallese",nativeName:"Kajin M\u0327aje\u013C"},mi:{name:"M\u0101ori",nativeName:"te reo M\u0101ori"},mk:{name:"Macedonian",nativeName:"\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438 \u0458\u0430\u0437\u0438\u043A"},ml:{name:"Malayalam",nativeName:"\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02"},mn:{name:"Mongolian",nativeName:"\u041C\u043E\u043D\u0433\u043E\u043B \u0445\u044D\u043B"},mr:{name:"Marathi",nativeName:"\u092E\u0930\u093E\u0920\u0940"},ms:{name:"Malay",nativeName:"Bahasa Melayu"},mt:{name:"Maltese",nativeName:"Malti"},my:{name:"Burmese",nativeName:"\u1017\u1019\u102C\u1005\u102C"},na:{name:"Nauru",nativeName:"Dorerin Naoero"},nb:{name:"Norwegian Bokm\xE5l",nativeName:"Norsk bokm\xE5l"},nd:{name:"Northern Ndebele",nativeName:"isiNdebele"},ne:{name:"Nepali",nativeName:"\u0928\u0947\u092A\u093E\u0932\u0940"},ng:{name:"Ndonga",nativeName:"Owambo"},nl:{name:"Dutch",nativeName:"Nederlands"},nn:{name:"Norwegian Nynorsk",nativeName:"Norsk nynorsk"},no:{name:"Norwegian",nativeName:"Norsk"},nr:{name:"Southern Ndebele",nativeName:"isiNdebele"},nv:{name:"Navajo",nativeName:"Din\xE9 bizaad"},ny:{name:"Chichewa",nativeName:"chiChe\u0175a"},oc:{name:"Occitan",nativeName:"occitan"},oj:{name:"Ojibwe",nativeName:"\u140A\u14C2\u1511\u14C8\u142F\u14A7\u140E\u14D0"},om:{name:"Oromo",nativeName:"Afaan Oromoo"},or:{name:"Oriya",nativeName:"\u0B13\u0B21\u0B3C\u0B3F\u0B06"},os:{name:"Ossetian",nativeName:"\u0438\u0440\u043E\u043D \xE6\u0432\u0437\u0430\u0433"},pa:{name:"Panjabi",nativeName:"\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40"},pi:{name:"P\u0101li",nativeName:"\u092A\u093E\u0934\u093F"},pl:{name:"Polish",nativeName:"Polski"},ps:{name:"Pashto",nativeName:"\u067E\u069A\u062A\u0648"},pt:{name:"Portuguese",nativeName:"Portugu\xEAs"},qu:{name:"Quechua",nativeName:"Runa Simi"},rm:{name:"Romansh",nativeName:"rumantsch grischun"},rn:{name:"Kirundi",nativeName:"Ikirundi"},ro:{name:"Romanian",nativeName:"Rom\xE2n\u0103"},ru:{name:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},rw:{name:"Kinyarwanda",nativeName:"Ikinyarwanda"},sa:{name:"Sanskrit",nativeName:"\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D"},sc:{name:"Sardinian",nativeName:"sardu"},sd:{name:"Sindhi",nativeName:"\u0938\u093F\u0928\u094D\u0927\u0940"},se:{name:"Northern Sami",nativeName:"Davvis\xE1megiella"},sg:{name:"Sango",nativeName:"y\xE2ng\xE2 t\xEE s\xE4ng\xF6"},si:{name:"Sinhala",nativeName:"\u0DC3\u0DD2\u0D82\u0DC4\u0DBD"},sk:{name:"Slovak",nativeName:"sloven\u010Dina"},sl:{name:"Slovenian",nativeName:"sloven\u0161\u010Dina"},sm:{name:"Samoan",nativeName:"gagana fa'a Samoa"},sn:{name:"Shona",nativeName:"chiShona"},so:{name:"Somali",nativeName:"Soomaaliga"},sq:{name:"Albanian",nativeName:"Shqip"},sr:{name:"Serbian",nativeName:"\u0441\u0440\u043F\u0441\u043A\u0438 \u0458\u0435\u0437\u0438\u043A"},ss:{name:"Swati",nativeName:"SiSwati"},st:{name:"Southern Sotho",nativeName:"Sesotho"},su:{name:"Sundanese",nativeName:"Basa Sunda"},sv:{name:"Swedish",nativeName:"Svenska"},sw:{name:"Swahili",nativeName:"Kiswahili"},ta:{name:"Tamil",nativeName:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD"},te:{name:"Telugu",nativeName:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41"},tg:{name:"Tajik",nativeName:"\u0442\u043E\u04B7\u0438\u043A\u04E3"},th:{name:"Thai",nativeName:"\u0E44\u0E17\u0E22"},ti:{name:"Tigrinya",nativeName:"\u1275\u130D\u122D\u129B"},tk:{name:"Turkmen",nativeName:"T\xFCrkmen\xE7e"},tl:{name:"Tagalog",nativeName:"Wikang Tagalog"},tn:{name:"Tswana",nativeName:"Setswana"},to:{name:"Tonga",nativeName:"faka Tonga"},tr:{name:"Turkish",nativeName:"T\xFCrk\xE7e"},ts:{name:"Tsonga",nativeName:"Xitsonga"},tt:{name:"Tatar",nativeName:"\u0442\u0430\u0442\u0430\u0440 \u0442\u0435\u043B\u0435"},tw:{name:"Twi",nativeName:"Twi"},ty:{name:"Tahitian",nativeName:"Reo Tahiti"},ug:{name:"Uyghur",nativeName:"\u0626\u06C7\u064A\u063A\u06C7\u0631\u0686\u06D5\u200E"},uk:{name:"Ukrainian",nativeName:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},ur:{name:"Urdu",nativeName:"\u0627\u0631\u062F\u0648"},uz:{name:"Uzbek",nativeName:"\u040E\u0437\u0431\u0435\u043A"},ve:{name:"Venda",nativeName:"Tshiven\u1E13a"},vi:{name:"Vietnamese",nativeName:"Ti\u1EBFng Vi\u1EC7t"},vo:{name:"Volap\xFCk",nativeName:"Volap\xFCk"},wa:{name:"Walloon",nativeName:"walon"},wo:{name:"Wolof",nativeName:"Wollof"},xh:{name:"Xhosa",nativeName:"isiXhosa"},yi:{name:"Yiddish",nativeName:"\u05D9\u05D9\u05B4\u05D3\u05D9\u05E9"},yo:{name:"Yoruba",nativeName:"Yor\xF9b\xE1"},za:{name:"Zhuang",nativeName:"Sa\u026F cue\u014B\u0185"},zh:{name:"Chinese",nativeName:"\u4E2D\u6587"},zu:{name:"Zulu",nativeName:"isiZulu"}};OC.exports=DF});var pb=pt((y9,HC)=>{"use strict";var _u=VC(),FC={},Ff={},zC=[],UC=[],jC=[];for(let t in _u){let{name:e,nativeName:n}=_u[t];FC[t]=Ff[e.toLowerCase()]=Ff[n.toLowerCase()]={code:t,name:e,nativeName:n},zC.push(t),UC.push(e),jC.push(n)}HC.exports=class Vf{static getLanguages(e=[]){return e.map(n=>Vf.validate(n)?Object.assign({},FC[n]):{code:n,name:"",nativeName:""})}static getName(e){return Vf.validate(e)?_u[e].name:""}static getAllNames(){return UC.slice()}static getNativeName(e){return Vf.validate(e)?_u[e].nativeName:""}static getAllNativeNames(){return jC.slice()}static getCode(e){return e=e.toLowerCase(),Ff.hasOwnProperty(e)?Ff[e].code:""}static getAllCodes(){return zC.slice()}static validate(e){return _u.hasOwnProperty(e)}}});var O$=pt(nm=>{"use strict";var D5=j(),O5=Symbol.for("react.element"),V5=Symbol.for("react.fragment"),F5=Object.prototype.hasOwnProperty,z5=D5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,U5={key:!0,ref:!0,__self:!0,__source:!0};function D$(t,e,n){var i,r={},s=null,a=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(i in e)F5.call(e,i)&&!U5.hasOwnProperty(i)&&(r[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:O5,type:t,key:s,ref:a,props:r,_owner:z5.current}}nm.Fragment=V5;nm.jsx=D$;nm.jsxs=D$});var ae=pt((_q,V$)=>{"use strict";V$.exports=O$()});var Hm=pt(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});function IR(t,e){if(e)return t;throw new Error("Unhandled discriminated union member: "+JSON.stringify(t))}jm.assertNever=IR;jm.default=IR});var q6={};kt(q6,{default:()=>pg});module.exports=qL(q6);var Nx=require("obsidian");function mg(t,e){let n={};for(let i of e)i in t&&(n[i]=t[i]);return n}function ed(t,e){let n={...t};for(let i of e)delete n[i];return n}var gg={bilibili:"https://www.bilibili.com",youtube:"https://www.youtube.com",vimeo:"https://www.vimeo.com",coursera:"https://www.coursera.org"},td={bilibili:"bilibili",youtube:"YouTube",generic:"Website",vimeo:"Vimeo",coursera:"Coursera"},Ax=t=>ed(t,["generic"]);var BL={bilibili:'<path fill-rule="evenodd" clip-rule="evenodd" d="M 20.736 14.88 C 18.513 12.735 18.513 9.173 20.736 7.028 C 22.849 4.99 26.197 4.99 28.311 7.028 L 40.096 18.397 C 40.43 18.72 40.715 19.075 40.949 19.453 L 58.772 19.453 C 59.006 19.075 59.291 18.72 59.625 18.397 L 71.41 7.028 C 73.523 4.99 76.871 4.99 78.984 7.028 C 81.208 9.173 81.208 12.735 78.984 14.88 L 74.244 19.453 L 77.778 19.453 C 90.051 19.453 100 29.402 100 41.675 L 100 72.262 C 100 84.534 90.051 94.484 77.778 94.484 L 22.222 94.484 C 9.949 94.484 0 84.534 0 72.262 L 0 41.675 C 0 29.402 9.949 19.453 22.222 19.453 L 25.477 19.453 L 20.736 14.88 Z M 22.222 30.172 C 16.086 30.172 11.111 35.146 11.111 41.283 L 11.111 72.654 C 11.111 78.79 16.086 83.765 22.222 83.765 L 77.778 83.765 C 83.914 83.765 88.889 78.79 88.889 72.654 L 88.889 41.283 C 88.889 35.146 83.914 30.172 77.778 30.172 L 22.222 30.172 Z M 27.778 51.805 C 27.778 48.737 30.265 46.25 33.333 46.25 C 36.402 46.25 38.889 48.737 38.889 51.805 L 38.889 56.772 C 38.889 59.84 36.402 62.328 33.333 62.328 C 30.265 62.328 27.778 59.84 27.778 56.772 L 27.778 51.805 Z M 66.667 46.25 C 63.598 46.25 61.111 48.737 61.111 51.805 L 61.111 56.772 C 61.111 59.84 63.598 62.328 66.667 62.328 C 69.735 62.328 72.222 59.84 72.222 56.772 L 72.222 51.805 C 72.222 48.737 69.735 46.25 66.667 46.25 Z" fill="currentColor"/>',vimeo:'<path d="M 99.952 26.773 C 99.508 36.508 92.705 49.844 79.555 66.768 C 65.962 84.445 54.458 93.287 45.044 93.287 C 39.218 93.287 34.286 87.905 30.254 77.134 C 27.566 67.263 24.872 57.4 22.185 47.53 C 19.194 36.765 15.986 31.377 12.552 31.377 C 11.806 31.377 9.182 32.952 4.701 36.09 L 0 30.027 C 4.932 25.692 9.799 21.352 14.59 17.005 C 21.175 11.321 26.113 8.324 29.412 8.022 C 37.193 7.276 41.983 12.6 43.783 23.988 C 45.725 36.283 47.069 43.929 47.822 46.919 C 50.066 57.117 52.535 62.21 55.229 62.21 C 57.325 62.21 60.47 58.898 64.663 52.287 C 68.849 45.671 71.093 40.636 71.395 37.183 C 71.993 31.473 69.749 28.612 64.663 28.612 C 62.264 28.612 59.795 29.158 57.261 30.252 C 62.174 14.15 71.562 6.324 85.426 6.768 C 95.701 7.07 100.544 13.739 99.952 26.773" fill="currentColor"/>',coursera:'<path d="M 2.8 50.013 C 2.8 22.278 25.472 0.001 53.82 0.001 C 71.135 -0.12 87.347 8.489 96.943 22.903 L 75.688 35.232 C 70.696 28.099 62.527 23.863 53.82 23.893 C 39.244 23.893 27.298 36.043 27.298 50.013 C 27.298 63.983 39.244 76.133 53.82 76.133 C 62.954 76.192 71.463 71.505 76.294 63.754 L 97.339 76.306 C 87.854 91.149 71.422 100.093 53.808 99.999 C 25.472 100.024 2.8 77.321 2.8 50.013 Z" fill="currentColor" />',youtube:null};Object.entries(BL).forEach(([t,e])=>{e&&(0,Nx.addIcon)(t,e)});var hg=require("obsidian");function Ko(t){return qn(t).href}function qn(t){let e=new URL(t);return e.hash="",e}function Bn(t){try{return new URL(t)}catch{return null}}var je=require("obsidian");function Zs(t,e){let n="target"in t?t.target:t;if(!n.instanceOf?.(HTMLElement))return;let i=n.getBoundingClientRect();return e.setParentElement(n).showAtPosition({x:i.x,y:i.bottom,width:i.width,overlap:!0,left:!0},n.doc)}var Dx="mx-port";var lr=t=>`persist:mx-player-${t}`;var Ox=require("obsidian");function Go(t){let e=require("@electron/remote"),n=lr(t);return n?e.session.fromPartition(n):(console.log("No partition, skip modifying session"),null)}function Vx(){return Ox.Platform.isDesktopApp?require("fs/promises"):null}function Fx(t){return require("@electron/remote").webContents.fromId(t)}function nd(){return require("@electron/remote").dialog}var cr=class extends je.Modal{constructor(n){super(n);_(this,"navEl",this.contentEl.insertAdjacentElement("beforebegin",createDiv({cls:"mx-login-nav"})));_(this,"webview",createEl("webview",{attr:{partition:this.partition,allowpopups:""}}));_(this,"backButton",new je.ButtonComponent(this.navEl).setIcon("arrow-left").setTooltip("Back").setClass("mx-login-back").setDisabled(!0).onClick(()=>{try{this.webview.goBack()}catch(n){new je.Notice("Failed to go back, see console for details"),console.error("err go back",n)}}));_(this,"forwardButton",new je.ButtonComponent(this.navEl).setIcon("arrow-right").setTooltip("Forward").setClass("mx-login-forward").setDisabled(!0).onClick(()=>{try{this.webview.goForward()}catch(n){new je.Notice("Failed to go forward, see console for details"),console.error("err go forward",n)}}));_(this,"refreshButton",new je.ButtonComponent(this.navEl).setIcon("rotate-ccw").setTooltip("Refresh").setClass("mx-login-refresh").setDisabled(!0).onClick(()=>{try{this.webview.reload()}catch(n){new je.Notice("Failed to refresh, see console for details"),console.error("err refresh",n)}}));_(this,"addressBarForm",this.navEl.createEl("form"));_(this,"addressBar",new je.TextComponent(this.addressBarForm).then(n=>{n.inputEl.type="url",n.inputEl.placeholder="https://example.com",n.inputEl.classList.add("mx-login-address")}));_(this,"addressSubmit",new je.ButtonComponent(this.addressBarForm).setIcon("arrow-right-circle").then(n=>n.buttonEl.type="submit"));_(this,"moreOptionsButton",new je.ButtonComponent(this.navEl).setIcon("more-horizontal").setTooltip("More options").setClass("mx-login-more").onClick(n=>{let i=new je.Menu;this.onMoreOptions(i),Zs(n,i)}));_(this,"callbacks",[]);_(this,"handledWebcontents",new Set);this.containerEl.addClasses(["mx-login-modal"]),this.titleEl.style.display="none",this.buildWelcome()}get partition(){return lr(this.app.appId)}buildWelcome(){this.contentEl.empty(),this.contentEl.createEl("h1").setText("Login");let n=this.contentEl.createEl("main");n.createEl("p").setText("You can login to sites, change preferences and more, just as you would in a browser."),n.createEl("p").setText("To open a website, you can:");let i=n.createEl("ul");i.createEl("li").setText("Enter the site address in the address bar");let r=i.createEl("li");r.setText("Select from a list of "),new je.DropdownComponent(r).addOptions({...Ax(td),".":"supported websites..."}).setValue(".").onChange(s=>{s in gg&&this.setUrl(gg[s])})}getSession(){return Go(this.app.appId)}onMoreOptions(n){n.addItem(i=>i.setTitle("Clear cache").setSection("clear").setIcon("trash").onClick(async()=>{if(window.confirm("Are you sure you want to clear the website cache? All login sessions and preferences will be lost."))try{await this.getSession()?.clearCache(),new je.Notice("Cache cleared")}catch(s){new je.Notice("Failed to clear cache, see console for details"),console.error("err clear cache",s)}}))}setUrl(n){this.initWebview(),this.webview.src=n,this.addressBar.setValue(n)}register(n){this.callbacks.push(n)}registerWebviewEvent(n,i){this.webview.addEventListener(n,i),this.register(()=>this.webview.removeEventListener(n,i))}onClose(){for(let n of this.callbacks)n();this.containerEl.empty()}initWebview(){this.webview.isConnected||(this.registerWebviewEvent("will-navigate",()=>{this.addressBar.setValue(this.webview.getURL())}),this.contentEl.empty(),this.contentEl.appendChild(this.webview),this.backButton.setDisabled(!1),this.forwardButton.setDisabled(!1),this.refreshButton.setDisabled(!1),this.registerWebviewEvent("dom-ready",()=>{if(this.handledWebcontents.has(this.webview.getWebContentsId()))return;let n=this.webview.getWebContentsId();this.handledWebcontents.add(n),Fx(n)?.setWindowOpenHandler(({url:r,disposition:s})=>((s==="new-window"||s==="foreground-tab"||s==="default")&&this.setUrl(r),{action:"deny"}))}))}onOpen(){this.addressBarForm.onsubmit=n=>{n.preventDefault();let i=this.addressBar.getValue();i&&this.setUrl(i)}}};function zx(){this.addCommand({id:"login",name:"Login website",callback:()=>{new cr(this.app).open()}})}var ZM=require("obsidian");var Po=require("obsidian");var id=require("obsidian"),Js=class t extends id.Modal{constructor(n,i,r){super(n);this.onSubmit=i;this.onExit=r;this.containerEl.addClass("mx-playback-prompt"),this.onSubmit=i}static run(){return new Promise(n=>{new t(app,r=>n(Number(r)),()=>n(null)).open()})}onOpen(){let{contentEl:n,titleEl:i}=this;i.setText("Playback Speed");let r=n.createEl("form",{},s=>{s.createEl("input",{type:"number",placeholder:"Enter a number between 0 and 10",attr:{min:.1,max:10,step:.1,width:100,required:!0,name:"playback-speed"}}),s.createEl("button",{attr:{type:"submit"},text:"Submit"})});r.oninvalid=s=>{s.preventDefault(),new id.Notice("Invalid playback rate")},r.onsubmit=s=>{s.preventDefault();let a=new FormData(r);this.onSubmit(a.get("playback-speed").toString()),this.close()}}onClose(){let{contentEl:n}=this;n.empty(),this.onExit()}};var yn=[.25,.5,.75,1,1.25,1.5,2,3,5,10];function Ux(t,e){let n=e.state.playbackRate,i=!yn.includes(n),r=t.setTitle(WL(n)).setIcon("gauge").setSection("mx-player").setSubmenu();yn.forEach(s=>r.addItem(a=>a.setTitle(`${s}x`).setChecked(s===n).onClick(()=>{e.playbackRate=s}))),r.addItem(s=>s.setTitle(KL(n)).setChecked(i).onClick(async()=>{let a=await Js.run();a&&(e.playbackRate=a)}))}function WL(t){let e=new DocumentFragment;return e.appendText("Speed "),e.createEl("code",{text:`(${t}x)`}),e}function KL(t){let e=new DocumentFragment;return e.appendText("Custom"),yn.includes(t)?e.appendText("..."):(e.appendText(" "),e.createEl("code",{text:`(${t}x)`})),e}var Lm=require("obsidian");var So=require("obsidian");function rd(){return/[<>:"/\\|?*\u0000-\u001F]/g}function jx(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var GL=100,YL=/^\.+(\\|\/)|^\.+$/,QL=/\.+$/;function vg(t,e={}){let n=/[\u0000-\u001F\u0080-\u009F]/g,i=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof t!="string")throw new TypeError("Expected a string");let r=e.replacement===void 0?"!":e.replacement;if(rd().test(r)&&n.test(r))throw new Error("Replacement string cannot contain reserved filename characters");r.length>0&&(t=t.replace(i,"$1")),t=t.normalize("NFD"),t=t.replace(YL,r),t=t.replace(rd(),r),t=t.replace(n,r),t=t.replace(QL,""),r.length>0&&(!(t[0]===".")&&t[0]==="."&&(t=r+t),t[t.length-1]==="."&&(t+=r)),t=jx().test(t)?t+r:t;let s=typeof e.maxLength=="number"?e.maxLength:GL;if(t.length>s){let a=t.lastIndexOf(".");if(a===-1)t=t.slice(0,s);else{let o=t.slice(0,a),l=t.slice(a);t=o.slice(0,Math.max(1,s-l.length))+l}}return t}function sd(t){return vg(t,{replacement:"_"}).replaceAll(/[[\]#^|]/g,"_")}var Hx=require("obsidian");var Tt={video:["mp4","webm","ogv","mov","mkv"],audio:["mp3","wav","m4a","3gp","flac","ogg","oga","opus"]};function en(t){t=t.replace(/^\./,"").toLowerCase();for(let e of Object.keys(Tt))if(Tt[e].includes(t))return e;return null}var Pz=[...Tt.video,...Tt.audio];function Li(t){return t.file instanceof Hx.TFile}var Et={video:"mx-url-video",audio:"mx-url-audio"},XL=new Set(Object.values(Et));function ZL(t){return XL.has(t)}var ss="mx-embed",_n="mx-webpage",Ft={video:"mx-file-video",audio:"mx-file-audio"},JL=new Set(Object.values(Ft));function eI(t){return JL.has(t)}function tI(t){return ZL(t)||ss===t||_n===t}function yg(t){return eI(t)||tI(t)}var qx=new Set([Et.video,Ft.video,_n]);var Bx=require("obsidian");function ad(t){let e=Bx.Keymap.isModEvent(t);return ur(e)}function ur(t){return t===!0?"tab":t}var km=require("obsidian"),UM=$(jl());var si=$(j());var SE={},EE=t=>{let e,n=new Set,i=(u,d)=>{let p=typeof u=="function"?u(e):u;if(!Object.is(p,e)){let h=e;e=d??(typeof p!="object"||p===null)?p:Object.assign({},e,p),n.forEach(y=>y(e,h))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(SE.env?SE.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=e=t(i,r,l);return l},$p=t=>t?EE(t):EE;var OE=$(j(),1),VE=$(AE(),1),DE={},{useDebugValue:NN}=OE.default,{useSyncExternalStoreWithSelector:DN}=VE.default,NE=!1,ON=t=>t;function Fy(t,e=ON,n){(DE.env?DE.env.MODE:void 0)!=="production"&&n&&!NE&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),NE=!0);let i=DN(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return NN(i),i}var Hl={main:/^(?<start>[\w:.]*)(?:,(?<end>[\w:.]+))?$/,npt_sec:/^\d+(?:\.\d+)?$/,npt_mmss:/^(?<mm>[0-5]\d):(?<ss>[0-5]\d(?:\.\d+)?)$/,npt_hhmmss:/^(?<hh>\d+):(?<mm>[0-5]\d):(?<ss>[0-5]\d(?:\.\d+)?)$/,npt_time:/^(?:npt:)?([\d.:]+)$/},Pn=({start:t,end:e})=>t>=0&&e<0;function Bt(t){if(!t)return null;let n=new URLSearchParams(t.replace(/^#+/,"")).get("t");if(!n)return null;let i=n.match(Hl.main);if(!i)return null;let{start:r,end:s}=i.groups;return VN(r,s)}var VN=(t,e)=>{let n=t||null,i=e??null,r,s;if(n&&i)r=Rp(n),s=i==="e"?1/0:Rp(i);else if(n)r=Rp(n),s=-1;else if(i)r=-1,s=Rp(i);else throw console.error("Missing startTime and endTime",t,e),new Error("Missing startTime and endTime");return r===null||s===null?null:{start:r,end:s}};function Rp(t){let e=t.match(Hl.npt_time);if(!e)return null;let n=e[1],i=n.match(Hl.npt_sec);if(i)return Number(i[0]);let r=n.match(Hl.npt_mmss);if(r){let{mm:a,ss:o}=r.groups;return Number(a)*60+Number(o)}let s=n.match(Hl.npt_hhmmss);if(s){let{hh:a,mm:o,ss:l}=s.groups;return Number(a)*60*60+Number(o)*60+Number(l)}return null}function Lp(t){let e=new URLSearchParams(t.replace(/^#+/,"")),n=!e.has("noctrl")&&!e.has("controls")?void 0:e.has("controls");return{loop:e.has("loop")?!0:void 0,muted:e.has("mute")?!0:void 0,autoplay:e.has("play")?!0:void 0,controls:n,volume:FN(e.get("vol")),tempFragment:Bt(t)}}function FN(t){if(!t)return;let e=parseInt(t,10);if(!isNaN(e)&&e>=0&&e<=100)return e/100}var FE=()=>({emit(t,...e){for(let n=0,i=this.events[t]||[],r=i.length;n<r;n++)i[n](...e)},events:{},on(t,e){var n;return((n=this.events)[t]||(n[t]=[])).push(e),()=>{this.events[t]=this.events[t]?.filter(i=>e!==i)}}});function Ip(){let t=FE();return t.once=function(n,i){let r=this.on(n,(...s)=>{r(),i(...s)});return r},t}function zE(t){let e=t;return typeof e.id=="string"&&typeof e.invoke=="string"}function UE(t,...e){return{id:zN(),invoke:t,args:e}}function jE(t){return typeof t.id=="string"}function HE(t){return typeof t.send=="string"}function qE(t,e){return{send:t,payload:e}}function zN(){return Math.random().toString(36).substring(2,9)}var Ap=class extends Error{constructor(e){super(`no handler for ${e}`)}},zy="mx-port-ready";var Np=class{constructor(){_(this,"port",null);_(this,"actions",Object.create(null));_(this,"emitter",Ip());_(this,"methods",new Proxy({},{get:(e,n)=>{if(typeof n=="symbol")throw new Error("Remote invoke does not support symbol property");return e[n]??(e[n]=(...i)=>this.invoke(n.toString(),i))}}))}load(e){this.port&&this.port.close(),this.port=e;let n=({data:i})=>{this.onMessage(i)};e.addEventListener("message",n),e.start(),e.postMessage(zy)}unload(){this.port?.close(),this.emitter.events={}}onMessage(e){e===zy?this.emitter.emit("ready"):zE(e)?this.response(e):jE(e)?this.emitter.emit("resp",e.id,e.payload,e.error):HE(e)&&this.emitter.emit(`send:${e.send}`,{type:e.send,payload:e.payload})}invoke(e,n,{transfer:i,timeout:r=1e3}={}){if(!this.port)throw new Error("port not loaded");let s=UE(e,...n);return this.port.postMessage(s,{transfer:i}),new Promise((a,o)=>{let l=-1,c=this.emitter.on("resp",(u,d,p)=>{if(u===s.id)if(c(),window.clearTimeout(l),p){let{message:h,stack:y}=p,v=new Error(h);v.stack=y,o(v)}else a(d)});r>0&&r<1/0&&(l=window.setTimeout(()=>{c(),console.error(`${e} timeout after ${r}ms`),o(new Hi(r))},r))})}handle(e,n){this.actions[e]=n}send(e,n,i){if(!this.port)throw new Error("port not loaded");let r=qE(e,n);this.port.postMessage(r,{transfer:i})}on(e,n){return this.emitter.on(`send:${e}`,n)}once(e,n){return this.emitter.once(`send:${e}`,n)}onReady(e,{once:n=!1}={}){return n?this.emitter.once("ready",e):this.emitter.on("ready",e)}async response({id:e,invoke:n,args:i=[]}){if(!this.port)throw new Error("port not loaded");let r={id:e,payload:null};try{let s=this.actions[n];if(!s)throw new Ap(n);let a=await s(...i);a===void 0?this.port.postMessage(r):(r.payload=await a.value,this.port.postMessage(r,{transfer:a.transfer}))}catch(s){console.error("port messaging error",s),s instanceof Error?r.error={message:s.message,stack:s.stack}:r.error={message:String(s)},this.port.postMessage(r)}}},Hi=class extends Error{constructor(e){super(`timeout after ${e}ms`)}};var UN=()=>{},ql=UN;At();At();Yt();Yt();var F=$(j(),1);var T=$(j(),1);At();Yt();var g1=$(Ul(),1);function ki(){return Gp(au)}var W3=X(Oc,{domEventsRegex:/^onMedia/}),v1=T.forwardRef(({children:t,...e},n)=>T.createElement(W3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));v1.displayName="AirPlayButton";var K3=X(Dc,{domEventsRegex:/^onMedia/}),yf=T.forwardRef(({children:t,...e},n)=>T.createElement(K3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));yf.displayName="PlayButton";var G3=X(Rc,{domEventsRegex:/^onMedia/}),Yw=T.forwardRef(({children:t,...e},n)=>T.createElement(G3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));Yw.displayName="CaptionButton";var Y3=X(Lc,{domEventsRegex:/^onMedia/}),_f=T.forwardRef(({children:t,...e},n)=>T.createElement(Y3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));_f.displayName="FullscreenButton";var Q3=X(Ac,{domEventsRegex:/^onMedia/}),wf=T.forwardRef(({children:t,...e},n)=>T.createElement(Q3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));wf.displayName="MuteButton";var X3=X(Nc,{domEventsRegex:/^onMedia/}),Qw=T.forwardRef(({children:t,...e},n)=>T.createElement(X3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));Qw.displayName="PIPButton";var Z3=X(Fc,{domEventsRegex:/^onMedia/}),uu=T.forwardRef(({children:t,...e},n)=>T.createElement(Z3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));uu.displayName="SeekButton";var J3=X(Ic,{domEventsRegex:/^onMedia/}),y1=T.forwardRef(({children:t,...e},n)=>T.createElement(J3,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));y1.displayName="LiveButton";var Xw=X(Kc),eV=X(Hc,{events:["onDragStart","onDragEnd","onDragValueChange","onValueChange","onPointerValueChange"]}),tV=T.forwardRef(({children:t,...e},n)=>T.createElement(eV,{...e,ref:n},i=>T.createElement(H.div,{...i},t)));tV.displayName="Slider";var nV=T.forwardRef((t,e)=>T.createElement(H.div,{...t,ref:e}));nV.displayName="SliderThumb";var iV=T.forwardRef((t,e)=>T.createElement(H.div,{...t,ref:e}));iV.displayName="SliderTrack";var rV=T.forwardRef((t,e)=>T.createElement(H.div,{...t,ref:e}));rV.displayName="SliderTrackFill";var sV=X(Yc),aV=T.forwardRef(({children:t,...e},n)=>T.createElement(sV,{...e},i=>T.createElement(H.div,{...i,ref:re(i.ref,n)},t)));aV.displayName="SliderPreview";var oV=T.forwardRef(({children:t,...e},n)=>T.createElement(Xw,{...e},(i,r)=>{let s=he(()=>r.getValueText(),r);return T.createElement(H.div,{...i,ref:n},s,t)}));oV.displayName="SliderValue";var lV=X(Bc,{domEventsRegex:/^onMedia/}),cV=T.forwardRef(({children:t,...e},n)=>T.createElement(lV,{...e,ref:n},i=>T.createElement(H.div,{...i},t)));cV.displayName="VolumeSlider";var uV=T.forwardRef(({children:t,...e},n)=>T.createElement(Xw,{...e},(i,r)=>{let s=he(()=>r.getValueText(),r);return T.createElement(H.div,{...i,ref:re(i.ref,n)},s,t)}));uV.displayName="SliderValue";function dV(t=0,e=0,n=""){return D?{startTime:t,endTime:e,text:n,addEventListener:Kt,removeEventListener:Kt,dispatchEvent:Kt}:new window.VTTCue(t,e,n)}var pV=X(no),_1=T.forwardRef(({children:t,...e},n)=>T.createElement(pV,{...e},i=>T.createElement(H.div,{...i,ref:re(i.ref,n)},t)));_1.displayName="Thumbnail";var w1=T.forwardRef(({children:t,...e},n)=>{let{src:i,img:r,crossOrigin:s}=Lr(no.state),a=he(i),o=he(s);return T.createElement(H.img,{crossOrigin:o,...e,src:a,ref:re(r.set,n)},t)});w1.displayName="ThumbnailImg";var bf=Object.freeze({__proto__:null,Img:w1,Root:_1}),xf=T.createContext({$chapters:O(null)});xf.displayName="TimeSliderContext";var hV=X(qc,{domEventsRegex:/^onMedia/}),fV=T.forwardRef(({children:t,...e},n)=>{let i=T.useMemo(()=>O(null),[]);return T.createElement(xf.Provider,{value:{$chapters:i}},T.createElement(hV,{...e,ref:n},r=>T.createElement(H.div,{...r},t)))});fV.displayName="TimeSlider";var mV=X(Qc),gV=T.forwardRef(({children:t,...e},n)=>T.createElement(mV,{...e},(i,r)=>T.createElement(H.div,{...i,ref:re(i.ref,n)},T.createElement(b1,{instance:r},t))));gV.displayName="SliderChapters";function b1({instance:t,children:e}){let n=he(()=>t.cues,t),i=T.useRef([]),r=T.useRef(),{$chapters:s}=T.useContext(xf);return r.current||(r.current=dV()),T.useEffect(()=>(s.set(t),()=>void s.set(null)),[t]),T.useEffect(()=>{t.setRefs(i.current)},[n]),e(n.length?n:[r.current],a=>{if(!a){i.current.length=0;return}i.current.push(a)})}b1.displayName="SliderChapterTracks";var vV=T.forwardRef(({children:t,...e},n)=>{let{$chapters:i}=T.useContext(xf),[r,s]=T.useState();return T.useEffect(()=>b(()=>{let a=i(),o=a?.activePointerCue||a?.activeCue;s(o?.text||"")}),[]),T.createElement(H.div,{...e,ref:n},r,t)});vV.displayName="SliderChapterTitle";var yV=T.forwardRef(({children:t,...e},n)=>T.createElement(Xw,{...e},(i,r)=>{let s=he(()=>r.getValueText(),r);return T.createElement(H.div,{...i,ref:re(i.ref,n)},s,t)}));yV.displayName="SliderValue";var _V=T.forwardRef((t,e)=>T.createElement(H.div,{...t,ref:e}));_V.displayName="SliderProgress";var wV=X(Wc),bV=T.forwardRef(({children:t,...e},n)=>T.createElement(wV,{...e},i=>T.createElement(H.div,{...i,ref:re(i.ref,n)},t)));bV.displayName="SliderThumbnail";var xV=X(Gc,{events:["onCanPlay","onError"]}),kV=T.forwardRef(({children:t,...e},n)=>T.createElement(xV,{...e},(i,r)=>T.createElement(x1,{...i,instance:r,ref:re(i.ref,n)},t)));kV.displayName="SliderVideo";var x1=T.forwardRef(({instance:t,children:e,...n},i)=>{let{canLoad:r}=Lr(Vs),{src:s,video:a,crossOrigin:o}=t.$state,l=he(s),c=he(r),u=he(o);return T.createElement(H.video,{style:{maxWidth:"unset"},...n,src:l||void 0,muted:!0,playsInline:!0,preload:c?"auto":"none",crossOrigin:u||void 0,ref:re(a.set,i)},e)});x1.displayName="SliderVideoProvider";var TV=X(tu,{events:["onChange"]}),EV=T.forwardRef(({children:t,...e},n)=>T.createElement(TV,{...e,ref:n},i=>T.createElement(H.div,{...i},t)));EV.displayName="RadioGroup";var SV=X(nu,{events:["onChange","onSelect"]}),PV=T.forwardRef(({children:t,...e},n)=>T.createElement(SV,{...e},i=>T.createElement(H.div,{...i,ref:re(i.ref,n)},t)));PV.displayName="RadioItem";var CV=typeof document>"u",$V=X(Xc,{events:["onOpen","onClose"],domEventsRegex:/^onMedia/}),MV=T.forwardRef(({children:t,...e},n)=>T.createElement($V,{...e,ref:n},(i,r)=>T.createElement(H.div,{...i,style:{display:r.isSubmenu?void 0:"contents",...i.style}},t)));MV.displayName="Menu";var RV=X(Zc,{events:["onSelect"]}),LV=T.forwardRef(({children:t,...e},n)=>T.createElement(RV,{...e},i=>T.createElement(H.button,{...i,ref:re(i.ref,n)},t)));LV.displayName="MenuButton";var IV=T.forwardRef(({disabled:t=!1,children:e,...n},i)=>{let r=_e("fullscreen");return CV||!(t==="fullscreen"?!r:!t)?e:(0,g1.createPortal)(T.createElement(H.div,{...n,style:{display:"contents",...n.style},ref:i},e),document.body)});IV.displayName="MenuPortal";var AV=X(Jc),NV=T.forwardRef(({children:t,...e},n)=>T.createElement(AV,{...e},i=>T.createElement(H.div,{...i,ref:re(i.ref,n)},t)));NV.displayName="MenuItems";var DV=X(eu),OV=T.forwardRef(({children:t,...e},n)=>T.createElement(DV,{...e},i=>T.createElement(H.div,{...i,ref:re(i.ref,n)},t)));OV.displayName="MenuItem";var VV=X(ru,{events:["onWillTrigger","onTrigger"]}),In=T.forwardRef(({children:t,...e},n)=>T.createElement(VV,{...e,ref:n},i=>T.createElement(H.div,{...i},t)));In.displayName="Gesture";var FV=X(su),du=T.forwardRef(({children:t,...e},n)=>T.createElement(FV,{...e},(i,r)=>T.createElement(k1,{...i,instance:r,ref:re(i.ref,n)},t)));du.displayName="Time";var k1=T.forwardRef(({instance:t,children:e,...n},i)=>{let{timeText:r}=t.$state,s=he(r);return T.createElement(H.div,{...n,ref:i},s,e)});k1.displayName="TimeText";function Ti(){return ki()?.player||null}function Zw({off:t=!0}={}){let e=ki(),{textTracks:n,textTrack:i}=e.$state,r=he(n);return he(i),T.useMemo(()=>{let s=r.filter(We),a=s.map(o=>({track:o,label:o.label,value:m1(o),get selected(){return i()===o},select(l){let c=n().indexOf(o);c>=0&&e.remote.changeTextTrackMode(c,"showing",l)}}));return t&&a.unshift({track:null,label:U(t)?t:"Off",value:"off",get selected(){return!i()},select(o){e.remote.toggleCaptions(o)}}),Object.defineProperty(a,"disabled",{get(){return!s.length}}),Object.defineProperty(a,"selectedTrack",{get(){return i()}}),Object.defineProperty(a,"selectedValue",{get(){let o=i();return o?m1(o):"off"}}),a},[r])}function m1(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}var kf=$(j(),1),Jw=kf.forwardRef((t,e)=>{let{width:n,height:i,size:r=null,paths:s,...a}=t;return kf.createElement("svg",{viewBox:"0 0 32 32",...a,width:n??r,height:i??r,fill:"none","aria-hidden":"true",focusable:"false",xmlns:"http://www.w3.org/2000/svg",ref:e,dangerouslySetInnerHTML:{__html:s}})});Jw.displayName="VidstackIcon";var ne=$(j(),1);At();Yt();var zV=X($c),T1=ne.forwardRef(({children:t,...e},n)=>ne.createElement(zV,{...e},i=>ne.createElement(H.div,{...i,ref:re(i.ref,n)},t)));T1.displayName="Controls";var UV=X(Mc),E1=ne.forwardRef(({children:t,...e},n)=>ne.createElement(UV,{...e},i=>ne.createElement(H.div,{...i,ref:re(i.ref,n)},t)));E1.displayName="ControlsGroup";var nr=Object.freeze({__proto__:null,Group:E1,Root:T1}),jV=X(zc);function HV({children:t,...e}){return ne.createElement(jV,{...e},t)}HV.displayName="Tooltip";var qV=X(Uc),BV=ne.forwardRef(({children:t,...e},n)=>ne.createElement(qV,{...e},i=>ne.createElement(H.button,{...i,ref:re(i.ref,n)},t)));BV.displayName="TooltipTrigger";var WV=X(jc),KV=ne.forwardRef(({children:t,...e},n)=>ne.createElement(WV,{...e},i=>ne.createElement(H.div,{...i,ref:re(i.ref,n)},t)));KV.displayName="TooltipContent";var GV=X(Vc,{domEventsRegex:/^onMedia/}),S1=ne.forwardRef(({children:t,...e},n)=>ne.createElement(GV,{...e},i=>ne.createElement(H.button,{...i,ref:re(i.ref,n)},t)));S1.displayName="GoogleCastButton";var P1=ne.forwardRef(({children:t,...e},n)=>{let i=_e("title");return ne.createElement(H.span,{...e,ref:n},i,t)});P1.displayName="Title";function C1(t){let[e,n]=ne.useState([]);return ne.useEffect(()=>{if(!t){n([]);return}function i(){n(t.activeCues)}return i(),S(t,"cue-change",i)},[t]),e}function $1(t){let e=ki(),[n,i]=ne.useState(null);return ne.useEffect(()=>io(e.textTracks,t,i),[t]),n}function Tf(){let t=$1("chapters");return C1(t)[0]?.text||""}var M1=ne.forwardRef(({children:t,...e},n)=>{let i=Tf();return ne.createElement(H.span,{...e,ref:n},i,t)});M1.displayName="ChapterTitle";var YV=X(iu),Ef=ne.forwardRef(({children:t,...e},n)=>ne.createElement(YV,{...e,ref:n},i=>ne.createElement(H.div,{...i},t)));Ef.displayName="Captions";var uj=ne.forwardRef(({size:t=96,children:e,...n},i)=>ne.createElement("svg",{width:t,height:t,fill:"none",viewBox:"0 0 120 120","aria-hidden":"true","data-part":"root",...n,ref:i},e)),dj=ne.forwardRef(({width:t=8,children:e,...n},i)=>ne.createElement("circle",{cx:"60",cy:"60",r:"54",stroke:"currentColor",strokeWidth:t,"data-part":"track",...n,ref:i},e)),pj=ne.forwardRef(({width:t=8,fillPercent:e=50,children:n,...i},r)=>ne.createElement("circle",{cx:"60",cy:"60",r:"54",stroke:"currentColor",pathLength:"100",strokeWidth:t,strokeDasharray:100,strokeDashoffset:100-e,"data-part":"track-fill",...i,ref:r},n));var Sf=$(j(),1);Yt();function Pf(t){let e=ki(),n=Sf.useRef();return n.current||(n.current=new Ga),Sf.useEffect(()=>{let i=t&&"current"in t?t.current:t,r=i instanceof Os,s=r?i:e?.player;n.current.setPlayer(s??null),n.current.setTarget(i??null)},[e,t&&"current"in t?t.current:t]),n.current}var Bj=$(Ul(),1);var XV=["onAbort","onAudioTrackChange","onAudioTracksChange","onAutoPlay","onAutoPlayChange","onAutoPlayFail","onCanLoad","onCanPlay","onCanPlayThrough","onControlsChange","onDestroy","onDurationChange","onEmptied","onEnd","onEnded","onError","onFindMediaPlayer","onFullscreenChange","onFullscreenError","onLiveChange","onLiveEdgeChange","onLoadedData","onLoadedMetadata","onLoadStart","onLoopChange","onOrientationChange","onPause","onPictureInPictureChange","onPictureInPictureError","onPlay","onPlayFail","onPlaying","onPlaysInlineChange","onPosterChange","onProgress","onProviderChange","onProviderLoaderChange","onProviderSetup","onQualitiesChange","onQualityChange","onRateChange","onReplay","onSeeked","onSeeking","onSourceChange","onSourceChange","onStalled","onStarted","onStreamTypeChange","onSuspend","onTextTrackChange","onTextTracksChange","onTimeUpdate","onTitleChange","onVdsLog","onVideoPresentationChange","onVolumeChange","onWaiting"],ZV=X(Os,{events:XV,eventsRegex:/^onHls/,domEventsRegex:/^onMedia/}),eb=F.forwardRef(({aspectRatio:t,children:e,...n},i)=>F.createElement(ZV,{...n,src:n.src,ref:i,style:{aspectRatio:t,...n.style}},r=>F.createElement(H.div,{...r},e)));eb.displayName="MediaPlayer";var JV=X(uf),tb=F.forwardRef(({loaders:t=[],children:e,mediaProps:n,buildMediaEl:i,...r},s)=>{let a=F.useMemo(()=>t.map(o=>new o),t);return F.createElement(JV,{...r,loaders:a,ref:s},(o,l)=>F.createElement("div",{...o},F.createElement(I1,{...n,provider:l,buildMediaEl:i}),e))});tb.displayName="MediaProvider";function I1({provider:t,buildMediaEl:e,...n}){let{controls:i,crossOrigin:r,poster:s,remotePlaybackInfo:a}=Lr(Vs),{loader:o}=t.$state,{$iosControls:l,$provider:c,$providerSetup:u}=ki(),d=he(i),p=he(l),h=d||p,y=he(r),v=he(s),w=he(o),m=he(c),f=he(u),g=he(a),x=w?.mediaType(),E=w?.name==="youtube",L=w?.name==="vimeo",R=E||L,I=w?.name==="remotion",z=w?.name==="google-cast",[A,oe]=F.useState("");return F.useEffect(()=>{!z||A||Promise.resolve().then(()=>(L1(),R1)).then(ee=>{oe(ee.default)})},[z]),z?F.createElement("div",{className:"vds-google-cast",ref:ee=>{t.load(ee)}},F.createElement(Jw,{paths:A}),g?.deviceName?F.createElement("span",{className:"vds-google-cast-info"},"Google Cast on"," ",F.createElement("span",{className:"vds-google-cast-device-name"},g.deviceName)):null):I?F.createElement("div",{"data-remotion-canvas":!0},F.createElement("div",{"data-remotion-container":!0,ref:ee=>{t.load(ee)}},f1(m)&&f?F.createElement(m.render):null)):e?.(w,t)??(R?F.createElement(F.Fragment,null,F.createElement("iframe",{className:E?"vds-youtube":"vds-vimeo",suppressHydrationWarning:!0,tabIndex:h?void 0:-1,"aria-hidden":"true","data-no-controls":h?void 0:"",ref(ee){t.load(ee)}}),h?null:F.createElement("div",{className:"vds-blocker"})):x?F.createElement(x==="audio"?"audio":"video",{...n,controls:h?"true":null,crossOrigin:typeof y=="boolean"?"":y,poster:x==="video"&&h&&v?v:null,preload:"none","aria-hidden":"true",suppressHydrationWarning:!0,ref(ee){t.load(ee)}}):null)}I1.displayName="MediaOutlet";function eF(t){let e=ki(),n=F.useMemo(()=>new un(t),Object.values(t));return F.useEffect(()=>(e.textTracks.add(n),()=>void e.textTracks.remove(n)),[n]),n}function nb({lang:t,...e}){return eF({language:t,...e}),null}nb.displayName="Track";var tF=X(df),nF=F.forwardRef(({children:t,...e},n)=>F.createElement(tF,{...e},i=>F.createElement(H.button,{...i,ref:re(i.ref,n)},t)));nF.displayName="ToggleButton";var iF=X(pf),rF=F.forwardRef(({children:t,...e},n)=>F.createElement(iF,{...e},(i,r)=>F.createElement(A1,{...i,instance:r,ref:re(i.ref,n)},t)));rF.displayName="Poster";var A1=F.forwardRef(({instance:t,children:e,...n},i)=>{let{src:r,img:s,alt:a,crossOrigin:o}=t.$state,l=he(r),c=he(a),u=he(o);return F.createElement(H.img,{...n,src:l||"",alt:c||void 0,crossOrigin:u||void 0,ref:re(s.set,i)},e)});A1.displayName="PosterImg";var sF=F.forwardRef(({children:t,...e},n)=>F.createElement(H.div,{translate:"yes","aria-live":"off","aria-atomic":"true",...e,ref:n},t));sF.displayName="Caption";var aF=F.forwardRef((t,e)=>{let n=_e("textTrack"),[i,r]=F.useState();return F.useEffect(()=>{if(!n)return;function s(){r(n?.activeCues[0])}return n.addEventListener("cue-change",s),()=>{n.removeEventListener("cue-change",s),r(void 0)}},[n]),F.createElement(H.span,{...t,"data-part":"cue",dangerouslySetInnerHTML:{__html:i?.text||""},ref:e})});aF.displayName="CaptionText";function N1(){let[t,e]=F.useState(null),n=ki();return F.useEffect(()=>{if(n)return b(()=>{e(n.$provider())})},[]),t}function D1({clamp:t=!1,offset:e=0,orientation:n="horizontal"}={}){let[i,r]=F.useState(null),[s,a]=F.useState(null),[o,l]=F.useState(0),[c,u]=F.useState(!1);return F.useEffect(()=>{if(!i)return;let d=O(!1);function p(h){i&&l(oF(i,h,n))}return b(()=>{if(!d()){S(i,"pointerenter",()=>{u(!0),s?.setAttribute("data-visible","")}),S(i,"pointerdown",h=>{d.set(!0),p(h)}),S(i,"pointerleave",()=>{u(!1),s?.removeAttribute("data-visible")}),S(i,"pointermove",h=>{p(h)});return}s?.setAttribute("data-dragging",""),S(document,"pointerup",h=>{d.set(!1),s?.removeAttribute("data-dragging"),p(h)}),S(document,"pointermove",h=>{p(h)}),S(document,"touchmove",h=>h.preventDefault(),{passive:!1})})},[i]),F.useEffect(()=>{s&&s.style.setProperty("--slider-pointer",o+"%")},[s,o]),F.useEffect(()=>{if(!s)return;let d=()=>{Hw(s,{offset:e,clamp:t,orientation:n})};d();let p=new ResizeObserver(d);return p.observe(s),()=>p.disconnect()},[s,t,e,n]),{previewRootRef:r,previewRef:a,previewValue:o,isPreviewVisible:c}}function oF(t,e,n){let i,r=t.getBoundingClientRect();if(n==="vertical"){let{bottom:s,height:a}=r;i=(s-e.clientY)/a}else{let{left:s,width:a}=r;i=(e.clientX-s)/a}return lF(Math.max(0,Math.min(100,100*i)))}function lF(t){return Number(t.toFixed(3))}var O1='"use strict";var X=()=>({emit(e,...t){for(let n=0,r=this.events[e]||[],i=r.length;n<i;n++)r[n](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(n=>t!==n)}}});function Z(){let e=X();return e.once=function(n,r){let i=this.on(n,(...s)=>{i(),r(...s)});return i},e}function ee(e){let t=e;return typeof t.id=="string"&&typeof t.invoke=="string"}function te(e,...t){return{id:Ce(),invoke:e,args:t}}function ne(e){return typeof e.id=="string"}function re(e){return typeof e.send=="string"}function ie(e,t){return{send:e,payload:t}}function Ce(){return Math.random().toString(36).substring(2,9)}var k=class extends Error{constructor(t){super(`no handler for ${t}`)}},N="mx-port-ready";var R=class{port=null;load(t){this.port&&this.port.close(),this.port=t;let n=({data:r})=>{this.onMessage(r)};t.addEventListener("message",n),t.start(),t.postMessage(N)}unload(){this.port?.close(),this.emitter.events={}}actions=Object.create(null);emitter=Z();onMessage(t){t===N?this.emitter.emit("ready"):ee(t)?this.response(t):ne(t)?this.emitter.emit("resp",t.id,t.payload,t.error):re(t)&&this.emitter.emit(`send:${t.send}`,{type:t.send,payload:t.payload})}methods=new Proxy({},{get:(t,n)=>{if(typeof n=="symbol")throw new Error("Remote invoke does not support symbol property");return t[n]??=(...r)=>this.invoke(n.toString(),r)}});invoke(t,n,{transfer:r,timeout:i=1e3}={}){if(!this.port)throw new Error("port not loaded");let s=te(t,...n);return this.port.postMessage(s,{transfer:r}),new Promise((o,a)=>{let l=-1,u=this.emitter.on("resp",(c,p,y)=>{if(c===s.id)if(u(),window.clearTimeout(l),y){let{message:K,stack:z}=y,S=new Error(K);S.stack=z,a(S)}else o(p)});i>0&&i<1/0&&(l=window.setTimeout(()=>{u(),a(new M(i))},i))})}handle(t,n){this.actions[t]=n}send(t,n,r){if(!this.port)throw new Error("port not loaded");let i=ie(t,n);this.port.postMessage(i,{transfer:r})}on(t,n){return this.emitter.on(`send:${t}`,n)}once(t,n){return this.emitter.once(`send:${t}`,n)}onReady(t,{once:n=!1}={}){return n?this.emitter.once("ready",t):this.emitter.on("ready",t)}async response({id:t,invoke:n,args:r=[]}){if(!this.port)throw new Error("port not loaded");let i={id:t,payload:null};try{let s=this.actions[n];if(!s)throw new k(n);let o=await s(...r);o===void 0?this.port.postMessage(i):(i.payload=await o.value,this.port.postMessage(i,{transfer:o.transfer}))}catch(s){s instanceof Error?i.error={message:s.message,stack:s.stack}:i.error={message:String(s)},this.port.postMessage(i)}}},M=class extends Error{constructor(t){super(`timeout after ${t}ms`)}};var se="mx-port";async function q(){let e=await new Promise((n,r)=>{function i({data:o,ports:a}){o===se&&(n(a[0]),window.removeEventListener("message",i),window.clearTimeout(s))}window.addEventListener("message",i);let s=setTimeout(()=>{r("failed to get port: timeout "+5e3),window.removeEventListener("message",i)},5e3)}),t=new R;return t.load(e),t}var A=class{#e=[];#t=!1;async load(){if(!this.#t){this.#t=!0,await this.onload();for(let t of this.#n)await t.load()}}async onload(){}async unload(){if(!this.#t)return;this.#t=!1;let t;for(;t=this.#e.pop();)await t();let n;for(;n=this.#n.pop();)await n.unload();await this.onunload()}async onunload(){}register(t){this.#e.push(t)}registerInterval(t,n){let r=setInterval(t,n);this.register(()=>clearInterval(r))}registerDomEvent(t,n,r,i){t.addEventListener(n,r,i),this.register(()=>t.removeEventListener(n,r,i))}#n=[];async addChild(t){return this.#n.push(t),this.#t&&await t.load(),t}async removeChild(t){let n=this.#n.indexOf(t);return n!==-1&&(this.#n.splice(n,1),t.unload()),t}};function d(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return{type:"TimeRanges",value:t}}function ae(e){let t=e.media,n=e.controller;e.registerDomEvent(t,"abort",r),e.registerDomEvent(t,"emptied",i),e.registerDomEvent(t,"error",s),e.registerDomEvent(t,"volumechange",o),e.registerDomEvent(t,"durationchange",a),e.registerDomEvent(t,"progress",l),e.registerDomEvent(t,"stalled",u),e.registerDomEvent(t,"suspend",c),e.registerDomEvent(t,"ratechange",p),e.registerDomEvent(t,"seeked",y),e.registerDomEvent(t,"seeking",K),e.registerDomEvent(t,"ended",z),e.registerDomEvent(t,"waiting",S),t instanceof HTMLVideoElement&&(e.registerDomEvent(t,"enterpictureinpicture",()=>n.send("enterpictureinpicture",void 0)),e.registerDomEvent(t,"leavepictureinpicture",()=>n.send("leavepictureinpicture",void 0)));function r(){n.send("abort",void 0)}function i(){n.send("emptied",void 0)}function s(){t.error&&n.send("error",{code:t.error.code,message:t.error.message})}function o(){n.send("volumechange",{muted:t.muted,volume:t.volume})}function a(){n.send("durationchange",{played:d(t.played),duration:t.duration})}function l(){n.send("progress",{buffered:d(t.buffered),seekable:d(t.seekable)})}function u(){n.send("stalled",{readyState:t.readyState})}function c(){n.send("suspend",void 0)}function p(){n.send("ratechange",{rate:t.playbackRate})}function y(){n.send("seeked",{current:t.currentTime,played:d(t.played),duration:t.duration,ended:t.ended})}function K(){n.send("seeking",{current:t.currentTime})}function z(){n.send("ended",{controls:t.controls,current:t.currentTime,played:d(t.played),duration:t.duration,ended:t.ended})}function S(){n.send("waiting",{readyState:t.readyState})}}var U=class{value;next;constructor(t){this.value=t}},x=class{#e;#t;#n;constructor(){this.clear()}enqueue(t){let n=new U(t);this.#e?(this.#t.next=n,this.#t=n):(this.#e=n,this.#t=n),this.#n++}dequeue(){let t=this.#e;if(t)return this.#e=this.#e.next,this.#n--,t.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let t=this.#e;for(;t;)yield t.value,t=t.next}};var le={bind(e,t,n){return e.bind(n)}};function F(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let t=new x,n=0,r=()=>{n--,t.size>0&&t.dequeue()()},i=async(a,l,u)=>{n++;let c=(async()=>a(...u))();l(c);try{await c}catch{}r()},s=(a,l,u)=>{t.enqueue(le.bind(i.bind(void 0,a,l,u))),(async()=>(await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()))()},o=(a,...l)=>new Promise(u=>{s(a,u,l)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}}}),o}async function ue(e,t,n){let r=document.createElement("canvas"),{videoWidth:i,videoHeight:s}=e;if(!i||!s)throw new Error("Cannot screenshot video without width or height");Object.assign(r,{width:i,height:s});let o=r.getContext("2d",{alpha:!1});if(!o)throw new Error("Canvas context creation failed");o.drawImage(e,0,0,i,s);let a=await new Promise((u,c)=>{try{r.toBlob(p=>{p?u(p):c(new Error("Canvas to blob failed"))},t,n)}catch(p){c(p)}}),l=await a.arrayBuffer();return{time:e.currentTime,blob:{arrayBuffer:l,type:a.type}}}var de=["currentTime","playbackRate","volume","muted"],ce=["paused","played","networkState","duration","buffered","seekable","readyState","ended","autoplay","error"],me=["play","pause"],fe="mx-mounted";function T(e){return e[0].toUpperCase()+e.slice(1)}function W(e){return e instanceof TimeRanges?d(e):e}function pe(){let e=this.media,t=this.controller,n=this.stateRef;ce.forEach(i=>{t.handle(`get${T(i)}`,()=>({value:W(e[i])}))}),t.handle("pictureInPictureEnabled",()=>({value:document.pictureInPictureElement===e})),t.handle("requestPictureInPicture",()=>{e instanceof HTMLVideoElement&&e.requestPictureInPicture()}),t.handle("exitPictureInPicture",()=>{document.exitPictureInPicture()}),de.forEach(i=>{t.handle(`get${T(i)}`,()=>({value:W(e[i])})),i==="currentTime"?t.handle(`set${T(i)}`,s=>{n.prevSeek={value:e.currentTime,time:Date.now()},e[i]=s}):t.handle(`set${T(i)}`,s=>{e[i]=s})}),me.forEach(i=>{t.handle(i,async(...s)=>({value:await e[i](...s)}))}),t.handle("screenshot",async(i,s)=>{if(!(e instanceof HTMLVideoElement))throw new Error("Cannot take screenshot of non-video element");let o=await ue(e,i,s);return{value:o,transfer:[o.blob.arrayBuffer]}});let r=F(4);return t.handle("fetch",async(i,{gzip:s=!1,...o}={})=>{let a=await r(()=>window.fetch(i,o)),l=await a.blob(),u={type:l.type,respHeaders:Object.fromEntries(a.headers)};if(!s){let y=await l.arrayBuffer();return{value:{ab:y,gzip:!1,...u},transfer:[y]}}let c=l.stream(),p=await De(c.pipeThrough(new CompressionStream("gzip")));return{value:{ab:p,gzip:!0,...u},transfer:[p]}}),n}async function De(e){let t=e.getReader(),n=[];for(;;){let{done:s,value:o}=await t.read();if(s)break;n.push(o)}let r=n.reduce((s,o)=>s+o.byteLength,0),i=new Uint8Array(r);for(let s=0,o=0;s<n.length;s++)i.set(n[s],o),o+=n[s].byteLength;return i.buffer}function ge(e){let t=e.media,n=e.controller;e.registerDomEvent(t,"loadstart",o),e.registerDomEvent(t,"loadeddata",l),e.registerDomEvent(t,"loadedmetadata",a),e.registerDomEvent(t,"canplay",u),e.registerDomEvent(t,"canplaythrough",c),t.readyState===0&&t.load(),t.readyState>=0&&o(),t.readyState>=1&&a(),t.readyState>=2&&l(),t.readyState>=3&&u(),t.readyState>=4&&c(),e.registerDomEvent(t,"play",s),e.registerDomEvent(t,"pause",r),e.registerDomEvent(t,"playing",i),t.readyState>=3&&!t.paused?(s(),i()):r();function r(){n.send("pause",{readyState:t.readyState})}function i(){n.send("playing",void 0)}function s(){n.send("play",void 0)}function o(){n.send("loadstart",{networkState:t.networkState})}function a(){n.send("loadedmetadata",void 0)}function l(){n.send("loadeddata",void 0)}function u(){n.send("canplay",{buffered:d(t.buffered),seekable:d(t.seekable),duration:t.duration})}function c(){n.send("canplaythrough",{buffered:d(t.buffered),seekable:d(t.seekable),duration:t.duration})}}var g=Symbol(0),C=!1,he=!1,$=null,E=null,f=null,m=0,b=[],j={};var w=0,we=1,P=2,B=3;function Ie(){C=!0,queueMicrotask(Oe)}function Oe(){if(!b.length){C=!1;return}he=!0;for(let e=0;e<b.length;e++)b[e].$st!==w&&He(b[e]);b=[],C=!1,he=!1}function He(e){let t=[e];for(;e=e[g];)e.$e&&e.$st!==w&&t.push(e);for(let n=t.length-1;n>=0;n--)J(t[n])}function G(e=!0){if(this.$st===B)return;let t=e?this.$ps||this[g]:this,n=this.$ns,r=null;for(;n&&n[g]===this;)G.call(n,!0),ye(n),r=n.$ns,n.$ns=null,n=r;e&&ye(this),n&&(n.$ps=e?this.$ps:this),t&&(t.$ns=n)}function ye(e){e.$st=B,e.$d&&Me(e),e.$s&&L(e,0),e.$ps&&(e.$ps.$ns=null),e[g]=null,e.$s=null,e.$o=null,e.$ps=null,e.$cx=j,e.$eh=null}function Me(e){try{if(Array.isArray(e.$d))for(let t=e.$d.length-1;t>=0;t--){let n=e.$d[t];n.call(n)}else e.$d.call(e.$d);e.$d=null}catch(t){xe(e,t)}}function _e(e,t,n){let r=$,i=E;$=e,E=n;try{return t.call(e)}finally{$=r,E=i}}function xe(e,t){if(!e||!e.$eh)throw t;let n=0,r=e.$eh.length,i=ve(t);for(n=0;n<r;n++)try{e.$eh[n](i);break}catch(s){i=ve(s)}if(n===r)throw i}function ve(e){return e instanceof Error?e:Error(JSON.stringify(e))}function Ke(){return this.$st===B?this.$v:(E&&!this.$e&&(!f&&E.$s&&E.$s[m]==this?m++:f?f.push(this):f=[this]),this.$c&&J(this),this.$v)}function ze(e){let t=Ue(e)?e(this.$v):e;if(this.$ch(this.$v,t)&&(this.$v=t,this.$o))for(let n=0;n<this.$o.length;n++)$e(this.$o[n],P);return this.$v}var Te=function(){this[g]=null,this.$ns=null,this.$ps=null,$&&$.append(this)},v=Te.prototype;v.$cx=j;v.$eh=null;v.$c=null;v.$d=null;v.append=function(e){if(e[g]=this,e.$ps=this,this.$ns)if(e.$ns){let t=e.$ns;for(;t.$ns;)t=t.$ns;t.$ns=this.$ns,this.$ns.$ps=t}else e.$ns=this.$ns,this.$ns.$ps=e;this.$ns=e,e.$cx=e.$cx===j?this.$cx:{...this.$cx,...e.$cx},this.$eh&&(e.$eh=e.$eh?[...e.$eh,...this.$eh]:this.$eh)};v.dispose=function(){G.call(this)};var Ne=function(t,n,r){Te.call(this),this.$st=n?P:w,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=t,n&&(this.$c=n),r&&r.dirty&&(this.$ch=r.dirty)},Y=Ne.prototype;Object.setPrototypeOf(Y,v);Y.$ch=qe;Y.call=Ke;function qe(e,t){return e!==t}function Ue(e){return typeof e=="function"}function J(e){if(e.$st===we)for(let t=0;t<e.$s.length&&(J(e.$s[t]),e.$st!==P);t++);e.$st===P?Fe(e):e.$st=w}function be(e){e.$ns&&e.$ns[g]===e&&G.call(e,!1),e.$d&&Me(e),e.$eh=e[g]?e[g].$eh:null}function Fe(e){let t=f,n=m;f=null,m=0;try{be(e);let r=_e(e,e.$c,e);if(f){if(e.$s&&L(e,m),e.$s&&m>0){e.$s.length=m+f.length;for(let s=0;s<f.length;s++)e.$s[m+s]=f[s]}else e.$s=f;let i;for(let s=m;s<e.$s.length;s++)i=e.$s[s],i.$o?i.$o.push(e):i.$o=[e]}else e.$s&&m<e.$s.length&&(L(e,m),e.$s.length=m);!e.$e&&e.$i?ze.call(e,r):(e.$v=r,e.$i=!0)}catch(r){xe(e,r),e.$st===P&&(be(e),e.$s&&L(e,0));return}f=t,m=n,e.$st=w}function $e(e,t){if(!(e.$st>=t)&&(e.$e&&e.$st===w&&(b.push(e),C||Ie()),e.$st=t,e.$o))for(let n=0;n<e.$o.length;n++)$e(e.$o[n],we)}function L(e,t){let n,r;for(let i=t;i<e.$s.length;i++)n=e.$s[i],n.$o&&(r=n.$o.indexOf(e),n.$o[r]=n.$o[n.$o.length-1],n.$o.pop())}function Pe(...e){}function I(e){return typeof e>"u"}function Q(e){return typeof e=="number"&&!Number.isNaN(e)}var Ee,We=Event,Se=Symbol("DOM_EVENT"),V=class extends We{constructor(t,...n){super(t,n[0]),this[Ee]=!0,this.triggers=new D,this.detail=n[0]?.detail;let r=n[0]?.trigger;r&&this.triggers.add(r)}static{Ee=Se}get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){return this.triggers.origin?.isTrusted??!1}},D=class{constructor(){this.chain=[]}get source(){return this.chain[0]}get origin(){return this.chain[this.chain.length-1]}add(t){this.chain.push(t),ke(t)&&this.chain.push(...t.triggers)}remove(t){return this.chain.splice(this.chain.indexOf(t),1)[0]}has(t){return this.chain.some(n=>n===t)}hasType(t){return!!this.findType(t)}findType(t){return this.chain.find(n=>n.type===t)}walk(t){for(let n of this.chain){let r=t(n);if(r)return[n,r]}}[Symbol.iterator](){return this.chain.values()}};function ke(e){return!!e?.[Se]}var dn=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:e=>window.setTimeout(e,1):Pe;var O=class{constructor(t){this._callback=t}_id;_start(){I(this._id)&&this._loop()}_stop(){Q(this._id)&&window.cancelAnimationFrame(this._id),this._id=void 0}_loop(){this._id=window.requestAnimationFrame(()=>{I(this._id)||(this._callback(),this._loop())})}};function Re(e){let t=e.media,n=e.controller,r=new O(a);e.register(()=>r._stop());let i,s=t.currentTime;function o(){i!==t.paused&&(i=t.paused,t.paused?t.addEventListener("timeupdate",a):t.removeEventListener("timeupdate",a))}o(),t.addEventListener("ended",()=>{r._stop(),o()}),t.addEventListener("pause",()=>{r._stop(),o()}),t.addEventListener("playing",()=>{r._start(),o()});function a(){s!==t.currentTime&&(s=t.currentTime,n.send("timeupdate",{current:s,played:d(t.played)}))}}function H(e,t=document.body,n=1e4){return new Promise((r,i)=>{let s=t.querySelector(e);if(s){r(s);return}let o=new MutationObserver(()=>{let l=t.querySelector(e);l&&(o.disconnect(),r(l),window.clearTimeout(a))}),a=window.setTimeout(()=>{o.disconnect(),i(new Error(`timeout waiting for ${e}`))},n);o.observe(t,{childList:!0,subtree:!0})})}var Ve=[".dplayer",".video-js",".jwplayer","[data-player]"],h=class extends A{constructor(n){super();this.controller=n;this.register(()=>n.unload())}getStyle(){return Ge}#e=null;stateRef={prevSeek:null};findMedia(){return H("video, audio")}async load(){let n=this.getStyle();n&&this.injectStyle(n),await super.load();let r=this.media.controls===!0;r&&(this.media.controls=!1),this.register(this.controller.on("mx-toggle-controls",({payload:i})=>{document.body.classList.toggle("mx-show-controls",i)})),r&&this.register(this.controller.on("mx-toggle-controls",({payload:i})=>{this.media.controls=i})),this.register(this.controller.on("mx-toggle-webfs",({payload:i})=>{document.body.classList.toggle("mx-fs-enable",i)})),document.body.classList.add("mx-play-ready"),this.controller.send("mx-play-ready",void 0)}get media(){if(!this.#e)throw new Error("Get media before load");return this.#e}async onload(){this.#e=await this.findMedia(),await Promise.all([this.enterWebFullscreen(),this.hookMediaEl()])}enterWebFullscreen(){document.body.classList.add("mx-fs-enable");let n=this.media.closest(Ve.join(", "))??this.media;n.classList.add("mx-player"),this.assignParentClass(n),window.dispatchEvent(new Event("resize"))}assignParentClass(n){for(let r of je(n))r.classList.add("mx-parent"),getComputedStyle(r).position=="fixed"&&r.classList.add("mx-absolute")}injectStyle(n){let r=document.createElement("style");r.textContent=n,document.head.appendChild(r),this.register(()=>r.remove())}async untilMediaReady(n="canplay",r=5e3){if(this.media.readyState>=Be[n])return;let i=-1;await new Promise((s,o)=>{this.registerDomEvent(this.media,n,s,{once:!0}),i=window.setTimeout(()=>{o(new M(r))},r)}),window.clearTimeout(i)}async hookMediaEl(){ge(this),Re(this),ae(this),pe.call(this),this.controller.send(fe,void 0)}};function*je(e,t=!1){for(t&&(yield e);e.parentElement&&e.parentElement!==document.body;)e=e.parentElement,yield e}var Be={loadedmetadata:HTMLMediaElement.HAVE_METADATA,loadeddata:HTMLMediaElement.HAVE_CURRENT_DATA,canplay:HTMLMediaElement.HAVE_FUTURE_DATA,canplaythrough:HTMLMediaElement.HAVE_ENOUGH_DATA},Ge=`\nbody.mx-fs-enable .mx-player {\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: none !important;\n max-height: none !important;\n min-width: 0 !important;\n min-height: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n z-index: 2147483647 !important; /* Ensure it\'s on top of other elements */\n background-color: #000 !important;\n transform: none !important;\n}\nbody.mx-fs-enable .mx-parent {\n overflow: visible !important;\n z-index: auto !important;\n transform: none !important;\n -webkit-transform-style: flat !important;\n transition: none !important;\n contain: none !important;\n}\nbody.mx-fs-enable .mx-absolute {\n position: absolute !important;\n}\nbody.mx-fs-enable {\n overflow: hidden !important;\n zoom: 100% !important;\n}\nbody.mx-fs-enable .mx-parent video {\n object-fit: contain !important;\n}\n`.trim();var Ye={waitForSelector:H,MediaPlugin:h},Ae=(e=>function(n){if(n in e)return e[n];throw new Error(`Module not found: ${n.toString()}`)})({"media-extended":Ye});async function Le(e,t){if(!e)return new h(t);let n=window.eval(`(function anonymous(require,module,exports){${e}\n})`),r={},i={exports:r};n(Ae,i,r),r=i.exports||r;let s=r.default||i.exports;if(!s)throw new Error("Failed to load plugin. No exports detected.");let o=new s(t);if(!(o instanceof h))throw new Error("Failed to load plugin. plugin not extends MediaPlugin");return o}var _;q().then(e=>{e.handle("loadPlugin",async t=>{_&&_.unload(),_=await Le(t,e),_.load()})});\n';var ir=Symbol(0),$f=!1,V1=!1,Fs=null,ao=null,An=null,mn=0,so=[],rb={},uF=()=>{},oo=0,H1=1,pu=2,Rf=3;function dF(){$f=!0,queueMicrotask(pF)}function pF(){if(!so.length){$f=!1;return}V1=!0;for(let t=0;t<so.length;t++)so[t].$st!==oo&&hF(so[t]);so=[],$f=!1,V1=!1}function hF(t){let e=[t];for(;t=t[ir];)t.$e&&t.$st!==oo&&e.push(t);for(let n=e.length-1;n>=0;n--)ob(e[n])}function q1(t){if(!t||!Fs)return t||uF;let e=Fs;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==Rf&&(t.call(null),G1(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function sb(t=!0){if(this.$st===Rf)return;let e=t?this.$ps||this[ir]:this,n=this.$ns,i=null;for(;n&&n[ir]===this;)sb.call(n,!0),F1(n),i=n.$ns,n.$ns=null,n=i;t&&F1(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function F1(t){t.$st=Rf,t.$d&&B1(t),t.$s&&Cf(t,0),t.$ps&&(t.$ps.$ns=null),t[ir]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=rb,t.$eh=null}function B1(t){try{if(Array.isArray(t.$d))for(let e=t.$d.length-1;e>=0;e--){let n=t.$d[e];n.call(n)}else t.$d.call(t.$d);t.$d=null}catch(e){W1(t,e)}}function fF(t,e,n){let i=Fs,r=ao;Fs=t,ao=n;try{return e.call(t)}finally{Fs=i,ao=r}}function W1(t,e){if(!t||!t.$eh)throw e;let n=0,i=t.$eh.length,r=z1(e);for(n=0;n<i;n++)try{t.$eh[n](r);break}catch(s){r=z1(s)}if(n===i)throw r}function z1(t){return t instanceof Error?t:Error(JSON.stringify(t))}function mF(){return this.$st===Rf?this.$v:(ao&&!this.$e&&(!An&&ao.$s&&ao.$s[mn]==this?mn++:An?An.push(this):An=[this]),this.$c&&ob(this),this.$v)}function gF(t){let e=G1(t)?t(this.$v):t;if(this.$ch(this.$v,e)&&(this.$v=e,this.$o))for(let n=0;n<this.$o.length;n++)Y1(this.$o[n],pu);return this.$v}var K1=function(){this[ir]=null,this.$ns=null,this.$ps=null,Fs&&Fs.append(this)},zs=K1.prototype;zs.$cx=rb;zs.$eh=null;zs.$c=null;zs.$d=null;zs.append=function(t){if(t[ir]=this,t.$ps=this,this.$ns)if(t.$ns){let e=t.$ns;for(;e.$ns;)e=e.$ns;e.$ns=this.$ns,this.$ns.$ps=e}else t.$ns=this.$ns,this.$ns.$ps=t;this.$ns=t,t.$cx=t.$cx===rb?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};zs.dispose=function(){sb.call(this)};var vF=function(e,n,i){K1.call(this),this.$st=n?pu:oo,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,n&&(this.$c=n),i&&i.dirty&&(this.$ch=i.dirty)},ab=vF.prototype;Object.setPrototypeOf(ab,zs);ab.$ch=yF;ab.call=mF;function yF(t,e){return t!==e}function G1(t){return typeof t=="function"}function ob(t){if(t.$st===H1)for(let e=0;e<t.$s.length&&(ob(t.$s[e]),t.$st!==pu);e++);t.$st===pu?_F(t):t.$st=oo}function U1(t){t.$ns&&t.$ns[ir]===t&&sb.call(t,!1),t.$d&&B1(t),t.$eh=t[ir]?t[ir].$eh:null}function _F(t){let e=An,n=mn;An=null,mn=0;try{U1(t);let i=fF(t,t.$c,t);if(An){if(t.$s&&Cf(t,mn),t.$s&&mn>0){t.$s.length=mn+An.length;for(let s=0;s<An.length;s++)t.$s[mn+s]=An[s]}else t.$s=An;let r;for(let s=mn;s<t.$s.length;s++)r=t.$s[s],r.$o?r.$o.push(t):r.$o=[t]}else t.$s&&mn<t.$s.length&&(Cf(t,mn),t.$s.length=mn);!t.$e&&t.$i?gF.call(t,i):(t.$v=i,t.$i=!0)}catch(i){W1(t,i),t.$st===pu&&(U1(t),t.$s&&Cf(t,0));return}An=e,mn=n,t.$st=oo}function Y1(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===oo&&(so.push(t),$f||dF()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)Y1(t.$o[n],H1)}function Cf(t,e){let n,i;for(let r=e;r<t.$s.length;r++)n=t.$s[r],n.$o&&(i=n.$o.indexOf(t),n.$o[i]=n.$o[n.$o.length-1],n.$o.pop())}function Q1(...t){}function hu(t){return typeof t=="string"}var j1,wF=Event,X1=Symbol("DOM_EVENT"),ib=class extends wF{constructor(e,...n){super(e,n[0]),this[j1]=!0,this.triggers=new Mf,this.detail=n[0]?.detail;let i=n[0]?.trigger;i&&this.triggers.add(i)}get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){return this.triggers.origin?.isTrusted??!1}};j1=X1;var Mf=class{constructor(){this.chain=[]}get source(){return this.chain[0]}get origin(){return this.chain[this.chain.length-1]}add(e){this.chain.push(e),Z1(e)&&this.chain.push(...e.triggers)}remove(e){return this.chain.splice(this.chain.indexOf(e),1)[0]}has(e){return this.chain.some(n=>n===e)}hasType(e){return!!this.findType(e)}findType(e){return this.chain.find(n=>n.type===e)}walk(e){for(let n of this.chain){let i=e(n);if(i)return[n,i]}}[Symbol.iterator](){return this.chain.values()}};function Z1(t){return!!t?.[X1]}function bF(){let t=new Set;return{add(...e){for(let n of e)t.add(n)},empty(){for(let e of t)e();t.clear()}}}function J1(){let t=bF();return q1(t.empty),t}var N7=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):Q1;var jr=require("obsidian");var eC=`"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var y=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},b=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p(e))!m.call(r,n)&&n!==t&&s(r,n,{get:()=>e[n],enumerable:!(i=d(e,n))||i.enumerable});return r};var f=r=>b(s({},"__esModule",{value:!0}),r);var k={};y(k,{default:()=>o});module.exports=f(k);var c=()=>require("media-extended");var{waitForSelector:l,MediaPlugin:h}=c(),w=\`
#bilibili-player .bpx-player-control-wrap {
opacity: 0 !important;
}
.mx-show-controls #bilibili-player .bpx-player-control-wrap {
opacity: 100 !important;
}
\`,o=class extends h{findMedia(){return l("#bilibili-player video")}getStyle(){return w}async onload(){this.controller.handle("bili_getManifest",()=>({value:window.player.getManifest()})),localStorage.setItem("recommend_auto_play","close"),localStorage.setItem("bpx_player_profile",JSON.stringify({media:{autoplay:!1}})),await super.onload(),this.revertAutoSeek(),Promise.all([this.toggleDanmaku(!1)]),await this.untilWebFullscreen()}get player(){return this.media.closest("#bilibili-player")}async toggleDanmaku(e){if(window.player){e===void 0&&(e=!window.player.danmaku.isOpen()),e?window.player.danmaku.open():window.player.danmaku.close();return}let t=await l(".bui-danmaku-switch",this.player);if(!t)return;let i=t.querySelector("input.bui-danmaku-switch-input");if(i){if(e===void 0){i.click();return}e!==this.isDanmakuOn(t)&&i.click()}}isDanmakuOn(e){return e.querySelector(".bui-danmaku-switch-off")?.offsetHeight===0}isWebFullscreen(){return this.player.classList.contains("mode-webscreen")}enterWebFullscreen(){this.isWebFullscreen()||l(".bpx-player-ctrl-web",this.player).then(e=>{e.click()})}revertAutoSeek(){let t=this.player.querySelector(".bpx-player-toast-auto");if(!t)return;let i=()=>{this.stateRef.prevSeek&&this.stateRef.prevSeek.time>Date.now()-5e3?this.media.currentTime=this.stateRef.prevSeek.value:this.media.currentTime=0},n=new MutationObserver(u=>{u.find(a=>a.type==="childList"&&a.addedNodes.length>0)?.addedNodes.forEach(a=>{a.textContent?.includes("\\u5DF2\\u4E3A\\u60A8\\u5B9A\\u4F4D\\u81F3")&&(a.style.opacity="0",i())})});n.observe(t,{childList:!0,subtree:!0}),this.register(()=>n.disconnect())}async untilWebFullscreen(){let e=this.player;this.isWebFullscreen()||await new Promise(t=>{let i=new MutationObserver(n=>{n.find(a=>a.type==="attributes"&&a.attributeName==="class"&&e?.classList.contains("mode-webscreen"))&&(i.disconnect(),t(void 0))});i.observe(e,{attributes:!0}),setTimeout(()=>{i.disconnect(),t(void 0)},6e3)})}};
`;var tC=`"use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var u=(r,e)=>{for(var o in e)a(r,o,{get:e[o],enumerable:!0})},m=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!d.call(r,t)&&t!==o&&a(r,t,{get:()=>e[t],enumerable:!(s=l(e,t))||s.enumerable});return r};var c=r=>m(a({},"__esModule",{value:!0}),r);var b={};u(b,{default:()=>i});module.exports=c(b);var n=()=>require("media-extended");var y=\`
body:not(.mx-show-controls) .vp-player-ui-overlays {
opacity: 0 !important;
}
\`,{waitForSelector:x,MediaPlugin:M}=n(),i=class extends M{findMedia(){return x("#main [data-player] .vp-video video")}getStyle(){return super.getStyle()+\`
\`+y}};
`;var nC=`"use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var b=(o,t)=>{for(var e in t)d(o,e,{get:t[e],enumerable:!0})},g=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of y(t))!h.call(o,r)&&r!==e&&d(o,r,{get:()=>t[r],enumerable:!(n=u(t,r))||n.enumerable});return o};var v=o=>g(d({},"__esModule",{value:!0}),o);var x={};b(x,{default:()=>l});module.exports=v(x);var a=()=>require("media-extended");var w=\`
body:not(.mx-player-ready) #movie_player,
ytd-watch-flexy[theater] #movie_player {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100vw !important;
height: 100vh !important;
max-width: none !important;
max-height: none !important;
min-width: 0 !important;
min-height: 0 !important;
margin: 0 !important;
padding: 0 !important;
z-index: 2147483647 !important; /* Ensure it's on top of other elements */
background-color: #000 !important;
transform: none !important;
}
.mx-parent {
overflow: visible !important;
z-index: auto !important;
transform: none !important;
-webkit-transform-style: flat !important;
transition: none !important;
contain: none !important;
}
.mx-absolute {
position: absolute !important;
}
html, body {
overflow: hidden !important;
zoom: 100% !important;
}
.mx-parent video {
object-fit: contain !important;
}
ytd-app .html5-endscreen {
opacity: 0 !important;
}
body:not(.mx-show-controls) ytd-app .ytp-chrome-bottom {
opacity: 0 !important;
}
\`.trim(),f=\`
/* \\u9996\\u9875\\u9876\\u90E8\\u6A2A\\u5E45\\u5E7F\\u544A */
#masthead-ad,
/* \\u9996\\u9875\\u89C6\\u9891\\u6392\\u7248\\u5E7F\\u544A */
ytd-rich-item-renderer.style-scope.ytd-rich-grid-row #content:has(.ytd-display-ad-renderer),
/* \\u64AD\\u653E\\u5668\\u5E95\\u90E8\\u5E7F\\u544A */
.video-ads.ytp-ad-module,
/* \\u64AD\\u653E\\u9875\\u4F1A\\u5458\\u4FC3\\u9500\\u5E7F\\u544A */
tp-yt-paper-dialog:has(yt-mealbar-promo-renderer),
/* \\u64AD\\u653E\\u9875\\u53F3\\u4E0A\\u65B9\\u63A8\\u8350\\u5E7F\\u544A */
ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"],
/* \\u64AD\\u653E\\u9875\\u8BC4\\u8BBA\\u533A\\u53F3\\u4FA7\\u63A8\\u5E7F\\u5E7F\\u544A */
#related #player-ads,
/* \\u64AD\\u653E\\u9875\\u8BC4\\u8BBA\\u533A\\u53F3\\u4FA7\\u89C6\\u9891\\u6392\\u7248\\u5E7F\\u544A */
#related ytd-ad-slot-renderer,
/* \\u641C\\u7D22\\u9875\\u5E7F\\u544A */
ytd-ad-slot-renderer,
/* \\u64AD\\u653E\\u9875\\u4F1A\\u5458\\u63A8\\u8350\\u5E7F\\u544A */
yt-mealbar-promo-renderer,
/* M\\u64AD\\u653E\\u9875\\u7B2C\\u4E09\\u65B9\\u63A8\\u8350\\u5E7F */
ad-slot-renderer,
/* M\\u53EF\\u8DF3\\u8FC7\\u7684\\u89C6\\u9891\\u5E7F\\u544A\\u94FE\\u63A5 */
ytm-companion-ad-renderer {
opacity: 0 !important;
}
\`.trim(),{waitForSelector:s,MediaPlugin:E}=a(),i=class extends E{findMedia(){return s("ytd-app #movie_player video")}getStyle(){return w+\`
\`+f}async onload(){await super.onload(),this.disableAutoPlay(),s("ytd-consent-bump-v2-lightbox",this.app).then(()=>{this.controller.send("mx-open-browser",{message:"Seems like YouTube is showing a consent popup that block playback. To continue playback, you should handle it in dedicated login browser. ",url:"https://youtube.com"})})}get app(){return this.media.closest("ytd-app")}get moviePlayer(){return this.media.closest("#movie_player")}async disableAutoPlay(){let e=await s('button.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"]',this.app);if(!e)throw new Error("Autoplay button not found");let n=e.querySelector(".ytp-autonav-toggle-button");if(!n)throw new Error("Autoplay button label not found");let r=()=>n.getAttribute("aria-checked")==="true";r()&&(e.click(),await new Promise(m=>{let c=new MutationObserver(()=>{r()||(c.disconnect(),m())});c.observe(n,{attributes:!0})}))}enterWebFullscreen(){this.assignParentClass(this.moviePlayer),(async()=>{let t=await s("#movie_player .ytp-size-button"),e=()=>!!this.app.querySelector("ytd-watch-flexy[theater]");if(!e())do t.click(),await M(200);while(!e());window.dispatchEvent(new Event("resize"))})()}};function M(o){return new Promise(t=>setTimeout(t,o))}var{waitForSelector:p}=a(),l=class extends i{findMedia(){return p("ytd-app #movie_player video")}async onload(){await super.onload(),p(".video-ads.ytp-ad-module",this.app).then(t=>this.removePlayerAD(t))}removePlayerAD(t){let e=new MutationObserver(()=>this.skipAd());this.registerInterval(()=>this.skipAd(),500),e.observe(t,{childList:!0,subtree:!0})}skipAd(){let t=this.media,e=this.moviePlayer.querySelector(".ytp-ad-skip-button")||this.moviePlayer.querySelector(".ytp-ad-skip-button-modern"),n=this.moviePlayer.querySelector(".video-ads.ytp-ad-module .ytp-ad-player-overlay");if(t)if(e){if(window.location.href.indexOf("https://m.youtube.com/")===-1&&(t.muted=!0),t.currentTime>.5){t.currentTime=t.duration;return}e.click(),T.call(e)}else n&&(t.currentTime=t.duration)}};function T(){let o=new Touch({identifier:Date.now(),target:this,clientX:12,clientY:34,radiusX:56,radiusY:78,rotationAngle:0,force:1}),t=new TouchEvent("touchstart",{bubbles:!0,cancelable:!0,view:window,touches:[o],targetTouches:[o],changedTouches:[o]});this.dispatchEvent(t);let e=new TouchEvent("touchend",{bubbles:!0,cancelable:!0,view:window,touches:[],targetTouches:[],changedTouches:[o]});this.dispatchEvent(e)}
`;var iC={bilibili:eC,youtube:nC,vimeo:tC,coursera:void 0,generic:void 0};var rC={generic:t=>t,bilibili:t=>t.replaceAll(/[-_]哔哩哔哩.+$|[-_]bilibili.+$|-(?:番剧|电影|纪录片|国创|电视剧|综艺)-.+/g,""),youtube:t=>t.replace(/^\(\d+\) /,"").replace(/ - YouTube$/,""),vimeo:t=>t.replace(/ on Vimeo$/,""),coursera:t=>t.replace(/ \| Coursera$/,"")};var EC=require("url"),lo=require("obsidian");var fu=require("obsidian");function Lf(t){return t===0?"00:00:00":fu.moment.utc(fu.moment.duration({seconds:t}).as("milliseconds")).format("HH:mm:ss")}function oC(t){return t===0?"DT0S":fu.moment.duration(t,"seconds").toISOString()}var sC=(t,e=2)=>{let n,i;return Number.isInteger(t)?n=t.toString():[n,i]=t.toFixed(e).split("."),n.length===1&&(n="0"+n),i?n+"."+i:n};function mu(t){return t.replace(/t=[^&]+/,"")}function lb(t,e){if(t=mu(t.trim().replace(/^#/,"")),!e)return t;let n=cb(e);return t?`${t}&${n}`:n??""}function lC(t,e){let n=Number.isNaN(t)?-1:t,i=Number.isNaN(e)?-1:e;return{start:n,end:i}}function cb(t){let{start:e,end:n}=t,i={get start(){return aC(e)},get end(){return aC(n)}};return Pn(t)?`t=${i.start}`:e<0&&n>0?Number.isFinite(n)?`t=,${i.end}`:null:e>0&&n>0?`t=${i.start},${i.end}`:null}function aC(t){if(Number.isNaN(t)||t<0)throw new Error("durationInSecond must be positive");if(t===1/0)return"e";let e=fu.moment.duration(t,"seconds"),n=e.hours(),i=e.minutes(),r=e.seconds()+e.milliseconds()/1e3;if(n>0)return[n,...[i,r].map(s=>sC(s))].join(":");if(i>0)return[i,r].map(s=>sC(s)).join(":");if(r>0)return r.toFixed(2);throw new Error("durationInSecond must be positive")}var cC=require("obsidian"),EF=cC.Platform.isWin?require("path/win32"):require("path/posix"),ii=EF;function Ei(t){let e=new URL(t.href),n=mu(e.hash);return e.hash===n?t:e}function dC(t){return t.hostname==="b23.tv"?!1:t.hostname.endsWith(".bilibili.com")&&(t.pathname.startsWith("/video/")||t.pathname.startsWith("/bangumi/play/"))?t.pathname.split("/").filter(Boolean).slice(-1)[0]:null}var pC=t=>dC(t)===null?null:"bilibili",hC=t=>{let e=dC(t);if(e===null)throw new Error("Invalid bilibili url");let n=Bt(t.hash),i=SF(t),r=qn(t);r.searchParams.forEach((o,l,c)=>{l==="p"&&o!=="1"||c.delete(l)}),r.searchParams.sort();let s=r.searchParams.get("p")??"1",a=new URL(r);return!n&&i>0&&(n={start:i,end:-1}),n&&Pn(n)&&(a=uC(a,n)),a=Ei(a),{source:a,cleaned:r,tempFrag:n,print:o=>uC(a,o).href,id:`${s}@${e}`||void 0}};function uC(t,e){let n=new URL(t.href);return n.searchParams.set("t",String(e.start)),n}function SF(t){let e=t.searchParams.get("t"),n=e?Number(e):NaN;return Number.isNaN(n)?NaN:n}var fC=t=>t.hostname==="www.coursera.org"?"coursera":null,mC=t=>{let e=qn(t);e.search="";let n=new URL(t);return{cleaned:e,source:Ei(n),tempFrag:Bt(t.hash)}};var gC=require("obsidian");var vC=t=>({type:"generic",cleaned:qn(t),source:Ei(t.protocol==="file:"?PF(t):t),tempFrag:Bt(t.hash)});function PF(t){let e=new URL(gC.Platform.resourcePathPrefix+t.href.substring(8));return e.search=Date.now().toString(),e}var yC=t=>t.hostname!=="vimeo.com"||!t.pathname.substring(1).match(/^\d+$/)?null:"vimeo",_C=t=>{let e=t.pathname.substring(1);if(!e.match(/^\d+$/))throw new Error("Invalid vimeo url");let n=qn(t);n.search="";let i=new URL(t);return{cleaned:n,source:Ei(i),tempFrag:Bt(t.hash),id:e}};function xC(t){let e=t.pathname.split("/");if(t.hostname==="youtu.be"&&e.length===2)return e[1];if(t.hostname==="www.youtube.com"||t.hostname==="youtube.com"){if(e.length===2&&e[1]==="watch")return t.searchParams.get("v");let n=["shorts","embed","v"];if(e.length===3&&n.includes(e[1]))return e[2]}return null}var kC=t=>xC(t)?"youtube":null,TC=t=>{let e=Bt(t.hash),n=ub(t.searchParams.get("t")),i=ub(t.searchParams.get("start")),r=ub(t.searchParams.get("end")),s=xC(t);if(!s)throw new Error("Invalid youtube url");let a=qn("https://www.youtube.com/watch");a.search=new URLSearchParams({v:s}).toString();let o=new URL(a);return t.searchParams.has("list")&&o.searchParams.set("list",t.searchParams.get("list")),e||(i>0&&r>0?e=lC(i,r):i>0?e={start:i,end:1/0}:r>0?e={start:0,end:r}:n>0&&(e={start:n,end:-1})),e&&(o=wC(o,e)),o=Ei(o),{source:o,cleaned:a,tempFrag:e,print:l=>wC(o,l).href,id:s}};function wC(t,e){let n=new URL(t),i=bC(e.start),r=bC(e.end);return Pn(e)||e.start>0&&e.end>0&&i===r?n.searchParams.set("t",i):(e.start>0&&n.searchParams.set("start",i),e.end>0&&n.searchParams.set("end",r)),n}function bC(t){return t.toFixed(0)}function ub(t){if(!t)return NaN;let e=Number(t);if(!Number.isNaN(e))return e;let n=/^(?:(?<h>\d+)h)?(?:(?<m>\d+)m)?(?:(?<s>\d+)s)?$/,i=t.match(n);if(!i)return NaN;let{h:r,m:s,s:a}=i.groups,o=r?Number(r):0,l=s?Number(s):0,c=a?Number(a):0;return o*3600+l*60+c}var CF=new Set(["https:","http:","file:"]),Si,gu=class gu extends URL{constructor(n,i){super(n);V(this,Si,void 0);_(this,"type");_(this,"mxUrl");if(this.mxUrl=i?new URL(i):null,!CF.has(this.protocol))throw new Error("Unsupported protocol: "+this.protocol);this.type=$F.reduce((r,s)=>r??s(this),null)??"generic",we(this,Si,MF[this.type](this))}static create(n,i){if(n instanceof gu)return n.clone();try{return new gu(n,i)}catch{return null}}get inferredType(){let n=this.pathname.split(".").pop();return n?en(n):null}get isFileUrl(){return this.protocol==="file:"}get filePath(){if(this.isFileUrl)try{return(0,EC.fileURLToPath)(this)}catch(n){return console.error("Failed to convert file url to path",n,this.href),null}return null}getVaultFile(n){if(!(n.adapter instanceof lo.FileSystemAdapter))return null;let i=this.filePath,r=n.adapter.getBasePath();if(!i)return null;let s=ii.relative(r,i);if(/^\.\.[/\\]/.test(s)||ii.isAbsolute(s))return null;let a=(0,lo.normalizePath)(s);return n.getFileByPath(a)}compare(n){return!!n&&this.jsonState.source===n.jsonState.source}print(n){return this.mxUrl?this.mxUrl.href:n?k(this,Si).print?k(this,Si).print(n):this.source.href:this.source.href}get tempFrag(){return Bt(this.hash)}setTempFrag(n){let i=this.clone(),r=mu(this.hash);return n?i.hash=lb(r,n):i.hash=r,i}clone(){return new gu(this,this.mxUrl??void 0)}get readableHref(){return decodeURI(this.href)}get source(){return k(this,Si).source}get cleaned(){return k(this,Si).cleaned}get id(){return k(this,Si).id}get jsonState(){return{source:Ko(this.mxUrl??this.cleaned),hash:lb(this.hash,k(this,Si).tempFrag)}}};Si=new WeakMap;var _t=gu,$F=[pC,kC,yC,fC],MF={bilibili:hC,youtube:TC,vimeo:_C,coursera:mC,generic:vC};function SC(t,{getUrlMapping:e}){if(!t)return null;if(t.protocol!=="mx:")return _t.create(t);let[,,n]=t.pathname.split("/"),i=e(n);return i?_t.create(t.href.replace(`mx://${n}/`,i.replace(/\/*$/,"/")),t):null}function PC(t,e){if(en(t.extension)===null)throw new Error(`Unknown media type ${t.extension}`);let n=e.getResourcePath(t);return new _t("file:///"+n.substring(lo.Platform.resourcePathPrefix.length))}function CC(t){return`webpage::${btoa(t)}`}function $C(t){return atob(t.replace(/^webpage::/,""))}function MC(t){return typeof t=="string"&&t.startsWith("webpage::")}function RC(t){return t.type==="TimeRanges"}var If=class{constructor(e){this.ranges=e}get length(){return this.ranges.length}start(e){return this.ranges[e][0]}end(e){return this.ranges[e][1]}};function ri(t){return RC(t)?new If(t.value):t}var{onDispose:db,peek:RF}=Ts,Af=class{constructor(e,n){this._provider=e;this._ctx=n;_(this,"_disposal",J1());_(this,"_waiting",!1);_(this,"_attachedLoadStart",!1);_(this,"_attachedCanPlay",!1);_(this,"_handlers");_(this,"_handleDevEvent");this._attachInitialListeners(),db(this._media.on("timeupdate",this._onTimeUpdate.bind(this))),db(this._onDispose.bind(this))}get _webview(){return this._provider.webview}get _media(){return this._provider.media}get _notify(){return this._ctx.delegate._notify}_onDispose(){this._attachedLoadStart=!1,this._attachedCanPlay=!1,this._disposal.empty()}_attachInitialListeners(){this._attachEventListener("loadstart",this._onLoadStart),this._attachEventListener("abort",this._onAbort),this._attachEventListener("emptied",this._onEmptied),this._attachEventListener("error",this._onError),this._attachEventListener("volumechange",this._onVolumeChange)}_attachLoadStartListeners(){this._attachedLoadStart||(this._disposal.add(this._attachEventListener("loadeddata",this._onLoadedData),this._attachEventListener("loadedmetadata",this._onLoadedMetadata),this._attachEventListener("canplay",this._onCanPlay),this._attachEventListener("canplaythrough",this._onCanPlayThrough),this._attachEventListener("durationchange",this._onDurationChange),this._attachEventListener("play",this._onPlay),this._attachEventListener("progress",this._onProgress),this._attachEventListener("stalled",this._onStalled),this._attachEventListener("suspend",this._onSuspend)),this._attachedLoadStart=!0)}_attachCanPlayListeners(){this._attachedCanPlay||(this._disposal.add(this._attachEventListener("pause",this._onPause),this._attachEventListener("playing",this._onPlaying),this._attachEventListener("ratechange",this._onRateChange),this._attachEventListener("seeked",this._onSeeked),this._attachEventListener("seeking",this._onSeeking),this._attachEventListener("ended",this._onEnded),this._attachEventListener("waiting",this._onWaiting)),this._attachedCanPlay=!0)}_attachEventListener(e,n){let i=n.bind(this),r=this._media.on(e,i);return db(r)}_onDevEvent(e){}_updateCurrentTime(e,n,i){let r={currentTime:Math.min(e,this._ctx.$state.seekableEnd()),played:n};this._notify("time-update",r,i&&new Event(i.type))}_onLoadStart(e){if(e.payload.networkState===3){this._onAbort(e);return}this._attachLoadStartListeners(),this._notify("load-start",void 0,new Event(e.type))}_onAbort(e){this._notify("abort",void 0,new Event(e.type))}_onEmptied({type:e}){this._notify("emptied",void 0,new Event(e))}_onLoadedData(e){this._notify("loaded-data",void 0,new Event(e.type))}_onLoadedMetadata(e){this._attachCanPlayListeners(),this._notify("loaded-metadata",void 0,new Event(e.type))}_getCanPlayDetail({duration:e,buffered:n,seekable:i}){return{provider:RF(this._ctx.$provider),duration:e,buffered:n,seekable:i}}_onPlay(e){this._ctx.$state.canPlay&&this._notify("play",void 0,new Event(e.type))}_onPause({type:e,payload:n}){n.readyState===1&&!this._waiting||(this._waiting=!1,this._notify("pause",void 0,new Event(e)))}_onCanPlay({type:e,payload:n}){let i=ri(n.buffered),r=ri(n.seekable);this._ctx.delegate._ready(this._getCanPlayDetail({duration:n.duration,buffered:i,seekable:r}),new Event(e))}_onCanPlayThrough({type:e,payload:n}){if(this._ctx.$state.started())return;let i=ri(n.buffered),r=ri(n.seekable);this._notify("can-play-through",this._getCanPlayDetail({duration:n.duration,buffered:i,seekable:r}),new Event(e))}_onPlaying({type:e}){this._waiting=!1,this._notify("playing",void 0,new Event(e))}_onStalled({type:e,payload:n}){this._notify("stalled",void 0,new Event(e)),n.readyState<3&&(this._waiting=!0,this._notify("waiting",void 0,new Event(e)))}_onWaiting({type:e,payload:n}){n.readyState<3&&(this._waiting=!0,this._notify("waiting",void 0,new Event(e)))}_onEnded(e){let{payload:n}=e,i=ri(n.played);this._updateCurrentTime(n.duration,i,e),this._notify("end",void 0,new Event(e.type))}_onTimeUpdate(e){let{payload:n}=e,i=ri(n.played);this._updateCurrentTime(n.current,i,e)}_onDurationChange(e){let{payload:n}=e,i=ri(n.played);this._ctx.$state.ended()&&this._updateCurrentTime(n.duration,i,e),this._notify("duration-change",n.duration,new Event(e.type))}_onVolumeChange({type:e,payload:n}){let i={volume:n.volume,muted:n.muted};this._notify("volume-change",i,new Event(e))}_onSeeked(e){let{payload:n}=e,i=ri(n.played);this._updateCurrentTime(n.current,i,e),this._notify("seeked",n.current,new Event(e.type))}_onSeeking({type:e,payload:n}){this._notify("seeking",n.current,new Event(e))}_onProgress({type:e,payload:n}){let i={buffered:ri(n.buffered),seekable:ri(n.seekable)};this._notify("progress",i,new Event(e))}_onSuspend({type:e}){this._notify("suspend",void 0,new Event(e))}_onRateChange({type:e,payload:n}){this._notify("rate-change",n.rate,new Event(e))}_onError({type:e,payload:n}){let i={message:n.message,code:n.code};this._notify("error",i,new ErrorEvent(e,{error:n}))}};async function LC(t,e){return await e.executeJavaScript(`(async function(){${t}})()`)}function IC(t){switch(t.code){case-202:return"SSL certificate isn't trusted by the browser. If the website is self-hosted, double check the SSL certificate and test it with a browser. ";default:return t.message}}var vu=class extends Error{constructor(n){super(`${n.errorCode}: ${n.errorDescription}`);_(this,"code");_(this,"description");_(this,"url");this.code=n.errorCode,this.url=n.validatedURL,this.description=n.errorDescription}};var{onDispose:AC}=Ts,yu,Nf=class{constructor(e,n,i){this._video=e;this._media=n;this.userGesture=i;V(this,yu,!1);_(this,"_onChange",(e,n)=>{this._media.delegate._notify("picture-in-picture-change",e,n)});AC(e.on("enterpictureinpicture",r=>this._onChange(!0,new Event(r.type)))),AC(e.on("leavepictureinpicture",r=>this._onChange(!1,new Event(r.type))))}async updateActive(){let e=await this._video.methods.pictureInPictureEnabled();return we(this,yu,e),e}get active(){return this.updateActive(),k(this,yu)}get supported(){return!!document.pictureInPictureEnabled}async enter(){await this.userGesture(),await this._video.methods.requestPictureInPicture()}async exit(){await this._video.methods.exitPictureInPicture()}};yu=new WeakMap;var{createScope:LF,onDispose:Df,scoped:IF}=Ts,co,Nn=class{constructor(e,n){this._webview=e;this._ctx=n;_(this,"scope",LF());_(this,"$$PROVIDER_TYPE","WEBVIEW");_(this,"_currentSrc",null);_(this,"_port",new Np);_(this,"pictureInPicture");V(this,co,null);_(this,"onDomReady",async e=>{let n=this._webview;new Af(this,this._ctx),this._updateTitle(e),await LC(O1,n),await this.loadPlugin(this.currentWebHost)});IF(()=>{this.pictureInPicture=new Nf(this._port,n,()=>this.userGesture(!0))},this.scope)}setup(){Df(()=>{this._webview.src=""}),AF(),this.type==="webview"&&this._ctx.delegate._notify("provider-setup",this),this.registerTitleChange(),Df(()=>{this._webview.removeEventListener("dom-ready",this.onDomReady)}),Df(this._port.on("mx-open-browser",({payload:{url:e,message:n=""}})=>{DC({message:n+`Open ${e} in login browser?`,cancelText:"No",onConfirm:()=>{let i=new cr(app);i.open(),i.setUrl(e)}})}))}get type(){return"webview"}get webview(){return this._webview}get media(){return this._port}get currentSrc(){return this._currentSrc}get currentWebHost(){return this._currentSrc?.host??"generic"}setPlaybackRate(e){this._port.methods.setPlaybackRate(e)}async userGesture(e=!1){if(!e&&k(this,co)){await k(this,co);return}await we(this,co,this.webview.executeJavaScript("1",!0))}async play(){this.webview.isConnected&&(await this.userGesture(),await this._port.methods.play())}async pause(){this.webview.isConnected&&(await this.userGesture(),await this._port.methods.pause())}setMuted(e){this._port.methods.setMuted(e)}setVolume(e){this._port.methods.setVolume(e)}setCurrentTime(e){this._port.methods.setCurrentTime(e)}get _notify(){return this._ctx.delegate._notify}async _updateTitle(e,n){let i=e=typeof e=="string"?new Event(e):e,r=n??this._webview.getTitle(),s=rC[this.currentWebHost](r),a=this._ctx.$state.title();s!==a&&this._notify("title-change",s,i)}loadPlugin(e){return new Promise((n,i)=>{let r=this._webview,s=this.media.onReady(async()=>{window.clearTimeout(a),await this.media.methods.loadPlugin(iC[e]),n()},{once:!0}),a=setTimeout(()=>{s(),i(new Hi(5e3))},5e3),{port1:o,port2:l}=new MessageChannel;this._port.load(o),r.contentWindow.postMessage(Dx,"*",[l])})}handlePlayReady(){let e=new Promise((a,o)=>{let l=()=>{this.webview.removeEventListener("did-stop-loading",c),this.webview.removeEventListener("did-finish-load",c),this.webview.removeEventListener("did-fail-load",u)},c=()=>{a(),l()},u=d=>{o(new vu(d)),l()};this.webview.addEventListener("did-stop-loading",c),this.webview.addEventListener("did-finish-load",c),this.webview.addEventListener("did-fail-load",u)}),n,i=a=>new Promise((o,l)=>{n=window.setTimeout(()=>l(new Hi(a)),a)}),r=new Promise(a=>{this._port.once("mx-play-ready",()=>{a(),window.clearTimeout(n)})}),s=1e4;e.then(()=>Promise.race([r,i(s)])).then(()=>{this.togglePlayReady(!0)}).catch(a=>{if(a instanceof Hi)NF(s);else if(a instanceof vu){let o=IC(a);new jr.Notice(createFragment(l=>{l.appendText(`Failed to load webpage: ${o}`),l.createEl("p",{text:"Click to copy "},c=>c.createEl("a",{href:a.url,text:a.url.length>50?`${a.url.substring(0,50)}...`:a.url},u=>{u.addEventListener("click",d=>{d.preventDefault(),navigator.clipboard.writeText(a.url),new jr.Notice("URL copied to clipboard.")})}))}))}else throw a}).finally(()=>{this.togglePlayReady(!0)})}registerTitleChange(){let e=this._webview,n=i=>{this._updateTitle(i,i.title)};e.addEventListener("page-title-updated",n),Df(()=>{e.removeEventListener("page-title-updated",n)})}togglePlayReady(e){typeof e>"u"&&(e=!("playReady"in this._webview.dataset)),e?this._webview.dataset.playReady="":delete this._webview.dataset.playReady}untilPluginReady(){let e=this._webview;return this.togglePlayReady(!1),e.removeEventListener("dom-ready",this.onDomReady),this.handlePlayReady(),new Promise((n,i)=>{let r=s=>{this.onDomReady(s).then(n).catch(i),e.removeEventListener("dom-ready",r),e.addEventListener("dom-ready",this.onDomReady)};e.addEventListener("dom-ready",r)})}async loadSource({src:e,type:n}){if(!hu(e))throw new Error("Webview provider only supports string src.");let i=_t.create($C(e)),r=this._webview;if(this._currentSrc={src:i?.source.href??"",type:n,host:i?.type??"generic"},!i){r.src="";return}let s=!r.src||Ko(i.source)!==Ko(r.src);r.src=i.href,s&&await this.untilPluginReady()}};co=new WeakMap;function AF(){let t="mx:webview-login-notified";localStorage.getItem(t)||(new jr.Notice(createFragment(n=>{n.appendText("You're using a webpage media player."),n.createEl("p",{text:"If you are requested to login, you can open a browser to login from:"},i=>{i.createEl("br"),i.appendText('- the "Login" command'),i.createEl("br"),i.appendText("- the entry in settings tab")}),n.appendText("Click to dismiss this notice.")}),0),localStorage.setItem(t,"1"))}function NF(t){let e="mx:webview-timeout-ignore";if(localStorage.getItem(e))return;let i=(t/1e3).toFixed(1);DC({message:`Webpage not fully loaded within ${i}s. You can still try to play.`,onCancel(){console.log("ignore webview timeout notice"),localStorage.setItem(e,"1")},cancelText:"Don't show again",timeout:5e3})}function DC({message:t,cancelText:e="Ignore",confirmText:n="OK",onConfirm:i,onCancel:r,timeout:s}){let a=new jr.Notice(createFragment(o=>{o.createDiv({text:t}),o.createDiv({},l=>{l.style.display="flex",l.style.justifyContent="flex-end",l.style.gap="1em",l.style.marginTop="1em";let c=new jr.ButtonComponent(l).setButtonText(n);i&&c.onClick(async()=>{await i(),a.hide()});let u=new jr.ButtonComponent(l).setButtonText(e);r&&u.onClick(async()=>{await r(),a.hide()})})}),s);return a}var Uf=require("fs/promises"),wu=require("obsidian");function Of(t,e){let n=new Map;for(let i of t){let r=e(i),s=n.get(r);s?s.push(i):n.set(r,[i])}return n}var zf=$(pb());var hb={"de-AT":"\xD6sterreichisches Deutsch","de-CH":"Schweizer Hochdeutsch","en-AU":"Australian English","en-CA":"Canadian English","en-GB":"British English","en-US":"American English","es-ES":"espa\xF1ol de Espa\xF1a","es-MX":"espa\xF1ol de M\xE9xico","fr-CA":"fran\xE7ais canadien","fr-CH":"fran\xE7ais suisse","nl-BE":"Vlaams","pt-BR":"portugu\xEAs do Brasil","pt-PT":"portugu\xEAs europeu","ro-MD":"moldoveneasc\u0103","zh-Hans":"\u7B80\u4F53\u4E2D\u6587","zh-Hant":"\u7E41\u9AD4\u4E2D\u6587"},BC=()=>Of(Object.entries(hb),([t])=>t.split("-")[0]),qC={"zh-Hans":["CN","SG","MY"],"zh-Hant":["TW","HK","MO"]};function WC(t){let e=t.split("-"),n=e[0].toLowerCase();if(e.length===1)return zf.default.getNativeName(n);let i=e.slice(0,2).join("-");return hb[i]||`${zf.default.getNativeName(e[0])} (${t})`}function OF(t){return t.toLowerCase()==="hans"||qC["zh-Hans"].includes(t.toUpperCase())?"zh-Hans":t.toLowerCase()==="hant"||qC["zh-Hant"].includes(t.toUpperCase())?"zh-Hant":"zh"}function fb(t){if(!t)return!1;let e=t.split("-")[0].toLowerCase();return zf.default.validate(e)}function KC(t){if(!fb(t))return null;let e=t.split("-"),n=e[0].toLowerCase();if(e.length===1)return n;let i=e[1];return n==="zh"?OF(i):hb[`${n}-${i.toUpperCase()}`]??`${n}-${e.slice(1).join("-")}`}var GC=["vtt","ass","ssa","srt"];function VF(t){return GC.includes(t.extension)}function YC(t,e,n){console.debug("Search subtitles for media",{basename:t.basename,path:t.path,defaultLangCode:n}),console.debug(`${e.length} siblings`,e);let i=e.filter(VF).flatMap(l=>{let c=FF(l,t.basename);return c?[c]:[]});if(i.length===0)return console.debug("No subtitles found"),i;console.debug(`Found ${i.length} subtitles: `,i.map(l=>l.src.path)),console.debug("Subtitles details: ",i);let r=Of(i,l=>l.language),s=[...r.keys()],a=n?s.find(l=>{if(l)return l===n})??s.find(l=>{if(!l)return;let c=l.split("-")[0],u=n.split("-")[0];return c===u}):s.filter(l=>!!l)[0],o=[];return r.forEach((l,c)=>{for(let u of GC){let d=l.find(p=>p.type===u);if(d){o.push({...d,default:!!a&&c===a});return}}}),console.debug(`Final tracks: ${o.length}`,o.map(l=>l.src.path)),console.debug("Final tracks details",o),o.length===0||(console.debug(`Final default lang: ${a??o[0].id}`),a||(o[0].default=!0)),o}async function jf(t,e){let n=t.filePath;if(!n||!t.inferredType)return[];let i=ii.basename(n),r=i.split(".").slice(0,-1).join("."),s=ii.dirname(n),a=(await(0,Uf.readdir)(s,{encoding:"utf-8",withFileTypes:!0}).catch(l=>{let c=l;return c.code!=="ENOENT"&&new wu.Notice(`Failed to read directory ${s}: ${c.message}`),[]})).filter(l=>l.name!==i&&(l.isFile()||l.isSymbolicLink())).map(l=>{let c=l.name.split(".");return c.length===1?{extension:"",basename:l.name,path:ii.join(s,l.name)}:{extension:c.at(-1),basename:c.slice(0,-1).join("."),path:ii.join(s,l.name)}}),o=YC({basename:r,path:n},a,e);return(await Promise.all(o.map(async({src:l,...c})=>{let u=await(0,Uf.readFile)(l.path,"utf-8").catch(d=>{let p=d;return p.code!=="ENOENT"&&new wu.Notice(`Failed to read subtitle file ${l.path}: ${p.message}`),""});return u?{...c,content:u}:null}))).filter(l=>!!l)}async function QC(t,e,n){if(!t.parent)return[];let i=YC(t,t.parent.children.filter(r=>r instanceof wu.TFile),n);return await Promise.all(i.map(async({src:r,...s})=>({...s,content:await e.cachedRead(r)})))}function FF(t,e){if(!t.basename.startsWith(e))return null;let n=t.basename.substring(e.length),i;if(!n)i=null;else if(i=KC(n.replace(/^\./,"")),!i)return null;let r=i?WC(i):"Unknown";return{kind:"subtitles",language:i??void 0,id:`${t.basename}.${t.extension}.${i??"unknown"}`,src:t,type:t.extension,label:`${r} (${t.extension})`,default:!1}}var XC={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(XC);var ZC=XC;var JC={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(JC);var e$=JC;var Dn=function(t,e,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(t):i?i.value:e.get(t)},uo,bu,Us,mb=class{constructor(...e){uo.set(this,new Map),bu.set(this,new Map),Us.set(this,new Map);for(let n of e)this.define(n)}define(e,n=!1){for(let[i,r]of Object.entries(e)){i=i.toLowerCase(),r=r.map(o=>o.toLowerCase()),Dn(this,Us,"f").has(i)||Dn(this,Us,"f").set(i,new Set);let s=Dn(this,Us,"f").get(i),a=!0;for(let o of r){let l=o.startsWith("*");if(o=l?o.slice(1):o,s?.add(o),a&&Dn(this,bu,"f").set(i,o),a=!1,l)continue;let c=Dn(this,uo,"f").get(o);if(c&&c!=i&&!n)throw new Error(`"${i} -> ${o}" conflicts with "${c} -> ${o}". Pass \`force=true\` to override this definition.`);Dn(this,uo,"f").set(o,i)}}return this}getType(e){if(typeof e!="string")return null;let n=e.replace(/^.*[/\\]/,"").toLowerCase(),i=n.replace(/^.*\./,"").toLowerCase(),r=n.length<e.length;return!(i.length<n.length-1)&&r?null:Dn(this,uo,"f").get(i)??null}getExtension(e){return typeof e!="string"?null:(e=e?.split?.(";")[0],(e&&Dn(this,bu,"f").get(e.trim().toLowerCase()))??null)}getAllExtensions(e){return typeof e!="string"?null:Dn(this,Us,"f").get(e.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let e of Dn(this,Us,"f").values())Object.freeze(e);return this}_getTestState(){return{types:Dn(this,uo,"f"),extensions:Dn(this,bu,"f")}}};uo=new WeakMap,bu=new WeakMap,Us=new WeakMap;var gb=mb;var vb=new gb(e$,ZC)._freeze();var Ke=require("obsidian");var xu=require("obsidian");async function t$(t,e,n){let i=document.createElement("canvas"),{videoWidth:r,videoHeight:s}=t;if(!r||!s)throw new Error("Cannot screenshot video without width or height");Object.assign(i,{width:r,height:s});let a=i.getContext("2d",{alpha:!1});if(!a)throw new Error("Canvas context creation failed");a.drawImage(t,0,0,r,s);let o=await new Promise((c,u)=>{try{i.toBlob(d=>{d?c(d):u(new Error("Canvas to blob failed"))},e,n)}catch(d){u(d)}}),l=await o.arrayBuffer();return{time:t.currentTime,blob:{arrayBuffer:l,type:o.type}}}function js(t){return ro(t)||t instanceof Nn}async function ku(t,e,n){let i=xu.Platform.isSafari&&e==="image/webp"?"image/jpeg":e;try{if(ro(t))return await t$(t.video,i,n);if(t instanceof Nn)return await t.media.methods.screenshot(i,n);throw new Error("Unsupported provider for screenshot")}catch(r){throw r instanceof DOMException&&r.name==="SecurityError"?new xu.Notice("Cannot take screenshot due to CORS restriction, you can try open media as webpage to bypass this"):new xu.Notice("Cannot take screenshot: "+(r instanceof Error?r.message:String(r))),r}}var n$=require("obsidian");function Hf({timestamp:t,screenshot:e},{template:n,editor:i,insertBefore:r}){console.debug("insert timestamp",{timestamp:t,screenshot:e,template:n});let s=n.replace("{{TIMESTAMP}}",t);e&&(s=s.replace("{{SCREENSHOT}}",e)),console.debug("content to insert",s);try{console.debug(`inserting timestamp ${r?"before":"after"} cursor`),r?UF(s,i):zF(s,i)}catch(a){new n$.Notice("Failed to insert timestamp, see console for details"),console.error("Failed to insert timestamp",a)}}function zF(t,e){let n=e.getCursor("to");console.debug("insert to cursor [to]",n.ch,n.line),e.replaceRange(t,n,n),e.setCursor(e.offsetToPos(e.posToOffset(n)+t.length))}function UF(t,e){let n=e.getCursor("from");console.debug("insert before cursor [from]",n.ch,n.line),e.replaceRange(t,n,n)}function i$(t){return t.file.basename}function r$({source:t},e){return e.title??t.hostname+decodeURI(t.pathname).replaceAll("/","_")}function s$(t,e){return Li(t)?i$(t):r$(t,e)}function po(t,e){let{metadataCache:n}=e.plugin.app,i=e.store.getState().player;if(!i)throw new Error("Player not initialized");if(Li(t)){let{file:r,type:s}=t;return e.plugin.leafOpener.openNote(t,{title:i$(t),fm:a=>({[s]:`[[${n.fileToLinktext(r,a)}]]`}),sourcePath:r.path})}else return e.plugin.leafOpener.openNote(t,{title:r$(t,i.state),fm:()=>({media:t.jsonState.source})})}function qf(t,e,{app:{fileManager:n},settings:{timestampOffset:i},state:{duration:r}}){t+=i,t<0&&(t=0),r&&t>r&&(t=r);let s=Lf(t),a=t>0?{start:t,end:-1}:void 0,o=a?`#${cb(a)}`:"";if(Li(e)){let{file:l}=e;return c=>n.generateMarkdownLink(l,c,o,s).replace(/^!/,"")}else{let l=e.print(a);return()=>`[${s}](${l}${o})`}}function Bf(t){let e=t.store.getState().player;if(!e)return new Ke.Notice("Player not initialized"),!1;let n=t.getMediaInfo();return n?!e?.provider||!js(e.provider)?(new Ke.Notice("Screenshot is not supported for this media"),!1):{media:n,provider:e.provider,state:e.state,app:t.plugin.app,settings:t.plugin.settings.getState()}:(new Ke.Notice("No media is opened"),!1)}async function Tu(t,{file:e,editor:n}){let i=Bf(t);if(!i)return!1;let{provider:r,state:s,media:a,app:{fileManager:o,vault:l},settings:{insertBefore:c,screenshotTemplate:u,screenshotEmbedTemplate:d,screenshotQuality:p,screenshotFormat:h,screenshotFolderPath:y}}=i,{blob:v,time:w}=await ku(r,h,p),m=qf(w,a,i),f=vb.getExtension(v.type);if(!f)return new Ke.Notice("Unknown mime type: "+v.type),!1;let g=s$(a,s),x=sd(g)+oC(w),E=w>0?` - ${Lf(w)}`:"",L,R=`${x}.${f}`;if(y===void 0){let A=`${Date.now()}.${Math.random().toString(36).substring(2)}.${f}`,oe=(await o.getAvailablePathForAttachment(A,e.path)).replace(A,"");L=(0,Ke.normalizePath)(`${oe}/${R}`)}else{let A=l.getAbstractFileByPath(y);if(A===null)A=await l.createFolder(y).catch(oe=>{throw new Ke.Notice(`Failed to create screenshot folder ${y}: ${oe instanceof Error?oe.message:oe}`),oe});else if(!(A instanceof Ke.TFolder))return new Ke.Notice(`Screenshot folder occupied, check your preferences: ${A.path}`),!1;L=`${A.path}/${R}`}let I=!1,z=l.getAbstractFileByPath(L);if(z instanceof Ke.TFile)await l.modifyBinary(z,v.arrayBuffer).catch(A=>{throw new Ke.Notice(`Failed to save screenshot to ${z}: ${A instanceof Error?A.message:A}`),A});else if(z===null)I=!0,z=await l.createBinary(L,v.arrayBuffer).catch(A=>{throw new Ke.Notice(`Failed to create screenshot in ${z}: ${A instanceof Error?A.message:A}`),A});else return new Ke.Notice(`Screenshot file occupied by a folder: ${z.path}`),!1;new Ke.Notice(`Screenshot ${I?"created in":"save to"} ${z.path}`);try{return Hf({timestamp:m(e.path),screenshot:o.generateMarkdownLink(z,e.path,"",d.replaceAll("{{TITLE}}",g).replaceAll("{{DURATION}}",E)).replace(/^!/,"")},{editor:n,template:u,insertBefore:c}),!0}catch(A){return new Ke.Notice("Failed to insert screenshot, see console for details"),console.error("Failed to insert screenshot",A),!1}}async function Eu(t){let{provider:e}=t,{blob:{arrayBuffer:n,type:i}}=await ku(e,"image/png",void 0),r;try{r=new ClipboardItem({[i]:new Blob([n],{type:i})})}catch(s){return new Ke.Notice("Failed to copy screenshot, see console for details"),console.error("Failed to copy screenshot",s),!1}await navigator.clipboard.write([r]),new Ke.Notice("Screenshot copied to clipboard")}var Su=require("obsidian");async function Pu(t,{file:e,editor:n}){let i=t.store.getState().player;if(!i)return new Su.Notice("Player not initialized"),!1;let r=t.getMediaInfo();if(!r)return new Su.Notice("No media is opened"),!1;let s=i.currentTime,a=qf(s,r,{app:t.plugin.app,settings:t.plugin.settings.getState(),state:i.state});if(s<=0)return new Su.Notice("Playback not started yet"),!1;let{insertBefore:o,timestampTemplate:l}=t.plugin.settings.getState();try{return Hf({timestamp:a(e.path)},{editor:n,template:l,insertBefore:o}),!0}catch(c){return new Su.Notice("Failed to insert timestamp, see console for details"),console.error("Failed to insert timestamp",c),!1}}var a$=require("obsidian");function yb(t){let e="mx:media-notetaking-notified";localStorage.getItem(e)||(new a$.Notice(createFragment(i=>{i.appendText(`You are taking ${t} from media player. By default, they will only be saved in the media note. `),i.createEl("p",{text:`To take ${t} or control playback from abritrary note, use command when focused on the note`}),i.createEl("p",{text:"PS: you can assign a hotkey to each command in the settings"}),i.appendText("Click to dismiss this notice.")}),0),localStorage.setItem(e,"1"))}function Wf(t){let e=Bn(t);if(!e)return"";let{pathname:n}=e;if(!n)return"";let i=n.split("/").pop();return i?decodeURI(i.split(".").slice(0,-1).join(".")):""}function Kf(t){t.addAction("star","Take timestamp in media note",()=>{let n=t.getMediaInfo();n&&(yb("timestamp"),po(n,t).then(i=>{Pu(t,i)}))});let e=t.getViewType();qx.has(e)&&t.addAction("camera","Take screenshot in media",()=>{let n=t.getMediaInfo();n&&(yb("screenshot"),po(n,t).then(i=>Tu(t,i)))})}function Gf(t,e,n){let{player:i,source:r,toggleControls:s,controls:a,setTransform:o,transform:l,toggleWebFullscreen:c,disableWebFullscreen:u}=t.store.getState();!i||!r||t.plugin.app.workspace.trigger("mx-media-menu",e,{source:r.url,viewType:r.viewType,player:i,toggleControls:s,controls:a,setTransform:o,transform:l,plugin:t.plugin,disableWebFullscreen:u,toggleWebFullscreen:c,reload:()=>t.render()},n,t.leaf)}var _b=new WeakSet;function o$(t){t.subscribe((e,n)=>{e.player!==n.player&&Cu(e)}),t.subscribe((e,n)=>{let i=e.player;if(!i)return;let r=e.source,s=n.source;if(r===s)return;let a=r?.url,o=s?.url;a!==o&&(!a&&o!==void 0||a!==void 0&&!a.compare(o))&&_b.delete(i)})}async function Cu({player:t,hash:{tempFragment:e}}){if(!t||!e)return;let n=!_b.has(t);_b.add(t);let i=null,r=.25;if(Pn(e)||t.currentTime<e.start||Math.abs(t.currentTime-e.end)<r?i=e.start:t.currentTime-r>e.end&&(i=e.end),i!==null){let s=i;t.currentTime=s,!t.state.canPlay&&["video/youtube"].includes(t.state.source.type)&&!t.state.autoPlay&&(await jF(t,"seeked"),await t.pause())}Pn(e)&&t.state.canPlay&&!n&&await t.play(new Event("hashchange"))}function jF(t,e){return new Promise(n=>{let i=window.setTimeout(()=>{n(),r()},5e3),r=t.listen(e,()=>{n(),window.clearTimeout(i),r()})})}function Hr(){let t=$p((e,n,i)=>({player:null,playerRef:r=>e({player:r}),source:void 0,hash:{autoplay:void 0,controls:void 0,loop:void 0,muted:void 0,tempFragment:null,volume:void 0},async getPlayer(r=1e4){let{player:s}=n();return s||new Promise((a,o)=>{let l=i.subscribe(({player:u})=>{u&&(l(),a(u),window.clearTimeout(c))}),c=window.setTimeout(()=>{l(),o(new Hi(r))},r)})},setSource(r,{hash:s,viewType:a,title:o,textTracks:l}){e(c=>({source:{...c.source,viewType:a,url:r},textTracks:l??c.textTracks,hash:{...c.hash,...Lp(s||r.hash)},title:(o===!0?Wf(r.source.href):o)??c.title})),Cu(n())},setHash(r){e(s=>({hash:{...s.hash,...Lp(r)}})),Cu(n())},async loadFile(r,{vault:s,subpath:a,defaultLang:o}){let l=await QC(r,s,o),c=PC(r,s);if(!c.inferredType)throw new Error("Unsupported media type");let u=Ft[c.inferredType];e(({source:d,hash:p})=>({source:{...d,url:c,viewType:u},textTracks:l,title:r.name,hash:a?{...p,...Lp(a)}:p})),await Cu(n())},title:"",transform:null,setTransform:r=>{e(r?s=>{let a={transform:{...s.transform,...r}};return a.transform.flipHorizontal&&a.transform.flipVertical&&a.transform.rotate==="180"&&(a.transform={...a.transform,flipHorizontal:!1,flipVertical:!1,rotate:void 0}),a}:{transform:null})},toggleControls(r){let{player:s}=n();e({controls:r}),s&&s.provider instanceof Nn&&s.provider.media.send("mx-toggle-controls",!r)},toggleWebFullscreen(r){let{player:s}=n();e({disableWebFullscreen:!r}),s&&s.provider instanceof Nn&&s.provider.media.send("mx-toggle-webfs",r)},textTracks:[],updateWebHost:r=>e({webHost:r==="generic"?void 0:r})}));return o$(t),t}var wt=(0,si.createContext)(null);function bt(t){let{store:e}=(0,si.useContext)(wt);return Fy(e,t)}function Hs(t){let{plugin:{settings:e}}=(0,si.useContext)(wt);return Fy(e,t)}function Yf(){let{store:t}=(0,si.useContext)(wt);return t}function l$(){return(0,si.useContext)(wt).reload}function Qf(t){let e=(0,si.useContext)(wt).plugin.app;return t?t(e):e}function c$(){return(0,si.useContext)(wt).plugin}function u$(){return(0,si.useContext)(wt).onScreenshot}var ho=()=>(0,si.useContext)(wt).embed;function $u(t,e){let n=ql,i=[()=>n(),t.subscribe((r,s)=>{if(r.player===s.player||(n(),!r.player))return;let a=e(r.player);a?Array.isArray(a)?n=()=>a.forEach(o=>o()):n=a:n=ql})];return()=>i.forEach(r=>r())}var Db=require("obsidian"),FM=$(j());var d$=$(j());function p$(){let t=Ti(),e=Yf();(0,d$.useEffect)(()=>{if(t)return HF(t,e)},[t,e])}function HF(t,e){let n={currentTime:t.state.currentTime,paused:t.state.paused,loop:t.state.loop},i=!1,r=[t.subscribe(({currentTime:s,paused:a,loop:o})=>{let l=qF(e.getState().hash.tempFragment,t.state.duration);if(!l||Pn(l))return;let{start:c,end:u}=l;if(n.paused!==a&&!a)(s>u||s<c)&&(i=!0,t.currentTime=c);else if(n.currentTime!==s){if(s<c)t.currentTime=c;else if(s>u)if(o)t.currentTime=c,a&&t.play();else{if(i){i=!1;return}a||t.pause()}}Object.assign(n,{currentTime:s,paused:a,loop:o})})];return()=>r.forEach(s=>s())}function qF(t,e){if(!t)return null;if(Pn(t))return t;let{start:n,end:i}=t;return e&&e<n?null:{start:n<0?0:n,end:i<0?1/0:i}}function h$(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=h$(t[e]))&&(i&&(i+=" "),i+=n);else for(e in t)t[e]&&(i&&(i+=" "),i+=e);return i}function f$(){for(var t,e,n=0,i="";n<arguments.length;)(t=arguments[n++])&&(e=h$(t))&&(i&&(i+=" "),i+=e);return i}var bb="-";function BF(t){let e=KF(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;function r(a){let o=a.split(bb);return o[0]===""&&o.length!==1&&o.shift(),v$(o,e)||WF(a)}function s(a,o){let l=n[a]||[];return o&&i[a]?[...l,...i[a]]:l}return{getClassGroupId:r,getConflictingClassGroupIds:s}}function v$(t,e){if(t.length===0)return e.classGroupId;let n=t[0],i=e.nextPart.get(n),r=i?v$(t.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;let s=t.join(bb);return e.validators.find(({validator:a})=>a(s))?.classGroupId}var m$=/^\[(.+)\]$/;function WF(t){if(m$.test(t)){let e=m$.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function KF(t){let{theme:e,prefix:n}=t,i={nextPart:new Map,validators:[]};return YF(Object.entries(t.classGroups),n).forEach(([s,a])=>{wb(a,i,s,e)}),i}function wb(t,e,n,i){t.forEach(r=>{if(typeof r=="string"){let s=r===""?e:g$(e,r);s.classGroupId=n;return}if(typeof r=="function"){if(GF(r)){wb(r(i),e,n,i);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,a])=>{wb(a,g$(e,s),n,i)})})}function g$(t,e){let n=t;return e.split(bb).forEach(i=>{n.nextPart.has(i)||n.nextPart.set(i,{nextPart:new Map,validators:[]}),n=n.nextPart.get(i)}),n}function GF(t){return t.isThemeGetter}function YF(t,e){return e?t.map(([n,i])=>{let r=i.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,o])=>[e+a,o])):s);return[n,r]}):t}function QF(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,i=new Map;function r(s,a){n.set(s,a),e++,e>t&&(e=0,i=n,n=new Map)}return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=i.get(s))!==void 0)return r(s,a),a},set(s,a){n.has(s)?n.set(s,a):r(s,a)}}}var y$="!";function XF(t){let e=t.separator,n=e.length===1,i=e[0],r=e.length;return function(a){let o=[],l=0,c=0,u;for(let v=0;v<a.length;v++){let w=a[v];if(l===0){if(w===i&&(n||a.slice(v,v+r)===e)){o.push(a.slice(c,v)),c=v+r;continue}if(w==="/"){u=v;continue}}w==="["?l++:w==="]"&&l--}let d=o.length===0?a:a.substring(c),p=d.startsWith(y$),h=p?d.substring(1):d,y=u&&u>c?u-c:void 0;return{modifiers:o,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:y}}}function ZF(t){if(t.length<=1)return t;let e=[],n=[];return t.forEach(i=>{i[0]==="["?(e.push(...n.sort(),i),n=[]):n.push(i)}),e.push(...n.sort()),e}function JF(t){return{cache:QF(t.cacheSize),splitModifiers:XF(t),...BF(t)}}var e5=/\s+/;function t5(t,e){let{splitModifiers:n,getClassGroupId:i,getConflictingClassGroupIds:r}=e,s=new Set;return t.trim().split(e5).map(a=>{let{modifiers:o,hasImportantModifier:l,baseClassName:c,maybePostfixModifierPosition:u}=n(a),d=i(u?c.substring(0,u):c),p=!!u;if(!d){if(!u)return{isTailwindClass:!1,originalClassName:a};if(d=i(c),!d)return{isTailwindClass:!1,originalClassName:a};p=!1}let h=ZF(o).join(":");return{isTailwindClass:!0,modifierId:l?h+y$:h,classGroupId:d,originalClassName:a,hasPostfixModifier:p}}).reverse().filter(a=>{if(!a.isTailwindClass)return!0;let{modifierId:o,classGroupId:l,hasPostfixModifier:c}=a,u=o+l;return s.has(u)?!1:(s.add(u),r(l,c).forEach(d=>s.add(o+d)),!0)}).reverse().map(a=>a.originalClassName).join(" ")}function n5(){let t=0,e,n,i="";for(;t<arguments.length;)(e=arguments[t++])&&(n=_$(e))&&(i&&(i+=" "),i+=n);return i}function _$(t){if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=_$(t[i]))&&(n&&(n+=" "),n+=e);return n}function i5(t,...e){let n,i,r,s=a;function a(l){let c=e.reduce((u,d)=>d(u),t());return n=JF(c),i=n.cache.get,r=n.cache.set,s=o,o(l)}function o(l){let c=i(l);if(c)return c;let u=t5(l,n);return r(l,u),u}return function(){return s(n5.apply(null,arguments))}}function Ee(t){let e=n=>n[t]||[];return e.isThemeGetter=!0,e}var w$=/^\[(?:([a-z-]+):)?(.+)\]$/i,r5=/^\d+\/\d+$/,s5=new Set(["px","full","screen"]),a5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,o5=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,l5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,c5=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,u5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function rr(t){return qs(t)||s5.has(t)||r5.test(t)}function qr(t){return fo(t,"length",y5)}function qs(t){return!!t&&!Number.isNaN(Number(t))}function Xf(t){return fo(t,"number",qs)}function Mu(t){return!!t&&Number.isInteger(Number(t))}function d5(t){return t.endsWith("%")&&qs(t.slice(0,-1))}function Q(t){return w$.test(t)}function Br(t){return a5.test(t)}var p5=new Set(["length","size","percentage"]);function h5(t){return fo(t,p5,b$)}function f5(t){return fo(t,"position",b$)}var m5=new Set(["image","url"]);function g5(t){return fo(t,m5,w5)}function v5(t){return fo(t,"",_5)}function Ru(){return!0}function fo(t,e,n){let i=w$.exec(t);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):n(i[2]):!1}function y5(t){return o5.test(t)&&!l5.test(t)}function b$(){return!1}function _5(t){return c5.test(t)}function w5(t){return u5.test(t)}function b5(){let t=Ee("colors"),e=Ee("spacing"),n=Ee("blur"),i=Ee("brightness"),r=Ee("borderColor"),s=Ee("borderRadius"),a=Ee("borderSpacing"),o=Ee("borderWidth"),l=Ee("contrast"),c=Ee("grayscale"),u=Ee("hueRotate"),d=Ee("invert"),p=Ee("gap"),h=Ee("gradientColorStops"),y=Ee("gradientColorStopPositions"),v=Ee("inset"),w=Ee("margin"),m=Ee("opacity"),f=Ee("padding"),g=Ee("saturate"),x=Ee("scale"),E=Ee("sepia"),L=Ee("skew"),R=Ee("space"),I=Ee("translate"),z=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto",Q,e],ee=()=>[Q,e],or=()=>["",rr,qr],Ce=()=>["auto",qs,Q],xt=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Mi=()=>["solid","dashed","dotted","double","none"],Bo=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],is=()=>["start","end","center","between","around","evenly","stretch"],jn=()=>["","0",Q],Ri=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Jt=()=>[qs,Xf],rs=()=>[qs,Q];return{cacheSize:500,separator:":",theme:{colors:[Ru],spacing:[rr,qr],blur:["none","",Br,Q],brightness:Jt(),borderColor:[t],borderRadius:["none","","full",Br,Q],borderSpacing:ee(),borderWidth:or(),contrast:Jt(),grayscale:jn(),hueRotate:rs(),invert:jn(),gap:ee(),gradientColorStops:[t],gradientColorStopPositions:[d5,qr],inset:oe(),margin:oe(),opacity:Jt(),padding:ee(),saturate:Jt(),scale:Jt(),sepia:jn(),skew:rs(),space:ee(),translate:ee()},classGroups:{aspect:[{aspect:["auto","square","video",Q]}],container:["container"],columns:[{columns:[Br]}],"break-after":[{"break-after":Ri()}],"break-before":[{"break-before":Ri()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...xt(),Q]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Mu,Q]}],basis:[{basis:oe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Q]}],grow:[{grow:jn()}],shrink:[{shrink:jn()}],order:[{order:["first","last","none",Mu,Q]}],"grid-cols":[{"grid-cols":[Ru]}],"col-start-end":[{col:["auto",{span:["full",Mu,Q]},Q]}],"col-start":[{"col-start":Ce()}],"col-end":[{"col-end":Ce()}],"grid-rows":[{"grid-rows":[Ru]}],"row-start-end":[{row:["auto",{span:[Mu,Q]},Q]}],"row-start":[{"row-start":Ce()}],"row-end":[{"row-end":Ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Q]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Q]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...is()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...is(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...is(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[f]}],px:[{px:[f]}],py:[{py:[f]}],ps:[{ps:[f]}],pe:[{pe:[f]}],pt:[{pt:[f]}],pr:[{pr:[f]}],pb:[{pb:[f]}],pl:[{pl:[f]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Q,e]}],"min-w":[{"min-w":[Q,e,"min","max","fit"]}],"max-w":[{"max-w":[Q,e,"none","full","min","max","fit","prose",{screen:[Br]},Br]}],h:[{h:[Q,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Q,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Q,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Q,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Br,qr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xf]}],"font-family":[{font:[Ru]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Q]}],"line-clamp":[{"line-clamp":["none",qs,Xf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rr,Q]}],"list-image":[{"list-image":["none",Q]}],"list-style-type":[{list:["none","disc","decimal",Q]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Mi(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",rr,qr]}],"underline-offset":[{"underline-offset":["auto",rr,Q]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ee()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...xt(),f5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",h5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},g5]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...Mi(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:Mi()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...Mi()]}],"outline-offset":[{"outline-offset":[rr,Q]}],"outline-w":[{outline:[rr,qr]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:or()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[rr,qr]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Br,v5]}],"shadow-color":[{shadow:[Ru]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":Bo()}],"bg-blend":[{"bg-blend":Bo()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[i]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Br,Q]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[g]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[g]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Q]}],duration:[{duration:rs()}],ease:[{ease:["linear","in","out","in-out",Q]}],delay:[{delay:rs()}],animate:[{animate:["none","spin","ping","pulse","bounce",Q]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[Mu,Q]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[L]}],"skew-y":[{"skew-y":[L]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Q]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ee()}],"scroll-mx":[{"scroll-mx":ee()}],"scroll-my":[{"scroll-my":ee()}],"scroll-ms":[{"scroll-ms":ee()}],"scroll-me":[{"scroll-me":ee()}],"scroll-mt":[{"scroll-mt":ee()}],"scroll-mr":[{"scroll-mr":ee()}],"scroll-mb":[{"scroll-mb":ee()}],"scroll-ml":[{"scroll-ml":ee()}],"scroll-p":[{"scroll-p":ee()}],"scroll-px":[{"scroll-px":ee()}],"scroll-py":[{"scroll-py":ee()}],"scroll-ps":[{"scroll-ps":ee()}],"scroll-pe":[{"scroll-pe":ee()}],"scroll-pt":[{"scroll-pt":ee()}],"scroll-pr":[{"scroll-pr":ee()}],"scroll-pb":[{"scroll-pb":ee()}],"scroll-pl":[{"scroll-pl":ee()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[rr,qr,Xf]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var x$=i5(b5);function On(...t){return x$(f$(t))}var k$=$(j());function T$(t){let e=Ti();(0,k$.useEffect)(()=>{if(e)return e.listen("loaded-metadata",n=>{let i=n.target;if(!ro(i.provider)){t("unknown");return}let{videoHeight:r,videoWidth:s}=i.provider.video;t(r===0||s===0?"audio":"unknown")})},[e])}var Zf=$(j());function Jf(){let{controls:t}=xb(),e=bt(r=>r.controls);return e===void 0&&t===void 0?!0:e||t}function xb(){let{volume:t,tempFragment:e,...n}=bt(i=>i.hash);return n}function E$(){let t=Ti(),{volume:e}=bt(s=>s.hash),n=Hs(s=>s.defaultVolume/100),i=e??n,r=(0,Zf.useRef)(i);r.current=i,(0,Zf.useEffect)(()=>t?.subscribe(({canPlay:s})=>{s&&(t.volume=r.current)}),[t])}function Ge(){return Ge=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ge.apply(this,arguments)}var Ot=$(j(),1);function Bs(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t?.(r),n===!1||!r.defaultPrevented)return e?.(r)}}var S$=$(j(),1);function x5(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function kb(...t){return e=>t.forEach(n=>x5(n,e))}function Pi(...t){return(0,S$.useCallback)(kb(...t),t)}var ai=$(j(),1);function Wr(t,e=[]){let n=[];function i(s,a){let o=(0,ai.createContext)(a),l=n.length;n=[...n,a];function c(d){let{scope:p,children:h,...y}=d,v=p?.[t][l]||o,w=(0,ai.useMemo)(()=>y,Object.values(y));return(0,ai.createElement)(v.Provider,{value:w},h)}function u(d,p){let h=p?.[t][l]||o,y=(0,ai.useContext)(h);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}let r=()=>{let s=n.map(a=>(0,ai.createContext)(a));return function(o){let l=o?.[t]||s;return(0,ai.useMemo)(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return r.scopeName=t,[i,k5(r,...e)]}function k5(...t){let e=t[0];if(t.length===1)return e;let n=()=>{let i=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){let a=i.reduce((o,{useScope:l,scopeName:c})=>{let d=l(s)[`__scope${c}`];return{...o,...d}},{});return(0,ai.useMemo)(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var go=$(j(),1),P5=$(Ul(),1);var Ne=$(j(),1);var mo=(0,Ne.forwardRef)((t,e)=>{let{children:n,...i}=t,r=Ne.Children.toArray(n),s=r.find(E5);if(s){let a=s.props.children,o=r.map(l=>l===s?Ne.Children.count(a)>1?Ne.Children.only(null):(0,Ne.isValidElement)(a)?a.props.children:null:l);return(0,Ne.createElement)(Tb,Ge({},i,{ref:e}),(0,Ne.isValidElement)(a)?(0,Ne.cloneElement)(a,void 0,o):null)}return(0,Ne.createElement)(Tb,Ge({},i,{ref:e}),n)});mo.displayName="Slot";var Tb=(0,Ne.forwardRef)((t,e)=>{let{children:n,...i}=t;return(0,Ne.isValidElement)(n)?(0,Ne.cloneElement)(n,{...S5(i,n.props),ref:e?kb(e,n.ref):n.ref}):Ne.Children.count(n)>1?Ne.Children.only(null):null});Tb.displayName="SlotClone";var T5=({children:t})=>(0,Ne.createElement)(Ne.Fragment,null,t);function E5(t){return(0,Ne.isValidElement)(t)&&t.type===T5}function S5(t,e){let n={...e};for(let i in e){let r=t[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...o)=>{s(...o),r(...o)}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...t,...n}}var C5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Lu=C5.reduce((t,e)=>{let n=(0,go.forwardRef)((i,r)=>{let{asChild:s,...a}=i,o=s?mo:e;return(0,go.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,go.createElement)(o,Ge({},a,{ref:r}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var vo=$(j(),1);function Eb(t){let e=(0,vo.useRef)(t);return(0,vo.useEffect)(()=>{e.current=t}),(0,vo.useMemo)(()=>(...n)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...n)},[])}var P$=$(j(),1),C$=globalThis?.document?P$.useLayoutEffect:()=>{};var Iu=$(j(),1);var $$=$(j(),1);function M$(t){let[e,n]=(0,$$.useState)(void 0);return C$(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let s=r[0],a,o;if("borderBoxSize"in s){let l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=t.offsetWidth,o=t.offsetHeight;n({width:a,height:o})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}var R$="Popper",[L$,Sb]=Wr(R$),[WH,KH]=L$(R$);var $5="PopperContent",[GH,YH]=L$($5);var Kr=$(j(),1);function I$({prop:t,defaultProp:e,onChange:n=()=>{}}){let[i,r]=M5({defaultProp:e,onChange:n}),s=t!==void 0,a=s?t:i,o=Eb(n),l=(0,Kr.useCallback)(c=>{if(s){let d=typeof c=="function"?c(t):c;d!==t&&o(d)}else r(c)},[s,t,r,o]);return[a,l]}function M5({defaultProp:t,onChange:e}){let n=(0,Kr.useState)(t),[i]=n,r=(0,Kr.useRef)(i),s=Eb(e);return(0,Kr.useEffect)(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),n}var[em,aq]=Wr("Tooltip",[Sb]),oq=Sb(),R5="TooltipProvider",L5=700;var[I5,lq]=em(R5),A5=t=>{let{__scopeTooltip:e,delayDuration:n=L5,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=t,[a,o]=(0,Ot.useState)(!0),l=(0,Ot.useRef)(!1),c=(0,Ot.useRef)(0);return(0,Ot.useEffect)(()=>{let u=c.current;return()=>window.clearTimeout(u)},[]),(0,Ot.createElement)(I5,{scope:e,isOpenDelayed:a,delayDuration:n,onOpen:(0,Ot.useCallback)(()=>{window.clearTimeout(c.current),o(!1)},[]),onClose:(0,Ot.useCallback)(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o(!0),i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:(0,Ot.useCallback)(u=>{l.current=u},[]),disableHoverableContent:r},s)},A$="Tooltip",[cq,uq]=em(A$);var N5="TooltipPortal",[dq,pq]=em(N5,{forceMount:void 0});var[hq,fq]=em(A$,{isInside:!1});var tm=A5;var rm=$(j());var F$=require("obsidian"),im=$(j()),Z$=$(ae());function j5(t){let e=(0,im.useRef)(null);return[(0,im.useCallback)(i=>{e.current&&e.current.empty(),i&&(0,F$.setIcon)(i,t),e.current=i},[t])]}function Ve(t){return function(n){let[i]=j5(t);return(0,Z$.jsx)("div",{ref:i,...n})}}var z$=Ve("play"),U$=Ve("pause"),wq=Ve("volume"),j$=Ve("volume-1"),H$=Ve("volume-2"),q$=Ve("volume-x"),B$=Ve("maximize"),W$=Ve("minimize"),H5=Ve("picture-in-picture-2"),q5=Ve("picture-in-picture"),Pb=Ve("subtitles"),bq=Ve("check-circle"),xq=Ve("circle"),K$=Ve("fast-forward"),G$=Ve("rewind"),Y$=Ve("edit"),Q$=Ve("image-down"),B5=Ve("pin"),X$=Ve("more-horizontal"),kq=Ve("plus"),Tq=Ve("trash");var Ze=$(ae()),Au="group ring-mod-border-focus relative inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-md outline-none ring-inset hover:bg-white/20 focus-visible:ring-2 aria-disabled:hidden";function sm(){let t=_e("paused");return(0,Ze.jsx)(yf,{className:Au,"aria-label":t?"Play":"Pause",children:t?(0,Ze.jsx)(z$,{className:"w-7 h-7 translate-x-px"}):(0,Ze.jsx)(U$,{className:"w-7 h-7"})})}function J$({seconds:t}){return(0,Ze.jsx)(uu,{className:Au,seconds:t,"aria-label":`Fast forward ${t}s`,children:(0,Ze.jsx)(K$,{className:"w-7 h-7"})})}function eM({seconds:t}){return(0,Ze.jsx)(uu,{className:Au,seconds:-t,"aria-label":`Rewind ${t}s`,children:(0,Ze.jsx)(G$,{className:"w-7 h-7"})})}function am(){let t=_e("volume"),e=_e("muted");return(0,Ze.jsx)(wf,{className:Au,"aria-label":e?"Unmute":"Mute",children:e||t==0?(0,Ze.jsx)(q$,{className:"w-7 h-7"}):t<.5?(0,Ze.jsx)(j$,{className:"w-7 h-7"}):(0,Ze.jsx)(H$,{className:"w-7 h-7"})})}function tM(){let t=_e("fullscreen");return(0,Ze.jsx)(_f,{className:Au,"aria-label":t?"Exit fullscreen":"Enter fullscreen",children:t?(0,Ze.jsx)(W$,{className:"w-7 h-7"}):(0,Ze.jsx)(B$,{className:"w-7 h-7"})})}function om(){return ho()?(0,Ze.jsx)("button",{className:On("mx-lp-edit","group ring-mod-border-focus relative inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-md outline-none ring-inset hover:bg-white/20 focus-visible:ring-2 aria-disabled:hidden"),onClick:()=>{},[Gr]:!0,"aria-label":"Edit in editor",children:(0,Ze.jsx)(Y$,{className:"w-7 h-7"})}):null}function W5(){let t=N1(),[e,n]=(0,rm.useState)(()=>js(t)),i=u$(),r=Hs(a=>a.screenshotFormat),s=Hs(a=>a.screenshotQuality);return(0,rm.useEffect)(()=>{n(js(t))},[t]),!e||!i||!t?null:async()=>{i(await ku(t,r,s))}}function nM(){let t=W5();return t?(0,Ze.jsx)("button",{className:"group ring-mod-border-focus relative inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-md outline-none ring-inset hover:bg-white/20 focus-visible:ring-2 aria-disabled:hidden",onClick:t,"aria-label":"Capture screenshot",children:(0,Ze.jsx)(Q$,{className:"w-7 h-7"})}):null}var Gr="data-lp-pass-through";function dt(t,e){let n=Object.keys(e).map(i=>K5(t,i,e[i]));return n.length===1?n[0]:function(){n.forEach(i=>i())}}function K5(t,e,n){let i=t[e],r=t.hasOwnProperty(e),s=n(i);return i&&Object.setPrototypeOf(s,i),Object.setPrototypeOf(a,s),t[e]=a,o;function a(...l){return s===i&&t[e]===a&&o(),s.apply(this,l)}function o(){t[e]===a&&(r?t[e]=i:delete t[e]),s!==i&&(s=i,Object.setPrototypeOf(a,i||Function))}}var rM=require("obsidian"),sM=$(j());var Nu=$(ae());function aM(t){let e=(0,sM.useRef)(null);return n=>{e.current?.close(),e.current=null;let i=new rM.Menu;t(i)?(Zs(n.nativeEvent,i),n.nativeEvent.stopImmediatePropagation(),dt(i,{close:r=>function(...s){return e.current===this&&(e.current=null),r.call(this,...s)}}),e.current=i):i.close()}}function oM(){let t=Zw(),e=_e("textTracks"),n=aM(i=>(t.forEach(({label:r,select:s,selected:a},o,l)=>{i.addItem(c=>{l.length===2&&r==="Unknown"&&(r="On"),c.setTitle(r).setChecked(a).onClick(s)})}),!0));return e.length===0?null:(0,Nu.jsx)("button",{className:"group ring-mod-border-focus relative inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-md outline-none ring-inset hover:bg-white/20 focus-visible:ring-2 aria-disabled:hidden",[Gr]:!0,onClick:n,"aria-label":"Select Caption",children:(0,Nu.jsx)(Pb,{className:"w-7 h-7"})})}function lm(){let t=Ti(),e=Qf(l=>l.workspace),n=c$(),i=ho(),r=l$(),s=bt(l=>l.source),a=Yf(),o=aM(l=>{if(!t||!s)return!1;let{toggleControls:c,controls:u,setTransform:d,transform:p,disableWebFullscreen:h,toggleWebFullscreen:y}=a.getState();return e.trigger("mx-media-menu",l,{player:t,reload:r,source:s.url,viewType:s.viewType,toggleControls:c,controls:u,setTransform:d,transform:p,plugin:n,disableWebFullscreen:h,toggleWebFullscreen:y},i?"player-menu-embed":"player-menu-view"),!0});return!t||!s?null:(0,Nu.jsx)("button",{className:"group ring-mod-border-focus relative inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-md outline-none ring-inset hover:bg-white/20 focus-visible:ring-2 aria-disabled:hidden",[Gr]:!0,onClick:o,"aria-label":"More options",children:(0,Nu.jsx)(X$,{className:"w-7 h-7"})})}var pm=$(j());var W=$(j(),1);function Cb(t,[e,n]){return Math.min(n,Math.max(e,t))}var Du=$(j(),1),G5=(0,Du.createContext)(void 0);function cM(t){let e=(0,Du.useContext)(G5);return t||e||"ltr"}var cm=$(j(),1);function uM(t){let e=(0,cm.useRef)({value:t,previous:t});return(0,cm.useMemo)(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var oi=$(j(),1);function dM(t){let e=t+"CollectionProvider",[n,i]=Wr(e),[r,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:y,children:v}=h,w=oi.default.useRef(null),m=oi.default.useRef(new Map).current;return oi.default.createElement(r,{scope:y,itemMap:m,collectionRef:w},v)},o=t+"CollectionSlot",l=oi.default.forwardRef((h,y)=>{let{scope:v,children:w}=h,m=s(o,v),f=Pi(y,m.collectionRef);return oi.default.createElement(mo,{ref:f},w)}),c=t+"CollectionItemSlot",u="data-radix-collection-item",d=oi.default.forwardRef((h,y)=>{let{scope:v,children:w,...m}=h,f=oi.default.useRef(null),g=Pi(y,f),x=s(c,v);return oi.default.useEffect(()=>(x.itemMap.set(f,{ref:f,...m}),()=>void x.itemMap.delete(f))),oi.default.createElement(mo,{[u]:"",ref:g},w)});function p(h){let y=s(t+"CollectionConsumer",h);return oi.default.useCallback(()=>{let w=y.collectionRef.current;if(!w)return[];let m=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((x,E)=>m.indexOf(x.ref.current)-m.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:d},p,i]}var fM=["PageUp","PageDown"],mM=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gM={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ou="Slider",[$b,Y5,Q5]=dM(Ou),[vM,lB]=Wr(Ou,[Q5]),[X5,um]=vM(Ou),Z5=(0,W.forwardRef)((t,e)=>{let{name:n,min:i=0,max:r=100,step:s=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[i],value:u,onValueChange:d=()=>{},onValueCommit:p=()=>{},inverted:h=!1,...y}=t,[v,w]=(0,W.useState)(null),m=Pi(e,Ce=>w(Ce)),f=(0,W.useRef)(new Set),g=(0,W.useRef)(0),x=a==="horizontal",E=v?!!v.closest("form"):!0,L=x?J5:e4,[R=[],I]=I$({prop:u,defaultProp:c,onChange:Ce=>{var xt;(xt=[...f.current][g.current])===null||xt===void 0||xt.focus(),d(Ce)}}),z=(0,W.useRef)(R);function A(Ce){let xt=c4(R,Ce);or(Ce,xt)}function oe(Ce){or(Ce,g.current)}function ee(){let Ce=z.current[g.current];R[g.current]!==Ce&&p(R)}function or(Ce,xt,{commit:Mi}={commit:!1}){let Bo=h4(s),is=f4(Math.round((Ce-i)/s)*s+i,Bo),jn=Cb(is,[i,r]);I((Ri=[])=>{let Jt=o4(Ri,jn,xt);if(p4(Jt,l*s)){g.current=Jt.indexOf(jn);let rs=String(Jt)!==String(Ri);return rs&&Mi&&p(Jt),rs?Jt:Ri}else return Ri})}return(0,W.createElement)(X5,{scope:t.__scopeSlider,disabled:o,min:i,max:r,valueIndexToChangeRef:g,thumbs:f.current,values:R,orientation:a},(0,W.createElement)($b.Provider,{scope:t.__scopeSlider},(0,W.createElement)($b.Slot,{scope:t.__scopeSlider},(0,W.createElement)(L,Ge({"aria-disabled":o,"data-disabled":o?"":void 0},y,{ref:m,onPointerDown:Bs(y.onPointerDown,()=>{o||(z.current=R)}),min:i,max:r,inverted:h,onSlideStart:o?void 0:A,onSlideMove:o?void 0:oe,onSlideEnd:o?void 0:ee,onHomeKeyDown:()=>!o&&or(i,0,{commit:!0}),onEndKeyDown:()=>!o&&or(r,R.length-1,{commit:!0}),onStepKeyDown:({event:Ce,direction:xt})=>{if(!o){let is=fM.includes(Ce.key)||Ce.shiftKey&&mM.includes(Ce.key)?10:1,jn=g.current,Ri=R[jn],Jt=s*is*xt;or(Ri+Jt,jn,{commit:!0})}}})))),E&&R.map((Ce,xt)=>(0,W.createElement)(a4,{key:xt,name:n?n+(R.length>1?"[]":""):void 0,value:Ce})))}),[yM,_M]=vM(Ou,{startEdge:"left",endEdge:"right",size:"width",direction:1}),J5=(0,W.forwardRef)((t,e)=>{let{min:n,max:i,dir:r,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=t,[d,p]=(0,W.useState)(null),h=Pi(e,g=>p(g)),y=(0,W.useRef)(),v=cM(r),w=v==="ltr",m=w&&!s||!w&&s;function f(g){let x=y.current||d.getBoundingClientRect(),E=[0,x.width],R=Mb(E,m?[n,i]:[i,n]);return y.current=x,R(g-x.left)}return(0,W.createElement)(yM,{scope:t.__scopeSlider,startEdge:m?"left":"right",endEdge:m?"right":"left",direction:m?1:-1,size:"width"},(0,W.createElement)(wM,Ge({dir:v,"data-orientation":"horizontal"},u,{ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:g=>{let x=f(g.clientX);a?.(x)},onSlideMove:g=>{let x=f(g.clientX);o?.(x)},onSlideEnd:()=>{y.current=void 0,l?.()},onStepKeyDown:g=>{let E=gM[m?"from-left":"from-right"].includes(g.key);c?.({event:g,direction:E?-1:1})}})))}),e4=(0,W.forwardRef)((t,e)=>{let{min:n,max:i,inverted:r,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onStepKeyDown:l,...c}=t,u=(0,W.useRef)(null),d=Pi(e,u),p=(0,W.useRef)(),h=!r;function y(v){let w=p.current||u.current.getBoundingClientRect(),m=[0,w.height],g=Mb(m,h?[i,n]:[n,i]);return p.current=w,g(v-w.top)}return(0,W.createElement)(yM,{scope:t.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1},(0,W.createElement)(wM,Ge({"data-orientation":"vertical"},c,{ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:v=>{let w=y(v.clientY);s?.(w)},onSlideMove:v=>{let w=y(v.clientY);a?.(w)},onSlideEnd:()=>{p.current=void 0,o?.()},onStepKeyDown:v=>{let m=gM[h?"from-bottom":"from-top"].includes(v.key);l?.({event:v,direction:m?-1:1})}})))}),wM=(0,W.forwardRef)((t,e)=>{let{__scopeSlider:n,onSlideStart:i,onSlideMove:r,onSlideEnd:s,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:l,...c}=t,u=um(Ou,n);return(0,W.createElement)(Lu.span,Ge({},c,{ref:e,onKeyDown:Bs(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(o(d),d.preventDefault()):fM.concat(mM).includes(d.key)&&(l(d),d.preventDefault())}),onPointerDown:Bs(t.onPointerDown,d=>{let p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),u.thumbs.has(p)?p.focus():i(d)}),onPointerMove:Bs(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&r(d)}),onPointerUp:Bs(t.onPointerUp,d=>{let p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),s(d))})}))}),t4="SliderTrack",n4=(0,W.forwardRef)((t,e)=>{let{__scopeSlider:n,...i}=t,r=um(t4,n);return(0,W.createElement)(Lu.span,Ge({"data-disabled":r.disabled?"":void 0,"data-orientation":r.orientation},i,{ref:e}))}),pM="SliderRange",i4=(0,W.forwardRef)((t,e)=>{let{__scopeSlider:n,...i}=t,r=um(pM,n),s=_M(pM,n),a=(0,W.useRef)(null),o=Pi(e,a),l=r.values.length,c=r.values.map(p=>bM(p,r.min,r.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,W.createElement)(Lu.span,Ge({"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0},i,{ref:o,style:{...t.style,[s.startEdge]:u+"%",[s.endEdge]:d+"%"}}))}),hM="SliderThumb",r4=(0,W.forwardRef)((t,e)=>{let n=Y5(t.__scopeSlider),[i,r]=(0,W.useState)(null),s=Pi(e,o=>r(o)),a=(0,W.useMemo)(()=>i?n().findIndex(o=>o.ref.current===i):-1,[n,i]);return(0,W.createElement)(s4,Ge({},t,{ref:s,index:a}))}),s4=(0,W.forwardRef)((t,e)=>{let{__scopeSlider:n,index:i,...r}=t,s=um(hM,n),a=_M(hM,n),[o,l]=(0,W.useState)(null),c=Pi(e,w=>l(w)),u=M$(o),d=s.values[i],p=d===void 0?0:bM(d,s.min,s.max),h=l4(i,s.values.length),y=u?.[a.size],v=y?u4(y,p,a.direction):0;return(0,W.useEffect)(()=>{if(o)return s.thumbs.add(o),()=>{s.thumbs.delete(o)}},[o,s.thumbs]),(0,W.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${p}% + ${v}px)`}},(0,W.createElement)($b.ItemSlot,{scope:t.__scopeSlider},(0,W.createElement)(Lu.span,Ge({role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":s.min,"aria-valuenow":d,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0},r,{ref:c,style:d===void 0?{display:"none"}:t.style,onFocus:Bs(t.onFocus,()=>{s.valueIndexToChangeRef.current=i})}))))}),a4=t=>{let{value:e,...n}=t,i=(0,W.useRef)(null),r=uM(e);return(0,W.useEffect)(()=>{let s=i.current,a=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(a,"value").set;if(r!==e&&l){let c=new Event("input",{bubbles:!0});l.call(s,e),s.dispatchEvent(c)}},[r,e]),(0,W.createElement)("input",Ge({style:{display:"none"}},n,{ref:i,defaultValue:e}))};function o4(t=[],e,n){let i=[...t];return i[n]=e,i.sort((r,s)=>r-s)}function bM(t,e,n){let s=100/(n-e)*(t-e);return Cb(s,[0,100])}function l4(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function c4(t,e){if(t.length===1)return 0;let n=t.map(r=>Math.abs(r-e)),i=Math.min(...n);return n.indexOf(i)}function u4(t,e,n){let i=t/2,s=Mb([0,50],[0,i]);return(i-s(e)*n)*n}function d4(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function p4(t,e){if(e>0){let n=d4(t);return Math.min(...n)>=e}return!0}function Mb(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let i=(e[1]-e[0])/(t[1]-t[0]);return e[0]+i*(n-t[0])}}function h4(t){return(String(t).split(".")[1]||"").length}function f4(t,e){let n=Math.pow(10,e);return Math.round(t*n)/n}var Rb=Z5,xM=n4,kM=i4,TM=r4;var EM=$(j());var yo=$(ae()),dm=EM.forwardRef(({className:t,variant:e="regular",autoHidden:n,children:i,...r},s)=>(0,yo.jsxs)(Rb,{ref:s,className:On("group relative flex w-full touch-none select-none items-center",t),...r,children:[(0,yo.jsx)(xM,{className:"relative h-slider-track w-full grow overflow-hidden rounded-sm bg-slider-track",children:(0,yo.jsx)(kM,{className:"absolute h-full bg-ia-accent rounded-sm will-change-[width]"})}),(0,yo.jsx)(TM,{className:On("block rounded-slider-thumb border-width-slider-thumb border-slider-thumb bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mod-border-focus disabled:pointer-events-none disabled:opacity-50 transition-opacity will-change-[left]",e==="regular"?"h-slider-thumb w-slider-thumb":"h-slider-thumb-sm w-slider-thumb-sm",n&&"opacity-0 group-hocus:opacity-100 focus:opacity-100")}),i]}));dm.displayName=Rb.displayName;var Yr=$(ae());function hm(){let t=_e("volume"),e=_e("canSetVolume"),n=Pf();return e?(0,Yr.jsx)(dm,{className:"group relative inline-flex h-10 w-full max-w-[80px] cursor-pointer touch-none select-none items-center outline-none",value:[t*100],onValueChange:([i])=>{n.changeVolume(i/100)},"aria-label":"Volume",autoHidden:!0}):null}function fm({thumbnails:t}){let e=_e("currentTime"),n=_e("canSeek"),i=_e("duration"),r=_e("seeking"),s=Pf(),a=1/i*100,[o,l]=(0,pm.useState)(0),{previewRootRef:c,previewRef:u,previewValue:d}=D1({clamp:!0,offset:6,orientation:"horizontal"}),p=d/100*i;return(0,pm.useEffect)(()=>{r||l(e/i*100)},[e,i,r]),(0,Yr.jsx)(dm,{className:"group relative inline-flex h-9 w-full cursor-pointer touch-none select-none items-center outline-none",value:[o],disabled:!n,step:Number.isFinite(a)?a:1,ref:c,onValueChange:([h])=>{l(h),s.seeking(h/100*i)},onValueCommit:([h])=>{s.seek(h/100*i)},autoHidden:!0,"aria-label":"Current Time",children:(0,Yr.jsxs)("div",{className:"flex flex-col items-center absolute opacity-0 data-[visible]:opacity-100 transition-opacity duration-200 will-change-[left] pointer-events-none",ref:u,children:[t?(0,Yr.jsx)(bf.Root,{src:t,time:p,className:"block mb-2 h-[var(--thumbnail-height)] max-h-[160px] min-h-[80px] w-[var(--thumbnail-width)] min-w-[120px] max-w-[180px] overflow-hidden border border-white bg-black",children:(0,Yr.jsx)(bf.Img,{})}):null,(0,Yr.jsx)("span",{className:"text-[13px]",children:Ur(p)})]})})}var _o=$(ae());function mm(){return(0,_o.jsxs)("div",{className:"ml-2.5 flex items-center text-sm font-medium",children:[(0,_o.jsx)(du,{className:"time",type:"current"}),(0,_o.jsx)("div",{className:"mx-1 text-white/80",children:"/"}),(0,_o.jsx)(du,{className:"time",type:"duration"})]})}var Vu=$(ae());function gm(){let t=_e("title").trim(),e=Tf().trim();return!t&&!e?null:(0,Vu.jsxs)("span",{className:"inline-block flex-1 overflow-hidden text-ellipsis whitespace-nowrap px-2 text-sm font-medium text-white/70",children:[(0,Vu.jsx)("span",{className:"mr-1",children:"|"}),(0,Vu.jsx)("span",{children:e||t})]})}var me=$(ae());function PM({thumbnails:t}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(g4,{}),(0,me.jsx)(nr.Root,{className:"opacity-100 absolute inset-0 z-10 flex h-full w-full flex-col bg-gradient-to-t from-black/10 to-transparent",children:(0,me.jsxs)(tm,{children:[(0,me.jsx)("div",{className:"flex-1"}),(0,me.jsx)(nr.Group,{className:"flex w-full items-center px-2",children:(0,me.jsx)(fm,{thumbnails:t})}),(0,me.jsxs)(nr.Group,{className:"-mt-0.5 flex w-full items-center px-2 pb-2",children:[(0,me.jsx)(eM,{seconds:30}),(0,me.jsx)(sm,{}),(0,me.jsx)(J$,{seconds:30}),(0,me.jsx)(am,{}),(0,me.jsx)(hm,{}),(0,me.jsx)(mm,{}),(0,me.jsx)(gm,{}),(0,me.jsx)("div",{className:"flex-1"}),(0,me.jsx)(om,{}),(0,me.jsx)(lm,{})]})]})})]})}function g4(){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(In,{className:"absolute inset-0 z-0 block h-full w-full",event:"pointerup",action:"toggle:paused"}),(0,me.jsx)(In,{className:"absolute inset-0 z-0 block h-full w-full",event:"dblpointerup",action:"toggle:fullscreen"}),(0,me.jsx)(In,{className:"absolute left-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:-10"}),(0,me.jsx)(In,{className:"absolute right-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:10"})]})}var de=$(ae());function CM({thumbnails:t}){return(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(v4,{}),(0,de.jsx)(Ef,{className:"mx-captions media-preview:opacity-0 media-controls:bottom-[85px] media-captions:opacity-100 absolute inset-0 bottom-2 z-10 select-none break-words opacity-0 transition-[opacity,bottom] duration-300"}),(0,de.jsx)(nr.Root,{className:"media-controls:opacity-100 not-media-can-load:opacity-100 absolute inset-0 z-10 flex h-full w-full flex-col bg-gradient-to-t from-black/10 to-transparent opacity-0 transition-opacity",children:(0,de.jsxs)(tm,{children:[(0,de.jsx)("div",{className:"flex-1"}),(0,de.jsx)(nr.Group,{className:"flex w-full items-center px-2",children:(0,de.jsx)(fm,{thumbnails:t})}),(0,de.jsxs)(nr.Group,{className:"-mt-0.5 flex w-full items-center px-2 pb-2",children:[(0,de.jsx)(sm,{}),(0,de.jsx)(am,{}),(0,de.jsx)(hm,{}),(0,de.jsx)(mm,{}),(0,de.jsx)(gm,{}),(0,de.jsx)("div",{className:"flex-1"}),(0,de.jsx)(oM,{}),(0,de.jsx)(nM,{}),(0,de.jsx)(tM,{}),(0,de.jsx)(om,{}),(0,de.jsx)(lm,{})]})]})})]})}function v4(){return(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(In,{className:"absolute inset-0 z-0 block h-full w-full",event:"pointerup",action:"toggle:paused"}),(0,de.jsx)(In,{className:"absolute inset-0 z-0 block h-full w-full",event:"dblpointerup",action:"toggle:fullscreen"}),(0,de.jsx)(In,{className:"absolute left-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:-10"}),(0,de.jsx)(In,{className:"absolute right-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:10"})]})}var OM=$(j());var Fu=class{constructor(){_(this,"name","webview");_(this,"target")}canPlay({src:e}){return hu(e)&&MC(e)}mediaType(){return"video"}async load(e){return new Nn(this.target,e)}};var gn=$(j());function vm(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var $M=$(j());function MM(t,e){var n=(0,$M.useState)(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(i){var r=n.value;r!==i&&(n.value=i,n.callback(i,r))}}}})[0];return n.callback=e,n.facade}var LM=$(j());var RM=new WeakMap;function Lb(t,e){var n=MM(e||null,function(i){return t.forEach(function(r){return vm(r,i)})});return LM.useLayoutEffect(function(){var i=RM.get(n);if(i){var r=new Set(i),s=new Set(t),a=n.current;r.forEach(function(o){s.has(o)||vm(o,null)}),s.forEach(function(o){r.has(o)||vm(o,a)})}RM.set(n,t)},[t]),n}var _m=require("obsidian"),ym={mac:"Mozilla/5.0 (Macintosh; Intel Mac OS X 12.1; rv:95.0) Gecko/20100101 Firefox/95.0",windows:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0",linux:"Mozilla/5.0 (Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0"};function Ib(t){return _m.Platform.isWin?ym.windows:_m.Platform.isMacOS?ym.mac:_m.Platform.isLinux?ym.linux:ym.windows}var IM=$(j()),Ab={onLoadCommit:"load-commit",onDidFinishLoad:"did-finish-load",onDidFailLoad:"did-fail-load",onDidFrameFinishLoad:"did-frame-finish-load",onDidStartLoading:"did-start-loading",onDidStopLoading:"did-stop-loading",onDidAttach:"did-attach",onDomReady:"dom-ready",onPageTitleUpdated:"page-title-updated",onPageFaviconUpdated:"page-favicon-updated",onEnterHtmlFullScreen:"enter-html-full-screen",onLeaveHtmlFullScreen:"leave-html-full-screen",onConsoleMessage:"console-message",onFoundInPage:"found-in-page",onWillNavigate:"will-navigate",onDidStartNavigation:"did-start-navigation",onDidRedirectNavigation:"did-redirect-navigation",onDidNavigate:"did-navigate",onDidFrameNavigate:"did-frame-navigate",onDidNavigateInPage:"did-navigate-in-page",onClose:"close",onIpcMessage:"ipc-message",onCrashed:"crashed",onPluginCrashed:"plugin-crashed",onDestroyed:"destroyed",onMediaStartedPlaying:"media-started-playing",onMediaPaused:"media-paused",onDidChangeThemeColor:"did-change-theme-color",onUpdateTargetUrl:"update-target-url",onDevtoolsOpened:"devtools-opened",onDevtoolsClosed:"devtools-closed",onDevtoolsFocused:"devtools-focused",onContextMenu:"context-menu"};function y4(t){return Object.entries(t).reduce((e,[n,i])=>(n in Ab?e.event[n]=i:e.rest[n]=i,e),{event:{},rest:{}})}function AM(t,e){let{event:n,rest:i}=y4(t);for(let r of Object.keys(Ab)){let s=r,a=Ab[s],o=n[s];(0,IM.useEffect)(()=>{if(!e.current||!o)return;let l=e.current;return l.addEventListener(a,o),()=>{l.removeEventListener(a,o)}},[a,o,e])}return i}var DM=$(ae()),NM=(0,gn.forwardRef)(function({devtools:e=!1,muted:n=!1,className:i,useragent:r,...s},a){let o=(0,gn.useRef)(null),[l,c]=(0,gn.useState)(!1),u=AM(s,o);w4(n,o,l);let d=_4(r??navigator.userAgent,o,l);return(0,gn.useEffect)(()=>{if(!o.current)return;let p=o.current;return p.addEventListener("dom-ready",h),p.addEventListener("will-navigate",y),()=>{p.removeEventListener("dom-ready",h),p.removeEventListener("will-navigate",y)};function h(){c(!0)}function y(){c(!1)}},[]),(0,DM.jsx)("webview",{ref:Lb([o,a]),className:On("h-full w-full",i),useragent:d,...u})});function _4(t,e,n){let i=(0,gn.useMemo)(()=>{let r=t??navigator.userAgent;return Ib(r)},[t]);return(0,gn.useEffect)(()=>{!e.current||!n||i===e.current.useragent||e.current.setUserAgent(i)},[i,n,e]),i}function w4(t,e,n){(0,gn.useEffect)(()=>{!e.current||!n||t===e.current.isAudioMuted()||e.current.setAudioMuted(t)},[t,n,e])}var Nb=$(ae());function VM({loaders:t,...e}){let n=Qf(l=>l.appId),i=_e("viewType"),r=bt(l=>!!l.transform?.flipHorizontal),s=bt(l=>!!l.transform?.flipVertical),a=bt(l=>{if(l.transform?.rotate)switch(l.transform.rotate){case"90":return"rotate-90";case"180":return"rotate-180";case"270":return"rotate-[270deg]";default:return}}),o=Jf();return(0,Nb.jsx)(tb,{className:On(i==="video"&&r&&"-scale-x-100",i==="video"&&s&&"-scale-y-100",i==="video"&&a),loaders:[Fu,...t??[]],buildMediaEl:(0,OM.useCallback)((l,c)=>l instanceof Fu?(0,Nb.jsx)(NM,{"aria-hidden":!0,className:On("data-[play-ready]:blur-none blur-lg transition-opacity",o&&"pointer-events-none"),webpreferences:"autoplayPolicy=user-gesture-required",partition:lr(n),ref:u=>{c.load(u)}}):null,[n,o]),...e})}var li=$(ae()),zM=$(j());function b4({onViewTypeChange:t}){return T$(t),p$(),E$(),(0,li.jsx)(li.Fragment,{})}function x4(){let t=_e("viewType"),e=Jf();return t==="audio"?(0,li.jsx)(PM,{}):e?(0,li.jsx)(CM,{}):null}function Qr(){let t=bt(d=>d.playerRef),e=bt(({source:d})=>{if(!d)return;let p=d.url.source.href;return d.viewType==="mx-webpage"?{src:CC(p)}:{type:d.viewType.endsWith("video")?"video/mp4":d.viewType.endsWith("audio")?"audio/mp3":void 0,src:p}}),n=bt(({source:d})=>!!d?.url.source.pathname.endsWith(".webm")),i=bt(({textTracks:d})=>d),r=Hs(d=>d.loadStrategy),s=ho(),[a,o]=(0,FM.useState)("unknown"),l=bt(d=>d.title),{controls:c,...u}=xb();return e?(0,li.jsxs)(eb,{className:On("w-full bg-slate-900 text-white font-sans overflow-hidden rounded-md ring-mod-border-focus data-[focus]:ring-2","data-[view-type=video]:aspect-video data-[view-type=audio]:h-20 data-[view-type=audio]:aspect-auto"),load:s?r:"eager",src:e,playsInline:!0,title:l,viewType:a,ref:t,onError:d=>{new Db.Notice(createFragment(p=>{switch(p.appendText(`Failed to load media for ${e.src}: `),p.createEl("br"),d.code){case 1:p.appendText("The media playback was aborted");break;case 2:p.appendText("A network error caused the media playback to fail");break;case 3:p.appendText("The media playback was aborted due to a corruption problem or because the media encoding is not supported");break;case 4:p.appendText("The media is not supported to open as regular video or audio, try open as webpage");break;default:p.appendText(d.message||"Unknown error, check console for more details"),console.error("Failed to load media",e.src,d);break}}))},...u,children:[(0,li.jsx)(VM,{children:i.map(d=>(0,zM.createElement)(nb,{...d,key:d.id}))}),(0,li.jsx)(b4,{onViewTypeChange:d=>{o(d),!n&&d==="audio"&&new Db.Notice("Unable to show video content due to a potentially unsupported codec by Obsidian. For verification, please disable this plugin, add the video to the vault, and check if video playback resumes normally.")}}),(0,li.jsx)(x4,{})]}):null}function wm(t,e){let n=new WeakMap,i;t.register($u(t.store,r=>[r.subscribe(({currentTime:s,paused:a,playbackRate:o})=>{s!==0&&r.el&&n.set(t.leaf.parent,{currentTime:s,paused:a,playbackRate:o})}),r.listen("can-play",()=>{if(!i)return;let s=n.get(i);if(!s){i=void 0;return}let{currentTime:a,paused:o,playbackRate:l}=s;if(!o)r.play(new Event("recover-state")).then(()=>{r.currentTime=a,r.playbackRate=l,i&&(n.delete(i),i=void 0)}).catch(c=>console.error("recov err play",c));else try{r.currentTime=a,r.playbackRate=l,i&&(n.delete(i),i=void 0)}catch(c){console.error("recov err paused",c)}})])),t.register(T4(t,(r,s)=>{e(),n.has(s)?i=s:i=void 0})),t.register(()=>{i=void 0})}function bm(t,e){let n=new WeakMap,i;t.register($u(t.store,r=>[r.subscribe(({currentTime:s,paused:a,playbackRate:o})=>{s!==0&&r.el&&n.set(r.el.win,{currentTime:s,paused:a,playbackRate:o})}),r.listen("can-play",()=>{if(!i)return;let s=n.get(i);if(!s){i=void 0;return}let{currentTime:a,paused:o,playbackRate:l}=s;if(!o)r.play(new Event("recover-state")).then(()=>{r.currentTime=a,r.playbackRate=l,i&&(n.delete(i),i=void 0)}).catch(c=>console.error("recov err play",c));else try{r.currentTime=a,r.playbackRate=l,i&&(n.delete(i),i=void 0)}catch(c){console.error("recov err paused",c)}})])),t.register(k4(t.containerEl,(r,s)=>{e(),n.has(s)?i=s:i=void 0})),t.register(()=>{i=void 0})}function k4(t,e){let n=t.win;return t.onNodeInserted(()=>{let i=t.win;i!==n&&(e(i,n),n=i)})}function T4(t,e){let n=t.containerEl.win,i=t.leaf.parent;return t.containerEl.onNodeInserted(()=>{let r=t.containerEl.win,s=t.leaf.parent;r===n?s!==i&&(e(s,i),i=s):n=r})}var Ob=$(ae()),xm=class extends km.EditableFileView{constructor(n,i){super(n);this.plugin=i;_(this,"allowNoFile",!1);_(this,"store");_(this,"scope");_(this,"root",null);this.store=Hr(),this.scope=new km.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Kf(this)}onload(){bm(this,()=>this.render())}async onLoadFile(n){await this.store.getState().loadFile(n,{vault:this.app.vault,defaultLang:this.plugin.settings.getState().getDefaultLang()})}onPaneMenu(n,i){super.onPaneMenu(n,i),Gf(this,n,i)}setEphemeralState(n){if("subpath"in n){let{subpath:i}=n;this.store.getState().setHash(i)}super.setEphemeralState(n)}async onOpen(){await super.onOpen(),this.render()}render(){this.root?.unmount(),this.root=UM.default.createRoot(this.contentEl),this.root.render((0,Ob.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!1},children:(0,Ob.jsx)(Qr,{})}))}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}},wo=class extends xm{getIcon(){return"file-video"}getMediaInfo(){return this.file?{type:"video",file:this.file,hash:this.getEphemeralState().subpath}:null}getViewType(){return Ft.video}canAcceptExtension(e){return Tt.video.includes(e)}},bo=class extends xm{getIcon(){return"file-audio"}getViewType(){return Ft.audio}getMediaInfo(){return this.file?{type:"audio",file:this.file,hash:this.getEphemeralState().subpath}:null}canAcceptExtension(e){return Tt.audio.includes(e)}};var Tm=require("obsidian"),jM=$(jl());var Vb=$(ae()),Xr=class extends Tm.ItemView{constructor(n,i){super(n);this.plugin=i;_(this,"store");_(this,"scope");_(this,"root",null);_(this,"navigation",!0);this.store=Hr(),this.scope=new Tm.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Kf(this)}setSource(n){this.store.getState().setSource(n,{viewType:this.getViewType()})}getMediaInfo(){return this.store.getState().source?.url??null}get sourceType(){return this.store.getState().player?.state.source.type??""}get playerTitle(){return this.store.getState().player?.state.title??""}onload(){let n=this;super.onload(),this.register(dt(this.leaf,{detach:i=>function(...r){return n.root?.unmount(),n.root=null,i.call(this,...r)}})),bm(this,()=>this.render())}registerRemoteTitleChange(){this.register($u(this.store,n=>n.subscribe(({title:i})=>{this.updateTitle()})))}onPaneMenu(n,i){super.onPaneMenu(n,i),Gf(this,n,i)}getState(){let n=super.getState(),i=this.store.getState().source?.url;return{...n,source:i?i.jsonState.source:n.source}}async setState(n,i){if(await super.setState(n,i),!("source"in n))return;let r=this.plugin.resolveUrl(n.source);if(!r)console.warn("Invalid URL",n.source);else{let s=this.store.getState().source?.url;r.compare(s)||(await this.setSource(r),this.render())}}setEphemeralState(n){if("subpath"in n){let{subpath:i}=n;this.store.getState().setHash(i)}super.setEphemeralState(n)}async onOpen(){await super.onOpen(),this.render()}updateTitle(){let n=this.getDisplayText();this.titleEl.setText(n),this.app.workspace.activeLeaf===this.leaf&&this.app.workspace.requestActiveLeafEvents()&&this.leaf.updateHeader()}render(){this.root&&this.root.unmount(),this.root=jM.default.createRoot(this.contentEl),this.root.render((0,Vb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!1},children:(0,Vb.jsx)(Qr,{})}))}close(){return this.root?.unmount(),this.root=null,super.close()}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}};var E4={"video/vimeo":"Vimeo","video/youtube":"YouTube"},xo=class extends Xr{onload(){super.onload(),this.registerRemoteTitleChange(),wm(this,()=>this.render())}getDisplayText(){let e=E4[this.sourceType]??"Embed";return this.playerTitle?`${this.playerTitle} - ${e}`:e}getIcon(){switch(this.sourceType){case"video/youtube":return"youtube";case"video/vimeo":return"vimeo";default:return"video"}}getViewType(){return ss}};var Em=class extends Xr{},ko=class extends Em{getIcon(){return"file-video"}getViewType(){return Et.video}getDisplayText(){return this.playerTitle||"Video"}async setSource(e){let n=this.plugin.settings.getState().getDefaultLang(),i=await jf(e,n).catch(r=>(console.error("Failed to get text tracks",r,e.href,n),[]));this.store.getState().setSource(e,{title:!0,textTracks:i,viewType:this.getViewType()})}},To=class extends Em{getIcon(){return"file-audio"}getDisplayText(){return this.playerTitle||"Audio"}getViewType(){return Et.audio}async setSource(e){this.store.getState().setSource(e,{title:!0,viewType:this.getViewType()})}};var Eo=class extends Xr{onload(){super.onload(),this.registerRemoteTitleChange(),wm(this,()=>this.render())}getViewType(){return _n}getIcon(){let e=this.getHost();return e==="generic"?"globe":e}getHost(){let{source:e}=this.store.getState();return e?.url?e.url.type:"generic"}getDisplayText(){return this.playerTitle?`${this.playerTitle} - ${td[this.getHost()]}`:"Webpage"}};function HM(t,e){if(!(t.view instanceof wo||t.view instanceof bo))return!1;let{file:n}=t.view.getState();return n===e.file.path}function qM(t,e){if(!(t.view instanceof xo||t.view instanceof Eo||t.view instanceof ko||t.view instanceof To))return!1;let{source:n}=t.view.store.getState();return e.compare(n?.url)}function Fb(t,e){let n=t.stat.mtime,i=e.stat.mtime;return!n||!i?0:i-n}var Sm="mx-media-active",zu,zb,Cm,WM,$m,KM,Mm,GM,Pm=class extends So.Component{constructor(n){super();this.plugin=n;V(this,zu);V(this,Cm);V(this,$m);V(this,Mm);_(this,"app");_(this,"activeMediaLeaf",null);_(this,"onLeafUpdate",(0,So.debounce)(n=>{n=n??this.workspace.activeLeaf,this.onActiveLeafChange(n)},200));this.app=n.app}onload(){let n=this.app.workspace;n.onLayoutReady(()=>{this.onLeafUpdate()}),this.registerEvent(n.on("active-leaf-change",i=>{this.onLeafUpdate(i)})),this.registerEvent(n.on("layout-change",()=>{this.onLeafUpdate()}))}onunload(){this.applyActiveMediaLeaf(null)}get workspace(){return this.app.workspace}onActiveLeafChange(n){let i=this.detectActiveMediaLeaf(n);this.activeMediaLeaf!==i&&this.applyActiveMediaLeaf(i)}applyActiveMediaLeaf(n){this.activeMediaLeaf?.tabHeaderEl.removeClass(Sm),this.activeMediaLeaf?.containerEl.removeClass(Sm),n?.tabHeaderEl.addClass(Sm),n?.containerEl.addClass(Sm),this.activeMediaLeaf=n}detectActiveMediaLeaf(n){let i=()=>{let r=this.findPinnedPlayer();if(r)return r;let s=BM(this.workspace),{activeTabGroup:a}=this.workspace;return(!n||!a?s:s.filter(l=>!a.children.includes(l))).at(0)??null};if(!n)return i();if(Ub(n))return n;if(n.view instanceof So.MarkdownView&&n.view.file){let{mediaNote:r}=this.plugin,s=r.findMedia(n.view.file);if(s)return this.findPlayerWithSameMedia(s)}return i()}findPlayerWithSameMedia(n){for(let i of this.plugin.urlViewType.getSupported(n)){let r=S4(n,i,this.workspace);if(r.length>0)return r[0]}return null}findPinnedPlayer(){return BM(this.workspace).filter(n=>n.pinned)[0]??null}get settings(){return this.plugin.settings.getState()}getSplitBehavior(n,i){if(!i)return ur(n)??!1;n=ur(n);let{defaultMxLinkClick:{click:r,alt:s}}=this.settings;return r===null?n??!1:n===void 0||n===!1?r:s!==null&&n===r?s:n}async openMedia(n,i,{direction:r,viewType:s,fromUser:a=!1}={}){let{workspace:o}=this.app;if(!i){let u=await M(this,Cm,WM).call(this,n,s);if(u)return u}let l=this.getSplitBehavior(i,a),c;return l==="split-horizontal"?c=o.getLeaf("split",r??"horizontal"):c=o.getLeaf(l,r),M(this,zu,zb).call(this,c,n,s)}async openNote(n,i,r="split",s="vertical"){let a=this.plugin.mediaNote.findNotes(n),o=M(this,$m,KM).call(this,a);if(o)return o.getMode()!=="source"&&await o.setState({mode:"source"},{history:!1}),o;let l;if(a.length===0){let d=`Media Note - ${sd(i.title)}`;l=await M(this,Mm,GM).call(this,d,i.fm,i.sourcePath??"")}else l=a.sort(Fb).at(0);let c=this.app.workspace.getLeaf(r,s);return await c.openFile(l,{state:{mode:"source"}}),{file:l,editor:c.view.editor}}};zu=new WeakSet,zb=async function(n,i,r){if(Li(i))await n.openFile(i.file,{eState:{subpath:i.hash},active:!0});else{let{hash:s,source:a}=i.jsonState,o={source:a};r??(r=this.plugin.urlViewType.getPreferred(i)),await n.setViewState({type:r,state:o,active:!0},{subpath:s})}return n},Cm=new WeakSet,WM=async function(n,i){let r=this.findPinnedPlayer();if(r)return await M(this,zu,zb).call(this,r,n,i);let s=this.findPlayerWithSameMedia(n);return s?(P4(n.hash,s),s):null},$m=new WeakSet,KM=function(n){let{workspace:i}=this.app,r=i.getLeavesOfType("markdown").filter(a=>{let o=a.view.file?.path;return!!o&&n.some(l=>l.path===o)});return r.length===0?null:(r.find(a=>a===i.activeLeaf)??r.sort((a,o)=>Fb(a.view.file,o.view.file)).at(0)).view},Mm=new WeakSet,GM=async function(n,i,r=""){let{fileManager:s}=this.app,a=s.getNewFileParent(r,n),o=await s.createNewFile(a,n,"md",`---
---
`);return await s.processFrontMatter(o,l=>{Object.assign(l,i(o.path))}),o};function BM(t){let e=[];return t.iterateAllLeaves(n=>{yg(n.view.getViewType())&&e.push(n)}),e.sort(Rm),e}function S4(t,e,n){let i=n.getLeavesOfType(e).filter(r=>Li(t)?HM(r,t):qM(r,t));return i.sort(Rm),i}function Ub(t){return!!t&&yg(t.view.getViewType())}function Rm(t,e){return e.activeTime-t.activeTime}function P4(t,e){e.setEphemeralState({subpath:t})}function C4(t,e,n){return i=>{let r=n.workspace.activeEditor;if(!r)return t?t(i):void 0;if(e&&r.getMode()!=="preview")return r instanceof Lm.MarkdownView&&r.inlineTitleEl.isActiveElement()?void 0:e(i,r.editor,r)}}function Zr({playerCheckCallback:t,noteCheckCallback:e,...n},i){let{app:r}=i,s=i.addCommand({...n,checkCallback:C4(t&&(a=>!t||!Ub(r.workspace.activeLeaf)?!1:a?!0:t(a,r.workspace.activeLeaf.view)),e&&((a,o,l)=>{if(!l.file)return!1;let c=i.mediaNote.findMedia(l.file),u=i.leafOpener.detectActiveMediaLeaf(r.workspace.activeLeaf);return e(a,u?.view,{isMediaNote:c,file:l.file,editor:o})}),r)});return!e||!n.menu||i.registerEvent(i.app.workspace.on("editor-menu",(a,o,l)=>{if(!l.file)return!1;let c=i.mediaNote.findMedia(l.file),u=i.leafOpener.detectActiveMediaLeaf(r.workspace.activeLeaf);if(!e(!0,u?.view,{isMediaNote:c,file:l.file,editor:o}))return;let d=l.file;a.addItem(p=>{n.icon&&p.setIcon(n.icon),n.name&&p.setTitle(n.name),n.section&&p.setSection(n.section),p.onClick(()=>{e(!1,u?.view,{isMediaNote:c,file:d,editor:o})})})})),s}function YM(t,{onKeyDown:e,onTrigger:n,onKeyUp:i}){let r=null,s=new Set;return t.register(()=>{s.forEach(a=>{window.removeEventListener("keyup",a,{capture:!0})})}),t.registerDomEvent(window,"keydown",a=>{if(!r)return;let o=a.target;if(o.instanceOf(HTMLElement)&&o.matches("input.prompt-input"))return;let l=a;if(e(a,...r),i){let c=r,u=d=>{let p=$4(l);(d.code===l.code&&p.every(h=>Lm.Keymap.isModifier(d,h))||p.some(h=>d.key===h))&&(i(d,...c),window.removeEventListener("keyup",u,{capture:!0}),s.delete(u))};s.add(u),window.addEventListener("keyup",u,{passive:!0,capture:!0})}r=null},!0),{callback:(...a)=>{r=a,setTimeout(()=>{r===null||(n?.(...a),r=null)},0)}}}function $4(t){let e=[];return t.ctrlKey&&e.push("Ctrl"),t.altKey&&e.push("Alt"),t.shiftKey&&e.push("Shift"),t.metaKey&&e.push("Meta"),e}var M4=t=>[{id:"toggle-play",label:"Play/pause",icon:"play",action:e=>{e.paused=!e.paused}},...[.5,1,2,5,10,30,60].flatMap(e=>[{id:`forward-${e}s`,label:`Forward ${e}s`,icon:"forward",action:n=>{n.currentTime+=e},repeat:!0},{id:`rewind-${e}s`,label:`Rewind ${e}s`,icon:"rewind",action:n=>{n.currentTime-=e},repeat:!0}]),{id:"toggle-mute",label:"Mute/unmute",icon:"volume-x",action:e=>{e.muted=!e.muted}},{id:"toggle-fullscreen",label:"Enter/exit fullscreen",icon:"expand",check:e=>e.state.canFullscreen,action:e=>{e.state.fullscreen?e.exitFullscreen():e.enterFullscreen()}},...R4(t)];function R4(t){let e=null,n=(0,Po.debounce)(()=>e?.hide(),2e3,!0);function i(a){!e||e.noticeEl.isConnected===!1?e=new Po.Notice(a,0):e.setMessage(a),n()}function r(a){!e||e.noticeEl.isConnected===!1?e=new Po.Notice(a,0):e.setMessage(a)}function s(a){new Po.Notice(a,2e3)}return[...yn.filter(a=>a>1).map(a=>{let o=!1,{callback:l}=YM(t,{onKeyDown(c,u){c.repeat&&(o=!0,u.playbackRate=a,r(`Fast forwarding at ${a}x`))},onKeyUp(c,u){o&&(u.playbackRate=1,e?.hide())}});return{id:`fast-forward-${a}x`,label:`Fast forward at ${a}x by holding hotkey`,icon:"forward",action:l,repeat:!0}}),...yn.map(a=>({id:`set-speed-${a}x`,label:`Set playback speed to ${a}x`,icon:"gauge",action:async o=>{o.playbackRate=a,i(`Speed set to ${a}x`)}})),{id:"reset-speed",label:"Reset playback speed",icon:"reset",check:a=>a.state.playbackRate!==1,action:a=>{a.playbackRate=1,s("Speed reset to 1x")}},{id:"increase-speed",label:"Increase playback speed",icon:"arrow-up",action:a=>{let o=a.playbackRate;if(o>=yn.last()){s("Cannot increase speed further");return}let l=yn.find(c=>c>o);a.playbackRate=l,i(`Speed increased to ${l}x`)}},{id:"decrease-speed",label:"Decrease playback speed",icon:"arrow-down",action:a=>{let o=a.playbackRate;if(o<=yn.first()){s("Cannot decrease speed further");return}let l=yn.slice().reverse().find(c=>c<o);a.playbackRate=l,i(`Speed decreased to ${l}x`)}},{id:"set-speed",label:"Set playback speed to custom value",icon:"gauge",action:async a=>{let o=await Js.run();o&&(a.playbackRate=o,i(`Speed set to ${o}x`))}},{id:"increase-speed-granular",label:"Increase playback speed by 0.1x",icon:"arrow-up",action:a=>{let o=a.playbackRate;if(o>=yn.last()){s("Cannot increase speed further");return}let l=Math.round((o+.1)*10)/10;a.playbackRate=l,i(`Speed increased to ${l}x`)}},{id:"decrease-speed-granular",label:"Decrease playback speed by 0.1x",icon:"arrow-down",action:a=>{let o=a.playbackRate;if(o<=yn.first()){s("Cannot decrease speed further");return}let l=Math.round((o-.1)*10)/10;a.playbackRate=l,i(`Speed decreased to ${l}x`)}}]}function QM(t){M4(t).forEach(({id:e,label:n,icon:i,action:r,repeat:s,check:a})=>{Zr({id:e,name:n,icon:i,repeatable:s,playerCheckCallback:(o,l)=>{if(!l)return!1;let c=l.store.getState().player;if(!c||a&&!a(c))return!1;if(o)return!0;r(c)},noteCheckCallback(o,l){if(!l)return!1;let c=l.store.getState().player;if(!c||a&&!a(c))return!1;if(o)return!0;r(c)}},t)})}var Im=require("obsidian");function XM(t){let e=null;Zr({id:"copy-screenshot",name:"Copy screenshot",icon:"copy",playerCheckCallback(i,r){if(i)return!0;let s=Bf(r);s&&Eu(s)},noteCheckCallback:n(i=>{let r=Bf(i);r&&Eu(r)}).noteCheckCallback},t),Zr({id:"take-timestamp",name:"Take timestamp",icon:"star",menu:!0,section:"selection-link",...n(async(i,r)=>{let s=e;e=r.file,await Pu(i,r)&&r.from==="player"&&s!==r.file&&new Im.Notice(`Timestamp taken in "${r.file.basename}"`)})},t),Zr({id:"save-screenshot",name:"Save screenshot",icon:"camera",section:"selection-link",menu:!0,...n(async(i,r)=>{let s=e;e=r.file,await Tu(i,r)&&r.from==="player"&&s!==r.file&&new Im.Notice(`Taking screenshot in "${r.file.basename}"`)})},t),Zr({id:"take-timestamp-media-note",name:"Take timestamp in media note",icon:"star",menu:!0,section:"selection-link",playerCheckCallback(i,r){let s=r.getMediaInfo();if(!s)return!1;if(i)return!0;po(s,r).then(a=>Pu(r,a))}},t),Zr({id:"save-screenshot-media-note",name:"Save screenshot in media note",icon:"camera",section:"selection-link",menu:!0,playerCheckCallback(i,r){let s=r.getMediaInfo();if(!s)return!1;if(i)return!0;po(s,r).then(a=>Tu(r,a))}},t);function n(i){return{playerCheckCallback:(r,s)=>{let a=L4(t.app);if(!a){if(r)return!1;new Im.Notice("No active note can be edited");return}if(r)return!0;i(s,{file:a.view.file,editor:a.view.editor,from:"player"})},noteCheckCallback:(r,s,{isMediaNote:a,...o})=>{let l;if(s){if(r)return!0;t.app.workspace.revealLeaf(s.leaf),l=Promise.resolve(s)}else{if(!a)return!1;if(r)return!0;l=t.leafOpener.openMedia(a,void 0,{fromUser:!0}).then(c=>c.view)}l.then(c=>i(c,{...o,from:"note"}))}}}}function L4(t){return t.workspace.getLeavesOfType("markdown").filter(n=>{let i=n.view;return i.file&&i.getMode()==="source"}).sort(Rm)[0]??null}function JM(){this.registerEvent(this.app.workspace.on("file-menu",(t,e,n,i)=>{if(!(e instanceof ZM.TFile))return;let r=this.mediaNote.findMedia(e);r&&t.addItem(s=>s.setSection("view").setIcon("play").setTitle("Open linked media").onClick(()=>this.leafOpener.openMedia(r,void 0,{fromUser:!0})))})),XM(this),QM(this)}var Vn=require("obsidian");var eR={"mx-embed":{label:"iframe",icon:"code"},"mx-url-audio":{label:"regular audio",icon:"headphones"},"mx-url-video":{label:"regular video",icon:"film"},"mx-webpage":{label:"webpage",icon:"globe"}};function jb(t,e,n=!1){let i=eR[e].label;return t.setTitle(n?i:`Open as ${i}`).setIcon(eR[e].icon)}function Uu(t,{mode:e,plugin:n,targetViewTypes:i,open:r=!0,url:s}){let{protocol:a,hostname:o,pathname:l,host:c,port:u}=s;i.length!==0&&(e==="once"&&i.forEach(d=>{if(!r)throw new Error("openAsMenu: cannot set 'open' to false in 'open once' mode");t.addItem(p=>jb(p,d).setSection("mx-link").onClick(async()=>{await n.leafOpener.openMedia(s,void 0,{viewType:d,fromUser:!0})}))}),e==="always"&&(t.addItem(d=>{let p=d.setTitle("Always open this url as").setIcon("external-link").setSection("mx-link").setSubmenu();i.forEach(h=>{p.addItem(y=>jb(y,h,!0).setSection("mx-link").onClick(async()=>{n.urlViewType.setPreferred({protocol:a,hostname:o,pathname:l,port:u},h),r&&await n.leafOpener.openMedia(s,void 0,{viewType:h,fromUser:!0})}))})}),o&&t.addItem(d=>{let p=d.setTitle(`Always open ${c} as`).setIcon("external-link").setSection("mx-link").setSubmenu();i.forEach(h=>{p.addItem(y=>jb(y,h,!0).setSection("mx-link").onClick(async()=>{n.urlViewType.setPreferred({protocol:a,hostname:o,port:u},h),r&&await n.leafOpener.openMedia(s,void 0,{viewType:h,fromUser:!0})}))})})))}function Co(t,e){return!!(t.type!=="generic"||t.inferredType||t.tempFrag||e.mediaNote.findNotes(t).length>0||e.urlViewType.getPreferred(t,!0))}var Hb=async function(t,e,n){let i=this.resolveUrl(t);if(!i||!Co(i,this)){n();return}await this.leafOpener.openMedia(i,e,{fromUser:!0})};async function I4(t){if(!Vn.Platform.isDesktopApp)return;let e=window.electron;if(!e)return;await(Vn.Platform.isMacOS?e.remote.shell:e.shell).showItemInFolder(t)}async function A4(t){if(!Vn.Platform.isDesktopApp)return;let e=window.electron;if(!e)return;let i=await(Vn.Platform.isMacOS?e.remote.shell:e.shell).openPath(t);if(i)throw new Error(i)}function tR(t){t.registerEvent(t.app.workspace.on("url-menu",(e,n)=>{let i=t.resolveUrl(n);if(!i)return;if(Vn.Platform.isDesktopApp&&i.isFileUrl&&i.filePath){let o=i.filePath;e.addItem(l=>l.setIcon("folder").setTitle(Vn.Platform.isMacOS?"Reveal in Finder":"Show in system explorer").onClick(()=>{I4(o).catch(c=>{new Vn.Notice(`Failed to open file in file explorer: ${c.message}`),console.error("Failed to open file in file explorer",c)})})).addItem(l=>l.setIcon("arrow-up-right").setTitle("Open in system player").onClick(()=>{A4(o).catch(c=>{new Vn.Notice(`Failed to open file in system player: ${c.message}`),console.error("Failed to open file in system player",c)})}))}let r=t.urlViewType.getSupported(i),s=t.urlViewType.getPreferred(i),a=Co(i,t)?r.filter(o=>o!==s):r;Uu(e,{targetViewTypes:a,url:i,mode:"once",plugin:t}),Uu(e,{targetViewTypes:a,url:i,mode:"always",plugin:t})}))}var nR=async function(t,e,n,i){let{metadataCache:r}=this.app,{path:s,subpath:a}=(0,Vn.parseLinktext)(t),o=r.getFirstLinkpathDest(s,e),l;if(!o||!(l=en(o.extension))){i();return}let c={file:o,hash:a,type:l,viewType:Ft[l]};await this.leafOpener.openMedia(c,n,{fromUser:!0})};var Jr=require("obsidian");var Dm=class extends Jr.Component{constructor(n){super();this.plugin=n;_(this,"app");_(this,"noteToMediaIndex",new Map);_(this,"mediaToNoteIndex",new Map);this.app=n.app}findNotes(n){let i=this.mediaToNoteIndex.get(Am(n));return i?[...i]:[]}findMedia(n){return this.noteToMediaIndex.get(n.path)}onResolve(){this.noteToMediaIndex.clear(),this.mediaToNoteIndex.clear();let n={metadataCache:this.app.metadataCache,vault:this.app.vault,plugin:this.plugin};for(let{file:i,mediaInfo:r}of D4(n))this.addMediaNote(r,i);this.registerEvent(this.app.metadataCache.on("changed",i=>{let r=sR(i,n);r&&this.addMediaNote(r,i)})),this.registerEvent(this.app.metadataCache.on("deleted",i=>{this.removeMediaNote(i)})),this.registerEvent(this.app.vault.on("rename",(i,r)=>{if(!this.noteToMediaIndex.has(r))return;let s=this.noteToMediaIndex.get(r);this.noteToMediaIndex.delete(r),this.noteToMediaIndex.set(i.path,s)}))}removeMediaNote(n){let i=this.noteToMediaIndex.get(n.path);if(!i)return;this.noteToMediaIndex.delete(n.path);let r=Am(i),s=this.mediaToNoteIndex.get(r);s&&(s.delete(n),s.size===0&&this.mediaToNoteIndex.delete(r))}addMediaNote(n,i){this.noteToMediaIndex.set(i.path,n);let r=this.mediaToNoteIndex.get(Am(n));r?r.add(i):this.mediaToNoteIndex.set(Am(n),new Set([i]))}onload(){N4(this.app.metadataCache,this).then(()=>{this.onResolve()})}};function N4(t,e){return t.initialized?Promise.resolve():new Promise(n=>{let i=t.on("initialized",()=>{t.offref(i),n()});e?.registerEvent(i)})}function*iR(t){for(let e of t.children)e instanceof Jr.TFolder?yield*iR(e):e instanceof Jr.TFile&&(yield e)}function*D4(t){for(let e of iR(t.vault.getRoot())){if(e.extension!=="md")continue;let n=sR(e,t);n&&(yield{mediaInfo:n,file:e})}}var Nm={generic:"media",video:"video",audio:"audio"},rR=Object.values(Nm);function sR(t,{metadataCache:e,plugin:n}){let i=e.getFileCache(t);if(!i)return null;let r={metadataCache:e,sourcePath:t.path,plugin:n};return qb(Nm.video,i,r)??qb(Nm.audio,i,r)??qb(Nm.generic,i,r)}function qb(t,e,n){let{frontmatter:i,frontmatterLinks:r}=e;if(!i||!(t in i))return null;let s=r?.find(o=>o.key===t);if(s){let{path:o,subpath:l}=(0,Jr.parseLinktext)(s.link),c=n.metadataCache.getFirstLinkpathDest(o,n.sourcePath);if(!c)return null;let u=en(c.extension);return u?{type:u,file:c,hash:l}:null}let a=i[t];return typeof a!="string"?null:n.plugin.resolveUrl(a)}function Am(t){return Li(t)?`file:${t.file.path}`:`url:${t.jsonState.source}`}var aR=require("obsidian"),oR=$(jl());var Bb=$(ae()),Om=class extends aR.Component{constructor(n,i,r,s){super();this.info=n;this.file=i;this.subpath=r;this.plugin=s;_(this,"store");_(this,"root",null);_(this,"containerEl");this.containerEl=n.containerEl,this.store=Hr();let{containerEl:a}=n;a.addClasses(["mx","mx-media-embed","custom"]);function o(l){if(!(l instanceof Element))return!1;let c=l.closest("button");return c?c.hasAttribute(Gr):!1}this.registerDomEvent(a,"click",l=>{o(l.target)||l.stopImmediatePropagation()})}getMediaInfo(){if(!this.file)return null;let n=en(this.file.extension);return n?{type:n,file:this.file,hash:this.subpath}:null}render(){this.root?.unmount(),this.root=oR.default.createRoot(this.info.containerEl),this.root.render((0,Bb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!0},children:(0,Bb.jsx)(Qr,{})}))}onload(){super.onload(),this.render()}async loadFile(){await this.store.getState().loadFile(this.file,{vault:this.plugin.app.vault,subpath:this.subpath,defaultLang:this.plugin.settings.getState().getDefaultLang()})}onunload(){this.root?.unmount(),this.root=null,super.onunload()}};function lR(t,e){let n=e.muted;t.addItem(i=>i.setSection("mx-player").setIcon(n?"volume-2":"volume-x").setTitle(n?"Unmute":"Mute").onClick(()=>{e.muted=!n}))}function cR(t,e){e.state.canPictureInPicture&&(e.state.pictureInPicture?t.addItem(n=>n.setTitle("Exit Picture in Picture").setIcon("picture-in-picture-2").setSection("mx-player").onClick(()=>e.exitPictureInPicture())):t.addItem(n=>n.setTitle("Picture in Picture").setSection("mx-player").setIcon("picture-in-picture").onClick(()=>e.enterPictureInPicture())))}function uR(t,{setTransform:e,transform:n}){let i=t.setTitle("Transform").setIcon("rotate-3d").setSection("mx-player").setSubmenu();(n?.flipHorizontal||n?.flipVertical||n?.rotate)&&i.addItem(r=>r.setIcon("reset").setTitle("Reset").onClick(()=>e(null))),i.addItem(r=>r.setTitle("Flip horizontally").setIcon("flip-horizontal").setChecked(!!n?.flipHorizontal).onClick(()=>e({flipHorizontal:!n?.flipHorizontal}))).addItem(r=>r.setTitle("Flip vertically").setIcon("flip-vertical").setChecked(!!n?.flipVertical).onClick(()=>e({flipVertical:!n?.flipVertical}))).addSeparator().addItem(r=>r.setChecked(n?.rotate==="180").setIcon("iteration-cw").setTitle("Rotate 180\xB0").onClick(()=>{e({rotate:n?.rotate==="180"?void 0:"180"})}))}var Wb=require("obsidian");function dR(t,{source:e,plugin:n,viewType:i,player:r}){if(e.isFileUrl)return;let s=e.jsonState.source,a=e.print({start:r.currentTime,end:-1});t.addItem(u=>u.setTitle("Copy URL").setIcon("clipboard").setSection("view").onClick(()=>{navigator.clipboard.writeText(s),new Wb.Notice("URL copied to clipboard")})),a!==s&&t.addItem(u=>u.setTitle("Copy URL with time").setIcon("clipboard").setSection("view").onClick(()=>{navigator.clipboard.writeText(a),new Wb.Notice("URL with time copied to clipboard")})),t.addItem(u=>u.setTitle("Open link in default browser").setIcon("globe").setSection("view").onClick(()=>{window.open(a)}));let o=n.urlViewType.getSupported(e),l=i,c=o.filter(u=>u!==l);Uu(t,{mode:"always",open:!1,url:e,plugin:n,targetViewTypes:c})}function pR(t,{controls:e=!0,toggleControls:n,player:i,source:r,disableWebFullscreen:s,toggleWebFullscreen:a},o){i.provider instanceof Nn&&o==="more-options"&&(t.addItem(l=>{l.setTitle(e?"Show website native controls":"Hide website controls").setSection("mx-web-player").setIcon("sliders-horizontal").onClick(()=>{n(!e)})}),r.type!=="bilibili"&&r.type!=="youtube"&&t.addItem(l=>{l.setTitle(s?"Enable in-player fullscreen":"Disable in-player fullscreen").setSection("mx-web-player").setIcon(s?"maximize":"minimize").onClick(()=>{a(!!s)})}))}function Kb(){tR(this),this.registerEvent(this.app.workspace.on("mx-media-menu",(t,e,n)=>{if((n==="more-options"||n==="sidebar-context-menu"||n==="tab-header"||n==="player-menu-embed")&&t.addItem(r=>r.setTitle("Refresh").setSection("view").setIcon("reset").onClick(()=>{e.reload()})),n!=="sidebar-context-menu"&&n!=="tab-header"?(t.addItem(r=>Ux(r,e.player)),e.player.state.viewType==="video"&&(t.addItem(r=>uR(r,e)),cR(t,e.player))):lR(t,e.player),n==="player-menu-embed"){let r=e.source;t.addItem(s=>s.setTitle("Open to the right").setIcon("separator-vertical").setSection("view").onClick(()=>{this.leafOpener.openMedia(r,"split")})).addItem(s=>s.setTitle("Open in new tab").setSection("view").setIcon("file-plus").onClick(()=>{this.leafOpener.openMedia(r,"tab")})).addItem(s=>s.setTitle("Open in new window").setSection("view").setIcon("maximize").onClick(()=>{this.leafOpener.openMedia(r,"window")}))}pR(t,e,n),(n==="player-menu-embed"||n==="more-options")&&dR(t,e);let i=e.player.provider;(n==="player-menu-embed"||n==="more-options"||n==="sidebar-context-menu")&&js(i)&&t.addItem(r=>r.setTitle("Copy Screenshot").setSection("view").setIcon("copy").onClick(()=>{Eu({app:this.app,media:e.source,provider:i,settings:this.settings.getState(),state:e.player.state})}))}))}var O4=/^(?<x>\d+)?x(?<y>\d+)$|^(?<xOnly>\d+)$/;function hR(t){let e=parseInt(t,10);return Number.isNaN(e)?-1:e}var fR=t=>{let e=t?.match(O4)?.groups;if(!e)return null;let n=hR(e.xOnly??e.x),i=hR(e.y);return[n,i]},ju=t=>{let e=t.lastIndexOf("|"),n,i=t;return e===-1?(n=fR(t),n&&(i="")):(n=fR(i.substring(e+1)),n&&(i=i.substring(0,e))),{title:i,size:n}};function Vm(t,{title:e,size:n}){e?t.setAttr("alt",e):t.removeAttribute("alt");let i=(r,s)=>{s<0?t.style.removeProperty(r):t.style[r]=`${s}px`};n?(i("width",n[0]),i("height",n[1])):(i("width",-1),i("height",-1))}var mR=require("obsidian"),gR=$(jl());var Gb=$(ae()),$o=class extends mR.MarkdownRenderChild{constructor(n,i){super(n);this.containerEl=n;this.plugin=i;_(this,"store");_(this,"root",null);this.store=Hr(),n.addClasses(["mx","custom","mx-media-embed"])}getMediaInfo(){return this.store.getState().source?.url??null}async setSource(n,i={}){let r=this.plugin.urlViewType.getPreferred(n),s=this.plugin.settings.getState().getDefaultLang();this.store.getState().setSource(n,{title:i.title??!0,hash:i.hash,viewType:r,textTracks:r===Et.video?await jf(n,s).catch(a=>(console.error("Failed to get text tracks",a,n.href,s),[])):[]})}render(){this.root?.unmount(),this.root=gR.default.createRoot(this.containerEl),this.root.render((0,Gb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!0},children:(0,Gb.jsx)(Qr,{})}))}onload(){super.onload(),this.render()}onunload(){this.root?.unmount(),this.root=null,super.onunload()}};var bR=require("@codemirror/state"),Mo=require("@codemirror/view"),Ro=require("obsidian");var Fm=require("@codemirror/language"),ex=require("@codemirror/view");var vR=t=>!(!t.startsWith("./")&&!t.startsWith("../"))||t.indexOf(":")===-1;var yR=require("@codemirror/view"),_R=require("obsidian");var Yb=class extends $o{constructor(n,i){super(n,i);this.containerEl=n;this.plugin=i;n.addClasses(["mx-external-media-embed"]);function r(s){if(!(s instanceof Element))return!1;let a=s.closest("button");return a?a.hasAttribute(Gr):!1}this.registerDomEvent(n,"click",s=>{r(s.target)||s.stopImmediatePropagation()})}},Ws=class extends yR.WidgetType{constructor(n,i,r,s,a){super();this.plugin=n;this.media=i;this.title=r;this.start=s;this.end=a}setPos(n){let i=n.playerInfo;i&&(i.start=this.start,i.end=this.end)}hookClickHandler(n,i){i.on("click","button.mx-lp-edit",r=>{r.defaultPrevented||(this.selectElement(n,i),r.preventDefault())})}selectElement(n,i){let r=i.playerInfo,{start:s}=r??this,{end:a}=r??this;try{if(s<0||a<0){let o=n.posAtDOM(i);n.dispatch({selection:{head:o,anchor:o}}),n.focus()}else _R.Platform.isMobile&&(a=s),n.dispatch({selection:{head:s,anchor:a}}),n.focus()}catch{}}resizeWidget(n,i){window.ResizeObserver&&new window.ResizeObserver(()=>n.requestMeasure()).observe(i,{box:"border-box"})}setInfo(n,i){n.playerInfo={title:this.title,start:this.start,end:this.end,child:i,url:this.media}}updateDOM(n){let i=n.playerInfo;if(!i)return!1;let{title:r}=i;return this.media.compare(i.url)?this.title!==r&&(i.title=this.title,this.applyTitle(n),this.setPos(n)):i.child.setSource(this.media),!0}destroy(n){let i=n.playerInfo;i&&(delete n.playerInfo,i.child.unload())}eq(n){return this.media.compare(n.media)&&this.title===n.title}setDOM(n,i){i.tabIndex=-1,this.applyTitle(i);let r=new Yb(i,this.plugin);r.setSource(this.media),r.load(),this.hookClickHandler(n,i),this.setInfo(i,r),this.resizeWidget(n,i)}applyTitle(n){Vm(n,ju(this.title))}toDOM(n){let i=createDiv();return i.style.display="none",i.setAttr("src",this.media.source.href),i.addClasses(["external-embed","cm-embed-block","mx-media-embed"]),i.style.removeProperty("display"),this.setDOM(n,i),i}};Object.defineProperty(Ws.prototype,"estimatedHeight",{get:()=>100,enumerable:!1,configurable:!0});var Qb=class extends Ws{constructor(){super(...arguments);_(this,"enableWebview",!1)}},Xb=class extends Ws{constructor(){super(...arguments);_(this,"enableWebview",!1)}},Zb=class extends Ws{constructor(){super(...arguments);_(this,"enableWebview",!1)}},Jb=class extends Ws{constructor(){super(...arguments);_(this,"enableWebview",!0)}},wR={"mx-url-audio":Xb,"mx-url-video":Qb,"mx-embed":Zb,"mx-webpage":Jb};var V4=(t,e,n,i,r)=>{let s=e.doc,a=!1,o="",l="",c=-1;(0,Fm.syntaxTree)(e).iterate({from:i,to:r,enter:({type:d,from:p,to:h})=>{let y=new Set(d.prop(Fm.tokenClassNodeProp)?.split(" "));if(y){if(y.has("image-marker"))a=!0,c=p;else if(y.has("image-alt-text")&&!y.has("formatting"))o=s.sliceString(p,h);else if(a&&y.has("url")&&!y.has("formatting"))l=s.sliceString(p,h);else if(a&&l&&y.has("formatting")){if(vR(l))return;let v=t.resolveUrl(l);if(v&&Co(v,t)){let w=t.urlViewType.getPreferred(v),m=new wR[w](t,v,o,c,h);u(m,c,h)}a=!1,l="",o="",c=-1}}}});function u(d,p,h){let{from:v,text:w}=s.lineAt(p);w.substring(0,p-v).trim()===""&&w.substring(h-v).trim()===""?n.push(ex.Decoration.widget({widget:d,block:!0,side:-1}).range(v)):n.push(ex.Decoration.widget({widget:d,side:-1}).range(p))}},tx=V4;var F4=(t,e)=>zm(t,e[0])||zm(t,e[1]),zm=(t,e)=>t[0]<e&&t[1]>e,z4=(t,e)=>{let n=zm(t,e[0])?t[0]:e[0],i=zm(t,e[1])?t[1]:e[1];return[n,i]};function nx(t){return t.sort((e,n)=>e[0]-n[0]).reduce((e,n)=>{let i=e.findIndex(r=>F4(r,n));return i!==-1?e[i]=z4(e[i],n):e.push(n),e},[])}var U4=t=>{let e=n=>{if(n.field(Ro.editorLivePreviewField)){let i=[];return tx(t,n,i),Mo.Decoration.set(i)}else return Mo.Decoration.none};return bR.StateField.define({create:e,update:(n,i)=>{let r=i.startState.field(Ro.editorLivePreviewField),s=i.state.field(Ro.editorLivePreviewField);if(r!==s)return e(i.state);if(!s)return Mo.Decoration.none;if(!i.docChanged)return n;if(i.state.field(Ro.editorEditorField).composing)return n.map(i.changes);n=n.map(i.changes);let a=[];i.changes.iterChangedRanges((l,c,u,d)=>{a.push([i.state.doc.lineAt(u).number,i.state.doc.lineAt(d).number])});let o=[];for(let[l,c]of nx(a)){let{from:u}=i.state.doc.line(l),{to:d}=i.state.doc.line(c);n=n.update({filterFrom:u,filterTo:d,filter:()=>!1}),tx(t,i.state,o,u,d)}return n.update({add:o,sort:!0})},provide:n=>Mo.EditorView.decorations.from(n)})},xR=U4;function ix(t){t.registerEditorExtension(xR(t)),H4(t)}var j4=["cm-line","cm-content"],kR="mxError";function TR(t){if(!t.parentElement)return!1;let e=t.parentElement;return j4.some(n=>e.classList.contains(n))}function ER(){TR(this)&&(this.dataset[kR]="",this.removeEventListener("load",SR))}function SR(){TR(this)&&(delete this.dataset[kR],this.removeEventListener("error",ER))}function H4(t){t.register(dt(window,{createEl:e=>function(){let n=e.apply(this,arguments);return n instanceof HTMLImageElement&&(n.addEventListener("error",ER,{once:!0}),n.addEventListener("load",SR,{once:!0})),n}}))}var q4=require("obsidian");function PR(t,e){let{app:n}=e;return new Promise(i=>{function r(){let s=n.workspace.getLeavesOfType(t)[0];return s?(i(s.view),!0):!1}n.workspace.onLayoutReady(()=>{if(r())return;let s=()=>{r()&&n.workspace.off("layout-change",s)};n.workspace.on("layout-change",s),e.register(()=>n.workspace.off("layout-change",s))})})}function Um(t){return t.constructor.prototype}function rx(t){t.getLeavesOfType("markdown").forEach(async e=>{let n=e.getViewState();await e.setViewState({type:"empty"}),await e.setViewState(n)})}function ax(t){B4.call(this,t),W4.call(this),ix(this)}function B4(t){let{app:e}=this;["video","audio"].forEach(r=>{let s=Tt[r],a=i(s),o=n(s,t);this.register(()=>{o(),a()})}),rx(e.workspace),this.register(()=>{rx(e.workspace)});function n(r,s){return e.embedRegistry.registerExtensions(r,s),()=>{e.embedRegistry.unregisterExtensions(r)}}function i(r){let s=r.map(a=>e.embedRegistry.embedByExtension[a]);return e.embedRegistry.unregisterExtensions(r),()=>{r.forEach((a,o)=>{let l=s[o];l&&e.embedRegistry.registerExtension(a,l)})}}}var sx=class extends $o{constructor(n,i,r){super(i,r);this.info=n;this.containerEl=i;this.plugin=r;i.addClasses(["mx-external-media-embed"])}onload(){this.setSource(this.info),super.onload()}};function W4(){let t=this;this.registerMarkdownPostProcessor((e,n)=>{for(let r of e.querySelectorAll("img")){let s=K4(r);s&&i(s,r)}for(let r of e.querySelectorAll('iframe.external-embed[src*="youtube.com/embed/"]')){let s=n.getSectionInfo(r)?.text,a=G4(s)??Y4(r);!a||!this.resolveUrl(a.url)||i(a,r)}function i(r,s){let a=t.resolveUrl(r.url);if(!a||!Co(a,t))return;let o=createDiv({cls:["media-embed","external-embed","is-loaded"],attr:{src:a.href}});Vm(o,r),s.replaceWith(o);let l=new sx(a,o,t);n.addChild(l)}})}function K4(t){let e=t.alt,n=t.src;return n?{url:n,...ju(e)}:null}function G4(t){if(!t)return null;let e=t.match(/!\[(?<alt>[^\]]*)\]\((?<src>[^)]+)\)/);if(!e)return null;let{alt:n,src:i}=e.groups;return i?{url:i,...ju(n)}:null}function Y4(t){console.warn("cannot get source text of iframe, use src instead");let e=t.src;return e?{url:e,title:Wf(e),size:null}:null}function ox({onExternalLinkClick:t}){let e=this;return PR("markdown",e).then(n=>{if(!n.editMode){console.error("MarkdownView.editMode is not available, cannot patch editor click");return}e.register(dt(Um(n.editMode),{triggerClickableToken:i=>async function(r,s,...a){let o=()=>i.call(this,r,s,...a);if(t&&r.type==="external-link")try{await t.call(e,r.text,ur(s),o)}catch(l){console.error("onExternalLinkClick error in editor, fallback to default",l),o()}else o()}})),console.debug("editor click patched")})}var CR=require("obsidian");function lx(){let t=n=>{let i=n.target;if(!i.instanceOf(HTMLElement)||!i.matches(".metadata-property .metadata-property-value .external-link"))return;let r=i.closest(".metadata-property");if(!r)return;let s=r.dataset.propertyKey;if(!rR.includes(s))return;let a=this.resolveUrl(i.textContent);a&&(n.stopImmediatePropagation(),this.leafOpener.openMedia(a,ad(n),{fromUser:!0}))},e=dt(CR.MarkdownView.prototype,{onload:n=>function(){return this.registerDomEvent(this.containerEl,"click",t,{capture:!0}),n.call(this)}});this.register(()=>{e(),this.app.workspace.getLeavesOfType("markdown").forEach(n=>n.view.containerEl.removeEventListener("click",t))})}var $R=require("obsidian");function cx({onInternalLinkClick:t}){let e=this;this.register(dt($R.Workspace.prototype,{openLinkText:n=>async function(i,r,s,a,...o){let l=()=>n.call(this,i,r,s,a,...o);try{await t.call(e,i,r,ur(s),l)}catch(c){console.error("onInternalLinkClick error in openLinktext, fallback to default",c),l()}}}))}function ux(){this.registerMarkdownPostProcessor(t=>t.querySelectorAll("a").forEach(e=>{let n=e.getAttr("aria-label");if(n)try{let i=decodeURI(n);n!==i&&e.setAttr("aria-label",i)}catch{}}))}var MR=require("obsidian");function dx(t){let e=this,n=dt(MR.MarkdownPreviewRenderer,{registerDomEvents:i=>function(r,s,...a){return Q4(s,t,e),n(),console.debug("preview click patched"),i.call(this,r,s,...a)}});e.register(n)}function Q4(t,{onExternalLinkClick:e},n){n.register(dt(Um(t),{onExternalLinkClick:i=>async function(r,s,a,...o){let l=()=>i.call(this,r,s,a,...o);if(!e)return l();r.preventDefault();try{await e.call(n,a,ad(r),l)}catch(c){console.error("onExternalLinkClick error in preview, fallback to default",c),l()}}}))}function px(t,e,n){let{app:i}=this;this.registerView(t,e),this.register(r(n)),this.registerExtensions(n,t);function r(s){let a=s.map(o=>({ext:o,type:i.viewRegistry.typeByExtension[o]}));return i.viewRegistry.unregisterExtensions(s),()=>{X4(a,"type").forEach((o,l)=>{l&&i.viewRegistry.registerExtensions(o.map(c=>c.ext),l)})}}}function X4(t,e){return t.reduce((n,i)=>{let r=i[e],s=n.get(r);return s?s.push(i):n.set(r,[i]),n},new Map)}var RR=require("obsidian");function LR(t){return t?(t=t instanceof URL?t:Bn(t),RR.Platform.isWin||!t||t.protocol!=="file:"||!t.pathname.includes("%5C")||(t.pathname=t.pathname.replaceAll(/%5C/g,"/")),t):null}var UR=$(Hm()),Ye=require("obsidian");var AR=()=>(...t)=>t;var NR=require("obsidian");var DR={6:"240P \u6781\u901F",16:"360P \u6D41\u7545",32:"480P \u6E05\u6670",64:"720P \u9AD8\u6E05",74:"720P60 \u9AD8\u5E27\u7387",80:"1080P \u9AD8\u6E05",112:"1080P+ \u9AD8\u7801\u7387",116:"1080P60 \u9AD8\u5E27\u7387",120:"4K \u8D85\u6E05",125:"HDR \u771F\u5F69\u8272",126:"\u675C\u6BD4\u89C6\u754C",127:"8K \u8D85\u9AD8\u6E05"};async function hx(t,e){await t.cookies.set({url:"https://www.bilibili.com",domain:".bilibili.com",path:"/",name:"CURRENT_QUALITY",value:e.toString(),expirationDate:Date.now()+1e3*60*60*24*365})}var OR=AR()("defaultVolume","urlMappingData","devices","defaultMxLinkClick","linkHandler","loadStrategy","timestampTemplate","screenshotTemplate","screenshotEmbedTemplate","insertBefore","timestampOffset","biliDefaultQuality","screenshotFormat","screenshotQuality","defaultLanguage","screenshotFolderPath"),VR={defaultVolume:80,urlMappingData:[],devices:[],defaultMxLinkClick:{click:"split",alt:"window"},linkHandler:{"mx-embed":[],"mx-url-audio":[],"mx-url-video":[],"mx-webpage":[]},loadStrategy:"eager",timestampTemplate:`
- {{TIMESTAMP}} `,screenshotEmbedTemplate:"{{TITLE}}{{DURATION}}|50",screenshotTemplate:`
- !{{SCREENSHOT}} {{TIMESTAMP}} `,insertBefore:!1,timestampOffset:0,biliDefaultQuality:80,screenshotFormat:"image/webp"};function FR(){return Ye.Platform.isDesktopApp?require("os").hostname()||(Ye.Platform.isMacOS?"Mac":Ye.Platform.isWin?"Windows":Ye.Platform.isLinux?"Linux":"Desktop"):Ye.Platform.isIosApp?Ye.Platform.isPhone?"iPhone":Ye.Platform.isTablet?"iPad":"iOS Device":Ye.Platform.isAndroidApp?Ye.Platform.isPhone?"Android Phone":Ye.Platform.isTablet?"Android Tablet":"Android Device":"Unknown Device"}function zR(t){return new Map(t.map(e=>[`${e.appId}%${e.protocol}`,e.replace]))}function Z4(t){return Array.from(t.entries()).map(([e,n])=>{let[i,r]=e.split("%");return{appId:i,protocol:r,replace:n}}).filter(e=>e.appId&&e.protocol&&e.replace)}function jR(t){let e=(0,Ye.debounce)(n=>{let i=mg(n,OR);t.saveData({...i,urlMappingData:n.getUrlMappingData()})},1e3);return $p((n,i)=>({...ed(VR,["urlMappingData"]),setScreenshotFormat(r){n({screenshotFormat:r}),e(i())},setScreenshotQuality(r){n({screenshotQuality:r??void 0}),e(i())},setDefaultLanguage(r){n({defaultLanguage:r?.format()}),e(i())},getDefaultLang(){let r=i().defaultLanguage,s=Ye.moment.locale();return r&&!fb(r)?(new Ye.Notice(`Invalid language code detected in preferences: ${r}, reverting to ${s}.`),n({defaultLanguage:void 0}),e(i()),s):r??Ye.moment.locale()},getUrlMappingData(){return Z4(i().urlMapping)},setBiliDefaultQuality(r){n({biliDefaultQuality:r}),e(i())},setInsertPosition(r){n({insertBefore:r==="before"}),e(i())},setLinkHandler(r,s){n(a=>{let o={...a.linkHandler};for(let l of Object.keys(o)){let c=l;o[c]=o[c].filter(u=>typeof u=="string"?u!==r:typeof r=="string"||!J4(u,r)),c===s&&(o[c]=[...o[c],r])}return{linkHandler:o}}),e(i())},setTimestampOffset(r){n({timestampOffset:r}),e(i())},setDefaultMxLinkBehavior:r=>{let s;r==="split"||r==="split-horizontal"?s="window":r==="window"?s="tab":r==="tab"?s="split":s=null,n({defaultMxLinkClick:{click:r,alt:s}}),e(i())},setTemplate(r,s){switch(r){case"screenshot":n({screenshotTemplate:s});break;case"screenshotEmbed":n({screenshotEmbedTemplate:s});break;case"timestamp":n({timestampTemplate:s});break;default:(0,UR.assertNever)(r)}e(i())},setMxLinkAltBehavior:r=>{n(({defaultMxLinkClick:s})=>({defaultMxLinkClick:{...s,alt:r}})),e(i())},urlMapping:zR(VR.urlMappingData),setDefaultVolume:r=>{n({defaultVolume:r}),e(i())},getUrlMapping:r=>i().urlMapping.get(`${t.app.appId}%${r}`),setUrlMapping:(r,s)=>{if(r.includes("%"))throw new Error("Protocol cannot contain %");let a=`${t.app.appId}%${r}`;n(o=>({urlMapping:new Map(o.urlMapping).set(a,s),devices:o.getDeviceName()?o.devices:[...o.devices,{appId:t.app.appId,name:FR()}]})),e(i())},removeUrlMapping:r=>{if(r.includes("%"))throw new Error("Protocol cannot contain %");n(s=>{let a=`${t.app.appId}%${r}`,o=new Map(s.urlMapping);return o.delete(a),{urlMapping:o}}),e(i())},getDeviceName(r=t.app.appId){return i().devices.find(s=>s.appId===r)?.name},getDeviceNameWithDefault(r=t.app.appId){let s=i().devices.find(a=>a.appId===r);return s?s.name:r===t.app.appId?FR():"Unknown Device"},setDeviceName(r,s=t.app.appId){n({devices:[...i().devices.filter(a=>a.appId!==s),{appId:s,name:r}]}),e(i())},setLoadStrategy:r=>{n({loadStrategy:r}),e(i())},setScreenshotFolder(r){r!==null?(r=(0,Ye.normalizePath)(r),r==="."?r="/":r.startsWith("./")&&(r=r.slice(2)),n({screenshotFolderPath:r})):n({screenshotFolderPath:void 0})},load:async()=>{let r=await t.loadData();if(!r)return;let{urlMappingData:s,...a}=mg(r,OR);n({...a,urlMapping:zR(s??[])})},save:()=>{e(i())}}))}function J4(t,e){let n=new Set([...Object.keys(t),...Object.keys(e)]);for(let i of n)if(t[i]!==e[i])return!1;return!0}var BR=require("url"),mx=$(pb()),Z=require("obsidian");var Bm=class extends Z.PluginSettingTab{constructor(n){super(n.app,n);_(this,"plugin");this.plugin=n}get state(){return this.plugin.settings.getState()}get sub(){return this.plugin.settings.subscribe.bind(this.plugin.settings)}protocol(){new Z.Setting(this.containerEl).setHeading().setName("Protocols").setDesc("Create custom protocols that resolve link per device");let n=this.containerEl.createDiv({cls:"mx-protocol-container"});new Z.Setting(n).setHeading().setName("This device").addText(o=>o.setPlaceholder(this.state.getDeviceNameWithDefault()).setValue(this.state.getDeviceName()??"").onChange(l=>this.state.setDeviceName(l))).addExtraButton(o=>o.setIcon("plus").setTooltip("Add new protocol").onClick(()=>{let l=new Z.Menu().addItem(c=>c.setIcon("link").setTitle("Link mapping").onClick(()=>{let u=r({protocol:"",replace:"https://"});i.insertAdjacentElement("afterbegin",u.settingEl)}));Z.Platform.isDesktopApp&&l.addItem(c=>c.setIcon("folder").setTitle("Folder mapping").onClick(async()=>{let u=(await nd().showOpenDialog({title:"Pick a folder",message:"Pick a folder to resolve media files from",buttonLabel:"Pick",properties:["openDirectory"]})).filePaths[0];if(!u)return;let d=r({protocol:"",replace:(0,BR.pathToFileURL)(u).href});i.insertAdjacentElement("afterbegin",d.settingEl)})),Zs(o.extraSettingsEl,l)}));let i=n.createDiv({cls:"mx-protocol-list"}),r=o=>new Z.Setting(i).then(l=>{let c=o.protocol,u=new Z.TextComponent(l.controlEl).setPlaceholder("Protocol name").setValue(c).onChange(h=>{if(!h)return;let y=c;c=h,this.state.removeUrlMapping(y);let v=p.getValue();v&&this.state.setUrlMapping(h,v)}),d="Target URL prefix";if(o.devices){d="Configured in ";let h=o.devices.filter(y=>!!y).slice(0,2);h.length>0?(d+=h.join(", "),h.length<o.devices.length&&(d+=", ...")):(d+="unknown device",o.devices.length>1&&(d+="s"))}let p=new Z.TextComponent(l.controlEl).setPlaceholder(d).setValue(o.replace).onChange(h=>{u.getValue()&&this.state.setUrlMapping(u.getValue(),h)});u.inputEl.addClass("mx-protocol-input"),p.inputEl.addClass("mx-replace-input"),l.addExtraButton(h=>h.setIcon("trash").setTooltip(`Remove ${u.getValue()||"empty"} protocol`).onClick(()=>{this.state.removeUrlMapping(u.getValue()),l.settingEl.remove()}))}),s=this.state.getUrlMappingData();[...new Set(s.map(o=>o.protocol))].sort().forEach(o=>{r({protocol:o,devices:s.filter(l=>l.protocol===o&&l.appId!==this.plugin.app.appId).map(l=>this.state.devices.find(c=>c.appId===l.appId)?.name??null),replace:this.state.getUrlMapping(o)??""})})}linkOpen(){let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Link open").setDesc("Configure how links to media are opened");let i={default:"Default obsidian behavior",replace:"In current pane",split:"New pane on the right","split-horizontal":"New pane on the bottom",tab:"New tab",window:"New window"},r=c=>{switch(c){case"split":case"split-horizontal":return Z.Platform.isMacOS?"click holding \u2318+\u2325":"click holding Ctrl+Alt";case"window":return Z.Platform.isMacOS?"click holding \u2318+\u2325+\u21E7":"click holding Ctrl+Alt+Shift";case"tab":default:return Z.Platform.isMacOS?"click holding \u2318 or middle-click":"middle-click or click holding Ctrl"}},s=c=>c===null?"default":c===!1?"replace":c,a=c=>{switch(c){case"replace":return!1;case"split":case"tab":case"window":return c;case"split-horizontal":return"split-horizontal";default:return null}};new Z.Setting(n).setName("Default link click").setDesc("Configure how links to media are opened").addDropdown(c=>c.addOptions(i).setValue(s(this.state.defaultMxLinkClick.click)).onChange(u=>this.state.setDefaultMxLinkBehavior(a(u))).then(()=>this.sub((u,d)=>{u.defaultMxLinkClick.click!==d.defaultMxLinkClick.click&&c.setValue(s(u.defaultMxLinkClick.click))})));let o=new Z.Setting(n).setName("Altnernative behavior").addDropdown(c=>c.addOptions(i).setValue(s(this.state.defaultMxLinkClick.alt)).onChange(u=>this.state.setMxLinkAltBehavior(a(u))).then(()=>this.sub((u,d)=>{u.defaultMxLinkClick.alt!==d.defaultMxLinkClick.alt&&c.setValue(s(u.defaultMxLinkClick.alt))})));function l(c){let u=r(c);o.setDesc("Configure link open behavior"+u?` when ${u}`:"")}l(this.state.defaultMxLinkClick.click),this.sub((c,u)=>{c.defaultMxLinkClick!==u.defaultMxLinkClick&&l(c.defaultMxLinkClick.click)})}playback(){let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Playback"),new Z.Setting(n).setName("Default volume").setDesc("The default volume for media files").addSlider(a=>a.setLimits(0,100,1).setValue(this.state.defaultVolume).onChange(this.state.setDefaultVolume).then(o=>{this.sub((l,c)=>{l.defaultVolume!==c.defaultVolume&&o.setValue(l.defaultVolume)})})).addText(a=>a.setValue(qm(this.state.defaultVolume)).onChange(HR(this.state.setDefaultVolume)).then(o=>{fx.call(o,0,100,1),o.inputEl.type="number",o.inputEl.style.textAlign="center",this.sub((l,c)=>{l.defaultVolume!==c.defaultVolume&&o.setValue(qm(l.defaultVolume))})})).then(a=>a.controlEl.appendText("%")),new Z.Setting(n).setName("Load strategy").setDesc(createFragment(a=>{a.appendText("Configure when media embeds are loaded in the note"),a.createEl("br"),a.appendText("Useful if you want lazy load media embeds in a note when there are many of them")})).addDropdown(a=>a.addOption("eager","On note open").addOption("play","When interacted with").setValue(this.state.loadStrategy).onChange(o=>this.state.setLoadStrategy(o)));let i="_follow_",r=BC(),s=Object.fromEntries(mx.default.getAllCodes().flatMap(a=>r.has(a)?[...r.get(a).values()]:[[a,mx.default.getNativeName(a)]]));new Z.Setting(n).setName("Default locale").setDesc("The default locale for subtitles").addDropdown(a=>a.addOption(i,"Follow obsidian locale").addOptions(s).setValue(this.state.defaultLanguage??i).onChange(o=>this.state.setDefaultLanguage(o===i?null:o)))}timestamp(){let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Timestamp"),new Z.Setting(n).setName("Timestamp template").setDesc(createFragment(i=>{i.appendText("The template used to insert timestamps."),i.createEl("br"),i.appendText("Supported placeholders: {{TIMESTAMP}}")})).addTextArea(i=>{i.setValue(this.state.timestampTemplate).onChange(r=>this.state.setTemplate("timestamp",r)),i.inputEl.rows=5,i.inputEl.cols=40}),new Z.Setting(n).setName("Timestamp offset").setDesc("Offset in seconds to add to the timestamp").addSlider(i=>i.setLimits(-10,10,.01).setValue(this.state.timestampOffset).onChange(this.state.setTimestampOffset).then(r=>{this.sub((s,a)=>{s.timestampOffset!==a.timestampOffset&&r.setValue(s.timestampOffset)})})).addText(i=>i.setValue(qm(this.state.timestampOffset)).onChange(qR(this.state.setTimestampOffset)).then(r=>{fx.call(r,-10,10,.01),r.inputEl.type="number",r.inputEl.style.textAlign="center",this.sub((s,a)=>{s.timestampOffset!==a.timestampOffset&&r.setValue(qm(s.timestampOffset))})})).then(i=>i.controlEl.appendText("s"))}screenshot(){let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Screenshot"),new Z.Setting(n).setName("Screenshot linktext template").setDesc(createFragment(r=>{r.appendText("The template used to create screenshot linktext."),r.createEl("br"),r.appendText("Supported placeholders: {{DURATION}}, {{TITLE}}"),r.createEl("br"),r.appendText("Remove `|50` suffix to embed image in full size")})).addTextArea(r=>{r.setValue(this.state.screenshotEmbedTemplate).onChange(s=>this.state.setTemplate("screenshotEmbed",s)),r.inputEl.rows=5,r.inputEl.cols=40}),new Z.Setting(n).setName("Screenshot template").setDesc(createFragment(r=>{r.appendText("The template used to insert screenshot."),r.createEl("br"),r.appendText("Supported placeholders: "),r.createEl("ul",{},s=>{s.createEl("li").appendText("{{TIMESTAMP}} - timestamp link"),s.createEl("li",{},a=>{a.appendText("{{SCREENSHOT}} - link to screenshot"),a.createEl("br"),a.appendText("add `!` prefix to insert as image embed")})})})).addTextArea(r=>{r.setValue(this.state.screenshotTemplate).onChange(s=>this.state.setTemplate("screenshot",s)),r.inputEl.rows=5,r.inputEl.cols=40}),new Z.Setting(n).setName("Screenshot format").setDesc(createFragment(r=>{r.appendText("The format to use when taking screenshots"),r.createEl("br"),r.appendText("Note that the webp format falls back to jpeg in iOS or iPadOS")})).addDropdown(r=>r.addOptions({"image/png":"PNG","image/jpeg":"JPEG","image/webp":"WEBP"}).setValue(this.state.screenshotFormat).onChange(s=>this.state.setScreenshotFormat(s))),new Z.Setting(n).setName("Default location for new screenshots").setDesc("Where newly added attachments are placed.").addDropdown(r=>r.addOptions({default:"In attachment folder",specific:"In the folder specified below"}).onChange(s=>{this.state.setScreenshotFolder(s==="specific"?"":null)})),new Z.Setting(n).setName("Attachment folder path").setDesc("Place newly created screenshot files in this folder.").addText(r=>r.setPlaceholder("Example: folder 1/folder").setValue(this.state.screenshotFolderPath??"").onChange(this.state.setScreenshotFolder)).then(r=>{r.settingEl.style.display=this.state.screenshotFolderPath!==void 0?"":"none",this.sub((s,a)=>{typeof s.screenshotFolderPath!=typeof a.screenshotFolderPath&&(r.settingEl.style.display=s.screenshotFolderPath!==void 0?"":"none")})});let i=r=>r.screenshotFormat==="image/webp"?.8:.92;new Z.Setting(n).setName("Screenshot quality").setDesc("Quality of the screenshot").addText(r=>r.setValue(this.state.screenshotQuality?.toString()??"").setPlaceholder(i(this.state).toString()).onChange(qR(this.state.setScreenshotQuality)).then(s=>{fx.call(s,0,1,.01),s.inputEl.type="number",s.inputEl.style.textAlign="center",this.sub((a,o)=>{a.screenshotFormat!==o.screenshotFormat&&s.setPlaceholder(i(this.state).toString()),a.screenshotQuality!==o.screenshotQuality&&s.setValue(a.screenshotQuality?.toString()??"")})})).addButton(r=>r.setTooltip("Reset to default").setIcon("reset").onClick(()=>{this.state.setScreenshotQuality(null)}).setDisabled(this.state.screenshotQuality===null).then(()=>{this.sub((s,a)=>{s.screenshotQuality!==a.screenshotQuality&&r.setDisabled(s.screenshotQuality===null)})})).then(r=>{this.sub((s,a)=>{s.screenshotFormat!==a.screenshotFormat&&(r.settingEl.style.display=s.screenshotFormat==="image/png"?"none":"")})})}noteTaking(){let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Note taking"),new Z.Setting(n).setDesc("Configure where timestamps and screenshots are inserted").setName("Insert location").addDropdown(i=>i.addOption("before","Latest content on top").addOption("after","Latest content at end").setValue(this.state.insertBefore===!0?"before":"after").onChange(r=>this.state.setInsertPosition(r))),this.timestamp(),this.screenshot()}webpage(){if(!Z.Platform.isDesktopApp)return;let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Webpage"),new Z.Setting(n).setName("Login").setDesc("If website requires login to access content or request login during playback, you can open a browser page here to login.").addButton(i=>i.setCta().setButtonText("Open broswer").onClick(()=>{new cr(this.app).open()}))}bilibili(){let{containerEl:n}=this;new Z.Setting(n).setHeading().setName("Bilibili"),new Z.Setting(n).setName("Default quality").setDesc(createFragment(i=>{i.appendText("The default quality for bilibili videos, will fallback to closest quality if not available"),i.createEl("br"),i.appendText("Only new videos will use this quality")})).addDropdown(i=>i.addOptions(DR).setValue(this.state.biliDefaultQuality.toString()).onChange(HR(r=>this.state.setBiliDefaultQuality(r))))}display(){let{containerEl:n}=this;n.empty(),this.webpage(),this.playback(),this.noteTaking(),this.linkOpen(),this.protocol(),this.bilibili()}};function HR(t){return e=>t(parseInt(e,10))}function qR(t){return e=>t(parseFloat(e))}function qm(t){return t.toString()}function fx(t,e,n){return this.inputEl.min=t.toString(),this.inputEl.max=e.toString(),this.inputEl.step=n.toString(),this}var QR=require("url"),vx=$(Hm()),Fe=require("obsidian");var WR=require("obsidian");async function gx(t){if(!WR.Platform.isDesktopApp)throw new Error("Not supported in web");let e=await nd().showOpenDialog({title:"Pick a media file",message:"Pick a media file to open",buttonLabel:"Pick",properties:["openFile"],filters:[{extensions:Tt.video,name:"Video"},{extensions:Tt.audio,name:"Audio"}],defaultPath:t});return e.canceled?null:e.filePaths[0]??null}var KR=require("url"),GR=require("obsidian");var Wm=class t extends GR.FuzzySuggestModal{constructor(n){super(n.app);this.plugin=n;_(this,"resolve",ql)}static choose(n){return new Promise(i=>{let r=new t(n);r.open(),r.resolve=i})}getItems(){return this.plugin.settings.getState().getUrlMappingData().filter(n=>n.appId===this.app.appId&&n.replace.startsWith("file://")).map(n=>({action:n.protocol,path:(0,KR.fileURLToPath)(n.replace),url:n.replace}))}getItemText(n){return`mx://${n.action}: ${n.path}`}onChooseItem(n){this.resolve(n)}onClose(){super.onClose(),setTimeout(()=>{this.resolve(null)},0)}};var e6=/^av(?<id>\d+)$/i,t6=/^BV1(?<id>[1-9A-HJ-NP-Za-km-z]{9})$/,n6=/^[\w-]{11}$/,i6=/^(?:(?:[a-zA-Z\d]|[a-zA-Z\d][a-zA-Z\d-]*[a-zA-Z\d])\.)*(?:[A-Za-z\d]|[A-Za-z\d][A-Za-z\d-]*[A-Za-z\d])$/;function yx(t){try{return(0,QR.pathToFileURL)(t)}catch(e){return console.error(`Failed to convert path ${t} to URL: `,e),null}}function YR(t){let e=ii.isAbsolute(t)?yx(t):Bn(t);return!e||["http:","https:"].includes(e.protocol)&&!i6.test(e.hostname)?null:e}var Km=class extends Fe.SuggestModal{constructor(n){super(n.app);this.plugin=n;this.inputEl.addEventListener("drop",i=>{if(!i.dataTransfer||i.dataTransfer.files.length===0)return;let r=[...i.dataTransfer.files],s=[...i.dataTransfer.files].filter(l=>en(ii.extname(l.name)));if(s.length===0){new Fe.Notice(`Cannot open dropped file${r.length>1?"s":""}, not supported media file type`);return}let a=s[0];i.preventDefault();let o=i.target;o.value=a.path,o.dispatchEvent(new Event("input"))}),this.setPlaceholder("Enter file path, URL or media id, or drop a media file here"),this.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to open url"},{command:Fe.Platform.isMacOS?"\u2318 \u21B5":"ctrl \u21B5",purpose:"to open in new tab"},{command:Fe.Platform.isMacOS?"\u2318 \u2325 \u21B5":"ctrl alt \u21B5",purpose:"to open to the right"},{command:"esc",purpose:"to dismiss"}]),this.scope.register(null,"Enter",i=>(this.chooser.useSelectedItem(i),!1))}getSuggestions(n){let i=YR(n),r=[];if(!i){let o;if((o=n.match(e6))&&r.push(new URL(`https://www.bilibili.com/video/av${o.groups.id}`)),(o=n.match(t6))&&r.push(new URL(`https://www.bilibili.com/video/${n}`)),(o=n.match(n6))&&r.push(new URL(`https://www.youtube.com/watch?v=${n}`)),!o){let l=YR(`https://${n}`);l&&r.push(l)}}let s=r.map(o=>_t.create(o.href)).filter(o=>!!o),a=this.plugin.resolveUrl(i?.href);return a?[a,...s]:s}onNoSuggestion(){super.onNoSuggestion(),this.chooser.setSuggestions(["file-picker","file-protocol-picker"])}renderSuggestion(n,i){n instanceof _t?i.setText(decodeURI(n.href)):n==="file-picker"?i.setText("Open local file"):n==="file-protocol-picker"?i.setText("Pick from folders defined in custom protocol"):(0,vx.assertNever)(n)}async onChooseSuggestion(n,i){let r;if(n==="file-protocol-picker"){let a=await Wm.choose(this.plugin);if(!a)return;let o=await gx(a.path);if(!o)return;if(!o.startsWith(a.path)){new Fe.Notice(`For protocol ${a.action}, the file must be in ${a.path}`);return}let l=yx(o);if(!l)return;let c=this.plugin.resolveUrl(l.href.replace(a.url.replace(/\/*$/,"/"),`mx://${a.action}/`));if(!c){new Fe.Notice(`Failed to resolve file protocol url: ${l.href} with ${a.url}`);return}r=c}else if(n==="file-picker"){let a=await gx();if(!a)return;let o=yx(a);if(!o)return;r=new _t(o.href)}else n instanceof _t?r=n:(0,vx.assertNever)(n);if(r.isFileUrl){if(!r.inferredType){new Fe.Notice("Unsupported file type: "+r.pathname);return}if(r.hostname){new Fe.Notice(`Network path is not supported in obsidian, you need to map it to a local path: ${r.filePath??r.readableHref}`);return}}let s=r.getVaultFile(this.plugin.app.vault);if(s){let a=en(s.extension);if(!a){new Fe.Notice("Unsupported file type: "+s.path);return}r={file:s,hash:r.hash,type:a}}else if(r.isFileUrl){let a=Vx();if(!a){new Fe.Notice("File path is only supported in desktop app");return}try{if(!(await a.stat(r)).isFile()){new Fe.Notice("Not a file: "+r.readableHref);return}}catch(o){let l=o,c=r.filePath??r.href;l.code==="ENOENT"?new Fe.Notice("File not found: "+c):l.code==="EACCES"?new Fe.Notice("Permission denied: "+c):new Fe.Notice(`Failed to access file (${l.code}): `+c);return}}console.debug("media selected",r),Fe.Keymap.isModifier(i,"Mod")&&Fe.Keymap.isModifier(i,"Alt")?this.plugin.leafOpener.openMedia(r,"split",{direction:"vertical"}):Fe.Keymap.isModifier(i,"Mod")?this.plugin.leafOpener.openMedia(r,"tab"):this.plugin.leafOpener.openMedia(r,!1)}};var Hu=require("obsidian");var XR="mx-open";function ZR(t){window.OBS_ACT&&t.register(dt(window,{OBS_ACT:i=>function(s){if(s.action.startsWith(XR+"/")){e(s);return}return i.apply(this,arguments)}})),t.registerObsidianProtocolHandler("mx-open",async i=>{let r=Bn(i.url);if(!r){new Hu.Notice("Invalid URL: "+i.url);return}await n(r)});async function e(i){let r=i.action.substring(XR.length+1),s=Bn(r),a=new URLSearchParams(i);if(a.delete("action"),!s){new Hu.Notice("Invalid URL: "+r+"?"+a.toString());return}s.search=a.toString(),await n(s)}async function n(i){let r=_t.create(i);if(!r){new Hu.Notice("Invail URL: "+i.href);return}new Hu.Notice(createFragment(s=>{s.appendText(`Opening ${r.type} ${r.inferredType??"content"} from browser: `),s.createEl("br"),s.createEl("a",{text:i.href.length>50?i.href.slice(0,25)+"..."+i.href.slice(-25):i.href,href:i.href})})),await t.leafOpener.openMedia(r,"tab")}}function JR(t){function e(){new Km(t).open()}t.addCommand({id:"open-media-switcher",name:"Open media",icon:"play",callback:e}),t.addRibbonIcon("play","Open media",e),ZR(t)}var bx=(t,e)=>e.some(n=>t instanceof n),eL,tL;function r6(){return eL||(eL=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function s6(){return tL||(tL=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var xx=new WeakMap,_x=new WeakMap,Gm=new WeakMap;function a6(t){let e=new Promise((n,i)=>{let r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(Ks(t.result)),r()},a=()=>{i(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",a)});return Gm.set(e,t),e}function o6(t){if(xx.has(t))return;let e=new Promise((n,i)=>{let r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",a),t.removeEventListener("abort",a)},s=()=>{n(),r()},a=()=>{i(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",a),t.addEventListener("abort",a)});xx.set(t,e)}var kx={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return xx.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ks(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function sL(t){kx=t(kx)}function l6(t){return s6().includes(t)?function(...e){return t.apply(Tx(this),e),Ks(this.request)}:function(...e){return Ks(t.apply(Tx(this),e))}}function c6(t){return typeof t=="function"?l6(t):(t instanceof IDBTransaction&&o6(t),bx(t,r6())?new Proxy(t,kx):t)}function Ks(t){if(t instanceof IDBRequest)return a6(t);if(_x.has(t))return _x.get(t);let e=c6(t);return e!==t&&(_x.set(t,e),Gm.set(e,t)),e}var Tx=t=>Gm.get(t);function aL(t,e,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){let a=indexedDB.open(t,e),o=Ks(a);return i&&a.addEventListener("upgradeneeded",l=>{i(Ks(a.result),l.oldVersion,l.newVersion,Ks(a.transaction),l)}),n&&a.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),o.then(l=>{s&&l.addEventListener("close",()=>s()),r&&l.addEventListener("versionchange",c=>r(c.oldVersion,c.newVersion,c))}).catch(()=>{}),o}var u6=["get","getKey","getAll","getAllKeys","count"],d6=["put","add","delete","clear"],wx=new Map;function nL(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(wx.get(e))return wx.get(e);let n=e.replace(/FromIndex$/,""),i=e!==n,r=d6.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||u6.includes(n)))return;let s=async function(a,...o){let l=this.transaction(a,r?"readwrite":"readonly"),c=l.store;return i&&(c=c.index(o.shift())),(await Promise.all([c[n](...o),r&&l.done]))[0]};return wx.set(e,s),s}sL(t=>({...t,get:(e,n,i)=>nL(e,n)||t.get(e,n,i),has:(e,n)=>!!nL(e,n)||t.has(e,n)}));var p6=["continue","continuePrimaryKey","advance"],iL={},Ex=new WeakMap,oL=new WeakMap,h6={get(t,e){if(!p6.includes(e))return t[e];let n=iL[e];return n||(n=iL[e]=function(...i){Ex.set(this,oL.get(this)[e](...i))}),n}};async function*f6(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;let n=new Proxy(e,h6);for(oL.set(n,e),Gm.set(n,Tx(e));e;)yield n,e=await(Ex.get(n)||e.continue()),Ex.delete(n)}function rL(t,e){return e===Symbol.asyncIterator&&bx(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&bx(t,[IDBIndex,IDBObjectStore])}sL(t=>({...t,get(e,n,i){return rL(e,n)?f6:t.get(e,n,i)},has(e,n){return rL(e,n)||t.has(e,n)}}));var Qm=require("obsidian");function m6(t,...e){return t.reduce((n,i,r)=>{let s=e[r],a=s!==void 0?JSON.stringify(s):"";return n+i+a},"")}var qu="mx:http_proxy",Sx={type:"player_v2",host:"api.bilibili.com",pathnames:["/x/player/v2","/x/player/wbi/v2"],filter:["https://api.bilibili.com/x/player/v2*","https://api.bilibili.com/x/player/wbi/v2*"],header:"player_v2",types:["xhr"]};function lL(t,e){let n=lr(e.appId);return n?m6`
const { session, webContents, net } = require("electron");
const webviewSession = session.fromPartition(${n});
const webContent = webContents.fromId(${t});
webviewSession.webRequest.onSendHeaders(
{
urls: ${Sx.filter}, type: ${Sx.types}
}, ({url, method, requestHeaders, webContentsId}) => {
if (method !== "GET" || webContentsId===undefined) return;
webContent.send(${qu}, {type:${Sx.type} ,url, method, requestHeaders, webContentsId});
})
`.trim():(console.log("partition disabled, cannot watch requests"),"")}async function cL(t,e){return g6(t.pipeThrough(new DecompressionStream("gzip")),e)}function uL(t){return new ReadableStream({start(e){e.enqueue(new Uint8Array(t)),e.close()}})}async function g6(t,e){let n=t.getReader(),i=[];for(;;){let{done:r,value:s}=await n.read();if(r)break;i.push(s)}return new Blob(i,{type:e})}function v6(t){return`${t.aid}-${t.bvid}-${t.cid}`}var Bu,Wu,Lo,Ym=class extends Qm.Component{constructor(n){super();this.plugin=n;V(this,Bu,Ip());V(this,Wu,new Map);V(this,Lo,new Map);_(this,"app");_(this,"db");this.app=n.app,this.db=aL(`mx-cache-${this.app.appId}`,1,{upgrade(i){i.createObjectStore("bili-subtitle")}}),this.app=n.app}async getPlayerApiResp(n,i=1e4){let{aid:r,bvid:s,cid:a}=await n.methods.bili_getManifest(),o=v6({aid:r,bvid:s,cid:a}),l=k(this,Wu).get(o);if(l)return l;let c=k(this,Lo).get(`${s}-${a}`)??k(this,Lo).get(`${r}-${a}`);c||(c=await new Promise((p,h)=>{let y=k(this,Bu).on("player_v2",w=>{a===w.cid&&(r===w.aid||s===w.bvid)&&(p(w.url),window.clearTimeout(v))}),v=window.setTimeout(()=>{y(),h(new Error("player_v2 timeout: "+o))},i)}));let u=await n.methods.fetch(c,{gzip:!1,credentials:"include"});if(u.type!=="application/json")throw new Error(`Unexpected response type ${u.type} for player_v2 api`);let d=JSON.parse(new TextDecoder().decode(u.ab));if(d.code!==0)throw new Error(`player_v2 api error: (${d.code}) ${d.message}`);return k(this,Wu).set(o,d.data),d.data}async cacheSubtitle(n,i){(await this.db).put("bili-subtitle",i,n.toString())}async getCachedSubtitle(n){let r=await(await this.db).get("bili-subtitle",n.toString());if(!r)return null;let{ab:s,gzip:a}=r,o="application/json",c=await(a?await cL(uL(s),o):new Blob([s],{type:o})).text();return JSON.parse(c)}async hasSubtitle(n){return await(await this.db).count("bili-subtitle",n.toString())>0}async onload(){if(!Qm.Platform.isDesktopApp)throw new Error("Cannot register ipc events, not in desktop app");let n=require("path"),i=require("fs/promises"),{ipcRenderer:r}=require("electron"),s=require("@electron/remote"),a=(o,l)=>{if(l.type!=="player_v2")return;let c=new URL(l.url),u=c.searchParams.get("aid"),d=c.searchParams.get("bvid"),p=c.searchParams.get("cid");if(!u&&!d||!p)return;k(this,Bu).emit("player_v2",{url:l.url,aid:+u,bvid:d,cid:+p});let h=d?`${d}-${p}`:`${u}-${p}`;k(this,Lo).set(h,l.url)};r.on(qu,a);try{let o=s.getCurrentWebContents().id,l=lL(o,this.app),c=n.join(this.app.vault.adapter.getBasePath(),...this.app.vault.configDir.split("/"),`mx-player-hack.${Date.now()}.js`);await i.writeFile(c,l,"utf-8");try{await s.require(c),console.log("mx-player-hack loaded")}finally{await i.rm(c,{force:!0,maxRetries:5})}this.register(()=>{r.off(qu,a)})}catch(o){throw r.off(qu,a),o}}};Bu=new WeakMap,Wu=new WeakMap,Lo=new WeakMap;var dL=require("obsidian");async function pL(){if(!dL.Platform.isDesktopApp)return;let t=Go(this.app.appId);t&&(this.settings.subscribe((e,n)=>{e.biliDefaultQuality!==n.biliDefaultQuality&&hx(t,e.biliDefaultQuality)}),await hx(t,this.settings.getState().biliDefaultQuality))}var OL=$(Hm()),dg=require("obsidian");var Qu=class{constructor(t,e,n,i,r,s){_(this,"type",3);_(this,"name","");_(this,"prefix","");_(this,"value","");_(this,"suffix","");_(this,"modifier",3);this.type=t,this.name=e,this.prefix=n,this.value=i,this.suffix=r,this.modifier=s}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},y6=/[$_\p{ID_Start}]/u,_6=/[$_\u200C\u200D\p{ID_Continue}]/u,Cx=".*";function w6(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function vL(t,e=!1){let n=[],i=0;for(;i<t.length;){let r=t[i],s=function(a){if(!e)throw new TypeError(a);n.push({type:"INVALID_CHAR",index:i,value:t[i++]})};if(r==="*"){n.push({type:"ASTERISK",index:i,value:t[i++]});continue}if(r==="+"||r==="?"){n.push({type:"OTHER_MODIFIER",index:i,value:t[i++]});continue}if(r==="\\"){n.push({type:"ESCAPED_CHAR",index:i++,value:t[i++]});continue}if(r==="{"){n.push({type:"OPEN",index:i,value:t[i++]});continue}if(r==="}"){n.push({type:"CLOSE",index:i,value:t[i++]});continue}if(r===":"){let a="",o=i+1;for(;o<t.length;){let l=t.substr(o,1);if(o===i+1&&y6.test(l)||o!==i+1&&_6.test(l)){a+=t[o++];continue}break}if(!a){s(`Missing parameter name at ${i}`);continue}n.push({type:"NAME",index:i,value:a}),i=o;continue}if(r==="("){let a=1,o="",l=i+1,c=!1;if(t[l]==="?"){s(`Pattern cannot start with "?" at ${l}`);continue}for(;l<t.length;){if(!w6(t[l],!1)){s(`Invalid character '${t[l]}' at ${l}.`),c=!0;break}if(t[l]==="\\"){o+=t[l++]+t[l++];continue}if(t[l]===")"){if(a--,a===0){l++;break}}else if(t[l]==="("&&(a++,t[l+1]!=="?")){s(`Capturing groups are not allowed at ${l}`),c=!0;break}o+=t[l++]}if(c)continue;if(a){s(`Unbalanced pattern at ${i}`);continue}if(!o){s(`Missing pattern at ${i}`);continue}n.push({type:"REGEX",index:i,value:o}),i=l;continue}n.push({type:"CHAR",index:i,value:t[i++]})}return n.push({type:"END",index:i,value:""}),n}function yL(t,e={}){let n=vL(t);e.delimiter??(e.delimiter="/#?"),e.prefixes??(e.prefixes="./");let i=`[^${Fn(e.delimiter)}]+?`,r=[],s=0,a=0,o="",l=new Set,c=g=>{if(a<n.length&&n[a].type===g)return n[a++].value},u=()=>c("OTHER_MODIFIER")??c("ASTERISK"),d=g=>{let x=c(g);if(x!==void 0)return x;let{type:E,index:L}=n[a];throw new TypeError(`Unexpected ${E} at ${L}, expected ${g}`)},p=()=>{let g="",x;for(;x=c("CHAR")??c("ESCAPED_CHAR");)g+=x;return g},h=g=>g,y=e.encodePart||h,v="",w=g=>{v+=g},m=()=>{v.length&&(r.push(new Qu(3,"","",y(v),"",3)),v="")},f=(g,x,E,L,R)=>{let I=3;switch(R){case"?":I=1;break;case"*":I=0;break;case"+":I=2;break}if(!x&&!E&&I===3){w(g);return}if(m(),!x&&!E){if(!g)return;r.push(new Qu(3,"","",y(g),"",I));return}let z;E?E==="*"?z=Cx:z=E:z=i;let A=2;z===i?(A=1,z=""):z===Cx&&(A=0,z="");let oe;if(x?oe=x:E&&(oe=s++),l.has(oe))throw new TypeError(`Duplicate name '${oe}'.`);l.add(oe),r.push(new Qu(A,oe,y(g),z,y(L),I))};for(;a<n.length;){let g=c("CHAR"),x=c("NAME"),E=c("REGEX");if(!x&&!E&&(E=c("ASTERISK")),x||E){let R=g??"";e.prefixes.indexOf(R)===-1&&(w(R),R=""),m();let I=u();f(R,x,E,"",I);continue}let L=g??c("ESCAPED_CHAR");if(L){w(L);continue}if(c("OPEN")){let R=p(),I=c("NAME"),z=c("REGEX");!I&&!z&&(z=c("ASTERISK"));let A=p();d("CLOSE");let oe=u();f(R,I,z,A,oe);continue}m(),d("END")}return r}function Fn(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function hL(t){return t&&t.ignoreCase?"ui":"u"}function b6(t,e,n){return _L(yL(t,n),e,n)}function Ao(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function _L(t,e,n={}){n.delimiter??(n.delimiter="/#?"),n.prefixes??(n.prefixes="./"),n.sensitive??(n.sensitive=!1),n.strict??(n.strict=!1),n.end??(n.end=!0),n.start??(n.start=!0),n.endsWith="";let i=n.start?"^":"";for(let o of t){if(o.type===3){o.modifier===3?i+=Fn(o.value):i+=`(?:${Fn(o.value)})${Ao(o.modifier)}`;continue}e&&e.push(o.name);let l=`[^${Fn(n.delimiter)}]+?`,c=o.value;if(o.type===1?c=l:o.type===0&&(c=Cx),!o.prefix.length&&!o.suffix.length){o.modifier===3||o.modifier===1?i+=`(${c})${Ao(o.modifier)}`:i+=`((?:${c})${Ao(o.modifier)})`;continue}if(o.modifier===3||o.modifier===1){i+=`(?:${Fn(o.prefix)}(${c})${Fn(o.suffix)})`,i+=Ao(o.modifier);continue}i+=`(?:${Fn(o.prefix)}`,i+=`((?:${c})(?:`,i+=Fn(o.suffix),i+=Fn(o.prefix),i+=`(?:${c}))*)${Fn(o.suffix)})`,o.modifier===0&&(i+="?")}let r=`[${Fn(n.endsWith)}]|$`,s=`[${Fn(n.delimiter)}]`;if(n.end)return n.strict||(i+=`${s}?`),n.endsWith.length?i+=`(?=${r})`:i+="$",new RegExp(i,hL(n));n.strict||(i+=`(?:${s}(?=${r}))?`);let a=!1;if(t.length){let o=t[t.length-1];o.type===3&&o.modifier===3&&(a=n.delimiter.indexOf(o)>-1)}return a||(i+=`(?=${s}|${r})`),new RegExp(i,hL(n))}var ts={delimiter:"",prefixes:"",sensitive:!0,strict:!0},x6={delimiter:".",prefixes:"",sensitive:!0,strict:!0},k6={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function T6(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function wL(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function E6(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function bL(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}var xL=["ftp","file","http","https","ws","wss"];function kL(t){if(!t)return!0;for(let e of xL)if(t.test(e))return!0;return!1}function S6(t,e){if(t=wL(t,"#"),e||t==="")return t;let n=new URL("https://example.com");return n.hash=t,n.hash?n.hash.substring(1,n.hash.length):""}function P6(t,e){if(t=wL(t,"?"),e||t==="")return t;let n=new URL("https://example.com");return n.search=t,n.search?n.search.substring(1,n.search.length):""}function C6(t,e){return e||t===""?t:bL(t)?SL(t):EL(t)}function $6(t,e){if(e||t==="")return t;let n=new URL("https://example.com");return n.password=t,n.password}function M6(t,e){if(e||t==="")return t;let n=new URL("https://example.com");return n.username=t,n.username}function R6(t,e,n){if(n||t==="")return t;if(e&&!xL.includes(e))return new URL(`${e}:${t}`).pathname;let i=t[0]=="/";return t=new URL(i?t:"/-"+t,"https://example.com").pathname,i||(t=t.substring(2,t.length)),t}function L6(t,e,n){return TL(e)===t&&(t=""),n||t===""?t:PL(t)}function I6(t,e){return t=E6(t,":"),e||t===""?t:Rx(t)}function TL(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function Rx(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function A6(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function N6(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function EL(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function SL(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function PL(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function D6(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}function O6(t){return t===""?t:new URL(`data:${t}`).pathname}function V6(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function F6(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}var No,Vt,rt,Se,Ys,Do,vn,Oo,Vo,Fo,ze,Je,eg,CL,Xu,$x,Qs,Gu,zo,Xm,Zt,zn,Zu,Mx,tg,$L,Uo,Zm,ng,ML,ig,RL,jo,Jm,ns,Io,ar,Gs,rg,LL,sg,IL,ag,AL,og,NL,Un,Ci,lg,DL,mL,z6=(mL=class{constructor(t){V(this,ze);V(this,eg);V(this,Xu);V(this,Qs);V(this,zo);V(this,Zt);V(this,Zu);V(this,tg);V(this,Uo);V(this,ng);V(this,ig);V(this,jo);V(this,ns);V(this,ar);V(this,rg);V(this,sg);V(this,ag);V(this,og);V(this,Un);V(this,lg);V(this,No,void 0);V(this,Vt,[]);V(this,rt,{});V(this,Se,0);V(this,Ys,1);V(this,Do,0);V(this,vn,0);V(this,Oo,0);V(this,Vo,0);V(this,Fo,!1);we(this,No,t)}get result(){return k(this,rt)}parse(){for(we(this,Vt,vL(k(this,No),!0));k(this,Se)<k(this,Vt).length;we(this,Se,k(this,Se)+k(this,Ys))){if(we(this,Ys,1),k(this,Vt)[k(this,Se)].type==="END"){if(k(this,vn)===0){M(this,Xu,$x).call(this),M(this,ar,Gs).call(this)?M(this,ze,Je).call(this,9,1):M(this,ns,Io).call(this)?M(this,ze,Je).call(this,8,1):M(this,ze,Je).call(this,7,0);continue}else if(k(this,vn)===2){M(this,Qs,Gu).call(this,5);continue}M(this,ze,Je).call(this,10,0);break}if(k(this,Oo)>0)if(M(this,sg,IL).call(this))we(this,Oo,k(this,Oo)-1);else continue;if(M(this,rg,LL).call(this)){we(this,Oo,k(this,Oo)+1);continue}switch(k(this,vn)){case 0:M(this,Zu,Mx).call(this)&&M(this,Qs,Gu).call(this,1);break;case 1:if(M(this,Zu,Mx).call(this)){M(this,lg,DL).call(this);let t=7,e=1;M(this,tg,$L).call(this)?(t=2,e=3):k(this,Fo)&&(t=2),M(this,ze,Je).call(this,t,e)}break;case 2:M(this,Uo,Zm).call(this)?M(this,Qs,Gu).call(this,3):(M(this,jo,Jm).call(this)||M(this,ns,Io).call(this)||M(this,ar,Gs).call(this))&&M(this,Qs,Gu).call(this,5);break;case 3:M(this,ng,ML).call(this)?M(this,ze,Je).call(this,4,1):M(this,Uo,Zm).call(this)&&M(this,ze,Je).call(this,5,1);break;case 4:M(this,Uo,Zm).call(this)&&M(this,ze,Je).call(this,5,1);break;case 5:M(this,ag,AL).call(this)?we(this,Vo,k(this,Vo)+1):M(this,og,NL).call(this)&&we(this,Vo,k(this,Vo)-1),M(this,ig,RL).call(this)&&!k(this,Vo)?M(this,ze,Je).call(this,6,1):M(this,jo,Jm).call(this)?M(this,ze,Je).call(this,7,0):M(this,ns,Io).call(this)?M(this,ze,Je).call(this,8,1):M(this,ar,Gs).call(this)&&M(this,ze,Je).call(this,9,1);break;case 6:M(this,jo,Jm).call(this)?M(this,ze,Je).call(this,7,0):M(this,ns,Io).call(this)?M(this,ze,Je).call(this,8,1):M(this,ar,Gs).call(this)&&M(this,ze,Je).call(this,9,1);break;case 7:M(this,ns,Io).call(this)?M(this,ze,Je).call(this,8,1):M(this,ar,Gs).call(this)&&M(this,ze,Je).call(this,9,1);break;case 8:M(this,ar,Gs).call(this)&&M(this,ze,Je).call(this,9,1);break;case 9:break;case 10:break}}k(this,rt).hostname!==void 0&&k(this,rt).port===void 0&&(k(this,rt).port="")}},No=new WeakMap,Vt=new WeakMap,rt=new WeakMap,Se=new WeakMap,Ys=new WeakMap,Do=new WeakMap,vn=new WeakMap,Oo=new WeakMap,Vo=new WeakMap,Fo=new WeakMap,ze=new WeakSet,Je=function(t,e){var n,i,r;switch(k(this,vn)){case 0:break;case 1:k(this,rt).protocol=M(this,Un,Ci).call(this);break;case 2:break;case 3:k(this,rt).username=M(this,Un,Ci).call(this);break;case 4:k(this,rt).password=M(this,Un,Ci).call(this);break;case 5:k(this,rt).hostname=M(this,Un,Ci).call(this);break;case 6:k(this,rt).port=M(this,Un,Ci).call(this);break;case 7:k(this,rt).pathname=M(this,Un,Ci).call(this);break;case 8:k(this,rt).search=M(this,Un,Ci).call(this);break;case 9:k(this,rt).hash=M(this,Un,Ci).call(this);break;case 10:break}k(this,vn)!==0&&t!==10&&([1,2,3,4].includes(k(this,vn))&&[6,7,8,9].includes(t)&&((n=k(this,rt)).hostname??(n.hostname="")),[1,2,3,4,5,6].includes(k(this,vn))&&[8,9].includes(t)&&((i=k(this,rt)).pathname??(i.pathname=k(this,Fo)?"/":"")),[1,2,3,4,5,6,7].includes(k(this,vn))&&t===9&&((r=k(this,rt)).search??(r.search=""))),M(this,eg,CL).call(this,t,e)},eg=new WeakSet,CL=function(t,e){we(this,vn,t),we(this,Do,k(this,Se)+e),we(this,Se,k(this,Se)+e),we(this,Ys,0)},Xu=new WeakSet,$x=function(){we(this,Se,k(this,Do)),we(this,Ys,0)},Qs=new WeakSet,Gu=function(t){M(this,Xu,$x).call(this),we(this,vn,t)},zo=new WeakSet,Xm=function(t){return t<0&&(t=k(this,Vt).length-t),t<k(this,Vt).length?k(this,Vt)[t]:k(this,Vt)[k(this,Vt).length-1]},Zt=new WeakSet,zn=function(t,e){let n=M(this,zo,Xm).call(this,t);return n.value===e&&(n.type==="CHAR"||n.type==="ESCAPED_CHAR"||n.type==="INVALID_CHAR")},Zu=new WeakSet,Mx=function(){return M(this,Zt,zn).call(this,k(this,Se),":")},tg=new WeakSet,$L=function(){return M(this,Zt,zn).call(this,k(this,Se)+1,"/")&&M(this,Zt,zn).call(this,k(this,Se)+2,"/")},Uo=new WeakSet,Zm=function(){return M(this,Zt,zn).call(this,k(this,Se),"@")},ng=new WeakSet,ML=function(){return M(this,Zt,zn).call(this,k(this,Se),":")},ig=new WeakSet,RL=function(){return M(this,Zt,zn).call(this,k(this,Se),":")},jo=new WeakSet,Jm=function(){return M(this,Zt,zn).call(this,k(this,Se),"/")},ns=new WeakSet,Io=function(){if(M(this,Zt,zn).call(this,k(this,Se),"?"))return!0;if(k(this,Vt)[k(this,Se)].value!=="?")return!1;let t=M(this,zo,Xm).call(this,k(this,Se)-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"},ar=new WeakSet,Gs=function(){return M(this,Zt,zn).call(this,k(this,Se),"#")},rg=new WeakSet,LL=function(){return k(this,Vt)[k(this,Se)].type=="OPEN"},sg=new WeakSet,IL=function(){return k(this,Vt)[k(this,Se)].type=="CLOSE"},ag=new WeakSet,AL=function(){return M(this,Zt,zn).call(this,k(this,Se),"[")},og=new WeakSet,NL=function(){return M(this,Zt,zn).call(this,k(this,Se),"]")},Un=new WeakSet,Ci=function(){let t=k(this,Vt)[k(this,Se)],e=M(this,zo,Xm).call(this,k(this,Do)).index;return k(this,No).substring(e,t.index)},lg=new WeakSet,DL=function(){let t={};Object.assign(t,ts),t.encodePart=Rx;let e=b6(M(this,Un,Ci).call(this),void 0,t);we(this,Fo,kL(e))},mL),Px=["protocol","username","password","hostname","port","pathname","search","hash"],es="*";function fL(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let n=new URL(t,e);return{protocol:n.protocol.substring(0,n.protocol.length-1),username:n.username,password:n.password,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search!==""?n.search.substring(1,n.search.length):void 0,hash:n.hash!==""?n.hash.substring(1,n.hash.length):void 0}}function sr(t,e){return e?Yu(t):t}function Ku(t,e,n){let i;if(typeof e.baseURL=="string")try{i=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=sr(i.protocol.substring(0,i.protocol.length-1),n)),!n&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=sr(i.username,n)),!n&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&e.password===void 0&&(t.password=sr(i.password,n)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=sr(i.hostname,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=sr(i.port,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=sr(i.pathname,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=sr(i.search.substring(1,i.search.length),n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&e.hash===void 0&&(t.hash=sr(i.hash.substring(1,i.hash.length),n))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=I6(e.protocol,n)),typeof e.username=="string"&&(t.username=M6(e.username,n)),typeof e.password=="string"&&(t.password=$6(e.password,n)),typeof e.hostname=="string"&&(t.hostname=C6(e.hostname,n)),typeof e.port=="string"&&(t.port=L6(e.port,t.protocol,n)),typeof e.pathname=="string"){if(t.pathname=e.pathname,i&&!T6(t.pathname,n)){let r=i.pathname.lastIndexOf("/");r>=0&&(t.pathname=sr(i.pathname.substring(0,r+1),n)+t.pathname)}t.pathname=R6(t.pathname,t.protocol,n)}return typeof e.search=="string"&&(t.search=P6(e.search,n)),typeof e.hash=="string"&&(t.hash=S6(e.hash,n)),t}function Yu(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function U6(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function j6(t,e){e.delimiter??(e.delimiter="/#?"),e.prefixes??(e.prefixes="./"),e.sensitive??(e.sensitive=!1),e.strict??(e.strict=!1),e.end??(e.end=!0),e.start??(e.start=!0),e.endsWith="";let n=".*",i=`[^${U6(e.delimiter)}]+?`,r=/[$_\u200C\u200D\p{ID_Continue}]/u,s="";for(let a=0;a<t.length;++a){let o=t[a];if(o.type===3){if(o.modifier===3){s+=Yu(o.value);continue}s+=`{${Yu(o.value)}}${Ao(o.modifier)}`;continue}let l=o.hasCustomName(),c=!!o.suffix.length||!!o.prefix.length&&(o.prefix.length!==1||!e.prefixes.includes(o.prefix)),u=a>0?t[a-1]:null,d=a<t.length-1?t[a+1]:null;if(!c&&l&&o.type===1&&o.modifier===3&&d&&!d.prefix.length&&!d.suffix.length)if(d.type===3){let p=d.value.length>0?d.value[0]:"";c=r.test(p)}else c=!d.hasCustomName();if(!c&&!o.prefix.length&&u&&u.type===3){let p=u.value[u.value.length-1];c=e.prefixes.includes(p)}c&&(s+="{"),s+=Yu(o.prefix),l&&(s+=`:${o.name}`),o.type===2?s+=`(${o.value})`:o.type===1?l||(s+=`(${i})`):o.type===0&&(!l&&(!u||u.type===3||u.modifier!==3||c||o.prefix!=="")?s+="*":s+=`(${n})`),o.type===1&&l&&o.suffix.length&&r.test(o.suffix[0])&&(s+="\\"),s+=Yu(o.suffix),c&&(s+="}"),o.modifier!==3&&(s+=Ao(o.modifier))}return s}var $i,Xs,Ho,st,ci,qo,gL,cg=(gL=class{constructor(t={},e,n){V(this,$i,void 0);V(this,Xs,{});V(this,Ho,{});V(this,st,{});V(this,ci,{});V(this,qo,!1);try{let i;if(typeof e=="string"?i=e:n=e,typeof t=="string"){let o=new z6(t);if(o.parse(),t=o.result,i===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=i}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(i)throw new TypeError("parameter 1 is not of type 'string'.")}typeof n>"u"&&(n={ignoreCase:!1});let r={ignoreCase:n.ignoreCase===!0};we(this,$i,Ku({pathname:es,protocol:es,username:es,password:es,hostname:es,port:es,search:es,hash:es},t,!0)),TL(k(this,$i).protocol)===k(this,$i).port&&(k(this,$i).port="");let a;for(a of Px){if(!(a in k(this,$i)))continue;let o={},l=k(this,$i)[a];switch(k(this,Ho)[a]=[],a){case"protocol":Object.assign(o,ts),o.encodePart=Rx;break;case"username":Object.assign(o,ts),o.encodePart=A6;break;case"password":Object.assign(o,ts),o.encodePart=N6;break;case"hostname":Object.assign(o,x6),bL(l)?o.encodePart=SL:o.encodePart=EL;break;case"port":Object.assign(o,ts),o.encodePart=PL;break;case"pathname":kL(k(this,Xs).protocol)?(Object.assign(o,k6,r),o.encodePart=D6):(Object.assign(o,ts,r),o.encodePart=O6);break;case"search":Object.assign(o,ts,r),o.encodePart=V6;break;case"hash":Object.assign(o,ts,r),o.encodePart=F6;break}try{k(this,ci)[a]=yL(l,o),k(this,Xs)[a]=_L(k(this,ci)[a],k(this,Ho)[a],o),k(this,st)[a]=j6(k(this,ci)[a],o),we(this,qo,k(this,qo)||k(this,ci)[a].some(c=>c.type===2))}catch{throw new TypeError(`invalid ${a} pattern '${k(this,$i)[a]}'.`)}}}catch(i){throw new TypeError(`Failed to construct 'URLPattern': ${i.message}`)}}test(t={},e){let n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?n=Ku(n,t,!1):n=Ku(n,fL(t,e),!1)}catch{return!1}let i;for(i of Px)if(!k(this,Xs)[i].exec(n[i]))return!1;return!0}exec(t={},e){let n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?n=Ku(n,t,!1):n=Ku(n,fL(t,e),!1)}catch{return null}let i={};e?i.inputs=[t,e]:i.inputs=[t];let r;for(r of Px){let s=k(this,Xs)[r].exec(n[r]);if(!s)return null;let a={};for(let[o,l]of k(this,Ho)[r].entries())if(typeof l=="string"||typeof l=="number"){let c=s[o+1];a[l]=c}i[r]={input:n[r]??"",groups:a}}return i}static compareComponent(t,e,n){let i=(o,l)=>{for(let c of["type","modifier","prefix","value","suffix"]){if(o[c]<l[c])return-1;if(o[c]!==l[c])return 1}return 0},r=new Qu(3,"","","","",3),s=new Qu(0,"","","","",3),a=(o,l)=>{let c=0;for(;c<Math.min(o.length,l.length);++c){let u=i(o[c],l[c]);if(u)return u}return o.length===l.length?0:i(o[c]??r,l[c]??r)};return!k(e,st)[t]&&!k(n,st)[t]?0:k(e,st)[t]&&!k(n,st)[t]?a(k(e,ci)[t],[s]):!k(e,st)[t]&&k(n,st)[t]?a([s],k(n,ci)[t]):a(k(e,ci)[t],k(n,ci)[t])}get protocol(){return k(this,st).protocol}get username(){return k(this,st).username}get password(){return k(this,st).password}get hostname(){return k(this,st).hostname}get port(){return k(this,st).port}get pathname(){return k(this,st).pathname}get search(){return k(this,st).search}get hash(){return k(this,st).hash}get hasRegExpGroups(){return k(this,qo)}},$i=new WeakMap,Xs=new WeakMap,Ho=new WeakMap,st=new WeakMap,ci=new WeakMap,qo=new WeakMap,gL);globalThis.URLPattern||(globalThis.URLPattern=cg);var Ju,Lx,ug=class extends dg.Component{constructor(n){super();this.plugin=n;V(this,Ju);_(this,"matcher");M(this,Ju,Lx).call(this)}onload(){let n=(0,dg.debounce)(()=>M(this,Ju,Lx).call(this),500,!0);this.register(this.plugin.settings.subscribe((i,r)=>{i.linkHandler!==r.linkHandler&&n()}))}getPreferred(n,i){let r=this.getSupported(n),s=null;for(let a of r)for(let o of this.matcher.get(a)){if(!o.test(n))continue;let l=H6(o);(!s||l>s.specifity)&&(s={type:a,specifity:l})}return s?.type??(i?null:r[0])}setPreferred(n,i){this.plugin.settings.getState().setLinkHandler(n,i)}getSupported(n){if(!(n instanceof _t))return[Ft[n.type]];if(n.type==="generic")switch(n.inferredType){case"video":return[Et.video,_n];case"audio":return[Et.audio,_n];default:return[_n,Et.video,Et.audio]}switch(n.type){case"youtube":case"vimeo":return[_n,ss];case"bilibili":case"coursera":return[_n];default:(0,OL.assertNever)(n.type)}}};Ju=new WeakSet,Lx=function(){this.matcher=new Map(Object.entries(this.plugin.settings.getState().linkHandler).map(([n,i])=>[n,i.map(r=>new cg(r))]))};function H6(t){return["protocol","username","password","hostname","port","pathname","search","hash"].reduce((e,n)=>{let i=t[n];return e+(i!=="*"?1:0)},0)}var pg=class extends hg.Plugin{constructor(){super(...arguments);_(this,"settings",jR(this));_(this,"api",{openUrl:async(n,i,r)=>{let s=this.resolveUrl(n);if(!s){new hg.Notice("Protocol not yet supported");return}await this.leafOpener.openMedia(s,i,{direction:r})}});_(this,"urlViewType",this.addChild(new ug(this)));_(this,"mediaNote",this.addChild(new Dm(this)));_(this,"biliReq",this.addChild(new Ym(this)));_(this,"leafOpener",this.addChild(new Pm(this)));_(this,"handleMediaNote",JM);_(this,"injectMediaEmbed",ax);_(this,"injectMediaView",px);_(this,"registerMediaMenu",Kb);_(this,"fixLinkLabel",ux);_(this,"patchEditorClick",ox);_(this,"patchPreviewClick",dx);_(this,"patchInlineUrl",lx);_(this,"patchLinktextOpen",cx);_(this,"modifySession",pL);_(this,"initLogin",zx)}resolveUrl(n){let i=LR(n);return i?SC(Bn(i),this.settings.getState()):null}async onload(){this.addSettingTab(new Bm(this)),await this.loadSettings(),this.initLogin(),this.loadPatches(),this.registerMediaMenu(),this.handleMediaNote(),await this.modifySession(),JR(this)}async loadSettings(){await this.settings.getState().load()}loadPatches(){this.injectMediaView(Ft.audio,n=>new bo(n,this),Tt.audio),this.injectMediaView(Ft.video,n=>new wo(n,this),Tt.video),this.injectMediaEmbed((n,i,r)=>new Om(n,i,r,this)),this.registerView(_n,n=>new Eo(n,this)),this.registerView(ss,n=>new xo(n,this)),this.registerView(Et.video,n=>new ko(n,this)),this.registerView(Et.audio,n=>new To(n,this)),this.patchEditorClick({onExternalLinkClick:Hb}),this.patchPreviewClick({onExternalLinkClick:Hb}),this.fixLinkLabel(),this.patchInlineUrl(),this.patchLinktextOpen({onInternalLinkClick:nR})}};
/*! Bundled license information:
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
(**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
(**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
*/