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
688 KiB
190 lines
688 KiB
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source visit the plugins github repository
|
|
*/
|
|
|
|
"use strict";var wL=Object.create;var jo=Object.defineProperty;var bL=Object.getOwnPropertyDescriptor;var xL=Object.getOwnPropertyNames;var kL=Object.getPrototypeOf,EL=Object.prototype.hasOwnProperty;var TL=(t,e,n)=>e in t?jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ue=(t,e)=>()=>(t&&(e=t(t=0)),e);var dt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xt=(t,e)=>{for(var n in e)jo(t,n,{get:e[n],enumerable:!0})},wx=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of xL(e))!EL.call(t,r)&&r!==n&&jo(t,r,{get:()=>e[r],enumerable:!(i=bL(e,r))||i.enumerable});return t};var $=(t,e,n)=>(n=t!=null?wL(kL(t)):{},wx(e||!t||!t.__esModule?jo(n,"default",{value:t,enumerable:!0}):n,t)),SL=t=>wx(jo({},"__esModule",{value:!0}),t);var w=(t,e,n)=>(TL(t,typeof e!="symbol"?e+"":e,n),n),ng=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var k=(t,e,n)=>(ng(t,e,"read from private field"),n?n.call(t):e.get(t)),O=(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)=>(ng(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);var M=(t,e,n)=>(ng(t,e,"access private method"),n);var zx=dt(ie=>{"use strict";var Ho=Symbol.for("react.element"),NL=Symbol.for("react.portal"),DL=Symbol.for("react.fragment"),OL=Symbol.for("react.strict_mode"),VL=Symbol.for("react.profiler"),FL=Symbol.for("react.provider"),zL=Symbol.for("react.context"),UL=Symbol.for("react.forward_ref"),jL=Symbol.for("react.suspense"),qL=Symbol.for("react.memo"),HL=Symbol.for("react.lazy"),Mx=Symbol.iterator;function BL(t){return t===null||typeof t!="object"?null:(t=Mx&&t[Mx]||t["@@iterator"],typeof t=="function"?t:null)}var Ix={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ax=Object.assign,Nx={};function Xs(t,e,n){this.props=t,this.context=e,this.refs=Nx,this.updater=n||Ix}Xs.prototype.isReactComponent={};Xs.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")};Xs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Dx(){}Dx.prototype=Xs.prototype;function lg(t,e,n){this.props=t,this.context=e,this.refs=Nx,this.updater=n||Ix}var cg=lg.prototype=new Dx;cg.constructor=lg;Ax(cg,Xs.prototype);cg.isPureReactComponent=!0;var Rx=Array.isArray,Ox=Object.prototype.hasOwnProperty,ug={current:null},Vx={key:!0,ref:!0,__self:!0,__source:!0};function Fx(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)Ox.call(e,i)&&!Vx.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:Ho,type:t,key:s,ref:a,props:r,_owner:ug.current}}function WL(t,e){return{$$typeof:Ho,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function dg(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ho}function KL(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Lx=/\/+/g;function og(t,e){return typeof t=="object"&&t!==null&&t.key!=null?KL(""+t.key):e.toString(36)}function Zu(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 Ho:case NL:a=!0}}if(a)return a=t,r=r(a),t=i===""?"."+og(a,0):i,Rx(r)?(n="",t!=null&&(n=t.replace(Lx,"$&/")+"/"),Zu(r,e,n,"",function(c){return c})):r!=null&&(dg(r)&&(r=WL(r,n+(!r.key||a&&a.key===r.key?"":(""+r.key).replace(Lx,"$&/")+"/")+t)),e.push(r)),1;if(a=0,i=i===""?".":i+":",Rx(t))for(var o=0;o<t.length;o++){s=t[o];var l=i+og(s,o);a+=Zu(s,e,n,l,r)}else if(l=BL(t),typeof l=="function")for(t=l.call(t),o=0;!(s=t.next()).done;)s=s.value,l=i+og(s,o++),a+=Zu(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 Xu(t,e,n){if(t==null)return t;var i=[],r=0;return Zu(t,i,"","",function(s){return e.call(n,s,r++)}),i}function GL(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 Et={current:null},Ju={transition:null},YL={ReactCurrentDispatcher:Et,ReactCurrentBatchConfig:Ju,ReactCurrentOwner:ug};ie.Children={map:Xu,forEach:function(t,e,n){Xu(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Xu(t,function(){e++}),e},toArray:function(t){return Xu(t,function(e){return e})||[]},only:function(t){if(!dg(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ie.Component=Xs;ie.Fragment=DL;ie.Profiler=VL;ie.PureComponent=lg;ie.StrictMode=OL;ie.Suspense=jL;ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YL;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=Ax({},t.props),r=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=ug.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)Ox.call(e,l)&&!Vx.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:Ho,type:t.type,key:r,ref:s,props:i,_owner:a}};ie.createContext=function(t){return t={$$typeof:zL,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:FL,_context:t},t.Consumer=t};ie.createElement=Fx;ie.createFactory=function(t){var e=Fx.bind(null,t);return e.type=t,e};ie.createRef=function(){return{current:null}};ie.forwardRef=function(t){return{$$typeof:UL,render:t}};ie.isValidElement=dg;ie.lazy=function(t){return{$$typeof:HL,_payload:{_status:-1,_result:t},_init:GL}};ie.memo=function(t,e){return{$$typeof:qL,type:t,compare:e===void 0?null:e}};ie.startTransition=function(t){var e=Ju.transition;Ju.transition={};try{t()}finally{Ju.transition=e}};ie.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};ie.useCallback=function(t,e){return Et.current.useCallback(t,e)};ie.useContext=function(t){return Et.current.useContext(t)};ie.useDebugValue=function(){};ie.useDeferredValue=function(t){return Et.current.useDeferredValue(t)};ie.useEffect=function(t,e){return Et.current.useEffect(t,e)};ie.useId=function(){return Et.current.useId()};ie.useImperativeHandle=function(t,e,n){return Et.current.useImperativeHandle(t,e,n)};ie.useInsertionEffect=function(t,e){return Et.current.useInsertionEffect(t,e)};ie.useLayoutEffect=function(t,e){return Et.current.useLayoutEffect(t,e)};ie.useMemo=function(t,e){return Et.current.useMemo(t,e)};ie.useReducer=function(t,e,n){return Et.current.useReducer(t,e,n)};ie.useRef=function(t){return Et.current.useRef(t)};ie.useState=function(t){return Et.current.useState(t)};ie.useSyncExternalStore=function(t,e,n){return Et.current.useSyncExternalStore(t,e,n)};ie.useTransition=function(){return Et.current.useTransition()};ie.version="18.2.0"});var z=dt((lz,Ux)=>{"use strict";Ux.exports=zx()});var Xx=dt(me=>{"use strict";function mg(t,e){var n=t.length;t.push(e);e:for(;0<n;){var i=n-1>>>1,r=t[i];if(0<ed(r,e))t[i]=e,t[n]=r,n=i;else break e}}function qn(t){return t.length===0?null:t[0]}function nd(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>ed(o,n))l<r&&0>ed(c,o)?(t[i]=c,t[l]=n,i=l):(t[i]=o,t[a]=n,i=a);else if(l<r&&0>ed(c,n))t[i]=c,t[l]=n,i=l;else break e}}return e}function ed(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(jx=performance,me.unstable_now=function(){return jx.now()}):(pg=Date,qx=pg.now(),me.unstable_now=function(){return pg.now()-qx});var jx,pg,qx,oi=[],or=[],QL=1,gn=null,ht=3,id=!1,es=!1,Wo=!1,Wx=typeof setTimeout=="function"?setTimeout:null,Kx=typeof clearTimeout=="function"?clearTimeout:null,Hx=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function gg(t){for(var e=qn(or);e!==null;){if(e.callback===null)nd(or);else if(e.startTime<=t)nd(or),e.sortIndex=e.expirationTime,mg(oi,e);else break;e=qn(or)}}function vg(t){if(Wo=!1,gg(t),!es)if(qn(oi)!==null)es=!0,_g(yg);else{var e=qn(or);e!==null&&wg(vg,e.startTime-t)}}function yg(t,e){es=!1,Wo&&(Wo=!1,Kx(Ko),Ko=-1),id=!0;var n=ht;try{for(gg(e),gn=qn(oi);gn!==null&&(!(gn.expirationTime>e)||t&&!Qx());){var i=gn.callback;if(typeof i=="function"){gn.callback=null,ht=gn.priorityLevel;var r=i(gn.expirationTime<=e);e=me.unstable_now(),typeof r=="function"?gn.callback=r:gn===qn(oi)&&nd(oi),gg(e)}else nd(oi);gn=qn(oi)}if(gn!==null)var s=!0;else{var a=qn(or);a!==null&&wg(vg,a.startTime-e),s=!1}return s}finally{gn=null,ht=n,id=!1}}var rd=!1,td=null,Ko=-1,Gx=5,Yx=-1;function Qx(){return!(me.unstable_now()-Yx<Gx)}function hg(){if(td!==null){var t=me.unstable_now();Yx=t;var e=!0;try{e=td(!0,t)}finally{e?Bo():(rd=!1,td=null)}}else rd=!1}var Bo;typeof Hx=="function"?Bo=function(){Hx(hg)}:typeof MessageChannel<"u"?(fg=new MessageChannel,Bx=fg.port2,fg.port1.onmessage=hg,Bo=function(){Bx.postMessage(null)}):Bo=function(){Wx(hg,0)};var fg,Bx;function _g(t){td=t,rd||(rd=!0,Bo())}function wg(t,e){Ko=Wx(function(){t(me.unstable_now())},e)}me.unstable_IdlePriority=5;me.unstable_ImmediatePriority=1;me.unstable_LowPriority=4;me.unstable_NormalPriority=3;me.unstable_Profiling=null;me.unstable_UserBlockingPriority=2;me.unstable_cancelCallback=function(t){t.callback=null};me.unstable_continueExecution=function(){es||id||(es=!0,_g(yg))};me.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"):Gx=0<t?Math.floor(1e3/t):5};me.unstable_getCurrentPriorityLevel=function(){return ht};me.unstable_getFirstCallbackNode=function(){return qn(oi)};me.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}};me.unstable_pauseExecution=function(){};me.unstable_requestPaint=function(){};me.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}};me.unstable_scheduleCallback=function(t,e,n){var i=me.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:QL++,callback:e,priorityLevel:t,startTime:n,expirationTime:r,sortIndex:-1},n>i?(t.sortIndex=n,mg(or,t),qn(oi)===null&&t===qn(or)&&(Wo?(Kx(Ko),Ko=-1):Wo=!0,wg(vg,n-i))):(t.sortIndex=r,mg(oi,t),es||id||(es=!0,_g(yg))),t};me.unstable_shouldYield=Qx;me.unstable_wrapCallback=function(t){var e=ht;return function(){var n=ht;ht=e;try{return t.apply(this,arguments)}finally{ht=n}}}});var Jx=dt((uz,Zx)=>{"use strict";Zx.exports=Xx()});var sT=dt(sn=>{"use strict";var ak=z(),nn=Jx();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 ok=new Set,ml={};function hs(t,e){ya(t,e),ya(t+"Capture",e)}function ya(t,e){for(ml[t]=e,t=0;t<e.length;t++)ok.add(e[t])}var Di=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qg=Object.prototype.hasOwnProperty,XL=/^[: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]*$/,e0={},t0={};function ZL(t){return qg.call(t0,t)?!0:qg.call(e0,t)?!1:XL.test(t)?t0[t]=!0:(e0[t]=!0,!1)}function JL(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 eI(t,e,n,i){if(e===null||typeof e>"u"||JL(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 Pt(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 ot={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ot[t]=new Pt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ot[e]=new Pt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ot[t]=new Pt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ot[t]=new Pt(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){ot[t]=new Pt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ot[t]=new Pt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ot[t]=new Pt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ot[t]=new Pt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ot[t]=new Pt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Nv=/[\-:]([a-z])/g;function Dv(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(Nv,Dv);ot[e]=new Pt(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(Nv,Dv);ot[e]=new Pt(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(Nv,Dv);ot[e]=new Pt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ot[t]=new Pt(t,1,!1,t.toLowerCase(),null,!1,!1)});ot.xlinkHref=new Pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ot[t]=new Pt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Ov(t,e,n,i){var r=ot.hasOwnProperty(e)?ot[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(eI(e,n,r,i)&&(n=null),i||r===null?ZL(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 zi=ak.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sd=Symbol.for("react.element"),ea=Symbol.for("react.portal"),ta=Symbol.for("react.fragment"),Vv=Symbol.for("react.strict_mode"),Hg=Symbol.for("react.profiler"),lk=Symbol.for("react.provider"),ck=Symbol.for("react.context"),Fv=Symbol.for("react.forward_ref"),Bg=Symbol.for("react.suspense"),Wg=Symbol.for("react.suspense_list"),zv=Symbol.for("react.memo"),cr=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var uk=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var n0=Symbol.iterator;function Go(t){return t===null||typeof t!="object"?null:(t=n0&&t[n0]||t["@@iterator"],typeof t=="function"?t:null)}var Le=Object.assign,bg;function nl(t){if(bg===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);bg=e&&e[1]||""}return`
|
|
`+bg+t}var xg=!1;function kg(t,e){if(!t||xg)return"";xg=!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{xg=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?nl(t):""}function tI(t){switch(t.tag){case 5:return nl(t.type);case 16:return nl("Lazy");case 13:return nl("Suspense");case 19:return nl("SuspenseList");case 0:case 2:case 15:return t=kg(t.type,!1),t;case 11:return t=kg(t.type.render,!1),t;case 1:return t=kg(t.type,!0),t;default:return""}}function Kg(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 ta:return"Fragment";case ea:return"Portal";case Hg:return"Profiler";case Vv:return"StrictMode";case Bg:return"Suspense";case Wg:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ck:return(t.displayName||"Context")+".Consumer";case lk:return(t._context.displayName||"Context")+".Provider";case Fv: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:Kg(t.type)||"Memo";case cr:e=t._payload,t=t._init;try{return Kg(t(e))}catch{}}return null}function nI(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 Kg(e);case 8:return e===Vv?"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 kr(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function dk(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function iI(t){var e=dk(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 ad(t){t._valueTracker||(t._valueTracker=iI(t))}function pk(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=dk(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function Ad(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 Gg(t,e){var n=e.checked;return Le({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function i0(t,e){var n=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;n=kr(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 hk(t,e){e=e.checked,e!=null&&Ov(t,"checked",e,!1)}function Yg(t,e){hk(t,e);var n=kr(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")?Qg(t,e.type,n):e.hasOwnProperty("defaultValue")&&Qg(t,e.type,kr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function r0(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 Qg(t,e,n){(e!=="number"||Ad(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var il=Array.isArray;function pa(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=""+kr(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 Xg(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(P(91));return Le({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function s0(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(il(n)){if(1<n.length)throw Error(P(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:kr(n)}}function fk(t,e){var n=kr(e.value),i=kr(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 a0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function mk(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 Zg(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?mk(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var od,gk=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(od=od||document.createElement("div"),od.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=od.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function gl(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var al={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},rI=["Webkit","ms","Moz","O"];Object.keys(al).forEach(function(t){rI.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),al[e]=al[t]})});function vk(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||al.hasOwnProperty(t)&&al[t]?(""+e).trim():e+"px"}function yk(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var i=n.indexOf("--")===0,r=vk(n,e[n],i);n==="float"&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}var sI=Le({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 Jg(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 ev(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 tv=null;function Uv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var nv=null,ha=null,fa=null;function o0(t){if(t=Al(t)){if(typeof nv!="function")throw Error(P(280));var e=t.stateNode;e&&(e=lp(e),nv(t.stateNode,t.type,e))}}function _k(t){ha?fa?fa.push(t):fa=[t]:ha=t}function wk(){if(ha){var t=ha,e=fa;if(fa=ha=null,o0(t),e)for(t=0;t<e.length;t++)o0(e[t])}}function bk(t,e){return t(e)}function xk(){}var Eg=!1;function kk(t,e,n){if(Eg)return t(e,n);Eg=!0;try{return bk(t,e,n)}finally{Eg=!1,(ha!==null||fa!==null)&&(xk(),wk())}}function vl(t,e){var n=t.stateNode;if(n===null)return null;var i=lp(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 iv=!1;if(Di)try{Zs={},Object.defineProperty(Zs,"passive",{get:function(){iv=!0}}),window.addEventListener("test",Zs,Zs),window.removeEventListener("test",Zs,Zs)}catch{iv=!1}var Zs;function aI(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 ol=!1,Nd=null,Dd=!1,rv=null,oI={onError:function(t){ol=!0,Nd=t}};function lI(t,e,n,i,r,s,a,o,l){ol=!1,Nd=null,aI.apply(oI,arguments)}function cI(t,e,n,i,r,s,a,o,l){if(lI.apply(this,arguments),ol){if(ol){var c=Nd;ol=!1,Nd=null}else throw Error(P(198));Dd||(Dd=!0,rv=c)}}function fs(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 Ek(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 l0(t){if(fs(t)!==t)throw Error(P(188))}function uI(t){var e=t.alternate;if(!e){if(e=fs(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 l0(r),t;if(s===i)return l0(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 Tk(t){return t=uI(t),t!==null?Sk(t):null}function Sk(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Sk(t);if(e!==null)return e;t=t.sibling}return null}var Pk=nn.unstable_scheduleCallback,c0=nn.unstable_cancelCallback,dI=nn.unstable_shouldYield,pI=nn.unstable_requestPaint,Ve=nn.unstable_now,hI=nn.unstable_getCurrentPriorityLevel,jv=nn.unstable_ImmediatePriority,Ck=nn.unstable_UserBlockingPriority,Od=nn.unstable_NormalPriority,fI=nn.unstable_LowPriority,$k=nn.unstable_IdlePriority,rp=null,di=null;function mI(t){if(di&&typeof di.onCommitFiberRoot=="function")try{di.onCommitFiberRoot(rp,t,void 0,(t.current.flags&128)===128)}catch{}}var Gn=Math.clz32?Math.clz32:yI,gI=Math.log,vI=Math.LN2;function yI(t){return t>>>=0,t===0?32:31-(gI(t)/vI|0)|0}var ld=64,cd=4194304;function rl(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 Vd(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=rl(o):(s&=a,s!==0&&(i=rl(s)))}else a=n&~r,a!==0?i=rl(a):s!==0&&(i=rl(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-Gn(e),r=1<<n,i|=t[n],e&=~r;return i}function _I(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 wI(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,r=t.expirationTimes,s=t.pendingLanes;0<s;){var a=31-Gn(s),o=1<<a,l=r[a];l===-1?(!(o&n)||o&i)&&(r[a]=_I(o,e)):l<=e&&(t.expiredLanes|=o),s&=~o}}function sv(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Mk(){var t=ld;return ld<<=1,!(ld&4194240)&&(ld=64),t}function Tg(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Ll(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Gn(e),t[e]=n}function bI(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-Gn(n),s=1<<r;e[r]=0,i[r]=-1,t[r]=-1,n&=~s}}function qv(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-Gn(n),r=1<<i;r&e|t[i]&e&&(t[i]|=e),n&=~r}}var de=0;function Rk(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Lk,Hv,Ik,Ak,Nk,av=!1,ud=[],mr=null,gr=null,vr=null,yl=new Map,_l=new Map,dr=[],xI="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 u0(t,e){switch(t){case"focusin":case"focusout":mr=null;break;case"dragenter":case"dragleave":gr=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":yl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":_l.delete(e.pointerId)}}function Yo(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=Al(e),e!==null&&Hv(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),t)}function kI(t,e,n,i,r){switch(e){case"focusin":return mr=Yo(mr,t,e,n,i,r),!0;case"dragenter":return gr=Yo(gr,t,e,n,i,r),!0;case"mouseover":return vr=Yo(vr,t,e,n,i,r),!0;case"pointerover":var s=r.pointerId;return yl.set(s,Yo(yl.get(s)||null,t,e,n,i,r)),!0;case"gotpointercapture":return s=r.pointerId,_l.set(s,Yo(_l.get(s)||null,t,e,n,i,r)),!0}return!1}function Dk(t){var e=is(t.target);if(e!==null){var n=fs(e);if(n!==null){if(e=n.tag,e===13){if(e=Ek(n),e!==null){t.blockedOn=e,Nk(t.priority,function(){Ik(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 Ed(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=ov(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);tv=i,n.target.dispatchEvent(i),tv=null}else return e=Al(n),e!==null&&Hv(e),t.blockedOn=n,!1;e.shift()}return!0}function d0(t,e,n){Ed(t)&&n.delete(e)}function EI(){av=!1,mr!==null&&Ed(mr)&&(mr=null),gr!==null&&Ed(gr)&&(gr=null),vr!==null&&Ed(vr)&&(vr=null),yl.forEach(d0),_l.forEach(d0)}function Qo(t,e){t.blockedOn===e&&(t.blockedOn=null,av||(av=!0,nn.unstable_scheduleCallback(nn.unstable_NormalPriority,EI)))}function wl(t){function e(r){return Qo(r,t)}if(0<ud.length){Qo(ud[0],t);for(var n=1;n<ud.length;n++){var i=ud[n];i.blockedOn===t&&(i.blockedOn=null)}}for(mr!==null&&Qo(mr,t),gr!==null&&Qo(gr,t),vr!==null&&Qo(vr,t),yl.forEach(e),_l.forEach(e),n=0;n<dr.length;n++)i=dr[n],i.blockedOn===t&&(i.blockedOn=null);for(;0<dr.length&&(n=dr[0],n.blockedOn===null);)Dk(n),n.blockedOn===null&&dr.shift()}var ma=zi.ReactCurrentBatchConfig,Fd=!0;function TI(t,e,n,i){var r=de,s=ma.transition;ma.transition=null;try{de=1,Bv(t,e,n,i)}finally{de=r,ma.transition=s}}function SI(t,e,n,i){var r=de,s=ma.transition;ma.transition=null;try{de=4,Bv(t,e,n,i)}finally{de=r,ma.transition=s}}function Bv(t,e,n,i){if(Fd){var r=ov(t,e,n,i);if(r===null)Lg(t,e,i,zd,n),u0(t,i);else if(kI(r,t,e,n,i))i.stopPropagation();else if(u0(t,i),e&4&&-1<xI.indexOf(t)){for(;r!==null;){var s=Al(r);if(s!==null&&Lk(s),s=ov(t,e,n,i),s===null&&Lg(t,e,i,zd,n),s===r)break;r=s}r!==null&&i.stopPropagation()}else Lg(t,e,i,null,n)}}var zd=null;function ov(t,e,n,i){if(zd=null,t=Uv(i),t=is(t),t!==null)if(e=fs(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Ek(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 zd=t,null}function Ok(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(hI()){case jv:return 1;case Ck:return 4;case Od:case fI:return 16;case $k:return 536870912;default:return 16}default:return 16}}var hr=null,Wv=null,Td=null;function Vk(){if(Td)return Td;var t,e=Wv,n=e.length,i,r="value"in hr?hr.value:hr.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 Td=r.slice(t,1<i?1-i:void 0)}function Sd(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 dd(){return!0}function p0(){return!1}function rn(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)?dd:p0,this.isPropagationStopped=p0,this}return Le(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=dd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=dd)},persist:function(){},isPersistent:dd}),e}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kv=rn(Ta),Il=Le({},Ta,{view:0,detail:0}),PI=rn(Il),Sg,Pg,Xo,sp=Le({},Il,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gv,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!==Xo&&(Xo&&t.type==="mousemove"?(Sg=t.screenX-Xo.screenX,Pg=t.screenY-Xo.screenY):Pg=Sg=0,Xo=t),Sg)},movementY:function(t){return"movementY"in t?t.movementY:Pg}}),h0=rn(sp),CI=Le({},sp,{dataTransfer:0}),$I=rn(CI),MI=Le({},Il,{relatedTarget:0}),Cg=rn(MI),RI=Le({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),LI=rn(RI),II=Le({},Ta,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),AI=rn(II),NI=Le({},Ta,{data:0}),f0=rn(NI),DI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},OI={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"},VI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function FI(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=VI[t])?!!e[t]:!1}function Gv(){return FI}var zI=Le({},Il,{key:function(t){if(t.key){var e=DI[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Sd(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?OI[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gv,charCode:function(t){return t.type==="keypress"?Sd(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Sd(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),UI=rn(zI),jI=Le({},sp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m0=rn(jI),qI=Le({},Il,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gv}),HI=rn(qI),BI=Le({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),WI=rn(BI),KI=Le({},sp,{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}),GI=rn(KI),YI=[9,13,27,32],Yv=Di&&"CompositionEvent"in window,ll=null;Di&&"documentMode"in document&&(ll=document.documentMode);var QI=Di&&"TextEvent"in window&&!ll,Fk=Di&&(!Yv||ll&&8<ll&&11>=ll),g0=" ",v0=!1;function zk(t,e){switch(t){case"keyup":return YI.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uk(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var na=!1;function XI(t,e){switch(t){case"compositionend":return Uk(e);case"keypress":return e.which!==32?null:(v0=!0,g0);case"textInput":return t=e.data,t===g0&&v0?null:t;default:return null}}function ZI(t,e){if(na)return t==="compositionend"||!Yv&&zk(t,e)?(t=Vk(),Td=Wv=hr=null,na=!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 Fk&&e.locale!=="ko"?null:e.data;default:return null}}var JI={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 y0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!JI[t.type]:e==="textarea"}function jk(t,e,n,i){_k(i),e=Ud(e,"onChange"),0<e.length&&(n=new Kv("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var cl=null,bl=null;function eA(t){Jk(t,0)}function ap(t){var e=sa(t);if(pk(e))return t}function tA(t,e){if(t==="change")return e}var qk=!1;Di&&(Di?(hd="oninput"in document,hd||($g=document.createElement("div"),$g.setAttribute("oninput","return;"),hd=typeof $g.oninput=="function"),pd=hd):pd=!1,qk=pd&&(!document.documentMode||9<document.documentMode));var pd,hd,$g;function _0(){cl&&(cl.detachEvent("onpropertychange",Hk),bl=cl=null)}function Hk(t){if(t.propertyName==="value"&&ap(bl)){var e=[];jk(e,bl,t,Uv(t)),kk(eA,e)}}function nA(t,e,n){t==="focusin"?(_0(),cl=e,bl=n,cl.attachEvent("onpropertychange",Hk)):t==="focusout"&&_0()}function iA(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ap(bl)}function rA(t,e){if(t==="click")return ap(e)}function sA(t,e){if(t==="input"||t==="change")return ap(e)}function aA(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Qn=typeof Object.is=="function"?Object.is:aA;function xl(t,e){if(Qn(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(!qg.call(e,r)||!Qn(t[r],e[r]))return!1}return!0}function w0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function b0(t,e){var n=w0(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=w0(n)}}function Bk(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Bk(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Wk(){for(var t=window,e=Ad();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ad(t.document)}return e}function Qv(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 oA(t){var e=Wk(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Bk(n.ownerDocument.documentElement,n)){if(i!==null&&Qv(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=b0(n,s);var a=b0(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 lA=Di&&"documentMode"in document&&11>=document.documentMode,ia=null,lv=null,ul=null,cv=!1;function x0(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cv||ia==null||ia!==Ad(i)||(i=ia,"selectionStart"in i&&Qv(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}),ul&&xl(ul,i)||(ul=i,i=Ud(lv,"onSelect"),0<i.length&&(e=new Kv("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=ia)))}function fd(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var ra={animationend:fd("Animation","AnimationEnd"),animationiteration:fd("Animation","AnimationIteration"),animationstart:fd("Animation","AnimationStart"),transitionend:fd("Transition","TransitionEnd")},Mg={},Kk={};Di&&(Kk=document.createElement("div").style,"AnimationEvent"in window||(delete ra.animationend.animation,delete ra.animationiteration.animation,delete ra.animationstart.animation),"TransitionEvent"in window||delete ra.transitionend.transition);function op(t){if(Mg[t])return Mg[t];if(!ra[t])return t;var e=ra[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Kk)return Mg[t]=e[n];return t}var Gk=op("animationend"),Yk=op("animationiteration"),Qk=op("animationstart"),Xk=op("transitionend"),Zk=new Map,k0="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 Tr(t,e){Zk.set(t,e),hs(e,[t])}for(md=0;md<k0.length;md++)gd=k0[md],E0=gd.toLowerCase(),T0=gd[0].toUpperCase()+gd.slice(1),Tr(E0,"on"+T0);var gd,E0,T0,md;Tr(Gk,"onAnimationEnd");Tr(Yk,"onAnimationIteration");Tr(Qk,"onAnimationStart");Tr("dblclick","onDoubleClick");Tr("focusin","onFocus");Tr("focusout","onBlur");Tr(Xk,"onTransitionEnd");ya("onMouseEnter",["mouseout","mouseover"]);ya("onMouseLeave",["mouseout","mouseover"]);ya("onPointerEnter",["pointerout","pointerover"]);ya("onPointerLeave",["pointerout","pointerover"]);hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));hs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hs("onBeforeInput",["compositionend","keypress","textInput","paste"]);hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sl="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(" "),cA=new Set("cancel close invalid load scroll toggle".split(" ").concat(sl));function S0(t,e,n){var i=t.type||"unknown-event";t.currentTarget=n,cI(i,e,void 0,t),t.currentTarget=null}function Jk(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;S0(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;S0(r,o,c),s=l}}}if(Dd)throw t=rv,Dd=!1,rv=null,t}function be(t,e){var n=e[fv];n===void 0&&(n=e[fv]=new Set);var i=t+"__bubble";n.has(i)||(eE(e,t,2,!1),n.add(i))}function Rg(t,e,n){var i=0;e&&(i|=4),eE(n,t,i,e)}var vd="_reactListening"+Math.random().toString(36).slice(2);function kl(t){if(!t[vd]){t[vd]=!0,ok.forEach(function(n){n!=="selectionchange"&&(cA.has(n)||Rg(n,!1,t),Rg(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[vd]||(e[vd]=!0,Rg("selectionchange",!1,e))}}function eE(t,e,n,i){switch(Ok(e)){case 1:var r=TI;break;case 4:r=SI;break;default:r=Bv}n=r.bind(null,e,n,t),r=void 0,!iv||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 Lg(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=is(o),a===null)return;if(l=a.tag,l===5||l===6){i=s=a;continue e}o=o.parentNode}}i=i.return}kk(function(){var c=s,u=Uv(n),d=[];e:{var p=Zk.get(t);if(p!==void 0){var h=Kv,y=t;switch(t){case"keypress":if(Sd(n)===0)break e;case"keydown":case"keyup":h=UI;break;case"focusin":y="focus",h=Cg;break;case"focusout":y="blur",h=Cg;break;case"beforeblur":case"afterblur":h=Cg;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=h0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=$I;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=HI;break;case Gk:case Yk:case Qk:h=LI;break;case Xk:h=WI;break;case"scroll":h=PI;break;case"wheel":h=GI;break;case"copy":case"cut":case"paste":h=AI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=m0}var v=(e&4)!==0,_=!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=vl(f,m),x!=null&&v.push(El(f,x,g)))),_)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!==tv&&(y=n.relatedTarget||n.fromElement)&&(is(y)||y[Oi]))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?is(y):null,y!==null&&(_=fs(y),y!==_||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=c),h!==y)){if(v=h0,x="onMouseLeave",m="onMouseEnter",f="mouse",(t==="pointerout"||t==="pointerover")&&(v=m0,x="onPointerLeave",m="onPointerEnter",f="pointer"),_=h==null?p:sa(h),g=y==null?p:sa(y),p=new v(x,f+"leave",h,n,u),p.target=_,p.relatedTarget=g,x=null,is(u)===c&&(v=new v(m,f+"enter",y,n,u),v.target=g,v.relatedTarget=_,x=v),_=x,h&&y)t:{for(v=h,m=y,f=0,g=v;g;g=Js(g))f++;for(g=0,x=m;x;x=Js(x))g++;for(;0<f-g;)v=Js(v),f--;for(;0<g-f;)m=Js(m),g--;for(;f--;){if(v===m||m!==null&&v===m.alternate)break t;v=Js(v),m=Js(m)}v=null}else v=null;h!==null&&P0(d,p,h,v,!1),y!==null&&_!==null&&P0(d,_,y,v,!0)}}e:{if(p=c?sa(c):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var T=tA;else if(y0(p))if(qk)T=sA;else{T=iA;var L=nA}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(T=rA);if(T&&(T=T(t,c))){jk(d,T,n,u);break e}L&&L(t,p,c),t==="focusout"&&(L=p._wrapperState)&&L.controlled&&p.type==="number"&&Qg(p,"number",p.value)}switch(L=c?sa(c):window,t){case"focusin":(y0(L)||L.contentEditable==="true")&&(ia=L,lv=c,ul=null);break;case"focusout":ul=lv=ia=null;break;case"mousedown":cv=!0;break;case"contextmenu":case"mouseup":case"dragend":cv=!1,x0(d,n,u);break;case"selectionchange":if(lA)break;case"keydown":case"keyup":x0(d,n,u)}var R;if(Yv)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 na?zk(t,n)&&(I="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(Fk&&n.locale!=="ko"&&(na||I!=="onCompositionStart"?I==="onCompositionEnd"&&na&&(R=Vk()):(hr=u,Wv="value"in hr?hr.value:hr.textContent,na=!0)),L=Ud(c,I),0<L.length&&(I=new f0(I,t,null,n,u),d.push({event:I,listeners:L}),R?I.data=R:(R=Uk(n),R!==null&&(I.data=R)))),(R=QI?XI(t,n):ZI(t,n))&&(c=Ud(c,"onBeforeInput"),0<c.length&&(u=new f0("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=R))}Jk(d,e)})}function El(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Ud(t,e){for(var n=e+"Capture",i=[];t!==null;){var r=t,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=vl(t,n),s!=null&&i.unshift(El(t,s,r)),s=vl(t,e),s!=null&&i.push(El(t,s,r))),t=t.return}return i}function Js(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function P0(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=vl(n,s),l!=null&&a.unshift(El(n,l,o))):r||(l=vl(n,s),l!=null&&a.push(El(n,l,o)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var uA=/\r\n?/g,dA=/\u0000|\uFFFD/g;function C0(t){return(typeof t=="string"?t:""+t).replace(uA,`
|
|
`).replace(dA,"")}function yd(t,e,n){if(e=C0(e),C0(t)!==e&&n)throw Error(P(425))}function jd(){}var uv=null,dv=null;function pv(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 hv=typeof setTimeout=="function"?setTimeout:void 0,pA=typeof clearTimeout=="function"?clearTimeout:void 0,$0=typeof Promise=="function"?Promise:void 0,hA=typeof queueMicrotask=="function"?queueMicrotask:typeof $0<"u"?function(t){return $0.resolve(null).then(t).catch(fA)}:hv;function fA(t){setTimeout(function(){throw t})}function Ig(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),wl(e);return}i--}else n!=="$"&&n!=="$?"&&n!=="$!"||i++;n=r}while(n);wl(e)}function yr(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 M0(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 Sa=Math.random().toString(36).slice(2),ui="__reactFiber$"+Sa,Tl="__reactProps$"+Sa,Oi="__reactContainer$"+Sa,fv="__reactEvents$"+Sa,mA="__reactListeners$"+Sa,gA="__reactHandles$"+Sa;function is(t){var e=t[ui];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Oi]||n[ui]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=M0(t);t!==null;){if(n=t[ui])return n;t=M0(t)}return e}t=n,n=t.parentNode}return null}function Al(t){return t=t[ui]||t[Oi],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function sa(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(P(33))}function lp(t){return t[Tl]||null}var mv=[],aa=-1;function Sr(t){return{current:t}}function xe(t){0>aa||(t.current=mv[aa],mv[aa]=null,aa--)}function ge(t,e){aa++,mv[aa]=t.current,t.current=e}var Er={},vt=Sr(Er),zt=Sr(!1),ls=Er;function _a(t,e){var n=t.type.contextTypes;if(!n)return Er;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 Ut(t){return t=t.childContextTypes,t!=null}function qd(){xe(zt),xe(vt)}function R0(t,e,n){if(vt.current!==Er)throw Error(P(168));ge(vt,e),ge(zt,n)}function tE(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,nI(t)||"Unknown",r));return Le({},n,i)}function Hd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Er,ls=vt.current,ge(vt,t),ge(zt,zt.current),!0}function L0(t,e,n){var i=t.stateNode;if(!i)throw Error(P(169));n?(t=tE(t,e,ls),i.__reactInternalMemoizedMergedChildContext=t,xe(zt),xe(vt),ge(vt,t)):xe(zt),ge(zt,n)}var Li=null,cp=!1,Ag=!1;function nE(t){Li===null?Li=[t]:Li.push(t)}function vA(t){cp=!0,nE(t)}function Pr(){if(!Ag&&Li!==null){Ag=!0;var t=0,e=de;try{var n=Li;for(de=1;t<n.length;t++){var i=n[t];do i=i(!0);while(i!==null)}Li=null,cp=!1}catch(r){throw Li!==null&&(Li=Li.slice(t+1)),Pk(jv,Pr),r}finally{de=e,Ag=!1}}return null}var oa=[],la=0,Bd=null,Wd=0,vn=[],yn=0,cs=null,Ii=1,Ai="";function ts(t,e){oa[la++]=Wd,oa[la++]=Bd,Bd=t,Wd=e}function iE(t,e,n){vn[yn++]=Ii,vn[yn++]=Ai,vn[yn++]=cs,cs=t;var i=Ii;t=Ai;var r=32-Gn(i)-1;i&=~(1<<r),n+=1;var s=32-Gn(e)+r;if(30<s){var a=r-r%5;s=(i&(1<<a)-1).toString(32),i>>=a,r-=a,Ii=1<<32-Gn(e)+r|n<<r|i,Ai=s+t}else Ii=1<<s|n<<r|i,Ai=t}function Xv(t){t.return!==null&&(ts(t,1),iE(t,1,0))}function Zv(t){for(;t===Bd;)Bd=oa[--la],oa[la]=null,Wd=oa[--la],oa[la]=null;for(;t===cs;)cs=vn[--yn],vn[yn]=null,Ai=vn[--yn],vn[yn]=null,Ii=vn[--yn],vn[yn]=null}var tn=null,en=null,Ce=!1,Kn=null;function rE(t,e){var n=_n(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 I0(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,tn=t,en=yr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,tn=t,en=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=cs!==null?{id:Ii,overflow:Ai}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=_n(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,tn=t,en=null,!0):!1;default:return!1}}function gv(t){return(t.mode&1)!==0&&(t.flags&128)===0}function vv(t){if(Ce){var e=en;if(e){var n=e;if(!I0(t,e)){if(gv(t))throw Error(P(418));e=yr(n.nextSibling);var i=tn;e&&I0(t,e)?rE(i,n):(t.flags=t.flags&-4097|2,Ce=!1,tn=t)}}else{if(gv(t))throw Error(P(418));t.flags=t.flags&-4097|2,Ce=!1,tn=t}}}function A0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;tn=t}function _d(t){if(t!==tn)return!1;if(!Ce)return A0(t),Ce=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!pv(t.type,t.memoizedProps)),e&&(e=en)){if(gv(t))throw sE(),Error(P(418));for(;e;)rE(t,e),e=yr(e.nextSibling)}if(A0(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){en=yr(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}en=null}}else en=tn?yr(t.stateNode.nextSibling):null;return!0}function sE(){for(var t=en;t;)t=yr(t.nextSibling)}function wa(){en=tn=null,Ce=!1}function Jv(t){Kn===null?Kn=[t]:Kn.push(t)}var yA=zi.ReactCurrentBatchConfig;function Bn(t,e){if(t&&t.defaultProps){e=Le({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}var Kd=Sr(null),Gd=null,ca=null,ey=null;function ty(){ey=ca=Gd=null}function ny(t){var e=Kd.current;xe(Kd),t._currentValue=e}function yv(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 ga(t,e){Gd=t,ey=ca=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ft=!0),t.firstContext=null)}function bn(t){var e=t._currentValue;if(ey!==t)if(t={context:t,memoizedValue:e,next:null},ca===null){if(Gd===null)throw Error(P(308));ca=t,Gd.dependencies={lanes:0,firstContext:t}}else ca=ca.next=t;return e}var rs=null;function iy(t){rs===null?rs=[t]:rs.push(t)}function aE(t,e,n,i){var r=e.interleaved;return r===null?(n.next=n,iy(e)):(n.next=r.next,r.next=n),e.interleaved=n,Vi(t,i)}function Vi(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 ur=!1;function ry(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oE(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 Ni(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function _r(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,Vi(t,n)}return r=i.interleaved,r===null?(e.next=e,iy(i)):(e.next=r.next,r.next=e),i.interleaved=e,Vi(t,n)}function Pd(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,qv(t,n)}}function N0(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 Yd(t,e,n,i){var r=t.updateQueue;ur=!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=Le({},d,p);break e;case 2:ur=!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);ds|=a,t.lanes=a,t.memoizedState=d}}function D0(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 lE=new ak.Component().refs;function _v(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:Le({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var up={isMounted:function(t){return(t=t._reactInternals)?fs(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var i=St(),r=br(t),s=Ni(i,r);s.payload=e,n!=null&&(s.callback=n),e=_r(t,s,r),e!==null&&(Yn(e,t,r,i),Pd(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=St(),r=br(t),s=Ni(i,r);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=_r(t,s,r),e!==null&&(Yn(e,t,r,i),Pd(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=St(),i=br(t),r=Ni(n,i);r.tag=2,e!=null&&(r.callback=e),e=_r(t,r,i),e!==null&&(Yn(e,t,i,n),Pd(e,t,i))}};function O0(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?!xl(n,i)||!xl(r,s):!0}function cE(t,e,n){var i=!1,r=Er,s=e.contextType;return typeof s=="object"&&s!==null?s=bn(s):(r=Ut(e)?ls:vt.current,i=e.contextTypes,s=(i=i!=null)?_a(t,r):Er),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=up,t.stateNode=e,e._reactInternals=t,i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function V0(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&&up.enqueueReplaceState(e,e.state,null)}function wv(t,e,n,i){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs=lE,ry(t);var s=e.contextType;typeof s=="object"&&s!==null?r.context=bn(s):(s=Ut(e)?ls:vt.current,r.context=_a(t,s)),r.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(_v(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&&up.enqueueReplaceState(r,r.state,null),Yd(t,n,r,i),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308)}function Zo(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===lE&&(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 wd(t,e){throw t=Object.prototype.toString.call(e),Error(P(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function F0(t){var e=t._init;return e(t._payload)}function uE(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=xr(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=Ug(g,m.mode,x),f.return=m,f):(f=r(f,g),f.return=m,f)}function l(m,f,g,x){var T=g.type;return T===ta?u(m,f,g.props.children,x,g.key):f!==null&&(f.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===cr&&F0(T)===f.type)?(x=r(f,g.props),x.ref=Zo(m,f,g),x.return=m,x):(x=Id(g.type,g.key,g.props,null,m.mode,x),x.ref=Zo(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=jg(g,m.mode,x),f.return=m,f):(f=r(f,g.children||[]),f.return=m,f)}function u(m,f,g,x,T){return f===null||f.tag!==7?(f=os(g,m.mode,x,T),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=Ug(""+f,m.mode,g),f.return=m,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case sd:return g=Id(f.type,f.key,f.props,null,m.mode,g),g.ref=Zo(m,null,f),g.return=m,g;case ea:return f=jg(f,m.mode,g),f.return=m,f;case cr:var x=f._init;return d(m,x(f._payload),g)}if(il(f)||Go(f))return f=os(f,m.mode,g,null),f.return=m,f;wd(m,f)}return null}function p(m,f,g,x){var T=f!==null?f.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return T!==null?null:o(m,f,""+g,x);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case sd:return g.key===T?l(m,f,g,x):null;case ea:return g.key===T?c(m,f,g,x):null;case cr:return T=g._init,p(m,f,T(g._payload),x)}if(il(g)||Go(g))return T!==null?null:u(m,f,g,x,null);wd(m,g)}return null}function h(m,f,g,x,T){if(typeof x=="string"&&x!==""||typeof x=="number")return m=m.get(g)||null,o(f,m,""+x,T);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case sd:return m=m.get(x.key===null?g:x.key)||null,l(f,m,x,T);case ea:return m=m.get(x.key===null?g:x.key)||null,c(f,m,x,T);case cr:var L=x._init;return h(m,f,g,L(x._payload),T)}if(il(x)||Go(x))return m=m.get(g)||null,u(f,m,x,T,null);wd(f,x)}return null}function y(m,f,g,x){for(var T=null,L=null,R=f,I=f=0,K=null;R!==null&&I<g.length;I++){R.index>I?(K=R,R=null):K=R.sibling;var q=p(m,R,g[I],x);if(q===null){R===null&&(R=K);break}t&&R&&q.alternate===null&&e(m,R),f=s(q,f,I),L===null?T=q:L.sibling=q,L=q,R=K}if(I===g.length)return n(m,R),Ce&&ts(m,I),T;if(R===null){for(;I<g.length;I++)R=d(m,g[I],x),R!==null&&(f=s(R,f,I),L===null?T=R:L.sibling=R,L=R);return Ce&&ts(m,I),T}for(R=i(m,R);I<g.length;I++)K=h(R,m,I,g[I],x),K!==null&&(t&&K.alternate!==null&&R.delete(K.key===null?I:K.key),f=s(K,f,I),L===null?T=K:L.sibling=K,L=K);return t&&R.forEach(function(_e){return e(m,_e)}),Ce&&ts(m,I),T}function v(m,f,g,x){var T=Go(g);if(typeof T!="function")throw Error(P(150));if(g=T.call(g),g==null)throw Error(P(151));for(var L=T=null,R=f,I=f=0,K=null,q=g.next();R!==null&&!q.done;I++,q=g.next()){R.index>I?(K=R,R=null):K=R.sibling;var _e=p(m,R,q.value,x);if(_e===null){R===null&&(R=K);break}t&&R&&_e.alternate===null&&e(m,R),f=s(_e,f,I),L===null?T=_e:L.sibling=_e,L=_e,R=K}if(q.done)return n(m,R),Ce&&ts(m,I),T;if(R===null){for(;!q.done;I++,q=g.next())q=d(m,q.value,x),q!==null&&(f=s(q,f,I),L===null?T=q:L.sibling=q,L=q);return Ce&&ts(m,I),T}for(R=i(m,R);!q.done;I++,q=g.next())q=h(R,m,I,q.value,x),q!==null&&(t&&q.alternate!==null&&R.delete(q.key===null?I:q.key),f=s(q,f,I),L===null?T=q:L.sibling=q,L=q);return t&&R.forEach(function(J){return e(m,J)}),Ce&&ts(m,I),T}function _(m,f,g,x){if(typeof g=="object"&&g!==null&&g.type===ta&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case sd:e:{for(var T=g.key,L=f;L!==null;){if(L.key===T){if(T=g.type,T===ta){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===T||typeof T=="object"&&T!==null&&T.$$typeof===cr&&F0(T)===L.type){n(m,L.sibling),f=r(L,g.props),f.ref=Zo(m,L,g),f.return=m,m=f;break e}n(m,L);break}else e(m,L);L=L.sibling}g.type===ta?(f=os(g.props.children,m.mode,x,g.key),f.return=m,m=f):(x=Id(g.type,g.key,g.props,null,m.mode,x),x.ref=Zo(m,f,g),x.return=m,m=x)}return a(m);case ea: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=jg(g,m.mode,x),f.return=m,m=f}return a(m);case cr:return L=g._init,_(m,f,L(g._payload),x)}if(il(g))return y(m,f,g,x);if(Go(g))return v(m,f,g,x);wd(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=Ug(g,m.mode,x),f.return=m,m=f),a(m)):n(m,f)}return _}var ba=uE(!0),dE=uE(!1),Nl={},pi=Sr(Nl),Sl=Sr(Nl),Pl=Sr(Nl);function ss(t){if(t===Nl)throw Error(P(174));return t}function sy(t,e){switch(ge(Pl,e),ge(Sl,t),ge(pi,Nl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Zg(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Zg(e,t)}xe(pi),ge(pi,e)}function xa(){xe(pi),xe(Sl),xe(Pl)}function pE(t){ss(Pl.current);var e=ss(pi.current),n=Zg(e,t.type);e!==n&&(ge(Sl,t),ge(pi,n))}function ay(t){Sl.current===t&&(xe(pi),xe(Sl))}var Me=Sr(0);function Qd(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 Ng=[];function oy(){for(var t=0;t<Ng.length;t++)Ng[t]._workInProgressVersionPrimary=null;Ng.length=0}var Cd=zi.ReactCurrentDispatcher,Dg=zi.ReactCurrentBatchConfig,us=0,Re=null,Ge=null,Ze=null,Xd=!1,dl=!1,Cl=0,_A=0;function ft(){throw Error(P(321))}function ly(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Qn(t[n],e[n]))return!1;return!0}function cy(t,e,n,i,r,s){if(us=s,Re=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Cd.current=t===null||t.memoizedState===null?kA:EA,t=n(i,r),dl){s=0;do{if(dl=!1,Cl=0,25<=s)throw Error(P(301));s+=1,Ze=Ge=null,e.updateQueue=null,Cd.current=TA,t=n(i,r)}while(dl)}if(Cd.current=Zd,e=Ge!==null&&Ge.next!==null,us=0,Ze=Ge=Re=null,Xd=!1,e)throw Error(P(300));return t}function uy(){var t=Cl!==0;return Cl=0,t}function ci(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ze===null?Re.memoizedState=Ze=t:Ze=Ze.next=t,Ze}function xn(){if(Ge===null){var t=Re.alternate;t=t!==null?t.memoizedState:null}else t=Ge.next;var e=Ze===null?Re.memoizedState:Ze.next;if(e!==null)Ze=e,Ge=t;else{if(t===null)throw Error(P(310));Ge=t,t={memoizedState:Ge.memoizedState,baseState:Ge.baseState,baseQueue:Ge.baseQueue,queue:Ge.queue,next:null},Ze===null?Re.memoizedState=Ze=t:Ze=Ze.next=t}return Ze}function $l(t,e){return typeof e=="function"?e(t):e}function Og(t){var e=xn(),n=e.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=t;var i=Ge,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((us&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,Re.lanes|=u,ds|=u}c=c.next}while(c!==null&&c!==s);l===null?a=i:l.next=o,Qn(i,e.memoizedState)||(Ft=!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,Re.lanes|=s,ds|=s,r=r.next;while(r!==t)}else r===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Vg(t){var e=xn(),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);Qn(s,e.memoizedState)||(Ft=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,i]}function hE(){}function fE(t,e){var n=Re,i=xn(),r=e(),s=!Qn(i.memoizedState,r);if(s&&(i.memoizedState=r,Ft=!0),i=i.queue,dy(vE.bind(null,n,i,t),[t]),i.getSnapshot!==e||s||Ze!==null&&Ze.memoizedState.tag&1){if(n.flags|=2048,Ml(9,gE.bind(null,n,i,r,e),void 0,null),Je===null)throw Error(P(349));us&30||mE(n,e,r)}return r}function mE(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Re.updateQueue,e===null?(e={lastEffect:null,stores:null},Re.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function gE(t,e,n,i){e.value=n,e.getSnapshot=i,yE(e)&&_E(t)}function vE(t,e,n){return n(function(){yE(e)&&_E(t)})}function yE(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Qn(t,n)}catch{return!0}}function _E(t){var e=Vi(t,1);e!==null&&Yn(e,t,1,-1)}function z0(t){var e=ci();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$l,lastRenderedState:t},e.queue=t,t=t.dispatch=xA.bind(null,Re,t),[e.memoizedState,t]}function Ml(t,e,n,i){return t={tag:t,create:e,destroy:n,deps:i,next:null},e=Re.updateQueue,e===null?(e={lastEffect:null,stores:null},Re.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 wE(){return xn().memoizedState}function $d(t,e,n,i){var r=ci();Re.flags|=t,r.memoizedState=Ml(1|e,n,void 0,i===void 0?null:i)}function dp(t,e,n,i){var r=xn();i=i===void 0?null:i;var s=void 0;if(Ge!==null){var a=Ge.memoizedState;if(s=a.destroy,i!==null&&ly(i,a.deps)){r.memoizedState=Ml(e,n,s,i);return}}Re.flags|=t,r.memoizedState=Ml(1|e,n,s,i)}function U0(t,e){return $d(8390656,8,t,e)}function dy(t,e){return dp(2048,8,t,e)}function bE(t,e){return dp(4,2,t,e)}function xE(t,e){return dp(4,4,t,e)}function kE(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 EE(t,e,n){return n=n!=null?n.concat([t]):null,dp(4,4,kE.bind(null,e,t),n)}function py(){}function TE(t,e){var n=xn();e=e===void 0?null:e;var i=n.memoizedState;return i!==null&&e!==null&&ly(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function SE(t,e){var n=xn();e=e===void 0?null:e;var i=n.memoizedState;return i!==null&&e!==null&&ly(e,i[1])?i[0]:(t=t(),n.memoizedState=[t,e],t)}function PE(t,e,n){return us&21?(Qn(n,e)||(n=Mk(),Re.lanes|=n,ds|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ft=!0),t.memoizedState=n)}function wA(t,e){var n=de;de=n!==0&&4>n?n:4,t(!0);var i=Dg.transition;Dg.transition={};try{t(!1),e()}finally{de=n,Dg.transition=i}}function CE(){return xn().memoizedState}function bA(t,e,n){var i=br(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},$E(t))ME(e,n);else if(n=aE(t,e,n,i),n!==null){var r=St();Yn(n,t,i,r),RE(n,e,i)}}function xA(t,e,n){var i=br(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if($E(t))ME(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,Qn(o,a)){var l=e.interleaved;l===null?(r.next=r,iy(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=aE(t,e,r,i),n!==null&&(r=St(),Yn(n,t,i,r),RE(n,e,i))}}function $E(t){var e=t.alternate;return t===Re||e!==null&&e===Re}function ME(t,e){dl=Xd=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function RE(t,e,n){if(n&4194240){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,qv(t,n)}}var Zd={readContext:bn,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},kA={readContext:bn,useCallback:function(t,e){return ci().memoizedState=[t,e===void 0?null:e],t},useContext:bn,useEffect:U0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,$d(4194308,4,kE.bind(null,e,t),n)},useLayoutEffect:function(t,e){return $d(4194308,4,t,e)},useInsertionEffect:function(t,e){return $d(4,2,t,e)},useMemo:function(t,e){var n=ci();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=ci();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=bA.bind(null,Re,t),[i.memoizedState,t]},useRef:function(t){var e=ci();return t={current:t},e.memoizedState=t},useState:z0,useDebugValue:py,useDeferredValue:function(t){return ci().memoizedState=t},useTransition:function(){var t=z0(!1),e=t[0];return t=wA.bind(null,t[1]),ci().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=Re,r=ci();if(Ce){if(n===void 0)throw Error(P(407));n=n()}else{if(n=e(),Je===null)throw Error(P(349));us&30||mE(i,e,n)}r.memoizedState=n;var s={value:n,getSnapshot:e};return r.queue=s,U0(vE.bind(null,i,s,t),[t]),i.flags|=2048,Ml(9,gE.bind(null,i,s,n,e),void 0,null),n},useId:function(){var t=ci(),e=Je.identifierPrefix;if(Ce){var n=Ai,i=Ii;n=(i&~(1<<32-Gn(i)-1)).toString(32)+n,e=":"+e+"R"+n,n=Cl++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=_A++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},EA={readContext:bn,useCallback:TE,useContext:bn,useEffect:dy,useImperativeHandle:EE,useInsertionEffect:bE,useLayoutEffect:xE,useMemo:SE,useReducer:Og,useRef:wE,useState:function(){return Og($l)},useDebugValue:py,useDeferredValue:function(t){var e=xn();return PE(e,Ge.memoizedState,t)},useTransition:function(){var t=Og($l)[0],e=xn().memoizedState;return[t,e]},useMutableSource:hE,useSyncExternalStore:fE,useId:CE,unstable_isNewReconciler:!1},TA={readContext:bn,useCallback:TE,useContext:bn,useEffect:dy,useImperativeHandle:EE,useInsertionEffect:bE,useLayoutEffect:xE,useMemo:SE,useReducer:Vg,useRef:wE,useState:function(){return Vg($l)},useDebugValue:py,useDeferredValue:function(t){var e=xn();return Ge===null?e.memoizedState=t:PE(e,Ge.memoizedState,t)},useTransition:function(){var t=Vg($l)[0],e=xn().memoizedState;return[t,e]},useMutableSource:hE,useSyncExternalStore:fE,useId:CE,unstable_isNewReconciler:!1};function ka(t,e){try{var n="",i=e;do n+=tI(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 Fg(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function bv(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var SA=typeof WeakMap=="function"?WeakMap:Map;function LE(t,e,n){n=Ni(-1,n),n.tag=3,n.payload={element:null};var i=e.value;return n.callback=function(){ep||(ep=!0,Rv=i),bv(t,e)},n}function IE(t,e,n){n=Ni(-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(){bv(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){bv(t,e),typeof i!="function"&&(wr===null?wr=new Set([this]):wr.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function j0(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new SA;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=zA.bind(null,t,e,n),e.then(t,t))}function q0(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 H0(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=Ni(-1,1),e.tag=2,_r(n,e,1))),n.lanes|=1),t)}var PA=zi.ReactCurrentOwner,Ft=!1;function Tt(t,e,n,i){e.child=t===null?dE(e,null,n,i):ba(e,t.child,n,i)}function B0(t,e,n,i,r){n=n.render;var s=e.ref;return ga(e,r),i=cy(t,e,n,i,s,r),n=uy(),t!==null&&!Ft?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Fi(t,e,r)):(Ce&&n&&Xv(e),e.flags|=1,Tt(t,e,i,r),e.child)}function W0(t,e,n,i,r){if(t===null){var s=n.type;return typeof s=="function"&&!wy(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,AE(t,e,s,i,r)):(t=Id(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:xl,n(a,i)&&t.ref===e.ref)return Fi(t,e,r)}return e.flags|=1,t=xr(s,i),t.ref=e.ref,t.return=e,e.child=t}function AE(t,e,n,i,r){if(t!==null){var s=t.memoizedProps;if(xl(s,i)&&t.ref===e.ref)if(Ft=!1,e.pendingProps=i=s,(t.lanes&r)!==0)t.flags&131072&&(Ft=!0);else return e.lanes=t.lanes,Fi(t,e,r)}return xv(t,e,n,i,r)}function NE(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},ge(da,Jt),Jt|=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,ge(da,Jt),Jt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:n,ge(da,Jt),Jt|=i}else s!==null?(i=s.baseLanes|n,e.memoizedState=null):i=n,ge(da,Jt),Jt|=i;return Tt(t,e,r,n),e.child}function DE(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function xv(t,e,n,i,r){var s=Ut(n)?ls:vt.current;return s=_a(e,s),ga(e,r),n=cy(t,e,n,i,s,r),i=uy(),t!==null&&!Ft?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Fi(t,e,r)):(Ce&&i&&Xv(e),e.flags|=1,Tt(t,e,n,r),e.child)}function K0(t,e,n,i,r){if(Ut(n)){var s=!0;Hd(e)}else s=!1;if(ga(e,r),e.stateNode===null)Md(t,e),cE(e,n,i),wv(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=bn(c):(c=Ut(n)?ls:vt.current,c=_a(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)&&V0(e,a,i,c),ur=!1;var p=e.memoizedState;a.state=p,Yd(e,i,a,r),l=e.memoizedState,o!==i||p!==l||zt.current||ur?(typeof u=="function"&&(_v(e,n,u,i),l=e.memoizedState),(o=ur||O0(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,oE(t,e),o=e.memoizedProps,c=e.type===e.elementType?o:Bn(e.type,o),a.props=c,d=e.pendingProps,p=a.context,l=n.contextType,typeof l=="object"&&l!==null?l=bn(l):(l=Ut(n)?ls:vt.current,l=_a(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)&&V0(e,a,i,l),ur=!1,p=e.memoizedState,a.state=p,Yd(e,i,a,r);var y=e.memoizedState;o!==d||p!==y||zt.current||ur?(typeof h=="function"&&(_v(e,n,h,i),y=e.memoizedState),(c=ur||O0(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 kv(t,e,n,i,s,r)}function kv(t,e,n,i,r,s){DE(t,e);var a=(e.flags&128)!==0;if(!i&&!a)return r&&L0(e,n,!1),Fi(t,e,s);i=e.stateNode,PA.current=e;var o=a&&typeof n.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,t!==null&&a?(e.child=ba(e,t.child,null,s),e.child=ba(e,null,o,s)):Tt(t,e,o,s),e.memoizedState=i.state,r&&L0(e,n,!0),e.child}function OE(t){var e=t.stateNode;e.pendingContext?R0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&R0(t,e.context,!1),sy(t,e.containerInfo)}function G0(t,e,n,i,r){return wa(),Jv(r),e.flags|=256,Tt(t,e,n,i),e.child}var Ev={dehydrated:null,treeContext:null,retryLane:0};function Tv(t){return{baseLanes:t,cachePool:null,transitions:null}}function VE(t,e,n){var i=e.pendingProps,r=Me.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),ge(Me,r&1),t===null)return vv(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=fp(a,i,0,null),t=os(t,i,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Tv(n),e.memoizedState=Ev,t):hy(e,a));if(r=t.memoizedState,r!==null&&(o=r.dehydrated,o!==null))return CA(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=xr(r,l),i.subtreeFlags=r.subtreeFlags&14680064),o!==null?s=xr(o,s):(s=os(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?Tv(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=t.childLanes&~n,e.memoizedState=Ev,i}return s=t.child,t=s.sibling,i=xr(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 hy(t,e){return e=fp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function bd(t,e,n,i){return i!==null&&Jv(i),ba(e,t.child,null,n),t=hy(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function CA(t,e,n,i,r,s,a){if(n)return e.flags&256?(e.flags&=-257,i=Fg(Error(P(422))),bd(t,e,a,i)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=fp({mode:"visible",children:i.children},r,0,null),s=os(s,r,a,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&ba(e,t.child,null,a),e.child.memoizedState=Tv(a),e.memoizedState=Ev,s);if(!(e.mode&1))return bd(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=Fg(s,i,void 0),bd(t,e,a,i)}if(o=(a&t.childLanes)!==0,Ft||o){if(i=Je,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,Vi(t,r),Yn(i,t,r,-1))}return _y(),i=Fg(Error(P(421))),bd(t,e,a,i)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=UA.bind(null,t),r._reactRetry=e,null):(t=s.treeContext,en=yr(r.nextSibling),tn=e,Ce=!0,Kn=null,t!==null&&(vn[yn++]=Ii,vn[yn++]=Ai,vn[yn++]=cs,Ii=t.id,Ai=t.overflow,cs=e),e=hy(e,i.children),e.flags|=4096,e)}function Y0(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),yv(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 FE(t,e,n){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(Tt(t,e,i.children,n),i=Me.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&&Y0(t,n,e);else if(t.tag===19)Y0(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(ge(Me,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&&Qd(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&&Qd(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 Md(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Fi(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ds|=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=xr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=xr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function $A(t,e,n){switch(e.tag){case 3:OE(e),wa();break;case 5:pE(e);break;case 1:Ut(e.type)&&Hd(e);break;case 4:sy(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;ge(Kd,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(ge(Me,Me.current&1),e.flags|=128,null):n&e.child.childLanes?VE(t,e,n):(ge(Me,Me.current&1),t=Fi(t,e,n),t!==null?t.sibling:null);ge(Me,Me.current&1);break;case 19:if(i=(n&e.childLanes)!==0,t.flags&128){if(i)return FE(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ge(Me,Me.current),i)break;return null;case 22:case 23:return e.lanes=0,NE(t,e,n)}return Fi(t,e,n)}var zE,Sv,UE,jE;zE=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}};Sv=function(){};UE=function(t,e,n,i){var r=t.memoizedProps;if(r!==i){t=e.stateNode,ss(pi.current);var s=null;switch(n){case"input":r=Gg(t,r),i=Gg(t,i),s=[];break;case"select":r=Le({},r,{value:void 0}),i=Le({},i,{value:void 0}),s=[];break;case"textarea":r=Xg(t,r),i=Xg(t,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(t.onclick=jd)}Jg(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"&&(ml.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"&&(ml.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)}};jE=function(t,e,n,i){n!==i&&(e.flags|=4)};function Jo(t,e){if(!Ce)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 MA(t,e,n){var i=e.pendingProps;switch(Zv(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 Ut(e.type)&&qd(),mt(e),null;case 3:return i=e.stateNode,xa(),xe(zt),xe(vt),oy(),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,Kn!==null&&(Av(Kn),Kn=null))),Sv(t,e),mt(e),null;case 5:ay(e);var r=ss(Pl.current);if(n=e.type,t!==null&&e.stateNode!=null)UE(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=ss(pi.current),_d(e)){i=e.stateNode,n=e.type;var s=e.memoizedProps;switch(i[ui]=e,i[Tl]=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<sl.length;r++)be(sl[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":i0(i,s),be("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},be("invalid",i);break;case"textarea":s0(i,s),be("invalid",i)}Jg(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&&yd(i.textContent,o,t),r=["children",o]):typeof o=="number"&&i.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&yd(i.textContent,o,t),r=["children",""+o]):ml.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&be("scroll",i)}switch(n){case"input":ad(i),r0(i,s,!0);break;case"textarea":ad(i),a0(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=jd)}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=mk(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[ui]=e,t[Tl]=i,zE(t,e,!1,!1),e.stateNode=t;e:{switch(a=ev(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<sl.length;r++)be(sl[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":i0(t,i),r=Gg(t,i),be("invalid",t);break;case"option":r=i;break;case"select":t._wrapperState={wasMultiple:!!i.multiple},r=Le({},i,{value:void 0}),be("invalid",t);break;case"textarea":s0(t,i),r=Xg(t,i),be("invalid",t);break;default:r=i}Jg(n,r),o=r;for(s in o)if(o.hasOwnProperty(s)){var l=o[s];s==="style"?yk(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&gk(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&gl(t,l):typeof l=="number"&&gl(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(ml.hasOwnProperty(s)?l!=null&&s==="onScroll"&&be("scroll",t):l!=null&&Ov(t,s,l,a))}switch(n){case"input":ad(t),r0(t,i,!1);break;case"textarea":ad(t),a0(t);break;case"option":i.value!=null&&t.setAttribute("value",""+kr(i.value));break;case"select":t.multiple=!!i.multiple,s=i.value,s!=null?pa(t,!!i.multiple,s,!1):i.defaultValue!=null&&pa(t,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(t.onclick=jd)}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)jE(t,e,t.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(P(166));if(n=ss(Pl.current),ss(pi.current),_d(e)){if(i=e.stateNode,n=e.memoizedProps,i[ui]=e,(s=i.nodeValue!==n)&&(t=tn,t!==null))switch(t.tag){case 3:yd(i.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&yd(i.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ui]=e,e.stateNode=i}return mt(e),null;case 13:if(xe(Me),i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ce&&en!==null&&e.mode&1&&!(e.flags&128))sE(),wa(),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[ui]=e}else wa(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;mt(e),s=!1}else Kn!==null&&(Av(Kn),Kn=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||Me.current&1?Ye===0&&(Ye=3):_y())),e.updateQueue!==null&&(e.flags|=4),mt(e),null);case 4:return xa(),Sv(t,e),t===null&&kl(e.stateNode.containerInfo),mt(e),null;case 10:return ny(e.type._context),mt(e),null;case 17:return Ut(e.type)&&qd(),mt(e),null;case 19:if(xe(Me),s=e.memoizedState,s===null)return mt(e),null;if(i=(e.flags&128)!==0,a=s.rendering,a===null)if(i)Jo(s,!1);else{if(Ye!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=Qd(t),a!==null){for(e.flags|=128,Jo(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 ge(Me,Me.current&1|2),e.child}t=t.sibling}s.tail!==null&&Ve()>Ea&&(e.flags|=128,i=!0,Jo(s,!1),e.lanes=4194304)}else{if(!i)if(t=Qd(a),t!==null){if(e.flags|=128,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Jo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Ce)return mt(e),null}else 2*Ve()-s.renderingStartTime>Ea&&n!==1073741824&&(e.flags|=128,i=!0,Jo(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=Ve(),e.sibling=null,n=Me.current,ge(Me,i?n&1|2:n&1),e):(mt(e),null);case 22:case 23:return yy(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Jt&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 RA(t,e){switch(Zv(e),e.tag){case 1:return Ut(e.type)&&qd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xa(),xe(zt),xe(vt),oy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ay(e),null;case 13:if(xe(Me),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(P(340));wa()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return xe(Me),null;case 4:return xa(),null;case 10:return ny(e.type._context),null;case 22:case 23:return yy(),null;case 24:return null;default:return null}}var xd=!1,gt=!1,LA=typeof WeakSet=="function"?WeakSet:Set,A=null;function ua(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){Oe(t,e,i)}else n.current=null}function Pv(t,e,n){try{n()}catch(i){Oe(t,e,i)}}var Q0=!1;function IA(t,e){if(uv=Fd,t=Wk(),Qv(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(dv={focusedElem:t,selectionRange:n},Fd=!1,A=e;A!==null;)if(e=A,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,A=t;else for(;A!==null;){e=A;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,_=y.memoizedState,m=e.stateNode,f=m.getSnapshotBeforeUpdate(e.elementType===e.type?v:Bn(e.type,v),_);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){Oe(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,A=t;break}A=e.return}return y=Q0,Q0=!1,y}function pl(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&&Pv(e,n,s)}r=r.next}while(r!==i)}}function pp(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 Cv(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 qE(t){var e=t.alternate;e!==null&&(t.alternate=null,qE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ui],delete e[Tl],delete e[fv],delete e[mA],delete e[gA])),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 HE(t){return t.tag===5||t.tag===3||t.tag===4}function X0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||HE(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 $v(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=jd));else if(i!==4&&(t=t.child,t!==null))for($v(t,e,n),t=t.sibling;t!==null;)$v(t,e,n),t=t.sibling}function Mv(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(Mv(t,e,n),t=t.sibling;t!==null;)Mv(t,e,n),t=t.sibling}var st=null,Wn=!1;function lr(t,e,n){for(n=n.child;n!==null;)BE(t,e,n),n=n.sibling}function BE(t,e,n){if(di&&typeof di.onCommitFiberUnmount=="function")try{di.onCommitFiberUnmount(rp,n)}catch{}switch(n.tag){case 5:gt||ua(n,e);case 6:var i=st,r=Wn;st=null,lr(t,e,n),st=i,Wn=r,st!==null&&(Wn?(t=st,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):st.removeChild(n.stateNode));break;case 18:st!==null&&(Wn?(t=st,n=n.stateNode,t.nodeType===8?Ig(t.parentNode,n):t.nodeType===1&&Ig(t,n),wl(t)):Ig(st,n.stateNode));break;case 4:i=st,r=Wn,st=n.stateNode.containerInfo,Wn=!0,lr(t,e,n),st=i,Wn=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)&&Pv(n,e,a),r=r.next}while(r!==i)}lr(t,e,n);break;case 1:if(!gt&&(ua(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(o){Oe(n,e,o)}lr(t,e,n);break;case 21:lr(t,e,n);break;case 22:n.mode&1?(gt=(i=gt)||n.memoizedState!==null,lr(t,e,n),gt=i):lr(t,e,n);break;default:lr(t,e,n)}}function Z0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new LA),e.forEach(function(i){var r=jA.bind(null,t,i);n.has(i)||(n.add(i),i.then(r,r))})}}function Hn(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:st=o.stateNode,Wn=!1;break e;case 3:st=o.stateNode.containerInfo,Wn=!0;break e;case 4:st=o.stateNode.containerInfo,Wn=!0;break e}o=o.return}if(st===null)throw Error(P(160));BE(s,a,r),st=null,Wn=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Oe(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)WE(e,t),e=e.sibling}function WE(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Hn(e,t),li(t),i&4){try{pl(3,t,t.return),pp(3,t)}catch(v){Oe(t,t.return,v)}try{pl(5,t,t.return)}catch(v){Oe(t,t.return,v)}}break;case 1:Hn(e,t),li(t),i&512&&n!==null&&ua(n,n.return);break;case 5:if(Hn(e,t),li(t),i&512&&n!==null&&ua(n,n.return),t.flags&32){var r=t.stateNode;try{gl(r,"")}catch(v){Oe(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&&hk(r,s),ev(o,a);var c=ev(o,s);for(a=0;a<l.length;a+=2){var u=l[a],d=l[a+1];u==="style"?yk(r,d):u==="dangerouslySetInnerHTML"?gk(r,d):u==="children"?gl(r,d):Ov(r,u,d,c)}switch(o){case"input":Yg(r,s);break;case"textarea":fk(r,s);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?pa(r,!!s.multiple,h,!1):p!==!!s.multiple&&(s.defaultValue!=null?pa(r,!!s.multiple,s.defaultValue,!0):pa(r,!!s.multiple,s.multiple?[]:"",!1))}r[Tl]=s}catch(v){Oe(t,t.return,v)}}break;case 6:if(Hn(e,t),li(t),i&4){if(t.stateNode===null)throw Error(P(162));r=t.stateNode,s=t.memoizedProps;try{r.nodeValue=s}catch(v){Oe(t,t.return,v)}}break;case 3:if(Hn(e,t),li(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{wl(e.containerInfo)}catch(v){Oe(t,t.return,v)}break;case 4:Hn(e,t),li(t);break;case 13:Hn(e,t),li(t),r=t.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(gy=Ve())),i&4&&Z0(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(gt=(c=gt)||u,Hn(e,t),gt=c):Hn(e,t),li(t),i&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(A=t,u=t.child;u!==null;){for(d=A=u;A!==null;){switch(p=A,h=p.child,p.tag){case 0:case 11:case 14:case 15:pl(4,p,p.return);break;case 1:ua(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){Oe(i,n,v)}}break;case 5:ua(p,p.return);break;case 22:if(p.memoizedState!==null){ek(d);continue}}h!==null?(h.return=p,A=h):ek(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=vk("display",a))}catch(v){Oe(t,t.return,v)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(v){Oe(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:Hn(e,t),li(t),i&4&&Z0(t);break;case 21:break;default:Hn(e,t),li(t)}}function li(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(HE(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&&(gl(r,""),i.flags&=-33);var s=X0(t);Mv(t,s,r);break;case 3:case 4:var a=i.stateNode.containerInfo,o=X0(t);$v(t,o,a);break;default:throw Error(P(161))}}catch(l){Oe(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function AA(t,e,n){A=t,KE(t,e,n)}function KE(t,e,n){for(var i=(t.mode&1)!==0;A!==null;){var r=A,s=r.child;if(r.tag===22&&i){var a=r.memoizedState!==null||xd;if(!a){var o=r.alternate,l=o!==null&&o.memoizedState!==null||gt;o=xd;var c=gt;if(xd=a,(gt=l)&&!c)for(A=r;A!==null;)a=A,l=a.child,a.tag===22&&a.memoizedState!==null?tk(r):l!==null?(l.return=a,A=l):tk(r);for(;s!==null;)A=s,KE(s,e,n),s=s.sibling;A=r,xd=o,gt=c}J0(t,e,n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,A=s):J0(t,e,n)}}function J0(t){for(;A!==null;){var e=A;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:gt||pp(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:Bn(e.type,n.memoizedProps);i.componentDidUpdate(r,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&D0(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}D0(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&&wl(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}gt||e.flags&512&&Cv(e)}catch(p){Oe(e,e.return,p)}}if(e===t){A=null;break}if(n=e.sibling,n!==null){n.return=e.return,A=n;break}A=e.return}}function ek(t){for(;A!==null;){var e=A;if(e===t){A=null;break}var n=e.sibling;if(n!==null){n.return=e.return,A=n;break}A=e.return}}function tk(t){for(;A!==null;){var e=A;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{pp(4,e)}catch(l){Oe(e,n,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){Oe(e,r,l)}}var s=e.return;try{Cv(e)}catch(l){Oe(e,s,l)}break;case 5:var a=e.return;try{Cv(e)}catch(l){Oe(e,a,l)}}}catch(l){Oe(e,e.return,l)}if(e===t){A=null;break}var o=e.sibling;if(o!==null){o.return=e.return,A=o;break}A=e.return}}var NA=Math.ceil,Jd=zi.ReactCurrentDispatcher,fy=zi.ReactCurrentOwner,wn=zi.ReactCurrentBatchConfig,se=0,Je=null,qe=null,at=0,Jt=0,da=Sr(0),Ye=0,Rl=null,ds=0,hp=0,my=0,hl=null,Vt=null,gy=0,Ea=1/0,Ri=null,ep=!1,Rv=null,wr=null,kd=!1,fr=null,tp=0,fl=0,Lv=null,Rd=-1,Ld=0;function St(){return se&6?Ve():Rd!==-1?Rd:Rd=Ve()}function br(t){return t.mode&1?se&2&&at!==0?at&-at:yA.transition!==null?(Ld===0&&(Ld=Mk()),Ld):(t=de,t!==0||(t=window.event,t=t===void 0?16:Ok(t.type)),t):1}function Yn(t,e,n,i){if(50<fl)throw fl=0,Lv=null,Error(P(185));Ll(t,n,i),(!(se&2)||t!==Je)&&(t===Je&&(!(se&2)&&(hp|=n),Ye===4&&pr(t,at)),jt(t,i),n===1&&se===0&&!(e.mode&1)&&(Ea=Ve()+500,cp&&Pr()))}function jt(t,e){var n=t.callbackNode;wI(t,e);var i=Vd(t,t===Je?at:0);if(i===0)n!==null&&c0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=i&-i,t.callbackPriority!==e){if(n!=null&&c0(n),e===1)t.tag===0?vA(nk.bind(null,t)):nE(nk.bind(null,t)),hA(function(){!(se&6)&&Pr()}),n=null;else{switch(Rk(i)){case 1:n=jv;break;case 4:n=Ck;break;case 16:n=Od;break;case 536870912:n=$k;break;default:n=Od}n=tT(n,GE.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function GE(t,e){if(Rd=-1,Ld=0,se&6)throw Error(P(327));var n=t.callbackNode;if(va()&&t.callbackNode!==n)return null;var i=Vd(t,t===Je?at:0);if(i===0)return null;if(i&30||i&t.expiredLanes||e)e=np(t,i);else{e=i;var r=se;se|=2;var s=QE();(Je!==t||at!==e)&&(Ri=null,Ea=Ve()+500,as(t,e));do try{VA();break}catch(o){YE(t,o)}while(!0);ty(),Jd.current=s,se=r,qe!==null?e=0:(Je=null,at=0,e=Ye)}if(e!==0){if(e===2&&(r=sv(t),r!==0&&(i=r,e=Iv(t,r))),e===1)throw n=Rl,as(t,0),pr(t,i),jt(t,Ve()),n;if(e===6)pr(t,i);else{if(r=t.current.alternate,!(i&30)&&!DA(r)&&(e=np(t,i),e===2&&(s=sv(t),s!==0&&(i=s,e=Iv(t,s))),e===1))throw n=Rl,as(t,0),pr(t,i),jt(t,Ve()),n;switch(t.finishedWork=r,t.finishedLanes=i,e){case 0:case 1:throw Error(P(345));case 2:ns(t,Vt,Ri);break;case 3:if(pr(t,i),(i&130023424)===i&&(e=gy+500-Ve(),10<e)){if(Vd(t,0)!==0)break;if(r=t.suspendedLanes,(r&i)!==i){St(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=hv(ns.bind(null,t,Vt,Ri),e);break}ns(t,Vt,Ri);break;case 4:if(pr(t,i),(i&4194240)===i)break;for(e=t.eventTimes,r=-1;0<i;){var a=31-Gn(i);s=1<<a,a=e[a],a>r&&(r=a),i&=~s}if(i=r,i=Ve()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*NA(i/1960))-i,10<i){t.timeoutHandle=hv(ns.bind(null,t,Vt,Ri),i);break}ns(t,Vt,Ri);break;case 5:ns(t,Vt,Ri);break;default:throw Error(P(329))}}}return jt(t,Ve()),t.callbackNode===n?GE.bind(null,t):null}function Iv(t,e){var n=hl;return t.current.memoizedState.isDehydrated&&(as(t,e).flags|=256),t=np(t,e),t!==2&&(e=Vt,Vt=n,e!==null&&Av(e)),t}function Av(t){Vt===null?Vt=t:Vt.push.apply(Vt,t)}function DA(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(!Qn(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 pr(t,e){for(e&=~my,e&=~hp,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Gn(e),i=1<<n;t[n]=-1,e&=~i}}function nk(t){if(se&6)throw Error(P(327));va();var e=Vd(t,0);if(!(e&1))return jt(t,Ve()),null;var n=np(t,e);if(t.tag!==0&&n===2){var i=sv(t);i!==0&&(e=i,n=Iv(t,i))}if(n===1)throw n=Rl,as(t,0),pr(t,e),jt(t,Ve()),n;if(n===6)throw Error(P(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ns(t,Vt,Ri),jt(t,Ve()),null}function vy(t,e){var n=se;se|=1;try{return t(e)}finally{se=n,se===0&&(Ea=Ve()+500,cp&&Pr())}}function ps(t){fr!==null&&fr.tag===0&&!(se&6)&&va();var e=se;se|=1;var n=wn.transition,i=de;try{if(wn.transition=null,de=1,t)return t()}finally{de=i,wn.transition=n,se=e,!(se&6)&&Pr()}}function yy(){Jt=da.current,xe(da)}function as(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,pA(n)),qe!==null)for(n=qe.return;n!==null;){var i=n;switch(Zv(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&qd();break;case 3:xa(),xe(zt),xe(vt),oy();break;case 5:ay(i);break;case 4:xa();break;case 13:xe(Me);break;case 19:xe(Me);break;case 10:ny(i.type._context);break;case 22:case 23:yy()}n=n.return}if(Je=t,qe=t=xr(t.current,null),at=Jt=e,Ye=0,Rl=null,my=hp=ds=0,Vt=hl=null,rs!==null){for(e=0;e<rs.length;e++)if(n=rs[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}rs=null}return t}function YE(t,e){do{var n=qe;try{if(ty(),Cd.current=Zd,Xd){for(var i=Re.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Xd=!1}if(us=0,Ze=Ge=Re=null,dl=!1,Cl=0,fy.current=null,n===null||n.return===null){Ye=1,Rl=e,qe=null;break}e:{var s=t,a=n.return,o=n,l=e;if(e=at,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=q0(a);if(h!==null){h.flags&=-257,H0(h,a,o,s,e),h.mode&1&&j0(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)){j0(s,c,e),_y();break e}l=Error(P(426))}}else if(Ce&&o.mode&1){var _=q0(a);if(_!==null){!(_.flags&65536)&&(_.flags|=256),H0(_,a,o,s,e),Jv(ka(l,o));break e}}s=l=ka(l,o),Ye!==4&&(Ye=2),hl===null?hl=[s]:hl.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var m=LE(s,l,e);N0(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"&&(wr===null||!wr.has(g)))){s.flags|=65536,e&=-e,s.lanes|=e;var x=IE(s,o,e);N0(s,x);break e}}s=s.return}while(s!==null)}ZE(n)}catch(T){e=T,qe===n&&n!==null&&(qe=n=n.return);continue}break}while(!0)}function QE(){var t=Jd.current;return Jd.current=Zd,t===null?Zd:t}function _y(){(Ye===0||Ye===3||Ye===2)&&(Ye=4),Je===null||!(ds&268435455)&&!(hp&268435455)||pr(Je,at)}function np(t,e){var n=se;se|=2;var i=QE();(Je!==t||at!==e)&&(Ri=null,as(t,e));do try{OA();break}catch(r){YE(t,r)}while(!0);if(ty(),se=n,Jd.current=i,qe!==null)throw Error(P(261));return Je=null,at=0,Ye}function OA(){for(;qe!==null;)XE(qe)}function VA(){for(;qe!==null&&!dI();)XE(qe)}function XE(t){var e=eT(t.alternate,t,Jt);t.memoizedProps=t.pendingProps,e===null?ZE(t):qe=e,fy.current=null}function ZE(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=RA(n,e),n!==null){n.flags&=32767,qe=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ye=6,qe=null;return}}else if(n=MA(n,e,Jt),n!==null){qe=n;return}if(e=e.sibling,e!==null){qe=e;return}qe=e=t}while(e!==null);Ye===0&&(Ye=5)}function ns(t,e,n){var i=de,r=wn.transition;try{wn.transition=null,de=1,FA(t,e,n,i)}finally{wn.transition=r,de=i}return null}function FA(t,e,n,i){do va();while(fr!==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(bI(t,s),t===Je&&(qe=Je=null,at=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||kd||(kd=!0,tT(Od,function(){return va(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=wn.transition,wn.transition=null;var a=de;de=1;var o=se;se|=4,fy.current=null,IA(t,n),WE(n,t),oA(dv),Fd=!!uv,dv=uv=null,t.current=n,AA(n,t,r),pI(),se=o,de=a,wn.transition=s}else t.current=n;if(kd&&(kd=!1,fr=t,tp=r),s=t.pendingLanes,s===0&&(wr=null),mI(n.stateNode,i),jt(t,Ve()),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(ep)throw ep=!1,t=Rv,Rv=null,t;return tp&1&&t.tag!==0&&va(),s=t.pendingLanes,s&1?t===Lv?fl++:(fl=0,Lv=t):fl=0,Pr(),null}function va(){if(fr!==null){var t=Rk(tp),e=wn.transition,n=de;try{if(wn.transition=null,de=16>t?16:t,fr===null)var i=!1;else{if(t=fr,fr=null,tp=0,se&6)throw Error(P(331));var r=se;for(se|=4,A=t.current;A!==null;){var s=A,a=s.child;if(A.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l<o.length;l++){var c=o[l];for(A=c;A!==null;){var u=A;switch(u.tag){case 0:case 11:case 15:pl(8,u,s)}var d=u.child;if(d!==null)d.return=u,A=d;else for(;A!==null;){u=A;var p=u.sibling,h=u.return;if(qE(u),u===c){A=null;break}if(p!==null){p.return=h,A=p;break}A=h}}}var y=s.alternate;if(y!==null){var v=y.child;if(v!==null){y.child=null;do{var _=v.sibling;v.sibling=null,v=_}while(v!==null)}}A=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,A=a;else e:for(;A!==null;){if(s=A,s.flags&2048)switch(s.tag){case 0:case 11:case 15:pl(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,A=m;break e}A=s.return}}var f=t.current;for(A=f;A!==null;){a=A;var g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,A=g;else e:for(a=f;A!==null;){if(o=A,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:pp(9,o)}}catch(T){Oe(o,o.return,T)}if(o===a){A=null;break e}var x=o.sibling;if(x!==null){x.return=o.return,A=x;break e}A=o.return}}if(se=r,Pr(),di&&typeof di.onPostCommitFiberRoot=="function")try{di.onPostCommitFiberRoot(rp,t)}catch{}i=!0}return i}finally{de=n,wn.transition=e}}return!1}function ik(t,e,n){e=ka(n,e),e=LE(t,e,1),t=_r(t,e,1),e=St(),t!==null&&(Ll(t,1,e),jt(t,e))}function Oe(t,e,n){if(t.tag===3)ik(t,t,n);else for(;e!==null;){if(e.tag===3){ik(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(wr===null||!wr.has(i))){t=ka(n,t),t=IE(e,t,1),e=_r(e,t,1),t=St(),e!==null&&(Ll(e,1,t),jt(e,t));break}}e=e.return}}function zA(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),e=St(),t.pingedLanes|=t.suspendedLanes&n,Je===t&&(at&n)===n&&(Ye===4||Ye===3&&(at&130023424)===at&&500>Ve()-gy?as(t,0):my|=n),jt(t,e)}function JE(t,e){e===0&&(t.mode&1?(e=cd,cd<<=1,!(cd&130023424)&&(cd=4194304)):e=1);var n=St();t=Vi(t,e),t!==null&&(Ll(t,e,n),jt(t,n))}function UA(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),JE(t,n)}function jA(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),JE(t,n)}var eT;eT=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||zt.current)Ft=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ft=!1,$A(t,e,n);Ft=!!(t.flags&131072)}else Ft=!1,Ce&&e.flags&1048576&&iE(e,Wd,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Md(t,e),t=e.pendingProps;var r=_a(e,vt.current);ga(e,n),r=cy(null,e,i,t,r,n);var s=uy();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,Ut(i)?(s=!0,Hd(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,ry(e),r.updater=up,e.stateNode=r,r._reactInternals=e,wv(e,i,t,n),e=kv(null,e,i,!0,s,n)):(e.tag=0,Ce&&s&&Xv(e),Tt(null,e,r,n),e=e.child),e;case 16:i=e.elementType;e:{switch(Md(t,e),t=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=HA(i),t=Bn(i,t),r){case 0:e=xv(null,e,i,t,n);break e;case 1:e=K0(null,e,i,t,n);break e;case 11:e=B0(null,e,i,t,n);break e;case 14:e=W0(null,e,i,Bn(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:Bn(i,r),xv(t,e,i,r,n);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bn(i,r),K0(t,e,i,r,n);case 3:e:{if(OE(e),t===null)throw Error(P(387));i=e.pendingProps,s=e.memoizedState,r=s.element,oE(t,e),Yd(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=ka(Error(P(423)),e),e=G0(t,e,i,n,r);break e}else if(i!==r){r=ka(Error(P(424)),e),e=G0(t,e,i,n,r);break e}else for(en=yr(e.stateNode.containerInfo.firstChild),tn=e,Ce=!0,Kn=null,n=dE(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wa(),i===r){e=Fi(t,e,n);break e}Tt(t,e,i,n)}e=e.child}return e;case 5:return pE(e),t===null&&vv(e),i=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,pv(i,r)?a=null:s!==null&&pv(i,s)&&(e.flags|=32),DE(t,e),Tt(t,e,a,n),e.child;case 6:return t===null&&vv(e),null;case 13:return VE(t,e,n);case 4:return sy(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=ba(e,null,i,n):Tt(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bn(i,r),B0(t,e,i,r,n);case 7:return Tt(t,e,e.pendingProps,n),e.child;case 8:return Tt(t,e,e.pendingProps.children,n),e.child;case 12:return Tt(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,ge(Kd,i._currentValue),i._currentValue=a,s!==null)if(Qn(s.value,a)){if(s.children===r.children&&!zt.current){e=Fi(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=Ni(-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),yv(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),yv(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}Tt(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,ga(e,n),r=bn(r),i=i(r),e.flags|=1,Tt(t,e,i,n),e.child;case 14:return i=e.type,r=Bn(i,e.pendingProps),r=Bn(i.type,r),W0(t,e,i,r,n);case 15:return AE(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bn(i,r),Md(t,e),e.tag=1,Ut(i)?(t=!0,Hd(e)):t=!1,ga(e,n),cE(e,i,r),wv(e,i,r,n),kv(null,e,i,!0,t,n);case 19:return FE(t,e,n);case 22:return NE(t,e,n)}throw Error(P(156,e.tag))};function tT(t,e){return Pk(t,e)}function qA(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 _n(t,e,n,i){return new qA(t,e,n,i)}function wy(t){return t=t.prototype,!(!t||!t.isReactComponent)}function HA(t){if(typeof t=="function")return wy(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Fv)return 11;if(t===zv)return 14}return 2}function xr(t,e){var n=t.alternate;return n===null?(n=_n(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 Id(t,e,n,i,r,s){var a=2;if(i=t,typeof t=="function")wy(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case ta:return os(n.children,r,s,e);case Vv:a=8,r|=8;break;case Hg:return t=_n(12,n,e,r|2),t.elementType=Hg,t.lanes=s,t;case Bg:return t=_n(13,n,e,r),t.elementType=Bg,t.lanes=s,t;case Wg:return t=_n(19,n,e,r),t.elementType=Wg,t.lanes=s,t;case uk:return fp(n,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case lk:a=10;break e;case ck:a=9;break e;case Fv:a=11;break e;case zv:a=14;break e;case cr:a=16,i=null;break e}throw Error(P(130,t==null?t:typeof t,""))}return e=_n(a,n,e,r),e.elementType=t,e.type=i,e.lanes=s,e}function os(t,e,n,i){return t=_n(7,t,i,e),t.lanes=n,t}function fp(t,e,n,i){return t=_n(22,t,i,e),t.elementType=uk,t.lanes=n,t.stateNode={isHidden:!1},t}function Ug(t,e,n){return t=_n(6,t,null,e),t.lanes=n,t}function jg(t,e,n){return e=_n(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function BA(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=Tg(0),this.expirationTimes=Tg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tg(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function by(t,e,n,i,r,s,a,o,l){return t=new BA(t,e,n,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=_n(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ry(s),t}function WA(t,e,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ea,key:i==null?null:""+i,children:t,containerInfo:e,implementation:n}}function nT(t){if(!t)return Er;t=t._reactInternals;e:{if(fs(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(Ut(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(Ut(n))return tE(t,n,e)}return e}function iT(t,e,n,i,r,s,a,o,l){return t=by(n,i,!0,t,r,s,a,o,l),t.context=nT(null),n=t.current,i=St(),r=br(n),s=Ni(i,r),s.callback=e??null,_r(n,s,r),t.current.lanes=r,Ll(t,r,i),jt(t,i),t}function mp(t,e,n,i){var r=e.current,s=St(),a=br(r);return n=nT(n),e.context===null?e.context=n:e.pendingContext=n,e=Ni(s,a),e.payload={element:t},i=i===void 0?null:i,i!==null&&(e.callback=i),t=_r(r,e,a),t!==null&&(Yn(t,r,a,s),Pd(t,r,a)),a}function ip(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 rk(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function xy(t,e){rk(t,e),(t=t.alternate)&&rk(t,e)}function KA(){return null}var rT=typeof reportError=="function"?reportError:function(t){console.error(t)};function ky(t){this._internalRoot=t}gp.prototype.render=ky.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(P(409));mp(t,e,null,null)};gp.prototype.unmount=ky.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ps(function(){mp(null,t,null,null)}),e[Oi]=null}};function gp(t){this._internalRoot=t}gp.prototype.unstable_scheduleHydration=function(t){if(t){var e=Ak();t={blockedOn:null,target:t,priority:e};for(var n=0;n<dr.length&&e!==0&&e<dr[n].priority;n++);dr.splice(n,0,t),n===0&&Dk(t)}};function Ey(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function vp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function sk(){}function GA(t,e,n,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=ip(a);s.call(c)}}var a=iT(e,i,t,0,null,!1,!1,"",sk);return t._reactRootContainer=a,t[Oi]=a.current,kl(t.nodeType===8?t.parentNode:t),ps(),a}for(;r=t.lastChild;)t.removeChild(r);if(typeof i=="function"){var o=i;i=function(){var c=ip(l);o.call(c)}}var l=by(t,0,!1,null,null,!1,!1,"",sk);return t._reactRootContainer=l,t[Oi]=l.current,kl(t.nodeType===8?t.parentNode:t),ps(function(){mp(e,l,n,i)}),l}function yp(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=ip(a);o.call(l)}}mp(e,a,t,r)}else a=GA(n,e,t,r,i);return ip(a)}Lk=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=rl(e.pendingLanes);n!==0&&(qv(e,n|1),jt(e,Ve()),!(se&6)&&(Ea=Ve()+500,Pr()))}break;case 13:ps(function(){var i=Vi(t,1);if(i!==null){var r=St();Yn(i,t,1,r)}}),xy(t,1)}};Hv=function(t){if(t.tag===13){var e=Vi(t,134217728);if(e!==null){var n=St();Yn(e,t,134217728,n)}xy(t,134217728)}};Ik=function(t){if(t.tag===13){var e=br(t),n=Vi(t,e);if(n!==null){var i=St();Yn(n,t,e,i)}xy(t,e)}};Ak=function(){return de};Nk=function(t,e){var n=de;try{return de=t,e()}finally{de=n}};nv=function(t,e,n){switch(e){case"input":if(Yg(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=lp(i);if(!r)throw Error(P(90));pk(i),Yg(i,r)}}}break;case"textarea":fk(t,n);break;case"select":e=n.value,e!=null&&pa(t,!!n.multiple,e,!1)}};bk=vy;xk=ps;var YA={usingClientEntryPoint:!1,Events:[Al,sa,lp,_k,wk,vy]},el={findFiberByHostInstance:is,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},QA={bundleType:el.bundleType,version:el.version,rendererPackageName:el.rendererPackageName,rendererConfig:el.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:zi.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Tk(t),t===null?null:t.stateNode},findFiberByHostInstance:el.findFiberByHostInstance||KA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(tl=__REACT_DEVTOOLS_GLOBAL_HOOK__,!tl.isDisabled&&tl.supportsFiber))try{rp=tl.inject(QA),di=tl}catch{}var tl;sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YA;sn.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ey(e))throw Error(P(200));return WA(t,e,null,n)};sn.createRoot=function(t,e){if(!Ey(t))throw Error(P(299));var n=!1,i="",r=rT;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=by(t,1,!1,null,null,n,!1,i,r),t[Oi]=e.current,kl(t.nodeType===8?t.parentNode:t),new ky(e)};sn.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=Tk(e),t=t===null?null:t.stateNode,t};sn.flushSync=function(t){return ps(t)};sn.hydrate=function(t,e,n){if(!vp(e))throw Error(P(200));return yp(null,t,e,!0,n)};sn.hydrateRoot=function(t,e,n){if(!Ey(t))throw Error(P(405));var i=n!=null&&n.hydratedSources||null,r=!1,s="",a=rT;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),e=iT(e,null,t,1,n??null,r,!1,s,a),t[Oi]=e.current,kl(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 gp(e)};sn.render=function(t,e,n){if(!vp(e))throw Error(P(200));return yp(null,t,e,!1,n)};sn.unmountComponentAtNode=function(t){if(!vp(t))throw Error(P(40));return t._reactRootContainer?(ps(function(){yp(null,null,t,!1,function(){t._reactRootContainer=null,t[Oi]=null})}),!0):!1};sn.unstable_batchedUpdates=vy;sn.unstable_renderSubtreeIntoContainer=function(t,e,n,i){if(!vp(n))throw Error(P(200));if(t==null||t._reactInternals===void 0)throw Error(P(38));return yp(t,e,n,!1,i)};sn.version="18.2.0-next-9e3b772b8-20220608"});var Dl=dt((pz,oT)=>{"use strict";function aT(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(aT)}catch(t){console.error(t)}}aT(),oT.exports=sT()});var Ol=dt(Ty=>{"use strict";var lT=Dl();Ty.createRoot=lT.createRoot,Ty.hydrateRoot=lT.hydrateRoot;var hz});var pT=dt(dT=>{"use strict";var Pa=z();function XA(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ZA=typeof Object.is=="function"?Object.is:XA,JA=Pa.useState,eN=Pa.useEffect,tN=Pa.useLayoutEffect,nN=Pa.useDebugValue;function iN(t,e){var n=e(),i=JA({inst:{value:n,getSnapshot:e}}),r=i[0].inst,s=i[1];return tN(function(){r.value=n,r.getSnapshot=e,Sy(r)&&s({inst:r})},[t,n,e]),eN(function(){return Sy(r)&&s({inst:r}),t(function(){Sy(r)&&s({inst:r})})},[t]),nN(n),n}function Sy(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ZA(t,n)}catch{return!0}}function rN(t,e){return e()}var sN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rN:iN;dT.useSyncExternalStore=Pa.useSyncExternalStore!==void 0?Pa.useSyncExternalStore:sN});var fT=dt((vz,hT)=>{"use strict";hT.exports=pT()});var gT=dt(mT=>{"use strict";var wp=z(),aN=fT();function oN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var lN=typeof Object.is=="function"?Object.is:oN,cN=aN.useSyncExternalStore,uN=wp.useRef,dN=wp.useEffect,pN=wp.useMemo,hN=wp.useDebugValue;mT.useSyncExternalStoreWithSelector=function(t,e,n,i,r){var s=uN(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=pN(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,lN(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=cN(t,s[0],s[1]);return dN(function(){a.hasValue=!0,a.value=o},[o]),hN(o),o}});var yT=dt((_z,vT)=>{"use strict";vT.exports=gT()});function xN(){Cp=!0,queueMicrotask(DT)}function DT(){if(!Ca.length){Cp=!1;return}Ly=!0;for(let t=0;t<Ca.length;t++)Ca[t].$st!==Ra&&kN(Ca[t]);Ca=[],Cp=!1,Ly=!1}function kN(t){let e=[t];for(;t=t[on];)t.$e&&t.$st!==Ra&&e.push(t);for(let n=e.length-1;n>=0;n--)By(e[n])}function OT(t){let e=$t();return Hl(e,t.length?t.bind(null,ql.bind(e)):t,null)}function C(t){return Hl(Ct,t,null)}function La(t){return Hl(null,t,null)}function Zn(){Ly||DT()}function jl(){return Ct}function et(t,e){try{return Hl(e,t,null)}catch(n){zy(e,n);return}}function Fy(t,e=Ct){return e?.$cx[t]}function EN(t,e,n=Ct){n&&(n.$cx={...n.$cx,[t]:e})}function TN(t){Ct&&(Ct.$eh=Ct.$eh?[t,...Ct.$eh]:[t])}function G(t){if(!t||!Ct)return t||bN;let e=Ct;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==Rp&&(t.call(null),Lp(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function ql(t=!0){if(this.$st===Rp)return;let e=t?this.$ps||this[on]:this,n=this.$ns,i=null;for(;n&&n[on]===this;)ql.call(n,!0),$T(n),i=n.$ns,n.$ns=null,n=i;t&&$T(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function $T(t){t.$st=Rp,t.$d&&VT(t),t.$s&&Sp(t,0),t.$ps&&(t.$ps.$ns=null),t[on]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=Vy,t.$eh=null}function VT(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 Hl(t,e,n){let i=Ct,r=$a;Ct=t,$a=n;try{return e.call(t)}finally{Ct=i,$a=r}}function zy(t,e){if(!t||!t.$eh)throw e;let n=0,i=t.$eh.length,r=MT(e);for(n=0;n<i;n++)try{t.$eh[n](r);break}catch(s){r=MT(s)}if(n===i)throw r}function MT(t){return t instanceof Error?t:Error(JSON.stringify(t))}function Uy(){return this.$st===Rp?this.$v:($a&&!this.$e&&(!En&&$a.$s&&$a.$s[an]==this?an++:En?En.push(this):En=[this]),this.$c&&By(this),this.$v)}function FT(t){let e=Lp(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++)jT(this.$o[n],Ul);return this.$v}function $t(){return new jy}function Hy(t,e,n){return new zT(t,e,n)}function SN(t,e){return t!==e}function Lp(t){return typeof t=="function"}function By(t){if(t.$st===NT)for(let e=0;e<t.$s.length&&(By(t.$s[e]),t.$st!==Ul);e++);t.$st===Ul?UT(t):t.$st=Ra}function RT(t){t.$ns&&t.$ns[on]===t&&ql.call(t,!1),t.$d&&VT(t),t.$eh=t[on]?t[on].$eh:null}function UT(t){let e=En,n=an;En=null,an=0;try{RT(t);let i=Hl(t,t.$c,t);if(En){if(t.$s&&Sp(t,an),t.$s&&an>0){t.$s.length=an+En.length;for(let s=0;s<En.length;s++)t.$s[an+s]=En[s]}else t.$s=En;let r;for(let s=an;s<t.$s.length;s++)r=t.$s[s],r.$o?r.$o.push(t):r.$o=[t]}else t.$s&&an<t.$s.length&&(Sp(t,an),t.$s.length=an);!t.$e&&t.$i?FT.call(t,i):(t.$v=i,t.$i=!0)}catch(i){zy(t,i),t.$st===Ul&&(RT(t),t.$s&&Sp(t,0));return}En=e,an=n,t.$st=Ra}function jT(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===Ra&&(Ca.push(t),Cp||xN()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)jT(t.$o[n],NT)}function Sp(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 D(t,e){let n=Hy(t,null,e),i=Uy.bind(n);return i[on]=!0,i.set=FT.bind(n),i}function qT(t){return Lp(t)&&on in t}function hi(t,e){let n=Hy(e?.initial,t,e),i=Uy.bind(n);return i[on]=!0,i}function HT(t,e){let n=Hy(null,function(){let r=t();return Lp(r)&&G(r),null},void 0);return n.$e=!0,UT(n),ql.bind(n,!0)}function PN(t){let e=()=>t();return e[on]=!0,e}function Wy(t){return qT(t)&&"set"in t}function Ht(...t){}function fi(t){return t===null}function Ie(t){return typeof t>"u"}function Ky(t){return fi(t)||Ie(t)}function Bl(t){return t?.constructor===Object}function Be(t){return typeof t=="number"&&!Number.isNaN(t)}function F(t){return typeof t=="string"}function Gy(t){return typeof t=="boolean"}function yt(t){return typeof t=="function"}function He(t){return Array.isArray(t)}function CN(t){return F(t)?new RegExp(t):t}function $N(t){return qt?!1:t===window}function MN(t,e){return typeof process<"u",Ht}function Ip(t){return!!t?.[WT]}function LN(t){return t.originEvent}function KT(t,e){if(Ip(t))return t.triggers.walk(e)}function Yy(t,e){return Ip(t)?t.triggers.findType(e):void 0}function GT(t,e){return!!Yy(t,e)}function YT(t,e){e&&t.triggers.add(e)}function S(t,e,n,i){return qt?Ht:(t.addEventListener(e,n,i),G(()=>t.removeEventListener(e,n,i)))}function Wl(t){return!!t?.type.startsWith("pointer")}function Ia(t){return!!t?.type.startsWith("touch")}function Qy(t){return/^(click|mouse)/.test(t?.type??"")}function ji(t){return!!t?.type.startsWith("key")}function IN(t){return ji(t)&&t.key==="Enter"}function AN(t){return ji(t)&&t.key==="Escape"}function Kl(t){return ji(t)&&(t.key==="Enter"||t.key===" ")}function Xy(t){return t instanceof Node}function NN(t){return Xy(t)&&t.nodeType===1}function DN(t){return Xy(t)&&t.nodeType===11}function ON(){return document.createDocumentFragment()}function VN(t){return qt?t:document.createComment(t)}function Z(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 lt(t,e,n){if(t)!n&&n!==0?t.style.removeProperty(e):t.style.setProperty(e,n+"");else return}function FN(t,e,n){t.classList[n?"add":"remove"](e)}function zN(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 UN(t){let e=t.firstChild,n=e.getAttribute("shadowroot");e.parentNode.attachShadow({mode:n}).appendChild(e.content),e.remove()}function jN(t){return yt(t)?t():t}function Iy(t){let e=t;for(;typeof e=="function";)e=e.call(this);return e}function mi(t){return{id:Symbol(),provide:t}}function Rt(t,e,n=jl()){let i=!Ie(e);EN(t.id,i?e:t.provide?.(),n)}function Ae(t){return Fy(t.id)}function Tn(t){return!Ie(Fy(t.id))}function qN(t){let e={};for(let n of Object.keys(t)){let i=t[n];e[n]=D(i,i)}return e}function Zy(t,e){return OT(()=>{zl.$$=new Mp(t,jl(),e);let n=new t;return zl.$$.e=n,zl.$$=null,n})}function ee(t,e,n){t[$y]||(t[$y]=new Set),t[$y].add(e)}function Ne(t,e,n){t[My]||(t[My]=new Set),t[My].add(e)}function gs(t){return Ae(t)}function Aa(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function HN(t){return Gl(t.replace(/([A-Z])/g," $1"))}function Np(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function XT(t){return ZT(t).replace(/\s/g,"")}function ZT(t){return Gl(t.replace(/-./g,e=>" "+e[1].toUpperCase()))}function Gl(t){return t.charAt(0).toUpperCase()+t.slice(1)}function BN(t){return t.charAt(0).toLowerCase()+t.slice(1)}function KN(t){return t.replace(WN,"")}function Dp(t,...e){return ce.createElement(vs.Provider,{value:t},...e)}function Op(){return ce.useContext(vs).current}function Vp(t){let e=Op();return ce.useMemo(()=>Fy(t.id,e),[e])}function GN(){return eS}function YN(t,e){var n;return n=class extends eS{},n.F=t,n.T=e,n}function Jy(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function re(...t){return e=>t.forEach(n=>Jy(n,e))}function QN(t,e){let n=ce.forwardRef((i,r)=>{let s=ce.useContext(vs),a=ce.useRef(null),o=ce.useRef();if(!o.current){let _=ZN(),m=AT(t,_,i,s.current);_.e=m,o.current=_,a.current=m.scope}function l(){let _=o.current,m=s.current;if(window.cancelAnimationFrame(_.ea),_.ea=-1,_.e.$$.o){let f=AT(t,_,i,m);_.e=f,_.Q=!1,_.da=!1,a.current=f.scope}return _.a&&IT(_,_.a),_.da||(Jy(r,_.e),_.da=!0),()=>Pp(_)}function c(_){let m=o.current;if(!m.da){m.a=_;return}window.cancelAnimationFrame(m.K),m.K=window.requestAnimationFrame(()=>{let f=o.current;f.K=-1,f.a!==_&&(Pp(f),_&&IT(f,_),f.a=_)})}ce.useEffect(()=>{let _=o.current;return window.cancelAnimationFrame(_.ea),_.ea=-1,function(){yt(i.children)&&(window.cancelAnimationFrame(_.K),_.K=-1,window.cancelAnimationFrame(_.E),_.E=-1,window.cancelAnimationFrame(_.ea),_.ea=window.requestAnimationFrame(()=>{_.ea=-1,Pp(_),_.e.$$.p(),_.e.$$[Ap]=null,_.J={},_._={},a.current=null}))}},[]),ce.useEffect(Zn);let u=o.current,{children:d,...p}=i,h={},y=u.aa,v=Object.keys(p);u.J={};for(let _ of[...y,...v])if(e.props.has(_))u.e.$props[_].set(v.includes(_)?p[_]:t.props?.[_]);else if(e.events?.has(_)||e.eventsRE?.test(_))u.J[_]=p[_];else if(e.domEvents?.has(_)||e.domEventsRE?.test(_)){let m=Aa(_.slice(2));u._[m]=p[_],v.includes(_)?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[_]=p[_];return u.aa=v,Dp(a,ce.createElement(XN,{effect:l}),yt(d)?d?.({...h,suppressHydrationWarning:!0,ref:c},u.e):d)});return n.displayName=t.name+"Bridge",n}function XN({effect:t}){return ce.useEffect(t,[]),null}function ZN(){let t={a:null,aa:[],J:{},_:{},K:-1,E:-1,ea:-1,Q:!1,da:!1,ca:null,ba(e){let n=Ie(e.detail)?[e]:[e.detail,e];t._[e.type]?.(...n)}};return t}function IT(t,e){if(!(t.a===e&&t.Q)){if(t.Q&&Pp(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 Pp(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 JN(t){let e=LT.get(t.type),n=Ie(t.detail)?[t]:[t.detail,t];e||LT.set(t.type,e=`on${XT(t.type)}`),this.J[e]?.(...n)}function AT(t,e,n,i){let r=Zy(t,{props:n,scope:i});return r.$$[Ap]=JN.bind(e),r.$$.w(),r}function tS(t,e=!1){let n=typeof t;if(n!=="string")return!e&&n==="function"?tS(t()):e&&n==="boolean"?t+"":t;let i=e?'"':"<",r=e?""":"<",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+="&",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+="&",o=a+1,a=t.indexOf("&",o);return o<t.length?l+t.substring(o):l}function n2(t,e){let n=e.trim().split(t2);for(let i of n)t.add(i)}function s2(t,e){let n=e.trim().split(r2);for(let i=0;i<n.length;i++){if(n[i]==="")continue;let[r,s]=n[i].split(i2);t.set(r,s)}}function o2(t,e){function n(i){let r=ce.useContext(vs),s=Zy(t,{props:i,scope:r.current}),a=new Ay(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:Np(p)]=h;a.removeAttribute("style")}for(let[p,h]of a.attributes.tokens){let y=a2[p];y&&(y in o||(o[y]=h),a.removeAttribute(p))}return Dp({current:s.$$.d},yt(c)?c?.({...Object.fromEntries(a.attributes.tokens),...o,style:l},s):c,ce.createElement(()=>(a.destroy(),null)))}return n.displayName=t.name+"Bridge",n}function $r(t){return Vp(t)}function pe(t,e){let[,n]=ce.useState();return ce.useEffect(()=>HT(()=>{t(),n({})}),[e??t]),t()}function Na(t){return t?"true":"false"}function nS(t){let e=[];for(let n=0;n<t.length;n++)He(t[n])?e.push(...nS(t[n])):(t[n]||t[n]===0)&&e.push(t[n]);return e}function Yl(){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 e_(){let t=Yl();return G(t.empty),t}function l2(t){return t()}function c2(t,e){for(let n of t)n(e)}function Ql(t){return Object.keys(t)}function u2(...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 iS(t,e){let n={};for(let i of e)Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i));return n}function d2(t,e){return iS(t,Ql(t).filter(n=>!e.includes(n)))}function qi(){let t,e;return{promise:new Promise((i,r)=>{t=i,e=r}),resolve:t,reject:e}}function p2(t,e,n){let i=new Promise((r,s)=>{let a=setTimeout(()=>{clearTimeout(a),s(n)},e)});return Promise.race([t,i])}function t_(t){return new Promise(e=>setTimeout(e,t))}function h2(t){return qt?Promise.resolve():new Promise(e=>{window.requestAnimationFrame(n=>{t?.(n),e()})})}function Mr(t){if(qt)return Ht;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 n_(t,e){return qt?Promise.resolve():new Promise(n=>{f2(i=>{t?.(i),n()},e)})}function i_(t){let[,e]=ce.useState(),n=ce.useRef(null);return n.current==null&&(n.current={state:{},$update:D({}),props:new Set}),ce.useEffect(()=>{let{state:i,$update:r,props:s}=n.current;return b(()=>{for(let a of s){let o=t[a]();i[a]=He(o)?[...o]:o}r(),e({})})},[t]),ce.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]=He(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 qt?o2(t,{props:new Set(Object.keys(t.props||{}))}):QN(t,{props:new Set(Object.keys(t.props||{})),events:new Set(e?.events),eventsRE:e?.eventsRegex,domEvents:e?.domEvents,domEventsRE:e?.domEventsRegex})}var ce,qt,on,Cp,Ly,Ct,$a,En,an,Ca,Vy,bN,Ra,NT,Ul,Rp,jy,ms,zT,qy,b,BT,RN,WT,j,$p,Ma,$y,My,Ap,QT,Ry,Mp,zl,Mt,H,Xn,WN,vs,JT,eS,LT,e2,t2,i2,r2,Ay,Ny,Dy,Oy,a2,f2,ys,Lt=Ue(()=>{"use strict";"use client";ce=$(z(),1),qt=typeof document>"u",on=Symbol(0),Cp=!1,Ly=!1,Ct=null,$a=null,En=null,an=0,Ca=[],Vy={},bN=()=>{},Ra=0,NT=1,Ul=2,Rp=3;jy=function(){this[on]=null,this.$ns=null,this.$ps=null,Ct&&Ct.append(this)},ms=jy.prototype;ms.$cx=Vy;ms.$eh=null;ms.$c=null;ms.$d=null;ms.append=function(t){if(t[on]=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===Vy?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};ms.dispose=function(){ql.call(this)};zT=function(e,n,i){jy.call(this),this.$st=n?Ul:Ra,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)},qy=zT.prototype;Object.setPrototypeOf(qy,ms);qy.$ch=SN;qy.call=Uy;b=qt?MN:HT;RN=qt?class{}:Event,WT=Symbol("DOM_EVENT"),j=class extends RN{constructor(e,...n){super(e,n[0]),this[BT]=!0,this.triggers=new $p,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}};BT=WT;$p=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),Ip(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()}};Ma=class extends EventTarget{addEventListener(e,n,i){return super.addEventListener(e,n,i)}removeEventListener(e,n,i){return super.removeEventListener(e,n,i)}};$y=Symbol(0),My=Symbol(0),Ap=Symbol(0),Ry={},Mp=class{constructor(e,n,i){this[QT]=null,this.$el=D(null),this.a=null,this.d=null,this.f=null,this.g=null,this.e=null,this.o=!1,this.i=Ry,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]()}),Rt(r,this.h)),s&&(this.i=qN(s),i?.props))for(let a of Object.keys(i.props))this.i[a]?.set(i.props[a]);G(this.p.bind(this))}w(){et(()=>{for(let e of this.l)e()},this.d)}x(e){this.a||(this.a=e,this.$el.set(e),et(()=>{this.f=$t(),et(()=>{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||et(()=>{this.g=$t(),et(()=>{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,et(()=>{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=Ry,this.d=null,this.k=Ry,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))qt?Z(this.a,e,Iy.call(this.e,this.b[e])):yt(this.b[e])?b(this.u.bind(this,e)):Z(this.a,e,this.b[e])}r(){if(this.c)for(let e of Object.keys(this.c))qt?lt(this.a,e,Iy.call(this.e,this.c[e])):yt(this.c[e])?b(this.v.bind(this,e)):lt(this.a,e,this.c[e])}u(e){Z(this.a,e,this.b[e].call(this.e))}v(e){lt(this.a,e,this.c[e].call(this.e))}};QT=Ap;zl={$$:null};Mt=class extends EventTarget{constructor(){super(),zl.$$&&this.attach(zl)}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 j(e,n[0])}dispatch(e,...n){if(qt||!this.el)return!1;let i=e instanceof Event?e:new j(e,n[0]);return Object.defineProperty(i,"target",{get:()=>this.$$.e}),La(()=>(this.$$[Ap]?.(i),this.el.dispatchEvent(i)))}dispatchEvent(e){return this.dispatch(e)}listen(e,n,i){return qt||!this.el?Ht:S(this.el,e,n,i)}},H=class extends Mt{subscribe(e){return et(()=>b(()=>e(this.state)),this.$$.d)}destroy(){this.$$.p()}};Xn=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?hi(r.bind(n)):D(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])}};WN=/;\s*$/;vs=ce.createContext({current:null});vs.displayName="Scope";JT=class extends ce.Component{constructor(e,n){super(e),this.d={current:$t()},n&&n.append(this.d.current);let i=this.constructor;i.F&&Rt(i.F,i.T?.(),this.d.current)}render(){return Dp(this.d,this.props?.children)}};JT.contextType=vs;eS=JT;LT=new Map;e2=Symbol(0),t2=/\s+/;i2=/\s*:\s*/,r2=/\s*;\s*/;Ay=class{constructor(e){this.keepAlive=!1,this.forwardKeepAlive=!0,this.attributes=new Ny,this.style=new Dy,this.classList=new Oy,this.$=e}get $props(){return this.$.$$.i}get $state(){return this.$.$$.h}get state(){return this.$.state}setup(){let e=this.$.$$;et(()=>{this.hasAttribute("class")&&n2(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)}[e2](){}addEventListener(){}removeEventListener(){}dispatchEvent(){return!1}subscribe(){return Ht}destroy(){this.$.destroy()}},Ny=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}="${tS(i,!0)}"`;return e}},Dy=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}},Oy=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(" ")}},a2={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"};f2=qt?Ht:typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):Ht;ys=Object.freeze({__proto__:null,Component:H,DOMEvent:j,EventTriggers:$p,EventsTarget:Ma,Instance:Mp,ReactScopeContext:vs,State:Xn,ViewController:Mt,WithScope:Dp,animationFrameThrottle:Mr,appendTriggerEvent:YT,ariaBool:Na,attachDeclarativeShadowDOM:UN,camelToKebabCase:Aa,camelToTitleCase:HN,composeRefs:re,computed:hi,createComment:VN,createComponent:Zy,createContext:mi,createDisposalBin:Yl,createFragment:ON,createReactComponent:X,createReactContextProvider:YN,createReactScopeProvider:GN,createRegex:CN,createScope:$t,deferredPromise:qi,effect:b,findTriggerEvent:Yy,flattenArray:nS,getOriginEvent:LN,getScope:jl,getSlottedChildren:zN,hasProvidedContext:Tn,hasTriggerEvent:GT,isArray:He,isBoolean:Gy,isDOMElement:NN,isDOMEvent:Ip,isDOMFragment:DN,isDOMNode:Xy,isFunction:yt,isKeyboardClick:Kl,isKeyboardEvent:ji,isMouseEvent:Qy,isNil:Ky,isNull:fi,isNumber:Be,isObject:Bl,isPointerEvent:Wl,isReadSignal:qT,isString:F,isTouchEvent:Ia,isUndefined:Ie,isWindow:$N,isWriteSignal:Wy,kebabToCamelCase:Np,kebabToPascalCase:XT,kebabToTitleCase:ZT,keysOf:Ql,listenEvent:S,lowercaseFirstLetter:BN,mergeProperties:u2,method:Ne,noop:Ht,omit:d2,onDispose:G,onError:TN,peek:C,pick:iS,prop:ee,provideContext:Rt,readonly:PN,root:OT,run:l2,runAll:c2,scoped:et,setAttribute:Z,setRef:Jy,setStyle:lt,signal:D,tick:Zn,timedPromise:p2,toggleClass:FN,trimTrailingSemicolon:KN,untrack:La,unwrap:jN,unwrapDeep:Iy,uppercaseFirstChar:Gl,useContext:Ae,useDisposalBin:e_,useReactContext:Vp,useReactScope:Op,useSignal:pe,useSignalRecord:i_,useState:gs,useStateContext:$r,waitAnimationFrame:h2,waitIdlePeriod:n_,waitTimeout:t_,walkTriggerEventChain:KT,wasEnterKeyPressed:IN,wasEscapeKeyPressed:AN})});var rS={};xt(rS,{SRTParser:()=>Fp,default:()=>v2});function v2(){return new Fp}var m2,g2,Fp,sS=Ue(()=>{"use strict";Xl();m2=/,/g,g2="-->",Fp=class extends Oa{parse(e,n){if(e==="")this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null),this.c=Da.None;else if(this.c===Da.Cue)this.a.text+=(this.a.text?`
|
|
`:"")+e;else if(e.includes(g2)){let i=this.o(e,n);i&&(this.a=new Hi(i[0],i[1],i[2].join(" ")),this.a.id=this.l,this.c=Da.Cue)}this.l=e}o(e,n){return super.o(e.replace(m2,"."),n)}}});var r_={};xt(r_,{ParseErrorBuilder:()=>y2});var y2,s_=Ue(()=>{"use strict";Xl();y2={p(){return new Bt({code:Sn.BadSignature,reason:"missing WEBVTT file header",line:1})},q(t,e){return new Bt({code:Sn.BadTimestamp,reason:`cue start timestamp \`${t}\` is invalid on line ${e}`,line:e})},r(t,e){return new Bt({code:Sn.BadTimestamp,reason:`cue end timestamp \`${t}\` is invalid on line ${e}`,line:e})},s(t,e,n){return new Bt({code:Sn.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${t}\` on line ${n}`,line:n})},w(t,e,n){return new Bt({code:Sn.BadSettingValue,reason:`invalid value for cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},v(t,e,n){return new Bt({code:Sn.UnknownSetting,reason:`unknown cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},u(t,e,n){return new Bt({code:Sn.BadSettingValue,reason:`invalid value for region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},t(t,e,n){return new Bt({code:Sn.UnknownSetting,reason:`unknown region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},T(t,e){return new Bt({code:Sn.BadFormat,reason:`format missing for \`${t}\` block on line ${e}`,line:e})}}});var dS={};xt(dS,{SSAParser:()=>jp,default:()=>_2});function o_(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 l_(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 _2(){return new jp}var zp,aS,oS,Up,lS,cS,uS,a_,jp,pS=Ue(()=>{"use strict";Xl();zp=/^Format:[\s\t]*/,aS=/^Style:[\s\t]*/,oS=/^Dialogue:[\s\t]*/,Up=/[\s\t]*,[\s\t]*/,lS=/\{[^}]+\}/g,cS=/\\N/g,uS=/^\[(.*)[\s\t]?Styles\]$/,a_=/^\[(.*)[\s\t]?Events\]$/,jp=class{constructor(){w(this,"f");w(this,"O",0);w(this,"a",null);w(this,"j",[]);w(this,"k",[]);w(this,"N",null);w(this,"d");w(this,"P",{})}async init(e){this.f=e,e.errors&&(this.d=(await Promise.resolve().then(()=>(s_(),r_))).ParseErrorBuilder)}parse(e,n){if(this.O)switch(this.O){case 1:if(e==="")this.O=0;else if(aS.test(e))if(this.N){let i=e.replace(aS,"").split(Up);this.S(i)}else this.e(this.d?.T("Style",n));else zp.test(e)?this.N=e.replace(zp,"").split(Up):a_.test(e)&&(this.N=null,this.O=2);break;case 2:if(e==="")this.Q();else if(oS.test(e))if(this.Q(),this.N){let i=e.replace(oS,"").split(Up),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(lS,"").replace(cS,`
|
|
`):zp.test(e)?this.N=e.replace(zp,"").split(Up):uS.test(e)?(this.N=null,this.O=1):a_.test(e)&&(this.N=null)}else e===""||(uS.test(e)?(this.N=null,this.O=1):a_.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 _=o_(v);_&&(i["--cue-color"]=_);break;case"BorderStyle":d=parseInt(v,10);break;case"BackColour":u=o_(v);break;case"OutlineColour":let m=o_(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&&l_(r*1.2,l*1.2,c),c?l_(r*(r/2),l*(r/2),h):l_(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 Hi(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(lS,"").replace(cS,`
|
|
`),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=Bi(e),s=Bi(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 yS(t,e){let n=new ReadableStream({start(i){let r=t.split(vS);for(let s of r)i.enqueue(s);i.close()}});return Wp(n,e)}async function Wp(t,e){let n=e?.type??"vtt",i;if(typeof n=="string")switch(n){case"srt":i=(await Promise.resolve().then(()=>(sS(),rS))).default;break;case"ssa":case"ass":i=(await Promise.resolve().then(()=>(pS(),dS))).default;break;default:i=(await Promise.resolve().then(function(){return O2})).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 _S(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 p_(n.body,{type:r,encoding:s,...e})}async function p_(t,{encoding:e="utf-8",...n}={}){let i=t.pipeThrough(new u_(e));return Wp(i,n)}function x2(t){let e=parseInt(t,10);return Number.isNaN(e)?null:e}function Jl(t){let e=parseInt(t.replace(b2,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function fS(t){if(!t.includes(hS))return null;let[e,n]=t.split(hS).map(Jl);return e!==null&&n!==null?[e,n]:null}function k2(t){let e=parseFloat(t);return Number.isNaN(e)?null:e}function Bi(t){let e=t.match(N2);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 D2(){return new Oa}function f_(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&&V2.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(F2," "),s?.type==="v"?s.voice=c_(e):s?.type==="lang"&&(s.lang=c_(e)),e="",n=1):e+=u;break;case 5:u===">"&&(e="",s=r.pop(),n=1);break;case 6:if(u===">"){let d=Bi(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(q2.has(e)){let c=s;s=H2(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_","");j2.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:c_(e)};s?s.children.push(c):i.push(c),e=""}return n===1&&l(),i}function H2(t){return{tagName:wS[t],type:t,children:[]}}function c_(t){return t.replace(U2,e=>z2[e]||"'")}function It(t,e,n){t.style.setProperty(`--${e}`,n+"")}function Rr(t,e,n=!0){t.setAttribute(`data-${e}`,n===!0?"":n+"")}function qp(t,e){t.setAttribute("data-part",e)}function B2(t){return parseFloat(getComputedStyle(t).lineHeight)||0}function bS(t){if(h_)throw Error("[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`");let e=document.createElement("template");return e.innerHTML=Kp(t),{cue:t,content:e.content}}function Kp(t,e=0){return Gp(f_(t),e)}function Gp(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:""}>${Gp(r.children)}</${r.tagName}>`}return i}function m_(t,e){if(!h_)for(let n of t.querySelectorAll('[data-part="timed"]')){let i=Number(n.getAttribute("data-time"));Number.isNaN(i)||(i>e?Rr(n,"future"):n.removeAttribute("data-future"),i<e?Rr(n,"past"):n.removeAttribute("data-past"))}}function W2(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 g_(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 Hp(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 K2(t,e){return t.left<=e.right&&t.right>=e.left&&t.top<=e.bottom&&t.bottom>=e.top}function G2(t,e){for(let n=0;n<e.length;n++)if(K2(t,e[n]))return e[n];return null}function gS(t,e){return e.top>=0&&e.bottom<=t.height&&e.left>=0&&e.right<=t.width}function Y2(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 Q2(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 v_(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 xS(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 ES(t,e,n,i){let r=v_(e,n);for(let s of kS)It(t,`${i}-${s}`,r[s]*100+"%")}function TS(t,e,n,i){let r=1,s,a={...e};for(let o=0;o<i.length;o++){for(;Y2(t,e,i[o])||gS(t,e)&&G2(e,n);)Hp(e,i[o],1);if(gS(t,e))return e;let l=Q2(t,e);r>l&&(s={...e},r=l),e={...a}}return s||a}function X2(t,e,n,i){let r=n.firstElementChild,s=eD(e),a,o=[];if(n[Lr]||(n[Lr]=Z2(t,n)),a=xS(t,{...n[Lr]}),n[ec])o=[n[ec]==="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=B2(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()),Hp(a,p,u)}else{let l=e.vertical==="",c=l?"+y":"+x",u=l?a.height:a.width;Hp(a,c,(l?t.height:t.width)*s/100),Hp(a,c,e.lineAlign==="center"?u/2:e.lineAlign==="end"?u:0),o=l?["-y","+y","-x","+x"]:["-x","+x","-y","+y"]}return a=TS(t,a,i,o),ES(n,t,a,"cue"),a}function Z2(t,e){let n=g_(e),i=J2(e);if(e[ec]=!1,i.top&&(n.top=i.top,n.bottom=i.top+n.height,e[ec]="top"),i.bottom){let r=t.height-i.bottom;n.top=r-n.height,n.bottom=r,e[ec]="bottom"}return i.left&&(n.left=i.left),i.right&&(n.right=t.width-i.right),v_(t,n)}function J2(t){let e={};for(let n of kS)e[n]=parseFloat(t.style.getPropertyValue(`--cue-${n}`));return e}function eD(t){return t.line==="auto"?t.snapToLines?-1:100:t.line}function tD(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 nD(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 rD(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;It(n,"region-height",s+"px"),n[Lr]||(n[Lr]=v_(t,g_(n)));let o={...n[Lr]};return o=xS(t,o),o.width=n.clientWidth,o.height=s,o.right=o.left+o.width,o.bottom=o.top+s,o=TS(t,o,i,iD),ES(n,t,o,"region"),o}var Sn,Bt,vS,u_,d_,tc,h_,w2,Hi,nc,hS,b2,E2,mS,T2,Va,S2,P2,C2,$2,Zl,M2,R2,L2,I2,A2,N2,Da,Oa,O2,V2,F2,wS,z2,U2,j2,q2,Lr,kS,ec,iD,Bp,Xl=Ue(()=>{"use strict";Sn={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5},Bt=class extends Error{constructor(n){super(n.reason);w(this,"code");w(this,"line");this.code=n.code,this.line=n.line}},vS=/\r?\n|\r/gm,u_=class{constructor(e){w(this,"writable");w(this,"readable");let n=new d_(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()}})}},d_=class{constructor(e){w(this,"x","");w(this,"y");w(this,"onLine");w(this,"onClose");this.y=new TextDecoder(e)}transform(e){this.x+=this.y.decode(e,{stream:!0});let n=this.x.split(vS);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()}};tc=class extends EventTarget{constructor(n,i,r){super();w(this,"id","");w(this,"startTime");w(this,"endTime");w(this,"text");w(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)}},h_=typeof document>"u",w2=h_?tc:window.VTTCue,Hi=class extends w2{constructor(){super(...arguments);w(this,"region",null);w(this,"vertical","");w(this,"snapToLines",!0);w(this,"line","auto");w(this,"lineAlign","start");w(this,"position","auto");w(this,"positionAlign","auto");w(this,"size",100);w(this,"align","center");w(this,"style")}},nc=class{constructor(){w(this,"id","");w(this,"width",100);w(this,"lines",3);w(this,"regionAnchorX",0);w(this,"regionAnchorY",100);w(this,"viewportAnchorX",0);w(this,"viewportAnchorY",100);w(this,"scroll","")}},hS=",",b2="%";E2="WEBVTT",mS=",",T2="%",Va=/[:=]/,S2=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,P2="NOTE",C2="REGION",$2=/^REGION:?[\s\t]+/,Zl=/[\s\t]+/,M2="-->",R2=/[\s\t]*-->[\s\t]+/,L2=/start|center|end|left|right/,I2=/start|center|end/,A2=/line-(?:left|right)|center|auto/,N2=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/,Da=(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))(Da||{}),Oa=class{constructor(){w(this,"f");w(this,"c",0);w(this,"g",{});w(this,"h",{});w(this,"j",[]);w(this,"a",null);w(this,"b",null);w(this,"k",[]);w(this,"d");w(this,"l","")}async init(e){this.f=e,e.strict&&(this.c=1),e.errors&&(this.d=(await Promise.resolve().then(()=>(s_(),r_))).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&&S2.test(e)?this.m(e.split(Zl),n):this.a.text+=(i?`
|
|
`:"")+e}break;case 3:this.n(e.split(Zl),n);break}else if(e.startsWith(P2))this.c=4;else if(e.startsWith(C2))this.c=3,this.b=new nc,this.n(e.replace($2,"").split(Zl),n);else if(e.includes(M2)){let i=this.o(e,n);i&&(this.a=new Hi(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(Va.test(e)){let[i,r]=e.split(Va);i&&(this.g[i]=(r||"").replace(Zl,""))}}else e.startsWith(E2)?this.c=1:this.e(this.d?.p())}o(e,n){let[i,r=""]=e.split(R2),[s,...a]=r.split(Zl),o=Bi(i),l=Bi(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(Va.test(e[r])){i=!1;let[s,a]=e[r].split(Va);switch(s){case"id":this.b.id=a;break;case"width":let o=Jl(a);o!==null?this.b.width=o:i=!0;break;case"lines":let l=x2(a);l!==null?this.b.lines=l:i=!0;break;case"regionanchor":let c=fS(a);c!==null?(this.b.regionAnchorX=c[0],this.b.regionAnchorY=c[1]):i=!0;break;case"viewportanchor":let u=fS(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,Va.test(e[r])){let[s,a]=e[r].split(Va);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(mS);if(l.includes(T2)){let y=Jl(l);y!==null?(this.a.line=y,this.a.snapToLines=!1):i=!0}else{let y=k2(l);y!==null?this.a.line=y:i=!0}I2.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(mS),p=Jl(u);p!==null?this.a.position=p:i=!0,d&&A2.test(d)?this.a.positionAlign=d:d&&(i=!0);break;case"size":let h=Jl(a);h!==null?(this.a.size=h,h<100&&(this.a.region=null)):i=!0;break;case"align":L2.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)}}};O2=Object.freeze({__proto__:null,VTTBlock:Da,VTTParser:Oa,default:D2,parseVTTTimestamp:Bi}),V2=/[0-9]/,F2=/[\s\t]+/,wS={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},z2={"&":"&","<":"<",">":">",""":'"',"'":"'"," ":"\xA0","‎":"\u200E","‏":"\u200F"},U2=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,j2=new Set(["white","lime","cyan","red","yellow","magenta","blue","black"]),q2=new Set(Object.keys(wS));Lr=Symbol(0);kS=["top","left","right","bottom"];ec=Symbol(0);iD=["-y","+y","-x","+x"];Bp=class{constructor(e,n){w(this,"overlay");w(this,"z");w(this,"A",0);w(this,"C","ltr");w(this,"B",[]);w(this,"D",!1);w(this,"E");w(this,"h",new Map);w(this,"j",new Map);w(this,"K",W2(()=>{this.D=!1,this.G();for(let e of this.h.values())e[Lr]=null;for(let e of this.j.values())e&&(e[Lr]=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"),qp(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,Rr(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=g_(this.overlay),It(this.overlay,"overlay-width",this.z.width+"px"),It(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(()=>Rr(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(rD(this.z,n.region,c,s)):s.push(X2(this.z,n,c,s)),a.add(l?n.region:n)}}m_(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 qp(n,"region"),Rr(n,"id",e.id),Rr(n,"scroll",e.scroll),It(n,"region-width",e.width+"%"),It(n,"region-anchor-x",e.regionAnchorX),It(n,"region-anchor-y",e.regionAnchorY),It(n,"region-viewport-anchor-x",e.viewportAnchorX),It(n,"region-viewport-anchor-y",e.viewportAnchorY),It(n,"region-lines",e.lines),n}L(e){let n=document.createElement("div"),i=tD(e),r=nD(e,this.C);if(qp(n,"cue-display"),e.vertical!==""&&Rr(n,"vertical"),It(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))It(n,"cue-offset",`${i-(r==="line-right"?100:r==="center"?50:0)}%`);else if(It(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===""?It(n,"cue-width",o+"%"):It(n,"cue-height",o+"%")}let s=document.createElement("div");return qp(s,"cue"),e.id&&Rr(s,"id",e.id),s.innerHTML=Kp(e),n.append(s),n}F(e){return e.region&&e.size===100&&e.vertical===""&&e.line==="auto"}}});var ic={};xt(ic,{CaptionsRenderer:()=>Bp,ParseError:()=>Bt,ParseErrorCode:()=>Sn,TextCue:()=>tc,VTTCue:()=>Hi,VTTRegion:()=>nc,createVTTCueTemplate:()=>bS,parseByteStream:()=>p_,parseResponse:()=>_S,parseText:()=>yS,parseTextStream:()=>Wp,parseVTTTimestamp:()=>Bi,renderVTTCueString:()=>Kp,renderVTTTokensString:()=>Gp,tokenizeVTTCue:()=>f_,updateTimedVTTCueNodes:()=>m_});var rc=Ue(()=>{"use strict";Xl()});var gi,sc=Ue(()=>{"use strict";"use client";Lt();gi=class{constructor(e){this._callback=e}_start(){Ie(this._id)&&this._loop()}_stop(){Be(this._id)&&window.cancelAnimationFrame(this._id),this._id=void 0}_loop(){this._id=window.requestAnimationFrame(()=>{Ie(this._id)||(this._callback(),this._loop())})}}});var y_,__,Fa,w_=Ue(()=>{"use strict";"use client";Lt();Wt();sc();y_=class{constructor(e,n){this._provider=e,this._ctx=n,this._disposal=e_(),this._waiting=!1,this._attachedLoadStart=!1,this._attachedCanPlay=!1,this._timeRAF=new gi(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),b_&&_s(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()&&Ky(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)&&Yp(this._media.duration)>Yp(this._media.currentTime)&&(this._updateCurrentTime(this._media.duration,e),this._media.ended||this._ctx.player.dispatch(new j("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)}},__=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}}},Fa=class{constructor(e,n){this._media=e,this._ctx=n,this.scope=$t(),this._currentSrc=null}setup(){new y_(this,this._ctx),"audioTracks"in this.media&&new __(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){Z(this._media,"playsinline",e)}async loadSource({src:e,type:n},i){this._media.preload=i||"",x_(e)?this._media.srcObject=e:(this._media.srcObject=null,this._media.src=F(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 SS={};xt(SS,{AudioProvider:()=>k_});var Zz,k_,PS=Ue(()=>{"use strict";"use client";w_();Zz=$(z(),1),k_=class extends Fa{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 CS={};xt(CS,{VideoProvider:()=>ac});function sD(t,e){return Array.from(t.children).find(n=>n.track===e)}var nU,E_,T_,S_,P_,C_,$_,M_,ac,R_=Ue(()=>{"use strict";"use client";Lt();Wt();w_();nU=$(z(),1),E_=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 ln({id:n.id,kind:n.kind,label:n.label,language:n.language,type:"vtt"});i[W._native]={track:n},i[W._readyState]=2,i[W._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[W._native]?.track;n?.oncuechange&&(n.oncuechange=null)}}};T_=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 Xp(this._video)}async enter(){return this._video.requestPictureInPicture()}exit(){return document.exitPictureInPicture()}_onEnter(e){this._onChange(!0,e)}_onExit(e){this._onChange(!1,e)}},S_=class{constructor(e,n){this._video=e,this._media=n,this._mode="inline",S(this._video,"webkitpresentationmodechanged",this._onModeChange.bind(this))}get _supported(){return Zp(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 j("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)})}},P_=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")}},C_=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")}},$_=class{constructor(e,n){this._video=e,this._ctx=n,this._supported=D(!1),this._setup()}get supported(){return this._supported()}_setup(){N||!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}},M_=class extends $_{constructor(){super(...arguments),this._type="airplay"}get _canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}},ac=class extends Fa{constructor(e,n){super(e,n),this.$$PROVIDER_TYPE="VIDEO",et(()=>{if(this.airPlay=new M_(e,n),Zp(e)){let i=new S_(e,n);this.fullscreen=new P_(i),this.pictureInPicture=new C_(i)}else Xp(e)&&(this.pictureInPicture=new T_(e,n))},this.scope)}get type(){return"video"}setup(){super.setup(),Qp(this.video)&&new E_(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 $S={};xt($S,{HLSProvider:()=>Jp});async function oD(t,e={}){if(!Ie(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 lD(t,e={}){if(F(t)){e.onLoadStart?.();try{if(await th(t),!yt(window.Hls))throw Error("");let n=window.Hls;return e.onLoaded?.(n),n}catch(n){e.onLoadError?.(n)}}}var oU,aD,L_,I_,cD,Jp,MS=Ue(()=>{"use strict";"use client";Lt();Wt();R_();sc();oU=$(z(),1),aD=t=>Aa(t),L_=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[cn._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 gi(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 j(aD(e),{detail:n}))}_onTracksFound(e,n){let i=new j(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 ln({id:`hls-${a.kind}${s}`,src:o?.url,label:a.label,language:o?.lang,kind:a.kind,default:a.default});l[W._readyState]=2,l[W._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 j(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 j(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 j(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 j(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[cn._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 j("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,oc&&(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){F(e.src)&&(this._clearRetryTimer(),this._instance?.loadSource(e.src))}_destroy(){this._clearRetryTimer(),this._ctx&&(this._ctx.qualities[cn._enableAuto]=void 0),this._instance?.destroy(),this._instance=null,this._stopLiveSync?.(),this._stopLiveSync=null}},I_=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 lD(this._lib,e);if(Ie(n)&&!F(this._lib)&&(n=await oD(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 j("hls-unsupported")),this._ctx.delegate._notify("error",{message:i,code:4}),null}return n}_onLoadStart(){this._ctx.player.dispatch(new j("hls-lib-load-start"))}_onLoaded(e){this._ctx.player.dispatch(new j("hls-lib-loaded",{detail:e})),this._callback(e)}_onLoadError(e){let n=vi(e);this._ctx.player.dispatch(new j("hls-lib-load-error",{detail:n})),this._ctx.delegate._notify("error",{message:n.message,code:4,error:n})}};cD="https://cdn.jsdelivr.net",Jp=class extends ac{constructor(){super(...arguments),this.$$PROVIDER_TYPE="HLS",this._ctor=null,this._controller=new L_(this.video,this._ctx),this._library=`${cD}/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(){F(this._library)&&Jn(this._library)}setup(){super.setup(),new I_(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){F(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()}};Jp.supported=eh()});function Ua(t,e=3e3){let n=qi();return setTimeout(()=>{let i=t();i&&n.reject(i)},e),n}var za,A_=Ue(()=>{"use strict";"use client";Lt();Wt();za=class{constructor(e){this._iframe=e,this._src=D(""),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",RS(e,n))}_postMessage(e,n){N||this._iframe.contentWindow?.postMessage(JSON.stringify(e),n??"*")}_onWindowMessage(e){let n=this._getOrigin();if((e.source===null||e.source===this._iframe?.contentWindow)&&(!F(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 LS={};xt(LS,{getVimeoVideoInfo:()=>O_,resolveVimeoVideoId:()=>D_});function D_(t){let e=t.match(uD);return{videoId:e?.[1],hash:e?.[2]}}async function O_(t,e){if(N_.has(t))return N_.get(t);if(nh.has(t))return nh.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 N_.set(t,l),l}).finally(()=>nh.delete(t));return nh.set(t,i),i}var uD,N_,nh,V_=Ue(()=>{"use strict";"use client";uD=/(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:\?hash=(.*))?/,N_=new Map,nh=new Map});var IS={};xt(IS,{VimeoProvider:()=>F_});var gU,dD,F_,AS=Ue(()=>{"use strict";"use client";Lt();Wt();sc();A_();V_();gU=$(z(),1),dD=["bufferend","bufferstart","durationchange","ended","enterpictureinpicture","error","fullscreenchange","leavepictureinpicture","loaded","playProgress","loadProgress","pause","play","playbackratechange","qualitychange","seeked","seeking","timeupdate","volumechange","waiting"],F_=class extends za{constructor(e,n){super(e),this._ctx=n,this.$$PROVIDER_TYPE="VIMEO",this.scope=$t(),this._played=0,this._playedRange=new oe(0,0),this._seekableRange=new oe(0,0),this._playPromise=null,this._pausePromise=null,this._videoInfoPromise=null,this._videoId=D(""),this._pro=D(!1),this._hash=null,this._currentSrc=null,this._currentCue=null,this._timeRAF=new gi(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(){Jn(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=Ua(()=>{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=Ua(()=>{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(!F(e.src)){this._currentSrc=null,this._hash=null,this._videoId.set("");return}let{videoId:n,hash:i}=D_(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=qi(),i=new AbortController;return this._videoInfoPromise=n,O_(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:vi(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 oe(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 oe(0,a),this._notify("title-change",r,e),this._notify("poster-change",s,e),this._notify("duration-change",a,e);let d={buffered:new oe(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:vi(i)})})}_onMethod(e,n,i){switch(e){case"getCurrentTime":this._onTimeUpdate(n,i);break;case"getBuffered":He(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 dD)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 oe(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 ln({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[cn._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[cn._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 oe(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 oe(0,0),this._seekableRange=new oe(0,0),this._playPromise=null,this._pausePromise=null,this._videoInfoPromise=null,this._currentCue=null,this._pro.set(!1),this._removeChapters()}}});var NS={};xt(NS,{findYouTubePoster:()=>hD,resolveYouTubeVideoId:()=>U_});function U_(t){return t.match(pD)?.[1]}async function hD(t,e){if(z_.has(t))return z_.get(t);if(ih.has(t))return ih.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=fD(t,s,a);if((await fetch(o,{mode:"no-cors",signal:e.signal})).status<400){z_.set(t,o),i(o);return}}}).catch(()=>"").finally(()=>ih.delete(t));return ih.set(t,n),n}function fD(t,e,n){return`https://i.ytimg.com/${n?"vi_webp":"vi"}/${t}/${e}.${n?"webp":"jpg"}`}var pD,z_,ih,j_=Ue(()=>{"use strict";"use client";pD=/(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/,z_=new Map,ih=new Map});var DS={};xt(DS,{YouTubeProvider:()=>q_});var bU,ws,q_,OS=Ue(()=>{"use strict";"use client";Lt();Wt();A_();j_();bU=$(z(),1),ws={_Unstarted:-1,_Ended:0,_Playing:1,_Paused:2,_Buffering:3,_Cued:5},q_=class extends za{constructor(e,n){super(e),this._ctx=n,this.$$PROVIDER_TYPE="YOUTUBE",this.scope=$t(),this._videoId=D(""),this._state=-1,this._seekingTimer=-1,this._pausedSeeking=!1,this._played=0,this._playedRange=new oe(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(){Jn(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=Ua(()=>{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=Ua(()=>{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(!F(e.src)){this._currentSrc=null,this._videoId.set("");return}let n=U_(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===ws._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 oe(0,this._played=e)}_onProgress(e,n,i){let r={buffered:new oe(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===ws._Playing,o=e===ws._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 ws._Cued:this._onReady(n);break;case ws._Playing:this._notify("playing",void 0,n);break;case ws._Paused:this._onPause(n);break;case ws._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(Bl(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 oe(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 oe(o,l),n),u!==r()&&this._notify("duration-change",u,n)}if(Be(e.volume)&&Gy(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 oe(0,0),this._playPromise=null,this._pausePromise=null,this._pausedSeeking=!1}}});var FS={};xt(FS,{GoogleCastProvider:()=>K_});var SU,B_,H_,VS,W_,K_,zS=Ue(()=>{"use strict";"use client";Lt();Wt();sc();Y_();SU=$(z(),1),B_=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}},H_=chrome.cast.media.TrackType.TEXT,VS=chrome.cast.media.TrackType.AUDIO,W_=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(VS),s=this._findRemoteTrack(r,n);s&&e.push(s.trackId)}if(i?.length){let r=this._getRemoteTracks(H_);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(H_);for(let i of e)if(!this._findRemoteTrack(n,i)){La(()=>this._onNewLocalTracks?.());break}}_syncRemoteTracks(e){if(!this._cast.isMediaLoaded)return;let n=this._getLocalAudioTracks(),i=this._getLocalTextTracks(),r=this._getRemoteTracks(VS),s=this._getRemoteTracks(H_);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=cc();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()}},K_=class{constructor(e,n){this._player=e,this._ctx=n,this.$$PROVIDER_TYPE="GOOGLE_CAST",this.scope=$t(),this._currentSrc=null,this._state="disconnected",this._currentTime=0,this._played=0,this._playedRange=new oe(0,0),this._seekableRange=new oe(0,0),this._timeRAF=new gi(this._onAnimationFrame.bind(this)),this._reloadInfo=null,this._isIdle=!1,this._tracks=new W_(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 bs()}get session(){return lc()}get media(){return cc()}get hasActiveSession(){return rh(this._currentSrc)}setup(){this._attachCastContextEventListeners(),this._attachCastPlayerEventListeners(),this._tracks._setup(),this._notify("provider-setup",this)}_attachCastContextEventListeners(){G_(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 Ql(n))this._player.controller.addEventListener(r,i);G(()=>{for(let r of Ql(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),rh(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(sh(i)));return}this._currentSrc=e}destroy(){this._reset(),this._endSession()}_reset(){this._reloadInfo||(this._played=0,this._playedRange=new oe(0,0),this._seekableRange=new oe(0,0)),this._timeRAF._stop(),this._currentTime=0,this._reloadInfo=null}_resumeSession(){let e=new j("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 oe(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 oe(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 oe(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 oe(this._player.liveSeekableRange.start,this._player.liveSeekableRange.end):this._seekableRange}_createEvent(e){return e instanceof Event?e:new j(e.type,{detail:e})}_buildMediaInfo(e){let{streamType:n,title:i,poster:r}=this._ctx.$state;return new B_(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 jS={};xt(jS,{a:()=>bs,b:()=>lc,c:()=>sh,d:()=>_D,g:()=>cc,h:()=>rh,l:()=>G_});function mD(){return"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"}function gD(){return!!window.cast?.framework}function vD(){return!!window.chrome?.cast?.isAvailable}function US(){return bs().getCastState()===cast.framework.CastState.CONNECTED}function bs(){return window.cast.framework.CastContext.getInstance()}function lc(){return bs().getCurrentSession()}function cc(){return lc()?.getSessionObj().media[0]}function rh(t){return cc()?.media.contentId===t?.src}function yD(){return{language:"en-US",autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,resumeSavedSession:!0,androidReceiverCompatible:!0}}function sh(t){return`Google Cast Error Code: ${t}`}function G_(t,e){return qS(bs(),t,e)}var Q_,_D,Y_=Ue(()=>{"use strict";"use client";Wt();Lt();Q_=class{constructor(){this.name="google-cast"}get cast(){return bs()}mediaType(){return"video"}canPlay(e){return oc&&!ah&&oh(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:lc()?.getCastDevice().friendlyName}),US()&&this._notifyRemoteStateChange(e,"connected",n)}catch(i){let r=vi(i);throw this._notifyRemoteStateChange(e,US()?"connected":"disconnected",new j("google-cast-prompt-error",{detail:r})),r}finally{e.player.dispatch("google-cast-prompt-close",{trigger:n})}}async load(e){if(N)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(()=>(zS(),FS))).GoogleCastProvider(this._player,e)}async _loadCastFramework(e){if(gD())return;let n=e.player.createEvent("google-cast-load-start");e.player.dispatch(n),await th(mD()),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(sh(n))}_setOptions(e){this.cast?.setOptions({...yD(),...e})}_notifyRemoteStateChange(e,n,i){let r={type:"google-cast",state:n};e.delegate._notify("remote-playback-change",r,i)}},_D=Object.freeze({__proto__:null,GoogleCastLoader:Q_})});function hP(){return hh}function X_(t){if(xs.fullscreenElement===t)return!0;try{return t.matches(xs.fullscreenPseudoClass)}catch{return!1}}function GS(){if(!hh)throw Error("[vidstack] no fullscreen API")}function bw(){return fP()&&yt(screen.orientation.unlock)}function fP(){return!N&&!Ie(window.screen.orientation)&&!Ie(window.screen.orientation.lock)}function LD(t,e){return N?!1:(t||(t=document.createElement("audio")),t.canPlayType(e).length>0)}function ID(t,e){return N?!1:(t||(t=document.createElement("video")),t.canPlayType(e).length>0)}function Qp(t){return N?!1:(t||(t=document.createElement("video")),t.canPlayType("application/vnd.apple.mpegurl").length>0)}function Xp(t){return N?!1:!!document.pictureInPictureEnabled&&!t?.disablePictureInPicture}function Zp(t){return N?!1:yt(t?.webkitSupportsPresentationMode)&&yt(t?.webkitSetPresentationMode)}async function mP(){let t=document.createElement("video");return t.volume=.5,await t_(0),t.volume===.5}function AD(){return N?void 0:window?.ManagedMediaSource??window?.MediaSource??window?.WebKitMediaSource}function ND(){return N?void 0:window?.SourceBuffer??window?.WebKitSourceBuffer}function eh(){if(N)return!1;let t=AD();if(Ie(t))return!1;let e=t&&yt(t.isTypeSupported)&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),n=ND(),i=Ie(n)||!Ie(n.prototype)&&yt(n.prototype.appendBuffer)&&yt(n.prototype.remove);return!!e&&!!i}function tw(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 nw(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 RS(t,e){let n=new URLSearchParams;for(let i of Object.keys(e))n.set(i,e[i]+"");return t+"?"+n.toString()}function Jn(t,e="preconnect"){if(N)return!1;let n=document.querySelector(`link[href="${t}"]`);if(!fi(n))return!0;let i=document.createElement("link");return i.rel=e,i.href=t,i.crossOrigin="true",document.head.append(i),!0}function th(t){if(lh[t])return lh[t].promise;let e=qi(),n=document.querySelector(`script[src="${t}"]`);if(!fi(n))return e.resolve(),e.promise;let i=document.createElement("script");return i.src=t,i.onload=()=>{e.resolve(),delete lh[t]},i.onerror=()=>{e.reject(),delete lh[t]},setTimeout(()=>document.head.append(i),0),e.promise}function mh(t){return t==="use-credentials"?"include":F(t)?"same-origin":void 0}function gh(t,e){return e>=t.startTime&&e<t.endTime}function eo(t,e,n){let i=null;function r(){let s=F(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 qD.test(t.kind)}function yP(t,e,n){let i=F(t)?JSON.parse(t):t,r=[],s=[];return i.regions&&n&&(r=i.regions.map(a=>Object.assign(new n,a))),(i.cues||He(i))&&(s=(He(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 _P(t){Ls.reset(t,e=>HD.has(e)),Zn()}function le(){return Ae(tu)}function wP(t){return t.split("-")[0]}function BD(t){return t.split("-")[1]}function WD(t){return t==="x"?"y":"x"}function KD(t){return t==="y"?"height":"width"}function bP(t){return["top","bottom"].includes(wP(t))?"y":"x"}function GD(t){return WD(bP(t))}function xP(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function JS(t,e,n){let{reference:i,floating:r}=t,s=bP(e),a=GD(e),o=KD(a),l=wP(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(BD(e)){case"start":h[a]-=p*(n&&c?-1:1);break;case"end":h[a]+=p*(n&&c?-1:1);break}return h}function Ar(t){return kP(t)?(t.nodeName||"").toLowerCase():"#document"}function dn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ji(t){var e;return(e=(kP(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function kP(t){return t instanceof Node||t instanceof dn(t).Node}function Gi(t){return t instanceof Element||t instanceof dn(t).Element}function yi(t){return t instanceof HTMLElement||t instanceof dn(t).HTMLElement}function eP(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof dn(t).ShadowRoot}function nu(t){let{overflow:e,overflowX:n,overflowY:i,display:r}=Cn(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(r)}function QD(t){return["table","td","th"].includes(Ar(t))}function kw(t){let e=Ew(),n=Cn(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 EP(t){let e=Wa(t);for(;yi(e)&&!nf(e);){if(kw(e))return e;e=Wa(e)}return null}function Ew(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function nf(t){return["html","body","#document"].includes(Ar(t))}function Cn(t){return dn(t).getComputedStyle(t)}function rf(t){return Gi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Wa(t){if(Ar(t)==="html")return t;let e=t.assignedSlot||t.parentNode||eP(t)&&t.host||Ji(t);return eP(e)?e.host:e}function TP(t){let e=Wa(t);return nf(e)?t.ownerDocument?t.ownerDocument.body:t.body:yi(e)&&nu(e)?e:TP(e)}function hc(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let r=TP(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),a=dn(r);return s?e.concat(a,a.visualViewport||[],nu(r)?r:[],a.frameElement&&n?hc(a.frameElement):[]):e.concat(r,hc(r,[],n))}function SP(t){let e=Cn(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,r=yi(t),s=r?t.offsetWidth:n,a=r?t.offsetHeight:i,o=vh(n)!==s||vh(i)!==a;return o&&(n=s,i=a),{width:n,height:i,$:o}}function Tw(t){return Gi(t)?t:t.contextElement}function qa(t){let e=Tw(t);if(!yi(e))return Ir(1);let n=e.getBoundingClientRect(),{width:i,height:r,$:s}=SP(e),a=(s?vh(n.width):n.width)/i,o=(s?vh(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}function PP(t){let e=dn(t);return!Ew()||!e.visualViewport?XD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ZD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==dn(t)?!1:e}function ks(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let r=t.getBoundingClientRect(),s=Tw(t),a=Ir(1);e&&(i?Gi(i)&&(a=qa(i)):a=qa(t));let o=ZD(s,n,i)?PP(s):Ir(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=dn(s),h=i&&Gi(i)?dn(i):i,y=p.frameElement;for(;y&&i&&h!==p;){let v=qa(y),_=y.getBoundingClientRect(),m=Cn(y),f=_.left+(y.clientLeft+parseFloat(m.paddingLeft))*v.x,g=_.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=dn(y).frameElement}}return xP({width:u,height:d,x:l,y:c})}function CP(t){let e=!1,n=0,i=0;function r(a){try{e=e||t.matches(a)}catch{}}JD.forEach(a=>{r(a)});let s=EP(t);if(e&&s){let a=s.getBoundingClientRect();n=a.x,i=a.y}return[e,n,i]}function eO(t){let{elements:e,rect:n,offsetParent:i,strategy:r}=t,s=Ji(i),[a]=e?CP(e.floating):[!1];if(i===s||a)return n;let o={scrollLeft:0,scrollTop:0},l=Ir(1),c=Ir(0),u=yi(i);if((u||!u&&r!=="fixed")&&((Ar(i)!=="body"||nu(s))&&(o=rf(i)),yi(i))){let d=ks(i);l=qa(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 tO(t){return Array.from(t.getClientRects())}function $P(t){return ks(Ji(t)).left+rf(t).scrollLeft}function nO(t){let e=Ji(t),n=rf(t),i=t.ownerDocument.body,r=ja(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=ja(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),a=-n.scrollLeft+$P(t),o=-n.scrollTop;return Cn(i).direction==="rtl"&&(a+=ja(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:a,y:o}}function iO(t,e){let n=dn(t),i=Ji(t),r=n.visualViewport,s=i.clientWidth,a=i.clientHeight,o=0,l=0;if(r){s=r.width,a=r.height;let c=Ew();(!c||c&&e==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:s,height:a,x:o,y:l}}function rO(t,e){let n=ks(t,!0,e==="fixed"),i=n.top+t.clientTop,r=n.left+t.clientLeft,s=yi(t)?qa(t):Ir(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 tP(t,e,n){let i;if(e==="viewport")i=iO(t,n);else if(e==="document")i=nO(Ji(t));else if(Gi(e))i=rO(e,n);else{let r=PP(t);i={...e,x:e.x-r.x,y:e.y-r.y}}return xP(i)}function MP(t,e){let n=Wa(t);return n===e||!Gi(n)||nf(n)?!1:Cn(n).position==="fixed"||MP(n,e)}function sO(t,e){let n=e.get(t);if(n)return n;let i=hc(t,[],!1).filter(o=>Gi(o)&&Ar(o)!=="body"),r=null,s=Cn(t).position==="fixed",a=s?Wa(t):t;for(;Gi(a)&&!nf(a);){let o=Cn(a),l=kw(a);!l&&o.position==="fixed"&&(r=null),(s?!l&&!r:!l&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||nu(a)&&!l&&MP(t,a))?i=i.filter(u=>u!==a):r=o,a=Wa(a)}return e.set(t,i),i}function aO(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=tP(e,u,r);return c.top=ja(d.top,c.top),c.right=iw(d.right,c.right),c.bottom=iw(d.bottom,c.bottom),c.left=ja(d.left,c.left),c},tP(e,o,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function oO(t){let{width:e,height:n}=SP(t);return{width:e,height:n}}function lO(t,e,n,i){let r=yi(e),s=Ji(e),a=n==="fixed",o=ks(t,!0,a,e),l={scrollLeft:0,scrollTop:0},c=Ir(0);if(r||!r&&!a)if((Ar(e)!=="body"||nu(s))&&(l=rf(e)),r){let v=ks(e,!0,a,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&(c.x=$P(s));let u=o.left+l.scrollLeft-c.x,d=o.top+l.scrollTop-c.y,[p,h,y]=CP(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 nP(t,e){return!yi(t)||Cn(t).position==="fixed"?null:e?e(t):t.offsetParent}function RP(t,e){let n=dn(t);if(!yi(t))return n;let i=nP(t,e);for(;i&&QD(i)&&Cn(i).position==="static";)i=nP(i,e);return i&&(Ar(i)==="html"||Ar(i)==="body"&&Cn(i).position==="static"&&!kw(i))?n:i||EP(t)||n}function uO(t){return Cn(t).direction==="rtl"}function pO(t,e){let n=null,i,r=Ji(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=ch(u),y=ch(r.clientWidth-(c+d)),v=ch(r.clientHeight-(u+p)),_=ch(c),f={rootMargin:-h+"px "+-y+"px "+-v+"px "+-_+"px",threshold:ja(0,iw(1,l))||1},g=!0;function x(T){let L=T[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 hO(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=Tw(t),u=r||s?[...c?hc(c):[],...hc(e)]:[];u.forEach(m=>{r&&m.addEventListener("scroll",n,{passive:!0}),s&&m.addEventListener("resize",n)});let d=c&&o?pO(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?ks(t):null;l&&_();function _(){let m=ks(t);v&&(m.x!==v.x||m.y!==v.y||m.width!==v.width||m.height!==v.height)&&n(),v=m,y=requestAnimationFrame(_)}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 qS(t,e,n){if(t)return S(t,e,n)}function ve(t,e,n){t.hasAttribute(e)||t.setAttribute(e,n)}function Or(t,e){if(t.hasAttribute("aria-label")||t.hasAttribute("data-no-label"))return;function n(){Z(t,"aria-label",e())}N?n():b(n)}function LP(t,e,n){for(;e;){if(e===t)return!0;if(n?.(e))break;e=e.parentElement}return!1}function Nr(t,e){S(t,"pointerup",n=>{n.button===0&&e(n)}),S(t,"keydown",n=>{Kl(n)&&e(n)})}function Sw(t){return Ia(t)&&(t.touches.length>1||t.changedTouches.length>1)}function yh(t){if(N)return t();let e=jl(),n=window.requestAnimationFrame(()=>{et(t,e),n=-1});return()=>void window.cancelAnimationFrame(n)}function IP(t,e,n,{offsetVarName:i,xOffset:r,yOffset:s,...a}){if(!t)return;let o=n.replace(" ","-").replace("-center","");if(lt(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 hO(e,t,()=>{fO(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 mO(t){return getComputedStyle(t).animationName!=="none"}function gO(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 to(t){return t?.$$PROVIDER_TYPE==="VIDEO"}function AP(t){return!N&&t instanceof HTMLAudioElement}function NP(t){return!N&&t instanceof HTMLVideoElement}function DP(t){return AP(t)||NP(t)}function xO(t){return t.replace(/Shift\+(\d)/g,(e,n)=>bO[n-1])}function Cw({src:t,type:e}){return F(t)?VP.test(t)||FP.has(e)||t.startsWith("blob:")&&e==="audio/object":e==="audio/object"}function $w(t){return F(t.src)?zP.test(t.src)||UP.has(t.type)||t.src.startsWith("blob:")&&t.type==="video/object"||_s(t)&&(N||Qp()):t.type==="video/object"}function _s({src:t,type:e}){return F(t)&&jP.test(t)||qP.has(e)}function oh(t){return F(t.src)&&(Cw(t)||$w(t)||_s(t))}function x_(t){return!N&&typeof window.MediaStream<"u"&&t instanceof window.MediaStream}function vi(t){return t instanceof Error?t:Error(JSON.stringify(t))}function Wi(t,e){if(!t)throw Error(e||"Assertion failed.")}function J_(t,e){if(!(t&&e))throw Error("[vidstack] media not ready")}function sP(t,e){if(!e?.supported)throw Error("[vidstack] no fullscreen support")}function At(t,e=2){return Number(t.toFixed(e))}function Yp(t){return String(t).split(".")[1]?.length??0}function Mw(t,e,n){return Math.max(t,Math.min(n,e))}function uh(t,e){Z(t,"data-focus",e),Z(t,"data-hocus",e)}function aP(t,e){Z(t,"data-hocus",e),Z(t,"data-hover",e)}function KP(t,e){return fetch(t,e).then(n=>n.text()).then(n=>{let i=MO(n);if(i)return KP(/^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"&&RO(n)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(n)||n.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":r})}function MO(t){let e=t.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return e?e[0].split(`
|
|
`)[1].trim():null}function RO(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 oP(t){return(He(t)?t:[!F(t)&&"src"in t?t:{src:t}]).map(({src:e,type:n,...i})=>({src:e,type:n??(F(e)?GP.get(e):null)??(!F(e)||e.startsWith("blob:")?"video/object":e.includes("youtube")?"video/youtube":e.includes("vimeo")?"video/vimeo":"?"),...i})).sort(e=>e.type==="?"?1:-1)}function lP(t,e){return t?.src===e?.src&&t?.type===e?.type}function FO(t){return t?"true":"false"}function Gt(t){return()=>FO(t())}function cP(t,e,n){let i=e-t,r=n-t;return i>0?r/i:0}function zO(t,e,n,i){return Mw(t,At(n,Yp(i)),e)}function UO(t,e,n,i){let r=Mw(0,n,1),s=e-t,a=s*r,o=a/i,l=i*o;return t+l}function ew(t,e){let n=String(t),i=n.length;if(i<e){let s=e-i;return`${"0".repeat(s)}${t}`}return n}function YP(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 Vr(t,e=null,n=null,i=!1){let{hours:r,minutes:s,seconds:a}=YP(t),o=e?ew(r,2):r,l=n||fi(n)&&t>=3600?ew(s,2):s,c=ew(a,2);return r>0||i?`${o}:${l}:${c}`:`${l}:${c}`}function yc(t){let e=[],{hours:n,minutes:i,seconds:r}=YP(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 Rw(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 b3(t){return ke.isValidElement(t)&&t.type===w3}function x3(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 ZP(t){return t?.$$PROVIDER_TYPE==="REMOTION"}function ye(t,e){let n=$r(Ls);return pe((e?.current?.$state||n||E3)[t])}var ke,wD,bD,xD,kD,ED,TD,SD,PD,CD,$D,MD,Y,HS,pc,un,BS,WS,KS,Kt,Pn,xs,hh,fh,N,RD,ah,YS,oc,b_,gP,xw,oe,lh,DD,OD,VD,FD,zD,UD,jD,W,QS,XS,ZS,ln,qD,Ls,HD,tu,Ba,iw,ja,vh,ch,Ir,YD,XD,JD,cO,dO,fO,Yi,_h,iu,wh,rw,bh,Pw,xh,uc,kh,Eh,yO,_O,cn,Th,OP,iP,wO,rP,sw,bO,Sh,VP,FP,zP,UP,jP,qP,Ph,fc,HP,WP,Ch,$h,Z_,kO,EO,Mh,aw,ow,Rh,lw,cw,TO,uw,dw,SO,Lh,pn,PO,CO,Ee,he,$O,GP,hw,fw,LO,IO,AO,Ka,Ih,Ah,Nh,Ha,NO,Dh,Oh,mc,tt,DO,OO,VO,gc,Vh,Fh,zh,Uh,jh,qh,Hh,Bh,Wh,sf,uP,mw,vc,af,_i,Qi,Ki,dh,Kh,Ga,Gh,jO,qO,HO,Es,BO,WO,KO,Ya,_c,wc,Qa,GO,YO,of,Xi,ct,QO,dP,gw,XO,ZO,ru,JO,Zi,e3,t3,n3,Ts,Yh,Qh,dc,bc,vw,Dr,i3,r3,QP,Xa,s3,a3,o3,Za,l3,c3,Lw,Ss,u3,d3,Iw,Ps,p3,h3,Aw,Cs,f3,m3,Nw,$s,g3,v3,Dw,Ms,Xh,yw,Zh,xc,kc,y3,_3,_w,Rs,Jh,Ec,Tc,ef,Sc,Pc,Cc,$c,Mc,Rc,Lc,Ic,Ac,Nc,Dc,Oc,Vc,Fc,zc,Uc,jc,qc,Hc,Bc,Wc,Kc,Gc,Yc,Qc,Xc,Zc,Jc,tf,Ja,eu,XP,ww,w3,k3,U,pP,E3,Wt=Ue(()=>{"use strict";"use client";ke=$(z(),1);Lt();bD=Symbol(0);wD=bD;xD=Symbol(0),kD=Symbol(0),ED=Symbol(0),TD=Symbol(0),SD=Symbol(0),PD=Symbol(0),CD=Symbol(0),$D=Symbol(0),MD=Symbol(0),Y={_add:xD,_remove:kD,_reset:ED,_select:TD,_readonly:SD,_setReadonly:PD,_onReset:CD,_onRemove:$D,_onUserSelect:MD},pc=class extends Ma{constructor(){super(...arguments),this._items=[],this[HS]=!1}get length(){return this._items.length}get readonly(){return this[Y._readonly]}toArray(){return[...this._items]}[(HS=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 j("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 j("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 j("readonly-change",{detail:e,trigger:n})))}},un={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},BS=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],WS=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],KS=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],Kt=typeof window<"u"&&typeof window.document<"u"?window.document:{},Pn="fullscreenEnabled"in Kt&&Object.keys(un)||BS[0]in Kt&&BS||WS[0]in Kt&&WS||KS[0]in Kt&&KS||[],xs={requestFullscreen:function(t){return t[Pn[un.requestFullscreen]]()},requestFullscreenFunction:function(t){return t[Pn[un.requestFullscreen]]},get exitFullscreen(){return Kt[Pn[un.exitFullscreen]].bind(Kt)},get fullscreenPseudoClass(){return":"+Pn[un.fullscreen]},addEventListener:function(t,e,n){return Kt.addEventListener(Pn[un[t]],e,n)},removeEventListener:function(t,e,n){return Kt.removeEventListener(Pn[un[t]],e,n)},get fullscreenEnabled(){return!!Kt[Pn[un.fullscreenEnabled]]},set fullscreenEnabled(t){},get fullscreenElement(){return Kt[Pn[un.fullscreenElement]]},set fullscreenElement(t){},get onfullscreenchange(){return Kt[("on"+Pn[un.fullscreenchange]).toLowerCase()]},set onfullscreenchange(t){return Kt[("on"+Pn[un.fullscreenchange]).toLowerCase()]=t},get onfullscreenerror(){return Kt[("on"+Pn[un.fullscreenerror]).toLowerCase()]},set onfullscreenerror(t){return Kt[("on"+Pn[un.fullscreenerror]).toLowerCase()]=t}},hh=xs.fullscreenEnabled,fh=class extends Mt{constructor(){super(...arguments),this._listening=!1,this._active=!1}get active(){return this._active}get supported(){return hh}onConnect(){S(xs,"fullscreenchange",this._onFullscreenChange.bind(this)),S(xs,"fullscreenerror",this._onFullscreenError.bind(this)),G(this._onDisconnect.bind(this))}async _onDisconnect(){hh&&await this.exit()}_onFullscreenChange(e){let n=X_(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||X_(this.el)?void 0:(GS(),xs.requestFullscreen(this.el))}catch(e){throw this._listening=!1,e}}async exit(){if(!(!this.el||!X_(this.el)))return GS(),xs.exitFullscreen()}};N=typeof document>"u",RD=N?"":navigator?.userAgent.toLowerCase()||"",ah=!N&&/iphone|ipad|ipod|ios|crios|fxios/i.test(RD),YS=!N&&/(iphone|ipod)/gi.test(navigator?.platform||""),oc=!N&&!!window.chrome,b_=!N&&(!!window.safari||ah);gP=class vP extends Mt{constructor(){super(...arguments),this._type=D(this._getScreenOrientation()),this._locked=D(!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 vP.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 N?"portrait-primary":this.supported?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"}};gP.supported=bw();xw=gP,oe=class{get length(){return this._ranges.length}constructor(e,n){He(e)?this._ranges=e:!Ie(e)&&!Ie(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}};lh={};DD=Symbol(0),OD=Symbol(0),VD=Symbol(0),FD=Symbol(0),zD=Symbol(0),UD=Symbol(0),jD=Symbol(0),W={_crossOrigin:DD,_readyState:OD,_updateActiveCues:VD,_canLoad:FD,_onModeChange:zD,_native:UD,_nativeHLS:jD};ln=class extends Ma{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[QS]=0,this[XS]=null,this[ZS]=null;for(let n of Object.keys(e))this[n]=e[n];this.type||(this.type="vtt"),!N&&e.content?Promise.resolve().then(()=>(rc(),ic)).then(({parseText:n,VTTCue:i,VTTRegion:r})=>{!F(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[W._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[W._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[W._native]?.track.addCue(e),this.dispatchEvent(new j("add-cue",{detail:e,trigger:n})),gh(e,this._currentTime)&&this[W._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[W._native]?.track.removeCue(e),this.dispatchEvent(new j("remove-cue",{detail:e,trigger:n})),r&&this[W._updateActiveCues](this._currentTime,n)}}setMode(e,n){this._mode!==e&&(this._mode=e,e==="disabled"?(this._activeCues=[],this._activeCuesChanged()):this.readyState===2?this[W._updateActiveCues](this._currentTime,n):this._load(),this.dispatchEvent(new j("mode-change",{detail:this,trigger:n})),this[W._onModeChange]?.())}[(QS=W._readyState,XS=W._onModeChange,ZS=W._native,W._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];gh(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)}[W._canLoad](){this._canLoad=!0,this._mode!=="disabled"&&this._load()}async _load(){if(!(!this._canLoad||!this.src||this[W._readyState]>0)){this[W._readyState]=1,this.dispatchEvent(new j("load-start"));try{let{parseResponse:e,VTTCue:n,VTTRegion:i}=await Promise.resolve().then(()=>(rc(),ic)),r=this[W._crossOrigin]?.(),s=fetch(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:mh(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[W._readyState]=2,!this.src||this.type!=="vtt"){let n=this[W._native]?.track;if(n)for(let i of this._cues)n.addCue(i)}let e=new j("load");this[W._updateActiveCues](this._currentTime,e),this.dispatchEvent(e)}_errorState(e){this[W._readyState]=3,this.dispatchEvent(new j("error",{detail:e}))}_parseJSON(e,n,i){try{let{regions:r,cues:s}=yP(e,n,i);this._regions=r,this._cues=s}catch(r){this._errorState(r)}}_activeCuesChanged(e){this.dispatchEvent(new j("cue-change",{trigger:e}))}},qD=/captions|subtitles/;Ls=new Xn({artist:"",audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,buffered:new oe,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:bw(),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 oe,playing:!1,playsInline:!1,pictureInPicture:!1,preload:"metadata",playbackRate:1,qualities:[],quality:null,autoQuality:!1,canSetQuality:!0,canSetPlaybackRate:!0,canSetVolume:!1,seekable:new oe,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=tw(this.buffered)??0;return Math.max(0,t-this.clipStartTime)},get bufferedEnd(){let t=nw(this.buffered)??0;return Math.min(this.duration,Math.max(0,t-this.clipStartTime))},get seekableStart(){let t=tw(this.seekable)??0;return Math.max(0,t-this.clipStartTime)},get seekableEnd(){let t=this.canPlay?nw(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}),HD=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"]);tu=mi();Ba=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 j("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 j(e,{bubbles:!0,composed:!0,cancelable:!0,detail:i,trigger:n}),s=n?.target||null;s&&s instanceof H&&(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){}},iw=Math.min,ja=Math.max,vh=Math.round,ch=Math.floor,Ir=t=>({x:t,y:t});YD=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}=JS(c,i,l),p=i,h={},y=0;for(let v=0;v<o.length;v++){let{name:_,fn:m}=o[v],{x:f,y:g,data:x,reset:T}=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,[_]:{...h[_],...x}},T&&y<=50&&(y++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(c=T.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:r}):T.rects),{x:u,y:d}=JS(c,p,l)),v=-1)}return{x:u,y:d,placement:p,strategy:r,middlewareData:h}};XD=Ir(0);JD=[":popover-open",":modal"];cO=async function(t){let e=this.getOffsetParent||RP,n=this.getDimensions;return{reference:lO(t.reference,await e(t.floating),t.strategy,t.floating),floating:{x:0,y:0,...await n(t.floating)}}};dO={convertOffsetParentRelativeRectToViewportRelativeRect:eO,getDocumentElement:Ji,getClippingRect:aO,getOffsetParent:RP,getElementRects:cO,getClientRects:tO,getDimensions:oO,getScale:qa,isElement:Gi,isRTL:uO};fO=(t,e,n)=>{let i=new Map,r={platform:dO,...n},s={...r.platform,_c:i};return YD(t,e,{...r,platform:s})};Yi=class extends Mt{},_h=class extends Yi{constructor(){super(...arguments),this._idleTimer=-2,this._pausedTracking=!1,this._hideOnMouseLeave=D(!1),this._isMouseOutside=D(!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||Sw(e)||(ji(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}))}},iu=gO;wh=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=iu(()=>{if(N||!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(N||!this.playerId)return;let e=JSON.stringify({...this._data,time:void 0});localStorage.setItem(this.playerId,e)}},rw=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[W._native]?.remove?.(),e[W._native]=null,this._tracks.delete(e)}changeTrack(e){let n=e?.[W._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=W._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[W._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)}}},bh=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 rw,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?.[W._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}},Pw=vO;xh=class extends pc{constructor(){super(),this._canLoad=!1,this._defaults={},this._storage=null,this._preferredLang=null,this._selectCaptions=Pw(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 ln,r=i?e:new ln(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[W._crossOrigin]=this[W._crossOrigin],this._canLoad&&r[W._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[W._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))}[W._canLoad](){if(!this._canLoad){for(let e of this._items)e[W._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 j("mode-change",{detail:e.detail,trigger:e}))}setStorage(e){this._storage=e}},uc=Symbol(0),kh=class extends pc{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[uc]=!1,Object.defineProperty(e,"selected",{get(){return this[uc]},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?.[uc])return;let r=this.selected;e&&(e[uc]=n),(n?r!==e:r===e)&&(r&&(r[uc]=!1),this.dispatchEvent(new j("change",{detail:{prev:r,current:this.selected},trigger:i})))}},Eh=class extends kh{getById(e){return e===""?null:this._items.find(n=>n.id===e)??null}},yO=Symbol(0),_O=Symbol(0),cn={_setAuto:yO,_enableAuto:_O},Th=class extends kh{constructor(){super(...arguments),this._auto=!1,this.switch="current"}get auto(){return this._auto||this.readonly}[Y._onUserSelect](){this[cn._setAuto](!1)}[Y._onReset](e){this[cn._setAuto](!1,e)}autoSelect(e){this.readonly||this._auto||!this[cn._enableAuto]||(this[cn._enableAuto]?.(),this[cn._setAuto](!0,e))}[cn._setAuto](e,n){this._auto!==e&&(this._auto=e,this.dispatchEvent(new j("auto-change",{detail:e,trigger:n})))}};OP={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:"<"},iP=new Set(["Shift","Alt","Meta","Control"]),wO='button, [role="button"]',rP='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]',sw=class extends Yi{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=D(!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(rP))return;let{method:i,value:r}=this._getMatchingMethod(e);if(!F(r)&&!He(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||iP.has(e.key))return;let n=document.activeElement;if(n?.matches(rP)||Kl(e)&&n?.matches(wO))return;let{method:i,value:r}=this._getMatchingMethod(e);if(!F(r)&&!He(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){DP(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=He(s)?s.join(" "):F(s)?s:s?.keys;return(He(a)?a:a?.split(" "))?.some(o=>xO(o).replace(/Control/g,"Ctrl").split("+").every(l=>iP.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))}},bO=["!","@","#","$","%","^","&","*","(",")"];Sh=class extends Mt{constructor(e){super(),this._shortcut=e}onAttach(e){let{$props:n,ariaKeys:i}=le(),r=e.getAttribute("aria-keyshortcuts");if(r){i[this._shortcut]=r,N||G(()=>{delete i[this._shortcut]});return}let s=n.keyShortcuts()[this._shortcut];if(s){let a=He(s)?s.join(" "):F(s)?s:s?.keys;e.setAttribute("aria-keyshortcuts",He(a)?a.join(" "):a)}}},VP=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,FP=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp4","audio/webm","audio/flac"]),zP=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,UP=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),jP=/\.(m3u8)($|\?)/i,qP=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]);Ph=class{constructor(){this.name="audio"}canPlay(e){return Cw(e)?N||e.type==="?"||LD(this.target,e.type):!1}mediaType(){return"audio"}async load(e){if(N)throw Error("[vidstack] can not load audio provider server-side");return new(await Promise.resolve().then(()=>(PS(),SS))).AudioProvider(this.target,e)}},fc=class{constructor(){this.name="video"}canPlay(e){return $w(e)?N||e.type==="?"||ID(this.target,e.type):!1}mediaType(){return"video"}async load(e){if(N)throw Error("[vidstack] can not load video provider server-side");return new(await Promise.resolve().then(()=>(R_(),CS))).VideoProvider(this.target,e)}},HP=class BP extends fc{constructor(){super(...arguments),this.name="hls"}canPlay(e){return BP.supported&&_s(e)}async load(e){if(N)throw Error("[vidstack] can not load hls provider server-side");return new(await Promise.resolve().then(()=>(MS(),$S))).HLSProvider(this.target,e)}};HP.supported=eh();WP=HP,Ch=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)Jn(n)}canPlay(e){return F(e.src)&&e.type==="video/vimeo"}mediaType(){return"video"}async load(e){if(N)throw Error("[vidstack] can not load vimeo provider server-side");return new(await Promise.resolve().then(()=>(AS(),IS))).VimeoProvider(this.target,e)}async loadPoster(e,n,i){let{resolveVimeoVideoId:r,getVimeoVideoInfo:s}=await Promise.resolve().then(()=>(V_(),LS));if(!F(e.src))return null;let{videoId:a}=r(e.src);return a?s(a,i).then(o=>o?o.poster:null):null}},$h=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)Jn(n)}canPlay(e){return F(e.src)&&e.type==="video/youtube"}mediaType(){return"video"}async load(e){if(N)throw Error("[vidstack] can not load youtube provider server-side");return new(await Promise.resolve().then(()=>(OS(),DS))).YouTubeProvider(this.target,e)}async loadPoster(e,n,i){let{findYouTubePoster:r,resolveYouTubeVideoId:s}=await Promise.resolve().then(()=>(j_(),NS)),a=F(e.src)&&s(e.src);return a?r(a,i):null}},Z_=Symbol(0),kO=["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"],EO={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:OP,storage:null},Mh=class extends Yi{constructor(e,n){super(),this._type=e,this._callback=n}async onAttach(e){if(N)return;let n=this.$props[this._type]();if(n==="eager")requestAnimationFrame(this._callback);else if(n==="idle")n_(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())}}},aw=class{constructor(e,n){this._handle=e,this._media=n,this._notify=(i,...r)=>{N||this._handle(new j(i,{detail:r?.[0],trigger:r?.[1]}))}}async _ready(e,n){if(!N)return La(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),Zn();let p=this._media.$provider(),{storage:h}=this._media,{muted:y,volume:v,clipStartTime:_,playbackRate:m}=this._media.$props,f=c()?.savedState?.currentTime,g=c()?.savedState?.paused===!1,x=f??await h?.getTime()??_(),T=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()&&T&&!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 j("auto-play-attempt",{trigger:e});try{await n.play(s)}catch{}}},ow=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()}},Rh=class{constructor(){this._serving=!1,this._pending=qi(),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=qi()}};lw=class extends Yi{constructor(e,n,i){super(),this._stateMgr=e,this._request=n,this._media=i,this._providerQueue=new Rh,this._wasPIPActive=!1,this._$provider=i.$provider,this._controls=new _h,this._fullscreen=new fh,this._orientation=new xw}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(N)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 J_(s,C(n)),await s.play()}catch(s){let a=this.createEvent("play-fail",{detail:vi(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(N)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 J_(r,C(n)),await r.pause()}catch(r){throw this._request._queue._delete("media-pause-request"),r}}}_seekToLiveEdge(e){if(N)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);J_(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(N)return;let i=this._getFullscreenAdapter(e);if(sP(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(N)return;let i=this._getFullscreenAdapter(e);if(sP(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(!N&&(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(!N&&(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=oc&&!ah&&oh(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(Jn("https://www.gstatic.com"),!this._googleCastLoader){let r=await Promise.resolve().then(()=>(Y_(),jS)).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(!(Ie(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:vi(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:vi(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){}};cw=class{constructor(){this._seeking=!1,this._looping=!1,this._replaying=!1,this._queue=new ow}},TO=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"]),uw=class extends Yi{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=iu(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=Pw(()=>{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),N||(TO.has(n)&&this._trackedEvents.set(n,e),this.dispatch(e))}_resumePlaybackOnConnect(){this._isPlayingOnDisconnect&&(requestAnimationFrame(()=>{this.scope&&this._media.remote.play(new j("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}mP().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[W._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&&(N?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(),_P(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[W._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))}},dw=class extends Yi{onSetup(){this._init(),!N&&(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()})}},SO=class pw extends Yi{constructor(){super()}onConnect(){b(this._onMetadataChange.bind(this)),b(this._onPlaybackStateChange.bind(this));let e=this._handleAction.bind(this);for(let n of pw._actions)navigator.mediaSession.setActionHandler(n,e);G(this._onDisconnect.bind(this))}_onDisconnect(){for(let e of pw._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 j("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}}};SO._actions=["play","pause","seekforward","seekbackward","seekto"];Lh=D(!1);N||(S(document,"pointerdown",()=>{Lh.set(!1)}),S(document,"keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||Lh.set(!0)}));pn=class extends Mt{constructor(){super(...arguments),this._focused=D(!1)}onConnect(e){b(()=>{if(!Lh()){this._focused.set(!1),uh(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),uh(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),uh(this.el,!0)}_onBlur(){this._focused.set(!1),uh(this.el,!1)}_onPointerEnter(){aP(this.el,!0)}_onPointerLeave(){aP(this.el,!1)}};PO=Object.defineProperty,CO=Object.getOwnPropertyDescriptor,Ee=(t,e,n,i)=>{for(var r=i>1?void 0:i?CO(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&&PO(e,n,r),r},he=class ph extends H{constructor(){super(),this.canPlayQueue=new Rh,this._skipTitleUpdate=!1,new dw;let e={player:this,qualities:new Th,audioTracks:new Eh,storage:null,$provider:D(null),$providerSetup:D(!1),$props:this.$props,$state:this.$state};e.remote=new Ba(void 0),e.remote.setPlayer(this),e.$iosControls=hi(this._isIOSControls.bind(this)),e.textTracks=new xh,e.textTracks[W._crossOrigin]=this.$state.crossOrigin,e.textRenderers=new bh(e),e.ariaKeys={},this._media=e,Rt(tu,e),this.orientation=new xw,new pn,new sw(e);let n=new cw;this._stateMgr=new uw(n,e),this._requestMgr=new lw(this._stateMgr,n,e),e.delegate=new aw(this._stateMgr._handle.bind(this._stateMgr),e),new Mh("load",this.startLoading.bind(this)),new Mh("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",""),ve(e,"tabindex","0"),ve(e,"role","region"),b(this._watchStorage.bind(this)),N?this._watchTitle():b(this._watchTitle.bind(this)),N?this._watchOrientation():b(this._watchOrientation.bind(this)),S(e,"find-media-player",this._onFindPlayer.bind(this))}onConnect(e){YS&&Z(e,"data-iphone","");let n=window.matchMedia("(pointer: coarse)");this._onPointerChange(n),n.onchange=this._onPointerChange.bind(this);let i=new ResizeObserver(Mr(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=Gl(r()),l=o!=="Unknown"?`${a?"Live ":""}${o}`:a?"Live":"Media",c=n();Z(this.el,"aria-label",c?`${l} - ${c}`:l+" Player"),!N&&e?.hasAttribute("title")&&(this._skipTitleUpdate=!0,e?.removeAttribute("title"))}_watchOrientation(){let e=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(e),Z(this.el,"data-orientation",e),this._onResize()}_watchCanPlay(){this.$state.canPlay()&&this._provider?this.canPlayQueue._start():this.canPlayQueue._stop()}_setupMediaAttributes(){if(ph[Z_]){this.setAttributes(ph[Z_]);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 kO){let r="data-"+(n[i]??Aa(i));e[r]=function(){return this.$state[i]()}}delete e.title,ph[Z_]=e,this.setAttributes(e)}_onFindPlayer(e){e.detail(this)}_onResize(){if(N||!this.el)return;let e=this.el.clientWidth,n=this.el.clientHeight;this.$state.width.set(e),this.$state.height.set(n),lt(this.el,"--player-width",e+"px"),lt(this.el,"--player-height",n+"px")}_onPointerChange(e){if(N)return;let n=e.matches?"coarse":"fine";Z(this.el,"data-pointer",n),this.$state.pointer.set(n),this._onResize()}_isIOSControls(){let{playsInline:e,fullscreen:n}=this.$state;return YS&&!hP()&&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=Mw(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=F(e)?new wh:e;if(n?.onChange){let{source:i}=this.$state,r=F(e)?e:this.el?.id,s=hi(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")}};he.props=EO;he.state=Ls;Ee([ee],he.prototype,"canPlayQueue",2);Ee([ee],he.prototype,"provider",1);Ee([ee],he.prototype,"controls",1);Ee([ee],he.prototype,"orientation",2);Ee([ee],he.prototype,"title",1);Ee([ee],he.prototype,"qualities",1);Ee([ee],he.prototype,"audioTracks",1);Ee([ee],he.prototype,"textTracks",1);Ee([ee],he.prototype,"textRenderers",1);Ee([ee],he.prototype,"paused",1);Ee([ee],he.prototype,"muted",1);Ee([ee],he.prototype,"currentTime",1);Ee([ee],he.prototype,"volume",1);Ee([ee],he.prototype,"playbackRate",1);Ee([Ne],he.prototype,"play",1);Ee([Ne],he.prototype,"pause",1);Ee([Ne],he.prototype,"enterFullscreen",1);Ee([Ne],he.prototype,"exitFullscreen",1);Ee([Ne],he.prototype,"enterPictureInPicture",1);Ee([Ne],he.prototype,"exitPictureInPicture",1);Ee([Ne],he.prototype,"seekToLiveEdge",1);Ee([Ne],he.prototype,"startLoading",1);Ee([Ne],he.prototype,"startLoadingPoster",1);Ee([Ne],he.prototype,"requestAirPlay",1);Ee([Ne],he.prototype,"requestGoogleCast",1);$O=he;GP=new Map,hw=class{constructor(e,n,i,r=[]){this._domSources=e,this._media=n,this._loader=i,this._initialize=!1;let s=new WP,a=new fc,o=new Ph,l=new $h,c=new Ch,u=[l,c];this._loaders=hi(()=>{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(oP(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",[...oP(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=mh(a()),l=new AbortController;return Promise.all(n.map(c=>F(c.src)&&c.type==="?"?fetch(c.src,{method:"HEAD",credentials:o,signal:l.signal}).then(u=>(c.type=u.headers.get("content-type")||"??",GP.set(c.src,c.type),c)).catch(()=>c):c)).then(c=>{l.signal.aborted||(this._findNewSource(C(e.source),c),Zn())}),()=>l.abort()}Zn()}_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 lP(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()){et(()=>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(!lP(e?.currentSrc,n)){if(this._media.$state.canLoad()){let r=new AbortController;return _s(n)?eh()||KP(n.src,{credentials:mh(i),signal:r.signal}).then(s=>{this._notify("stream-type-change",s)}).catch(Ht):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{F(n.src)&&Jn(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 j("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()}}};fw=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||ln.createId(n);this._media.textTracks.getById(i)||(n.id=i,this._media.textTracks.add(n))}this._prevTracks=e}},LO=Object.defineProperty,IO=Object.getOwnPropertyDescriptor,AO=(t,e,n,i)=>{for(var r=i>1?void 0:i?IO(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&&LO(e,n,r),r},Ka=class extends H{constructor(){super(...arguments),this._domSources=D([]),this._domTracks=D([]),this._loader=null,this._loadRafId=-1}onSetup(){this._media=le(),this._sources=new hw(this._domSources,this._media,this.$state.loader,this.$props.loaders())}onAttach(e){e.setAttribute("data-media-provider","")}onConnect(e){this._sources.connect(),new fw(this._domTracks,this._media);let n=new ResizeObserver(Mr(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&&(lt(e.el,"--media-width",n+"px"),lt(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),Zn()}};Ka.props={loaders:[]};Ka.state=new Xn({loader:null});AO([Ne],Ka.prototype,"load",1);Ih=class extends H{onSetup(){this._media=le(),b(this._watchProps.bind(this))}onAttach(e){let{pictureInPicture:n,fullscreen:i}=this._media.$state;lt(e,"pointer-events","none"),ve(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"])lt(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();Z(this.el,"aria-hidden",i?"true":null),lt(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()}};Ih.props={hideDelay:2e3,hideOnMouseLeave:!1};Ah=class extends H{onAttach(e){lt(e,"pointer-events","auto")}},Nh=class extends Mt{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(mO(n)){this._stopAnimationEndListener?.();let s=S(n,"animationend",i,{once:!0});this._stopAnimationEndListener=s}else i()}})}_cancelShowing(){window.clearTimeout(this._showTimerId),this._showTimerId=-1}},Ha=mi(),NO=0,Dh=class extends H{constructor(){super(),this._id=`media-tooltip-${++NO}`,this._trigger=D(null),this._content=D(null),new pn;let{showDelay:e}=this.$props;new Nh({_trigger:this._trigger,_content:this._content,_showDelay:e,_listen(n,i,r){S(n,"touchstart",s=>s.preventDefault(),{passive:!1}),b(()=>{Lh()&&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(){Rt(Ha,{_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`,""),Z(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",ve(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&&Z(n,"aria-describedby",e?this._id:null);for(let r of[this.el,n,i])r&&Z(r,"data-visible",e)}};Dh.props={showDelay:700};Oh=class extends H{constructor(){super(),new pn}onConnect(e){G(yh(()=>{if(!this.connectScope)return;this._attach();let n=Ae(Ha);G(()=>{let i=this._getButton();i&&n._detachTrigger(i)})}))}_attach(){let e=this._getButton(),n=Ae(Ha);e&&n._attachTrigger(e)}_getButton(){let e=this.el.firstElementChild;return e?.localName==="button"||e?.getAttribute("role")==="button"?e:this.el}},mc=class extends H{constructor(){super(),new pn;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=Ae(Ha);G(()=>n._detachContent(e)),G(yh(()=>{this.connectScope&&b(this._watchPlacement.bind(this))}))}_attach(e){Ae(Ha)._attachContent(e)}_watchPlacement(){let{placement:e,offset:n,alignOffset:i}=this.$props;return IP(this.el,this._getTrigger(),e(),{offsetVarName:"media-tooltip",xOffset:i(),yOffset:n()})}_getTrigger(){return Ae(Ha)._trigger()}};mc.props={placement:"top center",offset:0,alignOffset:0};tt=class extends Mt{constructor(e){super(),this._delegate=e,new pn,e._keyShortcut&&new Sh(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){ve(e,"tabindex","0"),ve(e,"role","button"),ve(e,"type","button")}onConnect(e){Nr(e,this._onMaybePress.bind(this));for(let n of["click","touchstart"])this.listen(n,this._onInteraction.bind(this))}_isARIAPressed(){return Na(this._delegate._isPressed())}_onPressed(e){Wy(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())}};tt.props={disabled:!1};DO=Object.defineProperty,OO=Object.getOwnPropertyDescriptor,VO=(t,e,n,i)=>{for(var r=i>1?void 0:i?OO(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&&DO(e,n,r),r},gc=class extends H{constructor(){super(),this._pressed=D(!1),new tt({_isPressed:this._pressed})}get pressed(){return this._pressed()}};gc.props={disabled:!1,defaultPressed:!1};VO([ee],gc.prototype,"pressed",1);Vh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_onPress:this._onPress.bind(this)})}onSetup(){this._media=le();let{canAirPlay:e,isAirPlayConnected:n}=this._media.$state;this.setAttributes({"data-active":n,"data-supported":e,"data-state":this._getState.bind(this),"aria-hidden":Gt(()=>!e())})}onAttach(e){e.setAttribute("data-media-tooltip","airplay"),Or(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()}`}};Vh.props=tt.props;Fh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_onPress:this._onPress.bind(this)})}onSetup(){this._media=le();let{canGoogleCast:e,isGoogleCastConnected:n}=this._media.$state;this.setAttributes({"data-active":n,"data-supported":e,"data-state":this._getState.bind(this),"aria-hidden":Gt(()=>!e())})}onAttach(e){e.setAttribute("data-media-tooltip","google-cast"),Or(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()}`}};Fh.props=tt.props;zh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_keyShortcut:"togglePaused",_onPress:this._onPress.bind(this)})}onSetup(){this._media=le();let{paused:e,ended:n}=this._media.$state;this.setAttributes({"data-paused":e,"data-ended":n})}onAttach(e){e.setAttribute("data-media-tooltip","play"),Or(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"}};zh.props=tt.props;Uh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_keyShortcut:"toggleCaptions",_onPress:this._onPress.bind(this)})}onSetup(){this._media=le(),this.setAttributes({"data-active":this._isPressed.bind(this),"data-supported":()=>!this._isHidden(),"aria-hidden":Gt(this._isHidden.bind(this))})}onAttach(e){e.setAttribute("data-media-tooltip","caption"),Or(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"}};Uh.props=tt.props;jh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_keyShortcut:"toggleFullscreen",_onPress:this._onPress.bind(this)})}onSetup(){this._media=le();let{fullscreen:e}=this._media.$state,n=this._isSupported.bind(this);this.setAttributes({"data-active":e,"data-supported":n,"aria-hidden":Gt(()=>!n())})}onAttach(e){e.setAttribute("data-media-tooltip","fullscreen"),Or(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"}};jh.props={...tt.props,target:"prefer-media"};qh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_keyShortcut:"toggleMuted",_onPress:this._onPress.bind(this)})}onSetup(){this._media=le(),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"),Or(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"}};qh.props=tt.props;Hh=class extends H{constructor(){super(),new tt({_isPressed:this._isPressed.bind(this),_keyShortcut:"togglePictureInPicture",_onPress:this._onPress.bind(this)})}onSetup(){this._media=le();let{pictureInPicture:e}=this._media.$state,n=this._isSupported.bind(this);this.setAttributes({"data-active":e,"data-supported":n,"aria-hidden":Gt(()=>!n())})}onAttach(e){e.setAttribute("data-media-tooltip","pip"),Or(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"}};Hh.props=tt.props;Bh=class extends H{constructor(){super(),new pn}onSetup(){this._media=le();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":Gt(()=>!i())})}onAttach(e){ve(e,"tabindex","0"),ve(e,"role","button"),ve(e,"type","button"),e.setAttribute("data-media-tooltip","seek"),Or(e,this._getDefaultLabel.bind(this))}onConnect(e){Nr(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)}};Bh.props={disabled:!1,seconds:30};Wh=class extends H{constructor(){super(),new pn}onSetup(){this._media=le();let{disabled:e}=this.$props,{live:n,liveEdge:i}=this._media.$state,r=()=>!n();this.setAttributes({"data-edge":i,"data-hidden":r,"aria-disabled":Gt(()=>e()||i()),"aria-hidden":Gt(r)})}onAttach(e){ve(e,"tabindex","0"),ve(e,"role","button"),ve(e,"type","button"),e.setAttribute("data-media-tooltip","live")}onConnect(e){Nr(e,this._onPress.bind(this))}_onPress(e){let{disabled:n}=this.$props,{liveEdge:i}=this._media.$state;n()||i()||this._media.remote.seekToLiveEdge(e)}};Wh.props={disabled:!1};sf=new Xn({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 cP(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return cP(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});uP={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1},mw=class extends Mt{constructor(e,n){super(),this._delegate=e,this._media=n,this._provider=null,this._touch=null,this._touchStartValue=null,this._onDocumentPointerMove=iu(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(fi(this._touch)||Sw(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)),b_&&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(UO(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)),!Ie(s)){this._updatePointerValue(s,e),this._updateValue(s,e);return}let a=this._getKeyValue(e);if(Ie(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(uP).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(uP[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()}},vc=mi(()=>({})),af=mi(),_i=class extends Mt{constructor(e){super(),this._delegate=e,this._updateSliderVars=Mr((n,i)=>{this.el?.style.setProperty("--slider-fill",n+"%"),this.el?.style.setProperty("--slider-pointer",i+"%")})}onSetup(){this._media=le();let e=new pn;e.attach(this),this.$state.focused=e.focused.bind(e),Tn(vc)||Rt(vc,{default:"value"}),Rt(af,{_orientation:this.$props.orientation,_disabled:this._delegate._isDisabled,_preview:D(null)}),b(this._watchValue.bind(this)),b(this._watchDisabled.bind(this)),this._setupAttrs(),new mw(this._delegate,this._media).attach(this)}onAttach(e){ve(e,"role","slider"),ve(e,"tabindex","0"),ve(e,"autocomplete","off"),N?this._watchCSSVars():b(this._watchCSSVars.bind(this))}_watchValue(){let{dragging:e,value:n,min:i,max:r}=this.$state;C(e)||n.set(zO(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 Na(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(At(e(),3),At(n(),3))}};_i.props={disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};Qi=class extends H{constructor(){super(),new _i({_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 At(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())}};Qi.props={..._i.props,min:0,max:100,value:0};Qi.state=sf;Ki=new Map,dh=new Map,Kh=class t{constructor(e,n,i){this.$src=e,this.$crossOrigin=n,this._media=i,this.$images=D([]),b(this._onLoadCues.bind(this))}static create(e,n){let i=le();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(F(n)&&Ki.has(n)){let r=Ki.get(n);if(Ki.delete(n),Ki.set(n,r),Ki.size>30){let s=Ki.keys().next().value;Ki.delete(s)}this.$images.set(Ki.get(n))}else if(F(n)){let r=this.$crossOrigin(),s=n+"::"+r;if(!dh.has(s)){let a=new Promise(async(o,l)=>{try{let c=await fetch(n,{signal:i.signal,credentials:mh(r)});if(c.headers.get("content-type")==="application/json"){let d=await c.json();if(He(d))if(d[0]&&"text"in d)o(this._processVTTCues(d));else{for(let p=0;p<d.length;p++){let h=d[p];Wi(Bl(h),!1),Wi("url"in h&&F(h.url),!1),Wi("startTime"in h&&Be(h.startTime),!1)}o(d)}else o(this._processStoryboard(d));return}Promise.resolve().then(()=>(rc(),ic)).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||Ki.set(s,o),o)).catch(o=>{i.signal.aborted||this._onError(n,o)}).finally(()=>{F(s)&&dh.delete(s)});dh.set(s,a)}dh.get(s)?.then(a=>{i.signal.aborted||this.$images.set(a||[])})}else if(He(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)=>(Wi(i.url&&F(i.url),!1),Wi("startTime"in i&&Be(i.startTime),!1),{...i,url:F(i.url)?this._resolveURL(i.url,n):i.url}))}_processStoryboard(e){Wi(F(e.url),!1),Wi(He(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];Wi("startTime"in s&&Be(s.startTime),!1),Wi("text"in s&&F(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!F(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){}},Ga=class extends H{constructor(){super(...arguments),this._styleResets=[]}onSetup(){this._media=le(),this._loader=Kh.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":Gt(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!fi(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=[]}};Ga.props={src:null,time:0,crossOrigin:null};Ga.state=new Xn({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1});Gh=class extends Ga{onAttach(e){this._slider=gs(Qi.state)}_getTime(){let{duration:e,clipStartTime:n}=this._media.$state;return n()+this._slider.pointerRate()*e()}},jO=Object.defineProperty,qO=Object.getOwnPropertyDescriptor,HO=(t,e,n,i)=>{for(var r=i>1?void 0:i?qO(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},Es=class extends H{get video(){return this.$state.video()}onSetup(){this._media=le(),this._slider=gs(Qi.state),this._watchCrossOrigin(),this.setAttributes({"data-loading":this._isLoading.bind(this),"data-hidden":this.$state.hidden,"data-error":this._hasError.bind(this),"aria-hidden":Gt(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!fi(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())}};Es.props={src:null,crossOrigin:null};Es.state=new Xn({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});HO([ee],Es.prototype,"video",1);BO=Object.defineProperty,WO=Object.getOwnPropertyDescriptor,KO=(t,e,n,i)=>{for(var r=i>1?void 0:i?WO(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&&BO(e,n,r),r},Ya=class extends H{onSetup(){this._slider=gs(Qi.state),this._format=Ae(vc),this._text=hi(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??At)(y,i())+"\uFE6A"}else return d==="time"?(this._format.time??Vr)(p,r(),s(),a()):this._format.value?.(p)??p.toFixed(2)}};Ya.props={type:"pointer",format:null,showHours:!1,padHours:null,padMinutes:null,decimalPlaces:2};KO([Ne],Ya.prototype,"getValueText",1);_c=class extends H{constructor(){super(...arguments),this._updatePlacement=Mr(()=>{let{_disabled:e,_orientation:n}=this._slider;if(e())return;let i=this.el,{offset:r,noClamp:s}=this.$props;Rw(i,{clamp:!s(),offset:r(),orientation:n()})})}onSetup(){this._slider=Ae(af);let{active:e}=gs(Qi.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())}};_c.props={offset:0,noClamp:!1};wc=class extends H{constructor(){super(...arguments),this._throttleVolumeChange=iu(this._onVolumeChange.bind(this),25)}onSetup(){this._media=le(),Rt(vc,{default:"percent"}),new _i({_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",""),ve(e,"aria-label","Volume");let{canSetVolume:n}=this._media.$state;this.setAttributes({"data-supported":n,"aria-hidden":Gt(()=>!n())})}_getARIAValueNow(){let{value:e}=this.$state;return Math.round(e())}_getARIAValueText(){let{value:e,max:n}=this.$state;return At(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=At(e.detail/100,3);this._media.remote.changeVolume(n,e)}_onValueChange(e){this._throttleVolumeChange(e)}_onDragValueChange(e){this._throttleVolumeChange(e)}};wc.props={..._i.props,keyStep:5,shiftKeyMultiplier:2};wc.state=sf;Qa=class extends H{constructor(){super(),this._chapter=D(null),this._playingBeforeDragStart=!1,new _i({_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=le(),Rt(vc,{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",""),ve(e,"aria-label","Seek")}onConnect(e){b(this._watchPreviewing.bind(this)),eo(this._media.textTracks,"chapters",this._chapter.set)}_calcBufferedPercent(){let{bufferedEnd:e,duration:n}=this._media.$state;return At(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=iu(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}=Ae(af);e&&n()&&Z(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 At(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)?`${yc(e)} out of ${yc(n())}`:"live"}_percentToTime(e){let{duration:n}=this._media.$state;return At(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?"-":""}${Vr(Math.abs(l),n,i,r)}`:"LIVE"}};Qa.props={..._i.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,seekingRequestThrottle:100};Qa.state=sf;GO=Object.defineProperty,YO=Object.getOwnPropertyDescriptor,of=(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},Xi=class extends H{constructor(){super(...arguments),this._titleRef=null,this._refs=[],this._$track=D(null),this._$cues=D([]),this._activeIndex=D(-1),this._activePointerIndex=D(-1),this._bufferedIndex=0,this._updateBufferedPercent=Mr(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=hi(this._calcMediaBufferedPercent.bind(this)),this._onCuesChange=Pw(()=>{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=le(),this._sliderState=gs(Qa.state)}onAttach(e){eo(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&&et(()=>this._watch(),this._updateScope=$t())}_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:At((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 At(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,At(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}};Xi.props={disabled:!1};of([ee],Xi.prototype,"cues",1);of([ee],Xi.prototype,"activeCue",1);of([ee],Xi.prototype,"activePointerCue",1);of([Ne],Xi.prototype,"setRefs",1);ct=mi(),QO=["a[href]","[tabindex]","input","select","button"].map(t=>`${t}:not([aria-hidden='true'])`).join(","),dP=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]),gw=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){dP.has(e.key)&&(e.stopPropagation(),e.preventDefault())}_onKeyDown(e){if(dP.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(QO),n=[],i=r=>r.getAttribute("role")==="menu";for(let r of e)r instanceof HTMLElement&&r.offsetParent!==null&&LP(this._el,r,i)&&n.push(r);return n}},XO=Object.defineProperty,ZO=Object.getOwnPropertyDescriptor,ru=(t,e,n,i)=>{for(var r=i>1?void 0:i?ZO(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&&XO(e,n,r),r},JO=0,Zi=class extends H{constructor(){super(),this._expanded=D(!1),this._disabled=D(!1),this._trigger=D(null),this._content=D(null),this._isTriggerDisabled=D(!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=Mr(()=>{let n=C(this._content);if(!n||N)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(()=>{lt(n,"--menu-height",i+"px")})});let{showDelay:e}=this.$props;this._popper=new Nh({_trigger:this._trigger,_content:this._content,_showDelay:e,_listen:(n,i,r)=>{Nr(n,a=>{this._expanded()?r(a):i(a)});let s=this._getCloseTarget();s&&Nr(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=le();let e=++JO;this._menuId=`media-menu-${e}`,this._menuButtonId=`media-menu-button-${e}`,this._focus=new gw({_getScrollContainer:this._findScrollContainer.bind(this),_closeMenu:this.close.bind(this)}),Tn(ct)&&(this._parentMenu=Ae(ct)),this.setAttributes({"data-open":this._expanded,"data-submenu":this.isSubmenu,"data-disabled":this._isDisabled.bind(this)}),Rt(ct,{_button:this._trigger,_expanded:this._expanded,_hint:D(""),_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&<(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=Gt(this._isDisabled.bind(this));ve(n,"tabindex",i?"-1":"0"),ve(n,"role",i?"menuitem":"button"),Z(n,"id",this._menuButtonId),Z(n,"aria-haspopup","menu"),Z(n,"aria-expanded","false"),Z(n,"data-submenu",this.isSubmenu),this.isSubmenu||this._stopClickPropagation(n);let s=()=>{Z(n,"data-open",this._expanded()),Z(n,"aria-disabled",r())};N?s():b(s),this._trigger.set(n),G(()=>{this._trigger.set(null)})}_attachMenuItems(e){let n=e.el;n.style.setProperty("display","none"),Z(n,"id",this._menuId),ve(n,"role","menu"),ve(n,"tabindex","-1"),Z(n,"data-submenu",this.isSubmenu),this._content.set(n),G(()=>this._content.set(null));let i=()=>Z(n,"data-open",this._expanded());if(N?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&&Z(n,"aria-hidden",Na(!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&&(Z(i,"aria-controls",e&&this._menuId),Z(i,"aria-expanded",Na(e))),r&&Z(r,"aria-labelledby",e&&this._menuButtonId),this._expanded.set(e),this._toggleMediaControls(n),Zn(),ji(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&&!ji(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&&LP(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";Z(n,"data-resizing",i)}}open(e){C(this._expanded)||(this._popper.show(e),Zn())}close(e){C(this._expanded)&&(this._popper.hide(e),Zn())}};Zi.props={showDelay:0};ru([ee],Zi.prototype,"triggerElement",1);ru([ee],Zi.prototype,"contentElement",1);ru([ee],Zi.prototype,"isSubmenu",1);ru([Ne],Zi.prototype,"open",1);ru([Ne],Zi.prototype,"close",1);e3=Object.defineProperty,t3=Object.getOwnPropertyDescriptor,n3=(t,e,n,i)=>{for(var r=i>1?void 0:i?t3(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&&e3(e,n,r),r},Ts=class extends H{get expanded(){return this._menu?._expanded()??!1}constructor(){super(),new pn}onSetup(){this._menu=Ae(ct)}onAttach(e){this._menu._attachMenuButton(this),b(this._watchDisabled.bind(this)),ve(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)}),Nr(e,i=>{this.dispatch("select",{trigger:i})})}_watchDisabled(){this._menu._disableMenuButton(this.$props.disabled())}};Ts.props={disabled:!1};n3([ee],Ts.prototype,"expanded",1);Yh=class extends Ts{},Qh=class extends H{constructor(){super(...arguments),this._target=null}onSetup(){this._media=le(),Rt(dc,{_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,yh(()=>{yh(()=>{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;Z(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}};Qh.props={container:null,disabled:!1};dc=mi(),bc=class extends H{constructor(){super(),new pn;let{placement:e}=this.$props;this.setAttributes({"data-placement":e})}onAttach(e){if(this._menu=Ae(ct),this._menu._attachMenuItems(this),Tn(dc)){let n=Ae(dc);n&&(Rt(dc,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 IP(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()}};bc.props={placement:null,offset:0,alignOffset:0};vw=mi(),Dr=class extends Mt{constructor(){super(...arguments),this._group=new Set,this._value=D(""),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(){Rt(vw,{add:this._addRadio.bind(this),remove:this._removeRadio.bind(this)})}onAttach(e){Tn(ct)||ve(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}},i3=Object.defineProperty,r3=Object.getOwnPropertyDescriptor,QP=(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},Xa=class extends H{get values(){return this._controller._values}get value(){return this._controller.value}set value(e){this._controller.value=e}constructor(){super(),this._controller=new Dr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){N?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)}};Xa.props={value:""};QP([ee],Xa.prototype,"values",1);QP([ee],Xa.prototype,"value",1);s3=Object.defineProperty,a3=Object.getOwnPropertyDescriptor,o3=(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&&s3(e,n,r),r},Za=class extends H{constructor(){super(),this._checked=D(!1),this._controller={_value:this.$props.value,_check:this._check.bind(this),_onCheck:null},new pn}get checked(){return this._checked()}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this._checked,"aria-checked":Gt(this._checked)})}onAttach(e){let n=Tn(ct);ve(e,"tabindex",n?"-1":"0"),ve(e,"role",n?"menuitemradio":"radio"),b(this._watchValue.bind(this))}onConnect(e){this._addToGroup(),Nr(e,this._onPress.bind(this)),G(this._onDisconnect.bind(this))}_onDisconnect(){et(()=>{Ae(vw).remove(this._controller)},this.connectScope)}_addToGroup(){Ae(vw).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})}};Za.props={value:""};o3([ee],Za.prototype,"checked",1);l3=Object.defineProperty,c3=Object.getOwnPropertyDescriptor,Lw=(t,e,n,i)=>{for(var r=i>1?void 0:i?c3(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&&l3(e,n,r),r},Ss=class extends H{constructor(){super(),this._index=D(0),this._track=D(null),this._cues=D([]),this._controller=new Dr,this._controller._onValueChange=this._onValueChange.bind(this)}get value(){return this._controller.value}get disabled(){return!this._cues()?.length}onSetup(){this._media=le(),Tn(ct)&&(this._menu=Ae(ct));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:Vr(Math.max(0,s.startTime-i),!1),duration:yc(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)),eo(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=>gh(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&<(u,"--progress",At(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}))}};Ss.props={thumbnails:null};Lw([ee],Ss.prototype,"value",1);Lw([ee],Ss.prototype,"disabled",1);Lw([Ne],Ss.prototype,"getOptions",1);u3=Object.defineProperty,d3=Object.getOwnPropertyDescriptor,Iw=(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&&u3(e,n,r),r},Ps=class extends H{get value(){return this._controller.value}get disabled(){let{audioTracks:e}=this._media.$state;return e().length===0}constructor(){super(),this._controller=new Dr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=le(),Tn(ct)&&(this._menu=Ae(ct))}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})}}};Ps.props={emptyLabel:"Default"};Iw([ee],Ps.prototype,"value",1);Iw([ee],Ps.prototype,"disabled",1);Iw([Ne],Ps.prototype,"getOptions",1);p3=Object.defineProperty,h3=Object.getOwnPropertyDescriptor,Aw=(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},Cs=class extends H{get value(){return this._controller.value}get disabled(){let{hasCaptions:e}=this._media.$state;return!e()}constructor(){super(),this._controller=new Dr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=le(),Tn(ct)&&(this._menu=Ae(ct))}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()}};Cs.props={offLabel:"Off"};Aw([ee],Cs.prototype,"value",1);Aw([ee],Cs.prototype,"disabled",1);Aw([Ne],Cs.prototype,"getOptions",1);f3=Object.defineProperty,m3=Object.getOwnPropertyDescriptor,Nw=(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&&f3(e,n,r),r},$s=class extends H{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 Dr,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=le(),Tn(ct)&&(this._menu=Ae(ct))}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})}};$s.props={normalLabel:"Normal",rates:[.25,.5,.75,1,1.25,1.5,1.75,2]};Nw([ee],$s.prototype,"value",1);Nw([ee],$s.prototype,"disabled",1);Nw([Ne],$s.prototype,"getOptions",1);g3=Object.defineProperty,v3=Object.getOwnPropertyDescriptor,Dw=(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&&g3(e,n,r),r},Ms=class extends H{constructor(){super(),this._sortedQualities=hi(()=>{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 Dr,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=le(),Tn(ct)&&(this._menu=Ae(ct))}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?`${At(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}};Ms.props={autoLabel:"Auto",hideBitrate:!1};Dw([ee],Ms.prototype,"value",1);Dw([ee],Ms.prototype,"disabled",1);Dw([Ne],Ms.prototype,"getOptions",1);Xh=class extends H{constructor(){super(...arguments),this._provider=null,this._presses=0,this._pressTimerId=-1}onSetup(){this._media=le();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()||Wl(e)&&(e.button!==0||this._media.activeMenu)||Ia(e)&&this._media.activeMenu||Sw(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(Wl(e)||Qy(e)||Ia(e)){let n=Ia(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 j("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[Np(r)](n),this.dispatch("trigger",{detail:e,trigger:n})}};Xh.props={disabled:!1,event:void 0,action:void 0};yw=class{constructor(e){this._renderer=e,this.priority=10,this._track=null,this._disposal=Yl()}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]})}},Zh=class extends H{onSetup(){this._media=le(),this.setAttributes({"aria-hidden":Gt(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(()=>(rc(),ic)).then(n=>{this.connectScope&&et(()=>{this._lib=n;let{CaptionsRenderer:i}=this._lib;this._renderer=new i(e),this._textRenderer=new yw(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()}};Zh.props={textDir:"ltr"};xc=class extends H{onSetup(){this._media=le(),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!fi(e())}_onPreconnect(){let{canLoadPoster:e,poster:n}=this._media.$state;!e()&&n()&&Jn(n(),"preconnect")}_watchHidden(){let{src:e}=this.$props,{$iosControls:n}=this._media,{poster:i}=this._media.$state;this.el&&Z(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)}};xc.props={src:null,alt:null,crossOrigin:null};xc.state=new Xn({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});kc=class extends H{constructor(){super(...arguments),this._invert=D(null)}onSetup(){this._media=le(),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}Nr(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=Vr(l,n(),i(),r());this.$state.timeText.set((o?"-":"")+c)}_watchRole(){if(!this.el)return;let{toggle:e}=this.$props;Z(this.el,"role",e()?"timer":null),Z(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)}};kc.props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1};kc.state=new Xn({timeText:""});y3=mi(),_3={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]},_w=class extends H{onSetup(){this._media=le(),Rt(y3,{...this.$props,previewTime:D(0)})}};_w.props=_3;Rs=class extends $O{},Jh=class extends Ka{},Ec=class extends Ih{},Tc=class extends Ah{},ef=class extends gc{},Sc=class extends Uh{},Pc=class extends jh{},Cc=class extends Wh{},$c=class extends qh{},Mc=class extends Hh{},Rc=class extends zh{},Lc=class extends Vh{},Ic=class extends Fh{},Ac=class extends Bh{},Nc=class extends Dh{},Dc=class extends Oh{},Oc=class extends mc{},Vc=class extends Qi{},Fc=class extends Qa{},zc=class extends wc{},Uc=class extends Gh{},jc=class extends Ya{},qc=class extends Es{},Hc=class extends _c{},Bc=class extends Xi{},Wc=class extends Zi{},Kc=class extends Ts{},Gc=class extends bc{},Yc=class extends Yh{},Qc=class extends Xa{},Xc=class extends Za{},Zc=class extends Zh{},Jc=class extends Xh{},tf=class extends xc{},Ja=class extends Ga{},eu=class extends kc{},XP=ke.forwardRef((t,e)=>{let{children:n,...i}=t,r=ke.Children.toArray(n),s=r.find(b3);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(ww,{...i,ref:e},ke.isValidElement(a)?ke.cloneElement(a,void 0,o):null)}return ke.createElement(ww,{...i,ref:e},n)});XP.displayName="Slot";ww=ke.forwardRef((t,e)=>{let{children:n,...i}=t;return ke.isValidElement(n)?ke.cloneElement(n,{...x3(i,n.props),ref:e?re(e,n.ref):n.ref}):ke.Children.count(n)>1?ke.Children.only(null):null});ww.displayName="SlotClone";w3=({children:t})=>ke.createElement(ke.Fragment,null,t);k3=["button","div","span","img","video","audio"],U=k3.reduce((t,e)=>{let n=ke.forwardRef((i,r)=>{let{asChild:s,...a}=i;return ke.createElement(s?XP:e,{...a,ref:r})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});pP=Rs.state.record,E3=Object.keys(pP).reduce((t,e)=>({...t,[e](){return pP[e]}}),{})});var m1={};xt(m1,{default:()=>$V});var $V,g1=Ue(()=>{"use strict";"use client";$V='<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 _C=dt((V8,yC)=>{"use strict";var mF={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"}};yC.exports=mF});var eb=dt((F8,EC)=>{"use strict";var pu=_C(),wC={},Mf={},bC=[],xC=[],kC=[];for(let t in pu){let{name:e,nativeName:n}=pu[t];wC[t]=Mf[e.toLowerCase()]=Mf[n.toLowerCase()]={code:t,name:e,nativeName:n},bC.push(t),xC.push(e),kC.push(n)}EC.exports=class $f{static getLanguages(e=[]){return e.map(n=>$f.validate(n)?Object.assign({},wC[n]):{code:n,name:"",nativeName:""})}static getName(e){return $f.validate(e)?pu[e].name:""}static getAllNames(){return xC.slice()}static getNativeName(e){return $f.validate(e)?pu[e].nativeName:""}static getAllNativeNames(){return kC.slice()}static getCode(e){return e=e.toLowerCase(),Mf.hasOwnProperty(e)?Mf[e].code:""}static getAllCodes(){return bC.slice()}static validate(e){return pu.hasOwnProperty(e)}}});var _$=dt(Qf=>{"use strict";var y5=z(),_5=Symbol.for("react.element"),w5=Symbol.for("react.fragment"),b5=Object.prototype.hasOwnProperty,x5=y5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,k5={key:!0,ref:!0,__self:!0,__source:!0};function y$(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)b5.call(e,i)&&!k5.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:_5,type:t,key:s,ref:a,props:r,_owner:x5.current}}Qf.Fragment=w5;Qf.jsx=y$;Qf.jsxs=y$});var ae=dt((jq,w$)=>{"use strict";w$.exports=_$()});var Rm=dt(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});function mR(t,e){if(e)return t;throw new Error("Unhandled discriminated union member: "+JSON.stringify(t))}Mm.assertNever=mR;Mm.default=mR});var E6={};xt(E6,{default:()=>eg});module.exports=SL(E6);var xx=require("obsidian");function ig(t,e){let n={};for(let i of e)i in t&&(n[i]=t[i]);return n}function Ku(t,e){let n={...t};for(let i of e)delete n[i];return n}var rg={bilibili:"https://www.bilibili.com",youtube:"https://www.youtube.com",vimeo:"https://www.vimeo.com",coursera:"https://www.coursera.org"},Gu={bilibili:"bilibili",youtube:"YouTube",generic:"Website",vimeo:"Vimeo",coursera:"Coursera"},bx=t=>Ku(t,["generic"]);var PL={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(PL).forEach(([t,e])=>{e&&(0,xx.addIcon)(t,e)});var tg=require("obsidian");function qo(t){return zn(t).href}function zn(t){let e=new URL(t);return e.hash="",e}function Un(t){try{return new URL(t)}catch{return null}}var je=require("obsidian");function Gs(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 kx="mx-port";var ai=t=>`persist:mx-player-${t}`;var Ex=require("obsidian");function sg(t){return require("@electron/remote").session.fromPartition(ai(t))}function Tx(){return Ex.Platform.isDesktopApp?require("fs/promises"):null}function Sx(t){return require("@electron/remote").webContents.fromId(t)}function Yu(){return require("@electron/remote").dialog}var Ys=class extends je.Modal{constructor(n){super(n);w(this,"navEl",this.contentEl.insertAdjacentElement("beforebegin",createDiv({cls:"mx-login-nav"})));w(this,"webview",createEl("webview",{attr:{partition:this.partition,allowpopups:""}}));w(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)}}));w(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)}}));w(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)}}));w(this,"addressBarForm",this.navEl.createEl("form"));w(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")}));w(this,"addressSubmit",new je.ButtonComponent(this.addressBarForm).setIcon("arrow-right-circle").then(n=>n.buttonEl.type="submit"));w(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),Gs(n,i)}));w(this,"callbacks",[]);w(this,"handledWebcontents",new Set);this.containerEl.addClasses(["mx-login-modal"]),this.titleEl.style.display="none",this.buildWelcome()}get partition(){return ai(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({...bx(Gu),".":"supported websites..."}).setValue(".").onChange(s=>{s in rg&&this.setUrl(rg[s])})}getSession(){return sg(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),Sx(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 Px(){this.addCommand({id:"login",name:"Login website",callback:()=>{new Ys(this.app).open()}})}var DM=require("obsidian");var Iu=require("obsidian");var Qu=require("obsidian"),Qs=class t extends Qu.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 Qu.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 ar=[.25,.5,.75,1,1.25,1.5,2,3,5,10];function Cx(t,e){let n=e.state.playbackRate,i=!ar.includes(n),r=t.setTitle(CL(n)).setIcon("gauge").setSection("mx-player").setSubmenu();ar.forEach(s=>r.addItem(a=>a.setTitle(`${s}x`).setChecked(s===n).onClick(()=>{e.playbackRate=s}))),r.addItem(s=>s.setTitle($L(n)).setChecked(i).onClick(async()=>{let a=await Qs.run();a&&(e.playbackRate=a)}))}function CL(t){let e=new DocumentFragment;return e.appendText("Speed "),e.createEl("code",{text:`(${t}x)`}),e}function $L(t){let e=new DocumentFragment;return e.appendText("Custom"),ar.includes(t)?e.appendText("..."):(e.appendText(" "),e.createEl("code",{text:`(${t}x)`})),e}var IM=require("obsidian");var ko=require("obsidian");var $x=require("obsidian");var kt={video:["mp4","webm","ogv","mov","mkv"],audio:["mp3","wav","m4a","3gp","flac","ogg","oga","opus"]};function Xt(t){t=t.replace(/^\./,"").toLowerCase();for(let e of Object.keys(kt))if(kt[e].includes(t))return e;return null}var nz=[...kt.video,...kt.audio];function $i(t){return t.file instanceof $x.TFile}var pt={video:"mx-url-video",audio:"mx-url-audio"},ML=new Set(Object.values(pt));function RL(t){return ML.has(t)}var Mi="mx-embed",Zt="mx-webpage",jn={video:"mx-file-video",audio:"mx-file-audio"},LL=new Set(Object.values(jn));function IL(t){return LL.has(t)}function AL(t){return RL(t)||Mi===t||Zt===t}function ag(t){return IL(t)||AL(t)}var mm=require("obsidian"),EM=$(Ol());var ti=$(z());var uT={},cT=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:()=>{(uT.env?uT.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?cT(t):cT;var bT=$(z(),1),xT=$(yT(),1),wT={},{useDebugValue:fN}=bT.default,{useSyncExternalStoreWithSelector:mN}=xT.default,_T=!1,gN=t=>t;function Py(t,e=gN,n){(wT.env?wT.env.MODE:void 0)!=="production"&&n&&!_T&&(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"),_T=!0);let i=mN(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return fN(i),i}var Vl={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.:]+)$/},kn=({start:t,end:e})=>t>=0&&e<0;function Cr(t){if(!t)return null;let n=new URLSearchParams(t.replace(/^#+/,"")).get("t");if(!n)return null;let i=n.match(Vl.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=bp(n),s=i==="e"?1/0:bp(i);else if(n)r=bp(n),s=-1;else if(i)r=-1,s=bp(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 bp(t){let e=t.match(Vl.npt_time);if(!e)return null;let n=e[1],i=n.match(Vl.npt_sec);if(i)return Number(i[0]);let r=n.match(Vl.npt_mmss);if(r){let{mm:a,ss:o}=r.groups;return Number(a)*60+Number(o)}let s=n.match(Vl.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 xp(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:yN(e.get("vol")),tempFragment:Cr(t)}}function yN(t){if(!t)return;let e=parseInt(t,10);if(!isNaN(e)&&e>=0&&e<=100)return e/100}var kT=()=>({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 kp(){let t=kT();return t.once=function(n,i){let r=this.on(n,(...s)=>{r(),i(...s)});return r},t}function ET(t){let e=t;return typeof e.id=="string"&&typeof e.invoke=="string"}function TT(t,...e){return{id:_N(),invoke:t,args:e}}function ST(t){return typeof t.id=="string"}function PT(t){return typeof t.send=="string"}function CT(t,e){return{send:t,payload:e}}function _N(){return Math.random().toString(36).substring(2,9)}var Ep=class extends Error{constructor(e){super(`no handler for ${e}`)}},Cy="mx-port-ready";var Tp=class{constructor(){w(this,"port",null);w(this,"actions",Object.create(null));w(this,"emitter",kp());w(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(Cy)}unload(){this.port?.close(),this.emitter.events={}}onMessage(e){e===Cy?this.emitter.emit("ready"):ET(e)?this.response(e):ST(e)?this.emitter.emit("resp",e.id,e.payload,e.error):PT(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=TT(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 Ui(r))},r))})}handle(e,n){this.actions[e]=n}send(e,n,i){if(!this.port)throw new Error("port not loaded");let r=CT(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 Ep(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)}}},Ui=class extends Error{constructor(e){super(`timeout after ${e}ms`)}};var wN=()=>{},Fl=wN;Lt();Lt();Wt();Wt();var V=$(z(),1);var E=$(z(),1);Lt();Wt();var e1=$(Dl(),1);function wi(){return Vp(tu)}var T3=X(Lc,{domEventsRegex:/^onMedia/}),t1=E.forwardRef(({children:t,...e},n)=>E.createElement(T3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));t1.displayName="AirPlayButton";var S3=X(Rc,{domEventsRegex:/^onMedia/}),lf=E.forwardRef(({children:t,...e},n)=>E.createElement(S3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));lf.displayName="PlayButton";var P3=X(Sc,{domEventsRegex:/^onMedia/}),Ow=E.forwardRef(({children:t,...e},n)=>E.createElement(P3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));Ow.displayName="CaptionButton";var C3=X(Pc,{domEventsRegex:/^onMedia/}),cf=E.forwardRef(({children:t,...e},n)=>E.createElement(C3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));cf.displayName="FullscreenButton";var $3=X($c,{domEventsRegex:/^onMedia/}),uf=E.forwardRef(({children:t,...e},n)=>E.createElement($3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));uf.displayName="MuteButton";var M3=X(Mc,{domEventsRegex:/^onMedia/}),Vw=E.forwardRef(({children:t,...e},n)=>E.createElement(M3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));Vw.displayName="PIPButton";var R3=X(Ac,{domEventsRegex:/^onMedia/}),su=E.forwardRef(({children:t,...e},n)=>E.createElement(R3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));su.displayName="SeekButton";var L3=X(Cc,{domEventsRegex:/^onMedia/}),n1=E.forwardRef(({children:t,...e},n)=>E.createElement(L3,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));n1.displayName="LiveButton";var Fw=X(jc),I3=X(Vc,{events:["onDragStart","onDragEnd","onDragValueChange","onValueChange","onPointerValueChange"]}),A3=E.forwardRef(({children:t,...e},n)=>E.createElement(I3,{...e,ref:n},i=>E.createElement(U.div,{...i},t)));A3.displayName="Slider";var N3=E.forwardRef((t,e)=>E.createElement(U.div,{...t,ref:e}));N3.displayName="SliderThumb";var D3=E.forwardRef((t,e)=>E.createElement(U.div,{...t,ref:e}));D3.displayName="SliderTrack";var O3=E.forwardRef((t,e)=>E.createElement(U.div,{...t,ref:e}));O3.displayName="SliderTrackFill";var V3=X(Hc),F3=E.forwardRef(({children:t,...e},n)=>E.createElement(V3,{...e},i=>E.createElement(U.div,{...i,ref:re(i.ref,n)},t)));F3.displayName="SliderPreview";var z3=E.forwardRef(({children:t,...e},n)=>E.createElement(Fw,{...e},(i,r)=>{let s=pe(()=>r.getValueText(),r);return E.createElement(U.div,{...i,ref:n},s,t)}));z3.displayName="SliderValue";var U3=X(zc,{domEventsRegex:/^onMedia/}),j3=E.forwardRef(({children:t,...e},n)=>E.createElement(U3,{...e,ref:n},i=>E.createElement(U.div,{...i},t)));j3.displayName="VolumeSlider";var q3=E.forwardRef(({children:t,...e},n)=>E.createElement(Fw,{...e},(i,r)=>{let s=pe(()=>r.getValueText(),r);return E.createElement(U.div,{...i,ref:re(i.ref,n)},s,t)}));q3.displayName="SliderValue";function H3(t=0,e=0,n=""){return N?{startTime:t,endTime:e,text:n,addEventListener:Ht,removeEventListener:Ht,dispatchEvent:Ht}:new window.VTTCue(t,e,n)}var B3=X(Ja),i1=E.forwardRef(({children:t,...e},n)=>E.createElement(B3,{...e},i=>E.createElement(U.div,{...i,ref:re(i.ref,n)},t)));i1.displayName="Thumbnail";var r1=E.forwardRef(({children:t,...e},n)=>{let{src:i,img:r,crossOrigin:s}=$r(Ja.state),a=pe(i),o=pe(s);return E.createElement(U.img,{crossOrigin:o,...e,src:a,ref:re(r.set,n)},t)});r1.displayName="ThumbnailImg";var df=Object.freeze({__proto__:null,Img:r1,Root:i1}),pf=E.createContext({$chapters:D(null)});pf.displayName="TimeSliderContext";var W3=X(Fc,{domEventsRegex:/^onMedia/}),K3=E.forwardRef(({children:t,...e},n)=>{let i=E.useMemo(()=>D(null),[]);return E.createElement(pf.Provider,{value:{$chapters:i}},E.createElement(W3,{...e,ref:n},r=>E.createElement(U.div,{...r},t)))});K3.displayName="TimeSlider";var G3=X(Bc),Y3=E.forwardRef(({children:t,...e},n)=>E.createElement(G3,{...e},(i,r)=>E.createElement(U.div,{...i,ref:re(i.ref,n)},E.createElement(s1,{instance:r},t))));Y3.displayName="SliderChapters";function s1({instance:t,children:e}){let n=pe(()=>t.cues,t),i=E.useRef([]),r=E.useRef(),{$chapters:s}=E.useContext(pf);return r.current||(r.current=H3()),E.useEffect(()=>(s.set(t),()=>void s.set(null)),[t]),E.useEffect(()=>{t.setRefs(i.current)},[n]),e(n.length?n:[r.current],a=>{if(!a){i.current.length=0;return}i.current.push(a)})}s1.displayName="SliderChapterTracks";var Q3=E.forwardRef(({children:t,...e},n)=>{let{$chapters:i}=E.useContext(pf),[r,s]=E.useState();return E.useEffect(()=>b(()=>{let a=i(),o=a?.activePointerCue||a?.activeCue;s(o?.text||"")}),[]),E.createElement(U.div,{...e,ref:n},r,t)});Q3.displayName="SliderChapterTitle";var X3=E.forwardRef(({children:t,...e},n)=>E.createElement(Fw,{...e},(i,r)=>{let s=pe(()=>r.getValueText(),r);return E.createElement(U.div,{...i,ref:re(i.ref,n)},s,t)}));X3.displayName="SliderValue";var Z3=E.forwardRef((t,e)=>E.createElement(U.div,{...t,ref:e}));Z3.displayName="SliderProgress";var J3=X(Uc),eV=E.forwardRef(({children:t,...e},n)=>E.createElement(J3,{...e},i=>E.createElement(U.div,{...i,ref:re(i.ref,n)},t)));eV.displayName="SliderThumbnail";var tV=X(qc,{events:["onCanPlay","onError"]}),nV=E.forwardRef(({children:t,...e},n)=>E.createElement(tV,{...e},(i,r)=>E.createElement(a1,{...i,instance:r,ref:re(i.ref,n)},t)));nV.displayName="SliderVideo";var a1=E.forwardRef(({instance:t,children:e,...n},i)=>{let{canLoad:r}=$r(Ls),{src:s,video:a,crossOrigin:o}=t.$state,l=pe(s),c=pe(r),u=pe(o);return E.createElement(U.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)});a1.displayName="SliderVideoProvider";var iV=X(Qc,{events:["onChange"]}),rV=E.forwardRef(({children:t,...e},n)=>E.createElement(iV,{...e,ref:n},i=>E.createElement(U.div,{...i},t)));rV.displayName="RadioGroup";var sV=X(Xc,{events:["onChange","onSelect"]}),aV=E.forwardRef(({children:t,...e},n)=>E.createElement(sV,{...e},i=>E.createElement(U.div,{...i,ref:re(i.ref,n)},t)));aV.displayName="RadioItem";var oV=typeof document>"u",lV=X(Wc,{events:["onOpen","onClose"],domEventsRegex:/^onMedia/}),cV=E.forwardRef(({children:t,...e},n)=>E.createElement(lV,{...e,ref:n},(i,r)=>E.createElement(U.div,{...i,style:{display:r.isSubmenu?void 0:"contents",...i.style}},t)));cV.displayName="Menu";var uV=X(Kc,{events:["onSelect"]}),dV=E.forwardRef(({children:t,...e},n)=>E.createElement(uV,{...e},i=>E.createElement(U.button,{...i,ref:re(i.ref,n)},t)));dV.displayName="MenuButton";var pV=E.forwardRef(({disabled:t=!1,children:e,...n},i)=>{let r=ye("fullscreen");return oV||!(t==="fullscreen"?!r:!t)?e:(0,e1.createPortal)(E.createElement(U.div,{...n,style:{display:"contents",...n.style},ref:i},e),document.body)});pV.displayName="MenuPortal";var hV=X(Gc),fV=E.forwardRef(({children:t,...e},n)=>E.createElement(hV,{...e},i=>E.createElement(U.div,{...i,ref:re(i.ref,n)},t)));fV.displayName="MenuItems";var mV=X(Yc),gV=E.forwardRef(({children:t,...e},n)=>E.createElement(mV,{...e},i=>E.createElement(U.div,{...i,ref:re(i.ref,n)},t)));gV.displayName="MenuItem";var vV=X(Jc,{events:["onWillTrigger","onTrigger"]}),$n=E.forwardRef(({children:t,...e},n)=>E.createElement(vV,{...e,ref:n},i=>E.createElement(U.div,{...i},t)));$n.displayName="Gesture";var yV=X(eu),au=E.forwardRef(({children:t,...e},n)=>E.createElement(yV,{...e},(i,r)=>E.createElement(o1,{...i,instance:r,ref:re(i.ref,n)},t)));au.displayName="Time";var o1=E.forwardRef(({instance:t,children:e,...n},i)=>{let{timeText:r}=t.$state,s=pe(r);return E.createElement(U.div,{...n,ref:i},s,e)});o1.displayName="TimeText";function bi(){return wi()?.player||null}function zw({off:t=!0}={}){let e=wi(),{textTracks:n,textTrack:i}=e.$state,r=pe(n);return pe(i),E.useMemo(()=>{let s=r.filter(We),a=s.map(o=>({track:o,label:o.label,value:JP(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:F(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?JP(o):"off"}}),a},[r])}function JP(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}var hf=$(z(),1),Uw=hf.forwardRef((t,e)=>{let{width:n,height:i,size:r=null,paths:s,...a}=t;return hf.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}})});Uw.displayName="VidstackIcon";var te=$(z(),1);Lt();Wt();var _V=X(Ec),l1=te.forwardRef(({children:t,...e},n)=>te.createElement(_V,{...e},i=>te.createElement(U.div,{...i,ref:re(i.ref,n)},t)));l1.displayName="Controls";var wV=X(Tc),c1=te.forwardRef(({children:t,...e},n)=>te.createElement(wV,{...e},i=>te.createElement(U.div,{...i,ref:re(i.ref,n)},t)));c1.displayName="ControlsGroup";var er=Object.freeze({__proto__:null,Group:c1,Root:l1}),bV=X(Nc);function xV({children:t,...e}){return te.createElement(bV,{...e},t)}xV.displayName="Tooltip";var kV=X(Dc),EV=te.forwardRef(({children:t,...e},n)=>te.createElement(kV,{...e},i=>te.createElement(U.button,{...i,ref:re(i.ref,n)},t)));EV.displayName="TooltipTrigger";var TV=X(Oc),SV=te.forwardRef(({children:t,...e},n)=>te.createElement(TV,{...e},i=>te.createElement(U.div,{...i,ref:re(i.ref,n)},t)));SV.displayName="TooltipContent";var PV=X(Ic,{domEventsRegex:/^onMedia/}),u1=te.forwardRef(({children:t,...e},n)=>te.createElement(PV,{...e},i=>te.createElement(U.button,{...i,ref:re(i.ref,n)},t)));u1.displayName="GoogleCastButton";var d1=te.forwardRef(({children:t,...e},n)=>{let i=ye("title");return te.createElement(U.span,{...e,ref:n},i,t)});d1.displayName="Title";function p1(t){let[e,n]=te.useState([]);return te.useEffect(()=>{if(!t){n([]);return}function i(){n(t.activeCues)}return i(),S(t,"cue-change",i)},[t]),e}function h1(t){let e=wi(),[n,i]=te.useState(null);return te.useEffect(()=>eo(e.textTracks,t,i),[t]),n}function ff(){let t=h1("chapters");return p1(t)[0]?.text||""}var f1=te.forwardRef(({children:t,...e},n)=>{let i=ff();return te.createElement(U.span,{...e,ref:n},i,t)});f1.displayName="ChapterTitle";var CV=X(Zc),mf=te.forwardRef(({children:t,...e},n)=>te.createElement(CV,{...e,ref:n},i=>te.createElement(U.div,{...i},t)));mf.displayName="Captions";var VU=te.forwardRef(({size:t=96,children:e,...n},i)=>te.createElement("svg",{width:t,height:t,fill:"none",viewBox:"0 0 120 120","aria-hidden":"true","data-part":"root",...n,ref:i},e)),FU=te.forwardRef(({width:t=8,children:e,...n},i)=>te.createElement("circle",{cx:"60",cy:"60",r:"54",stroke:"currentColor",strokeWidth:t,"data-part":"track",...n,ref:i},e)),zU=te.forwardRef(({width:t=8,fillPercent:e=50,children:n,...i},r)=>te.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 gf=$(z(),1);Wt();function vf(t){let e=wi(),n=gf.useRef();return n.current||(n.current=new Ba),gf.useEffect(()=>{let i=t&&"current"in t?t.current:t,r=i instanceof Rs,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 _j=$(Dl(),1);var MV=["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"],RV=X(Rs,{events:MV,eventsRegex:/^onHls/,domEventsRegex:/^onMedia/}),jw=V.forwardRef(({aspectRatio:t,children:e,...n},i)=>V.createElement(RV,{...n,src:n.src,ref:i,style:{aspectRatio:t,...n.style}},r=>V.createElement(U.div,{...r},e)));jw.displayName="MediaPlayer";var LV=X(Jh),qw=V.forwardRef(({loaders:t=[],children:e,mediaProps:n,buildMediaEl:i,...r},s)=>{let a=V.useMemo(()=>t.map(o=>new o),t);return V.createElement(LV,{...r,loaders:a,ref:s},(o,l)=>V.createElement("div",{...o},V.createElement(v1,{...n,provider:l,buildMediaEl:i}),e))});qw.displayName="MediaProvider";function v1({provider:t,buildMediaEl:e,...n}){let{controls:i,crossOrigin:r,poster:s,remotePlaybackInfo:a}=$r(Ls),{loader:o}=t.$state,{$iosControls:l,$provider:c,$providerSetup:u}=wi(),d=pe(i),p=pe(l),h=d||p,y=pe(r),v=pe(s),_=pe(o),m=pe(c),f=pe(u),g=pe(a),x=_?.mediaType(),T=_?.name==="youtube",L=_?.name==="vimeo",R=T||L,I=_?.name==="remotion",K=_?.name==="google-cast",[q,_e]=V.useState("");return V.useEffect(()=>{!K||q||Promise.resolve().then(()=>(g1(),m1)).then(J=>{_e(J.default)})},[K]),K?V.createElement("div",{className:"vds-google-cast",ref:J=>{t.load(J)}},V.createElement(Uw,{paths:q}),g?.deviceName?V.createElement("span",{className:"vds-google-cast-info"},"Google Cast on"," ",V.createElement("span",{className:"vds-google-cast-device-name"},g.deviceName)):null):I?V.createElement("div",{"data-remotion-canvas":!0},V.createElement("div",{"data-remotion-container":!0,ref:J=>{t.load(J)}},ZP(m)&&f?V.createElement(m.render):null)):e?.(_,t)??(R?V.createElement(V.Fragment,null,V.createElement("iframe",{className:T?"vds-youtube":"vds-vimeo",suppressHydrationWarning:!0,tabIndex:h?void 0:-1,"aria-hidden":"true","data-no-controls":h?void 0:"",ref(J){t.load(J)}}),h?null:V.createElement("div",{className:"vds-blocker"})):x?V.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(J){t.load(J)}}):null)}v1.displayName="MediaOutlet";function IV(t){let e=wi(),n=V.useMemo(()=>new ln(t),Object.values(t));return V.useEffect(()=>(e.textTracks.add(n),()=>void e.textTracks.remove(n)),[n]),n}function Hw({lang:t,...e}){return IV({language:t,...e}),null}Hw.displayName="Track";var AV=X(ef),NV=V.forwardRef(({children:t,...e},n)=>V.createElement(AV,{...e},i=>V.createElement(U.button,{...i,ref:re(i.ref,n)},t)));NV.displayName="ToggleButton";var DV=X(tf),OV=V.forwardRef(({children:t,...e},n)=>V.createElement(DV,{...e},(i,r)=>V.createElement(y1,{...i,instance:r,ref:re(i.ref,n)},t)));OV.displayName="Poster";var y1=V.forwardRef(({instance:t,children:e,...n},i)=>{let{src:r,img:s,alt:a,crossOrigin:o}=t.$state,l=pe(r),c=pe(a),u=pe(o);return V.createElement(U.img,{...n,src:l||"",alt:c||void 0,crossOrigin:u||void 0,ref:re(s.set,i)},e)});y1.displayName="PosterImg";var VV=V.forwardRef(({children:t,...e},n)=>V.createElement(U.div,{translate:"yes","aria-live":"off","aria-atomic":"true",...e,ref:n},t));VV.displayName="Caption";var FV=V.forwardRef((t,e)=>{let n=ye("textTrack"),[i,r]=V.useState();return V.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]),V.createElement(U.span,{...t,"data-part":"cue",dangerouslySetInnerHTML:{__html:i?.text||""},ref:e})});FV.displayName="CaptionText";function _1(){let[t,e]=V.useState(null),n=wi();return V.useEffect(()=>{if(n)return b(()=>{e(n.$provider())})},[]),t}function w1({clamp:t=!1,offset:e=0,orientation:n="horizontal"}={}){let[i,r]=V.useState(null),[s,a]=V.useState(null),[o,l]=V.useState(0),[c,u]=V.useState(!1);return V.useEffect(()=>{if(!i)return;let d=D(!1);function p(h){i&&l(zV(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]),V.useEffect(()=>{s&&s.style.setProperty("--slider-pointer",o+"%")},[s,o]),V.useEffect(()=>{if(!s)return;let d=()=>{Rw(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 zV(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 UV(Math.max(0,Math.min(100,100*i)))}function UV(t){return Number(t.toFixed(3))}var b1='"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}},T=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 T,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;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 x(e){return e[0].toUpperCase()+e.slice(1)}function V(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${x(i)}`,()=>({value:V(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${x(i)}`,()=>({value:V(e[i])})),i==="currentTime"?t.handle(`set${x(i)}`,s=>{n.prevSeek={value:e.currentTime,time:Date.now()},e[i]=s}):t.handle(`set${x(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){Te(e,t)}}function _e(e,t,n){let r=$,i=E;$=e,E=n;try{return t.call(e)}finally{$=r,E=i}}function Te(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 xe=function(){this[g]=null,this.$ns=null,this.$ps=null,$&&$.append(this)},v=xe.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){xe.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){Te(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,Ve=Event,Se=Symbol("DOM_EVENT"),W=class extends Ve{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 We=[".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(We.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 tr=Symbol(0),_f=!1,x1=!1,Is=null,io=null,Mn=null,hn=0,no=[],Ww={},qV=()=>{},ro=0,P1=1,ou=2,bf=3;function HV(){_f=!0,queueMicrotask(BV)}function BV(){if(!no.length){_f=!1;return}x1=!0;for(let t=0;t<no.length;t++)no[t].$st!==ro&&WV(no[t]);no=[],_f=!1,x1=!1}function WV(t){let e=[t];for(;t=t[tr];)t.$e&&t.$st!==ro&&e.push(t);for(let n=e.length-1;n>=0;n--)Yw(e[n])}function C1(t){if(!t||!Is)return t||qV;let e=Is;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==bf&&(t.call(null),L1(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function Kw(t=!0){if(this.$st===bf)return;let e=t?this.$ps||this[tr]:this,n=this.$ns,i=null;for(;n&&n[tr]===this;)Kw.call(n,!0),k1(n),i=n.$ns,n.$ns=null,n=i;t&&k1(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function k1(t){t.$st=bf,t.$d&&$1(t),t.$s&&yf(t,0),t.$ps&&(t.$ps.$ns=null),t[tr]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=Ww,t.$eh=null}function $1(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){M1(t,e)}}function KV(t,e,n){let i=Is,r=io;Is=t,io=n;try{return e.call(t)}finally{Is=i,io=r}}function M1(t,e){if(!t||!t.$eh)throw e;let n=0,i=t.$eh.length,r=E1(e);for(n=0;n<i;n++)try{t.$eh[n](r);break}catch(s){r=E1(s)}if(n===i)throw r}function E1(t){return t instanceof Error?t:Error(JSON.stringify(t))}function GV(){return this.$st===bf?this.$v:(io&&!this.$e&&(!Mn&&io.$s&&io.$s[hn]==this?hn++:Mn?Mn.push(this):Mn=[this]),this.$c&&Yw(this),this.$v)}function YV(t){let e=L1(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++)I1(this.$o[n],ou);return this.$v}var R1=function(){this[tr]=null,this.$ns=null,this.$ps=null,Is&&Is.append(this)},As=R1.prototype;As.$cx=Ww;As.$eh=null;As.$c=null;As.$d=null;As.append=function(t){if(t[tr]=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===Ww?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};As.dispose=function(){Kw.call(this)};var QV=function(e,n,i){R1.call(this),this.$st=n?ou:ro,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)},Gw=QV.prototype;Object.setPrototypeOf(Gw,As);Gw.$ch=XV;Gw.call=GV;function XV(t,e){return t!==e}function L1(t){return typeof t=="function"}function Yw(t){if(t.$st===P1)for(let e=0;e<t.$s.length&&(Yw(t.$s[e]),t.$st!==ou);e++);t.$st===ou?ZV(t):t.$st=ro}function T1(t){t.$ns&&t.$ns[tr]===t&&Kw.call(t,!1),t.$d&&$1(t),t.$eh=t[tr]?t[tr].$eh:null}function ZV(t){let e=Mn,n=hn;Mn=null,hn=0;try{T1(t);let i=KV(t,t.$c,t);if(Mn){if(t.$s&&yf(t,hn),t.$s&&hn>0){t.$s.length=hn+Mn.length;for(let s=0;s<Mn.length;s++)t.$s[hn+s]=Mn[s]}else t.$s=Mn;let r;for(let s=hn;s<t.$s.length;s++)r=t.$s[s],r.$o?r.$o.push(t):r.$o=[t]}else t.$s&&hn<t.$s.length&&(yf(t,hn),t.$s.length=hn);!t.$e&&t.$i?YV.call(t,i):(t.$v=i,t.$i=!0)}catch(i){M1(t,i),t.$st===ou&&(T1(t),t.$s&&yf(t,0));return}Mn=e,hn=n,t.$st=ro}function I1(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===ro&&(no.push(t),_f||HV()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)I1(t.$o[n],P1)}function yf(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 A1(...t){}function lu(t){return typeof t=="string"}var S1,JV=Event,N1=Symbol("DOM_EVENT"),Bw=class extends JV{constructor(e,...n){super(e,n[0]),this[S1]=!0,this.triggers=new wf,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}};S1=N1;var wf=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),D1(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 D1(t){return!!t?.[N1]}function eF(){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 O1(){let t=eF();return C1(t.empty),t}var c7=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):A1;var Ds=require("obsidian");var V1=`"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 F1=`"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 z1=`"use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var y=(o,t)=>{for(var e in t)s(o,e,{get:t[e],enumerable:!0})},h=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!u.call(o,r)&&r!==e&&s(o,r,{get:()=>t[r],enumerable:!(n=m(t,r))||n.enumerable});return o};var b=o=>h(s({},"__esModule",{value:!0}),o);var M={};y(M,{default:()=>a});module.exports=b(M);var d=()=>require("media-extended");var g=\`
|
|
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(),v=\`
|
|
/* \\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:i,MediaPlugin:w}=d(),a=class extends w{findMedia(){return i("ytd-app #movie_player video")}getStyle(){return g+\`
|
|
\`+v}async onload(){await super.onload(),Promise.all([i(".video-ads.ytp-ad-module",this.app).then(t=>this.removePlayerAD(t)),this.disableAutoPlay()])}get app(){return this.media.closest("ytd-app")}get moviePlayer(){return this.media.closest("#movie_player")}async disableAutoPlay(){let e=await i('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(c=>{let l=new MutationObserver(()=>{r()||(l.disconnect(),c())});l.observe(n,{attributes:!0})}))}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(),E.call(e)}else n&&(t.currentTime=t.duration)}enterWebFullscreen(){this.assignParentClass(this.moviePlayer),(async()=>{let t=await i("#movie_player .ytp-size-button"),e=()=>!!this.app.querySelector("ytd-watch-flexy[theater]");if(!e())do t.click(),await f(200);while(!e());window.dispatchEvent(new Event("resize"))})()}};function f(o){return new Promise(t=>setTimeout(t,o))}function E(){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 U1={bilibili:V1,youtube:z1,vimeo:F1,coursera:void 0,generic:void 0};var j1={generic:t=>t,bilibili:t=>t.replaceAll(/[-_]哔哩哔哩.+$|[-_]bilibili.+$|-(?:番剧|电影|纪录片|国创|电视剧|综艺)-.+/g,""),youtube:t=>t.replace(/ - YouTube$/,""),vimeo:t=>t.replace(/ on Vimeo$/,""),coursera:t=>t.replace(/ \| Coursera$/,"")};var lC=require("url"),so=require("obsidian");var cu=require("obsidian");function xf(t){return t===0?"00:00:00":cu.moment.utc(cu.moment.duration({seconds:t}).as("milliseconds")).format("HH:mm:ss")}function B1(t){return t===0?"DT0S":cu.moment.duration(t,"seconds").toISOString()}var q1=(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 kf(t){return t.replace(/t=[^&]+/,"")}function W1(t,e){let n=Qw(e);return`${t}&${n}`}function K1(t,e){let n=Number.isNaN(t)?-1:t,i=Number.isNaN(e)?-1:e;return{start:n,end:i}}function Qw(t){let{start:e,end:n}=t,i={get start(){return H1(e)},get end(){return H1(n)}};return kn(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 H1(t){if(Number.isNaN(t)||t<0)throw new Error("durationInSecond must be positive");if(t===1/0)return"e";let e=cu.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=>q1(s))].join(":");if(i>0)return[i,r].map(s=>q1(s)).join(":");if(r>0)return r.toFixed(2);throw new Error("durationInSecond must be positive")}var G1=require("obsidian"),rF=G1.Platform.isWin?require("path/win32"):require("path/posix"),xi=rF;function ki(t){let e=new URL(t.href),n=kf(e.hash);return e.hash===n?t:e}function Y1(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 Q1=t=>Y1(t)===null?null:"bilibili",X1=t=>{let e=Y1(t);if(e===null)throw new Error("Invalid bilibili url");let n=Cr(t.hash),i=sF(t),r=zn(t);r.searchParams.forEach((a,o,l)=>{o==="p"&&a!=="1"||l.delete(o)}),r.searchParams.sort();let s=new URL(r);return!n&&i>0&&(n={start:i,end:-1}),n&&kn(n)&&s.searchParams.set("t",String(n.start)),{source:ki(s),cleaned:r,id:e||void 0}};function sF(t){let e=t.searchParams.get("t"),n=e?Number(e):NaN;return Number.isNaN(n)?NaN:n}var Z1=t=>t.hostname==="www.coursera.org"?"coursera":null,J1=t=>{let e=zn(t);e.search="";let n=new URL(t);return{cleaned:e,source:ki(n)}};var eC=require("obsidian");var tC=t=>({type:"generic",cleaned:zn(t),source:ki(t.protocol==="file:"?aF(t):t)});function aF(t){let e=new URL(eC.Platform.resourcePathPrefix+t.href.substring(8));return e.search=Date.now().toString(),e}var nC=t=>t.hostname!=="vimeo.com"||!t.pathname.substring(1).match(/^\d+$/)?null:"vimeo",iC=t=>{let e=t.pathname.substring(1);if(!e.match(/^\d+$/))throw new Error("Invalid vimeo url");let n=zn(t);n.search="";let i=new URL(t);return{cleaned:n,source:ki(i),id:e}};function sC(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 aC=t=>sC(t)?"youtube":null,oC=t=>{let e=Cr(t.hash),n=Xw(t.searchParams.get("t")),i=Xw(t.searchParams.get("start")),r=Xw(t.searchParams.get("end")),s=sC(t);if(!s)throw new Error("Invalid youtube url");let a=zn("https://www.youtube.com/watch");a.search=new URLSearchParams({v:s}).toString();let o=new URL(a);if(t.searchParams.has("list")&&o.searchParams.set("list",t.searchParams.get("list")),e||(i>0&&r>0?e=K1(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){let l=rC(e.start),c=rC(e.end);kn(e)||e.start>0&&e.end>0&&l===c?o.searchParams.set("t",l):(e.start>0&&o.searchParams.set("start",l),e.end>0&&o.searchParams.set("end",c))}return{source:ki(o),cleaned:a,id:s}};function rC(t){return t.toFixed(0)}function Xw(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 oF=new Set(["https:","http:","file:"]),Ns,uu=class uu extends URL{constructor(n,i){super(n);O(this,Ns,void 0);w(this,"type");w(this,"mxUrl");if(this.mxUrl=i?new URL(i):null,!oF.has(this.protocol))throw new Error("Unsupported protocol: "+this.protocol);this.type=lF.reduce((r,s)=>r??s(this),null)??"generic",we(this,Ns,cF[this.type](this))}static create(n,i){if(n instanceof uu)return n.clone();try{return new uu(n,i)}catch{return null}}get inferredType(){let n=this.pathname.split(".").pop();return n?Xt(n):null}get isFileUrl(){return this.protocol==="file:"}get filePath(){if(this.isFileUrl)try{return(0,lC.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 so.FileSystemAdapter))return!1;let i=this.filePath,r=n.adapter.getBasePath();if(!i)return!1;let s=xi.relative(r,i);if(!s||s.startsWith(".."))return!1;let a=(0,so.normalizePath)(s);return n.getAbstractFileByPath(a)}compare(n){return!!n&&this.jsonState.source===n.jsonState.source}get tempFrag(){return Cr(this.hash)}setTempFrag(n){let i=this.clone(),r=kf(this.hash);return n?i.hash=W1(r,n):i.hash=r,i}clone(){return new uu(this,this.mxUrl??void 0)}get source(){return k(this,Ns).source}get cleaned(){return k(this,Ns).cleaned}get id(){return k(this,Ns).id}get jsonState(){return{source:qo(this.mxUrl??this.cleaned)}}};Ns=new WeakMap;var _t=uu,lF=[Q1,aC,nC,Z1],cF={bilibili:X1,youtube:oC,vimeo:iC,coursera:J1,generic:tC};function cC(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 uC(t,e){if(Xt(t.extension)===null)throw new Error(`Unknown media type ${t.extension}`);let n=e.getResourcePath(t);return new _t("file:///"+n.substring(so.Platform.resourcePathPrefix.length))}function dC(t){return`webpage::${btoa(t)}`}function pC(t){return atob(t.replace(/^webpage::/,""))}function hC(t){return t.startsWith("webpage::")}function fC(t){return t.type==="TimeRanges"}var Ef=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 ei(t){return fC(t)?new Ef(t.value):t}var{onDispose:Zw,peek:uF}=ys,Tf=class{constructor(e,n){this._provider=e;this._ctx=n;w(this,"_disposal",O1());w(this,"_waiting",!1);w(this,"_attachedLoadStart",!1);w(this,"_attachedCanPlay",!1);w(this,"_handlers");w(this,"_handleDevEvent");this._attachInitialListeners(),Zw(this._media.on("timeupdate",this._onTimeUpdate.bind(this))),Zw(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 Zw(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:uF(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=ei(n.buffered),r=ei(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=ei(n.buffered),r=ei(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=ei(n.played);this._updateCurrentTime(n.duration,i,e),this._notify("end",void 0,new Event(e.type))}_onTimeUpdate(e){let{payload:n}=e,i=ei(n.played);this._updateCurrentTime(n.current,i,e)}_onDurationChange(e){let{payload:n}=e,i=ei(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=ei(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:ei(n.buffered),seekable:ei(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 mC(t,e){return await e.executeJavaScript(`(async function(){${t}})()`)}var{onDispose:gC}=ys,du,Sf=class{constructor(e,n,i){this._video=e;this._media=n;this.userGesture=i;O(this,du,!1);w(this,"_onChange",(e,n)=>{this._media.delegate._notify("picture-in-picture-change",e,n)});gC(e.on("enterpictureinpicture",r=>this._onChange(!0,new Event(r.type)))),gC(e.on("leavepictureinpicture",r=>this._onChange(!1,new Event(r.type))))}async updateActive(){let e=await this._video.methods.pictureInPictureEnabled();return we(this,du,e),e}get active(){return this.updateActive(),k(this,du)}get supported(){return!!document.pictureInPictureEnabled}async enter(){await this.userGesture(),await this._video.methods.requestPictureInPicture()}async exit(){await this._video.methods.exitPictureInPicture()}};du=new WeakMap;var{createScope:dF,onDispose:Jw,scoped:pF}=ys,ao,Rn=class{constructor(e,n){this._webview=e;this._ctx=n;w(this,"scope",dF());w(this,"$$PROVIDER_TYPE","WEBVIEW");w(this,"_currentSrc",null);w(this,"_port",new Tp);w(this,"pictureInPicture");O(this,ao,null);w(this,"onDomReady",async e=>{let n=this._webview;this.handlePlayReady(),new Tf(this,this._ctx),this._updateTitle(e),await mC(b1,n),await this.loadPlugin(this.currentWebHost)});pF(()=>{this.pictureInPicture=new Sf(this._port,n,()=>this.userGesture(!0))},this.scope)}setup(){Jw(()=>{this._webview.src=""}),hF(),this.type==="webview"&&this._ctx.delegate._notify("provider-setup",this),this.registerTitleChange(),Jw(()=>{this._webview.removeEventListener("dom-ready",this.onDomReady)})}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,ao)){await k(this,ao);return}await we(this,ao,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=j1[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(U1[e]),n()},{once:!0}),a=setTimeout(()=>{s(),i(new Ui(5e3))},5e3),{port1:o,port2:l}=new MessageChannel;this._port.load(o),r.contentWindow.postMessage(kx,"*",[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 Pf(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 Ui(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 Ui)fF(s);else if(a instanceof Pf)new Ds.Notice("Webview failed to load website: "+a.message);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),Jw(()=>{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),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(!lu(e))throw new Error("Webview provider only supports string src.");let i=_t.create(pC(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||qo(i.source)!==qo(r.src);r.src=i.href,s&&await this.untilPluginReady()}};ao=new WeakMap;var Pf=class extends Error{constructor(e){super(`${e.errorCode}: ${e.errorDescription}`)}};function hF(){let t="mx:webview-login-notified";localStorage.getItem(t)||(new Ds.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 fF(t){let e="mx:webview-timeout-ignore";if(localStorage.getItem(e))return;let i=(t/1e3).toFixed(1),r=new Ds.Notice(createFragment(s=>{s.createDiv({text:`Webpage not fully loaded within ${i}s. You can still try to play.`}),s.createDiv({},a=>{a.style.display="flex",a.style.justifyContent="flex-end",a.style.gap="1em",a.style.marginTop="1em",new Ds.ButtonComponent(a).setButtonText("OK"),new Ds.ButtonComponent(a).setButtonText("Don't show again").onClick(()=>{console.log("ignore webview timeout notice"),localStorage.setItem(e,"1"),r.hide()})})}),5e3)}var Lf=require("fs/promises"),hu=require("obsidian");function Cf(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 Rf=$(eb());var tb={"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"},SC=()=>Cf(Object.entries(tb),([t])=>t.split("-")[0]),TC={"zh-Hans":["CN","SG","MY"],"zh-Hant":["TW","HK","MO"]};function PC(t){let e=t.split("-"),n=e[0].toLowerCase();if(e.length===1)return Rf.default.getNativeName(n);let i=e.slice(0,2).join("-");return tb[i]||`${Rf.default.getNativeName(e[0])} (${t})`}function gF(t){return t.toLowerCase()==="hans"||TC["zh-Hans"].includes(t.toUpperCase())?"zh-Hans":t.toLowerCase()==="hant"||TC["zh-Hant"].includes(t.toUpperCase())?"zh-Hant":"zh"}function nb(t){if(!t)return!1;let e=t.split("-")[0].toLowerCase();return Rf.default.validate(e)}function CC(t){if(!nb(t))return null;let e=t.split("-"),n=e[0].toLowerCase();if(e.length===1)return n;let i=e[1];return n==="zh"?gF(i):tb[`${n}-${i.toUpperCase()}`]??`${n}-${e.slice(1).join("-")}`}var $C=["vtt","ass","ssa","srt"];function vF(t){return $C.includes(t.extension)}function MC(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=yF(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=Cf(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 $C){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 If(t,e){let n=t.filePath;if(!n||!t.inferredType)return[];let i=xi.basename(n),r=i.split(".").slice(0,-1).join("."),s=xi.dirname(n),a=(await(0,Lf.readdir)(s,{encoding:"utf-8",withFileTypes:!0}).catch(l=>{let c=l;return c.code!=="ENOENT"&&new hu.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:xi.join(s,l.name)}:{extension:c.at(-1),basename:c.slice(0,-1).join("."),path:xi.join(s,l.name)}}),o=MC({basename:r,path:n},a,e);return(await Promise.all(o.map(async({src:l,...c})=>{let u=await(0,Lf.readFile)(l.path,"utf-8").catch(d=>{let p=d;return p.code!=="ENOENT"&&new hu.Notice(`Failed to read subtitle file ${l.path}: ${p.message}`),""});return u?{...c,content:u}:null}))).filter(l=>!!l)}async function RC(t,e,n){if(!t.parent)return[];let i=MC(t,t.parent.children.filter(r=>r instanceof hu.TFile),n);return await Promise.all(i.map(async({src:r,...s})=>({...s,content:await e.cachedRead(r)})))}function yF(t,e){if(!t.basename.startsWith(e))return null;let n=t.basename.substring(e.length),i;if(!n)i=null;else if(i=CC(n.replace(/^\./,"")),!i)return null;let r=i?PC(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}}function Af(){return/[<>:"/\\|?*\u0000-\u001F]/g}function LC(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var _F=100,wF=/^\.+(\\|\/)|^\.+$/,bF=/\.+$/;function ib(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(Af().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(wF,r),t=t.replace(Af(),r),t=t.replace(n,r),t=t.replace(bF,""),r.length>0&&(!(t[0]===".")&&t[0]==="."&&(t=r+t),t[t.length-1]==="."&&(t+=r)),t=LC().test(t)?t+r:t;let s=typeof e.maxLength=="number"?e.maxLength:_F;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}var IC={"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(IC);var AC=IC;var NC={"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(NC);var DC=NC;var Ln=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)},oo,fu,Os,rb=class{constructor(...e){oo.set(this,new Map),fu.set(this,new Map),Os.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()),Ln(this,Os,"f").has(i)||Ln(this,Os,"f").set(i,new Set);let s=Ln(this,Os,"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&&Ln(this,fu,"f").set(i,o),a=!1,l)continue;let c=Ln(this,oo,"f").get(o);if(c&&c!=i&&!n)throw new Error(`"${i} -> ${o}" conflicts with "${c} -> ${o}". Pass \`force=true\` to override this definition.`);Ln(this,oo,"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:Ln(this,oo,"f").get(i)??null}getExtension(e){return typeof e!="string"?null:(e=e?.split?.(";")[0],(e&&Ln(this,fu,"f").get(e.trim().toLowerCase()))??null)}getAllExtensions(e){return typeof e!="string"?null:Ln(this,Os,"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 Ln(this,Os,"f").values())Object.freeze(e);return this}_getTestState(){return{types:Ln(this,oo,"f"),extensions:Ln(this,fu,"f")}}};oo=new WeakMap,fu=new WeakMap,Os=new WeakMap;var sb=rb;var ab=new sb(DC,AC)._freeze();var Vs=require("obsidian");var mu=require("obsidian");async function OC(t,e,n){let i=document.createElement("canvas"),{videoWidth:r,videoHeight:s}=t;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 gu(t){return to(t)||t instanceof Rn}async function Nf(t,e,n){let i=mu.Platform.isSafari&&e==="image/webp"?"image/jpeg":e;try{if(to(t))return await OC(t.video,i,n);if(t instanceof Rn)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 mu.Notice("Cannot take screenshot due to CORS restriction, you can try open media as webpage to bypass this"):new mu.Notice("Cannot take screenshot: "+(r instanceof Error?r.message:String(r))),r}}var VC=require("obsidian");function Df({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?kF(s,i):xF(s,i)}catch(a){new VC.Notice("Failed to insert timestamp, see console for details"),console.error("Failed to insert timestamp",a)}}function xF(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 kF(t,e){let n=e.getCursor("from");console.debug("insert before cursor [from]",n.ch,n.line),e.replaceRange(t,n,n)}function FC(t){return t.file.basename}function zC({source:t},e){return e.title??t.hostname+decodeURI(t.pathname).replaceAll("/","_")}function UC(t,e){return $i(t)?FC(t):zC(t,e)}function vu(t,e){let{metadataCache:n}=e.plugin.app,i=e.store.getState().player;if(!i)throw new Error("Player not initialized");if($i(t)){let{file:r,type:s}=t;return e.plugin.leafOpener.openNote(t,{title:FC(t),fm:a=>({[s]:`[[${n.fileToLinktext(r,a)}]]`}),sourcePath:r.path})}else return e.plugin.leafOpener.openNote(t,{title:zC(t,i.state),fm:()=>({media:t.jsonState.source})})}function Of(t,e,n){let{fileManager:i}=n.plugin.app,{timestampOffset:r}=n.plugin.settings.getState(),s=n.store.getState().player?.state.duration;t+=r,t<0&&(t=0),s&&t>s&&(t=s);let a=xf(t),o=t>0?`#${Qw({start:t,end:-1})}`:"";if($i(e)){let{file:l}=e;return c=>i.generateMarkdownLink(l,c,o,a).replace(/^!/,"")}else{let l=e.jsonState.source;return()=>`[${a}](${l}${o})`}}async function Vf(t,{file:e,editor:n}){let{fileManager:i,vault:r}=t.plugin.app,s=t.store.getState().player;if(!s){new Vs.Notice("Player not initialized");return}let a=t.getMediaInfo();if(!a){new Vs.Notice("No media is opened");return}if(!s?.provider||!gu(s.provider)){new Vs.Notice("Screenshot is not supported for this media");return}let{screenshotQuality:o,screenshotFormat:l}=t.plugin.settings.getState(),{blob:c,time:u}=await Nf(s.provider,l,o),d=Of(u,a,t),p=ab.getExtension(c.type);if(!p){new Vs.Notice("Unknown mime type: "+c.type);return}let h=UC(a,s.state),y=ib(h,{replacement:"_"})+B1(u),v=u>0?` - ${xf(u)}`:"",_=await r.getAvailablePathForAttachments(y,p,e),m=await r.createBinary(_,c.arrayBuffer);new Vs.Notice("Screenshot saved to "+m.path);let{insertBefore:f,screenshotTemplate:g,screenshotEmbedTemplate:x}=t.plugin.settings.getState();try{Df({timestamp:d(e.path),screenshot:i.generateMarkdownLink(m,e.path,"",x.replaceAll("{{TITLE}}",h).replaceAll("{{DURATION}}",v)).replace(/^!/,"")},{editor:n,template:g,insertBefore:f})}catch(T){new Vs.Notice("Failed to insert screenshot, see console for details"),console.error("Failed to insert screenshot",T)}}var yu=require("obsidian");async function Ff(t,{file:e,editor:n}){let i=t.store.getState().player;if(!i){new yu.Notice("Player not initialized");return}let r=t.getMediaInfo();if(!r){new yu.Notice("No media is opened");return}let s=i.currentTime,a=Of(s,r,t);if(s<=0){new yu.Notice("Playback not started yet");return}let{insertBefore:o,timestampTemplate:l}=t.plugin.settings.getState();try{Df({timestamp:a(e.path)},{editor:n,template:l,insertBefore:o})}catch(c){new yu.Notice("Failed to insert timestamp, see console for details"),console.error("Failed to insert timestamp",c)}}var jC=require("obsidian");function lo(t){let e="mx:media-notetaking-notified";localStorage.getItem(e)||(new jC.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 zf(t){let e=Un(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 Uf(t){t.addAction("star","Timestamp",()=>{let e=t.getMediaInfo();e&&(lo("timestamp"),vu(e,t).then(n=>{Ff(t,n)}))}),t.getViewType()!==Mi&&t.addAction("camera","Screenshot",()=>{let e=t.getMediaInfo();e&&(lo("screenshot"),vu(e,t).then(n=>Vf(t,n)))})}function jf(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,player:i,toggleControls:s,controls:a,setTransform:o,transform:l,plugin:t.plugin,disableWebFullscreen:u,toggleWebFullscreen:c,reload:()=>t.render()},n,t.leaf)}var ob=new WeakSet;function qC(t){t.subscribe((e,n)=>{e.player!==n.player&&_u(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))&&ob.delete(i)})}async function _u({player:t,hash:{tempFragment:e}}){if(!t||!e)return;let n=!ob.has(t);ob.add(t);let i=null,r=.25;if(kn(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 EF(t,"seeked"),await t.pause())}kn(e)&&t.state.canPlay&&!n&&await t.play(new Event("hashchange"))}function EF(t,e){return new Promise(n=>{let i=window.setTimeout(()=>{n(),r()},5e3),r=t.listen(e,()=>{n(),window.clearTimeout(i),r()})})}function Fr(){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 Ui(r))},r)})},setSource(r,{hash:s,enableWebview:a,title:o,type:l,textTracks:c}={}){e(u=>({source:{...u.source,type:l??u.source?.type,url:r,enableWebview:a??u.source?.enableWebview},textTracks:c??u.textTracks,hash:{...u.hash,...xp(s||r.hash)},title:(o===!0?zf(r.source.href):o)??u.title})),_u(n())},setHash(r){e(s=>({hash:{...s.hash,...xp(r)}})),_u(n())},async loadFile(r,{vault:s,subpath:a,defaultLang:o}){let l=await RC(r,s,o);e(({source:c,hash:u})=>({source:{...c,url:uC(r,s)},textTracks:l,title:r.name,hash:a?{...u,...xp(a)}:u})),await _u(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 Rn&&s.provider.media.send("mx-toggle-controls",!r)},toggleWebFullscreen(r){let{player:s}=n();e({disableWebFullscreen:!r}),s&&s.provider instanceof Rn&&s.provider.media.send("mx-toggle-webfs",r)},textTracks:[],updateWebHost:r=>e({webHost:r==="generic"?void 0:r})}));return qC(t),t}var wt=(0,ti.createContext)(null);function Nt(t){let{store:e}=(0,ti.useContext)(wt);return Py(e,t)}function Fs(t){let{plugin:{settings:e}}=(0,ti.useContext)(wt);return Py(e,t)}function qf(){let{store:t}=(0,ti.useContext)(wt);return t}function HC(){return(0,ti.useContext)(wt).reload}function Hf(t){let e=(0,ti.useContext)(wt).plugin.app;return t?t(e):e}function BC(){return(0,ti.useContext)(wt).plugin}function WC(){return(0,ti.useContext)(wt).onScreenshot}var co=()=>(0,ti.useContext)(wt).embed;function wu(t,e){let n=Fl,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=Fl})];return()=>i.forEach(r=>r())}var bM=require("obsidian"),xM=$(z());var KC=$(z());function GC(){let t=bi(),e=qf();(0,KC.useEffect)(()=>{if(t)return TF(t,e)},[t,e])}function TF(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=SF(e.getState().hash.tempFragment,t.state.duration);if(!l||kn(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 SF(t,e){if(!t)return null;if(kn(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 YC(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=YC(t[e]))&&(i&&(i+=" "),i+=n);else for(e in t)t[e]&&(i&&(i+=" "),i+=e);return i}function QC(){for(var t,e,n=0,i="";n<arguments.length;)(t=arguments[n++])&&(e=YC(t))&&(i&&(i+=" "),i+=e);return i}var cb="-";function PF(t){let e=$F(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;function r(a){let o=a.split(cb);return o[0]===""&&o.length!==1&&o.shift(),JC(o,e)||CF(a)}function s(a,o){let l=n[a]||[];return o&&i[a]?[...l,...i[a]]:l}return{getClassGroupId:r,getConflictingClassGroupIds:s}}function JC(t,e){if(t.length===0)return e.classGroupId;let n=t[0],i=e.nextPart.get(n),r=i?JC(t.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;let s=t.join(cb);return e.validators.find(({validator:a})=>a(s))?.classGroupId}var XC=/^\[(.+)\]$/;function CF(t){if(XC.test(t)){let e=XC.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function $F(t){let{theme:e,prefix:n}=t,i={nextPart:new Map,validators:[]};return RF(Object.entries(t.classGroups),n).forEach(([s,a])=>{lb(a,i,s,e)}),i}function lb(t,e,n,i){t.forEach(r=>{if(typeof r=="string"){let s=r===""?e:ZC(e,r);s.classGroupId=n;return}if(typeof r=="function"){if(MF(r)){lb(r(i),e,n,i);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,a])=>{lb(a,ZC(e,s),n,i)})})}function ZC(t,e){let n=t;return e.split(cb).forEach(i=>{n.nextPart.has(i)||n.nextPart.set(i,{nextPart:new Map,validators:[]}),n=n.nextPart.get(i)}),n}function MF(t){return t.isThemeGetter}function RF(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 LF(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 e$="!";function IF(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 _=a[v];if(l===0){if(_===i&&(n||a.slice(v,v+r)===e)){o.push(a.slice(c,v)),c=v+r;continue}if(_==="/"){u=v;continue}}_==="["?l++:_==="]"&&l--}let d=o.length===0?a:a.substring(c),p=d.startsWith(e$),h=p?d.substring(1):d,y=u&&u>c?u-c:void 0;return{modifiers:o,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:y}}}function AF(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 NF(t){return{cache:LF(t.cacheSize),splitModifiers:IF(t),...PF(t)}}var DF=/\s+/;function OF(t,e){let{splitModifiers:n,getClassGroupId:i,getConflictingClassGroupIds:r}=e,s=new Set;return t.trim().split(DF).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=AF(o).join(":");return{isTailwindClass:!0,modifierId:l?h+e$: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 VF(){let t=0,e,n,i="";for(;t<arguments.length;)(e=arguments[t++])&&(n=t$(e))&&(i&&(i+=" "),i+=n);return i}function t$(t){if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=t$(t[i]))&&(n&&(n+=" "),n+=e);return n}function FF(t,...e){let n,i,r,s=a;function a(l){let c=e.reduce((u,d)=>d(u),t());return n=NF(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=OF(l,n);return r(l,u),u}return function(){return s(VF.apply(null,arguments))}}function Te(t){let e=n=>n[t]||[];return e.isThemeGetter=!0,e}var n$=/^\[(?:([a-z-]+):)?(.+)\]$/i,zF=/^\d+\/\d+$/,UF=new Set(["px","full","screen"]),jF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qF=/\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$/,HF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,BF=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,WF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function nr(t){return zs(t)||UF.has(t)||zF.test(t)}function zr(t){return uo(t,"length",e5)}function zs(t){return!!t&&!Number.isNaN(Number(t))}function Bf(t){return uo(t,"number",zs)}function bu(t){return!!t&&Number.isInteger(Number(t))}function KF(t){return t.endsWith("%")&&zs(t.slice(0,-1))}function Q(t){return n$.test(t)}function Ur(t){return jF.test(t)}var GF=new Set(["length","size","percentage"]);function YF(t){return uo(t,GF,i$)}function QF(t){return uo(t,"position",i$)}var XF=new Set(["image","url"]);function ZF(t){return uo(t,XF,n5)}function JF(t){return uo(t,"",t5)}function xu(){return!0}function uo(t,e,n){let i=n$.exec(t);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):n(i[2]):!1}function e5(t){return qF.test(t)&&!HF.test(t)}function i$(){return!1}function t5(t){return BF.test(t)}function n5(t){return WF.test(t)}function i5(){let t=Te("colors"),e=Te("spacing"),n=Te("blur"),i=Te("brightness"),r=Te("borderColor"),s=Te("borderRadius"),a=Te("borderSpacing"),o=Te("borderWidth"),l=Te("contrast"),c=Te("grayscale"),u=Te("hueRotate"),d=Te("invert"),p=Te("gap"),h=Te("gradientColorStops"),y=Te("gradientColorStopPositions"),v=Te("inset"),_=Te("margin"),m=Te("opacity"),f=Te("padding"),g=Te("saturate"),x=Te("scale"),T=Te("sepia"),L=Te("skew"),R=Te("space"),I=Te("translate"),K=()=>["auto","contain","none"],q=()=>["auto","hidden","clip","visible","scroll"],_e=()=>["auto",Q,e],J=()=>[Q,e],sr=()=>["",nr,zr],$e=()=>["auto",zs,Q],bt=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Pi=()=>["solid","dashed","dotted","double","none"],Uo=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],Zr=()=>["start","end","center","between","around","evenly","stretch"],Vn=()=>["","0",Q],Ci=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Qt=()=>[zs,Bf],Jr=()=>[zs,Q];return{cacheSize:500,separator:":",theme:{colors:[xu],spacing:[nr,zr],blur:["none","",Ur,Q],brightness:Qt(),borderColor:[t],borderRadius:["none","","full",Ur,Q],borderSpacing:J(),borderWidth:sr(),contrast:Qt(),grayscale:Vn(),hueRotate:Jr(),invert:Vn(),gap:J(),gradientColorStops:[t],gradientColorStopPositions:[KF,zr],inset:_e(),margin:_e(),opacity:Qt(),padding:J(),saturate:Qt(),scale:Qt(),sepia:Vn(),skew:Jr(),space:J(),translate:J()},classGroups:{aspect:[{aspect:["auto","square","video",Q]}],container:["container"],columns:[{columns:[Ur]}],"break-after":[{"break-after":Ci()}],"break-before":[{"break-before":Ci()}],"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:[...bt(),Q]}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:K()}],"overscroll-x":[{"overscroll-x":K()}],"overscroll-y":[{"overscroll-y":K()}],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",bu,Q]}],basis:[{basis:_e()}],"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:Vn()}],shrink:[{shrink:Vn()}],order:[{order:["first","last","none",bu,Q]}],"grid-cols":[{"grid-cols":[xu]}],"col-start-end":[{col:["auto",{span:["full",bu,Q]},Q]}],"col-start":[{"col-start":$e()}],"col-end":[{"col-end":$e()}],"grid-rows":[{"grid-rows":[xu]}],"row-start-end":[{row:["auto",{span:[bu,Q]},Q]}],"row-start":[{"row-start":$e()}],"row-end":[{"row-end":$e()}],"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",...Zr()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Zr(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Zr(),"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:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"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:[Ur]},Ur]}],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",Ur,zr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bf]}],"font-family":[{font:[xu]}],"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",zs,Bf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",nr,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:[...Pi(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",nr,zr]}],"underline-offset":[{"underline-offset":["auto",nr,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:J()}],"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:[...bt(),QF]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",YF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ZF]}],"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:[...Pi(),"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:Pi()}],"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:["",...Pi()]}],"outline-offset":[{"outline-offset":[nr,Q]}],"outline-w":[{outline:[nr,zr]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:sr()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[nr,zr]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ur,JF]}],"shadow-color":[{shadow:[xu]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":Uo()}],"bg-blend":[{"bg-blend":Uo()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[i]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ur,Q]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[g]}],sepia:[{sepia:[T]}],"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":[T]}],"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:Jr()}],ease:[{ease:["linear","in","out","in-out",Q]}],delay:[{delay:Jr()}],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:[bu,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":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"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:[nr,zr,Bf]}],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 r$=FF(i5);function In(...t){return r$(QC(t))}var s$=$(z());function a$(t){let e=bi();(0,s$.useEffect)(()=>{if(e)return e.listen("loaded-metadata",n=>{let i=n.target;if(!to(i.provider)){t("unknown");return}let{videoHeight:r,videoWidth:s}=i.provider.video;t(r===0||s===0?"audio":"unknown")})},[e])}var Wf=$(z());function Kf(){let{controls:t}=ub(),e=Nt(r=>r.controls);return e===void 0&&t===void 0?!0:e||t}function ub(){let{volume:t,tempFragment:e,...n}=Nt(i=>i.hash);return n}function o$(){let t=bi(),{volume:e}=Nt(s=>s.hash),n=Fs(s=>s.defaultVolume/100),i=e??n,r=(0,Wf.useRef)(i);r.current=i,(0,Wf.useEffect)(()=>t?.subscribe(({canPlay:s})=>{s&&(t.volume=r.current)}),[t])}function Ke(){return Ke=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},Ke.apply(this,arguments)}var Dt=$(z(),1);function Us(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t?.(r),n===!1||!r.defaultPrevented)return e?.(r)}}var l$=$(z(),1);function r5(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function db(...t){return e=>t.forEach(n=>r5(n,e))}function Ei(...t){return(0,l$.useCallback)(db(...t),t)}var ni=$(z(),1);function jr(t,e=[]){let n=[];function i(s,a){let o=(0,ni.createContext)(a),l=n.length;n=[...n,a];function c(d){let{scope:p,children:h,...y}=d,v=p?.[t][l]||o,_=(0,ni.useMemo)(()=>y,Object.values(y));return(0,ni.createElement)(v.Provider,{value:_},h)}function u(d,p){let h=p?.[t][l]||o,y=(0,ni.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,ni.createContext)(a));return function(o){let l=o?.[t]||s;return(0,ni.useMemo)(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return r.scopeName=t,[i,s5(r,...e)]}function s5(...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,ni.useMemo)(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var ho=$(z(),1),c5=$(Dl(),1);var De=$(z(),1);var po=(0,De.forwardRef)((t,e)=>{let{children:n,...i}=t,r=De.Children.toArray(n),s=r.find(o5);if(s){let a=s.props.children,o=r.map(l=>l===s?De.Children.count(a)>1?De.Children.only(null):(0,De.isValidElement)(a)?a.props.children:null:l);return(0,De.createElement)(pb,Ke({},i,{ref:e}),(0,De.isValidElement)(a)?(0,De.cloneElement)(a,void 0,o):null)}return(0,De.createElement)(pb,Ke({},i,{ref:e}),n)});po.displayName="Slot";var pb=(0,De.forwardRef)((t,e)=>{let{children:n,...i}=t;return(0,De.isValidElement)(n)?(0,De.cloneElement)(n,{...l5(i,n.props),ref:e?db(e,n.ref):n.ref}):De.Children.count(n)>1?De.Children.only(null):null});pb.displayName="SlotClone";var a5=({children:t})=>(0,De.createElement)(De.Fragment,null,t);function o5(t){return(0,De.isValidElement)(t)&&t.type===a5}function l5(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 u5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ku=u5.reduce((t,e)=>{let n=(0,ho.forwardRef)((i,r)=>{let{asChild:s,...a}=i,o=s?po:e;return(0,ho.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,ho.createElement)(o,Ke({},a,{ref:r}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var fo=$(z(),1);function hb(t){let e=(0,fo.useRef)(t);return(0,fo.useEffect)(()=>{e.current=t}),(0,fo.useMemo)(()=>(...n)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...n)},[])}var c$=$(z(),1),u$=globalThis?.document?c$.useLayoutEffect:()=>{};var Eu=$(z(),1);var d$=$(z(),1);function p$(t){let[e,n]=(0,d$.useState)(void 0);return u$(()=>{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 h$="Popper",[f$,fb]=jr(h$),[mq,gq]=f$(h$);var d5="PopperContent",[vq,yq]=f$(d5);var qr=$(z(),1);function m$({prop:t,defaultProp:e,onChange:n=()=>{}}){let[i,r]=p5({defaultProp:e,onChange:n}),s=t!==void 0,a=s?t:i,o=hb(n),l=(0,qr.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 p5({defaultProp:t,onChange:e}){let n=(0,qr.useState)(t),[i]=n,r=(0,qr.useRef)(i),s=hb(e);return(0,qr.useEffect)(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),n}var[Gf,$q]=jr("Tooltip",[fb]),Mq=fb(),h5="TooltipProvider",f5=700;var[m5,Rq]=Gf(h5),g5=t=>{let{__scopeTooltip:e,delayDuration:n=f5,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=t,[a,o]=(0,Dt.useState)(!0),l=(0,Dt.useRef)(!1),c=(0,Dt.useRef)(0);return(0,Dt.useEffect)(()=>{let u=c.current;return()=>window.clearTimeout(u)},[]),(0,Dt.createElement)(m5,{scope:e,isOpenDelayed:a,delayDuration:n,onOpen:(0,Dt.useCallback)(()=>{window.clearTimeout(c.current),o(!1)},[]),onClose:(0,Dt.useCallback)(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o(!0),i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:(0,Dt.useCallback)(u=>{l.current=u},[]),disableHoverableContent:r},s)},g$="Tooltip",[Lq,Iq]=Gf(g$);var v5="TooltipPortal",[Aq,Nq]=Gf(v5,{forceMount:void 0});var[Dq,Oq]=Gf(g$,{isInside:!1});var Yf=g5;var Zf=$(z());var b$=require("obsidian"),Xf=$(z()),A$=$(ae());function E5(t){let e=(0,Xf.useRef)(null);return[(0,Xf.useCallback)(i=>{e.current&&e.current.empty(),i&&(0,b$.setIcon)(i,t),e.current=i},[t])]}function Fe(t){return function(n){let[i]=E5(t);return(0,A$.jsx)("div",{ref:i,...n})}}var x$=Fe("play"),k$=Fe("pause"),qq=Fe("volume"),E$=Fe("volume-1"),T$=Fe("volume-2"),S$=Fe("volume-x"),P$=Fe("maximize"),C$=Fe("minimize"),T5=Fe("picture-in-picture-2"),S5=Fe("picture-in-picture"),mb=Fe("subtitles"),Hq=Fe("check-circle"),Bq=Fe("circle"),$$=Fe("fast-forward"),M$=Fe("rewind"),R$=Fe("edit"),L$=Fe("image-down"),P5=Fe("pin"),I$=Fe("more-horizontal"),Wq=Fe("plus"),Kq=Fe("trash");var Qe=$(ae()),Tu="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 Jf(){let t=ye("paused");return(0,Qe.jsx)(lf,{className:Tu,"aria-label":t?"Play":"Pause",children:t?(0,Qe.jsx)(x$,{className:"w-7 h-7 translate-x-px"}):(0,Qe.jsx)(k$,{className:"w-7 h-7"})})}function N$({seconds:t}){return(0,Qe.jsx)(su,{className:Tu,seconds:t,"aria-label":`Fast forward ${t}s`,children:(0,Qe.jsx)($$,{className:"w-7 h-7"})})}function D$({seconds:t}){return(0,Qe.jsx)(su,{className:Tu,seconds:-t,"aria-label":`Rewind ${t}s`,children:(0,Qe.jsx)(M$,{className:"w-7 h-7"})})}function em(){let t=ye("volume"),e=ye("muted");return(0,Qe.jsx)(uf,{className:Tu,"aria-label":e?"Unmute":"Mute",children:e||t==0?(0,Qe.jsx)(S$,{className:"w-7 h-7"}):t<.5?(0,Qe.jsx)(E$,{className:"w-7 h-7"}):(0,Qe.jsx)(T$,{className:"w-7 h-7"})})}function O$(){let t=ye("fullscreen");return(0,Qe.jsx)(cf,{className:Tu,"aria-label":t?"Exit fullscreen":"Enter fullscreen",children:t?(0,Qe.jsx)(C$,{className:"w-7 h-7"}):(0,Qe.jsx)(P$,{className:"w-7 h-7"})})}function tm(){return co()?(0,Qe.jsx)("button",{className:In("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:()=>{},[Hr]:!0,"aria-label":"Edit in editor",children:(0,Qe.jsx)(R$,{className:"w-7 h-7"})}):null}function C5(){let t=_1(),[e,n]=(0,Zf.useState)(()=>gu(t)),i=WC(),r=Fs(a=>a.screenshotFormat),s=Fs(a=>a.screenshotQuality);return(0,Zf.useEffect)(()=>{n(gu(t))},[t]),!e||!i||!t?null:async()=>{i(await Nf(t,r,s))}}function V$(){let t=C5();return t?(0,Qe.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,Qe.jsx)(L$,{className:"w-7 h-7"})}):null}var Hr="data-lp-pass-through";function ut(t,e){let n=Object.keys(e).map(i=>$5(t,i,e[i]));return n.length===1?n[0]:function(){n.forEach(i=>i())}}function $5(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 z$=require("obsidian"),U$=$(z());var Su=$(ae());function j$(t){let e=(0,U$.useRef)(null);return n=>{e.current?.close(),e.current=null;let i=new z$.Menu;t(i)?(Gs(n.nativeEvent,i),n.nativeEvent.stopImmediatePropagation(),ut(i,{close:r=>function(...s){return e.current===this&&(e.current=null),r.call(this,...s)}}),e.current=i):i.close()}}function q$(){let t=zw(),e=ye("textTracks"),n=j$(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,Su.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",[Hr]:!0,onClick:n,"aria-label":"Select Caption",children:(0,Su.jsx)(mb,{className:"w-7 h-7"})})}function nm(){let t=bi(),e=Hf(l=>l.workspace),n=BC(),i=co(),r=HC(),s=Nt(l=>l.source?.url),a=qf(),o=j$(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,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,Su.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",[Hr]:!0,onClick:o,"aria-label":"More options",children:(0,Su.jsx)(I$,{className:"w-7 h-7"})})}var am=$(z());var B=$(z(),1);function gb(t,[e,n]){return Math.min(n,Math.max(e,t))}var Pu=$(z(),1),M5=(0,Pu.createContext)(void 0);function B$(t){let e=(0,Pu.useContext)(M5);return t||e||"ltr"}var im=$(z(),1);function W$(t){let e=(0,im.useRef)({value:t,previous:t});return(0,im.useMemo)(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var ii=$(z(),1);function K$(t){let e=t+"CollectionProvider",[n,i]=jr(e),[r,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:y,children:v}=h,_=ii.default.useRef(null),m=ii.default.useRef(new Map).current;return ii.default.createElement(r,{scope:y,itemMap:m,collectionRef:_},v)},o=t+"CollectionSlot",l=ii.default.forwardRef((h,y)=>{let{scope:v,children:_}=h,m=s(o,v),f=Ei(y,m.collectionRef);return ii.default.createElement(po,{ref:f},_)}),c=t+"CollectionItemSlot",u="data-radix-collection-item",d=ii.default.forwardRef((h,y)=>{let{scope:v,children:_,...m}=h,f=ii.default.useRef(null),g=Ei(y,f),x=s(c,v);return ii.default.useEffect(()=>(x.itemMap.set(f,{ref:f,...m}),()=>void x.itemMap.delete(f))),ii.default.createElement(po,{[u]:"",ref:g},_)});function p(h){let y=s(t+"CollectionConsumer",h);return ii.default.useCallback(()=>{let _=y.collectionRef.current;if(!_)return[];let m=Array.from(_.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((x,T)=>m.indexOf(x.ref.current)-m.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:d},p,i]}var Q$=["PageUp","PageDown"],X$=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Z$={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cu="Slider",[vb,R5,L5]=K$(Cu),[J$,RH]=jr(Cu,[L5]),[I5,rm]=J$(Cu),A5=(0,B.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,_]=(0,B.useState)(null),m=Ei(e,$e=>_($e)),f=(0,B.useRef)(new Set),g=(0,B.useRef)(0),x=a==="horizontal",T=v?!!v.closest("form"):!0,L=x?N5:D5,[R=[],I]=m$({prop:u,defaultProp:c,onChange:$e=>{var bt;(bt=[...f.current][g.current])===null||bt===void 0||bt.focus(),d($e)}}),K=(0,B.useRef)(R);function q($e){let bt=B5(R,$e);sr($e,bt)}function _e($e){sr($e,g.current)}function J(){let $e=K.current[g.current];R[g.current]!==$e&&p(R)}function sr($e,bt,{commit:Pi}={commit:!1}){let Uo=Y5(s),Zr=Q5(Math.round(($e-i)/s)*s+i,Uo),Vn=gb(Zr,[i,r]);I((Ci=[])=>{let Qt=q5(Ci,Vn,bt);if(G5(Qt,l*s)){g.current=Qt.indexOf(Vn);let Jr=String(Qt)!==String(Ci);return Jr&&Pi&&p(Qt),Jr?Qt:Ci}else return Ci})}return(0,B.createElement)(I5,{scope:t.__scopeSlider,disabled:o,min:i,max:r,valueIndexToChangeRef:g,thumbs:f.current,values:R,orientation:a},(0,B.createElement)(vb.Provider,{scope:t.__scopeSlider},(0,B.createElement)(vb.Slot,{scope:t.__scopeSlider},(0,B.createElement)(L,Ke({"aria-disabled":o,"data-disabled":o?"":void 0},y,{ref:m,onPointerDown:Us(y.onPointerDown,()=>{o||(K.current=R)}),min:i,max:r,inverted:h,onSlideStart:o?void 0:q,onSlideMove:o?void 0:_e,onSlideEnd:o?void 0:J,onHomeKeyDown:()=>!o&&sr(i,0,{commit:!0}),onEndKeyDown:()=>!o&&sr(r,R.length-1,{commit:!0}),onStepKeyDown:({event:$e,direction:bt})=>{if(!o){let Zr=Q$.includes($e.key)||$e.shiftKey&&X$.includes($e.key)?10:1,Vn=g.current,Ci=R[Vn],Qt=s*Zr*bt;sr(Ci+Qt,Vn,{commit:!0})}}})))),T&&R.map(($e,bt)=>(0,B.createElement)(j5,{key:bt,name:n?n+(R.length>1?"[]":""):void 0,value:$e})))}),[eM,tM]=J$(Cu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),N5=(0,B.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,B.useState)(null),h=Ei(e,g=>p(g)),y=(0,B.useRef)(),v=B$(r),_=v==="ltr",m=_&&!s||!_&&s;function f(g){let x=y.current||d.getBoundingClientRect(),T=[0,x.width],R=yb(T,m?[n,i]:[i,n]);return y.current=x,R(g-x.left)}return(0,B.createElement)(eM,{scope:t.__scopeSlider,startEdge:m?"left":"right",endEdge:m?"right":"left",direction:m?1:-1,size:"width"},(0,B.createElement)(nM,Ke({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 T=Z$[m?"from-left":"from-right"].includes(g.key);c?.({event:g,direction:T?-1:1})}})))}),D5=(0,B.forwardRef)((t,e)=>{let{min:n,max:i,inverted:r,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onStepKeyDown:l,...c}=t,u=(0,B.useRef)(null),d=Ei(e,u),p=(0,B.useRef)(),h=!r;function y(v){let _=p.current||u.current.getBoundingClientRect(),m=[0,_.height],g=yb(m,h?[i,n]:[n,i]);return p.current=_,g(v-_.top)}return(0,B.createElement)(eM,{scope:t.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1},(0,B.createElement)(nM,Ke({"data-orientation":"vertical"},c,{ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:v=>{let _=y(v.clientY);s?.(_)},onSlideMove:v=>{let _=y(v.clientY);a?.(_)},onSlideEnd:()=>{p.current=void 0,o?.()},onStepKeyDown:v=>{let m=Z$[h?"from-bottom":"from-top"].includes(v.key);l?.({event:v,direction:m?-1:1})}})))}),nM=(0,B.forwardRef)((t,e)=>{let{__scopeSlider:n,onSlideStart:i,onSlideMove:r,onSlideEnd:s,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:l,...c}=t,u=rm(Cu,n);return(0,B.createElement)(ku.span,Ke({},c,{ref:e,onKeyDown:Us(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(o(d),d.preventDefault()):Q$.concat(X$).includes(d.key)&&(l(d),d.preventDefault())}),onPointerDown:Us(t.onPointerDown,d=>{let p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),u.thumbs.has(p)?p.focus():i(d)}),onPointerMove:Us(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&r(d)}),onPointerUp:Us(t.onPointerUp,d=>{let p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),s(d))})}))}),O5="SliderTrack",V5=(0,B.forwardRef)((t,e)=>{let{__scopeSlider:n,...i}=t,r=rm(O5,n);return(0,B.createElement)(ku.span,Ke({"data-disabled":r.disabled?"":void 0,"data-orientation":r.orientation},i,{ref:e}))}),G$="SliderRange",F5=(0,B.forwardRef)((t,e)=>{let{__scopeSlider:n,...i}=t,r=rm(G$,n),s=tM(G$,n),a=(0,B.useRef)(null),o=Ei(e,a),l=r.values.length,c=r.values.map(p=>iM(p,r.min,r.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,B.createElement)(ku.span,Ke({"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0},i,{ref:o,style:{...t.style,[s.startEdge]:u+"%",[s.endEdge]:d+"%"}}))}),Y$="SliderThumb",z5=(0,B.forwardRef)((t,e)=>{let n=R5(t.__scopeSlider),[i,r]=(0,B.useState)(null),s=Ei(e,o=>r(o)),a=(0,B.useMemo)(()=>i?n().findIndex(o=>o.ref.current===i):-1,[n,i]);return(0,B.createElement)(U5,Ke({},t,{ref:s,index:a}))}),U5=(0,B.forwardRef)((t,e)=>{let{__scopeSlider:n,index:i,...r}=t,s=rm(Y$,n),a=tM(Y$,n),[o,l]=(0,B.useState)(null),c=Ei(e,_=>l(_)),u=p$(o),d=s.values[i],p=d===void 0?0:iM(d,s.min,s.max),h=H5(i,s.values.length),y=u?.[a.size],v=y?W5(y,p,a.direction):0;return(0,B.useEffect)(()=>{if(o)return s.thumbs.add(o),()=>{s.thumbs.delete(o)}},[o,s.thumbs]),(0,B.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${p}% + ${v}px)`}},(0,B.createElement)(vb.ItemSlot,{scope:t.__scopeSlider},(0,B.createElement)(ku.span,Ke({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:Us(t.onFocus,()=>{s.valueIndexToChangeRef.current=i})}))))}),j5=t=>{let{value:e,...n}=t,i=(0,B.useRef)(null),r=W$(e);return(0,B.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,B.createElement)("input",Ke({style:{display:"none"}},n,{ref:i,defaultValue:e}))};function q5(t=[],e,n){let i=[...t];return i[n]=e,i.sort((r,s)=>r-s)}function iM(t,e,n){let s=100/(n-e)*(t-e);return gb(s,[0,100])}function H5(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function B5(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 W5(t,e,n){let i=t/2,s=yb([0,50],[0,i]);return(i-s(e)*n)*n}function K5(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function G5(t,e){if(e>0){let n=K5(t);return Math.min(...n)>=e}return!0}function yb(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 Y5(t){return(String(t).split(".")[1]||"").length}function Q5(t,e){let n=Math.pow(10,e);return Math.round(t*n)/n}var _b=A5,rM=V5,sM=F5,aM=z5;var oM=$(z());var mo=$(ae()),sm=oM.forwardRef(({className:t,variant:e="regular",autoHidden:n,children:i,...r},s)=>(0,mo.jsxs)(_b,{ref:s,className:In("group relative flex w-full touch-none select-none items-center",t),...r,children:[(0,mo.jsx)(rM,{className:"relative h-slider-track w-full grow overflow-hidden rounded-sm bg-slider-track",children:(0,mo.jsx)(sM,{className:"absolute h-full bg-ia-accent rounded-sm will-change-[width]"})}),(0,mo.jsx)(aM,{className:In("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]}));sm.displayName=_b.displayName;var Br=$(ae());function om(){let t=ye("volume"),e=ye("canSetVolume"),n=vf();return e?(0,Br.jsx)(sm,{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 lm({thumbnails:t}){let e=ye("currentTime"),n=ye("canSeek"),i=ye("duration"),r=ye("seeking"),s=vf(),a=1/i*100,[o,l]=(0,am.useState)(0),{previewRootRef:c,previewRef:u,previewValue:d}=w1({clamp:!0,offset:6,orientation:"horizontal"}),p=d/100*i;return(0,am.useEffect)(()=>{r||l(e/i*100)},[e,i,r]),(0,Br.jsx)(sm,{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,Br.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,Br.jsx)(df.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,Br.jsx)(df.Img,{})}):null,(0,Br.jsx)("span",{className:"text-[13px]",children:Vr(p)})]})})}var go=$(ae());function cm(){return(0,go.jsxs)("div",{className:"ml-2.5 flex items-center text-sm font-medium",children:[(0,go.jsx)(au,{className:"time",type:"current"}),(0,go.jsx)("div",{className:"mx-1 text-white/80",children:"/"}),(0,go.jsx)(au,{className:"time",type:"duration"})]})}var $u=$(ae());function um(){let t=ye("title").trim(),e=ff().trim();return!t&&!e?null:(0,$u.jsxs)("span",{className:"inline-block flex-1 overflow-hidden text-ellipsis whitespace-nowrap px-2 text-sm font-medium text-white/70",children:[(0,$u.jsx)("span",{className:"mr-1",children:"|"}),(0,$u.jsx)("span",{children:e||t})]})}var fe=$(ae());function cM({thumbnails:t}){return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(Z5,{}),(0,fe.jsx)(er.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,fe.jsxs)(Yf,{children:[(0,fe.jsx)("div",{className:"flex-1"}),(0,fe.jsx)(er.Group,{className:"flex w-full items-center px-2",children:(0,fe.jsx)(lm,{thumbnails:t})}),(0,fe.jsxs)(er.Group,{className:"-mt-0.5 flex w-full items-center px-2 pb-2",children:[(0,fe.jsx)(D$,{seconds:30}),(0,fe.jsx)(Jf,{}),(0,fe.jsx)(N$,{seconds:30}),(0,fe.jsx)(em,{}),(0,fe.jsx)(om,{}),(0,fe.jsx)(cm,{}),(0,fe.jsx)(um,{}),(0,fe.jsx)("div",{className:"flex-1"}),(0,fe.jsx)(tm,{}),(0,fe.jsx)(nm,{})]})]})})]})}function Z5(){return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)($n,{className:"absolute inset-0 z-0 block h-full w-full",event:"pointerup",action:"toggle:paused"}),(0,fe.jsx)($n,{className:"absolute inset-0 z-0 block h-full w-full",event:"dblpointerup",action:"toggle:fullscreen"}),(0,fe.jsx)($n,{className:"absolute left-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:-10"}),(0,fe.jsx)($n,{className:"absolute right-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:10"})]})}var ue=$(ae());function uM({thumbnails:t}){return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(J5,{}),(0,ue.jsx)(mf,{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,ue.jsx)(er.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,ue.jsxs)(Yf,{children:[(0,ue.jsx)("div",{className:"flex-1"}),(0,ue.jsx)(er.Group,{className:"flex w-full items-center px-2",children:(0,ue.jsx)(lm,{thumbnails:t})}),(0,ue.jsxs)(er.Group,{className:"-mt-0.5 flex w-full items-center px-2 pb-2",children:[(0,ue.jsx)(Jf,{}),(0,ue.jsx)(em,{}),(0,ue.jsx)(om,{}),(0,ue.jsx)(cm,{}),(0,ue.jsx)(um,{}),(0,ue.jsx)("div",{className:"flex-1"}),(0,ue.jsx)(q$,{}),(0,ue.jsx)(V$,{}),(0,ue.jsx)(O$,{}),(0,ue.jsx)(tm,{}),(0,ue.jsx)(nm,{})]})]})})]})}function J5(){return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)($n,{className:"absolute inset-0 z-0 block h-full w-full",event:"pointerup",action:"toggle:paused"}),(0,ue.jsx)($n,{className:"absolute inset-0 z-0 block h-full w-full",event:"dblpointerup",action:"toggle:fullscreen"}),(0,ue.jsx)($n,{className:"absolute left-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:-10"}),(0,ue.jsx)($n,{className:"absolute right-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:10"})]})}var _M=$(z());var Mu=class{constructor(){w(this,"name","webview");w(this,"target")}canPlay({src:e}){return lu(e)&&hC(e)}mediaType(){return"video"}async load(e){return new Rn(this.target,e)}};var fn=$(z());function dm(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var dM=$(z());function pM(t,e){var n=(0,dM.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 fM=$(z());var hM=new WeakMap;function wb(t,e){var n=pM(e||null,function(i){return t.forEach(function(r){return dm(r,i)})});return fM.useLayoutEffect(function(){var i=hM.get(n);if(i){var r=new Set(i),s=new Set(t),a=n.current;r.forEach(function(o){s.has(o)||dm(o,null)}),s.forEach(function(o){r.has(o)||dm(o,a)})}hM.set(n,t)},[t]),n}function bb(t){return"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"}var mM=$(z()),xb={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 e4(t){return Object.entries(t).reduce((e,[n,i])=>(n in xb?e.event[n]=i:e.rest[n]=i,e),{event:{},rest:{}})}function gM(t,e){let{event:n,rest:i}=e4(t);for(let r of Object.keys(xb)){let s=r,a=xb[s],o=n[s];(0,mM.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 yM=$(ae()),vM=(0,fn.forwardRef)(function({devtools:e=!1,muted:n=!1,className:i,useragent:r,...s},a){let o=(0,fn.useRef)(null),[l,c]=(0,fn.useState)(!1),u=gM(s,o);n4(n,o,l);let d=t4(r??navigator.userAgent,o,l);return(0,fn.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,yM.jsx)("webview",{ref:wb([o,a]),className:In("h-full w-full",i),useragent:d,...u})});function t4(t,e,n){let i=(0,fn.useMemo)(()=>{let r=t??navigator.userAgent;return bb(r)},[t]);return(0,fn.useEffect)(()=>{!e.current||!n||i===e.current.useragent||e.current.setUserAgent(i)},[i,n,e]),i}function n4(t,e,n){(0,fn.useEffect)(()=>{!e.current||!n||t===e.current.isAudioMuted()||e.current.setAudioMuted(t)},[t,n,e])}var kb=$(ae());function wM({loaders:t,...e}){let n=Hf(l=>l.appId),i=ye("viewType"),r=Nt(l=>!!l.transform?.flipHorizontal),s=Nt(l=>!!l.transform?.flipVertical),a=Nt(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=Kf();return(0,kb.jsx)(qw,{className:In(i==="video"&&r&&"-scale-x-100",i==="video"&&s&&"-scale-y-100",i==="video"&&a),loaders:[Mu,...t??[]],buildMediaEl:(0,_M.useCallback)((l,c)=>l instanceof Mu?(0,kb.jsx)(vM,{"aria-hidden":!0,className:In("data-[play-ready]:blur-none blur-lg transition-opacity",o&&"pointer-events-none"),webpreferences:"autoplayPolicy=user-gesture-required",partition:ai(n),ref:u=>{c.load(u)}}):null,[n,o]),...e})}var ri=$(ae()),kM=$(z());function i4({onViewTypeChange:t}){return a$(t),GC(),o$(),(0,ri.jsx)(ri.Fragment,{})}function r4(){let t=ye("viewType"),e=Kf();return t==="audio"?(0,ri.jsx)(cM,{}):e?(0,ri.jsx)(uM,{}):null}function Wr(){let t=Nt(u=>u.playerRef),e=Nt(({source:u})=>{if(!u)return;let d=u.url.source.href;return u.enableWebview?{src:dC(d)}:{type:u.type,src:d}}),n=Nt(({textTracks:u})=>u),i=Fs(u=>u.loadStrategy),r=co(),[s,a]=(0,xM.useState)("unknown"),o=Nt(u=>u.title),{controls:l,...c}=ub();return e?(0,ri.jsxs)(jw,{className:In("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:r?i:"eager",src:e,playsInline:!0,title:o,viewType:s,ref:t,onError:u=>{new bM.Notice(createFragment(d=>{switch(d.appendText(`Failed to load media for ${e.src}: `),d.createEl("br"),u.code){case 1:d.appendText("The media playback was aborted");break;case 2:d.appendText("A network error caused the media playback to fail");break;case 3:d.appendText("The media playback was aborted due to a corruption problem or because the media encoding is not supported");break;case 4:d.appendText("The media is not supported to open as regular video or audio, try open as webpage");break;default:d.appendText(u.message||"Unknown error, check console for more details"),console.error("Failed to load media",e.src,u);break}}))},...c,children:[(0,ri.jsx)(wM,{children:n.map(u=>(0,kM.createElement)(Hw,{...u,key:u.id}))}),(0,ri.jsx)(i4,{onViewTypeChange:a}),(0,ri.jsx)(r4,{})]}):null}function pm(t,e){let n=new WeakMap,i;t.register(wu(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(a4(t,(r,s)=>{e(),n.has(s)?i=s:i=void 0})),t.register(()=>{i=void 0})}function hm(t,e){let n=new WeakMap,i;t.register(wu(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(s4(t.containerEl,(r,s)=>{e(),n.has(s)?i=s:i=void 0})),t.register(()=>{i=void 0})}function s4(t,e){let n=t.win;return t.onNodeInserted(()=>{let i=t.win;i!==n&&(e(i,n),n=i)})}function a4(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 Eb=$(ae()),fm=class extends mm.EditableFileView{constructor(n,i){super(n);this.plugin=i;w(this,"allowNoFile",!1);w(this,"store");w(this,"scope");w(this,"root",null);this.store=Fr(),this.scope=new mm.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Uf(this)}onload(){hm(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),jf(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=EM.default.createRoot(this.contentEl),this.root.render((0,Eb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!1},children:(0,Eb.jsx)(Wr,{})}))}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}},vo=class extends fm{getIcon(){return"file-video"}getMediaInfo(){return this.file?{type:"video",file:this.file,hash:this.getEphemeralState().subpath}:null}getViewType(){return jn.video}canAcceptExtension(e){return kt.video.includes(e)}},yo=class extends fm{getIcon(){return"file-audio"}getViewType(){return jn.audio}getMediaInfo(){return this.file?{type:"audio",file:this.file,hash:this.getEphemeralState().subpath}:null}canAcceptExtension(e){return kt.audio.includes(e)}};var gm=require("obsidian"),TM=$(Ol());var Tb=$(ae()),Kr=class extends gm.ItemView{constructor(n,i){super(n);this.plugin=i;w(this,"store");w(this,"scope");w(this,"root",null);w(this,"navigation",!0);this.store=Fr(),this.scope=new gm.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Uf(this)}setSource(n){this.store.getState().setSource(n)}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(ut(this.leaf,{detach:i=>function(...r){return n.root?.unmount(),n.root=null,i.call(this,...r)}})),hm(this,()=>this.render())}registerRemoteTitleChange(){this.register(wu(this.store,n=>n.subscribe(({title:i})=>{this.updateTitle()})))}onPaneMenu(n,i){super.onPaneMenu(n,i),jf(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=TM.default.createRoot(this.contentEl),this.root.render((0,Tb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!1},children:(0,Tb.jsx)(Wr,{})}))}close(){return this.root?.unmount(),this.root=null,super.close()}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}};var o4={"video/vimeo":"Vimeo","video/youtube":"YouTube"},_o=class extends Kr{onload(){super.onload(),this.registerRemoteTitleChange(),pm(this,()=>this.render())}getDisplayText(){let e=o4[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 Mi}};var vm=class extends Kr{},wo=class extends vm{getIcon(){return"file-video"}getViewType(){return pt.video}getDisplayText(){return this.playerTitle||"Video"}async setSource(e){let n=this.plugin.settings.getState().getDefaultLang(),i=await If(e,n).catch(r=>(console.error("Failed to get text tracks",r,e.href,n),[]));this.store.getState().setSource(e,{title:!0,textTracks:i,type:"video/mp4"})}},bo=class extends vm{getIcon(){return"file-audio"}getDisplayText(){return this.playerTitle||"Audio"}getViewType(){return pt.audio}async setSource(e){this.store.getState().setSource(e,{title:!0,type:"audio/mp3"})}};var xo=class extends Kr{onload(){super.onload(),this.registerRemoteTitleChange(),pm(this,()=>this.render())}getViewType(){return Zt}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} - ${Gu[this.getHost()]}`:"Webpage"}setSource(e){this.store.getState().setSource(e,{enableWebview:!0})}};function SM(t,e){if(!(t.view instanceof vo||t.view instanceof yo))return!1;let{file:n}=t.view.getState();return n===e.file.path}function PM(t,e){if(!(t.view instanceof _o||t.view instanceof xo||t.view instanceof wo||t.view instanceof bo))return!1;let{source:n}=t.view.store.getState();return e.compare(n?.url)}function Sb(t,e){let n=t.stat.mtime,i=e.stat.mtime;return!n||!i?0:i-n}var ym="mx-media-active",Ru,Pb,wm,$M,bm,MM,xm,RM,_m=class extends ko.Component{constructor(n){super();this.plugin=n;O(this,Ru);O(this,wm);O(this,bm);O(this,xm);w(this,"app");w(this,"activeMediaLeaf",null);w(this,"onLeafUpdate",(0,ko.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(ym),this.activeMediaLeaf?.containerEl.removeClass(ym),n?.tabHeaderEl.addClass(ym),n?.containerEl.addClass(ym),this.activeMediaLeaf=n}detectActiveMediaLeaf(n){let i=()=>{let r=this.findPinnedPlayer();if(r)return r;let s=CM(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(Cb(n))return n;if(n.view instanceof ko.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=l4(n,i,this.workspace);if(r.length>0)return r[0]}return null}findPinnedPlayer(){return CM(this.workspace).filter(n=>n.pinned)[0]??null}get settings(){return this.plugin.settings.getState()}getSplitBehavior(n){let{defaultMxLinkClick:{click:i,alt:r}}=this.settings;return i===null?n??!1:n===void 0||n===!1?i:r!==null&&n===i?r:n}async openMedia(n,i,{direction:r,viewType:s,fromUser:a}={}){let{workspace:o}=this.app;if(!i){let c=await M(this,wm,$M).call(this,n,s);if(c)return c}let l=o.getLeaf(a?this.getSplitBehavior(i):i,r);return M(this,Ru,Pb).call(this,l,n,s)}async openNote(n,i,r="split",s="vertical"){let a=this.plugin.mediaNote.findNotes(n),o=M(this,bm,MM).call(this,a);if(o)return o.getMode()!=="source"&&await o.setState({mode:"source"},{history:!1}),o;let l;if(a.length===0){let u=`Media Note - ${i.title}`;l=await M(this,xm,RM).call(this,u,i.fm,i.sourcePath??"")}else l=a.sort(Sb).at(0);let c=this.app.workspace.getLeaf(r,s);return await c.openFile(l,{state:{mode:"source"}}),{file:l,editor:c.view.editor}}};Ru=new WeakSet,Pb=async function(n,i,r){if($i(i))await n.openFile(i.file,{eState:{subpath:i.hash},active:!0});else{let s={source:i.jsonState.source};r??(r=this.plugin.urlViewType.getPreferred(i)),await n.setViewState({type:r,state:s,active:!0},{subpath:i.hash})}return n},wm=new WeakSet,$M=async function(n,i){let r=this.findPinnedPlayer();if(r)return await M(this,Ru,Pb).call(this,r,n,i);let s=this.findPlayerWithSameMedia(n);return s?(c4(n.hash,s),s):null},bm=new WeakSet,MM=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)=>Sb(a.view.file,o.view.file)).at(0)).view},xm=new WeakSet,RM=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 CM(t){let e=[];return t.iterateAllLeaves(n=>{ag(n.view.getViewType())&&e.push(n)}),e.sort(LM),e}function l4(t,e,n){let i=n.getLeavesOfType(e).filter(r=>$i(t)?SM(r,t):PM(r,t));return i.sort(LM),i}function Cb(t){return!!t&&ag(t.view.getViewType())}function LM(t,e){return e.activeTime-t.activeTime}function c4(t,e){e.setEphemeralState({subpath:t})}function u4(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 IM.MarkdownView&&r.inlineTitleEl.isActiveElement()?void 0:e(i,r.editor,r)}}function Lu({playerCheckCallback:t,noteCheckCallback:e,...n},i){let{app:r}=i,s=i.addCommand({...n,checkCallback:u4(t&&(a=>!t||!Cb(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}var d4=[{id:"toggle-play",label:"Play/pause",icon:"play",action:t=>{t.paused=!t.paused}},...[5,30].flatMap(t=>[{id:`forward-${t}s`,label:`Forward ${t}s`,icon:"forward",action:e=>{e.currentTime+=t},repeat:!0},{id:`rewind-${t}s`,label:`Rewind ${t}s`,icon:"rewind",action:e=>{e.currentTime-=t},repeat:!0}]),{id:"toggle-mute",label:"Mute/unmute",icon:"volume-x",action:t=>{t.muted=!t.muted}},{id:"toggle-fullscreen",label:"Enter/exit fullscreen",icon:"expand",check:t=>t.state.canFullscreen,action:t=>{t.state.fullscreen?t.exitFullscreen():t.enterFullscreen()}},...p4()];function p4(){let t=null,e=(0,Iu.debounce)(()=>t?.hide(),2e3,!0);function n(r){!t||t.noticeEl.isConnected===!1?t=new Iu.Notice(r,0):t.setMessage(r),e()}function i(r){new Iu.Notice(r,2e3)}return[{id:"reset-speed",label:"Reset playback speed",icon:"reset",check:r=>r.state.playbackRate!==1,action:r=>{r.playbackRate=1,i("Speed reset to 1x")}},{id:"increase-speed",label:"Increase playback speed",icon:"arrow-up",action:r=>{let s=r.playbackRate;if(s>=ar.last()){i("Cannot increase speed further");return}let a=ar.find(o=>o>s);r.playbackRate=a,n(`Speed increased to ${a}x`)}},{id:"decrease-speed",label:"Decrease playback speed",icon:"arrow-down",action:r=>{let s=r.playbackRate;if(s<=ar.first()){i("Cannot decrease speed further");return}let a=ar.slice().reverse().find(o=>o<s);r.playbackRate=a,n(`Speed decreased to ${a}x`)}},{id:"set-speed",label:"Set playback speed",icon:"gauge",action:async r=>{let s=await Qs.run();s&&(r.playbackRate=s,n(`Speed set to ${s}x`))}}]}function AM(t){d4.forEach(({id:e,label:n,icon:i,action:r,repeat:s,check:a})=>{Lu({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)})}function NM(t){Lu({id:"take-timestamp",name:"Take timestamp",icon:"star",menu:!0,section:"selection-link",...e(async(n,i)=>{i.from==="player"&&lo("timestamp"),await Ff(n,i)})},t),Lu({id:"save-screenshot",name:"Save screenshot",icon:"camera",section:"selection-link",menu:!0,...e(async(n,i)=>{i.from==="player"&&lo("screenshot"),await Vf(n,i)})},t);function e(n){return{playerCheckCallback:(i,r)=>{let s=r.getMediaInfo();if(!s)return!1;if(i)return!0;vu(s,r).then(a=>n(r,{...a,from:"player"}))},noteCheckCallback:(i,r,{isMediaNote:s,...a})=>{let o;if(r){if(i)return!0;t.app.workspace.revealLeaf(r.leaf),o=Promise.resolve(r)}else{if(!s)return!1;if(i)return!0;o=t.leafOpener.openMedia(s,void 0,{fromUser:!0}).then(l=>l.view)}o.then(l=>n(l,{...a,from:"note"}))}}}}function OM(){this.registerEvent(this.app.workspace.on("file-menu",(t,e,n,i)=>{if(!(e instanceof DM.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})))})),NM(this),AM(this)}var An=require("obsidian");function Eo(t,e){return!!(t.type!=="generic"||t.inferredType||t.tempFrag||e.mediaNote.findNotes(t).length>0||e.urlViewType.getPreferred(t,!0))}var $b=async function(t,e,n){let i=this.resolveUrl(t);if(!i||!Eo(i,this)){n();return}await this.leafOpener.openMedia(i,e,{fromUser:!0})},VM={"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"}};async function h4(t){if(!An.Platform.isDesktopApp)return;let e=window.electron;if(!e)return;await(An.Platform.isMacOS?e.remote.shell:e.shell).showItemInFolder(t)}async function f4(t){if(!An.Platform.isDesktopApp)return;let e=window.electron;if(!e)return;let i=await(An.Platform.isMacOS?e.remote.shell:e.shell).openPath(t);if(i)throw new Error(i)}function FM(t){t.registerEvent(t.app.workspace.on("url-menu",(e,n)=>{let i=t.resolveUrl(n);if(!i)return;if(An.Platform.isDesktopApp&&i.isFileUrl&&i.filePath){let h=i.filePath;e.addItem(y=>y.setIcon("folder").setTitle(An.Platform.isMacOS?"Reveal in Finder":"Show in system explorer").onClick(()=>{h4(h).catch(v=>{new An.Notice(`Failed to open file in file explorer: ${v.message}`),console.error("Failed to open file in file explorer",v)})})).addItem(y=>y.setIcon("arrow-up-right").setTitle("Open in system player").onClick(()=>{f4(h).catch(v=>{new An.Notice(`Failed to open file in system player: ${v.message}`),console.error("Failed to open file in system player",v)})}))}let{protocol:r,hostname:s,pathname:a,host:o,port:l}=i,c=t.urlViewType.getSupported(i),u=t.urlViewType.getPreferred(i),d=Eo(i,t)?c.filter(h=>h!==u):c;if(d.length===0)return;function p(h,y,v=!1){let _=VM[y].label;return h.setTitle(v?_:`Open as ${_}`).setIcon(VM[y].icon)}d.forEach(h=>{e.addItem(y=>p(y,h).setSection("mx-link").onClick(async()=>{await t.leafOpener.openMedia(i,void 0,{viewType:h,fromUser:!0})}))}),e.addItem(h=>{let y=h.setTitle("Always open this url as").setIcon("external-link").setSection("mx-link").setSubmenu();d.forEach(v=>{y.addItem(_=>p(_,v,!0).setSection("mx-link").onClick(async()=>{t.urlViewType.setPreferred({protocol:r,hostname:s,pathname:a,port:l},v),await t.leafOpener.openMedia(i,void 0,{viewType:v,fromUser:!0})}))})}),s&&e.addItem(h=>{let y=h.setTitle(`Always open ${o} as`).setIcon("external-link").setSection("mx-link").setSubmenu();d.forEach(v=>{y.addItem(_=>p(_,v,!0).setSection("mx-link").onClick(async()=>{t.urlViewType.setPreferred({protocol:r,hostname:s,port:l},v),await t.leafOpener.openMedia(i,void 0,{viewType:v,fromUser:!0})}))})})}))}var zM=async function(t,e,n,i){let{metadataCache:r}=this.app,{path:s,subpath:a}=(0,An.parseLinktext)(t),o=r.getFirstLinkpathDest(s,e),l;if(!o||!(l=Xt(o.extension))){i();return}let c={file:o,hash:a,type:l,viewType:jn[l]};await this.leafOpener.openMedia(c,n,{fromUser:!0})};var Gr=require("obsidian");var Em=class extends Gr.Component{constructor(n){super();this.plugin=n;w(this,"app");w(this,"noteToMediaIndex",new Map);w(this,"mediaToNoteIndex",new Map);this.app=n.app}findNotes(n){let i=this.mediaToNoteIndex.get(km(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 g4(n))this.addMediaNote(r,i);this.registerEvent(this.app.metadataCache.on("changed",i=>{let r=jM(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=km(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(km(n));r?r.add(i):this.mediaToNoteIndex.set(km(n),new Set([i]))}onload(){m4(this.app.metadataCache,this).then(()=>{this.onResolve()})}};function m4(t,e){return t.initialized?Promise.resolve():new Promise(n=>{let i=t.on("initialized",()=>{t.offref(i),n()});e?.registerEvent(i)})}function*UM(t){for(let e of t.children)e instanceof Gr.TFolder?yield*UM(e):e instanceof Gr.TFile&&(yield e)}function*g4(t){for(let e of UM(t.vault.getRoot())){if(e.extension!=="md")continue;let n=jM(e,t);n&&(yield{mediaInfo:n,file:e})}}var Mb={generic:"media",video:"video",audio:"audio"};function jM(t,{metadataCache:e,plugin:n}){let i=e.getFileCache(t);if(!i)return null;let r={metadataCache:e,sourcePath:t.path,plugin:n};return Rb(Mb.video,i,r)??Rb(Mb.audio,i,r)??Rb(Mb.generic,i,r)}function Rb(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,Gr.parseLinktext)(s.link),c=n.metadataCache.getFirstLinkpathDest(o,n.sourcePath);if(!c)return null;let u=Xt(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 km(t){return $i(t)?`file:${t.file.path}`:`url:${t.jsonState.source}`}var qM=require("obsidian"),HM=$(Ol());var Lb=$(ae()),Tm=class extends qM.Component{constructor(n,i,r,s){super();this.info=n;this.file=i;this.subpath=r;this.plugin=s;w(this,"store");w(this,"root",null);w(this,"containerEl");this.containerEl=n.containerEl,this.store=Fr();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(Hr):!1}this.registerDomEvent(a,"click",l=>{o(l.target)||l.stopImmediatePropagation()})}getMediaInfo(){if(!this.file)return null;let n=Xt(this.file.extension);return n?{type:n,file:this.file,hash:this.subpath}:null}render(){this.root?.unmount(),this.root=HM.default.createRoot(this.info.containerEl),this.root.render((0,Lb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!0},children:(0,Lb.jsx)(Wr,{})}))}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 BM(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 WM(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 KM(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"})}))}function GM(t,{source:e}){e.isFileUrl||t.addItem(n=>n.setTitle("Open in browser").setIcon("globe").setSection("view").onClick(()=>{window.open(e.href)}))}function YM(t,{controls:e=!0,toggleControls:n,player:i,source:r,disableWebFullscreen:s,toggleWebFullscreen:a},o){i.provider instanceof Rn&&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 Ib(){FM(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(i=>i.setTitle("Refresh").setSection("view").setIcon("reset").onClick(()=>{e.reload()})),n!=="sidebar-context-menu"&&n!=="tab-header"?(t.addItem(i=>Cx(i,e.player)),e.player.state.viewType==="video"&&(t.addItem(i=>KM(i,e)),WM(t,e.player))):BM(t,e.player),n==="player-menu-embed"){let i=e.source;t.addItem(r=>r.setTitle("Open to the right").setIcon("separator-vertical").setSection("view").onClick(()=>{this.leafOpener.openMedia(i,"split")})).addItem(r=>r.setTitle("Open in new tab").setSection("view").setIcon("file-plus").onClick(()=>{this.leafOpener.openMedia(i,"tab")})).addItem(r=>r.setTitle("Open in new window").setSection("view").setIcon("maximize").onClick(()=>{this.leafOpener.openMedia(i,"window")}))}YM(t,e,n),(n==="player-menu-embed"||n==="more-options")&&GM(t,e)}))}var v4=/^(?<x>\d+)?x(?<y>\d+)$|^(?<xOnly>\d+)$/;function QM(t){let e=parseInt(t,10);return Number.isNaN(e)?-1:e}var Au=t=>{let e=t?.match(v4)?.groups;if(!e)return null;let n=QM(e.xOnly??e.x),i=QM(e.y);return[n,i]},Ab=t=>{let e=t.lastIndexOf("|"),n,i=t;return e===-1?(n=Au(t),n&&(i="")):(n=Au(i.substring(e+1)),n&&(i=i.substring(0,e))),[i,n]};var XM=require("obsidian"),ZM=$(Ol());var Nb=$(ae()),To=class extends XM.MarkdownRenderChild{constructor(n,i){super(n);this.containerEl=n;this.plugin=i;w(this,"store");w(this,"root",null);this.store=Fr(),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,enableWebview:r===Zt,type:r===pt.video?"video/mp4":r===pt.audio?"audio/mp3":void 0,textTracks:r===pt.video?await If(n,s).catch(a=>(console.error("Failed to get text tracks",a,n.href,s),[])):[]})}render(){this.root?.unmount(),this.root=ZM.default.createRoot(this.containerEl),this.root.render((0,Nb.jsx)(wt.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!0},children:(0,Nb.jsx)(Wr,{})}))}onload(){super.onload(),this.render()}onunload(){this.root?.unmount(),this.root=null,super.onunload()}};var iR=require("@codemirror/state"),So=require("@codemirror/view"),Po=require("obsidian");var Sm=require("@codemirror/language"),Ub=require("@codemirror/view");var JM=t=>!(!t.startsWith("./")&&!t.startsWith("../"))||t.indexOf(":")===-1;var eR=require("@codemirror/view"),tR=require("obsidian");var Db=class extends To{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(Hr):!1}this.registerDomEvent(n,"click",s=>{r(s.target)||s.stopImmediatePropagation()})}},js=class extends eR.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 tR.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 Db(i,this.plugin);r.setSource(this.media),r.load(),this.hookClickHandler(n,i),this.setInfo(i,r),this.resizeWidget(n,i)}applyTitle(n){if(!this.title){n.removeAttribute("alt"),n.style.removeProperty("width"),n.style.removeProperty("height");return}let i=this.title.lastIndexOf("|"),r,s=this.title;i===-1?(r=Au(this.title),r&&(s="")):(r=Au(s.substring(i+1)),r&&(s=s.substring(0,i))),s?n.setAttr("alt",s):n.removeAttribute("alt");let a=(o,l)=>{l<0?n.style.removeProperty(o):n.style[o]=`${l}px`};r?(a("width",r[0]),a("height",r[1])):(a("width",-1),a("height",-1))}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(js.prototype,"estimatedHeight",{get:()=>100,enumerable:!1,configurable:!0});var Ob=class extends js{constructor(){super(...arguments);w(this,"enableWebview",!1)}},Vb=class extends js{constructor(){super(...arguments);w(this,"enableWebview",!1)}},Fb=class extends js{constructor(){super(...arguments);w(this,"enableWebview",!1)}},zb=class extends js{constructor(){super(...arguments);w(this,"enableWebview",!0)}},nR={"mx-url-audio":Vb,"mx-url-video":Ob,"mx-embed":Fb,"mx-webpage":zb};var y4=(t,e,n,i,r)=>{let s=e.doc,a=!1,o="",l="",c=-1;(0,Sm.syntaxTree)(e).iterate({from:i,to:r,enter:({type:d,from:p,to:h})=>{let y=new Set(d.prop(Sm.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(JM(l))return;let v=t.resolveUrl(l);if(v&&Eo(v,t)){let _=t.urlViewType.getPreferred(v),m=new nR[_](t,v,o,c,h);u(m,c,h)}a=!1,l="",o="",c=-1}}}});function u(d,p,h){let{from:v,text:_}=s.lineAt(p);_.substring(0,p-v).trim()===""&&_.substring(h-v).trim()===""?n.push(Ub.Decoration.widget({widget:d,block:!0,side:-1}).range(v)):n.push(Ub.Decoration.widget({widget:d,side:-1}).range(p))}},jb=y4;var _4=(t,e)=>Pm(t,e[0])||Pm(t,e[1]),Pm=(t,e)=>t[0]<e&&t[1]>e,w4=(t,e)=>{let n=Pm(t,e[0])?t[0]:e[0],i=Pm(t,e[1])?t[1]:e[1];return[n,i]};function qb(t){return t.sort((e,n)=>e[0]-n[0]).reduce((e,n)=>{let i=e.findIndex(r=>_4(r,n));return i!==-1?e[i]=w4(e[i],n):e.push(n),e},[])}var b4=t=>{let e=n=>{if(n.field(Po.editorLivePreviewField)){let i=[];return jb(t,n,i),So.Decoration.set(i)}else return So.Decoration.none};return iR.StateField.define({create:e,update:(n,i)=>{let r=i.startState.field(Po.editorLivePreviewField),s=i.state.field(Po.editorLivePreviewField);if(r!==s)return e(i.state);if(!s)return So.Decoration.none;if(!i.docChanged)return n;if(i.state.field(Po.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 qb(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}),jb(t,i.state,o,u,d)}return n.update({add:o,sort:!0})},provide:n=>So.EditorView.decorations.from(n)})},rR=b4;function Hb(t){t.registerEditorExtension(rR(t)),k4(t)}var x4=["cm-line","cm-content"],sR="mxError";function aR(t){if(!t.parentElement)return!1;let e=t.parentElement;return x4.some(n=>e.classList.contains(n))}function oR(){aR(this)&&(this.dataset[sR]="",this.removeEventListener("load",lR))}function lR(){aR(this)&&(delete this.dataset[sR],this.removeEventListener("error",oR))}function k4(t){t.register(ut(window,{createEl:e=>function(){let n=e.apply(this,arguments);return n instanceof HTMLImageElement&&(n.addEventListener("error",oR,{once:!0}),n.addEventListener("load",lR,{once:!0})),n}}))}var E4=require("obsidian");function cR(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 Cm(t){return t.constructor.prototype}function Bb(t){t.getLeavesOfType("markdown").forEach(async e=>{let n=e.getViewState();await e.setViewState({type:"empty"}),await e.setViewState(n)})}function Kb(t){T4.call(this,t),S4.call(this),Hb(this)}function T4(t){let{app:e}=this;["video","audio"].forEach(r=>{let s=kt[r],a=i(s),o=n(s,t);this.register(()=>{o(),a()})}),Bb(e.workspace),this.register(()=>{Bb(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 Wb=class extends To{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)}};function S4(){let t=this;this.registerMarkdownPostProcessor((e,n)=>{for(let r of e.querySelectorAll("img")){let s=P4(r);s&&i(s,r)}for(let r of e.querySelectorAll('iframe[src*="youtube.com/embed/"]')){let s=n.getSectionInfo(r)?.text,a=C4(s)??$4(r);!a||!this.resolveUrl(a.url)||i(a,r)}function i({title:r,url:s},a){let o=t.resolveUrl(s);if(!o||!Eo(o,t))return;let l=createSpan({cls:["media-embed","external-embed","is-loaded"],attr:{src:o.href,alt:r}});a.replaceWith(l),n.addChild(new Wb(o,l,t))}})}function P4(t){let e=t.alt,n=t.src;if(!n)return null;let[i,r]=Ab(e);return{url:n,title:i,size:r}}function C4(t){if(!t)return null;let e=t.match(/!\[(?<alt>[^\]]*)\]\((?<src>[^)]+)\)/);if(!e)return null;let{alt:n,src:i}=e.groups;if(!i)return null;let[r,s]=Ab(n);return{url:i,title:r,size:s}}function $4(t){console.warn("cannot get source text of iframe, use src instead");let e=t.src;return e?{url:e,title:zf(e),size:null}:null}var uR=require("obsidian");function $m(t){let e=uR.Keymap.isModEvent(t);return Nu(e)}function Nu(t){return t===!0?"tab":t}function Gb({onExternalLinkClick:t}){let e=this;return cR("markdown",e).then(n=>{if(!n.editMode){console.error("MarkdownView.editMode is not available, cannot patch editor click");return}e.register(ut(Cm(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,Nu(s),o)}catch(l){console.error("onExternalLinkClick error in editor, fallback to default",l),o()}else o()}})),console.debug("editor click patched")})}var dR=require("obsidian");function Yb(){let t=n=>{let i=n.target;if(!i.instanceOf(HTMLElement)||!i.matches(".metadata-link-inner.external-link"))return;let r=this.resolveUrl(i.textContent);r&&(n.stopImmediatePropagation(),this.leafOpener.openMedia(r,$m(n),{fromUser:!0}))},e=ut(dR.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))})}function Qb({onInternalLinkClick:t}){let e=this;this.register(ut(this.app.workspace,{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,Nu(s),l)}catch(c){console.error("onInternalLinkClick error in openLinktext, fallback to default",c),l()}}}))}function Xb(){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 pR=require("obsidian");function Zb(t){let e=this,n=ut(pR.MarkdownPreviewRenderer,{registerDomEvents:i=>function(r,s,...a){return M4(s,t,e),n(),console.debug("preview click patched"),i.call(this,r,s,...a)}});e.register(n)}function M4(t,{onExternalLinkClick:e},n){n.register(ut(Cm(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,$m(r),l)}catch(c){console.error("onExternalLinkClick error in preview, fallback to default",c),l()}}}))}function Jb(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),()=>{R4(a,"type").forEach((o,l)=>{l&&i.viewRegistry.registerExtensions(o.map(c=>c.ext),l)})}}}function R4(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 hR=require("obsidian");function fR(t){return t?(t=t instanceof URL?t:Un(t),hR.Platform.isWin||!t||t.protocol!=="file:"||!t.pathname.includes("%5C")||(t.pathname=t.pathname.replaceAll(/%5C/g,"/")),t):null}var kR=$(Rm()),nt=require("obsidian");var gR=()=>(...t)=>t;var vR=require("obsidian");var yR={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 ex(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 _R=gR()("defaultVolume","urlMappingData","devices","defaultMxLinkClick","linkHandler","loadStrategy","timestampTemplate","screenshotTemplate","screenshotEmbedTemplate","insertBefore","timestampOffset","biliDefaultQuality","screenshotFormat","screenshotQuality","defaultLanguage"),wR={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 bR(){return nt.Platform.isDesktopApp?require("os").hostname()||(nt.Platform.isMacOS?"Mac":nt.Platform.isWin?"Windows":nt.Platform.isLinux?"Linux":"Desktop"):nt.Platform.isIosApp?nt.Platform.isPhone?"iPhone":nt.Platform.isTablet?"iPad":"iOS Device":nt.Platform.isAndroidApp?nt.Platform.isPhone?"Android Phone":nt.Platform.isTablet?"Android Tablet":"Android Device":"Unknown Device"}function xR(t){return new Map(t.map(e=>[`${e.appId}%${e.protocol}`,e.replace]))}function L4(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 ER(t){let e=(0,nt.debounce)(n=>{let i=ig(n,_R);t.saveData({...i,urlMappingData:n.getUrlMappingData()})},1e3);return _p((n,i)=>({...Ku(wR,["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=nt.moment.locale();return r&&!nb(r)?(new nt.Notice(`Invalid language code detected in preferences: ${r}, reverting to ${s}.`),n({defaultLanguage:void 0}),e(i()),s):r??nt.moment.locale()},getUrlMappingData(){return L4(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"||!I4(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"?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,kR.assertNever)(r)}e(i())},setMxLinkAltBehavior:r=>{n(({defaultMxLinkClick:s})=>({defaultMxLinkClick:{...s,alt:r}})),e(i())},urlMapping:xR(wR.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:bR()}]})),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?bR():"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())},load:async()=>{let r=await t.loadData();if(!r)return;let{urlMappingData:s,...a}=ig(r,_R);n({...a,urlMapping:xR(s??[])})},save:()=>{e(i())}}))}function I4(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 PR=require("url"),nx=$(eb()),ne=require("obsidian");var Im=class extends ne.PluginSettingTab{constructor(n){super(n.app,n);w(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 ne.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 ne.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 ne.Menu().addItem(c=>c.setIcon("link").setTitle("Link mapping").onClick(()=>{let u=r({protocol:"",replace:"https://"});i.insertAdjacentElement("afterbegin",u.settingEl)}));ne.Platform.isDesktopApp&&l.addItem(c=>c.setIcon("folder").setTitle("Folder mapping").onClick(async()=>{let u=(await Yu().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,PR.pathToFileURL)(u).href});i.insertAdjacentElement("afterbegin",d.settingEl)})),Gs(o.extraSettingsEl,l)}));let i=n.createDiv({cls:"mx-protocol-list"}),r=o=>new ne.Setting(i).then(l=>{let c=o.protocol,u=new ne.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 ne.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 ne.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 side",tab:"New tab",window:"New window"},r=c=>{switch(c){case"split":return ne.Platform.isMacOS?"click holding \u2318+\u2325":"click holding Ctrl+Alt";case"tab":return ne.Platform.isMacOS?"click holding \u2318 or middle-click":"middle-click or click holding Ctrl";case"window":return ne.Platform.isMacOS?"click holding \u2318+\u2325+\u21E7":"click holding Ctrl+Alt+Shift";default:return""}},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;default:return null}};new ne.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 ne.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){o.settingEl.style.display=c?"":"none";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 ne.Setting(n).setHeading().setName("Playback"),new ne.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(Lm(this.state.defaultVolume)).onChange(TR(this.state.setDefaultVolume)).then(o=>{tx.call(o,0,100,1),o.inputEl.type="number",o.inputEl.style.textAlign="center",this.sub((l,c)=>{l.defaultVolume!==c.defaultVolume&&o.setValue(Lm(l.defaultVolume))})})).then(a=>a.controlEl.appendText("%")),new ne.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=SC(),s=Object.fromEntries(nx.default.getAllCodes().flatMap(a=>r.has(a)?[...r.get(a).values()]:[[a,nx.default.getNativeName(a)]]));new ne.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 ne.Setting(n).setHeading().setName("Timestamp"),new ne.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 ne.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(Lm(this.state.timestampOffset)).onChange(SR(this.state.setTimestampOffset)).then(r=>{tx.call(r,-10,10,.01),r.inputEl.type="number",r.inputEl.style.textAlign="center",this.sub((s,a)=>{s.timestampOffset!==a.timestampOffset&&r.setValue(Lm(s.timestampOffset))})})).then(i=>i.controlEl.appendText("s"))}screenshot(){let{containerEl:n}=this;new ne.Setting(n).setHeading().setName("Screenshot"),new ne.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 ne.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 ne.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)));let i=r=>r.screenshotFormat==="image/webp"?.8:.92;new ne.Setting(n).setName("Screenshot quality").setDesc("Quality of the screenshot").addText(r=>r.setValue(this.state.screenshotQuality?.toString()??"").setPlaceholder(i(this.state).toString()).onChange(SR(this.state.setScreenshotQuality)).then(s=>{tx.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 ne.Setting(n).setHeading().setName("Note taking"),new ne.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(!ne.Platform.isDesktopApp)return;let{containerEl:n}=this;new ne.Setting(n).setHeading().setName("Webpage"),new ne.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 Ys(this.app).open()}))}bilibili(){let{containerEl:n}=this;new ne.Setting(n).setHeading().setName("Bilibili"),new ne.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(yR).setValue(this.state.biliDefaultQuality.toString()).onChange(TR(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 TR(t){return e=>t(parseInt(e,10))}function SR(t){return e=>t(parseFloat(e))}function Lm(t){return t.toString()}function tx(t,e,n){return this.inputEl.min=t.toString(),this.inputEl.max=e.toString(),this.inputEl.step=n.toString(),this}var LR=require("url"),rx=$(Rm()),Se=require("obsidian");var CR=require("obsidian");async function ix(t){if(!CR.Platform.isDesktopApp)throw new Error("Not supported in web");let e=await Yu().showOpenDialog({title:"Pick a media file",message:"Pick a media file to open",buttonLabel:"Pick",properties:["openFile"],filters:[{extensions:kt.video,name:"Video"},{extensions:kt.audio,name:"Audio"}],defaultPath:t});return e.canceled?null:e.filePaths[0]??null}var $R=require("url"),MR=require("obsidian");var Am=class t extends MR.FuzzySuggestModal{constructor(n){super(n.app);this.plugin=n;w(this,"resolve",Fl)}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,$R.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 A4=/^av(?<id>\d+)$/i,N4=/^BV1(?<id>[1-9A-HJ-NP-Za-km-z]{9})$/,D4=/^[\w-]{11}$/,O4=/^(?:(?:[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 sx(t){try{return(0,LR.pathToFileURL)(t)}catch(e){return console.error(`Failed to convert path ${t} to URL: `,e),null}}function RR(t){let e=xi.isAbsolute(t)?sx(t):Un(t);return!e||["http:","https:"].includes(e.protocol)&&!O4.test(e.hostname)?null:e}var Nm=class extends Se.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=>Xt(xi.extname(l.name)));if(s.length===0){new Se.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:Se.Platform.isMacOS?"\u2318 \u21B5":"ctrl \u21B5",purpose:"to open in new tab"},{command:Se.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=RR(n),r=[];if(!i){let o;if((o=n.match(A4))&&r.push(new URL(`https://www.bilibili.com/video/av${o.groups.id}`)),(o=n.match(N4))&&r.push(new URL(`https://www.bilibili.com/video/${n}`)),(o=n.match(D4))&&r.push(new URL(`https://www.youtube.com/watch?v=${n}`)),!o){let l=RR(`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,rx.assertNever)(n)}async onChooseSuggestion(n,i){let r;if(n==="file-protocol-picker"){let a=await Am.choose(this.plugin);if(!a)return;let o=await ix(a.path);if(!o)return;if(!o.startsWith(a.path)){new Se.Notice(`For protocol ${a.action}, the file must be in ${a.path}`);return}let l=sx(o);if(!l)return;let c=this.plugin.resolveUrl(l.href.replace(a.url.replace(/\/*$/,"/"),`mx://${a.action}/`));if(!c){new Se.Notice(`Failed to resolve file protocol url: ${l.href} with ${a.url}`);return}r=c}else if(n==="file-picker"){let a=await ix();if(!a)return;let o=sx(a);if(!o)return;r=new _t(o.href)}else n instanceof _t?r=n:(0,rx.assertNever)(n);if(r.isFileUrl){if(!r.inferredType){new Se.Notice("Unsupported file type: "+r.pathname);return}if(r.hostname){new Se.Notice(`Network path is not supported in obsidian, you need to map it to a local path: ${r.filePath??r.href}`);return}}let s=r.getVaultFile(this.plugin.app.vault);if(s!==!1){if(!s){new Se.Notice("File not found in vault: "+r.href);return}if(!(s instanceof Se.TFile)){new Se.Notice("Not a file: "+r.href);return}let a=Xt(s.extension);if(!a){new Se.Notice("Unsupported file type: "+s.path);return}r={file:s,hash:r.hash,type:a}}else if(r.isFileUrl){let a=Tx();if(!a){new Se.Notice("File path is only supported in desktop app");return}try{if(!(await a.stat(r)).isFile()){new Se.Notice("Not a file: "+r.href);return}}catch(o){let l=o,c=r.filePath??r.href;l.code==="ENOENT"?new Se.Notice("File not found: "+c):l.code==="EACCES"?new Se.Notice("Permission denied: "+c):new Se.Notice(`Failed to access file (${l.code}): `+c);return}}console.debug("media selected",r),Se.Keymap.isModifier(i,"Mod")&&Se.Keymap.isModifier(i,"Alt")?this.plugin.leafOpener.openMedia(r,"split",{direction:"vertical"}):Se.Keymap.isModifier(i,"Mod")?this.plugin.leafOpener.openMedia(r,"tab"):this.plugin.leafOpener.openMedia(r,!1)}};var Du=require("obsidian");var IR="mx-open";function AR(t){window.OBS_ACT&&t.register(ut(window,{OBS_ACT:i=>function(s){if(s.action.startsWith(IR+"/")){e(s);return}return i.apply(this,arguments)}})),t.registerObsidianProtocolHandler("mx-open",async i=>{let r=Un(i.url);if(!r){new Du.Notice("Invalid URL: "+i.url);return}await n(r)});async function e(i){let r=i.action.substring(IR.length+1),s=Un(r),a=new URLSearchParams(i);if(a.delete("action"),!s){new Du.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 Du.Notice("Invail URL: "+i.href);return}new Du.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 NR(t){function e(){new Nm(t).open()}t.addCommand({id:"open-media-switcher",name:"Open media",icon:"play",callback:e}),t.addRibbonIcon("play","Open media",e),AR(t)}var lx=(t,e)=>e.some(n=>t instanceof n),DR,OR;function V4(){return DR||(DR=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function F4(){return OR||(OR=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var cx=new WeakMap,ax=new WeakMap,Dm=new WeakMap;function z4(t){let e=new Promise((n,i)=>{let r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(qs(t.result)),r()},a=()=>{i(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",a)});return Dm.set(e,t),e}function U4(t){if(cx.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)});cx.set(t,e)}var ux={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return cx.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return qs(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 UR(t){ux=t(ux)}function j4(t){return F4().includes(t)?function(...e){return t.apply(dx(this),e),qs(this.request)}:function(...e){return qs(t.apply(dx(this),e))}}function q4(t){return typeof t=="function"?j4(t):(t instanceof IDBTransaction&&U4(t),lx(t,V4())?new Proxy(t,ux):t)}function qs(t){if(t instanceof IDBRequest)return z4(t);if(ax.has(t))return ax.get(t);let e=q4(t);return e!==t&&(ax.set(t,e),Dm.set(e,t)),e}var dx=t=>Dm.get(t);function jR(t,e,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){let a=indexedDB.open(t,e),o=qs(a);return i&&a.addEventListener("upgradeneeded",l=>{i(qs(a.result),l.oldVersion,l.newVersion,qs(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 H4=["get","getKey","getAll","getAllKeys","count"],B4=["put","add","delete","clear"],ox=new Map;function VR(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(ox.get(e))return ox.get(e);let n=e.replace(/FromIndex$/,""),i=e!==n,r=B4.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||H4.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 ox.set(e,s),s}UR(t=>({...t,get:(e,n,i)=>VR(e,n)||t.get(e,n,i),has:(e,n)=>!!VR(e,n)||t.has(e,n)}));var W4=["continue","continuePrimaryKey","advance"],FR={},px=new WeakMap,qR=new WeakMap,K4={get(t,e){if(!W4.includes(e))return t[e];let n=FR[e];return n||(n=FR[e]=function(...i){px.set(this,qR.get(this)[e](...i))}),n}};async function*G4(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;let n=new Proxy(e,K4);for(qR.set(n,e),Dm.set(n,dx(e));e;)yield n,e=await(px.get(n)||e.continue()),px.delete(n)}function zR(t,e){return e===Symbol.asyncIterator&&lx(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&lx(t,[IDBIndex,IDBObjectStore])}UR(t=>({...t,get(e,n,i){return zR(e,n)?G4:t.get(e,n,i)},has(e,n){return zR(e,n)||t.has(e,n)}}));var Vm=require("obsidian");function Y4(t,...e){return t.reduce((n,i,r)=>{let s=e[r],a=s!==void 0?JSON.stringify(s):"";return n+i+a},"")}var Ou="mx:http_proxy",hx={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 HR(t,e){return Y4`
|
|
const { session, webContents, net } = require("electron");
|
|
const webviewSession = session.fromPartition(${ai(e.appId)});
|
|
const webContent = webContents.fromId(${t});
|
|
webviewSession.webRequest.onSendHeaders(
|
|
{
|
|
urls: ${hx.filter}, type: ${hx.types}
|
|
}, ({url, method, requestHeaders, webContentsId}) => {
|
|
if (method !== "GET" || webContentsId===undefined) return;
|
|
webContent.send(${Ou}, {type:${hx.type} ,url, method, requestHeaders, webContentsId});
|
|
})
|
|
`.trim()}async function BR(t,e){return Q4(t.pipeThrough(new DecompressionStream("gzip")),e)}function WR(t){return new ReadableStream({start(e){e.enqueue(new Uint8Array(t)),e.close()}})}async function Q4(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 X4(t){return`${t.aid}-${t.bvid}-${t.cid}`}var Vu,Fu,Co,Om=class extends Vm.Component{constructor(n){super();this.plugin=n;O(this,Vu,kp());O(this,Fu,new Map);O(this,Co,new Map);w(this,"app");w(this,"db");this.app=n.app,this.db=jR(`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=X4({aid:r,bvid:s,cid:a}),l=k(this,Fu).get(o);if(l)return l;let c=k(this,Co).get(`${s}-${a}`)??k(this,Co).get(`${r}-${a}`);c||(c=await new Promise((p,h)=>{let y=k(this,Vu).on("player_v2",_=>{a===_.cid&&(r===_.aid||s===_.bvid)&&(p(_.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,Fu).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 BR(WR(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(!Vm.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,Vu).emit("player_v2",{url:l.url,aid:+u,bvid:d,cid:+p});let h=d?`${d}-${p}`:`${u}-${p}`;k(this,Co).set(h,l.url)};r.on(Ou,a);try{let o=s.getCurrentWebContents().id,l=HR(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(Ou,a)})}catch(o){throw r.off(Ou,a),o}}};Vu=new WeakMap,Fu=new WeakMap,Co=new WeakMap;var KR=require("obsidian");async function GR(){if(!KR.Platform.isDesktopApp)return;let e=require("@electron/remote").session.fromPartition(ai(this.app.appId));this.settings.subscribe((n,i)=>{n.biliDefaultQuality!==i.biliDefaultQuality&&ex(e,n.biliDefaultQuality)}),await ex(e,this.settings.getState().biliDefaultQuality)}var _L=$(Rm()),Jm=require("obsidian");var qu=class{constructor(t,e,n,i,r,s){w(this,"type",3);w(this,"name","");w(this,"prefix","");w(this,"value","");w(this,"suffix","");w(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"}},Z4=/[$_\p{ID_Start}]/u,J4=/[$_\u200C\u200D\p{ID_Continue}]/u,mx=".*";function e6(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function JR(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&&Z4.test(l)||o!==i+1&&J4.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(!e6(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 eL(t,e={}){let n=JR(t);e.delimiter??(e.delimiter="/#?"),e.prefixes??(e.prefixes="./");let i=`[^${Nn(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:T,index:L}=n[a];throw new TypeError(`Unexpected ${T} 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="",_=g=>{v+=g},m=()=>{v.length&&(r.push(new qu(3,"","",y(v),"",3)),v="")},f=(g,x,T,L,R)=>{let I=3;switch(R){case"?":I=1;break;case"*":I=0;break;case"+":I=2;break}if(!x&&!T&&I===3){_(g);return}if(m(),!x&&!T){if(!g)return;r.push(new qu(3,"","",y(g),"",I));return}let K;T?T==="*"?K=mx:K=T:K=i;let q=2;K===i?(q=1,K=""):K===mx&&(q=0,K="");let _e;if(x?_e=x:T&&(_e=s++),l.has(_e))throw new TypeError(`Duplicate name '${_e}'.`);l.add(_e),r.push(new qu(q,_e,y(g),K,y(L),I))};for(;a<n.length;){let g=c("CHAR"),x=c("NAME"),T=c("REGEX");if(!x&&!T&&(T=c("ASTERISK")),x||T){let R=g??"";e.prefixes.indexOf(R)===-1&&(_(R),R=""),m();let I=u();f(R,x,T,"",I);continue}let L=g??c("ESCAPED_CHAR");if(L){_(L);continue}if(c("OPEN")){let R=p(),I=c("NAME"),K=c("REGEX");!I&&!K&&(K=c("ASTERISK"));let q=p();d("CLOSE");let _e=u();f(R,I,K,q,_e);continue}m(),d("END")}return r}function Nn(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function YR(t){return t&&t.ignoreCase?"ui":"u"}function t6(t,e,n){return tL(eL(t,n),e,n)}function Mo(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function tL(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+=Nn(o.value):i+=`(?:${Nn(o.value)})${Mo(o.modifier)}`;continue}e&&e.push(o.name);let l=`[^${Nn(n.delimiter)}]+?`,c=o.value;if(o.type===1?c=l:o.type===0&&(c=mx),!o.prefix.length&&!o.suffix.length){o.modifier===3||o.modifier===1?i+=`(${c})${Mo(o.modifier)}`:i+=`((?:${c})${Mo(o.modifier)})`;continue}if(o.modifier===3||o.modifier===1){i+=`(?:${Nn(o.prefix)}(${c})${Nn(o.suffix)})`,i+=Mo(o.modifier);continue}i+=`(?:${Nn(o.prefix)}`,i+=`((?:${c})(?:`,i+=Nn(o.suffix),i+=Nn(o.prefix),i+=`(?:${c}))*)${Nn(o.suffix)})`,o.modifier===0&&(i+="?")}let r=`[${Nn(n.endsWith)}]|$`,s=`[${Nn(n.delimiter)}]`;if(n.end)return n.strict||(i+=`${s}?`),n.endsWith.length?i+=`(?=${r})`:i+="$",new RegExp(i,YR(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,YR(n))}var Qr={delimiter:"",prefixes:"",sensitive:!0,strict:!0},n6={delimiter:".",prefixes:"",sensitive:!0,strict:!0},i6={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function r6(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function nL(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function s6(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function iL(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}var rL=["ftp","file","http","https","ws","wss"];function sL(t){if(!t)return!0;for(let e of rL)if(t.test(e))return!0;return!1}function a6(t,e){if(t=nL(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 o6(t,e){if(t=nL(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 l6(t,e){return e||t===""?t:iL(t)?lL(t):oL(t)}function c6(t,e){if(e||t==="")return t;let n=new URL("https://example.com");return n.password=t,n.password}function u6(t,e){if(e||t==="")return t;let n=new URL("https://example.com");return n.username=t,n.username}function d6(t,e,n){if(n||t==="")return t;if(e&&!rL.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 p6(t,e,n){return aL(e)===t&&(t=""),n||t===""?t:cL(t)}function h6(t,e){return t=s6(t,":"),e||t===""?t:yx(t)}function aL(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function yx(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function f6(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function m6(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function oL(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 lL(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function cL(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function g6(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 v6(t){return t===""?t:new URL(`data:${t}`).pathname}function y6(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function _6(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}var Ro,Ot,it,Pe,Bs,Lo,mn,Io,Ao,No,ze,Xe,jm,uL,Hu,gx,Ws,Uu,Do,Fm,Yt,Dn,Bu,vx,qm,dL,Oo,zm,Hm,pL,Bm,hL,Vo,Um,Xr,$o,rr,Hs,Wm,fL,Km,mL,Gm,gL,Ym,vL,On,Ti,Qm,yL,XR,w6=(XR=class{constructor(t){O(this,ze);O(this,jm);O(this,Hu);O(this,Ws);O(this,Do);O(this,Yt);O(this,Bu);O(this,qm);O(this,Oo);O(this,Hm);O(this,Bm);O(this,Vo);O(this,Xr);O(this,rr);O(this,Wm);O(this,Km);O(this,Gm);O(this,Ym);O(this,On);O(this,Qm);O(this,Ro,void 0);O(this,Ot,[]);O(this,it,{});O(this,Pe,0);O(this,Bs,1);O(this,Lo,0);O(this,mn,0);O(this,Io,0);O(this,Ao,0);O(this,No,!1);we(this,Ro,t)}get result(){return k(this,it)}parse(){for(we(this,Ot,JR(k(this,Ro),!0));k(this,Pe)<k(this,Ot).length;we(this,Pe,k(this,Pe)+k(this,Bs))){if(we(this,Bs,1),k(this,Ot)[k(this,Pe)].type==="END"){if(k(this,mn)===0){M(this,Hu,gx).call(this),M(this,rr,Hs).call(this)?M(this,ze,Xe).call(this,9,1):M(this,Xr,$o).call(this)?M(this,ze,Xe).call(this,8,1):M(this,ze,Xe).call(this,7,0);continue}else if(k(this,mn)===2){M(this,Ws,Uu).call(this,5);continue}M(this,ze,Xe).call(this,10,0);break}if(k(this,Io)>0)if(M(this,Km,mL).call(this))we(this,Io,k(this,Io)-1);else continue;if(M(this,Wm,fL).call(this)){we(this,Io,k(this,Io)+1);continue}switch(k(this,mn)){case 0:M(this,Bu,vx).call(this)&&M(this,Ws,Uu).call(this,1);break;case 1:if(M(this,Bu,vx).call(this)){M(this,Qm,yL).call(this);let t=7,e=1;M(this,qm,dL).call(this)?(t=2,e=3):k(this,No)&&(t=2),M(this,ze,Xe).call(this,t,e)}break;case 2:M(this,Oo,zm).call(this)?M(this,Ws,Uu).call(this,3):(M(this,Vo,Um).call(this)||M(this,Xr,$o).call(this)||M(this,rr,Hs).call(this))&&M(this,Ws,Uu).call(this,5);break;case 3:M(this,Hm,pL).call(this)?M(this,ze,Xe).call(this,4,1):M(this,Oo,zm).call(this)&&M(this,ze,Xe).call(this,5,1);break;case 4:M(this,Oo,zm).call(this)&&M(this,ze,Xe).call(this,5,1);break;case 5:M(this,Gm,gL).call(this)?we(this,Ao,k(this,Ao)+1):M(this,Ym,vL).call(this)&&we(this,Ao,k(this,Ao)-1),M(this,Bm,hL).call(this)&&!k(this,Ao)?M(this,ze,Xe).call(this,6,1):M(this,Vo,Um).call(this)?M(this,ze,Xe).call(this,7,0):M(this,Xr,$o).call(this)?M(this,ze,Xe).call(this,8,1):M(this,rr,Hs).call(this)&&M(this,ze,Xe).call(this,9,1);break;case 6:M(this,Vo,Um).call(this)?M(this,ze,Xe).call(this,7,0):M(this,Xr,$o).call(this)?M(this,ze,Xe).call(this,8,1):M(this,rr,Hs).call(this)&&M(this,ze,Xe).call(this,9,1);break;case 7:M(this,Xr,$o).call(this)?M(this,ze,Xe).call(this,8,1):M(this,rr,Hs).call(this)&&M(this,ze,Xe).call(this,9,1);break;case 8:M(this,rr,Hs).call(this)&&M(this,ze,Xe).call(this,9,1);break;case 9:break;case 10:break}}k(this,it).hostname!==void 0&&k(this,it).port===void 0&&(k(this,it).port="")}},Ro=new WeakMap,Ot=new WeakMap,it=new WeakMap,Pe=new WeakMap,Bs=new WeakMap,Lo=new WeakMap,mn=new WeakMap,Io=new WeakMap,Ao=new WeakMap,No=new WeakMap,ze=new WeakSet,Xe=function(t,e){var n,i,r;switch(k(this,mn)){case 0:break;case 1:k(this,it).protocol=M(this,On,Ti).call(this);break;case 2:break;case 3:k(this,it).username=M(this,On,Ti).call(this);break;case 4:k(this,it).password=M(this,On,Ti).call(this);break;case 5:k(this,it).hostname=M(this,On,Ti).call(this);break;case 6:k(this,it).port=M(this,On,Ti).call(this);break;case 7:k(this,it).pathname=M(this,On,Ti).call(this);break;case 8:k(this,it).search=M(this,On,Ti).call(this);break;case 9:k(this,it).hash=M(this,On,Ti).call(this);break;case 10:break}k(this,mn)!==0&&t!==10&&([1,2,3,4].includes(k(this,mn))&&[6,7,8,9].includes(t)&&((n=k(this,it)).hostname??(n.hostname="")),[1,2,3,4,5,6].includes(k(this,mn))&&[8,9].includes(t)&&((i=k(this,it)).pathname??(i.pathname=k(this,No)?"/":"")),[1,2,3,4,5,6,7].includes(k(this,mn))&&t===9&&((r=k(this,it)).search??(r.search=""))),M(this,jm,uL).call(this,t,e)},jm=new WeakSet,uL=function(t,e){we(this,mn,t),we(this,Lo,k(this,Pe)+e),we(this,Pe,k(this,Pe)+e),we(this,Bs,0)},Hu=new WeakSet,gx=function(){we(this,Pe,k(this,Lo)),we(this,Bs,0)},Ws=new WeakSet,Uu=function(t){M(this,Hu,gx).call(this),we(this,mn,t)},Do=new WeakSet,Fm=function(t){return t<0&&(t=k(this,Ot).length-t),t<k(this,Ot).length?k(this,Ot)[t]:k(this,Ot)[k(this,Ot).length-1]},Yt=new WeakSet,Dn=function(t,e){let n=M(this,Do,Fm).call(this,t);return n.value===e&&(n.type==="CHAR"||n.type==="ESCAPED_CHAR"||n.type==="INVALID_CHAR")},Bu=new WeakSet,vx=function(){return M(this,Yt,Dn).call(this,k(this,Pe),":")},qm=new WeakSet,dL=function(){return M(this,Yt,Dn).call(this,k(this,Pe)+1,"/")&&M(this,Yt,Dn).call(this,k(this,Pe)+2,"/")},Oo=new WeakSet,zm=function(){return M(this,Yt,Dn).call(this,k(this,Pe),"@")},Hm=new WeakSet,pL=function(){return M(this,Yt,Dn).call(this,k(this,Pe),":")},Bm=new WeakSet,hL=function(){return M(this,Yt,Dn).call(this,k(this,Pe),":")},Vo=new WeakSet,Um=function(){return M(this,Yt,Dn).call(this,k(this,Pe),"/")},Xr=new WeakSet,$o=function(){if(M(this,Yt,Dn).call(this,k(this,Pe),"?"))return!0;if(k(this,Ot)[k(this,Pe)].value!=="?")return!1;let t=M(this,Do,Fm).call(this,k(this,Pe)-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"},rr=new WeakSet,Hs=function(){return M(this,Yt,Dn).call(this,k(this,Pe),"#")},Wm=new WeakSet,fL=function(){return k(this,Ot)[k(this,Pe)].type=="OPEN"},Km=new WeakSet,mL=function(){return k(this,Ot)[k(this,Pe)].type=="CLOSE"},Gm=new WeakSet,gL=function(){return M(this,Yt,Dn).call(this,k(this,Pe),"[")},Ym=new WeakSet,vL=function(){return M(this,Yt,Dn).call(this,k(this,Pe),"]")},On=new WeakSet,Ti=function(){let t=k(this,Ot)[k(this,Pe)],e=M(this,Do,Fm).call(this,k(this,Lo)).index;return k(this,Ro).substring(e,t.index)},Qm=new WeakSet,yL=function(){let t={};Object.assign(t,Qr),t.encodePart=yx;let e=t6(M(this,On,Ti).call(this),void 0,t);we(this,No,sL(e))},XR),fx=["protocol","username","password","hostname","port","pathname","search","hash"],Yr="*";function QR(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 ir(t,e){return e?ju(t):t}function zu(t,e,n){let i;if(typeof e.baseURL=="string")try{i=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=ir(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=ir(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=ir(i.password,n)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=ir(i.hostname,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=ir(i.port,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=ir(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=ir(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=ir(i.hash.substring(1,i.hash.length),n))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=h6(e.protocol,n)),typeof e.username=="string"&&(t.username=u6(e.username,n)),typeof e.password=="string"&&(t.password=c6(e.password,n)),typeof e.hostname=="string"&&(t.hostname=l6(e.hostname,n)),typeof e.port=="string"&&(t.port=p6(e.port,t.protocol,n)),typeof e.pathname=="string"){if(t.pathname=e.pathname,i&&!r6(t.pathname,n)){let r=i.pathname.lastIndexOf("/");r>=0&&(t.pathname=ir(i.pathname.substring(0,r+1),n)+t.pathname)}t.pathname=d6(t.pathname,t.protocol,n)}return typeof e.search=="string"&&(t.search=o6(e.search,n)),typeof e.hash=="string"&&(t.hash=a6(e.hash,n)),t}function ju(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function b6(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function x6(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=`[^${b6(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+=ju(o.value);continue}s+=`{${ju(o.value)}}${Mo(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+=ju(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+=ju(o.suffix),c&&(s+="}"),o.modifier!==3&&(s+=Mo(o.modifier))}return s}var Si,Ks,Fo,rt,si,zo,ZR,Xm=(ZR=class{constructor(t={},e,n){O(this,Si,void 0);O(this,Ks,{});O(this,Fo,{});O(this,rt,{});O(this,si,{});O(this,zo,!1);try{let i;if(typeof e=="string"?i=e:n=e,typeof t=="string"){let o=new w6(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,Si,zu({pathname:Yr,protocol:Yr,username:Yr,password:Yr,hostname:Yr,port:Yr,search:Yr,hash:Yr},t,!0)),aL(k(this,Si).protocol)===k(this,Si).port&&(k(this,Si).port="");let a;for(a of fx){if(!(a in k(this,Si)))continue;let o={},l=k(this,Si)[a];switch(k(this,Fo)[a]=[],a){case"protocol":Object.assign(o,Qr),o.encodePart=yx;break;case"username":Object.assign(o,Qr),o.encodePart=f6;break;case"password":Object.assign(o,Qr),o.encodePart=m6;break;case"hostname":Object.assign(o,n6),iL(l)?o.encodePart=lL:o.encodePart=oL;break;case"port":Object.assign(o,Qr),o.encodePart=cL;break;case"pathname":sL(k(this,Ks).protocol)?(Object.assign(o,i6,r),o.encodePart=g6):(Object.assign(o,Qr,r),o.encodePart=v6);break;case"search":Object.assign(o,Qr,r),o.encodePart=y6;break;case"hash":Object.assign(o,Qr,r),o.encodePart=_6;break}try{k(this,si)[a]=eL(l,o),k(this,Ks)[a]=tL(k(this,si)[a],k(this,Fo)[a],o),k(this,rt)[a]=x6(k(this,si)[a],o),we(this,zo,k(this,zo)||k(this,si)[a].some(c=>c.type===2))}catch{throw new TypeError(`invalid ${a} pattern '${k(this,Si)[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=zu(n,t,!1):n=zu(n,QR(t,e),!1)}catch{return!1}let i;for(i of fx)if(!k(this,Ks)[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=zu(n,t,!1):n=zu(n,QR(t,e),!1)}catch{return null}let i={};e?i.inputs=[t,e]:i.inputs=[t];let r;for(r of fx){let s=k(this,Ks)[r].exec(n[r]);if(!s)return null;let a={};for(let[o,l]of k(this,Fo)[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,rt)[t]&&!k(n,rt)[t]?0:k(e,rt)[t]&&!k(n,rt)[t]?a(k(e,si)[t],[s]):!k(e,rt)[t]&&k(n,rt)[t]?a([s],k(n,si)[t]):a(k(e,si)[t],k(n,si)[t])}get protocol(){return k(this,rt).protocol}get username(){return k(this,rt).username}get password(){return k(this,rt).password}get hostname(){return k(this,rt).hostname}get port(){return k(this,rt).port}get pathname(){return k(this,rt).pathname}get search(){return k(this,rt).search}get hash(){return k(this,rt).hash}get hasRegExpGroups(){return k(this,zo)}},Si=new WeakMap,Ks=new WeakMap,Fo=new WeakMap,rt=new WeakMap,si=new WeakMap,zo=new WeakMap,ZR);globalThis.URLPattern||(globalThis.URLPattern=Xm);var Wu,_x,Zm=class extends Jm.Component{constructor(n){super();this.plugin=n;O(this,Wu);w(this,"matcher");M(this,Wu,_x).call(this)}onload(){let n=(0,Jm.debounce)(()=>M(this,Wu,_x).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=k6(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[jn[n.type]];if(n.type==="generic")switch(n.inferredType){case"video":return[pt.video,Zt];case"audio":return[pt.audio,Zt];default:return[Zt,pt.video,pt.audio]}switch(n.type){case"youtube":case"vimeo":return[Zt,Mi];case"bilibili":case"coursera":return[Zt];default:(0,_L.assertNever)(n.type)}}};Wu=new WeakSet,_x=function(){this.matcher=new Map(Object.entries(this.plugin.settings.getState().linkHandler).map(([n,i])=>[n,i.map(r=>new Xm(r))]))};function k6(t){return["protocol","username","password","hostname","port","pathname","search","hash"].reduce((e,n)=>{let i=t[n];return e+(i!=="*"?1:0)},0)}var eg=class extends tg.Plugin{constructor(){super(...arguments);w(this,"settings",ER(this));w(this,"api",{openUrl:async(n,i,r)=>{let s=this.resolveUrl(n);if(!s){new tg.Notice("Protocol not yet supported");return}await this.leafOpener.openMedia(s,i,{direction:r})}});w(this,"urlViewType",this.addChild(new Zm(this)));w(this,"mediaNote",this.addChild(new Em(this)));w(this,"biliReq",this.addChild(new Om(this)));w(this,"leafOpener",this.addChild(new _m(this)));w(this,"handleMediaNote",OM);w(this,"injectMediaEmbed",Kb);w(this,"injectMediaView",Jb);w(this,"registerMediaMenu",Ib);w(this,"fixLinkLabel",Xb);w(this,"patchEditorClick",Gb);w(this,"patchPreviewClick",Zb);w(this,"patchInlineUrl",Yb);w(this,"patchLinktextOpen",Qb);w(this,"modifySession",GR);w(this,"initLogin",Px)}resolveUrl(n){let i=fR(n);return i?cC(Un(i),this.settings.getState()):null}async onload(){this.addSettingTab(new Im(this)),await this.loadSettings(),this.initLogin(),this.loadPatches(),this.registerMediaMenu(),this.handleMediaNote(),await this.modifySession(),NR(this)}async loadSettings(){await this.settings.getState().load()}loadPatches(){this.injectMediaView(jn.audio,n=>new yo(n,this),kt.audio),this.injectMediaView(jn.video,n=>new vo(n,this),kt.video),this.injectMediaEmbed((n,i,r)=>new Tm(n,i,r,this)),this.registerView(Zt,n=>new xo(n,this)),this.registerView(Mi,n=>new _o(n,this)),this.registerView(pt.video,n=>new wo(n,this)),this.registerView(pt.audio,n=>new bo(n,this)),this.patchEditorClick({onExternalLinkClick:$b}),this.patchPreviewClick({onExternalLinkClick:$b}),this.fixLinkLabel(),this.patchInlineUrl(),this.patchLinktextOpen({onInternalLinkClick:zM})}};
|
|
/*! 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.
|
|
*)
|
|
*/
|