215 lines
971 KiB
JavaScript
215 lines
971 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source visit the plugins github repository
|
|
*/
|
|
|
|
"use strict";var TB=Object.create;var cd=Object.defineProperty;var SB=Object.getOwnPropertyDescriptor;var EB=Object.getOwnPropertyNames;var PB=Object.getPrototypeOf,CB=Object.prototype.hasOwnProperty;var MB=(t,e,n)=>e in t?cd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var rt=(t,e)=>()=>(t&&(e=t(t=0)),e);var Jt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ot=(t,e)=>{for(var n in e)cd(t,n,{get:e[n],enumerable:!0})},qC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of EB(e))!CB.call(t,i)&&i!==n&&cd(t,i,{get:()=>e[i],enumerable:!(r=SB(e,i))||r.enumerable});return t};var $=(t,e,n)=>(n=t!=null?TB(PB(t)):{},qC(e||!t||!t.__esModule?cd(n,"default",{value:t,enumerable:!0}):n,t)),RB=t=>qC(cd({},"__esModule",{value:!0}),t);var T=(t,e,n)=>(MB(t,typeof e!="symbol"?e+"":e,n),n),t_=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var L=(t,e,n)=>(t_(t,e,"read from private field"),n?n.call(t):e.get(t)),Z=(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)},Ue=(t,e,n,r)=>(t_(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);var V=(t,e,n)=>(t_(t,e,"access private method"),n);var hd=Jt(im=>{"use strict";Object.defineProperty(im,"__esModule",{value:!0});function iM(t,e){if(e)return t;throw new Error("Unhandled discriminated union member: "+JSON.stringify(t))}im.assertNever=iM;im.default=iM});var mR=Jt(Ee=>{"use strict";var kd=Symbol.for("react.element"),Tj=Symbol.for("react.portal"),Sj=Symbol.for("react.fragment"),Ej=Symbol.for("react.strict_mode"),Pj=Symbol.for("react.profiler"),Cj=Symbol.for("react.provider"),Mj=Symbol.for("react.context"),Rj=Symbol.for("react.forward_ref"),$j=Symbol.for("react.suspense"),Ij=Symbol.for("react.memo"),Lj=Symbol.for("react.lazy"),oR=Symbol.iterator;function Aj(t){return t===null||typeof t!="object"?null:(t=oR&&t[oR]||t["@@iterator"],typeof t=="function"?t:null)}var lR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cR=Object.assign,uR={};function jl(t,e,n){this.props=t,this.context=e,this.refs=uR,this.updater=n||lR}jl.prototype.isReactComponent={};jl.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")};jl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function dR(){}dR.prototype=jl.prototype;function y_(t,e,n){this.props=t,this.context=e,this.refs=uR,this.updater=n||lR}var v_=y_.prototype=new dR;v_.constructor=y_;cR(v_,jl.prototype);v_.isPureReactComponent=!0;var aR=Array.isArray,pR=Object.prototype.hasOwnProperty,x_={current:null},fR={key:!0,ref:!0,__self:!0,__source:!0};function hR(t,e,n){var r,i={},o=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(o=""+e.key),e)pR.call(e,r)&&!fR.hasOwnProperty(r)&&(i[r]=e[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in s=t.defaultProps,s)i[r]===void 0&&(i[r]=s[r]);return{$$typeof:kd,type:t,key:o,ref:a,props:i,_owner:x_.current}}function Oj(t,e){return{$$typeof:kd,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function w_(t){return typeof t=="object"&&t!==null&&t.$$typeof===kd}function Fj(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var sR=/\/+/g;function g_(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Fj(""+t.key):e.toString(36)}function Sm(t,e,n,r,i){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case kd:case Tj:a=!0}}if(a)return a=t,i=i(a),t=r===""?"."+g_(a,0):r,aR(i)?(n="",t!=null&&(n=t.replace(sR,"$&/")+"/"),Sm(i,e,n,"",function(c){return c})):i!=null&&(w_(i)&&(i=Oj(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(sR,"$&/")+"/")+t)),e.push(i)),1;if(a=0,r=r===""?".":r+":",aR(t))for(var s=0;s<t.length;s++){o=t[s];var l=r+g_(o,s);a+=Sm(o,e,n,l,i)}else if(l=Aj(t),typeof l=="function")for(t=l.call(t),s=0;!(o=t.next()).done;)o=o.value,l=r+g_(o,s++),a+=Sm(o,e,n,l,i);else if(o==="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 Tm(t,e,n){if(t==null)return t;var r=[],i=0;return Sm(t,r,"","",function(o){return e.call(n,o,i++)}),r}function Dj(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 Tn={current:null},Em={transition:null},Nj={ReactCurrentDispatcher:Tn,ReactCurrentBatchConfig:Em,ReactCurrentOwner:x_};Ee.Children={map:Tm,forEach:function(t,e,n){Tm(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Tm(t,function(){e++}),e},toArray:function(t){return Tm(t,function(e){return e})||[]},only:function(t){if(!w_(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Ee.Component=jl;Ee.Fragment=Sj;Ee.Profiler=Pj;Ee.PureComponent=y_;Ee.StrictMode=Ej;Ee.Suspense=$j;Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Nj;Ee.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=cR({},t.props),i=t.key,o=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,a=x_.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(l in e)pR.call(e,l)&&!fR.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];r.children=s}return{$$typeof:kd,type:t.type,key:i,ref:o,props:r,_owner:a}};Ee.createContext=function(t){return t={$$typeof:Mj,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Cj,_context:t},t.Consumer=t};Ee.createElement=hR;Ee.createFactory=function(t){var e=hR.bind(null,t);return e.type=t,e};Ee.createRef=function(){return{current:null}};Ee.forwardRef=function(t){return{$$typeof:Rj,render:t}};Ee.isValidElement=w_;Ee.lazy=function(t){return{$$typeof:Lj,_payload:{_status:-1,_result:t},_init:Dj}};Ee.memo=function(t,e){return{$$typeof:Ij,type:t,compare:e===void 0?null:e}};Ee.startTransition=function(t){var e=Em.transition;Em.transition={};try{t()}finally{Em.transition=e}};Ee.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Ee.useCallback=function(t,e){return Tn.current.useCallback(t,e)};Ee.useContext=function(t){return Tn.current.useContext(t)};Ee.useDebugValue=function(){};Ee.useDeferredValue=function(t){return Tn.current.useDeferredValue(t)};Ee.useEffect=function(t,e){return Tn.current.useEffect(t,e)};Ee.useId=function(){return Tn.current.useId()};Ee.useImperativeHandle=function(t,e,n){return Tn.current.useImperativeHandle(t,e,n)};Ee.useInsertionEffect=function(t,e){return Tn.current.useInsertionEffect(t,e)};Ee.useLayoutEffect=function(t,e){return Tn.current.useLayoutEffect(t,e)};Ee.useMemo=function(t,e){return Tn.current.useMemo(t,e)};Ee.useReducer=function(t,e,n){return Tn.current.useReducer(t,e,n)};Ee.useRef=function(t){return Tn.current.useRef(t)};Ee.useState=function(t){return Tn.current.useState(t)};Ee.useSyncExternalStore=function(t,e,n){return Tn.current.useSyncExternalStore(t,e,n)};Ee.useTransition=function(){return Tn.current.useTransition()};Ee.version="18.2.0"});var K=Jt((eue,gR)=>{"use strict";gR.exports=mR()});var ER=Jt(Be=>{"use strict";function T_(t,e){var n=t.length;t.push(e);e:for(;0<n;){var r=n-1>>>1,i=t[r];if(0<Pm(i,e))t[r]=e,t[n]=i,n=r;else break e}}function ni(t){return t.length===0?null:t[0]}function Mm(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;e:for(var r=0,i=t.length,o=i>>>1;r<o;){var a=2*(r+1)-1,s=t[a],l=a+1,c=t[l];if(0>Pm(s,n))l<i&&0>Pm(c,s)?(t[r]=c,t[l]=n,r=l):(t[r]=s,t[a]=n,r=a);else if(l<i&&0>Pm(c,n))t[r]=c,t[l]=n,r=l;else break e}}return e}function Pm(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(yR=performance,Be.unstable_now=function(){return yR.now()}):(b_=Date,vR=b_.now(),Be.unstable_now=function(){return b_.now()-vR});var yR,b_,vR,Ri=[],ra=[],Vj=1,Ir=null,dn=3,Rm=!1,fs=!1,Sd=!1,bR=typeof setTimeout=="function"?setTimeout:null,_R=typeof clearTimeout=="function"?clearTimeout:null,xR=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S_(t){for(var e=ni(ra);e!==null;){if(e.callback===null)Mm(ra);else if(e.startTime<=t)Mm(ra),e.sortIndex=e.expirationTime,T_(Ri,e);else break;e=ni(ra)}}function E_(t){if(Sd=!1,S_(t),!fs)if(ni(Ri)!==null)fs=!0,C_(P_);else{var e=ni(ra);e!==null&&M_(E_,e.startTime-t)}}function P_(t,e){fs=!1,Sd&&(Sd=!1,_R(Ed),Ed=-1),Rm=!0;var n=dn;try{for(S_(e),Ir=ni(Ri);Ir!==null&&(!(Ir.expirationTime>e)||t&&!SR());){var r=Ir.callback;if(typeof r=="function"){Ir.callback=null,dn=Ir.priorityLevel;var i=r(Ir.expirationTime<=e);e=Be.unstable_now(),typeof i=="function"?Ir.callback=i:Ir===ni(Ri)&&Mm(Ri),S_(e)}else Mm(Ri);Ir=ni(Ri)}if(Ir!==null)var o=!0;else{var a=ni(ra);a!==null&&M_(E_,a.startTime-e),o=!1}return o}finally{Ir=null,dn=n,Rm=!1}}var $m=!1,Cm=null,Ed=-1,kR=5,TR=-1;function SR(){return!(Be.unstable_now()-TR<kR)}function __(){if(Cm!==null){var t=Be.unstable_now();TR=t;var e=!0;try{e=Cm(!0,t)}finally{e?Td():($m=!1,Cm=null)}}else $m=!1}var Td;typeof xR=="function"?Td=function(){xR(__)}:typeof MessageChannel<"u"?(k_=new MessageChannel,wR=k_.port2,k_.port1.onmessage=__,Td=function(){wR.postMessage(null)}):Td=function(){bR(__,0)};var k_,wR;function C_(t){Cm=t,$m||($m=!0,Td())}function M_(t,e){Ed=bR(function(){t(Be.unstable_now())},e)}Be.unstable_IdlePriority=5;Be.unstable_ImmediatePriority=1;Be.unstable_LowPriority=4;Be.unstable_NormalPriority=3;Be.unstable_Profiling=null;Be.unstable_UserBlockingPriority=2;Be.unstable_cancelCallback=function(t){t.callback=null};Be.unstable_continueExecution=function(){fs||Rm||(fs=!0,C_(P_))};Be.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"):kR=0<t?Math.floor(1e3/t):5};Be.unstable_getCurrentPriorityLevel=function(){return dn};Be.unstable_getFirstCallbackNode=function(){return ni(Ri)};Be.unstable_next=function(t){switch(dn){case 1:case 2:case 3:var e=3;break;default:e=dn}var n=dn;dn=e;try{return t()}finally{dn=n}};Be.unstable_pauseExecution=function(){};Be.unstable_requestPaint=function(){};Be.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=dn;dn=t;try{return e()}finally{dn=n}};Be.unstable_scheduleCallback=function(t,e,n){var r=Be.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,t){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5e3}return i=n+i,t={id:Vj++,callback:e,priorityLevel:t,startTime:n,expirationTime:i,sortIndex:-1},n>r?(t.sortIndex=n,T_(ra,t),ni(Ri)===null&&t===ni(ra)&&(Sd?(_R(Ed),Ed=-1):Sd=!0,M_(E_,n-r))):(t.sortIndex=i,T_(Ri,t),fs||Rm||(fs=!0,C_(P_))),t};Be.unstable_shouldYield=SR;Be.unstable_wrapCallback=function(t){var e=dn;return function(){var n=dn;dn=e;try{return t.apply(this,arguments)}finally{dn=n}}}});var CR=Jt((nue,PR)=>{"use strict";PR.exports=ER()});var AL=Jt(cr=>{"use strict";var O$=K(),sr=CR();function U(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 F$=new Set,Gd={};function Es(t,e){uc(t,e),uc(t+"Capture",e)}function uc(t,e){for(Gd[t]=e,t=0;t<e.length;t++)F$.add(e[t])}var co=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Z_=Object.prototype.hasOwnProperty,zj=/^[: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]*$/,MR={},RR={};function Uj(t){return Z_.call(RR,t)?!0:Z_.call(MR,t)?!1:zj.test(t)?RR[t]=!0:(MR[t]=!0,!1)}function Bj(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function jj(t,e,n,r){if(e===null||typeof e>"u"||Bj(t,e,n,r))return!0;if(r)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 Pn(t,e,n,r,i,o,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=a}var rn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){rn[t]=new Pn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];rn[e]=new Pn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){rn[t]=new Pn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){rn[t]=new Pn(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){rn[t]=new Pn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){rn[t]=new Pn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){rn[t]=new Pn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){rn[t]=new Pn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){rn[t]=new Pn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Hk=/[\-:]([a-z])/g;function Wk(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(Hk,Wk);rn[e]=new Pn(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(Hk,Wk);rn[e]=new Pn(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(Hk,Wk);rn[e]=new Pn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){rn[t]=new Pn(t,1,!1,t.toLowerCase(),null,!1,!1)});rn.xlinkHref=new Pn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){rn[t]=new Pn(t,1,!1,t.toLowerCase(),null,!0,!0)});function qk(t,e,n,r){var i=rn.hasOwnProperty(e)?rn[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(jj(e,n,i,r)&&(n=null),r||i===null?Uj(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var ho=O$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Im=Symbol.for("react.element"),ql=Symbol.for("react.portal"),Kl=Symbol.for("react.fragment"),Kk=Symbol.for("react.strict_mode"),J_=Symbol.for("react.profiler"),D$=Symbol.for("react.provider"),N$=Symbol.for("react.context"),Gk=Symbol.for("react.forward_ref"),ek=Symbol.for("react.suspense"),tk=Symbol.for("react.suspense_list"),Yk=Symbol.for("react.memo"),oa=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var V$=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var $R=Symbol.iterator;function Pd(t){return t===null||typeof t!="object"?null:(t=$R&&t[$R]||t["@@iterator"],typeof t=="function"?t:null)}var ut=Object.assign,R_;function Od(t){if(R_===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);R_=e&&e[1]||""}return`
|
|
`+R_+t}var $_=!1;function I_(t,e){if(!t||$_)return"";$_=!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 r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
`),o=r.stack.split(`
|
|
`),a=i.length-1,s=o.length-1;1<=a&&0<=s&&i[a]!==o[s];)s--;for(;1<=a&&0<=s;a--,s--)if(i[a]!==o[s]){if(a!==1||s!==1)do if(a--,s--,0>s||i[a]!==o[s]){var l=`
|
|
`+i[a].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=a&&0<=s);break}}}finally{$_=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Od(t):""}function Hj(t){switch(t.tag){case 5:return Od(t.type);case 16:return Od("Lazy");case 13:return Od("Suspense");case 19:return Od("SuspenseList");case 0:case 2:case 15:return t=I_(t.type,!1),t;case 11:return t=I_(t.type.render,!1),t;case 1:return t=I_(t.type,!0),t;default:return""}}function nk(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 Kl:return"Fragment";case ql:return"Portal";case J_:return"Profiler";case Kk:return"StrictMode";case ek:return"Suspense";case tk:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case N$:return(t.displayName||"Context")+".Consumer";case D$:return(t._context.displayName||"Context")+".Provider";case Gk:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Yk:return e=t.displayName||null,e!==null?e:nk(t.type)||"Memo";case oa:e=t._payload,t=t._init;try{return nk(t(e))}catch{}}return null}function Wj(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 nk(e);case 8:return e===Kk?"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 xa(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function z$(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function qj(t){var e=z$(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Lm(t){t._valueTracker||(t._valueTracker=qj(t))}function U$(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=z$(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function sg(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 rk(t,e){var n=e.checked;return ut({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function IR(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=xa(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function B$(t,e){e=e.checked,e!=null&&qk(t,"checked",e,!1)}function ik(t,e){B$(t,e);var n=xa(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?ok(t,e.type,n):e.hasOwnProperty("defaultValue")&&ok(t,e.type,xa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function LR(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+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 ok(t,e,n){(e!=="number"||sg(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Fd=Array.isArray;function ic(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+xa(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function ak(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(U(91));return ut({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function AR(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(U(92));if(Fd(n)){if(1<n.length)throw Error(U(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:xa(n)}}function j$(t,e){var n=xa(e.value),r=xa(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function OR(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function H$(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 sk(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?H$(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Am,W$=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Am=Am||document.createElement("div"),Am.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Am.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Yd(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Vd={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},Kj=["Webkit","ms","Moz","O"];Object.keys(Vd).forEach(function(t){Kj.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Vd[e]=Vd[t]})});function q$(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Vd.hasOwnProperty(t)&&Vd[t]?(""+e).trim():e+"px"}function K$(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=q$(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var Gj=ut({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 lk(t,e){if(e){if(Gj[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(U(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(U(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(U(61))}if(e.style!=null&&typeof e.style!="object")throw Error(U(62))}}function ck(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 uk=null;function Qk(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var dk=null,oc=null,ac=null;function FR(t){if(t=fp(t)){if(typeof dk!="function")throw Error(U(280));var e=t.stateNode;e&&(e=Og(e),dk(t.stateNode,t.type,e))}}function G$(t){oc?ac?ac.push(t):ac=[t]:oc=t}function Y$(){if(oc){var t=oc,e=ac;if(ac=oc=null,FR(t),e)for(t=0;t<e.length;t++)FR(e[t])}}function Q$(t,e){return t(e)}function X$(){}var L_=!1;function Z$(t,e,n){if(L_)return t(e,n);L_=!0;try{return Q$(t,e,n)}finally{L_=!1,(oc!==null||ac!==null)&&(X$(),Y$())}}function Qd(t,e){var n=t.stateNode;if(n===null)return null;var r=Og(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(U(231,e,typeof n));return n}var pk=!1;if(co)try{Hl={},Object.defineProperty(Hl,"passive",{get:function(){pk=!0}}),window.addEventListener("test",Hl,Hl),window.removeEventListener("test",Hl,Hl)}catch{pk=!1}var Hl;function Yj(t,e,n,r,i,o,a,s,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var zd=!1,lg=null,cg=!1,fk=null,Qj={onError:function(t){zd=!0,lg=t}};function Xj(t,e,n,r,i,o,a,s,l){zd=!1,lg=null,Yj.apply(Qj,arguments)}function Zj(t,e,n,r,i,o,a,s,l){if(Xj.apply(this,arguments),zd){if(zd){var c=lg;zd=!1,lg=null}else throw Error(U(198));cg||(cg=!0,fk=c)}}function Ps(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 J$(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 DR(t){if(Ps(t)!==t)throw Error(U(188))}function Jj(t){var e=t.alternate;if(!e){if(e=Ps(t),e===null)throw Error(U(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return DR(i),t;if(o===r)return DR(i),e;o=o.sibling}throw Error(U(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(U(189))}}if(n.alternate!==r)throw Error(U(190))}if(n.tag!==3)throw Error(U(188));return n.stateNode.current===n?t:e}function eI(t){return t=Jj(t),t!==null?tI(t):null}function tI(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=tI(t);if(e!==null)return e;t=t.sibling}return null}var nI=sr.unstable_scheduleCallback,NR=sr.unstable_cancelCallback,eH=sr.unstable_shouldYield,tH=sr.unstable_requestPaint,wt=sr.unstable_now,nH=sr.unstable_getCurrentPriorityLevel,Xk=sr.unstable_ImmediatePriority,rI=sr.unstable_UserBlockingPriority,ug=sr.unstable_NormalPriority,rH=sr.unstable_LowPriority,iI=sr.unstable_IdlePriority,$g=null,Ai=null;function iH(t){if(Ai&&typeof Ai.onCommitFiberRoot=="function")try{Ai.onCommitFiberRoot($g,t,void 0,(t.current.flags&128)===128)}catch{}}var si=Math.clz32?Math.clz32:sH,oH=Math.log,aH=Math.LN2;function sH(t){return t>>>=0,t===0?32:31-(oH(t)/aH|0)|0}var Om=64,Fm=4194304;function Dd(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 dg(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=Dd(s):(o&=a,o!==0&&(r=Dd(o)))}else a=n&~i,a!==0?r=Dd(a):o!==0&&(r=Dd(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-si(e),i=1<<n,r|=t[n],e&=~i;return r}function lH(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 cH(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var a=31-si(o),s=1<<a,l=i[a];l===-1?(!(s&n)||s&r)&&(i[a]=lH(s,e)):l<=e&&(t.expiredLanes|=s),o&=~s}}function hk(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function oI(){var t=Om;return Om<<=1,!(Om&4194240)&&(Om=64),t}function A_(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function dp(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-si(e),t[e]=n}function uH(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 r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-si(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function Zk(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-si(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Fe=0;function aI(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var sI,Jk,lI,cI,uI,mk=!1,Dm=[],da=null,pa=null,fa=null,Xd=new Map,Zd=new Map,sa=[],dH="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 VR(t,e){switch(t){case"focusin":case"focusout":da=null;break;case"dragenter":case"dragleave":pa=null;break;case"mouseover":case"mouseout":fa=null;break;case"pointerover":case"pointerout":Xd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zd.delete(e.pointerId)}}function Cd(t,e,n,r,i,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},e!==null&&(e=fp(e),e!==null&&Jk(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function pH(t,e,n,r,i){switch(e){case"focusin":return da=Cd(da,t,e,n,r,i),!0;case"dragenter":return pa=Cd(pa,t,e,n,r,i),!0;case"mouseover":return fa=Cd(fa,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return Xd.set(o,Cd(Xd.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Zd.set(o,Cd(Zd.get(o)||null,t,e,n,r,i)),!0}return!1}function dI(t){var e=gs(t.target);if(e!==null){var n=Ps(e);if(n!==null){if(e=n.tag,e===13){if(e=J$(n),e!==null){t.blockedOn=e,uI(t.priority,function(){lI(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 Xm(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=gk(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);uk=r,n.target.dispatchEvent(r),uk=null}else return e=fp(n),e!==null&&Jk(e),t.blockedOn=n,!1;e.shift()}return!0}function zR(t,e,n){Xm(t)&&n.delete(e)}function fH(){mk=!1,da!==null&&Xm(da)&&(da=null),pa!==null&&Xm(pa)&&(pa=null),fa!==null&&Xm(fa)&&(fa=null),Xd.forEach(zR),Zd.forEach(zR)}function Md(t,e){t.blockedOn===e&&(t.blockedOn=null,mk||(mk=!0,sr.unstable_scheduleCallback(sr.unstable_NormalPriority,fH)))}function Jd(t){function e(i){return Md(i,t)}if(0<Dm.length){Md(Dm[0],t);for(var n=1;n<Dm.length;n++){var r=Dm[n];r.blockedOn===t&&(r.blockedOn=null)}}for(da!==null&&Md(da,t),pa!==null&&Md(pa,t),fa!==null&&Md(fa,t),Xd.forEach(e),Zd.forEach(e),n=0;n<sa.length;n++)r=sa[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<sa.length&&(n=sa[0],n.blockedOn===null);)dI(n),n.blockedOn===null&&sa.shift()}var sc=ho.ReactCurrentBatchConfig,pg=!0;function hH(t,e,n,r){var i=Fe,o=sc.transition;sc.transition=null;try{Fe=1,e0(t,e,n,r)}finally{Fe=i,sc.transition=o}}function mH(t,e,n,r){var i=Fe,o=sc.transition;sc.transition=null;try{Fe=4,e0(t,e,n,r)}finally{Fe=i,sc.transition=o}}function e0(t,e,n,r){if(pg){var i=gk(t,e,n,r);if(i===null)U_(t,e,r,fg,n),VR(t,r);else if(pH(i,t,e,n,r))r.stopPropagation();else if(VR(t,r),e&4&&-1<dH.indexOf(t)){for(;i!==null;){var o=fp(i);if(o!==null&&sI(o),o=gk(t,e,n,r),o===null&&U_(t,e,r,fg,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else U_(t,e,r,null,n)}}var fg=null;function gk(t,e,n,r){if(fg=null,t=Qk(r),t=gs(t),t!==null)if(e=Ps(t),e===null)t=null;else if(n=e.tag,n===13){if(t=J$(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 fg=t,null}function pI(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(nH()){case Xk:return 1;case rI:return 4;case ug:case rH:return 16;case iI:return 536870912;default:return 16}default:return 16}}var ca=null,t0=null,Zm=null;function fI(){if(Zm)return Zm;var t,e=t0,n=e.length,r,i="value"in ca?ca.value:ca.textContent,o=i.length;for(t=0;t<n&&e[t]===i[t];t++);var a=n-t;for(r=1;r<=a&&e[n-r]===i[o-r];r++);return Zm=i.slice(t,1<r?1-r:void 0)}function Jm(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 Nm(){return!0}function UR(){return!1}function lr(t){function e(n,r,i,o,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var s in t)t.hasOwnProperty(s)&&(n=t[s],this[s]=n?n(o):o[s]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Nm:UR,this.isPropagationStopped=UR,this}return ut(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=Nm)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Nm)},persist:function(){},isPersistent:Nm}),e}var yc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},n0=lr(yc),pp=ut({},yc,{view:0,detail:0}),gH=lr(pp),O_,F_,Rd,Ig=ut({},pp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:r0,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!==Rd&&(Rd&&t.type==="mousemove"?(O_=t.screenX-Rd.screenX,F_=t.screenY-Rd.screenY):F_=O_=0,Rd=t),O_)},movementY:function(t){return"movementY"in t?t.movementY:F_}}),BR=lr(Ig),yH=ut({},Ig,{dataTransfer:0}),vH=lr(yH),xH=ut({},pp,{relatedTarget:0}),D_=lr(xH),wH=ut({},yc,{animationName:0,elapsedTime:0,pseudoElement:0}),bH=lr(wH),_H=ut({},yc,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),kH=lr(_H),TH=ut({},yc,{data:0}),jR=lr(TH),SH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},EH={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"},PH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function CH(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=PH[t])?!!e[t]:!1}function r0(){return CH}var MH=ut({},pp,{key:function(t){if(t.key){var e=SH[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Jm(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?EH[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:r0,charCode:function(t){return t.type==="keypress"?Jm(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Jm(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),RH=lr(MH),$H=ut({},Ig,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),HR=lr($H),IH=ut({},pp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:r0}),LH=lr(IH),AH=ut({},yc,{propertyName:0,elapsedTime:0,pseudoElement:0}),OH=lr(AH),FH=ut({},Ig,{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}),DH=lr(FH),NH=[9,13,27,32],i0=co&&"CompositionEvent"in window,Ud=null;co&&"documentMode"in document&&(Ud=document.documentMode);var VH=co&&"TextEvent"in window&&!Ud,hI=co&&(!i0||Ud&&8<Ud&&11>=Ud),WR=" ",qR=!1;function mI(t,e){switch(t){case"keyup":return NH.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gI(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Gl=!1;function zH(t,e){switch(t){case"compositionend":return gI(e);case"keypress":return e.which!==32?null:(qR=!0,WR);case"textInput":return t=e.data,t===WR&&qR?null:t;default:return null}}function UH(t,e){if(Gl)return t==="compositionend"||!i0&&mI(t,e)?(t=fI(),Zm=t0=ca=null,Gl=!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 hI&&e.locale!=="ko"?null:e.data;default:return null}}var BH={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 KR(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!BH[t.type]:e==="textarea"}function yI(t,e,n,r){G$(r),e=hg(e,"onChange"),0<e.length&&(n=new n0("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Bd=null,ep=null;function jH(t){CI(t,0)}function Lg(t){var e=Xl(t);if(U$(e))return t}function HH(t,e){if(t==="change")return e}var vI=!1;co&&(co?(zm="oninput"in document,zm||(N_=document.createElement("div"),N_.setAttribute("oninput","return;"),zm=typeof N_.oninput=="function"),Vm=zm):Vm=!1,vI=Vm&&(!document.documentMode||9<document.documentMode));var Vm,zm,N_;function GR(){Bd&&(Bd.detachEvent("onpropertychange",xI),ep=Bd=null)}function xI(t){if(t.propertyName==="value"&&Lg(ep)){var e=[];yI(e,ep,t,Qk(t)),Z$(jH,e)}}function WH(t,e,n){t==="focusin"?(GR(),Bd=e,ep=n,Bd.attachEvent("onpropertychange",xI)):t==="focusout"&&GR()}function qH(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Lg(ep)}function KH(t,e){if(t==="click")return Lg(e)}function GH(t,e){if(t==="input"||t==="change")return Lg(e)}function YH(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ci=typeof Object.is=="function"?Object.is:YH;function tp(t,e){if(ci(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Z_.call(e,i)||!ci(t[i],e[i]))return!1}return!0}function YR(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function QR(t,e){var n=YR(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=YR(n)}}function wI(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?wI(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function bI(){for(var t=window,e=sg();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=sg(t.document)}return e}function o0(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 QH(t){var e=bI(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&wI(n.ownerDocument.documentElement,n)){if(r!==null&&o0(n)){if(e=r.start,t=r.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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=QR(n,o);var a=QR(n,r);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(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 XH=co&&"documentMode"in document&&11>=document.documentMode,Yl=null,yk=null,jd=null,vk=!1;function XR(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vk||Yl==null||Yl!==sg(r)||(r=Yl,"selectionStart"in r&&o0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jd&&tp(jd,r)||(jd=r,r=hg(yk,"onSelect"),0<r.length&&(e=new n0("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Yl)))}function Um(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Ql={animationend:Um("Animation","AnimationEnd"),animationiteration:Um("Animation","AnimationIteration"),animationstart:Um("Animation","AnimationStart"),transitionend:Um("Transition","TransitionEnd")},V_={},_I={};co&&(_I=document.createElement("div").style,"AnimationEvent"in window||(delete Ql.animationend.animation,delete Ql.animationiteration.animation,delete Ql.animationstart.animation),"TransitionEvent"in window||delete Ql.transitionend.transition);function Ag(t){if(V_[t])return V_[t];if(!Ql[t])return t;var e=Ql[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in _I)return V_[t]=e[n];return t}var kI=Ag("animationend"),TI=Ag("animationiteration"),SI=Ag("animationstart"),EI=Ag("transitionend"),PI=new Map,ZR="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 ba(t,e){PI.set(t,e),Es(e,[t])}for(Bm=0;Bm<ZR.length;Bm++)jm=ZR[Bm],JR=jm.toLowerCase(),e$=jm[0].toUpperCase()+jm.slice(1),ba(JR,"on"+e$);var jm,JR,e$,Bm;ba(kI,"onAnimationEnd");ba(TI,"onAnimationIteration");ba(SI,"onAnimationStart");ba("dblclick","onDoubleClick");ba("focusin","onFocus");ba("focusout","onBlur");ba(EI,"onTransitionEnd");uc("onMouseEnter",["mouseout","mouseover"]);uc("onMouseLeave",["mouseout","mouseover"]);uc("onPointerEnter",["pointerout","pointerover"]);uc("onPointerLeave",["pointerout","pointerover"]);Es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Es("onBeforeInput",["compositionend","keypress","textInput","paste"]);Es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nd="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(" "),ZH=new Set("cancel close invalid load scroll toggle".split(" ").concat(Nd));function t$(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,Zj(r,e,void 0,t),t.currentTarget=null}function CI(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var o=void 0;if(e)for(var a=r.length-1;0<=a;a--){var s=r[a],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&i.isPropagationStopped())break e;t$(i,s,c),o=l}else for(a=0;a<r.length;a++){if(s=r[a],l=s.instance,c=s.currentTarget,s=s.listener,l!==o&&i.isPropagationStopped())break e;t$(i,s,c),o=l}}}if(cg)throw t=fk,cg=!1,fk=null,t}function Qe(t,e){var n=e[kk];n===void 0&&(n=e[kk]=new Set);var r=t+"__bubble";n.has(r)||(MI(e,t,2,!1),n.add(r))}function z_(t,e,n){var r=0;e&&(r|=4),MI(n,t,r,e)}var Hm="_reactListening"+Math.random().toString(36).slice(2);function np(t){if(!t[Hm]){t[Hm]=!0,F$.forEach(function(n){n!=="selectionchange"&&(ZH.has(n)||z_(n,!1,t),z_(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Hm]||(e[Hm]=!0,z_("selectionchange",!1,e))}}function MI(t,e,n,r){switch(pI(e)){case 1:var i=hH;break;case 4:i=mH;break;default:i=e0}n=i.bind(null,e,n,t),i=void 0,!pk||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function U_(t,e,n,r,i){var o=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;a=a.return}for(;s!==null;){if(a=gs(s),a===null)return;if(l=a.tag,l===5||l===6){r=o=a;continue e}s=s.parentNode}}r=r.return}Z$(function(){var c=o,u=Qk(n),d=[];e:{var p=PI.get(t);if(p!==void 0){var f=n0,h=t;switch(t){case"keypress":if(Jm(n)===0)break e;case"keydown":case"keyup":f=RH;break;case"focusin":h="focus",f=D_;break;case"focusout":h="blur",f=D_;break;case"beforeblur":case"afterblur":f=D_;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":f=BR;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=vH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=LH;break;case kI:case TI:case SI:f=bH;break;case EI:f=OH;break;case"scroll":f=gH;break;case"wheel":f=DH;break;case"copy":case"cut":case"paste":f=kH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=HR}var g=(e&4)!==0,x=!g&&t==="scroll",m=g?p!==null?p+"Capture":null:p;g=[];for(var y=c,v;y!==null;){v=y;var w=v.stateNode;if(v.tag===5&&w!==null&&(v=w,m!==null&&(w=Qd(y,m),w!=null&&g.push(rp(y,w,v)))),x)break;y=y.return}0<g.length&&(p=new f(p,h,null,n,u),d.push({event:p,listeners:g}))}}if(!(e&7)){e:{if(p=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",p&&n!==uk&&(h=n.relatedTarget||n.fromElement)&&(gs(h)||h[uo]))break e;if((f||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,f?(h=n.relatedTarget||n.toElement,f=c,h=h?gs(h):null,h!==null&&(x=Ps(h),h!==x||h.tag!==5&&h.tag!==6)&&(h=null)):(f=null,h=c),f!==h)){if(g=BR,w="onMouseLeave",m="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(g=HR,w="onPointerLeave",m="onPointerEnter",y="pointer"),x=f==null?p:Xl(f),v=h==null?p:Xl(h),p=new g(w,y+"leave",f,n,u),p.target=x,p.relatedTarget=v,w=null,gs(u)===c&&(g=new g(m,y+"enter",h,n,u),g.target=v,g.relatedTarget=x,w=g),x=w,f&&h)t:{for(g=f,m=h,y=0,v=g;v;v=Wl(v))y++;for(v=0,w=m;w;w=Wl(w))v++;for(;0<y-v;)g=Wl(g),y--;for(;0<v-y;)m=Wl(m),v--;for(;y--;){if(g===m||m!==null&&g===m.alternate)break t;g=Wl(g),m=Wl(m)}g=null}else g=null;f!==null&&n$(d,p,f,g,!1),h!==null&&x!==null&&n$(d,x,h,g,!0)}}e:{if(p=c?Xl(c):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var k=HH;else if(KR(p))if(vI)k=GH;else{k=qH;var b=WH}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(k=KH);if(k&&(k=k(t,c))){yI(d,k,n,u);break e}b&&b(t,p,c),t==="focusout"&&(b=p._wrapperState)&&b.controlled&&p.type==="number"&&ok(p,"number",p.value)}switch(b=c?Xl(c):window,t){case"focusin":(KR(b)||b.contentEditable==="true")&&(Yl=b,yk=c,jd=null);break;case"focusout":jd=yk=Yl=null;break;case"mousedown":vk=!0;break;case"contextmenu":case"mouseup":case"dragend":vk=!1,XR(d,n,u);break;case"selectionchange":if(XH)break;case"keydown":case"keyup":XR(d,n,u)}var S;if(i0)e:{switch(t){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else Gl?mI(t,n)&&(C="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(hI&&n.locale!=="ko"&&(Gl||C!=="onCompositionStart"?C==="onCompositionEnd"&&Gl&&(S=fI()):(ca=u,t0="value"in ca?ca.value:ca.textContent,Gl=!0)),b=hg(c,C),0<b.length&&(C=new jR(C,t,null,n,u),d.push({event:C,listeners:b}),S?C.data=S:(S=gI(n),S!==null&&(C.data=S)))),(S=VH?zH(t,n):UH(t,n))&&(c=hg(c,"onBeforeInput"),0<c.length&&(u=new jR("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=S))}CI(d,e)})}function rp(t,e,n){return{instance:t,listener:e,currentTarget:n}}function hg(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=Qd(t,n),o!=null&&r.unshift(rp(t,o,i)),o=Qd(t,e),o!=null&&r.push(rp(t,o,i))),t=t.return}return r}function Wl(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function n$(t,e,n,r,i){for(var o=e._reactName,a=[];n!==null&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(l!==null&&l===r)break;s.tag===5&&c!==null&&(s=c,i?(l=Qd(n,o),l!=null&&a.unshift(rp(n,l,s))):i||(l=Qd(n,o),l!=null&&a.push(rp(n,l,s)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var JH=/\r\n?/g,e7=/\u0000|\uFFFD/g;function r$(t){return(typeof t=="string"?t:""+t).replace(JH,`
|
|
`).replace(e7,"")}function Wm(t,e,n){if(e=r$(e),r$(t)!==e&&n)throw Error(U(425))}function mg(){}var xk=null,wk=null;function bk(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 _k=typeof setTimeout=="function"?setTimeout:void 0,t7=typeof clearTimeout=="function"?clearTimeout:void 0,i$=typeof Promise=="function"?Promise:void 0,n7=typeof queueMicrotask=="function"?queueMicrotask:typeof i$<"u"?function(t){return i$.resolve(null).then(t).catch(r7)}:_k;function r7(t){setTimeout(function(){throw t})}function B_(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),Jd(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Jd(e)}function ha(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 o$(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 vc=Math.random().toString(36).slice(2),Li="__reactFiber$"+vc,ip="__reactProps$"+vc,uo="__reactContainer$"+vc,kk="__reactEvents$"+vc,i7="__reactListeners$"+vc,o7="__reactHandles$"+vc;function gs(t){var e=t[Li];if(e)return e;for(var n=t.parentNode;n;){if(e=n[uo]||n[Li]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=o$(t);t!==null;){if(n=t[Li])return n;t=o$(t)}return e}t=n,n=t.parentNode}return null}function fp(t){return t=t[Li]||t[uo],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Xl(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(U(33))}function Og(t){return t[ip]||null}var Tk=[],Zl=-1;function _a(t){return{current:t}}function Xe(t){0>Zl||(t.current=Tk[Zl],Tk[Zl]=null,Zl--)}function je(t,e){Zl++,Tk[Zl]=t.current,t.current=e}var wa={},mn=_a(wa),Bn=_a(!1),bs=wa;function dc(t,e){var n=t.type.contextTypes;if(!n)return wa;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function jn(t){return t=t.childContextTypes,t!=null}function gg(){Xe(Bn),Xe(mn)}function a$(t,e,n){if(mn.current!==wa)throw Error(U(168));je(mn,e),je(Bn,n)}function RI(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(U(108,Wj(t)||"Unknown",i));return ut({},n,r)}function yg(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wa,bs=mn.current,je(mn,t),je(Bn,Bn.current),!0}function s$(t,e,n){var r=t.stateNode;if(!r)throw Error(U(169));n?(t=RI(t,e,bs),r.__reactInternalMemoizedMergedChildContext=t,Xe(Bn),Xe(mn),je(mn,t)):Xe(Bn),je(Bn,n)}var oo=null,Fg=!1,j_=!1;function $I(t){oo===null?oo=[t]:oo.push(t)}function a7(t){Fg=!0,$I(t)}function ka(){if(!j_&&oo!==null){j_=!0;var t=0,e=Fe;try{var n=oo;for(Fe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}oo=null,Fg=!1}catch(i){throw oo!==null&&(oo=oo.slice(t+1)),nI(Xk,ka),i}finally{Fe=e,j_=!1}}return null}var Jl=[],ec=0,vg=null,xg=0,Lr=[],Ar=0,_s=null,ao=1,so="";function hs(t,e){Jl[ec++]=xg,Jl[ec++]=vg,vg=t,xg=e}function II(t,e,n){Lr[Ar++]=ao,Lr[Ar++]=so,Lr[Ar++]=_s,_s=t;var r=ao;t=so;var i=32-si(r)-1;r&=~(1<<i),n+=1;var o=32-si(e)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,ao=1<<32-si(e)+i|n<<i|r,so=o+t}else ao=1<<o|n<<i|r,so=t}function a0(t){t.return!==null&&(hs(t,1),II(t,1,0))}function s0(t){for(;t===vg;)vg=Jl[--ec],Jl[ec]=null,xg=Jl[--ec],Jl[ec]=null;for(;t===_s;)_s=Lr[--Ar],Lr[Ar]=null,so=Lr[--Ar],Lr[Ar]=null,ao=Lr[--Ar],Lr[Ar]=null}var ar=null,or=null,it=!1,ai=null;function LI(t,e){var n=Or(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 l$(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,ar=t,or=ha(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,ar=t,or=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=_s!==null?{id:ao,overflow:so}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Or(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,ar=t,or=null,!0):!1;default:return!1}}function Sk(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Ek(t){if(it){var e=or;if(e){var n=e;if(!l$(t,e)){if(Sk(t))throw Error(U(418));e=ha(n.nextSibling);var r=ar;e&&l$(t,e)?LI(r,n):(t.flags=t.flags&-4097|2,it=!1,ar=t)}}else{if(Sk(t))throw Error(U(418));t.flags=t.flags&-4097|2,it=!1,ar=t}}}function c$(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;ar=t}function qm(t){if(t!==ar)return!1;if(!it)return c$(t),it=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!bk(t.type,t.memoizedProps)),e&&(e=or)){if(Sk(t))throw AI(),Error(U(418));for(;e;)LI(t,e),e=ha(e.nextSibling)}if(c$(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(U(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){or=ha(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}or=null}}else or=ar?ha(t.stateNode.nextSibling):null;return!0}function AI(){for(var t=or;t;)t=ha(t.nextSibling)}function pc(){or=ar=null,it=!1}function l0(t){ai===null?ai=[t]:ai.push(t)}var s7=ho.ReactCurrentBatchConfig;function ii(t,e){if(t&&t.defaultProps){e=ut({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}var wg=_a(null),bg=null,tc=null,c0=null;function u0(){c0=tc=bg=null}function d0(t){var e=wg.current;Xe(wg),t._currentValue=e}function Pk(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function lc(t,e){bg=t,c0=tc=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Un=!0),t.firstContext=null)}function Dr(t){var e=t._currentValue;if(c0!==t)if(t={context:t,memoizedValue:e,next:null},tc===null){if(bg===null)throw Error(U(308));tc=t,bg.dependencies={lanes:0,firstContext:t}}else tc=tc.next=t;return e}var ys=null;function p0(t){ys===null?ys=[t]:ys.push(t)}function OI(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,p0(e)):(n.next=i.next,i.next=n),e.interleaved=n,po(t,r)}function po(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 aa=!1;function f0(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function FI(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 lo(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ma(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Me&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,po(t,n)}return i=r.interleaved,i===null?(e.next=e,p0(r)):(e.next=i.next,i.next=e),r.interleaved=e,po(t,n)}function eg(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Zk(t,n)}}function u$(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=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};o===null?i=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function _g(t,e,n,r){var i=t.updateQueue;aa=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var l=s,c=l.next;l.next=null,a===null?o=c:a.next=c,a=l;var u=t.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==a&&(s===null?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(o!==null){var d=i.baseState;a=0,u=c=l=null,s=o;do{var p=s.lane,f=s.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:f,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var h=t,g=s;switch(p=e,f=n,g.tag){case 1:if(h=g.payload,typeof h=="function"){d=h.call(f,d,p);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h=="function"?h.call(f,d,p):h,p==null)break e;d=ut({},d,p);break e;case 2:aa=!0}}s.callback!==null&&s.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[s]:p.push(s))}else f={eventTime:f,lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,a|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Ts|=a,t.lanes=a,t.memoizedState=d}}function d$(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(U(191,i));i.call(r)}}}var DI=new O$.Component().refs;function Ck(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ut({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Dg={isMounted:function(t){return(t=t._reactInternals)?Ps(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=En(),i=ya(t),o=lo(r,i);o.payload=e,n!=null&&(o.callback=n),e=ma(t,o,i),e!==null&&(li(e,t,i,r),eg(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=En(),i=ya(t),o=lo(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=ma(t,o,i),e!==null&&(li(e,t,i,r),eg(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=En(),r=ya(t),i=lo(n,r);i.tag=2,e!=null&&(i.callback=e),e=ma(t,i,r),e!==null&&(li(e,t,r,n),eg(e,t,r))}};function p$(t,e,n,r,i,o,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,o,a):e.prototype&&e.prototype.isPureReactComponent?!tp(n,r)||!tp(i,o):!0}function NI(t,e,n){var r=!1,i=wa,o=e.contextType;return typeof o=="object"&&o!==null?o=Dr(o):(i=jn(e)?bs:mn.current,r=e.contextTypes,o=(r=r!=null)?dc(t,i):wa),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Dg,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function f$(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Dg.enqueueReplaceState(e,e.state,null)}function Mk(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs=DI,f0(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Dr(o):(o=jn(e)?bs:mn.current,i.context=dc(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(Ck(t,e,o,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&Dg.enqueueReplaceState(i,i.state,null),_g(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function $d(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(U(309));var r=n.stateNode}if(!r)throw Error(U(147,t));var i=r,o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(a){var s=i.refs;s===DI&&(s=i.refs={}),a===null?delete s[o]:s[o]=a},e._stringRef=o,e)}if(typeof t!="string")throw Error(U(284));if(!n._owner)throw Error(U(290,t))}return t}function Km(t,e){throw t=Object.prototype.toString.call(e),Error(U(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function h$(t){var e=t._init;return e(t._payload)}function VI(t){function e(m,y){if(t){var v=m.deletions;v===null?(m.deletions=[y],m.flags|=16):v.push(y)}}function n(m,y){if(!t)return null;for(;y!==null;)e(m,y),y=y.sibling;return null}function r(m,y){for(m=new Map;y!==null;)y.key!==null?m.set(y.key,y):m.set(y.index,y),y=y.sibling;return m}function i(m,y){return m=va(m,y),m.index=0,m.sibling=null,m}function o(m,y,v){return m.index=v,t?(v=m.alternate,v!==null?(v=v.index,v<y?(m.flags|=2,y):v):(m.flags|=2,y)):(m.flags|=1048576,y)}function a(m){return t&&m.alternate===null&&(m.flags|=2),m}function s(m,y,v,w){return y===null||y.tag!==6?(y=Q_(v,m.mode,w),y.return=m,y):(y=i(y,v),y.return=m,y)}function l(m,y,v,w){var k=v.type;return k===Kl?u(m,y,v.props.children,w,v.key):y!==null&&(y.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===oa&&h$(k)===y.type)?(w=i(y,v.props),w.ref=$d(m,y,v),w.return=m,w):(w=ag(v.type,v.key,v.props,null,m.mode,w),w.ref=$d(m,y,v),w.return=m,w)}function c(m,y,v,w){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=X_(v,m.mode,w),y.return=m,y):(y=i(y,v.children||[]),y.return=m,y)}function u(m,y,v,w,k){return y===null||y.tag!==7?(y=ws(v,m.mode,w,k),y.return=m,y):(y=i(y,v),y.return=m,y)}function d(m,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Q_(""+y,m.mode,v),y.return=m,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Im:return v=ag(y.type,y.key,y.props,null,m.mode,v),v.ref=$d(m,null,y),v.return=m,v;case ql:return y=X_(y,m.mode,v),y.return=m,y;case oa:var w=y._init;return d(m,w(y._payload),v)}if(Fd(y)||Pd(y))return y=ws(y,m.mode,v,null),y.return=m,y;Km(m,y)}return null}function p(m,y,v,w){var k=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return k!==null?null:s(m,y,""+v,w);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Im:return v.key===k?l(m,y,v,w):null;case ql:return v.key===k?c(m,y,v,w):null;case oa:return k=v._init,p(m,y,k(v._payload),w)}if(Fd(v)||Pd(v))return k!==null?null:u(m,y,v,w,null);Km(m,v)}return null}function f(m,y,v,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return m=m.get(v)||null,s(y,m,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Im:return m=m.get(w.key===null?v:w.key)||null,l(y,m,w,k);case ql:return m=m.get(w.key===null?v:w.key)||null,c(y,m,w,k);case oa:var b=w._init;return f(m,y,v,b(w._payload),k)}if(Fd(w)||Pd(w))return m=m.get(v)||null,u(y,m,w,k,null);Km(y,w)}return null}function h(m,y,v,w){for(var k=null,b=null,S=y,C=y=0,R=null;S!==null&&C<v.length;C++){S.index>C?(R=S,S=null):R=S.sibling;var _=p(m,S,v[C],w);if(_===null){S===null&&(S=R);break}t&&S&&_.alternate===null&&e(m,S),y=o(_,y,C),b===null?k=_:b.sibling=_,b=_,S=R}if(C===v.length)return n(m,S),it&&hs(m,C),k;if(S===null){for(;C<v.length;C++)S=d(m,v[C],w),S!==null&&(y=o(S,y,C),b===null?k=S:b.sibling=S,b=S);return it&&hs(m,C),k}for(S=r(m,S);C<v.length;C++)R=f(S,m,C,v[C],w),R!==null&&(t&&R.alternate!==null&&S.delete(R.key===null?C:R.key),y=o(R,y,C),b===null?k=R:b.sibling=R,b=R);return t&&S.forEach(function(D){return e(m,D)}),it&&hs(m,C),k}function g(m,y,v,w){var k=Pd(v);if(typeof k!="function")throw Error(U(150));if(v=k.call(v),v==null)throw Error(U(151));for(var b=k=null,S=y,C=y=0,R=null,_=v.next();S!==null&&!_.done;C++,_=v.next()){S.index>C?(R=S,S=null):R=S.sibling;var D=p(m,S,_.value,w);if(D===null){S===null&&(S=R);break}t&&S&&D.alternate===null&&e(m,S),y=o(D,y,C),b===null?k=D:b.sibling=D,b=D,S=R}if(_.done)return n(m,S),it&&hs(m,C),k;if(S===null){for(;!_.done;C++,_=v.next())_=d(m,_.value,w),_!==null&&(y=o(_,y,C),b===null?k=_:b.sibling=_,b=_);return it&&hs(m,C),k}for(S=r(m,S);!_.done;C++,_=v.next())_=f(S,m,C,_.value,w),_!==null&&(t&&_.alternate!==null&&S.delete(_.key===null?C:_.key),y=o(_,y,C),b===null?k=_:b.sibling=_,b=_);return t&&S.forEach(function(I){return e(m,I)}),it&&hs(m,C),k}function x(m,y,v,w){if(typeof v=="object"&&v!==null&&v.type===Kl&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Im:e:{for(var k=v.key,b=y;b!==null;){if(b.key===k){if(k=v.type,k===Kl){if(b.tag===7){n(m,b.sibling),y=i(b,v.props.children),y.return=m,m=y;break e}}else if(b.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===oa&&h$(k)===b.type){n(m,b.sibling),y=i(b,v.props),y.ref=$d(m,b,v),y.return=m,m=y;break e}n(m,b);break}else e(m,b);b=b.sibling}v.type===Kl?(y=ws(v.props.children,m.mode,w,v.key),y.return=m,m=y):(w=ag(v.type,v.key,v.props,null,m.mode,w),w.ref=$d(m,y,v),w.return=m,m=w)}return a(m);case ql:e:{for(b=v.key;y!==null;){if(y.key===b)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(m,y.sibling),y=i(y,v.children||[]),y.return=m,m=y;break e}else{n(m,y);break}else e(m,y);y=y.sibling}y=X_(v,m.mode,w),y.return=m,m=y}return a(m);case oa:return b=v._init,x(m,y,b(v._payload),w)}if(Fd(v))return h(m,y,v,w);if(Pd(v))return g(m,y,v,w);Km(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(m,y.sibling),y=i(y,v),y.return=m,m=y):(n(m,y),y=Q_(v,m.mode,w),y.return=m,m=y),a(m)):n(m,y)}return x}var fc=VI(!0),zI=VI(!1),hp={},Oi=_a(hp),op=_a(hp),ap=_a(hp);function vs(t){if(t===hp)throw Error(U(174));return t}function h0(t,e){switch(je(ap,e),je(op,t),je(Oi,hp),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:sk(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=sk(e,t)}Xe(Oi),je(Oi,e)}function hc(){Xe(Oi),Xe(op),Xe(ap)}function UI(t){vs(ap.current);var e=vs(Oi.current),n=sk(e,t.type);e!==n&&(je(op,t),je(Oi,n))}function m0(t){op.current===t&&(Xe(Oi),Xe(op))}var lt=_a(0);function kg(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 H_=[];function g0(){for(var t=0;t<H_.length;t++)H_[t]._workInProgressVersionPrimary=null;H_.length=0}var tg=ho.ReactCurrentDispatcher,W_=ho.ReactCurrentBatchConfig,ks=0,ct=null,Nt=null,Ht=null,Tg=!1,Hd=!1,sp=0,l7=0;function pn(){throw Error(U(321))}function y0(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!ci(t[n],e[n]))return!1;return!0}function v0(t,e,n,r,i,o){if(ks=o,ct=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,tg.current=t===null||t.memoizedState===null?p7:f7,t=n(r,i),Hd){o=0;do{if(Hd=!1,sp=0,25<=o)throw Error(U(301));o+=1,Ht=Nt=null,e.updateQueue=null,tg.current=h7,t=n(r,i)}while(Hd)}if(tg.current=Sg,e=Nt!==null&&Nt.next!==null,ks=0,Ht=Nt=ct=null,Tg=!1,e)throw Error(U(300));return t}function x0(){var t=sp!==0;return sp=0,t}function Ii(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?ct.memoizedState=Ht=t:Ht=Ht.next=t,Ht}function Nr(){if(Nt===null){var t=ct.alternate;t=t!==null?t.memoizedState:null}else t=Nt.next;var e=Ht===null?ct.memoizedState:Ht.next;if(e!==null)Ht=e,Nt=t;else{if(t===null)throw Error(U(310));Nt=t,t={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Ht===null?ct.memoizedState=Ht=t:Ht=Ht.next=t}return Ht}function lp(t,e){return typeof e=="function"?e(t):e}function q_(t){var e=Nr(),n=e.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=t;var r=Nt,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var s=a=null,l=null,c=o;do{var u=c.lane;if((ks&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(s=l=d,a=r):l=l.next=d,ct.lanes|=u,Ts|=u}c=c.next}while(c!==null&&c!==o);l===null?a=r:l.next=s,ci(r,e.memoizedState)||(Un=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do o=i.lane,ct.lanes|=o,Ts|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function K_(t){var e=Nr(),n=e.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,o=e.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do o=t(o,a.action),a=a.next;while(a!==i);ci(o,e.memoizedState)||(Un=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function BI(){}function jI(t,e){var n=ct,r=Nr(),i=e(),o=!ci(r.memoizedState,i);if(o&&(r.memoizedState=i,Un=!0),r=r.queue,w0(qI.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||Ht!==null&&Ht.memoizedState.tag&1){if(n.flags|=2048,cp(9,WI.bind(null,n,r,i,e),void 0,null),Wt===null)throw Error(U(349));ks&30||HI(n,e,i)}return i}function HI(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ct.updateQueue,e===null?(e={lastEffect:null,stores:null},ct.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function WI(t,e,n,r){e.value=n,e.getSnapshot=r,KI(e)&&GI(t)}function qI(t,e,n){return n(function(){KI(e)&&GI(t)})}function KI(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ci(t,n)}catch{return!0}}function GI(t){var e=po(t,1);e!==null&&li(e,t,1,-1)}function m$(t){var e=Ii();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lp,lastRenderedState:t},e.queue=t,t=t.dispatch=d7.bind(null,ct,t),[e.memoizedState,t]}function cp(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ct.updateQueue,e===null?(e={lastEffect:null,stores:null},ct.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function YI(){return Nr().memoizedState}function ng(t,e,n,r){var i=Ii();ct.flags|=t,i.memoizedState=cp(1|e,n,void 0,r===void 0?null:r)}function Ng(t,e,n,r){var i=Nr();r=r===void 0?null:r;var o=void 0;if(Nt!==null){var a=Nt.memoizedState;if(o=a.destroy,r!==null&&y0(r,a.deps)){i.memoizedState=cp(e,n,o,r);return}}ct.flags|=t,i.memoizedState=cp(1|e,n,o,r)}function g$(t,e){return ng(8390656,8,t,e)}function w0(t,e){return Ng(2048,8,t,e)}function QI(t,e){return Ng(4,2,t,e)}function XI(t,e){return Ng(4,4,t,e)}function ZI(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 JI(t,e,n){return n=n!=null?n.concat([t]):null,Ng(4,4,ZI.bind(null,e,t),n)}function b0(){}function eL(t,e){var n=Nr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&y0(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function tL(t,e){var n=Nr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&y0(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function nL(t,e,n){return ks&21?(ci(n,e)||(n=oI(),ct.lanes|=n,Ts|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Un=!0),t.memoizedState=n)}function c7(t,e){var n=Fe;Fe=n!==0&&4>n?n:4,t(!0);var r=W_.transition;W_.transition={};try{t(!1),e()}finally{Fe=n,W_.transition=r}}function rL(){return Nr().memoizedState}function u7(t,e,n){var r=ya(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},iL(t))oL(e,n);else if(n=OI(t,e,n,r),n!==null){var i=En();li(n,t,r,i),aL(n,e,r)}}function d7(t,e,n){var r=ya(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(iL(t))oL(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var a=e.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,ci(s,a)){var l=e.interleaved;l===null?(i.next=i,p0(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=OI(t,e,i,r),n!==null&&(i=En(),li(n,t,r,i),aL(n,e,r))}}function iL(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function oL(t,e){Hd=Tg=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function aL(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Zk(t,n)}}var Sg={readContext:Dr,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},p7={readContext:Dr,useCallback:function(t,e){return Ii().memoizedState=[t,e===void 0?null:e],t},useContext:Dr,useEffect:g$,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ng(4194308,4,ZI.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ng(4194308,4,t,e)},useInsertionEffect:function(t,e){return ng(4,2,t,e)},useMemo:function(t,e){var n=Ii();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ii();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=u7.bind(null,ct,t),[r.memoizedState,t]},useRef:function(t){var e=Ii();return t={current:t},e.memoizedState=t},useState:m$,useDebugValue:b0,useDeferredValue:function(t){return Ii().memoizedState=t},useTransition:function(){var t=m$(!1),e=t[0];return t=c7.bind(null,t[1]),Ii().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ct,i=Ii();if(it){if(n===void 0)throw Error(U(407));n=n()}else{if(n=e(),Wt===null)throw Error(U(349));ks&30||HI(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,g$(qI.bind(null,r,o,t),[t]),r.flags|=2048,cp(9,WI.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=Ii(),e=Wt.identifierPrefix;if(it){var n=so,r=ao;n=(r&~(1<<32-si(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=sp++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=l7++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},f7={readContext:Dr,useCallback:eL,useContext:Dr,useEffect:w0,useImperativeHandle:JI,useInsertionEffect:QI,useLayoutEffect:XI,useMemo:tL,useReducer:q_,useRef:YI,useState:function(){return q_(lp)},useDebugValue:b0,useDeferredValue:function(t){var e=Nr();return nL(e,Nt.memoizedState,t)},useTransition:function(){var t=q_(lp)[0],e=Nr().memoizedState;return[t,e]},useMutableSource:BI,useSyncExternalStore:jI,useId:rL,unstable_isNewReconciler:!1},h7={readContext:Dr,useCallback:eL,useContext:Dr,useEffect:w0,useImperativeHandle:JI,useInsertionEffect:QI,useLayoutEffect:XI,useMemo:tL,useReducer:K_,useRef:YI,useState:function(){return K_(lp)},useDebugValue:b0,useDeferredValue:function(t){var e=Nr();return Nt===null?e.memoizedState=t:nL(e,Nt.memoizedState,t)},useTransition:function(){var t=K_(lp)[0],e=Nr().memoizedState;return[t,e]},useMutableSource:BI,useSyncExternalStore:jI,useId:rL,unstable_isNewReconciler:!1};function mc(t,e){try{var n="",r=e;do n+=Hj(r),r=r.return;while(r);var i=n}catch(o){i=`
|
|
Error generating stack: `+o.message+`
|
|
`+o.stack}return{value:t,source:e,stack:i,digest:null}}function G_(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Rk(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var m7=typeof WeakMap=="function"?WeakMap:Map;function sL(t,e,n){n=lo(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Pg||(Pg=!0,zk=r),Rk(t,e)},n}function lL(t,e,n){n=lo(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Rk(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Rk(t,e),typeof r!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function y$(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new m7;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=M7.bind(null,t,e,n),e.then(t,t))}function v$(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 x$(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,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=lo(-1,1),e.tag=2,ma(n,e,1))),n.lanes|=1),t)}var g7=ho.ReactCurrentOwner,Un=!1;function Sn(t,e,n,r){e.child=t===null?zI(e,null,n,r):fc(e,t.child,n,r)}function w$(t,e,n,r,i){n=n.render;var o=e.ref;return lc(e,i),r=v0(t,e,n,r,o,i),n=x0(),t!==null&&!Un?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,fo(t,e,i)):(it&&n&&a0(e),e.flags|=1,Sn(t,e,r,i),e.child)}function b$(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!M0(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,cL(t,e,o,r,i)):(t=ag(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:tp,n(a,r)&&t.ref===e.ref)return fo(t,e,i)}return e.flags|=1,t=va(o,r),t.ref=e.ref,t.return=e,e.child=t}function cL(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(tp(o,r)&&t.ref===e.ref)if(Un=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(Un=!0);else return e.lanes=t.lanes,fo(t,e,i)}return $k(t,e,n,r,i)}function uL(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},je(rc,ir),ir|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,je(rc,ir),ir|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,je(rc,ir),ir|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,je(rc,ir),ir|=r;return Sn(t,e,i,n),e.child}function dL(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function $k(t,e,n,r,i){var o=jn(n)?bs:mn.current;return o=dc(e,o),lc(e,i),n=v0(t,e,n,r,o,i),r=x0(),t!==null&&!Un?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,fo(t,e,i)):(it&&r&&a0(e),e.flags|=1,Sn(t,e,n,i),e.child)}function _$(t,e,n,r,i){if(jn(n)){var o=!0;yg(e)}else o=!1;if(lc(e,i),e.stateNode===null)rg(t,e),NI(e,n,r),Mk(e,n,r,i),r=!0;else if(t===null){var a=e.stateNode,s=e.memoizedProps;a.props=s;var l=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=Dr(c):(c=jn(n)?bs:mn.current,c=dc(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==r||l!==c)&&f$(e,a,r,c),aa=!1;var p=e.memoizedState;a.state=p,_g(e,r,a,i),l=e.memoizedState,s!==r||p!==l||Bn.current||aa?(typeof u=="function"&&(Ck(e,n,u,r),l=e.memoizedState),(s=aa||p$(e,n,s,r,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=r,e.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{a=e.stateNode,FI(t,e),s=e.memoizedProps,c=e.type===e.elementType?s:ii(e.type,s),a.props=c,d=e.pendingProps,p=a.context,l=n.contextType,typeof l=="object"&&l!==null?l=Dr(l):(l=jn(n)?bs:mn.current,l=dc(e,l));var f=n.getDerivedStateFromProps;(u=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==d||p!==l)&&f$(e,a,r,l),aa=!1,p=e.memoizedState,a.state=p,_g(e,r,a,i);var h=e.memoizedState;s!==d||p!==h||Bn.current||aa?(typeof f=="function"&&(Ck(e,n,f,r),h=e.memoizedState),(c=aa||p$(e,n,c,r,p,h,l)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,h,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,h,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),a.props=r,a.state=h,a.context=l,r=c):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),r=!1)}return Ik(t,e,n,r,o,i)}function Ik(t,e,n,r,i,o){dL(t,e);var a=(e.flags&128)!==0;if(!r&&!a)return i&&s$(e,n,!1),fo(t,e,o);r=e.stateNode,g7.current=e;var s=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&a?(e.child=fc(e,t.child,null,o),e.child=fc(e,null,s,o)):Sn(t,e,s,o),e.memoizedState=r.state,i&&s$(e,n,!0),e.child}function pL(t){var e=t.stateNode;e.pendingContext?a$(t,e.pendingContext,e.pendingContext!==e.context):e.context&&a$(t,e.context,!1),h0(t,e.containerInfo)}function k$(t,e,n,r,i){return pc(),l0(i),e.flags|=256,Sn(t,e,n,r),e.child}var Lk={dehydrated:null,treeContext:null,retryLane:0};function Ak(t){return{baseLanes:t,cachePool:null,transitions:null}}function fL(t,e,n){var r=e.pendingProps,i=lt.current,o=!1,a=(e.flags&128)!==0,s;if((s=a)||(s=t!==null&&t.memoizedState===null?!1:(i&2)!==0),s?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),je(lt,i&1),t===null)return Ek(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=r.children,t=r.fallback,o?(r=e.mode,o=e.child,a={mode:"hidden",children:a},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=Ug(a,r,0,null),t=ws(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Ak(n),e.memoizedState=Lk,t):_0(e,a));if(i=t.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return y7(t,e,a,r,s,i,n);if(o){o=r.fallback,a=e.mode,i=t.child,s=i.sibling;var l={mode:"hidden",children:r.children};return!(a&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=va(i,l),r.subtreeFlags=i.subtreeFlags&14680064),s!==null?o=va(s,o):(o=ws(o,a,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,a=t.child.memoizedState,a=a===null?Ak(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=t.childLanes&~n,e.memoizedState=Lk,r}return o=t.child,t=o.sibling,r=va(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function _0(t,e){return e=Ug({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Gm(t,e,n,r){return r!==null&&l0(r),fc(e,t.child,null,n),t=_0(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function y7(t,e,n,r,i,o,a){if(n)return e.flags&256?(e.flags&=-257,r=G_(Error(U(422))),Gm(t,e,a,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Ug({mode:"visible",children:r.children},i,0,null),o=ws(o,i,a,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&fc(e,t.child,null,a),e.child.memoizedState=Ak(a),e.memoizedState=Lk,o);if(!(e.mode&1))return Gm(t,e,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var s=r.dgst;return r=s,o=Error(U(419)),r=G_(o,r,void 0),Gm(t,e,a,r)}if(s=(a&t.childLanes)!==0,Un||s){if(r=Wt,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,po(t,i),li(r,t,i,-1))}return C0(),r=G_(Error(U(421))),Gm(t,e,a,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=R7.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,or=ha(i.nextSibling),ar=e,it=!0,ai=null,t!==null&&(Lr[Ar++]=ao,Lr[Ar++]=so,Lr[Ar++]=_s,ao=t.id,so=t.overflow,_s=e),e=_0(e,r.children),e.flags|=4096,e)}function T$(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Pk(t.return,e,n)}function Y_(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function hL(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(Sn(t,e,r.children,n),r=lt.current,r&2)r=r&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&&T$(t,n,e);else if(t.tag===19)T$(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}r&=1}if(je(lt,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&kg(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Y_(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&kg(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Y_(e,!0,n,null,o);break;case"together":Y_(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function rg(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function fo(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Ts|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(U(153));if(e.child!==null){for(t=e.child,n=va(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=va(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function v7(t,e,n){switch(e.tag){case 3:pL(e),pc();break;case 5:UI(e);break;case 1:jn(e.type)&&yg(e);break;case 4:h0(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;je(wg,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(je(lt,lt.current&1),e.flags|=128,null):n&e.child.childLanes?fL(t,e,n):(je(lt,lt.current&1),t=fo(t,e,n),t!==null?t.sibling:null);je(lt,lt.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return hL(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),je(lt,lt.current),r)break;return null;case 22:case 23:return e.lanes=0,uL(t,e,n)}return fo(t,e,n)}var mL,Ok,gL,yL;mL=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}};Ok=function(){};gL=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,vs(Oi.current);var o=null;switch(n){case"input":i=rk(t,i),r=rk(t,r),o=[];break;case"select":i=ut({},i,{value:void 0}),r=ut({},r,{value:void 0}),o=[];break;case"textarea":i=ak(t,i),r=ak(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=mg)}lk(n,r);var a;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var s=i[c];for(a in s)s.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Gd.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(s=i?.[c],r.hasOwnProperty(c)&&l!==s&&(l!=null||s!=null))if(c==="style")if(s){for(a in s)!s.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in l)l.hasOwnProperty(a)&&s[a]!==l[a]&&(n||(n={}),n[a]=l[a])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,s=s?s.__html:void 0,l!=null&&s!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Gd.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Qe("scroll",t),o||s===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(e.updateQueue=c)&&(e.flags|=4)}};yL=function(t,e,n,r){n!==r&&(e.flags|=4)};function Id(t,e){if(!it)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 r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function fn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function x7(t,e,n){var r=e.pendingProps;switch(s0(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fn(e),null;case 1:return jn(e.type)&&gg(),fn(e),null;case 3:return r=e.stateNode,hc(),Xe(Bn),Xe(mn),g0(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(qm(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ai!==null&&(jk(ai),ai=null))),Ok(t,e),fn(e),null;case 5:m0(e);var i=vs(ap.current);if(n=e.type,t!==null&&e.stateNode!=null)gL(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(U(166));return fn(e),null}if(t=vs(Oi.current),qm(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[Li]=e,r[ip]=o,t=(e.mode&1)!==0,n){case"dialog":Qe("cancel",r),Qe("close",r);break;case"iframe":case"object":case"embed":Qe("load",r);break;case"video":case"audio":for(i=0;i<Nd.length;i++)Qe(Nd[i],r);break;case"source":Qe("error",r);break;case"img":case"image":case"link":Qe("error",r),Qe("load",r);break;case"details":Qe("toggle",r);break;case"input":IR(r,o),Qe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Qe("invalid",r);break;case"textarea":AR(r,o),Qe("invalid",r)}lk(n,o),i=null;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];a==="children"?typeof s=="string"?r.textContent!==s&&(o.suppressHydrationWarning!==!0&&Wm(r.textContent,s,t),i=["children",s]):typeof s=="number"&&r.textContent!==""+s&&(o.suppressHydrationWarning!==!0&&Wm(r.textContent,s,t),i=["children",""+s]):Gd.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&Qe("scroll",r)}switch(n){case"input":Lm(r),LR(r,o,!0);break;case"textarea":Lm(r),OR(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=mg)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=H$(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=a.createElement(n,{is:r.is}):(t=a.createElement(n),n==="select"&&(a=t,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):t=a.createElementNS(t,n),t[Li]=e,t[ip]=r,mL(t,e,!1,!1),e.stateNode=t;e:{switch(a=ck(n,r),n){case"dialog":Qe("cancel",t),Qe("close",t),i=r;break;case"iframe":case"object":case"embed":Qe("load",t),i=r;break;case"video":case"audio":for(i=0;i<Nd.length;i++)Qe(Nd[i],t);i=r;break;case"source":Qe("error",t),i=r;break;case"img":case"image":case"link":Qe("error",t),Qe("load",t),i=r;break;case"details":Qe("toggle",t),i=r;break;case"input":IR(t,r),i=rk(t,r),Qe("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=ut({},r,{value:void 0}),Qe("invalid",t);break;case"textarea":AR(t,r),i=ak(t,r),Qe("invalid",t);break;default:i=r}lk(n,i),s=i;for(o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="style"?K$(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&W$(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Yd(t,l):typeof l=="number"&&Yd(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Gd.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Qe("scroll",t):l!=null&&qk(t,o,l,a))}switch(n){case"input":Lm(t),LR(t,r,!1);break;case"textarea":Lm(t),OR(t);break;case"option":r.value!=null&&t.setAttribute("value",""+xa(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?ic(t,!!r.multiple,o,!1):r.defaultValue!=null&&ic(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=mg)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return fn(e),null;case 6:if(t&&e.stateNode!=null)yL(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(U(166));if(n=vs(ap.current),vs(Oi.current),qm(e)){if(r=e.stateNode,n=e.memoizedProps,r[Li]=e,(o=r.nodeValue!==n)&&(t=ar,t!==null))switch(t.tag){case 3:Wm(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Wm(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Li]=e,e.stateNode=r}return fn(e),null;case 13:if(Xe(lt),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(it&&or!==null&&e.mode&1&&!(e.flags&128))AI(),pc(),e.flags|=98560,o=!1;else if(o=qm(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error(U(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(U(317));o[Li]=e}else pc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;fn(e),o=!1}else ai!==null&&(jk(ai),ai=null),o=!0;if(!o)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||lt.current&1?Vt===0&&(Vt=3):C0())),e.updateQueue!==null&&(e.flags|=4),fn(e),null);case 4:return hc(),Ok(t,e),t===null&&np(e.stateNode.containerInfo),fn(e),null;case 10:return d0(e.type._context),fn(e),null;case 17:return jn(e.type)&&gg(),fn(e),null;case 19:if(Xe(lt),o=e.memoizedState,o===null)return fn(e),null;if(r=(e.flags&128)!==0,a=o.rendering,a===null)if(r)Id(o,!1);else{if(Vt!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=kg(t),a!==null){for(e.flags|=128,Id(o,!1),r=a.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)o=n,t=r,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,t=a.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return je(lt,lt.current&1|2),e.child}t=t.sibling}o.tail!==null&&wt()>gc&&(e.flags|=128,r=!0,Id(o,!1),e.lanes=4194304)}else{if(!r)if(t=kg(a),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Id(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!it)return fn(e),null}else 2*wt()-o.renderingStartTime>gc&&n!==1073741824&&(e.flags|=128,r=!0,Id(o,!1),e.lanes=4194304);o.isBackwards?(a.sibling=e.child,e.child=a):(n=o.last,n!==null?n.sibling=a:e.child=a,o.last=a)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=wt(),e.sibling=null,n=lt.current,je(lt,r?n&1|2:n&1),e):(fn(e),null);case 22:case 23:return P0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ir&1073741824&&(fn(e),e.subtreeFlags&6&&(e.flags|=8192)):fn(e),null;case 24:return null;case 25:return null}throw Error(U(156,e.tag))}function w7(t,e){switch(s0(e),e.tag){case 1:return jn(e.type)&&gg(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return hc(),Xe(Bn),Xe(mn),g0(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return m0(e),null;case 13:if(Xe(lt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(U(340));pc()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Xe(lt),null;case 4:return hc(),null;case 10:return d0(e.type._context),null;case 22:case 23:return P0(),null;case 24:return null;default:return null}}var Ym=!1,hn=!1,b7=typeof WeakSet=="function"?WeakSet:Set,G=null;function nc(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){mt(t,e,r)}else n.current=null}function Fk(t,e,n){try{n()}catch(r){mt(t,e,r)}}var S$=!1;function _7(t,e){if(xk=pg,t=bI(),o0(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,c=0,u=0,d=t,p=null;t:for(;;){for(var f;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(f=d.firstChild)!==null;)p=d,d=f;for(;;){if(d===t)break t;if(p===n&&++c===i&&(s=a),p===o&&++u===r&&(l=a),(f=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=f}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(wk={focusedElem:t,selectionRange:n},pg=!1,G=e;G!==null;)if(e=G,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,G=t;else for(;G!==null;){e=G;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,x=h.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?g:ii(e.type,g),x);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(w){mt(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,G=t;break}G=e.return}return h=S$,S$=!1,h}function Wd(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Fk(e,n,o)}i=i.next}while(i!==r)}}function Vg(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 r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Dk(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 vL(t){var e=t.alternate;e!==null&&(t.alternate=null,vL(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Li],delete e[ip],delete e[kk],delete e[i7],delete e[o7])),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 xL(t){return t.tag===5||t.tag===3||t.tag===4}function E$(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||xL(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 Nk(t,e,n){var r=t.tag;if(r===5||r===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=mg));else if(r!==4&&(t=t.child,t!==null))for(Nk(t,e,n),t=t.sibling;t!==null;)Nk(t,e,n),t=t.sibling}function Vk(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Vk(t,e,n),t=t.sibling;t!==null;)Vk(t,e,n),t=t.sibling}var tn=null,oi=!1;function ia(t,e,n){for(n=n.child;n!==null;)wL(t,e,n),n=n.sibling}function wL(t,e,n){if(Ai&&typeof Ai.onCommitFiberUnmount=="function")try{Ai.onCommitFiberUnmount($g,n)}catch{}switch(n.tag){case 5:hn||nc(n,e);case 6:var r=tn,i=oi;tn=null,ia(t,e,n),tn=r,oi=i,tn!==null&&(oi?(t=tn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):tn.removeChild(n.stateNode));break;case 18:tn!==null&&(oi?(t=tn,n=n.stateNode,t.nodeType===8?B_(t.parentNode,n):t.nodeType===1&&B_(t,n),Jd(t)):B_(tn,n.stateNode));break;case 4:r=tn,i=oi,tn=n.stateNode.containerInfo,oi=!0,ia(t,e,n),tn=r,oi=i;break;case 0:case 11:case 14:case 15:if(!hn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&Fk(n,e,a),i=i.next}while(i!==r)}ia(t,e,n);break;case 1:if(!hn&&(nc(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){mt(n,e,s)}ia(t,e,n);break;case 21:ia(t,e,n);break;case 22:n.mode&1?(hn=(r=hn)||n.memoizedState!==null,ia(t,e,n),hn=r):ia(t,e,n);break;default:ia(t,e,n)}}function P$(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new b7),e.forEach(function(r){var i=$7.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ri(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=t,a=e,s=a;e:for(;s!==null;){switch(s.tag){case 5:tn=s.stateNode,oi=!1;break e;case 3:tn=s.stateNode.containerInfo,oi=!0;break e;case 4:tn=s.stateNode.containerInfo,oi=!0;break e}s=s.return}if(tn===null)throw Error(U(160));wL(o,a,i),tn=null,oi=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){mt(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)bL(e,t),e=e.sibling}function bL(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(ri(e,t),$i(t),r&4){try{Wd(3,t,t.return),Vg(3,t)}catch(g){mt(t,t.return,g)}try{Wd(5,t,t.return)}catch(g){mt(t,t.return,g)}}break;case 1:ri(e,t),$i(t),r&512&&n!==null&&nc(n,n.return);break;case 5:if(ri(e,t),$i(t),r&512&&n!==null&&nc(n,n.return),t.flags&32){var i=t.stateNode;try{Yd(i,"")}catch(g){mt(t,t.return,g)}}if(r&4&&(i=t.stateNode,i!=null)){var o=t.memoizedProps,a=n!==null?n.memoizedProps:o,s=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{s==="input"&&o.type==="radio"&&o.name!=null&&B$(i,o),ck(s,a);var c=ck(s,o);for(a=0;a<l.length;a+=2){var u=l[a],d=l[a+1];u==="style"?K$(i,d):u==="dangerouslySetInnerHTML"?W$(i,d):u==="children"?Yd(i,d):qk(i,u,d,c)}switch(s){case"input":ik(i,o);break;case"textarea":j$(i,o);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var f=o.value;f!=null?ic(i,!!o.multiple,f,!1):p!==!!o.multiple&&(o.defaultValue!=null?ic(i,!!o.multiple,o.defaultValue,!0):ic(i,!!o.multiple,o.multiple?[]:"",!1))}i[ip]=o}catch(g){mt(t,t.return,g)}}break;case 6:if(ri(e,t),$i(t),r&4){if(t.stateNode===null)throw Error(U(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(g){mt(t,t.return,g)}}break;case 3:if(ri(e,t),$i(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Jd(e.containerInfo)}catch(g){mt(t,t.return,g)}break;case 4:ri(e,t),$i(t);break;case 13:ri(e,t),$i(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(S0=wt())),r&4&&P$(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(hn=(c=hn)||u,ri(e,t),hn=c):ri(e,t),$i(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(G=t,u=t.child;u!==null;){for(d=G=u;G!==null;){switch(p=G,f=p.child,p.tag){case 0:case 11:case 14:case 15:Wd(4,p,p.return);break;case 1:nc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount=="function"){r=p,n=p.return;try{e=r,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(g){mt(r,n,g)}}break;case 5:nc(p,p.return);break;case 22:if(p.memoizedState!==null){M$(d);continue}}f!==null?(f.return=p,G=f):M$(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(s=d.stateNode,l=d.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,s.style.display=q$("display",a))}catch(g){mt(t,t.return,g)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(g){mt(t,t.return,g)}}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:ri(e,t),$i(t),r&4&&P$(t);break;case 21:break;default:ri(e,t),$i(t)}}function $i(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(xL(n)){var r=n;break e}n=n.return}throw Error(U(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Yd(i,""),r.flags&=-33);var o=E$(t);Vk(t,o,i);break;case 3:case 4:var a=r.stateNode.containerInfo,s=E$(t);Nk(t,s,a);break;default:throw Error(U(161))}}catch(l){mt(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function k7(t,e,n){G=t,_L(t,e,n)}function _L(t,e,n){for(var r=(t.mode&1)!==0;G!==null;){var i=G,o=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||Ym;if(!a){var s=i.alternate,l=s!==null&&s.memoizedState!==null||hn;s=Ym;var c=hn;if(Ym=a,(hn=l)&&!c)for(G=i;G!==null;)a=G,l=a.child,a.tag===22&&a.memoizedState!==null?R$(i):l!==null?(l.return=a,G=l):R$(i);for(;o!==null;)G=o,_L(o,e,n),o=o.sibling;G=i,Ym=s,hn=c}C$(t,e,n)}else i.subtreeFlags&8772&&o!==null?(o.return=i,G=o):C$(t,e,n)}}function C$(t){for(;G!==null;){var e=G;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:hn||Vg(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!hn)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:ii(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;o!==null&&d$(e,o,r);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}d$(e,a,n)}break;case 5:var s=e.stateNode;if(n===null&&e.flags&4){n=s;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&&Jd(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(U(163))}hn||e.flags&512&&Dk(e)}catch(p){mt(e,e.return,p)}}if(e===t){G=null;break}if(n=e.sibling,n!==null){n.return=e.return,G=n;break}G=e.return}}function M$(t){for(;G!==null;){var e=G;if(e===t){G=null;break}var n=e.sibling;if(n!==null){n.return=e.return,G=n;break}G=e.return}}function R$(t){for(;G!==null;){var e=G;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Vg(4,e)}catch(l){mt(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){mt(e,i,l)}}var o=e.return;try{Dk(e)}catch(l){mt(e,o,l)}break;case 5:var a=e.return;try{Dk(e)}catch(l){mt(e,a,l)}}}catch(l){mt(e,e.return,l)}if(e===t){G=null;break}var s=e.sibling;if(s!==null){s.return=e.return,G=s;break}G=e.return}}var T7=Math.ceil,Eg=ho.ReactCurrentDispatcher,k0=ho.ReactCurrentOwner,Fr=ho.ReactCurrentBatchConfig,Me=0,Wt=null,Rt=null,nn=0,ir=0,rc=_a(0),Vt=0,up=null,Ts=0,zg=0,T0=0,qd=null,zn=null,S0=0,gc=1/0,io=null,Pg=!1,zk=null,ga=null,Qm=!1,ua=null,Cg=0,Kd=0,Uk=null,ig=-1,og=0;function En(){return Me&6?wt():ig!==-1?ig:ig=wt()}function ya(t){return t.mode&1?Me&2&&nn!==0?nn&-nn:s7.transition!==null?(og===0&&(og=oI()),og):(t=Fe,t!==0||(t=window.event,t=t===void 0?16:pI(t.type)),t):1}function li(t,e,n,r){if(50<Kd)throw Kd=0,Uk=null,Error(U(185));dp(t,n,r),(!(Me&2)||t!==Wt)&&(t===Wt&&(!(Me&2)&&(zg|=n),Vt===4&&la(t,nn)),Hn(t,r),n===1&&Me===0&&!(e.mode&1)&&(gc=wt()+500,Fg&&ka()))}function Hn(t,e){var n=t.callbackNode;cH(t,e);var r=dg(t,t===Wt?nn:0);if(r===0)n!==null&&NR(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&NR(n),e===1)t.tag===0?a7($$.bind(null,t)):$I($$.bind(null,t)),n7(function(){!(Me&6)&&ka()}),n=null;else{switch(aI(r)){case 1:n=Xk;break;case 4:n=rI;break;case 16:n=ug;break;case 536870912:n=iI;break;default:n=ug}n=RL(n,kL.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function kL(t,e){if(ig=-1,og=0,Me&6)throw Error(U(327));var n=t.callbackNode;if(cc()&&t.callbackNode!==n)return null;var r=dg(t,t===Wt?nn:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Mg(t,r);else{e=r;var i=Me;Me|=2;var o=SL();(Wt!==t||nn!==e)&&(io=null,gc=wt()+500,xs(t,e));do try{P7();break}catch(s){TL(t,s)}while(!0);u0(),Eg.current=o,Me=i,Rt!==null?e=0:(Wt=null,nn=0,e=Vt)}if(e!==0){if(e===2&&(i=hk(t),i!==0&&(r=i,e=Bk(t,i))),e===1)throw n=up,xs(t,0),la(t,r),Hn(t,wt()),n;if(e===6)la(t,r);else{if(i=t.current.alternate,!(r&30)&&!S7(i)&&(e=Mg(t,r),e===2&&(o=hk(t),o!==0&&(r=o,e=Bk(t,o))),e===1))throw n=up,xs(t,0),la(t,r),Hn(t,wt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(U(345));case 2:ms(t,zn,io);break;case 3:if(la(t,r),(r&130023424)===r&&(e=S0+500-wt(),10<e)){if(dg(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){En(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=_k(ms.bind(null,t,zn,io),e);break}ms(t,zn,io);break;case 4:if(la(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var a=31-si(r);o=1<<a,a=e[a],a>i&&(i=a),r&=~o}if(r=i,r=wt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*T7(r/1960))-r,10<r){t.timeoutHandle=_k(ms.bind(null,t,zn,io),r);break}ms(t,zn,io);break;case 5:ms(t,zn,io);break;default:throw Error(U(329))}}}return Hn(t,wt()),t.callbackNode===n?kL.bind(null,t):null}function Bk(t,e){var n=qd;return t.current.memoizedState.isDehydrated&&(xs(t,e).flags|=256),t=Mg(t,e),t!==2&&(e=zn,zn=n,e!==null&&jk(e)),t}function jk(t){zn===null?zn=t:zn.push.apply(zn,t)}function S7(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!ci(o(),i))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 la(t,e){for(e&=~T0,e&=~zg,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-si(e),r=1<<n;t[n]=-1,e&=~r}}function $$(t){if(Me&6)throw Error(U(327));cc();var e=dg(t,0);if(!(e&1))return Hn(t,wt()),null;var n=Mg(t,e);if(t.tag!==0&&n===2){var r=hk(t);r!==0&&(e=r,n=Bk(t,r))}if(n===1)throw n=up,xs(t,0),la(t,e),Hn(t,wt()),n;if(n===6)throw Error(U(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ms(t,zn,io),Hn(t,wt()),null}function E0(t,e){var n=Me;Me|=1;try{return t(e)}finally{Me=n,Me===0&&(gc=wt()+500,Fg&&ka())}}function Ss(t){ua!==null&&ua.tag===0&&!(Me&6)&&cc();var e=Me;Me|=1;var n=Fr.transition,r=Fe;try{if(Fr.transition=null,Fe=1,t)return t()}finally{Fe=r,Fr.transition=n,Me=e,!(Me&6)&&ka()}}function P0(){ir=rc.current,Xe(rc)}function xs(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,t7(n)),Rt!==null)for(n=Rt.return;n!==null;){var r=n;switch(s0(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&gg();break;case 3:hc(),Xe(Bn),Xe(mn),g0();break;case 5:m0(r);break;case 4:hc();break;case 13:Xe(lt);break;case 19:Xe(lt);break;case 10:d0(r.type._context);break;case 22:case 23:P0()}n=n.return}if(Wt=t,Rt=t=va(t.current,null),nn=ir=e,Vt=0,up=null,T0=zg=Ts=0,zn=qd=null,ys!==null){for(e=0;e<ys.length;e++)if(n=ys[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var a=o.next;o.next=i,r.next=a}n.pending=r}ys=null}return t}function TL(t,e){do{var n=Rt;try{if(u0(),tg.current=Sg,Tg){for(var r=ct.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Tg=!1}if(ks=0,Ht=Nt=ct=null,Hd=!1,sp=0,k0.current=null,n===null||n.return===null){Vt=1,up=e,Rt=null;break}e:{var o=t,a=n.return,s=n,l=e;if(e=nn,s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=s,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 f=v$(a);if(f!==null){f.flags&=-257,x$(f,a,s,o,e),f.mode&1&&y$(o,c,e),e=f,l=c;var h=e.updateQueue;if(h===null){var g=new Set;g.add(l),e.updateQueue=g}else h.add(l);break e}else{if(!(e&1)){y$(o,c,e),C0();break e}l=Error(U(426))}}else if(it&&s.mode&1){var x=v$(a);if(x!==null){!(x.flags&65536)&&(x.flags|=256),x$(x,a,s,o,e),l0(mc(l,s));break e}}o=l=mc(l,s),Vt!==4&&(Vt=2),qd===null?qd=[o]:qd.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var m=sL(o,l,e);u$(o,m);break e;case 1:s=l;var y=o.type,v=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(ga===null||!ga.has(v)))){o.flags|=65536,e&=-e,o.lanes|=e;var w=lL(o,s,e);u$(o,w);break e}}o=o.return}while(o!==null)}PL(n)}catch(k){e=k,Rt===n&&n!==null&&(Rt=n=n.return);continue}break}while(!0)}function SL(){var t=Eg.current;return Eg.current=Sg,t===null?Sg:t}function C0(){(Vt===0||Vt===3||Vt===2)&&(Vt=4),Wt===null||!(Ts&268435455)&&!(zg&268435455)||la(Wt,nn)}function Mg(t,e){var n=Me;Me|=2;var r=SL();(Wt!==t||nn!==e)&&(io=null,xs(t,e));do try{E7();break}catch(i){TL(t,i)}while(!0);if(u0(),Me=n,Eg.current=r,Rt!==null)throw Error(U(261));return Wt=null,nn=0,Vt}function E7(){for(;Rt!==null;)EL(Rt)}function P7(){for(;Rt!==null&&!eH();)EL(Rt)}function EL(t){var e=ML(t.alternate,t,ir);t.memoizedProps=t.pendingProps,e===null?PL(t):Rt=e,k0.current=null}function PL(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=w7(n,e),n!==null){n.flags&=32767,Rt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Vt=6,Rt=null;return}}else if(n=x7(n,e,ir),n!==null){Rt=n;return}if(e=e.sibling,e!==null){Rt=e;return}Rt=e=t}while(e!==null);Vt===0&&(Vt=5)}function ms(t,e,n){var r=Fe,i=Fr.transition;try{Fr.transition=null,Fe=1,C7(t,e,n,r)}finally{Fr.transition=i,Fe=r}return null}function C7(t,e,n,r){do cc();while(ua!==null);if(Me&6)throw Error(U(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(U(177));t.callbackNode=null,t.callbackPriority=0;var o=n.lanes|n.childLanes;if(uH(t,o),t===Wt&&(Rt=Wt=null,nn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Qm||(Qm=!0,RL(ug,function(){return cc(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Fr.transition,Fr.transition=null;var a=Fe;Fe=1;var s=Me;Me|=4,k0.current=null,_7(t,n),bL(n,t),QH(wk),pg=!!xk,wk=xk=null,t.current=n,k7(n,t,i),tH(),Me=s,Fe=a,Fr.transition=o}else t.current=n;if(Qm&&(Qm=!1,ua=t,Cg=i),o=t.pendingLanes,o===0&&(ga=null),iH(n.stateNode,r),Hn(t,wt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Pg)throw Pg=!1,t=zk,zk=null,t;return Cg&1&&t.tag!==0&&cc(),o=t.pendingLanes,o&1?t===Uk?Kd++:(Kd=0,Uk=t):Kd=0,ka(),null}function cc(){if(ua!==null){var t=aI(Cg),e=Fr.transition,n=Fe;try{if(Fr.transition=null,Fe=16>t?16:t,ua===null)var r=!1;else{if(t=ua,ua=null,Cg=0,Me&6)throw Error(U(331));var i=Me;for(Me|=4,G=t.current;G!==null;){var o=G,a=o.child;if(G.flags&16){var s=o.deletions;if(s!==null){for(var l=0;l<s.length;l++){var c=s[l];for(G=c;G!==null;){var u=G;switch(u.tag){case 0:case 11:case 15:Wd(8,u,o)}var d=u.child;if(d!==null)d.return=u,G=d;else for(;G!==null;){u=G;var p=u.sibling,f=u.return;if(vL(u),u===c){G=null;break}if(p!==null){p.return=f,G=p;break}G=f}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var x=g.sibling;g.sibling=null,g=x}while(g!==null)}}G=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,G=a;else e:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Wd(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,G=m;break e}G=o.return}}var y=t.current;for(G=y;G!==null;){a=G;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,G=v;else e:for(a=y;G!==null;){if(s=G,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:Vg(9,s)}}catch(k){mt(s,s.return,k)}if(s===a){G=null;break e}var w=s.sibling;if(w!==null){w.return=s.return,G=w;break e}G=s.return}}if(Me=i,ka(),Ai&&typeof Ai.onPostCommitFiberRoot=="function")try{Ai.onPostCommitFiberRoot($g,t)}catch{}r=!0}return r}finally{Fe=n,Fr.transition=e}}return!1}function I$(t,e,n){e=mc(n,e),e=sL(t,e,1),t=ma(t,e,1),e=En(),t!==null&&(dp(t,1,e),Hn(t,e))}function mt(t,e,n){if(t.tag===3)I$(t,t,n);else for(;e!==null;){if(e.tag===3){I$(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ga===null||!ga.has(r))){t=mc(n,t),t=lL(e,t,1),e=ma(e,t,1),t=En(),e!==null&&(dp(e,1,t),Hn(e,t));break}}e=e.return}}function M7(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=En(),t.pingedLanes|=t.suspendedLanes&n,Wt===t&&(nn&n)===n&&(Vt===4||Vt===3&&(nn&130023424)===nn&&500>wt()-S0?xs(t,0):T0|=n),Hn(t,e)}function CL(t,e){e===0&&(t.mode&1?(e=Fm,Fm<<=1,!(Fm&130023424)&&(Fm=4194304)):e=1);var n=En();t=po(t,e),t!==null&&(dp(t,e,n),Hn(t,n))}function R7(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),CL(t,n)}function $7(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(U(314))}r!==null&&r.delete(e),CL(t,n)}var ML;ML=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Bn.current)Un=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Un=!1,v7(t,e,n);Un=!!(t.flags&131072)}else Un=!1,it&&e.flags&1048576&&II(e,xg,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;rg(t,e),t=e.pendingProps;var i=dc(e,mn.current);lc(e,n),i=v0(null,e,r,t,i,n);var o=x0();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,jn(r)?(o=!0,yg(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,f0(e),i.updater=Dg,e.stateNode=i,i._reactInternals=e,Mk(e,r,t,n),e=Ik(null,e,r,!0,o,n)):(e.tag=0,it&&o&&a0(e),Sn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(rg(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=L7(r),t=ii(r,t),i){case 0:e=$k(null,e,r,t,n);break e;case 1:e=_$(null,e,r,t,n);break e;case 11:e=w$(null,e,r,t,n);break e;case 14:e=b$(null,e,r,ii(r.type,t),n);break e}throw Error(U(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ii(r,i),$k(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ii(r,i),_$(t,e,r,i,n);case 3:e:{if(pL(e),t===null)throw Error(U(387));r=e.pendingProps,o=e.memoizedState,i=o.element,FI(t,e),_g(e,r,null,n);var a=e.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=mc(Error(U(423)),e),e=k$(t,e,r,n,i);break e}else if(r!==i){i=mc(Error(U(424)),e),e=k$(t,e,r,n,i);break e}else for(or=ha(e.stateNode.containerInfo.firstChild),ar=e,it=!0,ai=null,n=zI(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(pc(),r===i){e=fo(t,e,n);break e}Sn(t,e,r,n)}e=e.child}return e;case 5:return UI(e),t===null&&Ek(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,a=i.children,bk(r,i)?a=null:o!==null&&bk(r,o)&&(e.flags|=32),dL(t,e),Sn(t,e,a,n),e.child;case 6:return t===null&&Ek(e),null;case 13:return fL(t,e,n);case 4:return h0(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=fc(e,null,r,n):Sn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ii(r,i),w$(t,e,r,i,n);case 7:return Sn(t,e,e.pendingProps,n),e.child;case 8:return Sn(t,e,e.pendingProps.children,n),e.child;case 12:return Sn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,a=i.value,je(wg,r._currentValue),r._currentValue=a,o!==null)if(ci(o.value,a)){if(o.children===i.children&&!Bn.current){e=fo(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=lo(-1,n&-n),l.tag=2;var c=o.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}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Pk(o.return,n,e),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===e.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(U(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),Pk(a,n,e),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===e){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Sn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,lc(e,n),i=Dr(i),r=r(i),e.flags|=1,Sn(t,e,r,n),e.child;case 14:return r=e.type,i=ii(r,e.pendingProps),i=ii(r.type,i),b$(t,e,r,i,n);case 15:return cL(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ii(r,i),rg(t,e),e.tag=1,jn(r)?(t=!0,yg(e)):t=!1,lc(e,n),NI(e,r,i),Mk(e,r,i,n),Ik(null,e,r,!0,t,n);case 19:return hL(t,e,n);case 22:return uL(t,e,n)}throw Error(U(156,e.tag))};function RL(t,e){return nI(t,e)}function I7(t,e,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(t,e,n,r){return new I7(t,e,n,r)}function M0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function L7(t){if(typeof t=="function")return M0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Gk)return 11;if(t===Yk)return 14}return 2}function va(t,e){var n=t.alternate;return n===null?(n=Or(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 ag(t,e,n,r,i,o){var a=2;if(r=t,typeof t=="function")M0(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Kl:return ws(n.children,i,o,e);case Kk:a=8,i|=8;break;case J_:return t=Or(12,n,e,i|2),t.elementType=J_,t.lanes=o,t;case ek:return t=Or(13,n,e,i),t.elementType=ek,t.lanes=o,t;case tk:return t=Or(19,n,e,i),t.elementType=tk,t.lanes=o,t;case V$:return Ug(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case D$:a=10;break e;case N$:a=9;break e;case Gk:a=11;break e;case Yk:a=14;break e;case oa:a=16,r=null;break e}throw Error(U(130,t==null?t:typeof t,""))}return e=Or(a,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function ws(t,e,n,r){return t=Or(7,t,r,e),t.lanes=n,t}function Ug(t,e,n,r){return t=Or(22,t,r,e),t.elementType=V$,t.lanes=n,t.stateNode={isHidden:!1},t}function Q_(t,e,n){return t=Or(6,t,null,e),t.lanes=n,t}function X_(t,e,n){return e=Or(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function A7(t,e,n,r,i){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=A_(0),this.expirationTimes=A_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=A_(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function R0(t,e,n,r,i,o,a,s,l){return t=new A7(t,e,n,s,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Or(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},f0(o),t}function O7(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ql,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function $L(t){if(!t)return wa;t=t._reactInternals;e:{if(Ps(t)!==t||t.tag!==1)throw Error(U(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(jn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(U(171))}if(t.tag===1){var n=t.type;if(jn(n))return RI(t,n,e)}return e}function IL(t,e,n,r,i,o,a,s,l){return t=R0(n,r,!0,t,i,o,a,s,l),t.context=$L(null),n=t.current,r=En(),i=ya(n),o=lo(r,i),o.callback=e??null,ma(n,o,i),t.current.lanes=i,dp(t,i,r),Hn(t,r),t}function Bg(t,e,n,r){var i=e.current,o=En(),a=ya(i);return n=$L(n),e.context===null?e.context=n:e.pendingContext=n,e=lo(o,a),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=ma(i,e,a),t!==null&&(li(t,i,a,o),eg(t,i,a)),a}function Rg(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 L$(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function $0(t,e){L$(t,e),(t=t.alternate)&&L$(t,e)}function F7(){return null}var LL=typeof reportError=="function"?reportError:function(t){console.error(t)};function I0(t){this._internalRoot=t}jg.prototype.render=I0.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(U(409));Bg(t,e,null,null)};jg.prototype.unmount=I0.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Ss(function(){Bg(null,t,null,null)}),e[uo]=null}};function jg(t){this._internalRoot=t}jg.prototype.unstable_scheduleHydration=function(t){if(t){var e=cI();t={blockedOn:null,target:t,priority:e};for(var n=0;n<sa.length&&e!==0&&e<sa[n].priority;n++);sa.splice(n,0,t),n===0&&dI(t)}};function L0(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Hg(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function A$(){}function D7(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Rg(a);o.call(c)}}var a=IL(e,r,t,0,null,!1,!1,"",A$);return t._reactRootContainer=a,t[uo]=a.current,np(t.nodeType===8?t.parentNode:t),Ss(),a}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var s=r;r=function(){var c=Rg(l);s.call(c)}}var l=R0(t,0,!1,null,null,!1,!1,"",A$);return t._reactRootContainer=l,t[uo]=l.current,np(t.nodeType===8?t.parentNode:t),Ss(function(){Bg(e,l,n,r)}),l}function Wg(t,e,n,r,i){var o=n._reactRootContainer;if(o){var a=o;if(typeof i=="function"){var s=i;i=function(){var l=Rg(a);s.call(l)}}Bg(e,a,t,i)}else a=D7(n,e,t,i,r);return Rg(a)}sI=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Dd(e.pendingLanes);n!==0&&(Zk(e,n|1),Hn(e,wt()),!(Me&6)&&(gc=wt()+500,ka()))}break;case 13:Ss(function(){var r=po(t,1);if(r!==null){var i=En();li(r,t,1,i)}}),$0(t,1)}};Jk=function(t){if(t.tag===13){var e=po(t,134217728);if(e!==null){var n=En();li(e,t,134217728,n)}$0(t,134217728)}};lI=function(t){if(t.tag===13){var e=ya(t),n=po(t,e);if(n!==null){var r=En();li(n,t,e,r)}$0(t,e)}};cI=function(){return Fe};uI=function(t,e){var n=Fe;try{return Fe=t,e()}finally{Fe=n}};dk=function(t,e,n){switch(e){case"input":if(ik(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 r=n[e];if(r!==t&&r.form===t.form){var i=Og(r);if(!i)throw Error(U(90));U$(r),ik(r,i)}}}break;case"textarea":j$(t,n);break;case"select":e=n.value,e!=null&&ic(t,!!n.multiple,e,!1)}};Q$=E0;X$=Ss;var N7={usingClientEntryPoint:!1,Events:[fp,Xl,Og,G$,Y$,E0]},Ld={findFiberByHostInstance:gs,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},V7={bundleType:Ld.bundleType,version:Ld.version,rendererPackageName:Ld.rendererPackageName,rendererConfig:Ld.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ho.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=eI(t),t===null?null:t.stateNode},findFiberByHostInstance:Ld.findFiberByHostInstance||F7,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ad=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ad.isDisabled&&Ad.supportsFiber))try{$g=Ad.inject(V7),Ai=Ad}catch{}var Ad;cr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N7;cr.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!L0(e))throw Error(U(200));return O7(t,e,null,n)};cr.createRoot=function(t,e){if(!L0(t))throw Error(U(299));var n=!1,r="",i=LL;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=R0(t,1,!1,null,null,n,!1,r,i),t[uo]=e.current,np(t.nodeType===8?t.parentNode:t),new I0(e)};cr.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(U(188)):(t=Object.keys(t).join(","),Error(U(268,t)));return t=eI(e),t=t===null?null:t.stateNode,t};cr.flushSync=function(t){return Ss(t)};cr.hydrate=function(t,e,n){if(!Hg(e))throw Error(U(200));return Wg(null,t,e,!0,n)};cr.hydrateRoot=function(t,e,n){if(!L0(t))throw Error(U(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",a=LL;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),e=IL(e,null,t,1,n??null,i,!1,o,a),t[uo]=e.current,np(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new jg(e)};cr.render=function(t,e,n){if(!Hg(e))throw Error(U(200));return Wg(null,t,e,!1,n)};cr.unmountComponentAtNode=function(t){if(!Hg(t))throw Error(U(40));return t._reactRootContainer?(Ss(function(){Wg(null,null,t,!1,function(){t._reactRootContainer=null,t[uo]=null})}),!0):!1};cr.unstable_batchedUpdates=E0;cr.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Hg(n))throw Error(U(200));if(t==null||t._reactInternals===void 0)throw Error(U(38));return Wg(t,e,n,!1,r)};cr.version="18.2.0-next-9e3b772b8-20220608"});var mo=Jt((iue,FL)=>{"use strict";function OL(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OL)}catch(t){console.error(t)}}OL(),FL.exports=AL()});var xc=Jt(A0=>{"use strict";var DL=mo();A0.createRoot=DL.createRoot,A0.hydrateRoot=DL.hydrateRoot;var oue});var UL=Jt(zL=>{"use strict";var bc=K();function z7(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var U7=typeof Object.is=="function"?Object.is:z7,B7=bc.useState,j7=bc.useEffect,H7=bc.useLayoutEffect,W7=bc.useDebugValue;function q7(t,e){var n=e(),r=B7({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return H7(function(){i.value=n,i.getSnapshot=e,O0(i)&&o({inst:i})},[t,n,e]),j7(function(){return O0(i)&&o({inst:i}),t(function(){O0(i)&&o({inst:i})})},[t]),W7(n),n}function O0(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!U7(t,n)}catch{return!0}}function K7(t,e){return e()}var G7=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?K7:q7;zL.useSyncExternalStore=bc.useSyncExternalStore!==void 0?bc.useSyncExternalStore:G7});var jL=Jt((cue,BL)=>{"use strict";BL.exports=UL()});var WL=Jt(HL=>{"use strict";var qg=K(),Y7=jL();function Q7(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var X7=typeof Object.is=="function"?Object.is:Q7,Z7=Y7.useSyncExternalStore,J7=qg.useRef,e8=qg.useEffect,t8=qg.useMemo,n8=qg.useDebugValue;HL.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=J7(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=t8(function(){function l(f){if(!c){if(c=!0,u=f,f=r(f),i!==void 0&&a.hasValue){var h=a.value;if(i(h,f))return d=h}return d=f}if(h=d,X7(u,f))return h;var g=r(f);return i!==void 0&&i(h,g)?h:(u=f,d=g)}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,r,i]);var s=Z7(t,o[0],o[1]);return e8(function(){a.hasValue=!0,a.value=s},[s]),n8(s),s}});var KL=Jt((due,qL)=>{"use strict";qL.exports=WL()});function u8(){Jg=!0,queueMicrotask(dA)}function dA(){if(!_c.length){Jg=!1;return}z0=!0;for(let t=0;t<_c.length;t++)_c[t].$st!==Sc&&d8(_c[t]);_c=[],Jg=!1,z0=!1}function d8(t){let e=[t];for(;t=t[dr];)t.$e&&t.$st!==Sc&&e.push(t);for(let n=e.length-1;n>=0;n--)J0(e[n])}function pA(t){let e=Mn();return bp(e,t.length?t.bind(null,wp.bind(e)):t,null)}function B(t){return bp(Cn,t,null)}function Ec(t){return bp(null,t,null)}function di(){z0||dA()}function xp(){return Cn}function qt(t,e){try{return bp(e,t,null)}catch(n){G0(e,n);return}}function K0(t,e=Cn){return e?.$cx[t]}function p8(t,e,n=Cn){n&&(n.$cx={...n.$cx,[t]:e})}function f8(t){Cn&&(Cn.$eh=Cn.$eh?[t,...Cn.$eh]:[t])}function me(t){if(!t||!Cn)return t||c8;let e=Cn;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==ny&&(t.call(null),ry(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function wp(t=!0){if(this.$st===ny)return;let e=t?this.$ps||this[dr]:this,n=this.$ns,r=null;for(;n&&n[dr]===this;)wp.call(n,!0),iA(n),r=n.$ns,n.$ns=null,n=r;t&&iA(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function iA(t){t.$st=ny,t.$d&&fA(t),t.$s&&Xg(t,0),t.$ps&&(t.$ps.$ns=null),t[dr]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=q0,t.$eh=null}function fA(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){G0(t,e)}}function bp(t,e,n){let r=Cn,i=kc;Cn=t,kc=n;try{return e.call(t)}finally{Cn=r,kc=i}}function G0(t,e){if(!t||!t.$eh)throw e;let n=0,r=t.$eh.length,i=oA(e);for(n=0;n<r;n++)try{t.$eh[n](i);break}catch(o){i=oA(o)}if(n===r)throw i}function oA(t){return t instanceof Error?t:Error(JSON.stringify(t))}function Y0(){return this.$st===ny?this.$v:(kc&&!this.$e&&(!Vr&&kc.$s&&kc.$s[ur]==this?ur++:Vr?Vr.push(this):Vr=[this]),this.$c&&J0(this),this.$v)}function hA(t){let e=ry(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++)yA(this.$o[n],vp);return this.$v}function Mn(){return new Q0}function Z0(t,e,n){return new mA(t,e,n)}function h8(t,e){return t!==e}function ry(t){return typeof t=="function"}function J0(t){if(t.$st===uA)for(let e=0;e<t.$s.length&&(J0(t.$s[e]),t.$st!==vp);e++);t.$st===vp?gA(t):t.$st=Sc}function aA(t){t.$ns&&t.$ns[dr]===t&&wp.call(t,!1),t.$d&&fA(t),t.$eh=t[dr]?t[dr].$eh:null}function gA(t){let e=Vr,n=ur;Vr=null,ur=0;try{aA(t);let r=bp(t,t.$c,t);if(Vr){if(t.$s&&Xg(t,ur),t.$s&&ur>0){t.$s.length=ur+Vr.length;for(let o=0;o<Vr.length;o++)t.$s[ur+o]=Vr[o]}else t.$s=Vr;let i;for(let o=ur;o<t.$s.length;o++)i=t.$s[o],i.$o?i.$o.push(t):i.$o=[t]}else t.$s&&ur<t.$s.length&&(Xg(t,ur),t.$s.length=ur);!t.$e&&t.$i?hA.call(t,r):(t.$v=r,t.$i=!0)}catch(r){G0(t,r),t.$st===vp&&(aA(t),t.$s&&Xg(t,0));return}Vr=e,ur=n,t.$st=Sc}function yA(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===Sc&&(_c.push(t),Jg||u8()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)yA(t.$o[n],uA)}function Xg(t,e){let n,r;for(let i=e;i<t.$s.length;i++)n=t.$s[i],n.$o&&(r=n.$o.indexOf(t),n.$o[r]=n.$o[n.$o.length-1],n.$o.pop())}function J(t,e){let n=Z0(t,null,e),r=Y0.bind(n);return r[dr]=!0,r.set=hA.bind(n),r}function vA(t){return ry(t)&&dr in t}function Fi(t,e){let n=Z0(e?.initial,t,e),r=Y0.bind(n);return r[dr]=!0,r}function xA(t,e){let n=Z0(null,function(){let i=t();return ry(i)&&me(i),null},void 0);return n.$e=!0,gA(n),wp.bind(n,!0)}function m8(t){let e=()=>t();return e[dr]=!0,e}function eT(t){return vA(t)&&"set"in t}function qn(...t){}function Di(t){return t===null}function ot(t){return typeof t>"u"}function tT(t){return Di(t)||ot(t)}function _p(t){return t?.constructor===Object}function $t(t){return typeof t=="number"&&!Number.isNaN(t)}function ee(t){return typeof t=="string"}function nT(t){return typeof t=="boolean"}function an(t){return typeof t=="function"}function bt(t){return Array.isArray(t)}function g8(t){return ee(t)?new RegExp(t):t}function y8(t){return Wn?!1:t===window}function v8(t,e){return typeof process<"u",qn}function iy(t){return!!t?.[bA]}function w8(t){return t.originEvent}function _A(t,e){if(iy(t))return t.triggers.walk(e)}function rT(t,e){return iy(t)?t.triggers.findType(e):void 0}function kA(t,e){return!!rT(t,e)}function TA(t,e){e&&t.triggers.add(e)}function z(t,e,n,r){return Wn?qn:(t.addEventListener(e,n,r),me(()=>t.removeEventListener(e,n,r)))}function kp(t){return!!t?.type.startsWith("pointer")}function Pc(t){return!!t?.type.startsWith("touch")}function iT(t){return/^(click|mouse)/.test(t?.type??"")}function yo(t){return!!t?.type.startsWith("key")}function b8(t){return yo(t)&&t.key==="Enter"}function _8(t){return yo(t)&&t.key==="Escape"}function Tp(t){return yo(t)&&(t.key==="Enter"||t.key===" ")}function oT(t){return t instanceof Node}function k8(t){return oT(t)&&t.nodeType===1}function T8(t){return oT(t)&&t.nodeType===11}function S8(){return document.createDocumentFragment()}function E8(t){return Wn?t:document.createComment(t)}function he(t,e,n){if(t)if(!n&&n!==""&&n!==0)t.removeAttribute(e);else{let r=n===!0?"":n+"";t.getAttribute(e)!==r&&t.setAttribute(e,r)}else return}function on(t,e,n){if(t)!n&&n!==0?t.style.removeProperty(e):t.style.setProperty(e,n+"");else return}function P8(t,e,n){t.classList[n?"add":"remove"](e)}function C8(t,e){let n=e?`slot[name="${e}"]`:"slot:not([name])",i=t.shadowRoot?.querySelector(n)?.assignedNodes({flatten:!0})??[];return Array.prototype.filter.call(i,o=>o.nodeType==1)}function M8(t){let e=t.firstChild,n=e.getAttribute("shadowroot");e.parentNode.attachShadow({mode:n}).appendChild(e.content),e.remove()}function R8(t){return an(t)?t():t}function U0(t){let e=t;for(;typeof e=="function";)e=e.call(this);return e}function Ni(t){return{id:Symbol(),provide:t}}function $n(t,e,n=xp()){let r=!ot(e);p8(t.id,r?e:t.provide?.(),n)}function dt(t){return K0(t.id)}function zr(t){return!ot(K0(t.id))}function $8(t){let e={};for(let n of Object.keys(t)){let r=t[n];e[n]=J(r,r)}return e}function aT(t,e){return pA(()=>{yp.$$=new ty(t,xp(),e);let n=new t;return yp.$$.e=n,yp.$$=null,n})}function be(t,e,n){t[D0]||(t[D0]=new Set),t[D0].add(e)}function pt(t,e,n){t[N0]||(t[N0]=new Set),t[N0].add(e)}function Ms(t){return dt(t)}function Cc(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function I8(t){return Sp(t.replace(/([A-Z])/g," $1"))}function ay(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function EA(t){return PA(t).replace(/\s/g,"")}function PA(t){return Sp(t.replace(/-./g,e=>" "+e[1].toUpperCase()))}function Sp(t){return t.charAt(0).toUpperCase()+t.slice(1)}function L8(t){return t.charAt(0).toLowerCase()+t.slice(1)}function O8(t){return t.replace(A8,"")}function sy(t,...e){return Oe.createElement(Rs.Provider,{value:t},...e)}function ly(){return Oe.useContext(Rs).current}function cy(t){let e=ly();return Oe.useMemo(()=>K0(t.id,e),[e])}function F8(){return MA}function D8(t,e){var n;return n=class extends MA{},n.F=t,n.T=e,n}function sT(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function Pe(...t){return e=>t.forEach(n=>sT(n,e))}function N8(t,e){let n=Oe.forwardRef((r,i)=>{let o=Oe.useContext(Rs),a=Oe.useRef(null),s=Oe.useRef();if(!s.current){let x=z8(),m=cA(t,x,r,o.current);x.e=m,s.current=x,a.current=m.scope}function l(){let x=s.current,m=o.current;if(window.cancelAnimationFrame(x.ea),x.ea=-1,x.e.$$.o){let y=cA(t,x,r,m);x.e=y,x.Q=!1,x.da=!1,a.current=y.scope}return x.a&&lA(x,x.a),x.da||(sT(i,x.e),x.da=!0),()=>Zg(x)}function c(x){let m=s.current;if(!m.da){m.a=x;return}window.cancelAnimationFrame(m.K),m.K=window.requestAnimationFrame(()=>{let y=s.current;y.K=-1,y.a!==x&&(Zg(y),x&&lA(y,x),y.a=x)})}Oe.useEffect(()=>{let x=s.current;return window.cancelAnimationFrame(x.ea),x.ea=-1,function(){an(r.children)&&(window.cancelAnimationFrame(x.K),x.K=-1,window.cancelAnimationFrame(x.E),x.E=-1,window.cancelAnimationFrame(x.ea),x.ea=window.requestAnimationFrame(()=>{x.ea=-1,Zg(x),x.e.$$.p(),x.e.$$[oy]=null,x.J={},x._={},a.current=null}))}},[]),Oe.useEffect(di);let u=s.current,{children:d,...p}=r,f={},h=u.aa,g=Object.keys(p);u.J={};for(let x of[...h,...g])if(e.props.has(x))u.e.$props[x].set(ot(p[x])?t.props?.[x]:p[x]);else if(e.events?.has(x)||e.eventsRE?.test(x))u.J[x]=p[x];else if(e.domEvents?.has(x)||e.domEventsRE?.test(x)){let m=Cc(x.slice(2));u._[m]=p[x],g.includes(x)?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 f[x]=p[x];return u.aa=g,sy(a,Oe.createElement(V8,{effect:l}),an(d)?d?.({...f,suppressHydrationWarning:!0,ref:c},u.e):d)});return n.displayName=t.name+"Bridge",n}function V8({effect:t}){return Oe.useEffect(t,[]),null}function z8(){let t={a:null,aa:[],J:{},_:{},K:-1,E:-1,ea:-1,Q:!1,da:!1,ca:null,ba(e){let n=ot(e.detail)?[e]:[e.detail,e];t._[e.type]?.(...n)}};return t}function lA(t,e){if(!(t.a===e&&t.Q)){if(t.Q&&Zg(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 Zg(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 U8(t){let e=sA.get(t.type),n=ot(t.detail)?[t]:[t.detail,t];e||sA.set(t.type,e=`on${EA(t.type)}`),this.J[e]?.(...n)}function cA(t,e,n,r){let i=aT(t,{props:n,scope:r});return i.$$[oy]=U8.bind(e),i.$$.w(),i}function RA(t,e=!1){let n=typeof t;if(n!=="string")return!e&&n==="function"?RA(t()):e&&n==="boolean"?t+"":t;let r=e?'"':"<",i=e?""":"<",o=t.indexOf(r),a=t.indexOf("&");if(o<0&&a<0)return t;let s=0,l="";for(;o>=0&&a>=0;)o<a?(s<o&&(l+=t.substring(s,o)),l+=i,s=o+1,o=t.indexOf(r,s)):(s<a&&(l+=t.substring(s,a)),l+="&",s=a+1,a=t.indexOf("&",s));if(o>=0)do s<o&&(l+=t.substring(s,o)),l+=i,s=o+1,o=t.indexOf(r,s);while(o>=0);else for(;a>=0;)s<a&&(l+=t.substring(s,a)),l+="&",s=a+1,a=t.indexOf("&",s);return s<t.length?l+t.substring(s):l}function H8(t,e){let n=e.trim().split(j8);for(let r of n)t.add(r)}function K8(t,e){let n=e.trim().split(q8);for(let r=0;r<n.length;r++){if(n[r]==="")continue;let[i,o]=n[r].split(W8);t.set(i,o)}}function Y8(t,e){function n(r){let i=Oe.useContext(Rs),o=aT(t,{props:r,scope:i.current}),a=new B0(o),s={},{style:l={},children:c,forwardRef:u,...d}=r;if(e.props.size)for(let p of Object.keys(d))e.props.has(p)||(s[p]=d[p]);else s=d;if(a.setup(),a.hasAttribute("style")){for(let[p,f]of a.style.tokens)l[p.startsWith("--")?p:ay(p)]=f;a.removeAttribute("style")}for(let[p,f]of a.attributes.tokens){let h=G8[p];h&&(h in s||(s[h]=f),a.removeAttribute(p))}return sy({current:o.$$.d},an(c)?c?.({...Object.fromEntries(a.attributes.tokens),...s,style:l},o):c,Oe.createElement(()=>(a.destroy(),null)))}return n.displayName=t.name+"Bridge",n}function Ta(t){return cy(t)}function Ie(t,e){let[,n]=Oe.useState();return Oe.useEffect(()=>xA(()=>{t(),n({})}),[e??t]),t()}function Mc(t){return t?"true":"false"}function $A(t){let e=[];for(let n=0;n<t.length;n++)bt(t[n])?e.push(...$A(t[n])):(t[n]||t[n]===0)&&e.push(t[n]);return e}function Ep(){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 lT(){let t=Ep();return me(t.empty),t}function Q8(t){return t()}function X8(t,e){for(let n of t)n(e)}function Pp(t){return Object.keys(t)}function Z8(...t){let e={};for(let n=0;n<t.length;n++){let r=t[n];r&&Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}return e}function IA(t,e){let n={};for(let r of e)Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}function J8(t,e){return IA(t,Pp(t).filter(n=>!e.includes(n)))}function vo(){let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}function e9(t,e,n){let r=new Promise((i,o)=>{let a=setTimeout(()=>{clearTimeout(a),o(n)},e)});return Promise.race([t,r])}function cT(t){return new Promise(e=>setTimeout(e,t))}function t9(t){return Wn?Promise.resolve():new Promise(e=>{window.requestAnimationFrame(n=>{t?.(n),e()})})}function Sa(t){if(Wn)return qn;let e=-1,n;function r(...i){n=i,!(e>=0)&&(e=window.requestAnimationFrame(()=>{t.apply(this,n),e=-1,n=void 0}))}return r}function uT(t,e){return Wn?Promise.resolve():new Promise(n=>{n9(r=>{t?.(r),n()},e)})}function dT(t){let[,e]=Oe.useState(),n=Oe.useRef(null);return n.current==null&&(n.current={state:{},$update:J({}),props:new Set}),Oe.useEffect(()=>{let{state:r,$update:i,props:o}=n.current;return M(()=>{for(let a of o){let s=t[a]();r[a]=bt(s)?[...s]:s}i(),e({})})},[t]),Oe.useMemo(()=>{let{state:r,$update:i,props:o}=n.current,a=!1;return o.clear(),new Proxy(r,{get(s,l){if(!o.has(l)&&l in t){o.add(l);let c=t[l]();r[l]=bt(c)?[...c]:c,a||(i.set({}),a=!0,queueMicrotask(()=>a=!1))}return r[l]},set(s,l,c){return l in t||(r[l]=c),!0}})},[t])}function we(t,e){return Wn?Y8(t,{props:new Set(Object.keys(t.props||{}))}):N8(t,{props:new Set(Object.keys(t.props||{})),events:new Set(e?.events),eventsRE:e?.eventsRegex,domEvents:e?.domEvents,domEventsRE:e?.domEventsRegex})}var Oe,Wn,dr,Jg,z0,Cn,kc,Vr,ur,_c,q0,c8,Sc,uA,vp,ny,Q0,Cs,mA,X0,M,wA,x8,bA,ae,ey,Tc,D0,N0,oy,SA,V0,ty,yp,Rn,le,ui,A8,Rs,CA,MA,sA,B8,j8,W8,q8,B0,j0,H0,W0,G8,n9,Ea,In=rt(()=>{"use strict";"use client";Oe=$(K(),1),Wn=typeof document>"u",dr=Symbol(0),Jg=!1,z0=!1,Cn=null,kc=null,Vr=null,ur=0,_c=[],q0={},c8=()=>{},Sc=0,uA=1,vp=2,ny=3;Q0=function(){this[dr]=null,this.$ns=null,this.$ps=null,Cn&&Cn.append(this)},Cs=Q0.prototype;Cs.$cx=q0;Cs.$eh=null;Cs.$c=null;Cs.$d=null;Cs.append=function(t){if(t[dr]=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===q0?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};Cs.dispose=function(){wp.call(this)};mA=function(e,n,r){Q0.call(this),this.$st=n?vp:Sc,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,n&&(this.$c=n),r&&r.dirty&&(this.$ch=r.dirty)},X0=mA.prototype;Object.setPrototypeOf(X0,Cs);X0.$ch=h8;X0.call=Y0;M=Wn?v8:xA;x8=Wn?class{}:Event,bA=Symbol("DOM_EVENT"),ae=class extends x8{constructor(e,...n){super(e,n[0]),this[wA]=!0,this.triggers=new ey,this.detail=n[0]?.detail;let r=n[0]?.trigger;r&&this.triggers.add(r)}get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){return this.triggers.origin?.isTrusted??!1}};wA=bA;ey=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),iy(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 r=e(n);if(r)return[n,r]}}[Symbol.iterator](){return this.chain.values()}};Tc=class extends EventTarget{addEventListener(e,n,r){return super.addEventListener(e,n,r)}removeEventListener(e,n,r){return super.removeEventListener(e,n,r)}};D0=Symbol(0),N0=Symbol(0),oy=Symbol(0),V0={},ty=class{constructor(e,n,r){this[SA]=null,this.$el=J(null),this.a=null,this.d=null,this.f=null,this.g=null,this.e=null,this.o=!1,this.i=V0,this.b=null,this.c=null,this.l=[],this.m=[],this.j=[],this.n=[],this.d=n,r?.scope&&r.scope.append(n);let i=e.state,o=e.props;if(i&&(this.h=i.create(),this.k=new Proxy(this.h,{get:(a,s)=>this.h[s]()}),$n(i,this.h)),o&&(this.i=$8(o),r?.props))for(let a of Object.keys(r.props))this.i[a]?.set(r.props[a]);me(this.p.bind(this))}w(){qt(()=>{for(let e of this.l)e()},this.d)}x(e){this.a||(this.a=e,this.$el.set(e),qt(()=>{this.f=Mn(),qt(()=>{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||qt(()=>{this.g=Mn(),qt(()=>{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,qt(()=>{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=V0,this.d=null,this.k=V0,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))Wn?he(this.a,e,U0.call(this.e,this.b[e])):an(this.b[e])?M(this.u.bind(this,e)):he(this.a,e,this.b[e])}r(){if(this.c)for(let e of Object.keys(this.c))Wn?on(this.a,e,U0.call(this.e,this.c[e])):an(this.c[e])?M(this.v.bind(this,e)):on(this.a,e,this.c[e])}u(e){he(this.a,e,this.b[e].call(this.e))}v(e){on(this.a,e,this.c[e].call(this.e))}};SA=oy;yp={$$:null};Rn=class extends EventTarget{constructor(){super(),yp.$$&&this.attach(yp)}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,r){this.listen(e,n,r)}removeEventListener(e,n,r){this.el?.removeEventListener(e,n,r)}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 ae(e,n[0])}dispatch(e,...n){if(Wn||!this.el)return!1;let r=e instanceof Event?e:new ae(e,n[0]);return Object.defineProperty(r,"target",{get:()=>this.$$.e}),Ec(()=>(this.$$[oy]?.(r),this.el.dispatchEvent(r)))}dispatchEvent(e){return this.dispatch(e)}listen(e,n,r){return Wn||!this.el?qn:z(this.el,e,n,r)}},le=class extends Rn{subscribe(e){return qt(()=>M(()=>e(this.state)),this.$$.d)}destroy(){this.$$.p()}};ui=class{constructor(e){this.id=Symbol(0),this.record=e,this.A=Object.getOwnPropertyDescriptors(e)}create(){let e={},n=new Proxy(e,{get:(r,i)=>e[i]()});for(let r of Object.keys(this.record)){let i=this.A[r].get;e[r]=i?Fi(i.bind(n)):J(this.record[r])}return e}reset(e,n){for(let r of Object.keys(e))!this.A[r].get&&(!n||n(r))&&e[r].set(this.record[r])}};A8=/;\s*$/;Rs=Oe.createContext({current:null});Rs.displayName="Scope";CA=class extends Oe.Component{constructor(e,n){super(e),this.d={current:Mn()},n&&n.append(this.d.current);let r=this.constructor;r.F&&$n(r.F,r.T?.(),this.d.current)}render(){return sy(this.d,this.props?.children)}};CA.contextType=Rs;MA=CA;sA=new Map;B8=Symbol(0),j8=/\s+/;W8=/\s*:\s*/,q8=/\s*;\s*/;B0=class{constructor(e){this.keepAlive=!1,this.forwardKeepAlive=!0,this.attributes=new j0,this.style=new H0,this.classList=new W0,this.$=e}get $props(){return this.$.$$.i}get $state(){return this.$.$$.h}get state(){return this.$.state}setup(){let e=this.$.$$;qt(()=>{this.hasAttribute("class")&&H8(this.classList.tokens,this.getAttribute("class")),this.hasAttribute("style")&&K8(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)}[B8](){}addEventListener(){}removeEventListener(){}dispatchEvent(){return!1}subscribe(){return qn}destroy(){this.$.destroy()}},j0=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,r]of this.Z)e+=` ${n}="${RA(r,!0)}"`;return e}},H0=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,r]of this.Z)e+=`${n}: ${r};`;return e}},W0=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(" ")}},G8={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"};n9=Wn?qn:typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):qn;Ea=Object.freeze({__proto__:null,Component:le,DOMEvent:ae,EventTriggers:ey,EventsTarget:Tc,Instance:ty,ReactScopeContext:Rs,State:ui,ViewController:Rn,WithScope:sy,animationFrameThrottle:Sa,appendTriggerEvent:TA,ariaBool:Mc,attachDeclarativeShadowDOM:M8,camelToKebabCase:Cc,camelToTitleCase:I8,composeRefs:Pe,computed:Fi,createComment:E8,createComponent:aT,createContext:Ni,createDisposalBin:Ep,createFragment:S8,createReactComponent:we,createReactContextProvider:D8,createReactScopeProvider:F8,createRegex:g8,createScope:Mn,deferredPromise:vo,effect:M,findTriggerEvent:rT,flattenArray:$A,getOriginEvent:w8,getScope:xp,getSlottedChildren:C8,hasProvidedContext:zr,hasTriggerEvent:kA,isArray:bt,isBoolean:nT,isDOMElement:k8,isDOMEvent:iy,isDOMFragment:T8,isDOMNode:oT,isFunction:an,isKeyboardClick:Tp,isKeyboardEvent:yo,isMouseEvent:iT,isNil:tT,isNull:Di,isNumber:$t,isObject:_p,isPointerEvent:kp,isReadSignal:vA,isString:ee,isTouchEvent:Pc,isUndefined:ot,isWindow:y8,isWriteSignal:eT,kebabToCamelCase:ay,kebabToPascalCase:EA,kebabToTitleCase:PA,keysOf:Pp,listenEvent:z,lowercaseFirstLetter:L8,mergeProperties:Z8,method:pt,noop:qn,omit:J8,onDispose:me,onError:f8,peek:B,pick:IA,prop:be,provideContext:$n,readonly:m8,root:pA,run:Q8,runAll:X8,scoped:qt,setAttribute:he,setRef:sT,setStyle:on,signal:J,tick:di,timedPromise:e9,toggleClass:P8,trimTrailingSemicolon:O8,untrack:Ec,unwrap:R8,unwrapDeep:U0,uppercaseFirstChar:Sp,useContext:dt,useDisposalBin:lT,useReactContext:cy,useReactScope:ly,useSignal:Ie,useSignalRecord:dT,useState:Ms,useStateContext:Ta,waitAnimationFrame:t9,waitIdlePeriod:uT,waitTimeout:cT,walkTriggerEventChain:_A,wasEnterKeyPressed:b8,wasEscapeKeyPressed:_8})});var LA={};Ot(LA,{SRTParser:()=>uy,default:()=>o9});function o9(){return new uy}var r9,i9,uy,AA=rt(()=>{"use strict";Cp();r9=/,/g,i9="-->",uy=class extends $c{parse(e,n){if(e==="")this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null),this.c=Rc.None;else if(this.c===Rc.Cue)this.a.text+=(this.a.text?`
|
|
`:"")+e;else if(e.includes(i9)){let r=this.o(e,n);r&&(this.a=new xo(r[0],r[1],r[2].join(" ")),this.a.id=this.l,this.c=Rc.Cue)}this.l=e}o(e,n){return super.o(e.replace(r9,"."),n)}}});var pT={};Ot(pT,{ParseErrorBuilder:()=>a9});var a9,fT=rt(()=>{"use strict";Cp();a9={p(){return new Kn({code:Ur.BadSignature,reason:"missing WEBVTT file header",line:1})},q(t,e){return new Kn({code:Ur.BadTimestamp,reason:`cue start timestamp \`${t}\` is invalid on line ${e}`,line:e})},r(t,e){return new Kn({code:Ur.BadTimestamp,reason:`cue end timestamp \`${t}\` is invalid on line ${e}`,line:e})},s(t,e,n){return new Kn({code:Ur.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${t}\` on line ${n}`,line:n})},w(t,e,n){return new Kn({code:Ur.BadSettingValue,reason:`invalid value for cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},v(t,e,n){return new Kn({code:Ur.UnknownSetting,reason:`unknown cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},u(t,e,n){return new Kn({code:Ur.BadSettingValue,reason:`invalid value for region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},t(t,e,n){return new Kn({code:Ur.UnknownSetting,reason:`unknown region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},T(t,e){return new Kn({code:Ur.BadFormat,reason:`format missing for \`${t}\` block on line ${e}`,line:e})}}});var zA={};Ot(zA,{SSAParser:()=>fy,default:()=>s9});function mT(t){let e=parseInt(t.replace("&H",""),16);if(e>=0){let r=(e>>24&255^255)/255,i=e>>16&255,o=e>>8&255;return"rgba("+[e&255,o,i,r].join(",")+")"}return null}function gT(t,e,n){let r=Math.ceil(2*Math.PI*t),i="";for(let o=0;o<r;o++){let a=2*Math.PI*o/r;i+=t*Math.cos(a)+"px "+e*Math.sin(a)+"px 0 "+n+(o==r-1?"":",")}return i}function s9(){return new fy}var dy,OA,FA,py,DA,NA,VA,hT,fy,UA=rt(()=>{"use strict";Cp();dy=/^Format:[\s\t]*/,OA=/^Style:[\s\t]*/,FA=/^Dialogue:[\s\t]*/,py=/[\s\t]*,[\s\t]*/,DA=/\{[^}]+\}/g,NA=/\\N/g,VA=/^\[(.*)[\s\t]?Styles\]$/,hT=/^\[(.*)[\s\t]?Events\]$/,fy=class{constructor(){T(this,"f");T(this,"O",0);T(this,"a",null);T(this,"j",[]);T(this,"k",[]);T(this,"N",null);T(this,"d");T(this,"P",{})}async init(e){this.f=e,e.errors&&(this.d=(await Promise.resolve().then(()=>(fT(),pT))).ParseErrorBuilder)}parse(e,n){if(this.O)switch(this.O){case 1:if(e==="")this.O=0;else if(OA.test(e))if(this.N){let r=e.replace(OA,"").split(py);this.S(r)}else this.e(this.d?.T("Style",n));else dy.test(e)?this.N=e.replace(dy,"").split(py):hT.test(e)&&(this.N=null,this.O=2);break;case 2:if(e==="")this.Q();else if(FA.test(e))if(this.Q(),this.N){let r=e.replace(FA,"").split(py),i=this.U(r,n);i&&(this.a=i)}else this.e(this.d?.T("Dialogue",n));else this.a?this.a.text+=`
|
|
`+e.replace(DA,"").replace(NA,`
|
|
`):dy.test(e)?this.N=e.replace(dy,"").split(py):VA.test(e)?(this.N=null,this.O=1):hT.test(e)&&(this.N=null)}else e===""||(VA.test(e)?(this.N=null,this.O=1):hT.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",r={},i,o="center",a="bottom",s,l=1.2,c,u,d=3,p=[];for(let f=0;f<this.N.length;f++){let h=this.N[f],g=e[f];switch(h){case"Name":n=g;break;case"Fontname":r["font-family"]=g;break;case"Fontsize":r["font-size"]=`calc(${g} / var(--overlay-height))`;break;case"PrimaryColour":let x=mT(g);x&&(r["--cue-color"]=x);break;case"BorderStyle":d=parseInt(g,10);break;case"BackColour":u=mT(g);break;case"OutlineColour":let m=mT(g);m&&(c=m);break;case"Bold":parseInt(g)&&(r["font-weight"]="bold");break;case"Italic":parseInt(g)&&(r["font-style"]="italic");break;case"Underline":parseInt(g)&&(r["text-decoration"]="underline");break;case"StrikeOut":parseInt(g)&&(r["text-decoration"]="line-through");break;case"Spacing":r["letter-spacing"]=g+"px";break;case"AlphaLevel":r.opacity=parseFloat(g);break;case"ScaleX":p.push(`scaleX(${parseFloat(g)/100})`);break;case"ScaleY":p.push(`scaleY(${parseFloat(g)/100})`);break;case"Angle":p.push(`rotate(${g}deg)`);break;case"Shadow":l=parseInt(g,10)*1.2;break;case"MarginL":r["--cue-width"]="auto",r["--cue-left"]=parseFloat(g)+"px";break;case"MarginR":r["--cue-width"]="auto",r["--cue-right"]=parseFloat(g)+"px";break;case"MarginV":s=parseFloat(g);break;case"Outline":i=parseInt(g,10);break;case"Alignment":let y=parseInt(g,10);switch(y>=4&&(a=y>=7?"top":"center"),y%3){case 1:o="start";break;case 2:o="center";break;case 3:o="end";break}}}if(r.R=a,r["--cue-white-space"]="normal",r["--cue-line-height"]="normal",r["--cue-text-align"]=o,a==="center"?(r["--cue-top"]="50%",p.push("translateY(-50%)")):r[`--cue-${a}`]=(s||0)+"px",d===1&&(r["--cue-padding-y"]="0"),(d===1||u)&&(r["--cue-bg-color"]=d===1?"none":u),d===3&&c&&(r["--cue-outline"]=`${i}px solid ${c}`),d===1&&typeof i=="number"){let f=u??"#000";r["--cue-text-shadow"]=[c&&gT(i*1.2,l*1.2,c),c?gT(i*(i/2),l*(i/2),f):gT(i,l,f)].filter(Boolean).join(", ")}p.length&&(r["--cue-transform"]=p.join(" ")),this.P[n]=r}U(e,n){let r=this.V(e),i=this.o(r.Start,r.End,n);if(!i)return;let o=new xo(i[0],i[1],""),a={...this.P[r.Style]||{}},s=r.Name?`<v ${r.Name}>`:"",l=a.R,c=r.MarginL&&parseFloat(r.MarginL),u=r.MarginR&&parseFloat(r.MarginR),d=r.MarginV&&parseFloat(r.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"),o.text=s+e.slice(this.N.length-1).join(", ").replace(DA,"").replace(NA,`
|
|
`),delete a.R,Object.keys(a).length&&(o.style=a),o}V(e){let n={};for(let r=0;r<this.N.length;r++)n[this.N[r]]=e[r];return n}o(e,n,r){let i=wo(e),o=wo(n);if(i!==null&&o!==null&&o>i)return[i,o];i===null&&this.e(this.d?.q(e,r)),o===null&&this.e(this.d?.r(n,r)),i!=null&&o!==null&&o>i&&this.e(this.d?.s(i,o,r))}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}}});async function KA(t,e){let n=new ReadableStream({start(r){let i=t.split(qA);for(let o of i)r.enqueue(o);r.close()}});return yy(n,e)}async function yy(t,e){let n=e?.type??"vtt",r;if(typeof n=="string")switch(n){case"srt":r=(await Promise.resolve().then(()=>(AA(),LA))).default;break;case"ssa":case"ass":r=(await Promise.resolve().then(()=>(UA(),zA))).default;break;default:r=(await Promise.resolve().then(function(){return S9})).default}else r=n;let i,o=t.getReader(),a=r(),s=!!e?.strict||!!e?.errors;await a.init({strict:!1,...e,errors:s,type:n,cancel(){o.cancel(),i=a.done(!0)}});let l=1;for(;;){let{value:c,done:u}=await o.read();if(u){a.parse("",l),i=a.done(!1);break}a.parse(c,l),l++}return i}async function GA(t,e){let n=await t;if(!n.ok||!n.body)return{metadata:{},cues:[],regions:[],errors:[void 0]};let r=n.headers.get("content-type")||"",i=r.match(/text\/(.*?)(?:;|$)/)?.[1],o=r.match(/charset=(.*?)(?:;|$)/)?.[1];return wT(n.body,{type:i,encoding:o,...e})}async function wT(t,{encoding:e="utf-8",...n}={}){let r=t.pipeThrough(new vT(e));return yy(r,n)}function u9(t){let e=parseInt(t,10);return Number.isNaN(e)?null:e}function Rp(t){let e=parseInt(t.replace(c9,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function jA(t){if(!t.includes(BA))return null;let[e,n]=t.split(BA).map(Rp);return e!==null&&n!==null?[e,n]:null}function d9(t){let e=parseFloat(t);return Number.isNaN(e)?null:e}function wo(t){let e=t.match(k9);if(!e)return null;let n=e[1]?parseInt(e[1],10):0,r=parseInt(e[2],10),i=parseInt(e[3],10),o=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,a=n*3600+r*60+i+o/1e3;return n<0||r<0||i<0||o<0||r>59||i>59?null:a}function T9(){return new $c}function _T(t){let e="",n=1,r=[],i=[],o;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&&E9.test(u)&&(n=6),e+=u;break}break;case 3:switch(u){case" ":case" ":case`
|
|
`:s(),o&&o.class?.trim(),n=4;break;case".":s();break;case">":s(),o&&o.class?.trim(),n=1;break;default:e+=u}break;case 4:u===">"?(e=e.replace(P9," "),o?.type==="v"?o.voice=yT(e):o?.type==="lang"&&(o.lang=yT(e)),e="",n=1):e+=u;break;case 5:u===">"&&(e="",o=i.pop(),n=1);break;case 6:if(u===">"){let d=wo(e);d!==null&&d>=t.startTime&&d<=t.endTime&&(e="timestamp",a(),o.time=d),e="",n=1}else e+=u;break}}function a(){if($9.has(e)){let c=o;o=I9(e),c?(i[i.length-1]!==c&&i.push(c),c.children.push(o)):r.push(o)}e="",n=1}function s(){if(o&&e){let c=e.replace("bg_","");R9.has(c)?o[e.startsWith("bg_")?"bgColor":"color"]=c:o.class=o.class?o.class+" "+e:e}e=""}function l(){if(!e)return;let c={type:"text",data:yT(e)};o?o.children.push(c):r.push(c),e=""}return n===1&&l(),r}function I9(t){return{tagName:YA[t],type:t,children:[]}}function yT(t){return t.replace(M9,e=>C9[e]||"'")}function Ln(t,e,n){t.style.setProperty(`--${e}`,n+"")}function Pa(t,e,n=!0){t.setAttribute(`data-${e}`,n===!0?"":n+"")}function hy(t,e){t.setAttribute("data-part",e)}function L9(t){return parseFloat(getComputedStyle(t).lineHeight)||0}function QA(t){if(bT)throw Error("[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`");let e=document.createElement("template");return e.innerHTML=vy(t),{cue:t,content:e.content}}function vy(t,e=0){return xy(_T(t),e)}function xy(t,e=0){let n,r="";for(let i of t)if(i.type==="text")r+=i.data;else{let o=i.type==="timestamp";n={},n.class=i.class,n.title=i.type==="v"&&i.voice,n.lang=i.type==="lang"&&i.lang,n["data-part"]=i.type==="v"&&"voice",o&&(n["data-part"]="timed",n["data-time"]=i.time,n["data-future"]=i.time>e,n["data-past"]=i.time<e),n.style=`${i.color?`color: ${i.color};`:""}${i.bgColor?`background-color: ${i.bgColor};`:""}`;let a=Object.entries(n).filter(s=>s[1]).map(s=>`${s[0]}="${s[1]===!0?"":s[1]}"`).join(" ");r+=`<${i.tagName}${a?" "+a:""}>${xy(i.children)}</${i.tagName}>`}return r}function kT(t,e){if(!bT)for(let n of t.querySelectorAll('[data-part="timed"]')){let r=Number(n.getAttribute("data-time"));Number.isNaN(r)||(r>e?Pa(n,"future"):n.removeAttribute("data-future"),r<e?Pa(n,"past"):n.removeAttribute("data-past"))}}function A9(t,e){let n=null,r;function i(){o(),t(...r),r=void 0}function o(){clearTimeout(n),n=null}function a(){r=[].slice.call(arguments),o(),n=setTimeout(i,e)}return a}function TT(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 my(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 O9(t,e){return t.left<=e.right&&t.right>=e.left&&t.top<=e.bottom&&t.bottom>=e.top}function F9(t,e){for(let n=0;n<e.length;n++)if(O9(t,e[n]))return e[n];return null}function WA(t,e){return e.top>=0&&e.bottom<=t.height&&e.left>=0&&e.right<=t.width}function D9(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 N9(t,e){let n=Math.max(0,Math.min(t.width,e.right)-Math.max(0,e.left)),r=Math.max(0,Math.min(t.height,e.bottom)-Math.max(0,e.top));return n*r/(t.height*t.width)}function ST(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 XA(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 JA(t,e,n,r){let i=ST(e,n);for(let o of ZA)Ln(t,`${r}-${o}`,i[o]*100+"%")}function eO(t,e,n,r){let i=1,o,a={...e};for(let s=0;s<r.length;s++){for(;D9(t,e,r[s])||WA(t,e)&&F9(e,n);)my(e,r[s],1);if(WA(t,e))return e;let l=N9(t,e);i>l&&(o={...e},i=l),e={...a}}return o||a}function V9(t,e,n,r){let i=n.firstElementChild,o=B9(e),a,s=[];if(n[Ca]||(n[Ca]=z9(t,n)),a=XA(t,{...n[Ca]}),n[$p])s=[n[$p]==="top"?"+y":"-y","+x","-x"];else if(e.snapToLines){let l;switch(e.vertical){case"":s=["+y","-y"],l="height";break;case"rl":s=["+x","-x"],l="width";break;case"lr":s=["-x","+x"],l="width";break}let c=L9(i),u=c*Math.round(o),d=t[l]+c,p=s[0];Math.abs(u)>d&&(u=u<0?-1:1,u*=Math.ceil(d/c)*c),o<0&&(u+=e.vertical===""?t.height:t.width,s=s.reverse()),my(a,p,u)}else{let l=e.vertical==="",c=l?"+y":"+x",u=l?a.height:a.width;my(a,c,(l?t.height:t.width)*o/100),my(a,c,e.lineAlign==="center"?u/2:e.lineAlign==="end"?u:0),s=l?["-y","+y","-x","+x"]:["-x","+x","-y","+y"]}return a=eO(t,a,r,s),JA(n,t,a,"cue"),a}function z9(t,e){let n=TT(e),r=U9(e);if(e[$p]=!1,r.top&&(n.top=r.top,n.bottom=r.top+n.height,e[$p]="top"),r.bottom){let i=t.height-r.bottom;n.top=i-n.height,n.bottom=i,e[$p]="bottom"}return r.left&&(n.left=r.left),r.right&&(n.right=t.width-r.right),ST(t,n)}function U9(t){let e={};for(let n of ZA)e[n]=parseFloat(t.style.getPropertyValue(`--cue-${n}`));return e}function B9(t){return t.line==="auto"?t.snapToLines?-1:100:t.line}function j9(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 H9(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 q9(t,e,n,r){let i=Array.from(n.querySelectorAll('[data-part="cue-display"]')),o=0,a=Math.max(0,i.length-e.lines);for(let l=i.length-1;l>=a;l--)o+=i[l].offsetHeight;Ln(n,"region-height",o+"px"),n[Ca]||(n[Ca]=ST(t,TT(n)));let s={...n[Ca]};return s=XA(t,s),s.width=n.clientWidth,s.height=o,s.right=s.left+s.width,s.bottom=s.top+o,s=eO(t,s,r,W9),JA(n,t,s,"region"),s}var Ur,Kn,qA,vT,xT,Ip,bT,l9,xo,Lp,BA,c9,p9,HA,f9,Ic,h9,m9,g9,y9,Mp,v9,x9,w9,b9,_9,k9,Rc,$c,S9,E9,P9,YA,C9,M9,R9,$9,Ca,ZA,$p,W9,gy,Cp=rt(()=>{"use strict";Ur={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5},Kn=class extends Error{constructor(n){super(n.reason);T(this,"code");T(this,"line");this.code=n.code,this.line=n.line}},qA=/\r?\n|\r/gm,vT=class{constructor(e){T(this,"writable");T(this,"readable");let n=new xT(e);this.writable=new WritableStream({write(r){n.transform(r)},close(){n.close()}}),this.readable=new ReadableStream({start(r){n.onLine=i=>r.enqueue(i),n.onClose=()=>r.close()}})}},xT=class{constructor(e){T(this,"x","");T(this,"y");T(this,"onLine");T(this,"onClose");this.y=new TextDecoder(e)}transform(e){this.x+=this.y.decode(e,{stream:!0});let n=this.x.split(qA);this.x=n.pop()||"";for(let r=0;r<n.length;r++)this.onLine(n[r].trim())}close(){this.x&&this.onLine(this.x.trim()),this.x="",this.onClose()}};Ip=class extends EventTarget{constructor(n,r,i){super();T(this,"id","");T(this,"startTime");T(this,"endTime");T(this,"text");T(this,"pauseOnExit",!1);this.startTime=n,this.endTime=r,this.text=i}addEventListener(n,r,i){super.addEventListener(n,r,i)}removeEventListener(n,r,i){super.removeEventListener(n,r,i)}},bT=typeof document>"u",l9=bT?Ip:window.VTTCue,xo=class extends l9{constructor(){super(...arguments);T(this,"region",null);T(this,"vertical","");T(this,"snapToLines",!0);T(this,"line","auto");T(this,"lineAlign","start");T(this,"position","auto");T(this,"positionAlign","auto");T(this,"size",100);T(this,"align","center");T(this,"style")}},Lp=class{constructor(){T(this,"id","");T(this,"width",100);T(this,"lines",3);T(this,"regionAnchorX",0);T(this,"regionAnchorY",100);T(this,"viewportAnchorX",0);T(this,"viewportAnchorY",100);T(this,"scroll","")}},BA=",",c9="%";p9="WEBVTT",HA=",",f9="%",Ic=/[:=]/,h9=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,m9="NOTE",g9="REGION",y9=/^REGION:?[\s\t]+/,Mp=/[\s\t]+/,v9="-->",x9=/[\s\t]*-->[\s\t]+/,w9=/start|center|end|left|right/,b9=/start|center|end/,_9=/line-(?:left|right)|center|auto/,k9=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/,Rc=(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))(Rc||{}),$c=class{constructor(){T(this,"f");T(this,"c",0);T(this,"g",{});T(this,"h",{});T(this,"j",[]);T(this,"a",null);T(this,"b",null);T(this,"k",[]);T(this,"d");T(this,"l","")}async init(e){this.f=e,e.strict&&(this.c=1),e.errors&&(this.d=(await Promise.resolve().then(()=>(fT(),pT))).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 r=this.a.text.length>0;!r&&h9.test(e)?this.m(e.split(Mp),n):this.a.text+=(r?`
|
|
`:"")+e}break;case 3:this.n(e.split(Mp),n);break}else if(e.startsWith(m9))this.c=4;else if(e.startsWith(g9))this.c=3,this.b=new Lp,this.n(e.replace(y9,"").split(Mp),n);else if(e.includes(v9)){let r=this.o(e,n);r&&(this.a=new xo(r[0],r[1],""),this.a.id=this.l,this.m(r[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(Ic.test(e)){let[r,i]=e.split(Ic);r&&(this.g[r]=(i||"").replace(Mp,""))}}else e.startsWith(p9)?this.c=1:this.e(this.d?.p())}o(e,n){let[r,i=""]=e.split(x9),[o,...a]=i.split(Mp),s=wo(r),l=wo(o);if(s!==null&&l!==null&&l>s)return[s,l,a];s===null&&this.e(this.d?.q(r,n)),l===null&&this.e(this.d?.r(o,n)),s!=null&&l!==null&&l>s&&this.e(this.d?.s(s,l,n))}n(e,n){let r;for(let i=0;i<e.length;i++)if(Ic.test(e[i])){r=!1;let[o,a]=e[i].split(Ic);switch(o){case"id":this.b.id=a;break;case"width":let s=Rp(a);s!==null?this.b.width=s:r=!0;break;case"lines":let l=u9(a);l!==null?this.b.lines=l:r=!0;break;case"regionanchor":let c=jA(a);c!==null?(this.b.regionAnchorX=c[0],this.b.regionAnchorY=c[1]):r=!0;break;case"viewportanchor":let u=jA(a);u!==null?(this.b.viewportAnchorX=u[0],this.b.viewportAnchorY=u[1]):r=!0;break;case"scroll":a==="up"?this.b.scroll="up":r=!0;break;default:this.e(this.d?.t(o,a,n))}r&&this.e(this.d?.u(o,a,n))}}m(e,n){let r;for(let i=0;i<e.length;i++)if(r=!1,Ic.test(e[i])){let[o,a]=e[i].split(Ic);switch(o){case"region":let s=this.h[a];s&&(this.a.region=s);break;case"vertical":a==="lr"||a==="rl"?(this.a.vertical=a,this.a.region=null):r=!0;break;case"line":let[l,c]=a.split(HA);if(l.includes(f9)){let h=Rp(l);h!==null?(this.a.line=h,this.a.snapToLines=!1):r=!0}else{let h=d9(l);h!==null?this.a.line=h:r=!0}b9.test(c)?this.a.lineAlign=c:c&&(r=!0),this.a.line!=="auto"&&(this.a.region=null);break;case"position":let[u,d]=a.split(HA),p=Rp(u);p!==null?this.a.position=p:r=!0,d&&_9.test(d)?this.a.positionAlign=d:d&&(r=!0);break;case"size":let f=Rp(a);f!==null?(this.a.size=f,f<100&&(this.a.region=null)):r=!0;break;case"align":w9.test(a)?this.a.align=a:r=!0;break;default:this.e(this.d?.v(o,a,n))}r&&this.e(this.d?.w(o,a,n))}}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}};S9=Object.freeze({__proto__:null,VTTBlock:Rc,VTTParser:$c,default:T9,parseVTTTimestamp:wo}),E9=/[0-9]/,P9=/[\s\t]+/,YA={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},C9={"&":"&","<":"<",">":">",""":'"',"'":"'"," ":"\xA0","‎":"\u200E","‏":"\u200F"},M9=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,R9=new Set(["white","lime","cyan","red","yellow","magenta","blue","black"]),$9=new Set(Object.keys(YA));Ca=Symbol(0);ZA=["top","left","right","bottom"];$p=Symbol(0);W9=["-y","+y","-x","+x"];gy=class{constructor(e,n){T(this,"overlay");T(this,"z");T(this,"A",0);T(this,"C","ltr");T(this,"B",[]);T(this,"D",!1);T(this,"E");T(this,"h",new Map);T(this,"j",new Map);T(this,"K",A9(()=>{this.D=!1,this.G();for(let e of this.h.values())e[Ca]=null;for(let e of this.j.values())e&&(e[Ca]=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"),hy(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,Pa(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 r of n)this.j.set(r,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=TT(this.overlay),Ln(this.overlay,"overlay-width",this.z.width+"px"),Ln(this.overlay,"overlay-height",this.z.height+"px")}H(e=!1){if(!this.j.size||this.D)return;let n,r=[...this.j.keys()].filter(o=>this.A>=o.startTime&&this.A<=o.endTime).sort((o,a)=>o.startTime!==a.startTime?o.startTime-a.startTime:o.endTime-a.endTime),i=r.map(o=>o.region);for(let o=0;o<this.B.length;o++){if(n=this.B[o],r[o]===n)continue;if(n.region&&!i.includes(n.region)){let s=this.h.get(n.region.id);s&&(s.removeAttribute("data-active"),e=!0)}let a=this.j.get(n);a&&(a.remove(),e=!0)}for(let o=0;o<r.length;o++){n=r[o];let a=this.j.get(n);a||this.j.set(n,a=this.L(n));let s=this.F(n)&&this.h.get(n.region.id);s&&!s.hasAttribute("data-active")&&(requestAnimationFrame(()=>Pa(s,"active")),e=!0),a.isConnected||((s||this.overlay).append(a),e=!0)}if(e){let o=[],a=new Set;for(let s=r.length-1;s>=0;s--){if(n=r[s],a.has(n.region||n))continue;let l=this.F(n),c=l?this.h.get(n.region.id):this.j.get(n);l?o.push(q9(this.z,n.region,c,o)):o.push(V9(this.z,n,c,o)),a.add(l?n.region:n)}}kT(this.overlay,this.A),this.B=r}J(e){if(e)for(let n of e){let r=this.M(n);this.h.set(n.id,r),this.overlay.append(r)}}M(e){let n=document.createElement("div");return hy(n,"region"),Pa(n,"id",e.id),Pa(n,"scroll",e.scroll),Ln(n,"region-width",e.width+"%"),Ln(n,"region-anchor-x",e.regionAnchorX),Ln(n,"region-anchor-y",e.regionAnchorY),Ln(n,"region-viewport-anchor-x",e.viewportAnchorX),Ln(n,"region-viewport-anchor-y",e.viewportAnchorY),Ln(n,"region-lines",e.lines),n}L(e){let n=document.createElement("div"),r=j9(e),i=H9(e,this.C);if(hy(n,"cue-display"),e.vertical!==""&&Pa(n,"vertical"),Ln(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))Ln(n,"cue-offset",`${r-(i==="line-right"?100:i==="center"?50:0)}%`);else if(Ln(n,"cue-writing-mode",e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl"),!e.style?.["--cue-width"]){let a=r;i==="line-left"?a=100-r:i==="center"&&r<=50?a=r*2:i==="center"&&r>50&&(a=(100-r)*2);let s=e.size<a?e.size:a;e.vertical===""?Ln(n,"cue-width",s+"%"):Ln(n,"cue-height",s+"%")}let o=document.createElement("div");return hy(o,"cue"),e.id&&Pa(o,"id",e.id),o.innerHTML=vy(e),n.append(o),n}F(e){return e.region&&e.size===100&&e.vertical===""&&e.line==="auto"}}});var Ap={};Ot(Ap,{CaptionsRenderer:()=>gy,ParseError:()=>Kn,ParseErrorCode:()=>Ur,TextCue:()=>Ip,VTTCue:()=>xo,VTTRegion:()=>Lp,createVTTCueTemplate:()=>QA,parseByteStream:()=>wT,parseResponse:()=>GA,parseText:()=>KA,parseTextStream:()=>yy,parseVTTTimestamp:()=>wo,renderVTTCueString:()=>vy,renderVTTTokensString:()=>xy,tokenizeVTTCue:()=>_T,updateTimedVTTCueNodes:()=>kT});var Op=rt(()=>{"use strict";Cp()});var Vi,Fp=rt(()=>{"use strict";"use client";In();Vi=class{constructor(e){this._callback=e}_start(){ot(this._id)&&this._loop()}_stop(){$t(this._id)&&window.cancelAnimationFrame(this._id),this._id=void 0}_loop(){this._id=window.requestAnimationFrame(()=>{ot(this._id)||(this._callback(),this._loop())})}}});var ET,PT,Lc,CT=rt(()=>{"use strict";"use client";In();Gn();Fp();ET=class{constructor(e,n){this._provider=e,this._ctx=n,this._disposal=lT(),this._waiting=!1,this._attachedLoadStart=!1,this._attachedCanPlay=!1,this._timeRAF=new Vi(this._onAnimationFrame.bind(this)),this._handlers=void 0,this._handleDevEvent=void 0,this._attachInitialListeners(),M(this._attachTimeUpdate.bind(this)),me(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._attachEventListener("ratechange",this._onRateChange)),this._attachedLoadStart=!0)}_attachCanPlayListeners(){this._attachedCanPlay||(this._disposal.add(this._attachEventListener("pause",this._onPause),this._attachEventListener("playing",this._onPlaying),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 z(this._media,e,n.bind(this))}_onDevEvent(e){}_updateCurrentTime(e,n){let r={currentTime:Math.min(e,this._ctx.$state.seekableEnd()),played:this._media.played};this._notify("time-update",r,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),(Ac||tO&&$s(this._ctx.$state.source()))&&this._ctx.delegate._ready(this._getCanPlayDetail(),e)}_getCanPlayDetail(){return{provider:B(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()&&tT(this._media.controls)&&(this._media.controls=!1)}_attachTimeUpdate(){this._ctx.$state.paused()&&z(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)&&wy(this._media.duration)>wy(this._media.currentTime)&&(this._updateCurrentTime(this._media.duration,e),this._media.ended||this._ctx.player.dispatch(new ae("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 r={message:n.message,code:n.code,mediaError:n};this._notify("error",r,e)}},PT=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),z(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 r={id:n.id.toString(),label:n.label,language:n.language,kind:n.kind,selected:!1};this._ctx.audioTracks[ye._add](r,e),n.enabled&&(r.selected=!0)}_onRemoveNativeTrack(e){let n=this._ctx.audioTracks.getById(e.track.id);n&&this._ctx.audioTracks[ye._remove](n,e)}_onChangeNativeTrack(e){let n=this._getEnabledNativeTrack();if(!n)return;let r=this._ctx.audioTracks.getById(n.id);r&&this._ctx.audioTracks[ye._select](r,!0,e)}_getEnabledNativeTrack(){return Array.from(this._nativeTracks).find(e=>e.enabled)}_onChangeTrack(e){let{current:n}=e.detail;if(!n)return;let r=this._nativeTracks.getTrackById(n.id);if(r){let i=this._getEnabledNativeTrack();i&&(i.enabled=!1),r.enabled=!0}}},Lc=class{constructor(e,n){this._media=e,this._ctx=n,this.scope=Mn(),this._currentSrc=null}setup(){new ET(this,this._ctx),"audioTracks"in this.media&&new PT(this,this._ctx),me(()=>{this._media.srcObject=null,this._media.removeAttribute("src");for(let e of this._media.querySelectorAll("source"))e.remove();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){he(this._media,"playsinline",e)}async loadSource({src:e,type:n},r){this._media.preload=r||"",MT(e)?(this._removeSource(),this._media.srcObject=e):(this._media.srcObject=null,ee(e)?n!=="?"?this._appendSource({src:e,type:n}):(this._removeSource(),this._media.src=this._appendMediaFragment(e)):(this._removeSource(),this._media.src=window.URL.createObjectURL(e))),this._media.load(),this._currentSrc={src:e,type:n}}_appendSource(e,n){let r=this._media.querySelector("source[data-vds]"),i=r??document.createElement("source");he(i,"src",this._appendMediaFragment(e.src)),he(i,"type",e.type!=="?"?e.type:n),he(i,"data-vds",""),r||this._media.append(i)}_removeSource(){this._media.querySelector("source[data-vds]")?.remove()}_appendMediaFragment(e){let{clipStartTime:n,clipEndTime:r}=this._ctx.$state,i=n(),o=r();return i>0&&o>0?`${e}#t=${i},${o}`:i>0?`${e}#t=${i}`:o>0?`${e}#t=0,${o}`:e}}});var nO={};Ot(nO,{AudioProvider:()=>RT});var jue,RT,rO=rt(()=>{"use strict";"use client";CT();jue=$(K(),1),RT=class extends Lc{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 iO={};Ot(iO,{VideoProvider:()=>Dp});function K9(t,e){return Array.from(t.children).find(n=>n.track===e)}var Kue,$T,IT,LT,AT,OT,FT,DT,Dp,NT=rt(()=>{"use strict";"use client";In();Gn();CT();Kue=$(K(),1),$T=class{constructor(e,n){this._video=e,this._ctx=n,e.textTracks.onaddtrack=this._onAddTrack.bind(this),me(this._onDispose.bind(this))}_onAddTrack(e){let n=e.track;if(!n||K9(this._video,n))return;let r=new gn({id:n.id,kind:n.kind,label:n.label,language:n.language,type:"vtt"});r[de._native]={track:n},r[de._readyState]=2,r[de._nativeHLS]=!0;let i=0,o=a=>{if(n.cues)for(let s=i;s<n.cues.length;s++)r.addCue(n.cues[s],a),i++};o(e),n.oncuechange=o,this._ctx.textTracks.add(r,e),r.setMode(n.mode,e)}_onDispose(){this._video.textTracks.onaddtrack=null;for(let e of this._ctx.textTracks){let n=e[de._native]?.track;n?.oncuechange&&(n.oncuechange=null)}}};IT=class{constructor(e,n){this._video=e,this._media=n,this._onChange=(r,i)=>{this._media.delegate._notify("picture-in-picture-change",r,i)},z(this._video,"enterpictureinpicture",this._onEnter.bind(this)),z(this._video,"leavepictureinpicture",this._onExit.bind(this))}get active(){return document.pictureInPictureElement===this._video}get supported(){return _y(this._video)}async enter(){return this._video.requestPictureInPicture()}exit(){return document.exitPictureInPicture()}_onEnter(e){this._onChange(!0,e)}_onExit(e){this._onChange(!1,e)}},LT=class{constructor(e,n){this._video=e,this._media=n,this._mode="inline",z(this._video,"webkitpresentationmodechanged",this._onModeChange.bind(this))}get _supported(){return ky(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 ae("video-presentation-change",{detail:this._mode,trigger:e})),["fullscreen","picture-in-picture"].forEach(r=>{(this._mode===r||n===r)&&this._media.delegate._notify(`${r}-change`,this._mode===r,e)})}},AT=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")}},OT=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")}},FT=class{constructor(e,n){this._video=e,this._ctx=n,this._supported=J(!1),this._setup()}get supported(){return this._supported()}_setup(){Y||!this._video.remote||!this._canPrompt||(this._video.remote.watchAvailability(e=>{this._supported.set(e)}).catch(()=>{this._supported.set(!1)}),M(this._watchSupported.bind(this)))}_watchSupported(){if(!this._supported())return;let e=["connecting","connect","disconnect"],n=this._onStateChange.bind(this);n(),z(this._video,"playing",n);for(let r of e)z(this._video.remote,r,n)}async prompt(){if(!this.supported)throw Error("Not supported on this platform.");return this._type==="airplay"&&this._video.webkitShowPlaybackTargetPicker?this._video.webkitShowPlaybackTargetPicker():this._video.remote.prompt()}_onStateChange(e){let n=this._video.remote.state;if(n===this._state)return;let r={type:this._type,state:n};this._ctx.delegate._notify("remote-playback-change",r,e),this._state=n}},DT=class extends FT{constructor(){super(...arguments),this._type="airplay"}get _canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}},Dp=class extends Lc{constructor(e,n){super(e,n),this.$$PROVIDER_TYPE="VIDEO",qt(()=>{if(this.airPlay=new DT(e,n),ky(e)){let r=new LT(e,n);this.fullscreen=new AT(r),this.pictureInPicture=new OT(r)}else _y(e)&&(this.pictureInPicture=new IT(e,n))},this.scope)}get type(){return"video"}setup(){super.setup(),by(this.video)&&new $T(this.video,this._ctx),this._ctx.textRenderers._attachVideo(this.video),me(()=>{this._ctx.textRenderers._attachVideo(null)}),this.type==="video"&&this._ctx.delegate._notify("provider-setup",this)}get video(){return this._media}}});var oO={};Ot(oO,{HLSProvider:()=>Ty});async function Y9(t,e={}){if(!ot(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 Q9(t,e={}){if(ee(t)){e.onLoadStart?.();try{if(await Ey(t),!an(window.Hls))throw Error("");let n=window.Hls;return e.onLoaded?.(n),n}catch(n){e.onLoadError?.(n)}}}var Zue,G9,VT,zT,X9,Ty,aO=rt(()=>{"use strict";"use client";In();Gn();NT();Fp();Zue=$(K(),1),G9=t=>Cc(t),VT=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,r=B(n).includes("live"),i=B(n).includes("ll-");this._instance=new e({lowLatencyMode:i,backBufferLength:i?4:r?8:void 0,renderTextTracksNatively:!1,...this._config});let o=this._dispatchHLSEvent.bind(this);for(let a of Object.values(e.Events))this._instance.on(a,o);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[pr._enableAuto]=this._enableAutoQuality.bind(this),z(this._ctx.qualities,"change",this._onQualityChange.bind(this)),z(this._ctx.audioTracks,"change",this._onAudioChange.bind(this)),this._stopLiveSync=M(this._liveSync.bind(this))}_liveSync(){if(!this._ctx.$state.live())return;let e=new Vi(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 ae(G9(e),{detail:n}))}_onTracksFound(e,n){let r=new ae(e,{detail:n}),i=-1;for(let o=0;o<n.tracks.length;o++){let a=n.tracks[o],s=a.subtitleTrack??a.closedCaptions,l=new gn({id:`hls-${a.kind}${o}`,src:s?.url,label:a.label,language:s?.lang,kind:a.kind,default:a.default});l[de._readyState]=2,l[de._onModeChange]=()=>{l.mode==="showing"?(this._instance.subtitleTrack=o,i=o):i===o&&(this._instance.subtitleTrack=-1,i=-1)},this._ctx.textTracks.add(l,r)}}_onCuesParsed(e,n){let r=this._ctx.textTracks.getById(`hls-${n.track}`);if(!r)return;let i=new ae(e,{detail:n});for(let o of n.cues)o.positionAlign="auto",r.addCue(o,i)}_onAudioSwitch(e,n){let r=this._ctx.audioTracks[n.id];if(r){let i=new ae(e,{detail:n});this._ctx.audioTracks[ye._select](r,!0,i)}}_onLevelSwitched(e,n){let r=this._ctx.qualities[n.level];if(r){let i=new ae(e,{detail:n});this._ctx.qualities[ye._select](r,!0,i)}}_onLevelLoaded(e,n){if(this._ctx.$state.canPlay())return;let{type:r,live:i,totalduration:o,targetduration:a}=n.details,s=new ae(e,{detail:n});this._ctx.delegate._notify("stream-type-change",i?r==="EVENT"&&Number.isFinite(o)&&a>=10?"live:dvr":"live":"on-demand",s),this._ctx.delegate._notify("duration-change",o,s);let l=this._instance.media;this._instance.currentLevel===-1&&this._ctx.qualities[pr._setAuto](!0,s);for(let c of this._instance.audioTracks){let u={id:c.id.toString(),label:c.name,language:c.lang||"",kind:"main"};this._ctx.audioTracks[ye._add](u,s)}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[ye._add](u,s)}l.dispatchEvent(new ae("canplay",{trigger:s}))}_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,Np&&(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){ee(e.src)&&(this._clearRetryTimer(),this._instance?.loadSource(e.src))}_destroy(){this._clearRetryTimer(),this._ctx&&(this._ctx.qualities[pr._enableAuto]=void 0),this._instance?.destroy(),this._instance=null,this._stopLiveSync?.(),this._stopLiveSync=null}},zT=class{constructor(e,n,r){this._lib=e,this._ctx=n,this._callback=r,this._startLoading()}async _startLoading(){let e={onLoadStart:this._onLoadStart.bind(this),onLoaded:this._onLoaded.bind(this),onLoadError:this._onLoadError.bind(this)},n=await Q9(this._lib,e);if(ot(n)&&!ee(this._lib)&&(n=await Y9(this._lib,e)),!n)return null;if(!n.isSupported()){let r="[vidstack] `hls.js` is not supported in this environment";return this._ctx.player.dispatch(new ae("hls-unsupported")),this._ctx.delegate._notify("error",{message:r,code:4}),null}return n}_onLoadStart(){this._ctx.player.dispatch(new ae("hls-lib-load-start"))}_onLoaded(e){this._ctx.player.dispatch(new ae("hls-lib-loaded",{detail:e})),this._callback(e)}_onLoadError(e){let n=Is(e);this._ctx.player.dispatch(new ae("hls-lib-load-error",{detail:n})),this._ctx.delegate._notify("error",{message:n.message,code:4,error:n})}};X9="https://cdn.jsdelivr.net",Ty=class extends Dp{constructor(){super(...arguments),this.$$PROVIDER_TYPE="HLS",this._ctor=null,this._controller=new VT(this.video,this._ctx),this._library=`${X9}/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(){ee(this._library)&&pi(this._library)}setup(){super.setup(),new zT(this._library,this._ctx,e=>{this._ctor=e,this._controller.setup(e),this._ctx.delegate._notify("provider-setup",this);let n=B(this._ctx.$state.source);n&&this.loadSource(n)})}async loadSource(e,n){if(!ee(e.src)){this._removeSource();return}this._media.preload=n||"",this._appendSource(e,"application/x-mpegurl"),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()}};Ty.supported=Sy()});function Fc(t,e=3e3){let n=vo();return setTimeout(()=>{let r=t();r&&n.reject(r)},e),n}var Oc,UT=rt(()=>{"use strict";"use client";In();Gn();Oc=class{constructor(e){this._iframe=e,this._src=J(""),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(){z(window,"message",this._onWindowMessage.bind(this)),z(this._iframe,"load",this._onLoad.bind(this)),M(this._watchSrc.bind(this))}_watchSrc(){let e=this._src();if(!e.length){this._iframe.setAttribute("src","");return}let n=B(()=>this._buildParams());this._iframe.setAttribute("src",sO(e,n))}_postMessage(e,n){Y||this._iframe.contentWindow?.postMessage(JSON.stringify(e),n??"*")}_onWindowMessage(e){let n=this._getOrigin();if((e.source===null||e.source===this._iframe?.contentWindow)&&(!ee(n)||n===e.origin)){try{let i=JSON.parse(e.data);i&&this._onMessage(i,e);return}catch{}e.data&&this._onMessage(e.data,e)}}}});var lO={};Ot(lO,{getVimeoVideoInfo:()=>HT,resolveVimeoVideoId:()=>jT});function jT(t){let e=t.match(Z9);return{videoId:e?.[1],hash:e?.[2]}}async function HT(t,e){if(BT.has(t))return BT.get(t);if(Py.has(t))return Py.get(t);let n=`https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${t}`,r=window.fetch(n,{mode:"cors",signal:e.signal}).then(i=>i.json()).then(i=>{let o=/vimeocdn.com\/video\/(.*)?_/,a=i?.thumbnail_url?.match(o)?.[1],s=a?`https://i.vimeocdn.com/video/${a}_1920x1080.webp`:"",l={title:i?.title??"",duration:i?.duration??0,poster:s,pro:i.account_type!=="basic"};return BT.set(t,l),l}).finally(()=>Py.delete(t));return Py.set(t,r),r}var Z9,BT,Py,WT=rt(()=>{"use strict";"use client";Z9=/(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:\?hash=(.*))?/,BT=new Map,Py=new Map});var cO={};Ot(cO,{VimeoProvider:()=>qT});var sde,J9,qT,uO=rt(()=>{"use strict";"use client";In();Gn();Fp();UT();WT();sde=$(K(),1),J9=["bufferend","bufferstart","durationchange","ended","enterpictureinpicture","error","fullscreenchange","leavepictureinpicture","loaded","playProgress","loadProgress","pause","play","playbackratechange","qualitychange","seeked","seeking","timeupdate","volumechange","waiting"],qT=class extends Oc{constructor(e,n){super(e),this._ctx=n,this.$$PROVIDER_TYPE="VIMEO",this.scope=Mn(),this._played=0,this._playedRange=new $e(0,0),this._seekableRange=new $e(0,0),this._playPromise=null,this._pausePromise=null,this._videoInfoPromise=null,this._videoId=J(""),this._pro=J(!1),this._hash=null,this._currentSrc=null,this._currentCue=null,this._timeRAF=new Vi(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(){pi(this._getOrigin())}setup(){super.setup(),M(this._watchVideoId.bind(this)),M(this._watchVideoInfo.bind(this)),M(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=Fc(()=>{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=Fc(()=>{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",B(this._ctx.$state.muted))}setPlaybackRate(e){this._remote("setPlaybackRate",e)}async loadSource(e){if(!ee(e.src)){this._currentSrc=null,this._hash=null,this._videoId.set("");return}let{videoId:n,hash:r}=jT(e.src);this._videoId.set(n??""),this._hash=r??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=vo(),r=new AbortController;return this._videoInfoPromise=n,HT(e,r).then(i=>{n.resolve(i)}).catch(i=>{n.reject()}),()=>{n.reject(),r.abort()}}_watchPro(){let e=this._pro(),{$state:n,qualities:r}=this._ctx;if(n.canSetPlaybackRate.set(e),r[ye._setReadonly](!e),e)return z(r,"change",()=>{if(r.auto)return;let i=r.selected?.id;i&&this._remote("setQuality",i)})}_getOrigin(){return"https://player.vimeo.com"}_buildParams(){let{$iosControls:e}=this._ctx,{keyDisabled:n}=this._ctx.$props,{controls:r,playsInline:i}=this._ctx.$state,o=r()||e();return{title:this.title,byline:this.byline,color:this.color,portrait:this.portrait,controls:o,h:this.hash,keyboard:o&&!n(),transparent:!0,playsinline:i(),dnt:!this.cookies}}_onAnimationFrame(){this._remote("getCurrentTime")}_onTimeUpdate(e,n){if(this._skipTimeUpdates&&e===0)return;let{realCurrentTime:r,realDuration:i,paused:o,bufferedEnd:a}=this._ctx.$state;if(r()===e)return;let s=r(),l={currentTime:e,played:this._getPlayedRange(e)};this._notify("time-update",l,n),Math.abs(s-e)>1.5&&(this._notify("seeking",e,n),!o()&&a()<e&&this._notify("waiting",void 0,n)),i()-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 $e(0,this._played=e)}_onSeeked(e,n){this._notify("seeked",e,n)}_onLoaded(e){let n=this._videoId();this._videoInfoPromise?.promise.then(r=>{if(!r)return;let{title:i,poster:o,duration:a,pro:s}=r;this._pro.set(s),this._notify("title-change",i,e),this._notify("poster-change",o,e),this._notify("duration-change",a,e),this._onReady(a,e)}).catch(()=>{n===this._videoId()&&(this._remote("getVideoTitle"),this._remote("getDuration"))})}_onReady(e,n){let{$iosControls:r}=this._ctx,{controls:i}=this._ctx.$state,o=i()||r();this._seekableRange=new $e(0,e);let a={buffered:new $e(0,0),seekable:this._seekableRange,duration:e};this._ctx.delegate._ready(a,n),o||this._remote("_hideOverlay"),this._remote("getQualities"),this._remote("getChapters")}_onMethod(e,n,r){switch(e){case"getVideoTitle":let i=n;this._notify("title-change",i,r);break;case"getDuration":let o=n;this._ctx.$state.canPlay()?this._notify("duration-change",o,r):this._onReady(o,r);break;case"getCurrentTime":this._onTimeUpdate(n,r);break;case"getBuffered":bt(n)&&n.length&&this._onLoadProgress(n[n.length-1][1],r);break;case"setMuted":this._onVolumeChange(B(this._ctx.$state.volume),n,r);break;case"getChapters":this._onChaptersChange(n);break;case"getQualities":this._onQualitiesChange(n,r);break}}_attachListeners(){for(let e of J9)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 r={buffered:new $e(0,e),seekable:this._seekableRange};this._notify("progress",r,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,r){let i={volume:e,muted:n};this._notify("volume-change",i,r)}_onChaptersChange(e){if(this._removeChapters(),!e.length)return;let n=new gn({kind:"chapters",default:!0}),{realDuration:r}=this._ctx.$state;for(let i=0;i<e.length;i++){let o=e[i],a=e[i+1];n.addCue(new window.VTTCue(o.startTime,a?.startTime??r(),o.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[pr._enableAuto]=e.some(r=>r.id==="auto")?()=>{this._remote("setQuality","auto")}:void 0;for(let r of e){if(r.id==="auto")continue;let i=+r.id.slice(0,-1);isNaN(i)||this._ctx.qualities[ye._add]({id:r.id,width:i*(16/9),height:i,codec:"avc1,h.264",bitrate:-1},n)}this._onQualityChange(e.find(r=>r.active),n)}_onQualityChange({id:e}={},n){if(!e)return;let r=e==="auto",i=this._ctx.qualities.toArray().find(o=>o.id===e);r?(this._ctx.qualities[pr._setAuto](r,n),this._ctx.qualities[ye._select](void 0,!0,n)):this._ctx.qualities[ye._select](i,!0,n)}_onEvent(e,n,r){switch(e){case"ready":this._attachListeners();break;case"loaded":this._onLoaded(r);break;case"play":this._onPlay(r);break;case"playProgress":this._onPlayProgress(r);break;case"pause":this._onPause(r);break;case"loadProgress":this._onLoadProgress(n.seconds,r);break;case"waiting":this._onWaiting(r);break;case"bufferstart":this._onBufferStart(r);break;case"bufferend":this._onBufferEnd(r);break;case"volumechange":this._onVolumeChange(n.volume,B(this._ctx.$state.muted),r);break;case"durationchange":this._seekableRange=new $e(0,n.duration),this._notify("duration-change",n.duration,r);break;case"playbackratechange":this._notify("rate-change",n.playbackRate,r);break;case"qualitychange":this._onQualityChange(n,r);break;case"fullscreenchange":this._notify("fullscreen-change",n.fullscreen,r);break;case"enterpictureinpicture":this._notify("picture-in-picture-change",!0,r);break;case"leavepictureinpicture":this._notify("picture-in-picture-change",!1,r);break;case"ended":this._notify("end",void 0,r);break;case"error":this._onError(n,r);break;case"seek":case"seeked":this._onSeeked(n.seconds,r);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 $e(0,0),this._seekableRange=new $e(0,0),this._playPromise=null,this._pausePromise=null,this._videoInfoPromise=null,this._currentCue=null,this._pro.set(!1),this._removeChapters()}}});var dO={};Ot(dO,{findYouTubePoster:()=>tW,resolveYouTubeVideoId:()=>GT});function GT(t){return t.match(eW)?.[1]}async function tW(t,e){if(KT.has(t))return KT.get(t);if(Cy.has(t))return Cy.get(t);let n=new Promise(async r=>{let i=["maxresdefault","sddefault","hqdefault"];for(let o of i)for(let a of[!0,!1]){let s=nW(t,o,a);if((await fetch(s,{mode:"no-cors",signal:e.signal})).status<400){KT.set(t,s),r(s);return}}}).catch(()=>"").finally(()=>Cy.delete(t));return Cy.set(t,n),n}function nW(t,e,n){return`https://i.ytimg.com/${n?"vi_webp":"vi"}/${t}/${e}.${n?"webp":"jpg"}`}var eW,KT,Cy,YT=rt(()=>{"use strict";"use client";eW=/(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/,KT=new Map,Cy=new Map});var pO={};Ot(pO,{YouTubeProvider:()=>QT});var pde,Ls,QT,fO=rt(()=>{"use strict";"use client";In();Gn();UT();YT();pde=$(K(),1),Ls={_Unstarted:-1,_Ended:0,_Playing:1,_Paused:2,_Buffering:3,_Cued:5},QT=class extends Oc{constructor(e,n){super(e),this._ctx=n,this.$$PROVIDER_TYPE="YOUTUBE",this.scope=Mn(),this._videoId=J(""),this._state=-1,this._seekingTimer=-1,this._pausedSeeking=!1,this._played=0,this._playedRange=new $e(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(){pi(this._getOrigin())}setup(){super.setup(),M(this._watchVideoId.bind(this)),this._notify("provider-setup",this)}async play(){let{paused:e}=this._ctx.$state;return this._playPromise||(this._playPromise=Fc(()=>{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=Fc(()=>{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(!ee(e.src)){this._currentSrc=null,this._videoId.set("");return}let n=GT(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:r,muted:i,playsInline:o}=this._ctx.$state,a=r()||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:i()?1:0,playsinline:o()?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:r,realCurrentTime:i}=this._ctx.$state,o=this._state===Ls._Ended,a=o?r():e,s={currentTime:a,played:this._getPlayedRange(a)};this._notify("time-update",s,n),!o&&Math.abs(a-i())>1&&this._notify("seeking",a,n)}_getPlayedRange(e){return this._played>=e?this._playedRange:this._playedRange=new $e(0,this._played=e)}_onProgress(e,n,r){let i={buffered:new $e(0,e),seekable:n};this._notify("progress",i,r);let{seeking:o,realCurrentTime:a}=this._ctx.$state;o()&&e>a()&&this._onSeeked(r)}_onSeeked(e){let{paused:n,realCurrentTime:r}=this._ctx.$state;window.clearTimeout(this._seekingTimer),this._seekingTimer=window.setTimeout(()=>{this._notify("seeked",r(),e),this._seekingTimer=-1},n()?100:0),this._pausedSeeking=!1}_onEnded(e){let{seeking:n}=this._ctx.$state;n()&&this._onSeeked(e),this._notify("pause",void 0,e),this._notify("end",void 0,e)}_onStateChange(e,n){let{started:r,paused:i,seeking:o}=this._ctx.$state,a=e===Ls._Playing,s=e===Ls._Buffering,l=(i()||this._playPromise)&&(s||a);if(s&&this._notify("waiting",void 0,n),o()&&a&&this._onSeeked(n),!r()&&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 Ls._Cued:this._onReady(n);break;case Ls._Playing:this._notify("playing",void 0,n);break;case Ls._Paused:this._onPause(n);break;case Ls._Ended:this._onEnded(n);break}this._state=e}_onMessage({info:e},n){if(!e)return;let{title:r,intrinsicDuration:i,playbackRate:o}=this._ctx.$state;if(_p(e.videoData)&&e.videoData.title!==r()&&this._notify("title-change",e.videoData.title,n),$t(e.duration)&&e.duration!==i()){if($t(e.videoLoadedFraction)){let a=e.progressState?.loaded??e.videoLoadedFraction*e.duration,s=new $e(0,e.duration);this._onProgress(a,s,n)}this._notify("duration-change",e.duration,n)}if($t(e.playbackRate)&&e.playbackRate!==o()&&this._notify("rate-change",e.playbackRate,n),e.progressState){let{current:a,seekableStart:s,seekableEnd:l,loaded:c,duration:u}=e.progressState;this._onTimeUpdate(a,n),this._onProgress(c,new $e(s,l),n),u!==i()&&this._notify("duration-change",u,n)}if($t(e.volume)&&nT(e.muted)){let a={muted:e.muted,volume:e.volume/100};this._notify("volume-change",a,n)}$t(e.playerState)&&e.playerState!==this._state&&this._onStateChange(e.playerState,n)}_reset(){this._state=-1,this._seekingTimer=-1,this._played=0,this._playedRange=new $e(0,0),this._playPromise=null,this._pausePromise=null,this._pausedSeeking=!1}}});var mO={};Ot(mO,{GoogleCastProvider:()=>eS});var yde,ZT,XT,hO,JT,eS,gO=rt(()=>{"use strict";"use client";In();Gn();Fp();nS();yde=$(K(),1),ZT=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 r=new chrome.cast.media.Track(n,chrome.cast.media.TrackType.TEXT);return r.name=e.label,r.trackContentId=e.src,r.trackContentType="text/vtt",r.language=e.language,r.subtype=e.kind.toUpperCase(),r}},XT=chrome.cast.media.TrackType.TEXT,hO=chrome.cast.media.TrackType.AUDIO,JT=class{constructor(e,n,r){this._cast=e,this._ctx=n,this._onNewLocalTracks=r}_setup(){let e=this._syncRemoteActiveIds.bind(this);z(this._ctx.audioTracks,"change",e),z(this._ctx.textTracks,"mode-change",e),M(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(r=>r.type===e):n}_getRemoteActiveIds(){let e=[],n=this._getLocalAudioTracks().find(i=>i.selected),r=this._getLocalTextTracks().filter(i=>i.mode==="showing");if(n){let i=this._getRemoteTracks(hO),o=this._findRemoteTrack(i,n);o&&e.push(o.trackId)}if(r?.length){let i=this._getRemoteTracks(XT);if(i.length)for(let o of r){let a=this._findRemoteTrack(i,o);a&&e.push(a.trackId)}}return e}_syncLocalTracks(){let e=this._getLocalTextTracks();if(!this._cast.isMediaLoaded)return;let n=this._getRemoteTracks(XT);for(let r of e)if(!this._findRemoteTrack(n,r)){Ec(()=>this._onNewLocalTracks?.());break}}_syncRemoteTracks(e){if(!this._cast.isMediaLoaded)return;let n=this._getLocalAudioTracks(),r=this._getLocalTextTracks(),i=this._getRemoteTracks(hO),o=this._getRemoteTracks(XT);for(let a of i){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[ye._add](l,e)}for(let a of o){if(this._findLocalTrack(r,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(),r=new chrome.cast.media.EditTracksInfoRequest(n);this._editTracksInfo(r).catch(i=>{})}_editTracksInfo(e){let n=zp();return new Promise((r,i)=>n?.editTracksInfo(e,r,i))}_findLocalTrack(e,n){return e.find(r=>this._isMatch(r,n))}_findRemoteTrack(e,n){return e.find(r=>this._isMatch(n,r))}_isMatch(e,n){return n.name===e.label&&n.language===e.language&&n.subtype.toLowerCase()===e.kind.toLowerCase()}},eS=class{constructor(e,n){this._player=e,this._ctx=n,this.$$PROVIDER_TYPE="GOOGLE_CAST",this.scope=Mn(),this._currentSrc=null,this._state="disconnected",this._currentTime=0,this._played=0,this._playedRange=new $e(0,0),this._seekableRange=new $e(0,0),this._timeRAF=new Vi(this._onAnimationFrame.bind(this)),this._reloadInfo=null,this._isIdle=!1,this._tracks=new JT(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 As()}get session(){return Vp()}get media(){return zp()}get hasActiveSession(){return My(this._currentSrc)}setup(){this._attachCastContextEventListeners(),this._attachCastPlayerEventListeners(),this._tracks._setup(),this._notify("provider-setup",this)}_attachCastContextEventListeners(){tS(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 r=this._onRemotePlayerEvent.bind(this);for(let i of Pp(n))this._player.controller.addEventListener(i,r);me(()=>{for(let i of Pp(n))this._player.controller.removeEventListener(i,r)})}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,r)=>{this.media?.getStatus(e,n,r)})}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),My(e)){this._resumeSession(),this._currentSrc=e;return}this._notify("load-start");let n=this._buildLoadRequest(e),r=await this.session.loadMedia(n);if(r){this._currentSrc=null,this._notify("error",Error(Ry(r)));return}this._currentSrc=e}destroy(){this._reset(),this._endSession()}_reset(){this._reloadInfo||(this._played=0,this._playedRange=new $e(0,0),this._seekableRange=new $e(0,0)),this._timeRAF._stop(),this._currentTime=0,this._reloadInfo=null}_resumeSession(){let e=new ae("resume-session",{detail:this.session});this._onMediaLoadedChange(e);let{muted:n,volume:r,remotePlaybackInfo:i}=this._ctx.$state,o=i();this.setCurrentTime(Math.max(this._player.currentTime,o?.savedState?.currentTime??0)),this.setMuted(n()),this.setVolume(r()),o?.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(),r=n===cast.framework.CastState.CONNECTED?"connected":n===cast.framework.CastState.CONNECTING?"connecting":"disconnected";if(this._state===r)return;let i={type:"google-cast",state:r},o=this._createEvent(e);this._state=r,this._notify("remote-playback-change",i,o),r==="disconnected"&&this._disconnectFromReceiver()}_onMediaLoadedChange(e){if(!!!this._player.isMediaLoaded)return;let r=B(this._ctx.$state.source);Promise.resolve().then(()=>{if(r!==B(this._ctx.$state.source)||!this._player.isMediaLoaded)return;this._reset();let i=this._player.duration;this._seekableRange=new $e(0,i);let o={provider:this,duration:i,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",o,a),this._onCanControlVolumeChange(),this._onCanSeekChange(e);let{volume:s,muted:l}=this._ctx.$state;this.setVolume(s()),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,r=this._getPlayedRange(e),i={currentTime:e,played:r};this._notify("time-update",i),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 $e(0,this._played=e)}_onDurationChange(e){if(!this._player.isMediaLoaded||this._reloadInfo)return;let n=this._player.duration,r=this._createEvent(e);this._seekableRange=new $e(0,n),this._notify("duration-change",n,r)}_onVolumeChange(e){if(!this._player.isMediaLoaded)return;let n={muted:this._player.isMuted,volume:this._player.volumeLevel},r=this._createEvent(e);this._notify("volume-change",n,r)}_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},r=e?this._createEvent(e):void 0;this._notify("progress",n,r)}_onPlayerStateChange(e){let n=this._player.playerState,r=chrome.cast.media.PlayerState;if(this._isIdle=n===r.IDLE,n===r.PAUSED)return;let i=this._createEvent(e);switch(n){case r.PLAYING:this._notify("playing",void 0,i);break;case r.BUFFERING:this._notify("waiting",void 0,i);break;case r.IDLE:this._timeRAF._stop(),this._notify("pause"),this._notify("end");break}}_getSeekableRange(){return this._player.liveSeekableRange?new $e(this._player.liveSeekableRange.start,this._player.liveSeekableRange.end):this._seekableRange}_createEvent(e){return e instanceof Event?e:new ae(e.type,{detail:e})}_buildMediaInfo(e){let{streamType:n,title:r,poster:i}=this._ctx.$state;return new ZT(e)._setMetadata(r(),i())._setStreamType(n())._setTracks(this._tracks._getLocalTextTracks()).build()}_buildLoadRequest(e){let n=this._buildMediaInfo(e),r=new chrome.cast.media.LoadRequest(n),i=this._ctx.$state.remotePlaybackInfo();return r.autoplay=(this._reloadInfo?.paused??i?.savedState?.paused)===!1,r.currentTime=this._reloadInfo?.time??i?.savedState?.currentTime??0,r}async _reload(e,n){let r=B(this._ctx.$state.source);this._reloadInfo={src:r,paused:e,time:n},await this.loadSource(r)}_onNewLocalTracks(){this._reload(this._player.isPaused,this._player.currentTime).catch(e=>{})}}});var vO={};Ot(vO,{a:()=>As,b:()=>Vp,c:()=>Ry,d:()=>sW,g:()=>zp,h:()=>My,l:()=>tS});function rW(){return"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"}function iW(){return!!window.cast?.framework}function oW(){return!!window.chrome?.cast?.isAvailable}function yO(){return As().getCastState()===cast.framework.CastState.CONNECTED}function As(){return window.cast.framework.CastContext.getInstance()}function Vp(){return As().getCurrentSession()}function zp(){return Vp()?.getSessionObj().media[0]}function My(t){return zp()?.media.contentId===t?.src}function aW(){return{language:"en-US",autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,resumeSavedSession:!0,androidReceiverCompatible:!0}}function Ry(t){return`Google Cast Error Code: ${t}`}function tS(t,e){return xO(As(),t,e)}var rS,sW,nS=rt(()=>{"use strict";"use client";Gn();In();rS=class{constructor(){this.name="google-cast"}get cast(){return As()}mediaType(){return"video"}canPlay(e){return Np&&!Ac&&$y(e)}async prompt(e){let n;try{let r=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:r}),e.player.dispatchEvent(n),this._notifyRemoteStateChange(e,"connecting",n),await this._showPrompt(B(e.$props.googleCast)),e.$state.remotePlaybackInfo.set({deviceName:Vp()?.getCastDevice().friendlyName}),yO()&&this._notifyRemoteStateChange(e,"connected",n)}catch(r){let i=Is(r);throw this._notifyRemoteStateChange(e,yO()?"connected":"disconnected",new ae("google-cast-prompt-error",{detail:i})),i}finally{e.player.dispatch("google-cast-prompt-close",{trigger:n})}}async load(e){if(Y)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(()=>(gO(),mO))).GoogleCastProvider(this._player,e)}async _loadCastFramework(e){if(iW())return;let n=e.player.createEvent("google-cast-load-start");e.player.dispatch(n),await Ey(rW()),await customElements.whenDefined("google-cast-launcher");let r=e.player.createEvent("google-cast-loaded",{trigger:n});if(e.player.dispatch(r),!oW())throw Error("Cast not available.");return r}async _showPrompt(e){this._setOptions(e);let n=await this.cast.requestSession();if(n)throw Error(Ry(n))}_setOptions(e){this.cast?.setOptions({...aW(),...e})}_notifyRemoteStateChange(e,n,r){let i={type:"google-cast",state:n};e.delegate._notify("remote-playback-change",i,r)}},sW=Object.freeze({__proto__:null,GoogleCastLoader:rS})});function jO(){return Dy}function iS(t){if(Os.fullscreenElement===t)return!0;try{return t.matches(Os.fullscreenPseudoClass)}catch{return!1}}function TO(){if(!Dy)throw Error("[vidstack] no fullscreen API")}function PS(){return HO()&&an(screen.orientation.unlock)}function HO(){return!Y&&!ot(window.screen.orientation)&&!ot(window.screen.orientation.lock)}function wW(t,e){return Y?!1:(t||(t=document.createElement("audio")),t.canPlayType(e).length>0)}function bW(t,e){return Y?!1:(t||(t=document.createElement("video")),t.canPlayType(e).length>0)}function by(t){return Y?!1:(t||(t=document.createElement("video")),t.canPlayType("application/vnd.apple.mpegurl").length>0)}function _y(t){return Y?!1:!!document.pictureInPictureEnabled&&!t?.disablePictureInPicture}function ky(t){return Y?!1:an(t?.webkitSupportsPresentationMode)&&an(t?.webkitSetPresentationMode)}async function WO(){let t=document.createElement("video");return t.volume=.5,await cT(0),t.volume===.5}function _W(){return Y?void 0:window?.ManagedMediaSource??window?.MediaSource??window?.WebKitMediaSource}function kW(){return Y?void 0:window?.SourceBuffer??window?.WebKitSourceBuffer}function Sy(){if(Y)return!1;let t=_W();if(ot(t))return!1;let e=t&&an(t.isTypeSupported)&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),n=kW(),r=ot(n)||!ot(n.prototype)&&an(n.prototype.appendBuffer)&&an(n.prototype.remove);return!!e&&!!r}function lS(t){if(!t.length)return null;let e=t.start(0);for(let n=1;n<t.length;n++){let r=t.start(n);r<e&&(e=r)}return e}function Hp(t){if(!t.length)return null;let e=t.end(0);for(let n=1;n<t.length;n++){let r=t.end(n);r>e&&(e=r)}return e}function sO(t,e){let n=new URLSearchParams;for(let r of Object.keys(e))n.set(r,e[r]+"");return t+"?"+n.toString()}function pi(t,e="preconnect"){if(Y)return!1;let n=document.querySelector(`link[href="${t}"]`);if(!Di(n))return!0;let r=document.createElement("link");return r.rel=e,r.href=t,r.crossOrigin="true",document.head.append(r),!0}function Ey(t){if(Iy[t])return Iy[t].promise;let e=vo(),n=document.querySelector(`script[src="${t}"]`);if(!Di(n))return e.resolve(),e.promise;let r=document.createElement("script");return r.src=t,r.onload=()=>{e.resolve(),delete Iy[t]},r.onerror=()=>{e.reject(),delete Iy[t]},setTimeout(()=>document.head.append(r),0),e.promise}function Vy(t){return t==="use-credentials"?"include":ee(t)?"same-origin":void 0}function zy(t,e){return e>=t.startTime&&e<t.endTime}function Yc(t,e,n){let r=null;function i(){let o=ee(e)?[e]:e,a=t.toArray().find(s=>o.includes(s.kind)&&s.mode==="showing");if(a!==r){if(!a){n(null),r=null;return}a.readyState==2?n(a):(n(null),a.addEventListener("load",()=>n(a),{once:!0})),r=a}}return i(),z(t,"mode-change",i)}function It(t){return $W.test(t.kind)}function GO(t,e,n){let r=ee(t)?JSON.parse(t):t,i=[],o=[];return r.regions&&n&&(i=r.regions.map(a=>Object.assign(new n,a))),(r.cues||bt(r))&&(o=(bt(r)?r:r.cues).filter(a=>$t(a.startTime)&&$t(a.endTime)).map(a=>Object.assign(new e(0,0,""),a))),{regions:i,cues:o}}function YO(t){Ws.reset(t,e=>IW.has(e)),di()}function Le(){return dt(Af)}function QO(t){return t.split("-")[0]}function LW(t){return t.split("-")[1]}function AW(t){return t==="x"?"y":"x"}function OW(t){return t==="y"?"height":"width"}function XO(t){return["top","bottom"].includes(QO(t))?"y":"x"}function FW(t){return AW(XO(t))}function ZO(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function MO(t,e,n){let{reference:r,floating:i}=t,o=XO(e),a=FW(e),s=OW(a),l=QO(e),c=o==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(LW(e)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1);break}return f}function Ra(t){return JO(t)?(t.nodeName||"").toLowerCase():"#document"}function hr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Co(t){var e;return(e=(JO(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function JO(t){return t instanceof Node||t instanceof hr(t).Node}function ko(t){return t instanceof Element||t instanceof hr(t).Element}function zi(t){return t instanceof HTMLElement||t instanceof hr(t).HTMLElement}function RO(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof hr(t).ShadowRoot}function Of(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=jr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function NW(t){return["table","td","th"].includes(Ra(t))}function MS(t){let e=RS(),n=jr(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(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function VW(t){let e=Uc(t);for(;zi(e)&&!Ev(e);){if(MS(e))return e;e=Uc(e)}return null}function RS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ev(t){return["html","body","#document"].includes(Ra(t))}function jr(t){return hr(t).getComputedStyle(t)}function Pv(t){return ko(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Uc(t){if(Ra(t)==="html")return t;let e=t.assignedSlot||t.parentNode||RO(t)&&t.host||Co(t);return RO(e)?e.host:e}function eF(t){let e=Uc(t);return Ev(e)?t.ownerDocument?t.ownerDocument.body:t.body:zi(e)&&Of(e)?e:eF(e)}function Wp(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=eF(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),a=hr(i);return o?e.concat(a,a.visualViewport||[],Of(i)?i:[],a.frameElement&&n?Wp(a.frameElement):[]):e.concat(i,Wp(i,[],n))}function tF(t){let e=jr(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=zi(t),o=i?t.offsetWidth:n,a=i?t.offsetHeight:r,s=Uy(n)!==o||Uy(r)!==a;return s&&(n=o,r=a),{width:n,height:r,$:s}}function $S(t){return ko(t)?t:t.contextElement}function Nc(t){let e=$S(t);if(!zi(e))return Ma(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=tF(e),a=(o?Uy(n.width):n.width)/r,s=(o?Uy(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}function nF(t){let e=hr(t);return!RS()||!e.visualViewport?zW:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function UW(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==hr(t)?!1:e}function Fs(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=$S(t),a=Ma(1);e&&(r?ko(r)&&(a=Nc(r)):a=Nc(t));let s=UW(o,n,r)?nF(o):Ma(0),l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(o){let p=hr(o),f=r&&ko(r)?hr(r):r,h=p,g=h.frameElement;for(;g&&r&&f!==h;){let x=Nc(g),m=g.getBoundingClientRect(),y=jr(g),v=m.left+(g.clientLeft+parseFloat(y.paddingLeft))*x.x,w=m.top+(g.clientTop+parseFloat(y.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=v,c+=w,h=hr(g),g=h.frameElement}}return ZO({width:u,height:d,x:l,y:c})}function rF(t){return BW.some(e=>{try{return t.matches(e)}catch{return!1}})}function jW(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t,o=i==="fixed",a=Co(r),s=e?rF(e.floating):!1;if(r===a||s&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Ma(1),u=Ma(0),d=zi(r);if((d||!d&&!o)&&((Ra(r)!=="body"||Of(a))&&(l=Pv(r)),zi(r))){let p=Fs(r);c=Nc(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function HW(t){return Array.from(t.getClientRects())}function iF(t){return Fs(Co(t)).left+Pv(t).scrollLeft}function WW(t){let e=Co(t),n=Pv(t),r=t.ownerDocument.body,i=Dc(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Dc(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),a=-n.scrollLeft+iF(t),s=-n.scrollTop;return jr(r).direction==="rtl"&&(a+=Dc(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:s}}function qW(t,e){let n=hr(t),r=Co(t),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;let c=RS();(!c||c&&e==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s,y:l}}function KW(t,e){let n=Fs(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=zi(t)?Nc(t):Ma(1),a=t.clientWidth*o.x,s=t.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:a,height:s,x:l,y:c}}function $O(t,e,n){let r;if(e==="viewport")r=qW(t,n);else if(e==="document")r=WW(Co(t));else if(ko(e))r=KW(e,n);else{let i=nF(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return ZO(r)}function oF(t,e){let n=Uc(t);return n===e||!ko(n)||Ev(n)?!1:jr(n).position==="fixed"||oF(n,e)}function GW(t,e){let n=e.get(t);if(n)return n;let r=Wp(t,[],!1).filter(s=>ko(s)&&Ra(s)!=="body"),i=null,o=jr(t).position==="fixed",a=o?Uc(t):t;for(;ko(a)&&!Ev(a);){let s=jr(a),l=MS(a);!l&&s.position==="fixed"&&(i=null),(o?!l&&!i:!l&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Of(a)&&!l&&oF(t,a))?r=r.filter(u=>u!==a):i=s,a=Uc(a)}return e.set(t,r),r}function YW(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,a=[...n==="clippingAncestors"?GW(e,this._c):[].concat(n),r],s=a[0],l=a.reduce((c,u)=>{let d=$O(e,u,i);return c.top=Dc(d.top,c.top),c.right=cS(d.right,c.right),c.bottom=cS(d.bottom,c.bottom),c.left=Dc(d.left,c.left),c},$O(e,s,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function QW(t){let{width:e,height:n}=tF(t);return{width:e,height:n}}function XW(t,e,n){let r=zi(e),i=Co(e),o=n==="fixed",a=Fs(t,!0,o,e),s={scrollLeft:0,scrollTop:0},l=Ma(0);if(r||!r&&!o)if((Ra(e)!=="body"||Of(i))&&(s=Pv(e)),r){let d=Fs(e,!0,o,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else i&&(l.x=iF(i));let c=a.left+s.scrollLeft-l.x,u=a.top+s.scrollTop-l.y;return{x:c,y:u,width:a.width,height:a.height}}function IO(t,e){return!zi(t)||jr(t).position==="fixed"?null:e?e(t):t.offsetParent}function aF(t,e){let n=hr(t);if(!zi(t)||rF(t))return n;let r=IO(t,e);for(;r&&NW(r)&&jr(r).position==="static";)r=IO(r,e);return r&&(Ra(r)==="html"||Ra(r)==="body"&&jr(r).position==="static"&&!MS(r))?n:r||VW(t)||n}function JW(t){return jr(t).direction==="rtl"}function tq(t,e){let n=null,r,i=Co(t);function o(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function a(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),o();let{left:c,top:u,width:d,height:p}=t.getBoundingClientRect();if(s||e(),!d||!p)return;let f=Ly(u),h=Ly(i.clientWidth-(c+d)),g=Ly(i.clientHeight-(u+p)),x=Ly(c),y={rootMargin:-f+"px "+-h+"px "+-g+"px "+-x+"px",threshold:Dc(0,cS(1,l))||1},v=!0;function w(k){let b=k[0].intersectionRatio;if(b!==l){if(!v)return a();b?a(!1,b):r=setTimeout(()=>{a(!1,1e-7)},100)}v=!1}try{n=new IntersectionObserver(w,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(w,y)}n.observe(t)}return a(!0),o}function nq(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$S(t),u=i||o?[...c?Wp(c):[],...Wp(e)]:[];u.forEach(m=>{i&&m.addEventListener("scroll",n,{passive:!0}),o&&m.addEventListener("resize",n)});let d=c&&s?tq(c,n):null,p=-1,f=null;a&&(f=new ResizeObserver(m=>{let[y]=m;y&&y.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),n()}),c&&!l&&f.observe(c),f.observe(e));let h,g=l?Fs(t):null;l&&x();function x(){let m=Fs(t);g&&(m.x!==g.x||m.y!==g.y||m.width!==g.width||m.height!==g.height)&&n(),g=m,h=requestAnimationFrame(x)}return n(),()=>{var m;u.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),d?.(),(m=f)==null||m.disconnect(),f=null,l&&cancelAnimationFrame(h)}}function xO(t,e,n){if(t)return z(t,e,n)}function He(t,e,n){t.hasAttribute(e)||t.setAttribute(e,n)}function La(t,e){if(t.hasAttribute("aria-label")||t.hasAttribute("data-no-label"))return;if(!an(e)){he(t,"aria-label",e);return}function n(){he(t,"aria-label",e())}Y?n():M(n)}function sF(t,e,n){for(;e;){if(e===t)return!0;if(n?.(e))break;e=e.parentElement}return!1}function $a(t,e){z(t,"pointerup",n=>{n.button===0&&e(n)}),z(t,"keydown",n=>{Tp(n)&&e(n)})}function IS(t){return Pc(t)&&(t.touches.length>1||t.changedTouches.length>1)}function By(t){if(Y)return t();let e=xp(),n=window.requestAnimationFrame(()=>{qt(t,e),n=-1});return()=>void window.cancelAnimationFrame(n)}function lF(t,e,n,{offsetVarName:r,xOffset:i,yOffset:o,...a}){if(!t)return;let s=n.replace(" ","-").replace("-center","");if(on(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 nq(e,t,()=>{rq(e,t,{placement:s,...a}).then(({x:u,y:d})=>{Object.assign(t.style,{top:`calc(${d+"px"} + ${c(o?o+"px":`var(--${r}-y-offset, 0px)`)})`,left:`calc(${u+"px"} + ${l(i?i+"px":`var(--${r}-x-offset, 0px)`)})`})})})}function iq(t){return getComputedStyle(t).animationName!=="none"}function oq(t,e,n){var r=null,i=null,o=n&&n.leading,a=n&&n.trailing;o==null&&(o=!0),a==null&&(a=!o),o==!0&&(a=!1);var s=function(){r&&(clearTimeout(r),r=null)},l=function(){var u=i;s(),u&&u()},c=function(){var u=o&&!r,d=this,p=arguments;if(i=function(){return t.apply(d,p)},r||(r=setTimeout(function(){if(r=null,a)return i()},e)),u)return u=!1,i()};return c.cancel=s,c.flush=l,c}function aq(t,e,n){var r=null,i=null,o=function(){r&&(clearTimeout(r),i=null,r=null)},a=function(){var l=i;o(),l&&l()},s=function(){if(!e)return t.apply(this,arguments);var l=this,c=arguments,u=n&&!r;if(o(),i=function(){t.apply(l,c)},r=setTimeout(function(){if(r=null,!u){var d=i;return i=null,d()}},e),u)return i()};return s.cancel=o,s.flush=a,s}function Qc(t){return t?.$$PROVIDER_TYPE==="VIDEO"}function cF(t){return!Y&&t instanceof HTMLAudioElement}function uF(t){return!Y&&t instanceof HTMLVideoElement}function dF(t){return cF(t)||uF(t)}function dq(t){return t.replace(/Shift\+(\d)/g,(e,n)=>uq[n-1])}function AS({src:t,type:e}){return ee(t)?fF.test(t)||hF.has(e)||t.startsWith("blob:")&&e==="audio/object":e==="audio/object"}function OS(t){return ee(t.src)?mF.test(t.src)||gF.has(t.type)||t.src.startsWith("blob:")&&t.type==="video/object"||$s(t)&&(Y||by()):t.type==="video/object"}function $s({src:t,type:e}){return ee(t)&&yF.test(t)||vF.has(e)}function $y(t){return ee(t.src)&&(AS(t)||OS(t)||$s(t))}function MT(t){return!Y&&typeof window.MediaStream<"u"&&t instanceof window.MediaStream}function Is(t){return t instanceof Error?t:Error(JSON.stringify(t))}function bo(t,e){if(!t)throw Error(e||"Assertion failed.")}function aS(t,e){if(!(t&&e))throw Error("[vidstack] media not ready")}function OO(t,e){if(!e?.supported)throw Error("[vidstack] no fullscreen support")}function An(t,e=2){return Number(t.toFixed(e))}function wy(t){return String(t).split(".")[1]?.length??0}function FS(t,e,n){return Math.max(t,Math.min(n,e))}function Ay(t,e){he(t,"data-focus",e),he(t,"data-hocus",e)}function FO(t,e){he(t,"data-hocus",e),he(t,"data-hover",e)}function _F(t,e){return fetch(t,e).then(n=>n.text()).then(n=>{let r=xq(n);if(r)return _F(/^https?:/.test(r)?r:new URL(r,t).href,e);let i=/EXT-X-PLAYLIST-TYPE:\s*VOD/.test(n)?"on-demand":"live";return i==="live"&&wq(n)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(n)||n.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":i})}function xq(t){let e=t.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return e?e[0].split(`
|
|
`)[1].trim():null}function wq(t){let e=t.split(`
|
|
`);for(let n of e)if(n.startsWith("#EXT-X-TARGETDURATION")){let r=parseFloat(n.split(":")[1]);if(!isNaN(r))return r}return-1}function DO(t){return(bt(t)?t:[t&&!ee(t)&&"src"in t?t:{src:t||""}]).map(({src:e,type:n,...r})=>({src:e,type:n??(ee(e)?kF.get(e):null)??(!ee(e)||e.startsWith("blob:")?"video/object":e.includes("youtube")?"video/youtube":e.includes("vimeo")&&!e.includes("progressive_redirect")&&!e.includes(".m3u8")?"video/vimeo":"?"),...r})).sort(e=>e.type==="?"?1:-1)}function NO(t,e){return t?.src===e?.src&&t?.type===e?.type}function Cq(t){return t?"true":"false"}function Qn(t){return()=>Cq(t())}function VO(t,e,n){let r=e-t,i=n-t;return r>0?i/r:0}function Mq(t,e,n,r){return FS(t,An(n,wy(r)),e)}function Rq(t,e,n,r){let i=FS(0,n,1),o=e-t,a=o*i,s=a/r,l=r*s;return t+l}function sS(t,e){let n=String(t),r=n.length;if(r<e){let o=e-r;return`${"0".repeat(o)}${t}`}return n}function TF(t){let e=Math.trunc(t/3600),n=Math.trunc(t%3600/60),r=Math.trunc(t%60),i=Number((t-Math.trunc(t)).toPrecision(3));return{hours:e,minutes:n,seconds:r,fraction:i}}function Aa(t,{padHrs:e=null,padMins:n=null,showHrs:r=!1,showMs:i=!1}={}){let{hours:o,minutes:a,seconds:s,fraction:l}=TF(t),c=e?sS(o,2):o,u=n||Di(n)&&t>=3600?sS(a,2):a,d=sS(s,2),p=i&&l>0?`.${String(l).replace(/^0?\./,"")}`:"",f=`${u}:${d}${p}`;return o>0||r?`${c}:${f}`:f}function Qp(t){let e=[],{hours:n,minutes:r,seconds:i}=TF(t);return n>0&&e.push(`${n} hour`),r>0&&e.push(`${r} min`),(i>0||e.length===0)&&e.push(`${i} sec`),e.join(" ")}function DS(t,{clamp:e,offset:n,orientation:r}){let i=getComputedStyle(t),o=parseFloat(i.width),a=parseFloat(i.height),s={top:null,right:null,bottom:null,left:null};if(s[r==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${n}px))`,r==="horizontal"){let l=o/2;if(!e)s.left=`calc(var(--slider-pointer) - ${l}px)`;else{let c=`max(0px, calc(var(--slider-pointer) - ${l}px))`,u=`calc(100% - ${o}px)`;s.left=`min(${c}, ${u})`}}else{let l=a/2;if(!e)s.bottom=`calc(var(--slider-pointer) - ${l}px)`;else{let c=`max(${l}px, calc(var(--slider-pointer) - ${l}px))`,u=`calc(100% - ${a}px)`;s.bottom=`min(${c}, ${u})`}}Object.assign(t.style,s)}function uK(t){return Ze.isValidElement(t)&&t.type===cK}function dK(t,e){let n={...e};for(let r in e){let i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{o(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function CF(t){return t?.$$PROVIDER_TYPE==="REMOTION"}function qe(t,e){let n=Ta(Ws);return Ie((e?.current?.$state||n||fK)[t])}var Ze,lW,cW,uW,dW,pW,fW,hW,mW,gW,yW,vW,ye,wO,jp,fr,bO,_O,kO,Yn,Br,Os,Dy,Ny,Y,xW,Ac,SO,Np,tO,qO,CS,$e,Iy,TW,SW,EW,PW,CW,MW,RW,de,EO,PO,CO,gn,$W,Ws,IW,Af,zc,cS,Dc,Uy,Ly,Ma,DW,zW,BW,ZW,eq,rq,To,jy,Ff,Hy,uS,Wy,LS,qy,Up,Ky,Gy,sq,lq,pr,Yy,pF,LO,cq,AO,dS,uq,Qy,fF,hF,mF,gF,yF,vF,Xy,qp,xF,bF,Zy,Jy,oS,pq,fq,ev,pS,fS,tv,hS,mS,hq,gS,yS,mq,nv,mr,gq,yq,We,De,vq,kF,xS,wS,bq,_q,kq,Bc,rv,iv,ov,Vc,Tq,av,sv,Kp,Kt,Sq,Eq,Pq,Gp,lv,cv,uv,dv,pv,fv,hv,mv,gv,Cv,zO,bS,Yp,Mv,Ui,So,_o,Oy,yv,jc,vv,$q,Iq,Lq,Ds,Aq,Oq,Fq,Hc,Xp,Zp,Wc,Dq,Nq,Rv,Eo,sn,Vq,UO,_S,zq,Uq,Df,Bq,Po,jq,Hq,Wq,Ns,xv,wv,Bp,Jp,kS,Ia,qq,Kq,SF,qc,Gq,Yq,Qq,Kc,Xq,Zq,NS,Vs,Jq,eK,VS,zs,tK,nK,zS,Us,rK,iK,US,EF,Bs,oK,aK,BS,js,bv,TS,_v,ef,tf,sK,lK,SS,Hs,kv,nf,rf,Tv,of,af,sf,lf,cf,uf,df,pf,ff,hf,mf,gf,yf,vf,xf,wf,bf,_f,kf,Tf,Sf,Ef,Pf,Cf,Mf,Rf,$f,If,Sv,Gc,Lf,PF,ES,cK,pK,oe,BO,fK,Gn=rt(()=>{"use strict";"use client";Ze=$(K(),1);In();cW=Symbol(0);lW=cW;uW=Symbol(0),dW=Symbol(0),pW=Symbol(0),fW=Symbol(0),hW=Symbol(0),mW=Symbol(0),gW=Symbol(0),yW=Symbol(0),vW=Symbol(0),ye={_add:uW,_remove:dW,_reset:pW,_select:fW,_readonly:hW,_setReadonly:mW,_onReset:gW,_onRemove:yW,_onUserSelect:vW},jp=class extends Tc{constructor(){super(...arguments),this._items=[],this[wO]=!1}get length(){return this._items.length}get readonly(){return this[ye._readonly]}toArray(){return[...this._items]}[(wO=ye._readonly,Symbol.iterator)](){return this._items.values()}[ye._add](e,n){let r=this._items.length;""+r in this||Object.defineProperty(this,r,{get(){return this._items[r]}}),!this._items.includes(e)&&(this._items.push(e),this.dispatchEvent(new ae("add",{detail:e,trigger:n})))}[ye._remove](e,n){let r=this._items.indexOf(e);r>=0&&(this[ye._onRemove]?.(e,n),this._items.splice(r,1),this.dispatchEvent(new ae("remove",{detail:e,trigger:n})))}[ye._reset](e){for(let n of[...this._items])this[ye._remove](n,e);this._items=[],this[ye._setReadonly](!1,e),this[ye._onReset]?.()}[ye._setReadonly](e,n){this[ye._readonly]!==e&&(this[ye._readonly]=e,this.dispatchEvent(new ae("readonly-change",{detail:e,trigger:n})))}},fr={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},bO=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],_O=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],kO=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],Yn=typeof window<"u"&&typeof window.document<"u"?window.document:{},Br="fullscreenEnabled"in Yn&&Object.keys(fr)||bO[0]in Yn&&bO||_O[0]in Yn&&_O||kO[0]in Yn&&kO||[],Os={requestFullscreen:function(t){return t[Br[fr.requestFullscreen]]()},requestFullscreenFunction:function(t){return t[Br[fr.requestFullscreen]]},get exitFullscreen(){return Yn[Br[fr.exitFullscreen]].bind(Yn)},get fullscreenPseudoClass(){return":"+Br[fr.fullscreen]},addEventListener:function(t,e,n){return Yn.addEventListener(Br[fr[t]],e,n)},removeEventListener:function(t,e,n){return Yn.removeEventListener(Br[fr[t]],e,n)},get fullscreenEnabled(){return!!Yn[Br[fr.fullscreenEnabled]]},set fullscreenEnabled(t){},get fullscreenElement(){return Yn[Br[fr.fullscreenElement]]},set fullscreenElement(t){},get onfullscreenchange(){return Yn[("on"+Br[fr.fullscreenchange]).toLowerCase()]},set onfullscreenchange(t){return Yn[("on"+Br[fr.fullscreenchange]).toLowerCase()]=t},get onfullscreenerror(){return Yn[("on"+Br[fr.fullscreenerror]).toLowerCase()]},set onfullscreenerror(t){return Yn[("on"+Br[fr.fullscreenerror]).toLowerCase()]=t}},Dy=Os.fullscreenEnabled,Ny=class extends Rn{constructor(){super(...arguments),this._listening=!1,this._active=!1}get active(){return this._active}get supported(){return Dy}onConnect(){z(Os,"fullscreenchange",this._onFullscreenChange.bind(this)),z(Os,"fullscreenerror",this._onFullscreenError.bind(this)),me(this._onDisconnect.bind(this))}async _onDisconnect(){Dy&&await this.exit()}_onFullscreenChange(e){let n=iS(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||iS(this.el)?void 0:(TO(),Os.requestFullscreen(this.el))}catch(e){throw this._listening=!1,e}}async exit(){if(!(!this.el||!iS(this.el)))return TO(),Os.exitFullscreen()}};Y=typeof document>"u",xW=Y?"":navigator?.userAgent.toLowerCase()||"",Ac=!Y&&/iphone|ipad|ipod|ios|crios|fxios/i.test(xW),SO=!Y&&/(iphone|ipod)/gi.test(navigator?.platform||""),Np=!Y&&!!window.chrome,tO=!Y&&(!!window.safari||Ac);qO=class KO extends Rn{constructor(){super(...arguments),this._type=J(this._getScreenOrientation()),this._locked=J(!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 KO.supported}onConnect(){if(this.supported)z(screen.orientation,"change",this._onOrientationChange.bind(this));else{let e=window.matchMedia("(orientation: landscape)");e.onchange=this._onOrientationChange.bind(this),me(()=>e.onchange=null)}me(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:B(this._type),lock:this._currentLock},trigger:e})}async lock(e){B(this._locked)||this._currentLock===e||(this._assertScreenOrientationAPI(),await screen.orientation.lock(e),this._locked.set(!0),this._currentLock=e)}async unlock(){B(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 Y?"portrait-primary":this.supported?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"}};qO.supported=PS();CS=qO,$e=class{get length(){return this._ranges.length}constructor(e,n){bt(e)?this._ranges=e:!ot(e)&&!ot(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}};Iy={};TW=Symbol(0),SW=Symbol(0),EW=Symbol(0),PW=Symbol(0),CW=Symbol(0),MW=Symbol(0),RW=Symbol(0),de={_crossOrigin:TW,_readyState:SW,_updateActiveCues:EW,_canLoad:PW,_onModeChange:CW,_native:MW,_nativeHLS:RW};gn=class extends Tc{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[EO]=0,this[PO]=null,this[CO]=null;for(let n of Object.keys(e))this[n]=e[n];this.type||(this.type="vtt"),!Y&&e.content?Promise.resolve().then(()=>(Op(),Ap)).then(({parseText:n,VTTCue:r,VTTRegion:i})=>{!ee(e.content)||e.type==="json"?(this._parseJSON(e.content,r,i),this.readyState!==3&&this._readyState()):n(e.content,{type:e.type}).then(({cues:o,regions:a})=>{this._cues=o,this._regions=a,this._readyState()})}):e.src||(this[de._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[de._readyState]}get mode(){return this._mode}set mode(e){this.setMode(e)}addCue(e,n){let r=0,i=this._cues.length;for(r=0;r<i&&!(e.endTime<=this._cues[r].startTime);r++);r===i?this._cues.push(e):this._cues.splice(r,0,e),n?.type!=="cuechange"&&this[de._native]?.track.addCue(e),this.dispatchEvent(new ae("add-cue",{detail:e,trigger:n})),zy(e,this._currentTime)&&this[de._updateActiveCues](this._currentTime,n)}removeCue(e,n){let r=this._cues.indexOf(e);if(r>=0){let i=this._activeCues.includes(e);this._cues.splice(r,1),this[de._native]?.track.removeCue(e),this.dispatchEvent(new ae("remove-cue",{detail:e,trigger:n})),i&&this[de._updateActiveCues](this._currentTime,n)}}setMode(e,n){this._mode!==e&&(this._mode=e,e==="disabled"?(this._activeCues=[],this._activeCuesChanged()):this.readyState===2?this[de._updateActiveCues](this._currentTime,n):this._load(),this.dispatchEvent(new ae("mode-change",{detail:this,trigger:n})),this[de._onModeChange]?.())}[(EO=de._readyState,PO=de._onModeChange,CO=de._native,de._updateActiveCues)](e,n){if(this._currentTime=e,this.mode==="disabled"||!this._cues.length)return;let r=[];for(let o=0,a=this._cues.length;o<a;o++){let s=this._cues[o];zy(s,e)&&r.push(s)}let i=r.length!==this._activeCues.length;if(!i){for(let o=0;o<r.length;o++)if(!this._activeCues.includes(r[o])){i=!0;break}}this._activeCues=r,i&&this._activeCuesChanged(n)}[de._canLoad](){this._canLoad=!0,this._mode!=="disabled"&&this._load()}async _load(){if(!(!this._canLoad||!this.src||this[de._readyState]>0)){this[de._readyState]=1,this.dispatchEvent(new ae("load-start"));try{let{parseResponse:e,VTTCue:n,VTTRegion:r}=await Promise.resolve().then(()=>(Op(),Ap)),i=this[de._crossOrigin]?.(),o=(this.customFetch??fetch)(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:Vy(i)});if(this.type==="json")this._parseJSON(await(await o).json(),n,r);else{let{errors:a,metadata:s,regions:l,cues:c}=await e(o,{type:this.type,encoding:this.encoding});if(a[0]?.code===0)throw a[0];this._metadata=s,this._regions=l,this._cues=c}this._readyState()}catch(e){this._errorState(e)}}}_readyState(){if(this[de._readyState]=2,!this.src||this.type!=="vtt"){let n=this[de._native]?.track;if(n)for(let r of this._cues)n.addCue(r)}let e=new ae("load");this[de._updateActiveCues](this._currentTime,e),this.dispatchEvent(e)}_errorState(e){this[de._readyState]=3,this.dispatchEvent(new ae("error",{detail:e}))}_parseJSON(e,n,r){try{let{regions:i,cues:o}=GO(e,n,r);this._regions=i,this._cues=o}catch(i){this._errorState(i)}}_activeCuesChanged(e){this.dispatchEvent(new ae("cue-change",{trigger:e}))}},$W=/captions|subtitles/;Ws=new ui({artist:"",audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,buffered:new $e,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:PS(),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 $e,playing:!1,playsInline:!1,pictureInPicture:!1,preload:"metadata",playbackRate:1,qualities:[],quality:null,autoQuality:!1,canSetQuality:!0,canSetPlaybackRate:!0,canSetVolume:!1,seekable:new $e,seeking:!1,source:{src:"",type:""},sources:[],started:!1,textTracks:[],textTrack:null,get hasCaptions(){return this.textTracks.filter(It).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=lS(this.buffered)??0;return Math.max(0,t-this.clipStartTime)},get bufferedEnd(){let t=Hp(this.buffered)??0;return Math.min(this.duration,Math.max(0,t-this.clipStartTime))},get seekableStart(){let t=lS(this.seekable)??0;return Math.max(0,t-this.clipStartTime)},get seekableEnd(){let t=this.canPlay?Hp(this.seekable)??1/0:0;return this.clipEndTime>0?Math.max(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}),IW=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"]);Af=Ni();zc=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 ae("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,r){this._dispatchRequest("media-text-track-change-request",r,{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 r=this.getPlayer(n?.target);r&&(r.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 r=n.state.textTracks,i=n.state.textTrack;if(i){let o=r.indexOf(i);this.changeTextTrackMode(o,"disabled",e)}}toggleCaptions(e){let n=this.getPlayer(e?.target);if(!n)return;let r=n.state.textTracks,i=n.state.textTrack;if(i){let o=r.indexOf(i);this.changeTextTrackMode(o,"disabled",e),this._prevTrackIndex=o}else{let o=this._prevTrackIndex;(!r[o]||!It(r[o]))&&(o=-1),o===-1&&(o=r.findIndex(a=>It(a)&&a.default)),o===-1&&(o=r.findIndex(a=>It(a))),o>=0&&this.changeTextTrackMode(o,"showing",e),this._prevTrackIndex=-1}}_dispatchRequest(e,n,r){let i=new ae(e,{bubbles:!0,composed:!0,cancelable:!0,detail:r,trigger:n}),o=n?.target||null;o&&o instanceof le&&(o=o.el),o=!o||o===document||o===window||o===document.body||this._player?.el&&o instanceof Node&&!this._player.el.contains(o)?this._target??this.getPlayer()?.el:o??this._target,this._player?e==="media-play-request"&&!this._player.state.canLoad?o?.dispatchEvent(i):this._player.canPlayQueue._enqueue(e,()=>o?.dispatchEvent(i)):o?.dispatchEvent(i)}_noPlayerWarning(e){}},cS=Math.min,Dc=Math.max,Uy=Math.round,Ly=Math.floor,Ma=t=>({x:t,y:t});DW=async(t,e,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=o.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e)),c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=MO(c,r,l),p=r,f={},h=0;for(let g=0;g<s.length;g++){let{name:x,fn:m}=s[g],{x:y,y:v,data:w,reset:k}=await m({x:u,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:t,floating:e}});u=y??u,d=v??d,f={...f,[x]:{...f[x],...w}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(c=k.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):k.rects),{x:u,y:d}=MO(c,p,l)),g=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:f}};zW=Ma(0);BW=[":popover-open",":modal"];ZW=async function(t){let e=this.getOffsetParent||aF,n=this.getDimensions;return{reference:XW(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,...await n(t.floating)}}};eq={convertOffsetParentRelativeRectToViewportRelativeRect:jW,getDocumentElement:Co,getClippingRect:YW,getOffsetParent:aF,getElementRects:ZW,getClientRects:HW,getDimensions:QW,getScale:Nc,isElement:ko,isRTL:JW};rq=(t,e,n)=>{let r=new Map,i={platform:eq,...n},o={...i.platform,_c:r};return DW(t,e,{...i,platform:o})};To=class extends Rn{},jy=class extends To{constructor(){super(...arguments),this._idleTimer=-2,this._pausedTracking=!1,this._hideOnMouseLeave=J(!1),this._isMouseOutside=J(!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(){M(this._watchMouse.bind(this)),M(this._watchPaused.bind(this));let e=this._onPlay.bind(this),n=this._onPause.bind(this);this.listen("can-play",r=>this.show(0,r)),this.listen("play",e),this.listen("pause",n),this.listen("auto-play-fail",n)}_watchMouse(){let{started:e,pointer:n,paused:r}=this.$state;if(!e()||n()!=="fine")return;let i=this.hideOnMouseLeave;(!i||!this._isMouseOutside())&&M(()=>{r()||this.listen("pointermove",this._onStopIdle.bind(this))}),i&&(this.listen("mouseenter",this._onMouseEnter.bind(this)),this.listen("mouseleave",this._onMouseLeave.bind(this)))}_watchPaused(){let{paused:e,started:n,autoPlayError:r}=this.$state;if(e()||r()&&!n())return;let i=this._onStopIdle.bind(this);M(()=>{let o=this.$state.pointer(),a=o==="coarse",s=[a?"touchend":"pointerup","keydown"];for(let l of s)this.listen(l,i,{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||IS(e)||(yo(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,r){if(n===0){this._onChange(e,r);return}this._idleTimer=window.setTimeout(()=>{this.scope&&this._onChange(e&&!this._pausedTracking,r)},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}))}},Ff=oq;Hy=class{constructor(){this.playerId="vds-player",this.mediaId=null,this._data={volume:null,muted:null,time:null,lang:null,captions:null,rate:null,quality:null},this.saveTime=Ff(()=>{if(Y||!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()}async getVideoQuality(){return this._data.quality}async setVideoQuality(e){this._data.quality=e,this.save()}onChange(e,n,r="vds-player"){let i=r?localStorage.getItem(r):null,o=n?localStorage.getItem(n):null;this.playerId=r,this.mediaId=n,this._data={volume:null,muted:null,lang:null,captions:null,rate:null,quality:null,...i?JSON.parse(i):{},time:o?+o:null}}save(){if(Y||!this.playerId)return;let e=JSON.stringify({...this._data,time:void 0});localStorage.setItem(this.playerId,e)}},uS=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[de._native]?.remove?.(),e[de._native]=null,this._tracks.delete(e)}changeTrack(e){let n=e?.[de._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 r;if(!this._video)return;let n=e[r=de._native]??(e[r]=this._createTrackElement(e));n instanceof HTMLElement&&(this._video.append(n),n.track.mode=n.default?"showing":"hidden")}_createTrackElement(e){let n=document.createElement("track"),r=e.default||e.mode==="showing",i=e.src&&e.type==="vtt";if(n.id=e.id,i)n.src=e.src;else{let o=function(){URL.revokeObjectURL(this.src),this.removeEventListener("load",o),this.removeEventListener("error",o)},a=new Blob([`WEBVTT
|
|
`],{type:"text/vtt"});n.src=URL.createObjectURL(a),n.addEventListener("load",o),n.addEventListener("error",o)}return n.label=e.label,n.kind=e.kind,n.default=r,e.language&&(n.srclang=e.language),r&&!i&&this._copyCues(e,n.track),n}_copyCues(e,n){if(!(e.src&&e.type==="vtt"||n.cues?.length))for(let r of e.cues)n.addCue(r)}_onChange(e){for(let n of this._tracks){let r=n[de._native]?.track;if(!r)continue;if(!this._display){r.mode="disabled";continue}let i=r.mode==="showing";i&&this._copyCues(n,r),n.setMode(i?"showing":"disabled",e)}}},Wy=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,M(this._watchControls.bind(this)),me(this._detach.bind(this)),z(n,"add",this._onAddTrack.bind(this)),z(n,"remove",this._onRemoveTrack.bind(this)),z(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 uS,this._nativeRenderer.attach(e);for(let n of this._textTracks)this._addNativeTrack(n)}this._update()})}_addNativeTrack(e){It(e)&&this._nativeRenderer?.addTrack(e)}_removeNativeTrack(e){It(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?.[de._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((r,i)=>r.priority-i.priority).find(r=>r.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}},LS=aq;qy=class extends jp{constructor(){super(),this._canLoad=!1,this._defaults={},this._storage=null,this._preferredLang=null,this._selectTracks=LS(async()=>{if(!this._canLoad)return;!this._preferredLang&&this._storage&&(this._preferredLang=await this._storage.getLang());let e=await this._storage?.getCaptions(),n=[["captions","subtitles"],"chapters","descriptions","metadata"];for(let r of n){let i=this.getByKind(r);if(i.find(c=>c.mode==="showing"))continue;let o=this._preferredLang?i.find(c=>c.language===this._preferredLang):null,a=bt(r)?this._defaults[r.find(c=>this._defaults[c])||""]:this._defaults[r],s=o??a,l=s&&It(s);s&&(!l||e!==!1)&&(s.mode="showing",l&&this._saveCaptionsTrack(s))}},300),this._onTrackModeChangeBind=this._onTrackModeChange.bind(this)}get selected(){return this._items.find(n=>n.mode==="showing"&&It(n))??null}get preferredLang(){return this._preferredLang}set preferredLang(e){this._preferredLang=e,this._saveLang(e)}add(e,n){let r=e instanceof gn,i=r?e:new gn(e),o=e.kind==="captions"||e.kind==="subtitles"?"captions":e.kind;return this._defaults[o]&&e.default&&delete e.default,i.addEventListener("mode-change",this._onTrackModeChangeBind),this[ye._add](i,n),i[de._crossOrigin]=this[de._crossOrigin],this._canLoad&&i[de._canLoad](),e.default&&(this._defaults[o]=i),this._selectTracks(),this}remove(e,n){if(this._items.includes(e))return e===this._defaults[e.kind]&&delete this._defaults[e.kind],e.mode="disabled",e[de._onModeChange]=null,e.removeEventListener("mode-change",this._onTrackModeChangeBind),this[ye._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(r=>n.includes(r.kind))}[de._canLoad](){if(!this._canLoad){for(let e of this._items)e[de._canLoad]();this._canLoad=!0,this._selectTracks()}}_onTrackModeChange(e){let n=e.detail;if(this._storage&&It(n)&&n.mode!=="disabled"&&this._saveCaptionsTrack(n),n.mode==="showing"){let r=It(n)?["captions","subtitles"]:[n.kind];for(let i of this._items)i.mode==="showing"&&i!=n&&r.includes(i.kind)&&(i.mode="disabled")}this.dispatchEvent(new ae("mode-change",{detail:e.detail,trigger:e}))}_saveCaptionsTrack(e){this._saveLang(e.language),this._storage?.setCaptions?.(e.mode==="showing")}_saveLang(e){this._storage?.setLang?.(this._preferredLang=e)}setStorage(e){this._storage=e}},Up=Symbol(0),Ky=class extends jp{get selected(){return this._items.find(e=>e.selected)??null}get selectedIndex(){return this._items.findIndex(e=>e.selected)}[ye._onRemove](e,n){this[ye._select](e,!1,n)}[ye._add](e,n){e[Up]=!1,Object.defineProperty(e,"selected",{get(){return this[Up]},set:r=>{this.readonly||(this[ye._onUserSelect]?.(),this[ye._select](e,r))}}),super[ye._add](e,n)}[ye._select](e,n,r){if(n===e?.[Up])return;let i=this.selected;e&&(e[Up]=n),(n?i!==e:i===e)&&(i&&(i[Up]=!1),this.dispatchEvent(new ae("change",{detail:{prev:i,current:this.selected},trigger:r})))}},Gy=class extends Ky{getById(e){return e===""?null:this._items.find(n=>n.id===e)??null}},sq=Symbol(0),lq=Symbol(0),pr={_setAuto:sq,_enableAuto:lq},Yy=class extends Ky{constructor(){super(...arguments),this._auto=!1,this.switch="current"}get auto(){return this._auto||this.readonly}[ye._onUserSelect](){this[pr._setAuto](!1)}[ye._onReset](e){this[pr._setAuto](!1,e)}autoSelect(e){this.readonly||this._auto||!this[pr._enableAuto]||(this[pr._enableAuto]?.(),this[pr._setAuto](!0,e))}[pr._setAuto](e,n){this._auto!==e&&(this._auto=e,this.dispatchEvent(new ae("auto-change",{detail:e,trigger:n})))}};pF={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:"<"},LO=new Set(["Shift","Alt","Meta","Control"]),cq='button, [role="button"]',AO='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]',dS=class extends To{constructor(e){super(),this._media=e,this._timeSlider=null}onConnect(){M(this._onTargetChange.bind(this))}_onTargetChange(){let{keyDisabled:e,keyTarget:n}=this.$props;if(e())return;let r=n()==="player"?this.el:document,i=J(!1);r===this.el?(this.listen("focusin",()=>i.set(!0)),this.listen("focusout",o=>{this.el.contains(o.target)||i.set(!1)})):(B(i)||i.set(document.querySelector("[data-media-player]")===this.el),z(document,"focusin",o=>{let a=o.composedPath().find(s=>s instanceof Element&&s.localName==="media-player");a!==void 0&&i.set(this.el===a)})),M(()=>{i()&&(z(r,"keyup",this._onKeyUp.bind(this)),z(r,"keydown",this._onKeyDown.bind(this)),z(r,"keydown",this._onPreventVideoKeys.bind(this),{capture:!0}))})}_onKeyUp(e){let n=document.activeElement;if(!e.key||!this.$state.canSeek()||n?.matches(AO))return;let{method:r,value:i}=this._getMatchingMethod(e);if(!ee(i)&&!bt(i)){i?.onKeyUp?.({event:e,player:this._media.player,remote:this._media.remote}),i?.callback?.(e,this._media.remote);return}r?.startsWith("seek")&&(e.preventDefault(),e.stopPropagation(),this._timeSlider?(this._forwardTimeKeyboardEvent(e,r==="seekForward"),this._timeSlider=null):(this._media.remote.seek(this._seekTotal,e),this._seekTotal=void 0)),r?.startsWith("volume")&&this.el.querySelector("[data-media-volume-slider]")?.dispatchEvent(new KeyboardEvent("keyup",{key:r==="volumeUp"?"Up":"Down",shiftKey:e.shiftKey,trigger:e}))}_onKeyDown(e){if(!e.key||LO.has(e.key))return;let n=document.activeElement;if(n?.matches(AO)||Tp(e)&&n?.matches(cq))return;let{method:r,value:i}=this._getMatchingMethod(e),o=!e.metaKey&&/^[0-9]$/.test(e.key);if(!ee(i)&&!bt(i)&&!o){i?.onKeyDown?.({event:e,player:this._media.player,remote:this._media.remote}),i?.callback?.(e,this._media.remote);return}if(!r&&o){e.preventDefault(),e.stopPropagation(),this._media.remote.seek(this.$state.duration()/10*Number(e.key),e);return}if(r){switch(e.preventDefault(),e.stopPropagation(),r){case"seekForward":case"seekBackward":this._seeking(e,r,r==="seekForward");break;case"volumeUp":case"volumeDown":let a=this.el.querySelector("[data-media-volume-slider]");if(a)a.dispatchEvent(new KeyboardEvent("keydown",{key:r==="volumeUp"?"Up":"Down",shiftKey:e.shiftKey,trigger:e}));else{let l=e.shiftKey?.1:.05;this._media.remote.changeVolume(this.$state.volume()+(r==="volumeUp"?+l:-l),e)}break;case"toggleFullscreen":this._media.remote.toggleFullscreen("prefer-media",e);break;case"speedUp":case"slowDown":let s=this.$state.playbackRate();this._media.remote.changePlaybackRate(Math.max(.25,Math.min(2,s+(r==="speedUp"?.25:-.25))),e);break;default:this._media.remote[r]?.(e)}this.$state.lastKeyboardAction.set({action:r,event:e})}}_onPreventVideoKeys(e){dF(e.target)&&this._getMatchingMethod(e).method&&e.preventDefault()}_getMatchingMethod(e){let n={...this.$props.keyShortcuts(),...this._media.ariaKeys},r=Object.keys(n).find(i=>{let o=n[i],a=bt(o)?o.join(" "):ee(o)?o:o?.keys;return(bt(a)?a:a?.split(" "))?.some(s=>dq(s).replace(/Control/g,"Ctrl").split("+").every(l=>LO.has(l)?e[l.toLowerCase()+"Key"]:e.key===l.replace("Space"," ")))});return{method:r,value:r?n[r]:null}}_calcSeekAmount(e,n){let r=e.shiftKey?10:5;return this._seekTotal=Math.max(0,Math.min((this._seekTotal??this.$state.currentTime())+(n==="seekForward"?+r:-r),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,r){this.$state.canSeek()&&(this._timeSlider||(this._timeSlider=this.el.querySelector("[data-media-time-slider]")),this._timeSlider?this._forwardTimeKeyboardEvent(e,r):this._media.remote.seeking(this._calcSeekAmount(e,n),e))}},uq=["!","@","#","$","%","^","&","*","(",")"];Qy=class extends Rn{constructor(e){super(),this._shortcut=e}onAttach(e){let{$props:n,ariaKeys:r}=Le(),i=e.getAttribute("aria-keyshortcuts");if(i){r[this._shortcut]=i,Y||me(()=>{delete r[this._shortcut]});return}let o=n.keyShortcuts()[this._shortcut];if(o){let a=bt(o)?o.join(" "):ee(o)?o:o?.keys;e.setAttribute("aria-keyshortcuts",bt(a)?a.join(" "):a)}}},fF=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,hF=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp4","audio/webm","audio/flac"]),mF=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,gF=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),yF=/\.(m3u8)($|\?)/i,vF=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]);Xy=class{constructor(){this.name="audio"}canPlay(e){return AS(e)?Y||!ee(e.src)||e.type==="?"||wW(this.target,e.type):!1}mediaType(){return"audio"}async load(e){if(Y)throw Error("[vidstack] can not load audio provider server-side");return new(await Promise.resolve().then(()=>(rO(),nO))).AudioProvider(this.target,e)}},qp=class{constructor(){this.name="video"}canPlay(e){return OS(e)?Y||!ee(e.src)||e.type==="?"||bW(this.target,e.type):!1}mediaType(){return"video"}async load(e){if(Y)throw Error("[vidstack] can not load video provider server-side");return new(await Promise.resolve().then(()=>(NT(),iO))).VideoProvider(this.target,e)}},xF=class wF extends qp{constructor(){super(...arguments),this.name="hls"}canPlay(e){return wF.supported&&$s(e)}async load(e){if(Y)throw Error("[vidstack] can not load hls provider server-side");return new(await Promise.resolve().then(()=>(aO(),oO))).HLSProvider(this.target,e)}};xF.supported=Sy();bF=xF,Zy=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)pi(n)}canPlay(e){return ee(e.src)&&e.type==="video/vimeo"}mediaType(){return"video"}async load(e){if(Y)throw Error("[vidstack] can not load vimeo provider server-side");return new(await Promise.resolve().then(()=>(uO(),cO))).VimeoProvider(this.target,e)}async loadPoster(e,n,r){let{resolveVimeoVideoId:i,getVimeoVideoInfo:o}=await Promise.resolve().then(()=>(WT(),lO));if(!ee(e.src))return null;let{videoId:a}=i(e.src);return a?o(a,r).then(s=>s?s.poster:null):null}},Jy=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)pi(n)}canPlay(e){return ee(e.src)&&e.type==="video/youtube"}mediaType(){return"video"}async load(e){if(Y)throw Error("[vidstack] can not load youtube provider server-side");return new(await Promise.resolve().then(()=>(fO(),pO))).YouTubeProvider(this.target,e)}async loadPoster(e,n,r){let{findYouTubePoster:i,resolveYouTubeVideoId:o}=await Promise.resolve().then(()=>(YT(),dO)),a=ee(e.src)&&o(e.src);return a?i(a,r):null}},oS=Symbol(0),pq=["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"],fq={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:pF,storage:null},ev=class extends To{constructor(e,n){super(),this._type=e,this._callback=n}async onAttach(e){if(Y)return;let n=this.$props[this._type]();if(n==="eager")requestAnimationFrame(this._callback);else if(n==="idle")uT(this._callback);else if(n==="visible"){let r,i=new IntersectionObserver(o=>{this.scope&&o[0].isIntersecting&&(r?.(),r=void 0,this._callback())});i.observe(e),r=me(()=>i.disconnect())}}},pS=class{constructor(e,n){this._handle=e,this._media=n,this._notify=(r,...i)=>{Y||this._handle(new ae(r,{detail:i?.[0],trigger:i?.[1]}))}}async _ready(e,n){if(!Y)return Ec(async()=>{this._media;let{autoPlay:r,canPlay:i,started:o,duration:a,seekable:s,buffered:l,remotePlaybackInfo:c,playsInline:u}=this._media.$state;if(i())return;let d={duration:e?.duration??a(),seekable:e?.seekable??s(),buffered:e?.buffered??l(),provider:this._media.$provider()};this._notify("can-play",d,n),di();let p=this._media.$provider(),{storage:f,qualities:h}=this._media,{muted:g,volume:x,clipStartTime:m,playbackRate:y}=this._media.$props,v=c()?.savedState?.currentTime,w=c()?.savedState?.paused===!1,k=v??await f?.getTime()??m(),b=w||r();p&&(p.setVolume(await f?.getVolume()??x()),p.setMuted(await f?.getMuted()??g()),p.setPlaybackRate?.(await f?.getPlaybackRate()??y()),p.setPlaysInline?.(u()),k>0&&p.setCurrentTime(k));let S=await f?.getVideoQuality();if(S&&h.length){let C=null,R=1/0;for(let _ of h){let D=Math.abs(S.width-_.width)+Math.abs(S.height-_.height)+(S.bitrate?Math.abs(S.bitrate-_.bitrate):0);D<R&&(C=_,R=D)}C&&(C.selected=!0)}i()&&b&&!o()&&await this._attemptAutoplay(n),c.set(null)})}async _attemptAutoplay(e){let{player:n,$state:{autoPlaying:r,muted:i}}=this._media;r.set(!0);let o=new ae("auto-play-attempt",{trigger:e});try{await n.play(o)}catch{}}},fS=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()}},tv=class{constructor(){this._serving=!1,this._pending=vo(),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=vo()}};hS=class extends To{constructor(e,n,r){super(),this._stateMgr=e,this._request=n,this._media=r,this._providerQueue=new tv,this._wasPIPActive=!1,this._$provider=r.$provider,this._controls=new jy,this._fullscreen=new Ny,this._orientation=new CS}onAttach(){this.listen("fullscreen-change",this._onFullscreenChange.bind(this))}onConnect(){let e=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=this._handleRequest.bind(this);for(let r of e)r.startsWith("media-")&&this.listen(r,n);this._attachLoadPlayListener(),M(this._watchProvider.bind(this)),M(this._onControlsDelayChange.bind(this)),M(this._onAirPlaySupportChange.bind(this)),M(this._onGoogleCastSupportChange.bind(this)),M(this._onFullscreenSupportChange.bind(this)),M(this._onPiPSupportChange.bind(this))}onDestroy(){this._providerQueue._reset()}_attachLoadPlayListener(){let{load:e}=this.$props,{canLoad:n}=this.$state;if(e()!=="play"||n())return;let r=this.listen("media-play-request",i=>{this._handleLoadPlayStrategy(i),r()})}_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]&&(B(this._$provider)?this[e.type](e):this._providerQueue._enqueue(e.type,()=>{B(this._$provider)&&this[e.type](e)}))}async _play(e){if(Y)return;let{canPlay:n,paused:r,autoPlaying:i}=this.$state;if(!this._handleLoadPlayStrategy(e)&&B(r)){e&&this._request._queue._enqueue("media-play-request",e);try{let o=B(this._$provider);return aS(o,B(n)),await o.play()}catch(o){let a=this.createEvent("play-fail",{detail:Is(o),trigger:e});throw a.autoPlay=i(),this._stateMgr._handle(a),o}}}_handleLoadPlayStrategy(e){let{load:n}=this.$props,{canLoad:r}=this.$state;if(n()==="play"&&!r()){let i=this.createEvent("media-start-loading",{trigger:e});return this.dispatchEvent(i),this._providerQueue._enqueue("media-play-request",async()=>{try{await this._play(i)}catch{}}),!0}return!1}async _pause(e){if(Y)return;let{canPlay:n,paused:r}=this.$state;if(!B(r)){e&&this._request._queue._enqueue("media-pause-request",e);try{let i=B(this._$provider);return aS(i,B(n)),await i.pause()}catch(i){throw this._request._queue._delete("media-pause-request"),i}}}_seekToLiveEdge(e){if(Y)return;let{canPlay:n,live:r,liveEdge:i,canSeek:o,liveSyncPosition:a,seekableEnd:s,userBehindLiveEdge:l}=this.$state;if(l.set(!1),B(()=>!r()||i()||!o()))return;let c=B(this._$provider);aS(c,B(n)),e&&this._request._queue._enqueue("media-seek-request",e);let u=s()-2;c.setCurrentTime(Math.min(u,a()??u))}async _enterFullscreen(e="prefer-media",n){if(Y)return;let r=this._getFullscreenAdapter(e);if(OO(e,r),!r.active)return B(this.$state.pictureInPicture)&&(this._wasPIPActive=!0,await this._exitPictureInPicture(n)),n&&this._request._queue._enqueue("media-enter-fullscreen-request",n),r.enter()}async _exitFullscreen(e="prefer-media",n){if(Y)return;let r=this._getFullscreenAdapter(e);if(OO(e,r),!!r.active){n&&this._request._queue._enqueue("media-exit-fullscreen-request",n);try{let i=await r.exit();return this._wasPIPActive&&B(this.$state.canPictureInPicture)&&await this._enterPictureInPicture(),i}finally{this._wasPIPActive=!1}}}_getFullscreenAdapter(e){let n=B(this._$provider);return e==="prefer-media"&&this._fullscreen.supported||e==="media"?this._fullscreen:n?.fullscreen}async _enterPictureInPicture(e){if(!Y&&(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(!Y&&(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,r=Np&&!Ac&&$y(n());e.set(r)}_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(!B(n))throw new Error("Cast not available.");if(pi("https://www.gstatic.com"),!this._googleCastLoader){let i=await Promise.resolve().then(()=>(nS(),vO)).then(function(o){return o.d});this._googleCastLoader=new i.GoogleCastLoader}await this._googleCastLoader.prompt(this._media),e&&this._request._queue._enqueue("media-google-cast-request",e);let r=B(this.$state.remotePlaybackState)!=="disconnected";r&&this.$state.remotePlaybackInfo.set(i=>({...i,savedState:{paused:B(this.$state.paused),currentTime:B(this.$state.currentTime)}})),this.$state.remotePlaybackLoader.set(r?this._googleCastLoader:null)}catch(n){throw this._request._queue._delete("media-google-cast-request"),n}}"media-audio-track-change-request"(e){let{logger:n,audioTracks:r}=this._media;if(r.readonly)return;let i=e.detail,o=r[i];if(o){let a=e.type;this._request._queue._enqueue(a,e),o.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=B(this.$props.fullscreenOrientation),r=e.detail;if(!(ot(n)||!this._orientation.supported))if(r){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:Is(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:Is(e)}))}"media-live-edge-request"(e){let{live:n,liveEdge:r,canSeek:i}=this.$state;if(!(!n()||r()||!i())){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:r}=this.$state;if(n()===e.detail||!r())return;let i=this._$provider();i?.setPlaybackRate&&(this._request._queue._enqueue("media-rate-change-request",e),i.setPlaybackRate(e.detail))}"media-quality-change-request"(e){let{qualities:n,storage:r,logger:i}=this._media;if(n.readonly)return;this._request._queue._enqueue("media-quality-change-request",e);let o=e.detail;if(o<0)n.autoSelect(e),e.isOriginTrusted&&r?.setVideoQuality?.(null);else{let a=n[o];a&&(a.selected=!0,e.isOriginTrusted&&r?.setVideoQuality?.({id:a.id,width:a.width,height:a.height,bitrate:a.bitrate}))}}"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:r,ended:i,canSeek:o,live:a,userBehindLiveEdge:s,clipStartTime:l}=this.$state;i()&&(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()),r()-.1);!Number.isFinite(u)||!o()||(this._request._queue._enqueue(c,e),this._$provider().setCurrentTime(u),a()&&e.isOriginTrusted&&Math.abs(r()-u)>=2&&s.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:r}=e.detail,i=this._media.textTracks[n];if(i){let o=e.type;this._request._queue._enqueue(o,e),i.setMode(r,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:r}=this.$state;if(!n())return;let i=e.type;this._request._queue._enqueue(i,e),this._media.$provider().setMuted(!1),r()===0&&(this._request._queue._enqueue(i,e),this._$provider().setVolume(.25))}"media-volume-change-request"(e){let{muted:n,volume:r}=this.$state,i=e.detail;if(r()===i)return;let o=e.type;this._request._queue._enqueue(o,e),this._$provider().setVolume(i),i>0&&n()&&(this._request._queue._enqueue(o,e),this._$provider().setMuted(!1))}_logError(e,n,r){}};mS=class{constructor(){this._seeking=!1,this._looping=!1,this._replaying=!1,this._queue=new fS}},hq=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"]),gS=class extends To{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=Ff(r=>{let{seeking:i,realCurrentTime:o,paused:a}=this.$state;i.set(!0),o.set(r.detail),this._satisfyRequest("media-seeking-request",r),a()&&(this._waitingTrigger=r,this._fireWaiting())},150,{leading:!0}),this._fireWaiting=LS(()=>{if(!this._waitingTrigger)return;this._firingWaiting=!0;let{waiting:r,playing:i}=this.$state;r.set(!0),i.set(!1);let o=this.createEvent("waiting",{trigger:this._waitingTrigger});this._trackedEvents.set("waiting",o),this.dispatch(o),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){M(this._watchCanSetVolume.bind(this)),this._addTextTrackListeners(),this._addQualityListeners(),this._addAudioTrackListeners(),this._resumePlaybackOnConnect(),me(this._pausePlaybackOnDisconnect.bind(this))}_handle(e){if(!this.scope)return;let n=e.type;this[e.type]?.(e),Y||(hq.has(n)&&this._trackedEvents.set(n,e),this.dispatch(e))}_resumePlaybackOnConnect(){this._isPlayingOnDisconnect&&(requestAnimationFrame(()=>{this.scope&&this._media.remote.play(new ae("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 r=this._request._queue._serve(e);r&&(n.request=r,n.triggers.add(r))}_addTextTrackListeners(){this._onTextTracksChange(),this._onTextTrackModeChange();let e=this._media.textTracks;z(e,"add",this._onTextTracksChange.bind(this)),z(e,"remove",this._onTextTracksChange.bind(this)),z(e,"mode-change",this._onTextTrackModeChange.bind(this))}_addQualityListeners(){let e=this._media.qualities;z(e,"add",this._onQualitiesChange.bind(this)),z(e,"remove",this._onQualitiesChange.bind(this)),z(e,"change",this._onQualityChange.bind(this)),z(e,"auto-change",this._onAutoQualityChange.bind(this)),z(e,"readonly-change",this._onCanSetQualityChange.bind(this))}_addAudioTrackListeners(){let e=this._media.audioTracks;z(e,"add",this._onAudioTracksChange.bind(this)),z(e,"remove",this._onAudioTracksChange.bind(this)),z(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:r}=this.$state;r()!==n&&(r.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}WO().then(e.set)}"provider-change"(e){let n=this._media.$provider(),r=e.detail;n?.type!==r?.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[de._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 r=this.$state.viewType();this.$state.mediaType.set(e.detail);let i=this.$state.providedViewType(),o=i==="unknown"?e.detail:i;r!==o&&(Y?this.$state.inferredViewType.set(o):setTimeout(()=>{requestAnimationFrame(()=>{this.scope&&(this.$state.inferredViewType.set(e.detail),this.dispatch("view-type-change",{detail:o,trigger:e}))})},0))}"stream-type-change"(e){let n=this._trackedEvents.get("source-change");n&&e.triggers.add(n);let{streamType:r,inferredStreamType:i}=this.$state;i.set(e.detail),e.detail=r()}"rate-change"(e){let{storage:n}=this._media,{canPlay:r}=this.$state;this.$state.playbackRate.set(e.detail),this._satisfyRequest("media-rate-change-request",e),r()&&n?.setPlaybackRate?.(e.detail)}"remote-playback-change"(e){let{remotePlaybackState:n,remotePlaybackType:r}=this.$state,{type:i,state:o}=e.detail,a=o==="connected";r.set(i),n.set(o);let s=i==="airplay"?"media-airplay-request":"media-google-cast-request";if(a)this._satisfyRequest(s,e);else{let l=this._request._queue._peek(s);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[ye._reset](e),this._media.qualities[ye._reset](e),this._resetTracking(),YO(this._media.$state)}abort(e){let n=this._trackedEvents.get("source-change");n&&e.triggers.add(n);let r=this._trackedEvents.get("can-load");r&&!e.triggers.hasType("can-load")&&e.triggers.add(r)}"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,buffered:r,intrinsicDuration:i,canPlay:o}=this.$state;o.set(!0),r.set(e.buffered),n.set(e.seekable);let a=Hp(e.seekable)??1/0;i.set(a)}"duration-change"(e){let{live:n,intrinsicDuration:r}=this.$state,i=e.detail;n()||r.set(Number.isNaN(i)?0:i)}progress(e){let{buffered:n,seekable:r,live:i,intrinsicDuration:o}=this.$state,a=e.detail;if(n.set(a.buffered),r.set(a.seekable),i()){let s=Hp(a.seekable)??1/0;o.set(s),this.dispatch("duration-change",{detail:s,trigger:e})}}play(e){let{paused:n,autoPlayError:r,ended:i,autoPlaying:o,playsInline:a,pointer:s,muted:l,viewType:c,live:u,userBehindLiveEdge:d}=this.$state;if(this._resetPlaybackIfNeeded(),!n()){e.stopImmediatePropagation();return}e.autoPlay=o();let p=this._trackedEvents.get("waiting");p&&e.triggers.add(p),this._satisfyRequest("media-play-request",e),this._trackedEvents.set("play",e),n.set(!1),r.set(null),e.autoPlay&&(this._handle(this.createEvent("auto-play",{detail:{muted:l()},trigger:e})),o.set(!1)),(i()||this._request._replaying)&&(this._request._replaying=!1,i.set(!1),this._handle(this.createEvent("replay",{trigger:e}))),!a()&&c()==="video"&&s()==="coarse"&&this._media.remote.enterFullscreen("prefer-media",e),u()&&!d()&&this._media.remote.seekToLiveEdge(e)}_resetPlaybackIfNeeded(e){if(!B(this._media.$provider))return;let{ended:r,seekableStart:i,clipStartTime:o,clipEndTime:a,realCurrentTime:s,duration:l}=this.$state,c=s()<o()||a()>0&&s()>=a()||Math.abs(s()-l())<.1||r();return c&&this.dispatch("media-seek-request",{detail:(o()>0?0:i())+.1,trigger:e}),c}"play-fail"(e){let{muted:n,autoPlaying:r}=this.$state,i=this._trackedEvents.get("play");i&&e.triggers.add(i),this._satisfyRequest("media-play-request",e);let{paused:o,playing:a}=this.$state;o.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})),r.set(!1))}playing(e){let n=this._trackedEvents.get("play"),r=this._trackedEvents.get("seeked");n?e.triggers.add(n):r&&e.triggers.add(r),setTimeout(()=>this._resetTracking(),0);let{paused:i,playing:o,live:a,liveSyncPosition:s,seekableEnd:l,started:c,currentTime:u,seeking:d,ended:p}=this.$state;if(i.set(!1),o.set(!0),d.set(!1),p.set(!1),this._request._looping){this._request._looping=!1;return}if(a()&&!c()&&u()===0){let f=s()??l()-2;Number.isFinite(f)&&this._media.$provider().setCurrentTime(f)}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");n&&e.triggers.add(n);let{paused:r,playing:i}=this.$state;r.set(!0),i.set(!1),this._clipEnded&&setTimeout(()=>{this._handle(this.createEvent("end",{trigger:e})),this._clipEnded=!1},0),this._resetTracking()}"time-update"(e){if(this._request._looping){e.stopImmediatePropagation();return}let{realCurrentTime:n,played:r,waiting:i,clipEndTime:o}=this.$state,a=o(),s=e.detail;n.set(s.currentTime),r.set(s.played),i.set(!1);for(let l of this._media.textTracks)l[de._updateActiveCues](s.currentTime,e);a>0&&s.currentTime>=a&&(this._clipEnded=!0,this.dispatch("media-pause-request",{trigger:e})),this._saveTime()}_saveTime(){let{storage:e}=this._media,{canPlay:n,realCurrentTime:r}=this.$state;n()&&e?.setTime?.(r())}"volume-change"(e){let{storage:n}=this._media,{volume:r,muted:i,canPlay:o}=this.$state,a=e.detail;r.set(a.volume),i.set(a.muted||a.volume===0),this._satisfyRequest("media-volume-change-request",e),this._satisfyRequest(a.muted?"media-mute-request":"media-unmute-request",e),o()&&(n?.setVolume?.(r()),n?.setMuted?.(i()))}seeked(e){let{seeking:n,currentTime:r,realCurrentTime:i,paused:o,duration:a,ended:s}=this.$state;if(this._request._seeking)n.set(!0),e.stopImmediatePropagation();else if(n()){let l=this._trackedEvents.get("waiting");l&&e.triggers.add(l);let c=this._trackedEvents.get("seeking");c&&!e.triggers.has(c)&&e.triggers.add(c),o()&&this._stopWaiting(),n.set(!1),e.detail!==a()&&s.set(!1),i.set(e.detail),this._satisfyRequest("media-seek-request",e);let u=e?.originEvent;u?.isTrusted&&!/seek/.test(u.type)&&this.started(e)}Math.abs(a()-r())>=.1&&s.set(!1)}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:r,ended:i,duration:o}=this.$state;n()||this.dispatch("pause",{trigger:e}),r()&&this.dispatch("seeked",{detail:o(),trigger:e}),i.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))}},yS=class extends To{onSetup(){this._init(),!Y&&(M(this._watchArtist.bind(this)),M(this._watchAutoplay.bind(this)),M(this._watchClipTimes.bind(this)),M(this._watchControls.bind(this)),M(this._watchCrossOrigin.bind(this)),M(this._watchDuration.bind(this)),M(this._watchLive.bind(this)),M(this._watchLiveEdge.bind(this)),M(this._watchLiveTolerance.bind(this)),M(this._watchLoop.bind(this)),M(this._watchPlaysInline.bind(this)),M(this._watchPoster.bind(this)),M(this._watchProvidedTypes.bind(this)),M(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 r of Object.keys(this.$props))n.has(r)||this.$state[e[r]??r]?.set(this.$props[r]());this.$state.muted.set(this.$props.muted()||this.$props.volume()===0)}_watchProvidedTypes(){let{viewType:e,streamType:n,title:r,poster:i}=this.$props;this.$state.providedPoster.set(i()),this.$state.providedStreamType.set(n()),this.$state.providedViewType.set(e()),this.$state.providedTitle.set(r())}_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()})}},mq=class vS extends To{constructor(){super()}onConnect(){M(this._onMetadataChange.bind(this)),M(this._onPlaybackStateChange.bind(this));let e=this._handleAction.bind(this);for(let n of vS._actions)navigator.mediaSession.setActionHandler(n,e);me(this._onDisconnect.bind(this))}_onDisconnect(){for(let e of vS._actions)navigator.mediaSession.setActionHandler(e,null)}_onMetadataChange(){let{title:e,artist:n,poster:r}=this.$state;navigator.mediaSession.metadata=new MediaMetadata({title:e(),artist:n(),artwork:[{src:r()}]})}_onPlaybackStateChange(){let{canPlay:e,paused:n}=this.$state;navigator.mediaSession.playbackState=e()?n()?"paused":"playing":"none"}_handleAction(e){let n=new ae("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:$t(e.seekTime)?e.seekTime:this.$state.currentTime()+(e.seekOffset??10),trigger:n});break}}};mq._actions=["play","pause","seekforward","seekbackward","seekto"];nv=J(!1);Y||(z(document,"pointerdown",()=>{nv.set(!1)}),z(document,"keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||nv.set(!0)}));mr=class extends Rn{constructor(){super(...arguments),this._focused=J(!1)}onConnect(e){M(()=>{if(!nv()){this._focused.set(!1),Ay(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),Ay(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),Ay(this.el,!0)}_onBlur(){this._focused.set(!1),Ay(this.el,!1)}_onPointerEnter(){FO(this.el,!0)}_onPointerLeave(){FO(this.el,!1)}};gq=Object.defineProperty,yq=Object.getOwnPropertyDescriptor,We=(t,e,n,r)=>{for(var i=r>1?void 0:r?yq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&gq(e,n,i),i},De=class Fy extends le{constructor(){super(),this.canPlayQueue=new tv,this._skipTitleUpdate=!1,new yS;let e={player:this,qualities:new Yy,audioTracks:new Gy,storage:null,$provider:J(null),$providerSetup:J(!1),$props:this.$props,$state:this.$state};e.remote=new zc(void 0),e.remote.setPlayer(this),e.$iosControls=Fi(this._isIOSControls.bind(this)),e.textTracks=new qy,e.textTracks[de._crossOrigin]=this.$state.crossOrigin,e.textRenderers=new Wy(e),e.ariaKeys={},this._media=e,$n(Af,e),this.orientation=new CS,new mr,new dS(e);let n=new mS;this._stateMgr=new gS(n,e),this._requestMgr=new hS(this._stateMgr,n,e),e.delegate=new pS(this._stateMgr._handle.bind(this._stateMgr),e),new ev("load",this.startLoading.bind(this)),new ev("posterLoad",this.startLoadingPoster.bind(this))}get _provider(){return this._media.$provider()}get _$$props(){return this.$props}onSetup(){this._setupMediaAttributes(),M(this._watchCanPlay.bind(this)),M(this._watchMuted.bind(this)),M(this._watchPaused.bind(this)),M(this._watchVolume.bind(this)),M(this._watchCurrentTime.bind(this)),M(this._watchPlaysInline.bind(this)),M(this._watchPlaybackRate.bind(this))}onAttach(e){e.setAttribute("data-media-player",""),He(e,"tabindex","0"),He(e,"role","region"),M(this._watchStorage.bind(this)),Y?this._watchTitle():M(this._watchTitle.bind(this)),Y?this._watchOrientation():M(this._watchOrientation.bind(this)),z(e,"find-media-player",this._onFindPlayer.bind(this))}onConnect(e){SO&&he(e,"data-iphone","");let n=window.matchMedia("(pointer: coarse)");this._onPointerChange(n),n.onchange=this._onPointerChange.bind(this);let r=new ResizeObserver(Sa(this._onResize.bind(this)));r.observe(e),M(this._onResize.bind(this)),this.dispatch("media-player-connect",{detail:this,bubbles:!0,composed:!0}),me(()=>{r.disconnect(),n.onchange=null})}onDestroy(){this._media.player=null,this.canPlayQueue._reset()}_watchTitle(){let e=this.$el,{title:n,live:r,viewType:i,providedTitle:o}=this.$state,a=r(),s=Sp(i()),l=s!=="Unknown"?`${a?"Live ":""}${s}`:a?"Live":"Media",c=n();he(this.el,"aria-label",c?`${l} - ${c}`:l+" Player"),!Y&&e?.hasAttribute("title")&&(this._skipTitleUpdate=!0,e?.removeAttribute("title"))}_watchOrientation(){let e=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(e),he(this.el,"data-orientation",e),this._onResize()}_watchCanPlay(){this.$state.canPlay()&&this._provider?this.canPlayQueue._start():this.canPlayQueue._stop()}_setupMediaAttributes(){if(Fy[oS]){this.setAttributes(Fy[oS]);return}let e={"data-load":function(){return this.$props.load()},"data-captions":function(){let r=this.$state.textTrack();return!!r&&It(r)},"data-ios-controls":function(){return this._media.$iosControls()},"data-controls":function(){return this.controls.showing},"data-buffering":function(){let{canLoad:r,canPlay:i,waiting:o}=this.$state;return r()&&(!i()||o())},"data-error":function(){let{error:r}=this.$state;return!!r()},"data-autoplay-error":function(){let{autoPlayError:r}=this.$state;return!!r()}},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 r of pq){let i="data-"+(n[r]??Cc(r));e[i]=function(){return this.$state[r]()}}delete e.title,Fy[oS]=e,this.setAttributes(e)}_onFindPlayer(e){e.detail(this)}_onResize(){if(Y||!this.el)return;let e=this.el.clientWidth,n=this.el.clientHeight;this.$state.width.set(e),this.$state.height.set(n),on(this.el,"--player-width",e+"px"),on(this.el,"--player-height",n+"px")}_onPointerChange(e){if(Y)return;let n=e.matches?"coarse":"fine";he(this.el,"data-pointer",n),this.$state.pointer.set(n),this._onResize()}_isIOSControls(){let{playsInline:e,fullscreen:n}=this.$state;return SO&&!jO()&&this.$state.mediaType()==="video"&&(!e()||n())}get provider(){return this._provider}get controls(){return this._requestMgr._controls}set controls(e){this._$$props.controls.set(e)}get title(){return B(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 duration(){return this.$state.duration()}set duration(e){this._$$props.duration.set(e)}get paused(){return B(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 B(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 B(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:r,seekableStart:i,seekableEnd:o}=this.$state;e!==B(n)&&B(()=>{if(!this._provider)return;let a=Math.min(Math.max(i()+.1,e+r()),o()-.1);Number.isFinite(a)&&this._provider.setCurrentTime(a)})})}get volume(){return B(this.$state.volume)}set volume(e){this._$$props.volume.set(e)}_watchVolume(){this._queueVolumeUpdate(this.$props.volume())}_queueVolumeUpdate(e){let n=FS(0,e,1);this.canPlayQueue._enqueue("volume",()=>{this._provider&&this._provider.setVolume(n)})}get playbackRate(){return B(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=ee(e)?new Hy:e;if(n?.onChange){let{source:r}=this.$state,i=ee(e)?e:this.el?.id,o=Fi(this._computeMediaId.bind(this));M(()=>n.onChange(r(),o(),i))}this._media.storage=n,this._media.textTracks.setStorage(n),me(()=>{n?.onDestroy?.(),this._media.storage=null,this._media.textTracks.setStorage(null)})}_computeMediaId(){let{clipStartTime:e,clipEndTime:n}=this.$props,{source:r}=this.$state,i=r();return i.src?`${i.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")}};De.props=fq;De.state=Ws;We([be],De.prototype,"canPlayQueue",2);We([be],De.prototype,"provider",1);We([be],De.prototype,"controls",1);We([be],De.prototype,"orientation",2);We([be],De.prototype,"title",1);We([be],De.prototype,"qualities",1);We([be],De.prototype,"audioTracks",1);We([be],De.prototype,"textTracks",1);We([be],De.prototype,"textRenderers",1);We([be],De.prototype,"duration",1);We([be],De.prototype,"paused",1);We([be],De.prototype,"muted",1);We([be],De.prototype,"currentTime",1);We([be],De.prototype,"volume",1);We([be],De.prototype,"playbackRate",1);We([pt],De.prototype,"play",1);We([pt],De.prototype,"pause",1);We([pt],De.prototype,"enterFullscreen",1);We([pt],De.prototype,"exitFullscreen",1);We([pt],De.prototype,"enterPictureInPicture",1);We([pt],De.prototype,"exitPictureInPicture",1);We([pt],De.prototype,"seekToLiveEdge",1);We([pt],De.prototype,"startLoading",1);We([pt],De.prototype,"startLoadingPoster",1);We([pt],De.prototype,"requestAirPlay",1);We([pt],De.prototype,"requestGoogleCast",1);vq=De;kF=new Map,xS=class{constructor(e,n,r,i=[]){this._domSources=e,this._media=n,this._loader=r,this._initialize=!1;let o=new bF,a=new qp,s=new Xy,l=new Jy,c=new Zy,u=[l,c];this._loaders=Fi(()=>{let p=n.$state.remotePlaybackLoader(),f=n.$props.preferNativeHLS()?[...i,a,s,o,...u]:[...i,o,a,s,...u];return p?[p,...f]:f});let{$state:d}=n;d.sources.set(DO(n.$props.src()));for(let p of d.sources()){let f=this._loaders().find(g=>g.canPlay(p));if(!f)continue;let h=f.mediaType(p);this._media.$state.source.set(p),this._media.$state.mediaType.set(h),this._media.$state.inferredViewType.set(h),this._loader.set(f),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),M(this._onSourcesChange.bind(this)),M(this._onSourceChange.bind(this)),M(this._onSetup.bind(this)),M(this._onLoadSource.bind(this)),M(this._onLoadPoster.bind(this))}_onSourcesChange(){this._notify("sources-change",[...DO(this._media.$props.src()),...this._domSources()])}_onSourceChange(){let{$state:e}=this._media,n=e.sources(),r=B(e.source),i=this._findNewSource(r,n);if(n[0]?.src&&!i.src&&!i.type){let{crossOrigin:a}=e,s=Vy(a()),l=new AbortController;return Promise.all(n.map(c=>ee(c.src)&&c.type==="?"?fetch(c.src,{method:"HEAD",credentials:s,signal:l.signal}).then(u=>(c.type=u.headers.get("content-type")||"??",kF.set(c.src,c.type),c)).catch(()=>c):c)).then(c=>{l.signal.aborted||(this._findNewSource(B(e.source),c),di())}),()=>l.abort()}di()}_findNewSource(e,n){let r={src:"",type:""},i=null,o=this._loaders();for(let a of n){let s=o.find(l=>l.canPlay(a));if(s){r=a,i=s;break}}return NO(e,r)||this._notifySourceChange(r,i),i!==B(this._loader)&&this._notifyLoaderChange(i),r}_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&&B(()=>e.preconnect?.(this._media)),this._loader.set(e),this._notify("provider-loader-change",e)}_onSetup(){let e=this._media.$provider();if(!(!e||B(this._media.$providerSetup))){if(this._media.$state.canLoad()){qt(()=>e.setup(),e.scope),this._media.$providerSetup.set(!0);return}B(()=>e.preconnect?.())}}_onLoadSource(){if(!this._media.$providerSetup())return;let e=this._media.$provider(),n=this._media.$state.source(),r=B(this._media.$state.crossOrigin),i=B(this._media.$props.preferNativeHLS);if(!NO(e?.currentSrc,n)){if(this._media.$state.canLoad()){let o=new AbortController;return $s(n)?(i||!Sy())&&_F(n.src,{credentials:Vy(r),signal:o.signal}).then(a=>{this._notify("stream-type-change",a)}).catch(qn):this._notify("stream-type-change","on-demand"),B(()=>{let a=B(this._media.$state.preload);return e?.loadSource(n,a).catch(s=>{})}),()=>o.abort()}try{ee(n.src)&&pi(new URL(n.src).origin)}catch{}}}_onLoadPoster(){let e=this._loader(),{providedPoster:n,source:r,canLoadPoster:i}=this._media.$state;if(!e||!e.loadPoster||!r()||!i()||n())return;let o=new AbortController,a=new ae("source-change",{detail:r});return e.loadPoster(r(),this._media,o).then(s=>{this._notify("poster-change",s||"",a)}).catch(()=>{this._notify("poster-change","",a)}),()=>{o.abort()}}};wS=class{constructor(e,n){this._domTracks=e,this._media=n,this._prevTracks=[],M(this._onTracksChange.bind(this))}_onTracksChange(){let e=this._domTracks();for(let n of this._prevTracks)if(!e.some(r=>r.id===n.id)){let r=n.id&&this._media.textTracks.getById(n.id);r&&this._media.textTracks.remove(r)}for(let n of e){let r=n.id||gn.createId(n);this._media.textTracks.getById(r)||(n.id=r,this._media.textTracks.add(n))}this._prevTracks=e}},bq=Object.defineProperty,_q=Object.getOwnPropertyDescriptor,kq=(t,e,n,r)=>{for(var i=r>1?void 0:r?_q(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&bq(e,n,i),i},Bc=class extends le{constructor(){super(...arguments),this._domSources=J([]),this._domTracks=J([]),this._loader=null,this._loadRafId=-1}onSetup(){this._media=Le(),this._sources=new xS(this._domSources,this._media,this.$state.loader,this.$props.loaders())}onAttach(e){e.setAttribute("data-media-provider","")}onConnect(e){this._sources.connect(),new wS(this._domTracks,this._media);let n=new ResizeObserver(Sa(this._onResize.bind(this)));n.observe(e);let r=new MutationObserver(this._onMutation.bind(this));r.observe(e,{attributes:!0,childList:!0}),this._onResize(),this._onMutation(),me(()=>{n.disconnect(),r.disconnect()})}load(e){window.cancelAnimationFrame(this._loadRafId),this._loadRafId=requestAnimationFrame(()=>this._runLoader(e)),me(()=>{window.cancelAnimationFrame(this._loadRafId)})}_runLoader(e){if(!this.scope)return;let n=this.$state.loader(),{$provider:r}=this._media;this._loader===n&&n?.target===e&&B(r)||(this._destroyProvider(),this._loader=n,n&&(n.target=e||null),!(!n||!e)&&n.load(this._media).then(i=>{this.scope&&B(this.$state.loader)===n&&this._media.delegate._notify("provider-change",i)}))}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,r=this.el.offsetHeight;e&&(e.$state.mediaWidth.set(n),e.$state.mediaHeight.set(r),e.el&&(on(e.el,"--media-width",n+"px"),on(e.el,"--media-height",r+"px")))}_onMutation(){let e=[],n=[],r=this.el.children;for(let i of r)i.hasAttribute("data-vds")||(i instanceof HTMLSourceElement?e.push({src:i.src,type:i.type}):i instanceof HTMLTrackElement&&n.push({id:i.id,src:i.src,kind:i.track.kind,language:i.srclang,label:i.label,default:i.default,type:i.getAttribute("data-type")}));this._domSources.set(e),this._domTracks.set(n),di()}};Bc.props={loaders:[]};Bc.state=new ui({loader:null});kq([pt],Bc.prototype,"load",1);rv=class extends le{onSetup(){this._media=Le(),M(this._watchProps.bind(this))}onAttach(e){let{pictureInPicture:n,fullscreen:r}=this._media.$state;on(e,"pointer-events","none"),He(e,"role","group"),this.setAttributes({"data-visible":this._isShowing.bind(this),"data-fullscreen":r,"data-pip":n}),M(()=>{this.dispatch("change",{detail:this._isShowing()})}),M(this._hideControls.bind(this)),M(()=>{let i=r();for(let o of["top","right","bottom","left"])on(e,`padding-${o}`,i&&`env(safe-area-inset-${o})`)})}_hideControls(){if(!this.el)return;let{$iosControls:e}=this._media,{controls:n}=this._media.$state,r=n()||e();he(this.el,"aria-hidden",r?"true":null),on(this.el,"display",r?"none":null)}_watchProps(){let{controls:e}=this._media.player,{hideDelay:n,hideOnMouseLeave:r}=this.$props;e.defaultDelay=n()===2e3?this._media.$props.controlsDelay():n(),e.hideOnMouseLeave=r()}_isShowing(){let{controlsVisible:e}=this._media.$state;return e()}};rv.props={hideDelay:2e3,hideOnMouseLeave:!1};iv=class extends le{onAttach(e){e.style.pointerEvents||on(e,"pointer-events","auto")}},ov=class extends Rn{constructor(e){super(),this._delegate=e,this._showTimerId=-1,this._hideRafId=-1,this._stopAnimationEndListener=null,M(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),r=this.hide.bind(this);this._delegate._listen(e,n,r)}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"),B(()=>this._delegate._onChange(!0,e))},this._delegate._showDelay?.()??0)}hide(e){this._cancelShowing(),B(()=>this._delegate._onChange(!1,e)),this._hideRafId=requestAnimationFrame(()=>{this._cancelShowing(),this._hideRafId=-1;let n=this._delegate._content();if(n){let r=()=>{n.style.display="none",this._stopAnimationEndListener=null};if(iq(n)){this._stopAnimationEndListener?.();let o=z(n,"animationend",r,{once:!0});this._stopAnimationEndListener=o}else r()}})}_cancelShowing(){window.clearTimeout(this._showTimerId),this._showTimerId=-1}},Vc=Ni(),Tq=0,av=class extends le{constructor(){super(),this._id=`media-tooltip-${++Tq}`,this._trigger=J(null),this._content=J(null),new mr;let{showDelay:e}=this.$props;new ov({_trigger:this._trigger,_content:this._content,_showDelay:e,_listen(n,r,i){z(n,"touchstart",o=>o.preventDefault(),{passive:!1}),M(()=>{nv()&&z(n,"focus",r),z(n,"blur",i)}),z(n,"mouseenter",r),z(n,"mouseleave",i)},_onChange:this._onShowingChange.bind(this)})}onAttach(e){e.style.setProperty("display","contents")}onSetup(){$n(Vc,{_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`,""),he(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",He(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(),r=this._content();n&&he(n,"aria-describedby",e?this._id:null);for(let i of[this.el,n,r])i&&he(i,"data-visible",e)}};av.props={showDelay:700};sv=class extends le{constructor(){super(),new mr}onConnect(e){me(By(()=>{if(!this.connectScope)return;this._attach();let n=dt(Vc);me(()=>{let r=this._getButton();r&&n._detachTrigger(r)})}))}_attach(){let e=this._getButton(),n=dt(Vc);e&&n._attachTrigger(e)}_getButton(){let e=this.el.firstElementChild;return e?.localName==="button"||e?.getAttribute("role")==="button"?e:this.el}},Kp=class extends le{constructor(){super(),new mr;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=dt(Vc);me(()=>n._detachContent(e)),me(By(()=>{this.connectScope&&M(this._watchPlacement.bind(this))}))}_attach(e){dt(Vc)._attachContent(e)}_watchPlacement(){let{placement:e,offset:n,alignOffset:r}=this.$props;return lF(this.el,this._getTrigger(),e(),{offsetVarName:"media-tooltip",xOffset:r(),yOffset:n()})}_getTrigger(){return dt(Vc)._trigger()}};Kp.props={placement:"top center",offset:0,alignOffset:0};Kt=class extends Rn{constructor(e){super(),this._delegate=e,new mr,e._keyShortcut&&new Qy(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){He(e,"tabindex","0"),He(e,"role","button"),He(e,"type","button")}onConnect(e){$a(e,this._onMaybePress.bind(this));for(let n of["click","touchstart"])this.listen(n,this._onInteraction.bind(this))}_isARIAPressed(){return Mc(this._delegate._isPressed())}_onPressed(e){eT(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())}};Kt.props={disabled:!1};Sq=Object.defineProperty,Eq=Object.getOwnPropertyDescriptor,Pq=(t,e,n,r)=>{for(var i=r>1?void 0:r?Eq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&Sq(e,n,i),i},Gp=class extends le{constructor(){super(),this._pressed=J(!1),new Kt({_isPressed:this._pressed})}get pressed(){return this._pressed()}};Gp.props={disabled:!1,defaultPressed:!1};Pq([be],Gp.prototype,"pressed",1);lv=class extends le{constructor(){super(),new Kt({_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":Qn(()=>!e())})}onAttach(e){e.setAttribute("data-media-tooltip","airplay"),La(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()}`}};lv.props=Kt.props;cv=class extends le{constructor(){super(),new Kt({_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":Qn(()=>!e())})}onAttach(e){e.setAttribute("data-media-tooltip","google-cast"),La(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()}`}};cv.props=Kt.props;uv=class extends le{constructor(){super(),new Kt({_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"),La(e,"Play")}_onPress(e){let n=this._media.remote;this._isPressed()?n.pause(e):n.play(e)}_isPressed(){let{paused:e}=this._media.$state;return!e()}};uv.props=Kt.props;dv=class extends le{constructor(){super(),new Kt({_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":Qn(this._isHidden.bind(this))})}onAttach(e){e.setAttribute("data-media-tooltip","caption"),La(e,"Captions")}_onPress(e){this._media.remote.toggleCaptions(e)}_isPressed(){let{textTrack:e}=this._media.$state,n=e();return!!n&&It(n)}_isHidden(){let{hasCaptions:e}=this._media.$state;return!e()}};dv.props=Kt.props;pv=class extends le{constructor(){super(),new Kt({_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":Qn(()=>!n())})}onAttach(e){e.setAttribute("data-media-tooltip","fullscreen"),La(e,"Fullscreen")}_onPress(e){let n=this._media.remote,r=this.$props.target();this._isPressed()?n.exitFullscreen(r,e):n.enterFullscreen(r,e)}_isPressed(){let{fullscreen:e}=this._media.$state;return e()}_isSupported(){let{canFullscreen:e}=this._media.$state;return e()}};pv.props={...Kt.props,target:"prefer-media"};fv=class extends le{constructor(){super(),new Kt({_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"),La(e,"Mute")}_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}_getState(){let{muted:e,volume:n}=this._media.$state,r=n();if(e()||r===0)return"muted";if(r>=.5)return"high";if(r<.5)return"low"}};fv.props=Kt.props;hv=class extends le{constructor(){super(),new Kt({_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":Qn(()=>!n())})}onAttach(e){e.setAttribute("data-media-tooltip","pip"),La(e,"PiP")}_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()}};hv.props=Kt.props;mv=class extends le{constructor(){super(),new mr}onSetup(){this._media=Le();let{seeking:e}=this._media.$state,{seconds:n}=this.$props,r=this._isSupported.bind(this);this.setAttributes({seconds:n,"data-seeking":e,"data-supported":r,"aria-hidden":Qn(()=>!r())})}onAttach(e){He(e,"tabindex","0"),He(e,"role","button"),He(e,"type","button"),e.setAttribute("data-media-tooltip","seek"),La(e,this._getDefaultLabel.bind(this))}onConnect(e){$a(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:r}=this.$props;if(r())return;let{currentTime:i}=this._media.$state,o=i()+n();this._media.remote.seek(o,e)}};mv.props={disabled:!1,seconds:30};gv=class extends le{constructor(){super(),new mr}onSetup(){this._media=Le();let{disabled:e}=this.$props,{live:n,liveEdge:r}=this._media.$state,i=()=>!n();this.setAttributes({"data-edge":r,"data-hidden":i,"aria-disabled":Qn(()=>e()||r()),"aria-hidden":Qn(i)})}onAttach(e){He(e,"tabindex","0"),He(e,"role","button"),He(e,"type","button"),e.setAttribute("data-media-tooltip","live")}onConnect(e){$a(e,this._onPress.bind(this))}_onPress(e){let{disabled:n}=this.$props,{liveEdge:r}=this._media.$state;n()||r()||this._media.remote.seekToLiveEdge(e)}};gv.props={disabled:!1};Cv=new ui({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 VO(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return VO(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});zO={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1},bS=class extends Rn{constructor(e,n){super(),this._delegate=e,this._media=n,this._provider=null,this._touch=null,this._touchStartValue=null,this._onDocumentPointerMove=Ff(r=>{this._updatePointerValue(this._getPointerValue(r),r)},20,{leading:!0})}onConnect(){M(this._attachEventListeners.bind(this)),M(this._attachPointerListeners.bind(this)),this._delegate._swipeGesture&&M(this._watchSwipeGesture.bind(this))}_watchSwipeGesture(){let{pointer:e}=this._media.$state;if(e()!=="coarse"||!this._delegate._swipeGesture()){this._provider=null;return}this._provider=this._media.player.el?.querySelector("media-provider,[data-media-provider]"),this._provider&&(z(this._provider,"touchstart",this._onTouchStart.bind(this),{passive:!0}),z(this._provider,"touchmove",this._onTouchMove.bind(this),{passive:!1}))}_onTouchStart(e){this._touch=e.touches[0]}_onTouchMove(e){if(Di(this._touch)||IS(e))return;let n=e.touches[0],r=n.clientX-this._touch.clientX,i=n.clientY-this._touch.clientY,o=this.$state.dragging();!o&&Math.abs(i)>5||o||(e.preventDefault(),Math.abs(r)>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()||(z(document,"pointerup",this._onDocumentPointerUp.bind(this)),z(document,"pointermove",this._onDocumentPointerMove.bind(this)),z(document,"touchmove",this._onDocumentTouchMove.bind(this),{passive:!1}))}_onFocus(){this._updatePointerValue(this.$state.value())}_updateValue(e,n){let{value:r,min:i,max:o,dragging:a}=this.$state,s=Math.max(i(),Math.min(e,o()));r.set(s);let l=this.createEvent("value-change",{detail:s,trigger:n});if(this.dispatch(l),this._delegate._onValueChange?.(l),a()){let c=this.createEvent("drag-value-change",{detail:s,trigger:n});this.dispatch(c),this._delegate._onDragValueChange?.(c)}}_updatePointerValue(e,n){let{pointerValue:r,dragging:i}=this.$state;r.set(e),this.dispatch("pointer-value-change",{detail:e,trigger:n}),i()&&this._updateValue(e,n)}_getPointerValue(e){let n,r=this.el.getBoundingClientRect(),{min:i,max:o}=this.$state;if(this.$props.orientation()==="vertical"){let{bottom:a,height:s}=r;n=(a-e.clientY)/s}else if(this._touch&&$t(this._touchStartValue)){let{width:a}=this._provider.getBoundingClientRect(),s=(e.clientX-this._touch.clientX)/a,l=o()-i(),c=l*Math.abs(s);n=(s<0?this._touchStartValue-c:this._touchStartValue+c)/l}else{let{left:a,width:s}=r;n=(e.clientX-a)/s}return Math.max(i(),Math.min(o(),this._delegate._roundValue(Rq(i(),o(),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:r}=this.$state;if(r())return;r.set(!0),this._media.remote.pauseControls(n);let i=this.createEvent("drag-start",{detail:e,trigger:n});this.dispatch(i),this._delegate._onDragStart?.(i)}_onStopDragging(e,n){let{dragging:r}=this.$state;if(!r())return;r.set(!1),this._media.remote.resumeControls(n);let i=this.createEvent("drag-end",{detail:e,trigger:n});this.dispatch(i),this._delegate._onDragEnd?.(i),this._touch=null,this._touchStartValue=null}_onKeyDown(e){let{key:n}=e,{min:r,max:i}=this.$state,o;if(n==="Home"||n==="PageUp"?o=r():n==="End"||n==="PageDown"?o=i():!e.metaKey&&/^[0-9]$/.test(n)&&(o=(i()-r())/10*Number(n)),!ot(o)){this._updatePointerValue(o,e),this._updateValue(o,e);return}let a=this._getKeyValue(e);if(ot(a))return;let s=n===this._lastDownKey;!this.$state.dragging()&&s&&this._onStartDragging(a,e),this._updatePointerValue(a,e),s||this._updateValue(a,e),this._lastDownKey=n}_onKeyUp(e){this._lastDownKey="";let{dragging:n,value:r}=this.$state;if(!n())return;let i=this._getKeyValue(e)??r();this._updatePointerValue(i),this._onStopDragging(i,e)}_getKeyValue(e){let{key:n,shiftKey:r}=e;if(!Object.keys(zO).includes(n))return;e.preventDefault(),e.stopPropagation();let{shiftKeyMultiplier:o}=this.$props,{value:a,min:s,max:l}=this.$state,c=this._delegate._getStep(),u=this._delegate._getKeyStep(),d=r?u*o():u,p=Number(zO[n]),f=d*p,h=(a()+f)/c;return Math.max(s(),Math.min(l(),Number((c*h).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()}},Yp=Ni(()=>({})),Mv=Ni(),Ui=class extends Rn{constructor(e){super(),this._delegate=e,this._updateSliderVars=Sa((n,r)=>{this.el?.style.setProperty("--slider-fill",n+"%"),this.el?.style.setProperty("--slider-pointer",r+"%")})}onSetup(){this._media=Le();let e=new mr;e.attach(this),this.$state.focused=e.focused.bind(e),zr(Yp)||$n(Yp,{default:"value"}),$n(Mv,{_orientation:this.$props.orientation,_disabled:this._delegate._isDisabled,_preview:J(null)}),M(this._watchValue.bind(this)),M(this._watchDisabled.bind(this)),this._setupAttrs(),new bS(this._delegate,this._media).attach(this)}onAttach(e){He(e,"role","slider"),He(e,"tabindex","0"),He(e,"autocomplete","off"),Y?this._watchCSSVars():M(this._watchCSSVars.bind(this))}_watchValue(){let{dragging:e,value:n,min:r,max:i}=this.$state;B(e)||n.set(Mq(r(),i(),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 Mc(this._delegate._isDisabled())}_setupAttrs(){let{orientation:e}=this.$props,{dragging:n,active:r,pointing:i}=this.$state;this.setAttributes({"data-dragging":n,"data-pointing":i,"data-active":r,"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(An(e(),3),An(n(),3))}};Ui.props={disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};So=class extends le{constructor(){super(),new Ui({_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(){M(this._watchValue.bind(this)),M(this._watchMinMax.bind(this))}_getARIAValueNow(){let{value:e}=this.$state;return Math.round(e())}_getARIAValueText(){let{value:e,max:n}=this.$state;return An(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())}};So.props={...Ui.props,min:0,max:100,value:0};So.state=Cv;_o=new Map,Oy=new Map,yv=class t{constructor(e,n,r){this.$src=e,this.$crossOrigin=n,this._media=r,this.$images=J([]),M(this._onLoadCues.bind(this))}static create(e,n){let r=Le();return new t(e,n,r)}_onLoadCues(){let{canLoad:e}=this._media.$state;if(!e())return;let n=this.$src(),r=new AbortController;if(n){if(ee(n)&&_o.has(n)){let i=_o.get(n);if(_o.delete(n),_o.set(n,i),_o.size>30){let o=_o.keys().next().value;_o.delete(o)}this.$images.set(_o.get(n))}else if(ee(n)){let i=this.$crossOrigin(),o=n+"::"+i;if(!Oy.has(o)){let a=new Promise(async(s,l)=>{try{let c=await fetch(n,{signal:r.signal,credentials:Vy(i)});if(c.headers.get("content-type")==="application/json"){let d=await c.json();if(bt(d))if(d[0]&&"text"in d[0])s(this._processVTTCues(d));else{for(let p=0;p<d.length;p++){let f=d[p];bo(_p(f),!1),bo("url"in f&&ee(f.url),!1),bo("startTime"in f&&$t(f.startTime),!1)}s(d)}else s(this._processStoryboard(d));return}Promise.resolve().then(()=>(Op(),Ap)).then(async({parseResponse:d})=>{try{let{cues:p}=await d(c);s(this._processVTTCues(p))}catch(p){l(p)}})}catch(c){l(c)}}).then(s=>(r.signal.aborted||_o.set(o,s),s)).catch(s=>{r.signal.aborted||this._onError(n,s)}).finally(()=>{ee(o)&&Oy.delete(o)});Oy.set(o,a)}Oy.get(o)?.then(a=>{r.signal.aborted||this.$images.set(a||[])})}else if(bt(n))try{this.$images.set(this._processImages(n))}catch(i){this._onError(n,i)}else try{this.$images.set(this._processStoryboard(n))}catch(i){this._onError(n,i)}return()=>{r.abort(),this.$images.set([])}}}_processImages(e){let n=this._resolveBaseUrl();return e.map((r,i)=>(bo(r.url&&ee(r.url),!1),bo("startTime"in r&&$t(r.startTime),!1),{...r,url:ee(r.url)?this._resolveURL(r.url,n):r.url}))}_processStoryboard(e){bo(ee(e.url),!1),bo(bt(e.tiles)&&e.tiles?.length,!1);let n=new URL(e.url),r=[],i="tile_width"in e?e.tile_width:e.tileWidth,o="tile_height"in e?e.tile_height:e.tileHeight;for(let a of e.tiles)r.push({url:n,startTime:"start"in a?a.start:a.startTime,width:i,height:o,coords:{x:a.x,y:a.y}});return r}_processVTTCues(e){for(let i=0;i<e.length;i++){let o=e[i];bo("startTime"in o&&$t(o.startTime),!1),bo("text"in o&&ee(o.text),!1)}let n=[],r=this._resolveBaseUrl();for(let i of e){let[o,a]=i.text.split("#"),s=this._resolveData(a);n.push({url:this._resolveURL(o,r),startTime:i.startTime,endTime:i.endTime,width:s?.w,height:s?.h,coords:s&&$t(s.x)&&$t(s.y)?{x:s.x,y:s.y}:void 0})}return n}_resolveBaseUrl(){let e=B(this.$src);return!ee(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,r]=e.split("="),i=r?.split(","),o={};if(!n||!i)return null;for(let a=0;a<n.length;a++){let s=+i[a];isNaN(s)||(o[n[a]]=s)}return o}_onError(e,n){}},jc=class extends le{constructor(){super(...arguments),this._styleResets=[]}onSetup(){this._media=Le(),this._loader=yv.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":Qn(this.$state.hidden)})}onConnect(e){M(this._watchImg.bind(this)),M(this._watchHidden.bind(this)),M(this._watchCrossOrigin.bind(this)),M(this._onLoadStart.bind(this)),M(this._onFindActiveThumbnail.bind(this)),M(this._resize.bind(this))}_watchImg(){let e=this.$state.img();e&&(z(e,"load",this._onLoaded.bind(this)),z(e,"error",this._onError.bind(this)))}_watchCrossOrigin(){let{crossOrigin:e}=this.$props,{crossOrigin:n}=this.$state,{crossOrigin:r}=this._media.$state,i=e()!==null?e():r();n.set(i===!0?"anonymous":i)}_onLoadStart(){let{src:e,loading:n,error:r}=this.$state;return e()&&(n.set(!0),r.set(null)),()=>{this._resetStyles(),n.set(!1),r.set(null)}}_onLoaded(){let{loading:e,error:n}=this.$state;this._resize(),e.set(!1),n.set(null)}_onError(e){let{loading:n,error:r}=this.$state;n.set(!1),r.set(e)}_isLoading(){let{loading:e,hidden:n}=this.$state;return!n()&&e()}_hasError(){let{error:e}=this.$state;return!Di(e())}_watchHidden(){let{hidden:e}=this.$state,{duration:n}=this._media.$state,r=this._loader.$images();e.set(this._hasError()||!Number.isFinite(n())||r.length===0)}_getTime(){return this.$props.time()}_onFindActiveThumbnail(){let e=this._loader.$images();if(!e.length)return;let n=this._getTime(),{src:r,activeThumbnail:i}=this.$state,o=-1,a=null;for(let s=e.length-1;s>=0;s--){let l=e[s];if(n>=l.startTime&&(!l.endTime||n<l.endTime)){o=s;break}}e[o]&&(a=e[o]),i.set(a),r.set(a?.url.href||"")}_resize(){if(!this.scope||this.$state.hidden())return;let e=this.el,n=this.$state.img(),r=this.$state.activeThumbnail();if(!n||!r||!e)return;let i=r.width??n.naturalWidth,o=r?.height??n.naturalHeight,{maxWidth:a,maxHeight:s,minWidth:l,minHeight:c,width:u,height:d}=getComputedStyle(this.el);l==="100%"&&(l=parseFloat(u)+""),c==="100%"&&(c=parseFloat(d)+"");let p=Math.max(parseInt(l)/i,parseInt(c)/o),f=Math.min(Math.max(parseInt(l),parseInt(a))/i,Math.max(parseInt(c),parseInt(s))/o),h=!isNaN(f)&&f<1?f:p>1?p:1;this._style(e,"--thumbnail-width",`${i*h}px`),this._style(e,"--thumbnail-height",`${o*h}px`),this._style(n,"width",`${n.naturalWidth*h}px`),this._style(n,"height",`${n.naturalHeight*h}px`),this._style(n,"transform",r.coords?`translate(-${r.coords.x*h}px, -${r.coords.y*h}px)`:""),this._style(n,"max-width","none")}_style(e,n,r){e.style.setProperty(n,r),this._styleResets.push(()=>e.style.removeProperty(n))}_resetStyles(){for(let e of this._styleResets)e();this._styleResets=[]}};jc.props={src:null,time:0,crossOrigin:null};jc.state=new ui({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1});vv=class extends jc{onAttach(e){this._slider=Ms(So.state)}_getTime(){let{duration:e,clipStartTime:n}=this._media.$state;return n()+this._slider.pointerRate()*e()}},$q=Object.defineProperty,Iq=Object.getOwnPropertyDescriptor,Lq=(t,e,n,r)=>{for(var i=r>1?void 0:r?Iq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&$q(e,n,i),i},Ds=class extends le{get video(){return this.$state.video()}onSetup(){this._media=Le(),this._slider=Ms(So.state),this._watchCrossOrigin(),this.setAttributes({"data-loading":this._isLoading.bind(this),"data-hidden":this.$state.hidden,"data-error":this._hasError.bind(this),"aria-hidden":Qn(this.$state.hidden)})}onAttach(e){M(this._watchVideo.bind(this)),M(this._watchSrc.bind(this)),M(this._watchCrossOrigin.bind(this)),M(this._watchHidden.bind(this)),M(this._onSrcChange.bind(this)),M(this._onUpdateTime.bind(this))}_watchVideo(){let e=this.$state.video();e&&(e.readyState>=2&&this._onCanPlay(),z(e,"canplay",this._onCanPlay.bind(this)),z(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:r}=this._media.$state,i=e()!==null?e():r();n.set(i===!0?"anonymous":i)}_isLoading(){let{canPlay:e,hidden:n}=this.$state;return!e()&&!n()}_hasError(){let{error:e}=this.$state;return!Di(e)}_watchHidden(){let{src:e,hidden:n}=this.$state,{canLoad:r,duration:i}=this._media.$state;n.set(r()&&(!e()||this._hasError()||!Number.isFinite(i())))}_onSrcChange(){let{src:e,canPlay:n,error:r}=this.$state;e(),n.set(!1),r.set(null)}_onCanPlay(e){let{canPlay:n,error:r}=this.$state;n.set(!0),r.set(null),this.dispatch("can-play",{trigger:e})}_onError(e){let{canPlay:n,error:r}=this.$state;n.set(!1),r.set(e),this.dispatch("error",{trigger:e})}_onUpdateTime(){let{video:e,canPlay:n}=this.$state,{duration:r}=this._media.$state,{pointerRate:i}=this._slider,o=e();n()&&o&&Number.isFinite(r())&&Number.isFinite(i())&&(o.currentTime=i()*r())}};Ds.props={src:null,crossOrigin:null};Ds.state=new ui({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});Lq([be],Ds.prototype,"video",1);Aq=Object.defineProperty,Oq=Object.getOwnPropertyDescriptor,Fq=(t,e,n,r)=>{for(var i=r>1?void 0:r?Oq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&Aq(e,n,i),i},Hc=class extends le{onSetup(){this._slider=Ms(So.state),this._format=dt(Yp),this._text=Fi(this.getValueText.bind(this))}getValueText(){let{type:e,format:n,decimalPlaces:r,padHours:i,padMinutes:o,showHours:a,showMs:s}=this.$props,{value:l,pointerValue:c,min:u,max:d}=this._slider,p=n()??this._format.default,f=e()==="current"?l():c();if(p==="percent"){let h=d()-u(),g=f/h*100;return(this._format.percent??An)(g,r())+"\uFE6A"}else return p==="time"?(this._format.time??Aa)(f,{padHrs:i(),padMins:o(),showHrs:a(),showMs:s()}):this._format.value?.(f)??f.toFixed(2)}};Hc.props={type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2};Fq([pt],Hc.prototype,"getValueText",1);Xp=class extends le{constructor(){super(...arguments),this._updatePlacement=Sa(()=>{let{_disabled:e,_orientation:n}=this._slider;if(e())return;let r=this.el,{offset:i,noClamp:o}=this.$props;DS(r,{clamp:!o(),offset:i(),orientation:n()})})}onSetup(){this._slider=dt(Mv);let{active:e}=Ms(So.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),me(()=>n.set(null)),M(this._updatePlacement.bind(this));let r=new ResizeObserver(this._updatePlacement.bind(this));r.observe(e),me(()=>r.disconnect())}};Xp.props={offset:0,noClamp:!1};Zp=class extends le{constructor(){super(...arguments),this._throttleVolumeChange=Ff(this._onVolumeChange.bind(this),25)}onSetup(){this._media=Le(),$n(Yp,{default:"percent"}),new Ui({_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),M(this._watchVolume.bind(this))}onAttach(e){e.setAttribute("data-media-volume-slider",""),He(e,"aria-label","Volume");let{canSetVolume:n}=this._media.$state;this.setAttributes({"data-supported":n,"aria-hidden":Qn(()=>!n())})}_getARIAValueNow(){let{value:e}=this.$state;return Math.round(e())}_getARIAValueText(){let{value:e,max:n}=this.$state;return An(e()/n()*100,2)+"%"}_watchVolume(){let{muted:e,volume:n}=this._media.$state,r=e()?0:n()*100;this.$state.value.set(r),this.dispatch("value-change",{detail:r})}_onVolumeChange(e){if(!e.trigger)return;let n=An(e.detail/100,3);this._media.remote.changeVolume(n,e)}_onValueChange(e){this._throttleVolumeChange(e)}_onDragValueChange(e){this._throttleVolumeChange(e)}};Zp.props={...Ui.props,keyStep:5,shiftKeyMultiplier:2};Zp.state=Cv;Wc=class extends le{constructor(){super(),this._chapter=J(null),this._playingBeforeDragStart=!1;let{noSwipeGesture:e}=this.$props;new Ui({_swipeGesture:()=>!e(),_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(),$n(Yp,{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)}),M(this._watchCurrentTime.bind(this)),M(this._watchSeekingThrottle.bind(this))}onAttach(e){e.setAttribute("data-media-time-slider",""),He(e,"aria-label","Seek")}onConnect(e){M(this._watchPreviewing.bind(this)),Yc(this._media.textTracks,"chapters",this._chapter.set)}_calcBufferedPercent(){let{bufferedEnd:e,duration:n}=this._media.$state;return An(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=Ff(this._seeking.bind(this),this.$props.seekingRequestThrottle())}_watchCurrentTime(){let{currentTime:e}=this._media.$state,{value:n,dragging:r}=this.$state,i=this._timeToPercent(e());B(r)||(n.set(i),this.dispatch("value-change",{detail:i}))}_watchPreviewing(){let e=this._media.player.el,{_preview:n}=dt(Mv);e&&n()&&he(e,"data-preview",this.$state.active())}_seeking(e,n){this._media.remote.seeking(e,n)}_seek(e,n,r){this._dispatchSeeking.cancel();let{live:i}=this._media.$state;if(i()&&n>=99){this._media.remote.seekToLiveEdge(r);return}this._media.remote.seek(e,r)}_onDragStart(e){let{pauseWhileDragging:n}=this.$props;if(n()){let{paused:r}=this._media.$state;this._playingBeforeDragStart=!r(),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:r}=this.$props;r()&&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 An(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)?`${Qp(e)} out of ${Qp(n())}`:"live"}_percentToTime(e){let{duration:n}=this._media.$state;return An(e/100*n(),5)}_timeToPercent(e){let{liveEdge:n,duration:r}=this._media.$state,i=Math.max(0,Math.min(1,n()?1:Math.min(e,r())/r()));return Number.isNaN(i)?0:Number.isFinite(i)?i*100:100}_formatValue(e){let n=this._percentToTime(e),{live:r,duration:i}=this._media.$state;return Number.isFinite(n)?(r()?n-i():n).toFixed(0):"LIVE"}_formatTime(e,n){let r=this._percentToTime(e),{live:i,duration:o}=this._media.$state,a=i()?r-o():r;return Number.isFinite(r)?`${a<0?"-":""}${Aa(Math.abs(a),n)}`:"LIVE"}};Wc.props={...Ui.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100};Wc.state=Cv;Dq=Object.defineProperty,Nq=Object.getOwnPropertyDescriptor,Rv=(t,e,n,r)=>{for(var i=r>1?void 0:r?Nq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&Dq(e,n,i),i},Eo=class extends le{constructor(){super(...arguments),this._titleRef=null,this._refs=[],this._$track=J(null),this._$cues=J([]),this._activeIndex=J(-1),this._activePointerIndex=J(-1),this._bufferedIndex=0,this._updateBufferedPercent=Sa(e=>{let n,r=this._$cues(),{clipStartTime:i}=this._media.$state,o=i(),a=this._getEndTime(r);for(let s=this._bufferedIndex;s<this._refs.length;s++)if(n=this._calcPercent(r[s],e,o,a),this._refs[s]?.style.setProperty("--chapter-progress",n+"%"),n<100){this._bufferedIndex=s;break}}),this._bufferedPercent=Fi(this._calcMediaBufferedPercent.bind(this)),this._onCuesChange=LS(()=>{let e=B(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=Ms(Wc.state)}onAttach(e){Yc(this._media.textTracks,"chapters",this._setTrack.bind(this)),M(this._onTrackChange.bind(this))}onConnect(){me(()=>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&&qt(()=>this._watch(),this._updateScope=Mn())}_setTrack(e){B(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&&(M(this._watchContainerWidths.bind(this)),M(this._watchFillPercent.bind(this)),M(this._watchPointerPercent.bind(this)),M(this._watchBufferedPercent.bind(this)))}_watchContainerWidths(){let e=this._$cues();if(!e.length)return;let n,{clipStartTime:r,clipEndTime:i}=this._media.$state,o=r(),a=i()||e[e.length-1].endTime,s=a-o,l=100;for(let c=0;c<e.length;c++)if(n=e[c],this._refs[c]){let u=c===e.length-1?l:An((n.endTime-Math.max(o,n.startTime))/s*100,3);this._refs[c].style.width=u+"%",l-=u}}_watchFillPercent(){let{liveEdge:e,clipStartTime:n,duration:r}=this._media.$state,{fillPercent:i,value:o}=this._sliderState,a=this._$cues(),s=e(),l=B(this._activeIndex),c=a[l],u=s?this._$cues.length-1:this._findActiveChapterIndex(c&&c.startTime/r()*100<=B(o)?l:0,i());s||!c?this._updateFillPercents(0,a.length,"100%"):u>l?this._updateFillPercents(l,u,"100%"):u<l&&this._updateFillPercents(u+1,l+1,"0%");let d=s?"100%":this._calcPercent(a[u],i(),n(),this._getEndTime(a))+"%";this._updateFillPercent(this._refs[u],d),this._activeIndex.set(u)}_watchPointerPercent(){let{pointing:e,pointerPercent:n}=this._sliderState;if(!e()){this._activePointerIndex.set(-1);return}let r=this._findActiveChapterIndex(0,n());this._activePointerIndex.set(r)}_updateFillPercents(e,n,r){for(let i=e;i<n;i++)this._updateFillPercent(this._refs[i],r)}_updateFillPercent(e,n){e&&e.style.setProperty("--chapter-fill",n)}_findActiveChapterIndex(e,n){let r=0,i=this._$cues();if(n===0)return 0;if(n===100)return i.length-1;let{clipStartTime:o}=this._media.$state,a=o(),s=this._getEndTime(i);for(let l=e;l<i.length;l++)if(r=this._calcPercent(i[l],n,a,s),r>=0&&r<100)return l;return 0}_watchBufferedPercent(){this._updateBufferedPercent(this._bufferedPercent())}_calcMediaBufferedPercent(){let{bufferedEnd:e,duration:n}=this._media.$state;return An(Math.min(e()/Math.max(n(),1),1),3)*100}_getEndTime(e){let{clipEndTime:n}=this._media.$state,r=n();return r>0?r:e[e.length-1]?.endTime||0}_calcPercent(e,n,r,i){if(this._$cues().length===0)return 0;let a=i-r,s=Math.max(0,e.startTime-r),l=Math.min(i,e.endTime)-r,c=s/a,u=c*100,d=Math.min(1,c+(l-s)/a)*100;return Math.max(0,An(n>=d?100:(n-u)/(d-u)*100,3))}_fillGaps(e){let n=[],{clipStartTime:r,clipEndTime:i,duration:o}=this._media.$state,a=r(),s=i()||1/0;e=e.filter(u=>u.startTime<=s&&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 f=p.startTime-d.endTime;f>0&&n.push(new window.VTTCue(d.endTime,d.endTime+f,""))}}let c=e[e.length-1];if(c){n.push(c);let u=o();u>=0&&u-c.endTime>1&&n.push(new window.VTTCue(c.endTime,o(),""))}return 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 r=this._onCuesChange.bind(this);r(),me(z(n,"add-cue",r)),me(z(n,"remove-cue",r)),M(this._watchMediaDuration.bind(this))}return this._titleRef=this._findChapterTitleRef(),this._titleRef&&M(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}};Eo.props={disabled:!1};Rv([be],Eo.prototype,"cues",1);Rv([be],Eo.prototype,"activeCue",1);Rv([be],Eo.prototype,"activePointerCue",1);Rv([pt],Eo.prototype,"setRefs",1);sn=Ni(),Vq=["a[href]","[tabindex]","input","select","button"].map(t=>`${t}:not([aria-hidden='true'])`).join(","),UO=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]),_S=class{constructor(e){this._delegate=e,this._index=0,this._el=null,this._elements=[]}get _items(){return this._elements}_attachMenu(e){return z(e,"focus",this._onFocus.bind(this)),this._el=e,me(()=>{this._el=null}),this}_listen(){this._el&&(this._update(),z(this._el,"keyup",this._onKeyUp.bind(this)),z(this._el,"keydown",this._onKeyDown.bind(this)),me(()=>{this._index=0,this._elements=[]}))}_update(){this._index=0,this._elements=this._getFocusableElements()}_scroll(e=this._findActiveIndex()){let n=this._elements[e],r=this._delegate._getScrollContainer();n&&r&&requestAnimationFrame(()=>{r.scrollTop=n.offsetTop-r.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){UO.has(e.key)&&(e.stopPropagation(),e.preventDefault())}_onKeyDown(e){if(UO.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(Vq),n=[],r=i=>i.getAttribute("role")==="menu";for(let i of e)i instanceof HTMLElement&&i.offsetParent!==null&&sF(this._el,i,r)&&n.push(i);return n}},zq=Object.defineProperty,Uq=Object.getOwnPropertyDescriptor,Df=(t,e,n,r)=>{for(var i=r>1?void 0:r?Uq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&zq(e,n,i),i},Bq=0,Po=class extends le{constructor(){super(),this._expanded=J(!1),this._disabled=J(!1),this._trigger=J(null),this._content=J(null),this._isTriggerDisabled=J(!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=Sa(()=>{let n=B(this._content);if(!n||Y)return;let r=0,i=getComputedStyle(n),o=[...n.children];for(let a of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])r+=parseFloat(i[a])||0;for(let a of o)if(a instanceof HTMLElement&&a.style.display==="contents")o.push(...a.children);else if(a.nodeType===3)r+=parseFloat(getComputedStyle(a).fontSize);else if(a instanceof HTMLElement){let s=getComputedStyle(a);if(s.display==="none")continue;r+=a.offsetHeight+(parseFloat(s.marginTop)||0)+(parseFloat(s.marginBottom)||0)}on(n,"--menu-height",r+"px")});let{showDelay:e}=this.$props;this._popper=new ov({_trigger:this._trigger,_content:this._content,_showDelay:e,_listen:(n,r,i)=>{$a(n,a=>{this._expanded()?i(a):r(a)});let o=this._getCloseTarget();o&&$a(o,a=>{a.stopPropagation(),i(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=++Bq;this._menuId=`media-menu-${e}`,this._menuButtonId=`media-menu-button-${e}`,this._focus=new _S({_getScrollContainer:this._findScrollContainer.bind(this),_closeMenu:this.close.bind(this)}),zr(sn)&&(this._parentMenu=dt(sn)),this.setAttributes({"data-open":this._expanded,"data-submenu":this.isSubmenu,"data-disabled":this._isDisabled.bind(this)}),$n(sn,{_button:this._trigger,_expanded:this._expanded,_hint:J(""),_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){M(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&&(M(()=>{let{height:n}=this._media.$state,r=this._content();r&&on(r,"--player-height",n()+"px")}),this._focus._listen(),this.listen("pointerup",this._onPointerUp.bind(this)),z(window,"pointerup",this._onWindowPointerUp.bind(this)))}_attachMenuButton(e){let n=e.el,r=this.isSubmenu,i=Qn(this._isDisabled.bind(this));He(n,"tabindex",r?"-1":"0"),He(n,"role",r?"menuitem":"button"),he(n,"id",this._menuButtonId),he(n,"aria-haspopup","menu"),he(n,"aria-expanded","false"),he(n,"data-submenu",this.isSubmenu),this.isSubmenu||this._stopClickPropagation(n);let o=()=>{he(n,"data-open",this._expanded()),he(n,"aria-disabled",i())};Y?o():M(o),this._trigger.set(n),me(()=>{this._trigger.set(null)})}_attachMenuItems(e){let n=e.el;n.style.setProperty("display","none"),he(n,"id",this._menuId),He(n,"role","menu"),He(n,"tabindex","-1"),he(n,"data-submenu",this.isSubmenu),this._content.set(n),me(()=>this._content.set(null));let r=()=>he(n,"data-open",this._expanded());if(Y?r():M(r),this._focus._attachMenu(n),this._updateMenuItemsHidden(!1),!this.isSubmenu){let i=this._onResizeTransition.bind(this);e.listen("transitionstart",i),e.listen("transitionend",i),e.listen("animationend",this._onResize),e.listen("vds-menu-resize",this._onResize)}}_attachObserver(e){this._menuObserver=e}_stopClickPropagation(e){z(e,"click",n=>n.stopPropagation()),z(e,"pointerup",n=>n.stopPropagation())}_updateMenuItemsHidden(e){let n=B(this._content);n&&he(n,"aria-hidden",Mc(!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 r=this._trigger(),i=this._content();if(r&&(he(r,"aria-controls",e&&this._menuId),he(r,"aria-expanded",Mc(e))),i&&he(i,"aria-labelledby",e&&this._menuButtonId),this._expanded.set(e),this._toggleMediaControls(n),di(),yo(n)){e?i?.focus():r?.focus();for(let o of[this.el,i])o&&o.setAttribute("data-keyboard","")}else for(let o of[this.el,i])o&&o.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 o of this._submenus)o.close(n)},300):this._media.activeMenu=null,this._menuObserver?._onClose?.(n)),e&&!yo(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&&sF(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 B(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),z(e,"open",this._onSubmenuOpenBind),z(e,"close",this._onSubmenuCloseBind),me(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 r of[n.el,n.triggerElement])r?.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 r=e.type==="transitionstart";he(n,"data-resizing",r)}}open(e){B(this._expanded)||(this._popper.show(e),di())}close(e){B(this._expanded)&&(this._popper.hide(e),di())}};Po.props={showDelay:0};Df([be],Po.prototype,"triggerElement",1);Df([be],Po.prototype,"contentElement",1);Df([be],Po.prototype,"isSubmenu",1);Df([pt],Po.prototype,"open",1);Df([pt],Po.prototype,"close",1);jq=Object.defineProperty,Hq=Object.getOwnPropertyDescriptor,Wq=(t,e,n,r)=>{for(var i=r>1?void 0:r?Hq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&jq(e,n,i),i},Ns=class extends le{constructor(){super(),this._hintEl=J(null),new mr}get expanded(){return this._menu?._expanded()??!1}onSetup(){this._menu=dt(sn)}onAttach(e){this._menu._attachMenuButton(this),M(this._watchDisabled.bind(this)),He(e,"type","button")}onConnect(e){M(this._watchHintEl.bind(this)),this._onMutation();let n=new MutationObserver(this._onMutation.bind(this));n.observe(e,{attributeFilter:["data-part"],childList:!0,subtree:!0}),me(()=>n.disconnect()),$a(e,r=>{this.dispatch("select",{trigger:r})})}_watchDisabled(){this._menu._disableMenuButton(this.$props.disabled())}_watchHintEl(){let e=this._hintEl();e&&M(()=>{let n=this._menu._hint();n&&(e.textContent=n)})}_onMutation(){let e=this.el?.querySelector('[data-part="hint"]');this._hintEl.set(e??null)}};Ns.props={disabled:!1};Wq([be],Ns.prototype,"expanded",1);xv=class extends Ns{},wv=class extends le{constructor(){super(...arguments),this._target=null}onSetup(){this._media=Le(),$n(Bp,{_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,By(()=>{By(()=>{this.connectScope&&M(this._watchDisabled.bind(this))})})}_watchDisabled(){let{fullscreen:e}=this._media.$state,{disabled:n}=this.$props,r=n();this._portal(r==="fullscreen"?!e():!r)}_portal(e){if(!this._target)return;let n=this._getContainer(this.$props.container());if(!n)return;let r=this._target.parentElement===n;he(this._target,"data-portal",e),e?r||(this._target.remove(),n.append(this._target)):r&&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}};wv.props={container:null,disabled:!1};Bp=Ni(),Jp=class extends le{constructor(){super(),new mr;let{placement:e}=this.$props;this.setAttributes({"data-placement":e})}onAttach(e){if(this._menu=dt(sn),this._menu._attachMenuItems(this),zr(Bp)){let n=dt(Bp);n&&($n(Bp,null),n._attach(e),me(()=>n._attach(null)))}}onConnect(e){M(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:r}=this.$props;return lF(this.el,this._getButton(),e,{offsetVarName:"media-menu",xOffset:r(),yOffset:n()})}else this.el.removeAttribute("style"),this.el.style.display="none"}_getButton(){return this._menu._button()}};Jp.props={placement:null,offset:0,alignOffset:0};kS=Ni(),Ia=class extends Rn{constructor(){super(...arguments),this._group=new Set,this._value=J(""),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(){$n(kS,{add:this._addRadio.bind(this),remove:this._removeRadio.bind(this)})}onAttach(e){zr(sn)||He(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 r=B(this._value);if(!e||e===r)return;let i=this._findRadio(r),o=this._findRadio(e);i?._check(!1,n),o?._check(!0,n),this._value.set(e),this._onValueChange?.(e,n)}_findRadio(e){for(let n of this._group)if(e===B(n._value))return n;return null}},qq=Object.defineProperty,Kq=Object.getOwnPropertyDescriptor,SF=(t,e,n,r)=>{for(var i=r>1?void 0:r?Kq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&qq(e,n,i),i},qc=class extends le{get values(){return this._controller._values}get value(){return this._controller.value}set value(e){this._controller.value=e}constructor(){super(),this._controller=new Ia,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){Y?this._watchValue():M(this._watchValue.bind(this))}_watchValue(){this._controller.value=this.$props.value()}_onValueChange(e,n){let r=this.createEvent("change",{detail:e,trigger:n});this.dispatch(r)}};qc.props={value:""};SF([be],qc.prototype,"values",1);SF([be],qc.prototype,"value",1);Gq=Object.defineProperty,Yq=Object.getOwnPropertyDescriptor,Qq=(t,e,n,r)=>{for(var i=r>1?void 0:r?Yq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&Gq(e,n,i),i},Kc=class extends le{constructor(){super(),this._checked=J(!1),this._controller={_value:this.$props.value,_check:this._check.bind(this),_onCheck:null},new mr}get checked(){return this._checked()}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this._checked,"aria-checked":Qn(this._checked)})}onAttach(e){let n=zr(sn);He(e,"tabindex",n?"-1":"0"),He(e,"role",n?"menuitemradio":"radio"),M(this._watchValue.bind(this))}onConnect(e){this._addToGroup(),$a(e,this._onPress.bind(this)),me(this._onDisconnect.bind(this))}_onDisconnect(){qt(()=>{dt(kS).remove(this._controller)},this.connectScope)}_addToGroup(){dt(kS).add(this._controller)}_watchValue(){let{value:e}=this.$props,n=e();B(this._checked)&&this._controller._onCheck?.(n)}_onPress(e){B(this._checked)||(this._onChange(!0,e),this._onSelect(e),this._controller._onCheck?.(B(this.$props.value),e))}_check(e,n){B(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})}};Kc.props={value:""};Qq([be],Kc.prototype,"checked",1);Xq=Object.defineProperty,Zq=Object.getOwnPropertyDescriptor,NS=(t,e,n,r)=>{for(var i=r>1?void 0:r?Zq(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&Xq(e,n,i),i},Vs=class extends le{constructor(){super(),this._index=J(0),this._track=J(null),this._cues=J([]),this._controller=new Ia,this._controller._onValueChange=this._onValueChange.bind(this)}get value(){return this._controller.value}get disabled(){return!this._cues()?.length}onSetup(){this._media=Le(),zr(sn)&&(this._menu=dt(sn));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,r=e(),i=n()||1/0;return this._cues().map((o,a)=>({cue:o,value:a.toString(),label:o.text,startTime:Aa(Math.max(0,o.startTime-r)),duration:Qp(Math.min(i,o.endTime)-Math.max(r,o.startTime))}))}_onOpen(){B(()=>this._watchCurrentTime())}onConnect(e){M(this._watchValue.bind(this)),M(this._watchCurrentTime.bind(this)),M(this._watchControllerDisabled.bind(this)),M(this._watchTrack.bind(this)),Yc(this._media.textTracks,"chapters",this._track.set)}_watchTrack(){let e=this._track();if(!e)return;let n=this._onCuesChange.bind(this,e);return n(),z(e,"add-cue",n),z(e,"remove-cue",n),()=>{this._cues.set([])}}_onCuesChange(e){let{clipStartTime:n,clipEndTime:r}=this._media.$state,i=n(),o=r()||1/0;this._cues.set([...e.cues].filter(a=>a.startTime<=o&&a.endTime>=i))}_watchValue(){this._controller.value=this._getValue()}_watchCurrentTime(){if(!this._menu?._expanded())return;if(!this._track()){this._index.set(-1);return}let{realCurrentTime:n,clipStartTime:r,clipEndTime:i}=this._media.$state,o=r(),a=i()||1/0,s=n(),l=this._cues().findIndex(c=>zy(c,s));if(this._index.set(l),l>=0){let c=this._cues()[l],u=this.el.querySelector("[aria-checked='true']"),d=Math.max(o,c.startTime),p=Math.min(a,c.endTime)-d,f=Math.max(0,s-d)/p*100;u&&on(u,"--progress",An(f,3)+"%")}}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_getValue(){return this._index().toString()}_onValueChange(e,n){if(this.disabled||!n)return;let r=+e,i=this._cues(),{clipStartTime:o}=this._media.$state;$t(r)&&i?.[r]&&(this._index.set(r),this._media.remote.seek(i[r].startTime-o(),n),this.dispatch("change",{detail:i[r],trigger:n}))}};Vs.props={thumbnails:null};NS([be],Vs.prototype,"value",1);NS([be],Vs.prototype,"disabled",1);NS([pt],Vs.prototype,"getOptions",1);Jq=Object.defineProperty,eK=Object.getOwnPropertyDescriptor,VS=(t,e,n,r)=>{for(var i=r>1?void 0:r?eK(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&Jq(e,n,i),i},zs=class extends le{get value(){return this._controller.value}get disabled(){let{audioTracks:e}=this._media.$state;return e().length<=1}constructor(){super(),this._controller=new Ia,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=Le(),zr(sn)&&(this._menu=dt(sn))}onConnect(e){M(this._watchValue.bind(this)),M(this._watchControllerDisabled.bind(this)),M(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,r=n();this._menu?._hint.set(r?.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 r=this._media.audioTracks.toArray().findIndex(i=>i.label.toLowerCase()===e);if(r>=0){let i=this._media.audioTracks[r];this._media.remote.changeAudioTrack(r,n),this.dispatch("change",{detail:i,trigger:n})}}};zs.props={emptyLabel:"Default"};VS([be],zs.prototype,"value",1);VS([be],zs.prototype,"disabled",1);VS([pt],zs.prototype,"getOptions",1);tK=Object.defineProperty,nK=Object.getOwnPropertyDescriptor,zS=(t,e,n,r)=>{for(var i=r>1?void 0:r?nK(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&tK(e,n,i),i},Us=class extends le{get value(){return this._controller.value}get disabled(){let{hasCaptions:e}=this._media.$state;return!e()}constructor(){super(),this._controller=new Ia,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=Le(),zr(sn)&&(this._menu=dt(sn))}onConnect(e){super.onConnect?.(e),M(this._watchValue.bind(this)),M(this._watchControllerDisabled.bind(this)),M(this._watchHintText.bind(this))}getOptions(){let{offLabel:e}=this.$props,{textTracks:n}=this._media.$state;return[{value:"off",label:e},...n().filter(It).map(r=>({track:r,label:r.label,value:this._getTrackValue(r)}))]}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{offLabel:e}=this.$props,{textTrack:n}=this._media.$state,r=n();this._menu?._hint.set(r&&It(r)&&r.mode==="showing"?r.label:e())}_watchControllerDisabled(){this._menu?._disable(this.disabled)}_getValue(){let{textTrack:e}=this._media.$state,n=e();return n&&It(n)&&n.mode==="showing"?this._getTrackValue(n):"off"}_onValueChange(e,n){if(this.disabled)return;if(e==="off"){let i=this._media.textTracks.selected;if(i){let o=this._media.textTracks.toArray().indexOf(i);this._media.remote.changeTextTrackMode(o,"disabled",n),this.dispatch("change",{detail:null,trigger:n})}return}let r=this._media.textTracks.toArray().findIndex(i=>this._getTrackValue(i)===e);if(r>=0){let i=this._media.textTracks[r];this._media.remote.changeTextTrackMode(r,"showing",n),this.dispatch("change",{detail:i,trigger:n})}}_getTrackValue(e){return e.id+":"+e.kind+"-"+e.label.toLowerCase()}};Us.props={offLabel:"Off"};zS([be],Us.prototype,"value",1);zS([be],Us.prototype,"disabled",1);zS([pt],Us.prototype,"getOptions",1);rK=Object.defineProperty,iK=Object.getOwnPropertyDescriptor,US=(t,e,n,r)=>{for(var i=r>1?void 0:r?iK(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&rK(e,n,i),i},EF=[.25,.5,.75,1,1.25,1.5,1.75,2],Bs=class extends le{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 Ia,this._controller._onValueChange=this._onValueChange.bind(this)}onSetup(){this._media=Le(),zr(sn)&&(this._menu=dt(sn))}onConnect(e){M(this._watchValue.bind(this)),M(this._watchHintText.bind(this)),M(this._watchControllerDisabled.bind(this))}getOptions(){let{rates:e,normalLabel:n}=this.$props;return e().map(r=>({label:r===1?n:r+"\xD7",value:r.toString()}))}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{normalLabel:e}=this.$props,{playbackRate:n}=this._media.$state,r=n();this._menu?._hint.set(r===1?e():r+"\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 r=+e;this._media.remote.changePlaybackRate(r,n),this.dispatch("change",{detail:r,trigger:n})}};Bs.props={normalLabel:"Normal",rates:EF};US([be],Bs.prototype,"value",1);US([be],Bs.prototype,"disabled",1);US([pt],Bs.prototype,"getOptions",1);oK=Object.defineProperty,aK=Object.getOwnPropertyDescriptor,BS=(t,e,n,r)=>{for(var i=r>1?void 0:r?aK(e,n):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=(r?a(e,n,i):a(i))||i);return r&&i&&oK(e,n,i),i},js=class extends le{constructor(){super(),this._sortedQualities=Fi(()=>{let{qualities:e}=this._media.$state;return[...e()].sort((n,r)=>r.height===n.height?r.bitrate-n.bitrate:r.height-n.height)}),this._controller=new Ia,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(),zr(sn)&&(this._menu=dt(sn))}onConnect(e){M(this._watchValue.bind(this)),M(this._watchControllerDisabled.bind(this)),M(this._watchHintText.bind(this))}getOptions(){let{autoLabel:e,hideBitrate:n}=this.$props;return[{value:"auto",label:e},...this._sortedQualities().map(r=>{let i=r.bitrate>=0?`${An(r.bitrate/1e6,2)} Mbps`:null;return{quality:r,label:r.height+"p",value:this._getQualityId(r),bitrate:()=>n()?null:i}})]}_watchValue(){this._controller.value=this._getValue()}_watchHintText(){let{autoLabel:e}=this.$props,{autoQuality:n,quality:r}=this._media.$state,i=r()?r().height+"p":"";this._menu?._hint.set(n()?e()+(i?` (${i})`:""):i)}_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:r}=this._media.$state,i=B(r).findIndex(o=>this._getQualityId(o)===e);if(i>=0){let o=B(r)[i];this._media.remote.changeQuality(i,n),this.dispatch("change",{detail:o,trigger:n})}}_getValue(){let{quality:e,autoQuality:n}=this._media.$state;if(n())return"auto";let r=e();return r?this._getQualityId(r):"auto"}_getQualityId(e){return e.height+"_"+e.bitrate}};js.props={autoLabel:"Auto",hideBitrate:!1};BS([be],js.prototype,"value",1);BS([be],js.prototype,"disabled",1);BS([pt],js.prototype,"getOptions",1);bv=class extends le{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]"),M(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"),z(this._provider,e,this._acceptEvent.bind(this),{passive:!1}))}_acceptEvent(e){if(this.$props.disabled()||kp(e)&&(e.button!==0||this._media.activeMenu)||Pc(e)&&this._media.activeMenu||IS(e)||!this._inBounds(e))return;if(e.MEDIA_GESTURE=!0,e.preventDefault(),!B(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(B(this.$props.action),e),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})}_inBounds(e){if(!this.el)return!1;if(kp(e)||iT(e)||Pc(e)){let n=Pc(e)?e.changedTouches[0]??e.touches[0]:void 0,r=n?.clientX??e.clientX,i=n?.clientY??e.clientY,o=this.el.getBoundingClientRect(),a=i>=o.top&&i<=o.bottom&&r>=o.left&&r<=o.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,r)=>+getComputedStyle(r).zIndex-+getComputedStyle(n).zIndex)[0]===this.el}_performAction(e,n){if(!e)return;let r=new ae("will-trigger",{detail:e,cancelable:!0,trigger:n});if(this.dispatchEvent(r),r.defaultPrevented)return;let[i,o]=e.replace(/:([a-z])/,"-$1").split(":");e.includes(":fullscreen")?this._media.remote.toggleFullscreen("prefer-media",n):e.includes("seek:")?this._media.remote.seek(B(this._media.$state.currentTime)+(+o||0),n):this._media.remote[ay(i)](n),this.dispatch("trigger",{detail:e,trigger:n})}};bv.props={disabled:!1,event:void 0,action:void 0};TS=class{constructor(e){this._renderer=e,this.priority=10,this._track=null,this._disposal=Ep()}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(z(e,"load",()=>this._changeTrack(e),{once:!0}))):this._changeTrack(e),this._disposal.add(z(e,"add-cue",n=>{this._renderer.addCue(n.detail)}),z(e,"remove-cue",n=>{this._renderer.removeCue(n.detail)})),this._track=e)}_changeTrack(e){this._renderer.changeTrack({cues:[...e.cues],regions:[...e.regions]})}},_v=class extends le{onSetup(){this._media=Le(),this.setAttributes({"aria-hidden":Qn(this._isHidden.bind(this))})}onAttach(e){e.style.setProperty("pointer-events","none")}onConnect(e){if(this._renderer){M(this._watchViewType.bind(this));return}Promise.resolve().then(()=>(Op(),Ap)).then(n=>{this.connectScope&&qt(()=>{this._lib=n;let{CaptionsRenderer:r}=this._lib;this._renderer=new r(e),this._textRenderer=new TS(this._renderer),M(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,r=e();return this._media.$iosControls()||n()==="connected"||!r||!It(r)}_watchViewType(){let{viewType:e}=this._media.$state;return e()==="audio"?this._setupAudioView():this._setupVideoView()}_setupAudioView(){return M(this._onTrackChange.bind(this)),()=>{this.el.textContent=""}}_onTrackChange(){if(this._isHidden())return;let{textTrack:e}=this._media.$state;this._onCueChange(),z(e(),"cue-change",this._onCueChange.bind(this)),M(this._onUpdateTimedNodes.bind(this))}_onCueChange(){this.el.textContent="";let{realCurrentTime:e,textTrack:n}=this._media.$state,r=B(e),i=B(n).activeCues,{renderVTTCueString:o}=this._lib;for(let a of i){let s=document.createElement("div");s.setAttribute("data-part","cue"),s.innerHTML=o(a,r),this.el.append(s)}}_onUpdateTimedNodes(){let{realCurrentTime:e}=this._media.$state,{updateTimedVTTCueNodes:n}=this._lib;n(this.el,e())}_setupVideoView(){return M(this._watchTextDirection.bind(this)),M(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()}};_v.props={textDir:"ltr"};ef=class extends le{constructor(){super(...arguments),this._prevSrc=""}onSetup(){this._media=Le(),this._watchSrc(),this._watchAlt(),this._watchCrossOrigin(),this._watchHidden()}onAttach(e){e.style.setProperty("pointer-events","none"),M(this._watchImg.bind(this)),M(this._watchSrc.bind(this)),M(this._watchAlt.bind(this)),M(this._watchCrossOrigin.bind(this)),M(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){M(this._onPreconnect.bind(this)),M(this._onLoadStart.bind(this))}_hasError(){let{error:e}=this.$state;return!Di(e())}_onPreconnect(){let{canLoadPoster:e,poster:n}=this._media.$state;!e()&&n()&&pi(n(),"preconnect")}_watchHidden(){let{src:e}=this.$props,{$iosControls:n}=this._media,{poster:r}=this._media.$state;this.el&&he(this.el,"display",n()?"none":null),this.$state.hidden.set(this._hasError()||!(e()||r())||n())}_isLoading(){let{loading:e,hidden:n}=this.$state;return!n()&&e()}_watchImg(){let e=this.$state.img();e&&(z(e,"load",this._onLoad.bind(this)),z(e,"error",this._onError.bind(this)))}_watchSrc(){let{poster:e}=this._media.$props,{canLoadPoster:n,providedPoster:r,inferredPoster:i}=this._media.$state,o=this.$props.src()||"",a=o||e()||i();this._prevSrc===r()&&r.set(o),this.$state.src.set(n()&&a.length?a:null),this._prevSrc=o}_watchAlt(){let{src:e}=this.$props,{alt:n}=this.$state,{poster:r}=this._media.$state;n.set(e()||r()?this.$props.alt():null)}_watchCrossOrigin(){let{crossOrigin:e}=this.$props,{crossOrigin:n}=this.$state,{crossOrigin:r,poster:i}=this._media.$state,o=e()!==null?e():r();n.set(/ytimg\.com|vimeo/.test(i()||"")?null:o===!0?"anonymous":o)}_onLoadStart(){let{loading:e,error:n}=this.$state,{canLoadPoster:r,poster:i}=this._media.$state;e.set(r()&&!!i()),n.set(null)}_onLoad(){let{loading:e,error:n}=this.$state;e.set(!1),n.set(null)}_onError(e){let{loading:n,error:r}=this.$state;n.set(!1),r.set(e)}};ef.props={src:null,alt:null,crossOrigin:null};ef.state=new ui({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});tf=class extends le{constructor(){super(...arguments),this._invert=J(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")||M(this._watchRole.bind(this)),M(this._watchTime.bind(this))}onConnect(e){M(()=>{if(!this.$props.toggle()){this._invert.set(null);return}$a(e,this._onToggle.bind(this))})}_watchTime(){let{type:e,padHours:n,padMinutes:r,showHours:i}=this.$props,o=this._getSeconds(e()),a=this._media.$state.duration(),s=this._shouldInvert();if(!Number.isFinite(o+a)){this.$state.timeText.set("LIVE");return}let l=s?Math.max(0,a-o):o,c=Aa(l,{padHrs:n(),padMins:r(),showHrs:i()});this.$state.timeText.set((s?"-":"")+c)}_watchRole(){if(!this.el)return;let{toggle:e}=this.$props;he(this.el,"role",e()?"timer":null),he(this.el,"tabindex",e()?0:null)}_getSeconds(e){let{bufferedEnd:n,duration:r,currentTime:i}=this._media.$state;switch(e){case"buffered":return n();case"duration":return r();default:return i()}}_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)}};tf.props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1};tf.state=new ui({timeText:""});sK=Ni(),lK={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]},SS=class extends le{onSetup(){this._media=Le(),$n(sK,{...this.$props,previewTime:J(0)})}};SS.props=lK;Hs=class extends vq{},kv=class extends Bc{},nf=class extends rv{},rf=class extends iv{},Tv=class extends Gp{},of=class extends dv{},af=class extends pv{},sf=class extends gv{},lf=class extends fv{},cf=class extends hv{},uf=class extends uv{},df=class extends lv{},pf=class extends cv{},ff=class extends mv{},hf=class extends av{},mf=class extends sv{},gf=class extends Kp{},yf=class extends So{},vf=class extends Wc{},xf=class extends Zp{},wf=class extends vv{},bf=class extends Hc{},_f=class extends Ds{},kf=class extends Xp{},Tf=class extends Eo{},Sf=class extends Po{},Ef=class extends Ns{},Pf=class extends Jp{},Cf=class extends xv{},Mf=class extends qc{},Rf=class extends Kc{},$f=class extends _v{},If=class extends bv{},Sv=class extends ef{},Gc=class extends jc{},Lf=class extends tf{},PF=Ze.forwardRef((t,e)=>{let{children:n,...r}=t,i=Ze.Children.toArray(n),o=i.find(uK);if(o){let a=o.props.children,s=i.map(l=>l===o?Ze.Children.count(a)>1?Ze.Children.only(null):Ze.isValidElement(a)?a.props.children:null:l);return Ze.createElement(ES,{...r,ref:e},Ze.isValidElement(a)?Ze.cloneElement(a,void 0,s):null)}return Ze.createElement(ES,{...r,ref:e},n)});PF.displayName="Slot";ES=Ze.forwardRef((t,e)=>{let{children:n,...r}=t;return Ze.isValidElement(n)?Ze.cloneElement(n,{...dK(r,n.props),ref:e?Pe(e,n.ref):n.ref}):Ze.Children.count(n)>1?Ze.Children.only(null):null});ES.displayName="SlotClone";cK=({children:t})=>Ze.createElement(Ze.Fragment,null,t);pK=["button","div","span","img","video","audio"],oe=pK.reduce((t,e)=>{let n=Ze.forwardRef((r,i)=>{let{asChild:o,...a}=r;return Ze.createElement(o?PF:e,{...a,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});BO=Hs.state.record,fK=Object.keys(BO).reduce((t,e)=>({...t,[e](){return BO[e]}}),{})});var WF={};Ot(WF,{default:()=>vG});var vG,qF=rt(()=>{"use strict";"use client";vG='<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 $2=Jt((pwe,R2)=>{"use strict";var LJ={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"}};R2.exports=LJ});var mE=Jt((fwe,F2)=>{"use strict";var Yf=$2(),I2={},vx={},L2=[],A2=[],O2=[];for(let t in Yf){let{name:e,nativeName:n}=Yf[t];I2[t]=vx[e.toLowerCase()]=vx[n.toLowerCase()]={code:t,name:e,nativeName:n},L2.push(t),A2.push(e),O2.push(n)}F2.exports=class yx{static getLanguages(e=[]){return e.map(n=>yx.validate(n)?Object.assign({},I2[n]):{code:n,name:"",nativeName:""})}static getName(e){return yx.validate(e)?Yf[e].name:""}static getAllNames(){return A2.slice()}static getNativeName(e){return yx.validate(e)?Yf[e].nativeName:""}static getAllNativeNames(){return O2.slice()}static getCode(e){return e=e.toLowerCase(),vx.hasOwnProperty(e)?vx[e].code:""}static getAllCodes(){return L2.slice()}static validate(e){return Yf.hasOwnProperty(e)}}});var SV=Jt(Jx=>{"use strict";var pte=K(),fte=Symbol.for("react.element"),hte=Symbol.for("react.fragment"),mte=Object.prototype.hasOwnProperty,gte=pte.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,yte={key:!0,ref:!0,__self:!0,__source:!0};function TV(t,e,n){var r,i={},o=null,a=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)mte.call(e,r)&&!yte.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:fte,type:t,key:o,ref:a,props:i,_owner:gte.current}}Jx.Fragment=hte;Jx.jsx=TV;Jx.jsxs=TV});var ie=Jt((ike,EV)=>{"use strict";EV.exports=SV()});var H4=Jt((WIe,j4)=>{"use strict";var xb=Object.prototype.hasOwnProperty,B4=Object.prototype.toString,F4=Object.defineProperty,D4=Object.getOwnPropertyDescriptor,N4=function(e){return typeof Array.isArray=="function"?Array.isArray(e):B4.call(e)==="[object Array]"},V4=function(e){if(!e||B4.call(e)!=="[object Object]")return!1;var n=xb.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&xb.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||xb.call(e,i)},z4=function(e,n){F4&&n.name==="__proto__"?F4(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},U4=function(e,n){if(n==="__proto__")if(xb.call(e,n)){if(D4)return D4(e,n).value}else return;return e[n]};j4.exports=function t(){var e,n,r,i,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(n in e)r=U4(s,n),i=U4(e,n),s!==i&&(u&&i&&(V4(i)||(o=N4(i)))?(o?(o=!1,a=r&&N4(r)?r:[]):a=r&&V4(r)?r:{},z4(s,{name:n,newValue:t(u,a,i)})):typeof i<"u"&&z4(s,{name:n,newValue:i}));return s}});var s6={};Ot(s6,{SRTParser:()=>Tb,default:()=>aae});function aae(){return new Tb}var iae,oae,Tb,l6=rt(()=>{"use strict";jh();iae=/,/g,oae="-->",Tb=class extends Ku{parse(e,n){if(e==="")this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null),this.c=qu.None;else if(this.c===qu.Cue)this.a.text+=(this.a.text?`
|
|
`:"")+e;else if(e.includes(oae)){let r=this.o(e,n);r&&(this.a=new rs(r[0],r[1],r[2].join(" ")),this.a.id=this.l,this.c=qu.Cue)}this.l=e}o(e,n){return super.o(e.replace(iae,"."),n)}}});var N1={};Ot(N1,{ParseErrorBuilder:()=>sae});var sae,V1=rt(()=>{"use strict";jh();sae={p(){return new br({code:Ti.BadSignature,reason:"missing WEBVTT file header",line:1})},q(t,e){return new br({code:Ti.BadTimestamp,reason:`cue start timestamp \`${t}\` is invalid on line ${e}`,line:e})},r(t,e){return new br({code:Ti.BadTimestamp,reason:`cue end timestamp \`${t}\` is invalid on line ${e}`,line:e})},s(t,e,n){return new br({code:Ti.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${t}\` on line ${n}`,line:n})},w(t,e,n){return new br({code:Ti.BadSettingValue,reason:`invalid value for cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},v(t,e,n){return new br({code:Ti.UnknownSetting,reason:`unknown cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},u(t,e,n){return new br({code:Ti.BadSettingValue,reason:`invalid value for region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},t(t,e,n){return new br({code:Ti.UnknownSetting,reason:`unknown region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},N(t,e){return new br({code:Ti.BadFormat,reason:`format missing for \`${t}\` block on line ${e}`,line:e})}}});var h6={};Ot(h6,{SSAParser:()=>Pb,default:()=>lae});function U1(t){let e=parseInt(t.replace("&H",""),16);if(e>=0){let r=(e>>24&255^255)/255,i=e>>16&255,o=e>>8&255;return"rgba("+[e&255,o,i,r].join(",")+")"}return null}function B1(t,e,n){let r=Math.ceil(2*Math.PI*t),i="";for(let o=0;o<r;o++){let a=2*Math.PI*o/r;i+=t*Math.cos(a)+"px "+e*Math.sin(a)+"px 0 "+n+(o==r-1?"":",")}return i}function lae(){return new Pb}var Sb,c6,u6,Eb,d6,p6,f6,z1,Pb,m6=rt(()=>{"use strict";jh();Sb=/^Format:[\s\t]*/,c6=/^Style:[\s\t]*/,u6=/^Dialogue:[\s\t]*/,Eb=/[\s\t]*,[\s\t]*/,d6=/\{[^}]+\}/g,p6=/\\N/g,f6=/^\[(.*)[\s\t]?Styles\]$/,z1=/^\[(.*)[\s\t]?Events\]$/,Pb=class{constructor(){T(this,"f");T(this,"P",0);T(this,"a",null);T(this,"j",[]);T(this,"k",[]);T(this,"O",null);T(this,"d");T(this,"Q",{})}async init(e){this.f=e,e.errors&&(this.d=(await Promise.resolve().then(()=>(V1(),N1))).ParseErrorBuilder)}parse(e,n){if(this.P)switch(this.P){case 1:if(e==="")this.P=0;else if(c6.test(e))if(this.O){let r=e.replace(c6,"").split(Eb);this.T(r)}else this.e(this.d?.N("Style",n));else Sb.test(e)?this.O=e.replace(Sb,"").split(Eb):z1.test(e)&&(this.O=null,this.P=2);break;case 2:if(e==="")this.R();else if(u6.test(e))if(this.R(),this.O){let r=e.replace(u6,"").split(Eb),i=this.U(r,n);i&&(this.a=i)}else this.e(this.d?.N("Dialogue",n));else this.a?this.a.text+=`
|
|
`+e.replace(d6,"").replace(p6,`
|
|
`):Sb.test(e)?this.O=e.replace(Sb,"").split(Eb):f6.test(e)?(this.O=null,this.P=1):z1.test(e)&&(this.O=null)}else e===""||(f6.test(e)?(this.O=null,this.P=1):z1.test(e)&&(this.O=null,this.P=2))}done(){return{metadata:{},cues:this.j,regions:[],errors:this.k}}R(){this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null)}T(e){let n="Default",r={},i,o="center",a="bottom",s,l=1.2,c,u,d=3,p=[];for(let f=0;f<this.O.length;f++){let h=this.O[f],g=e[f];switch(h){case"Name":n=g;break;case"Fontname":r["font-family"]=g;break;case"Fontsize":r["font-size"]=`calc(${g} / var(--overlay-height))`;break;case"PrimaryColour":let x=U1(g);x&&(r["--cue-color"]=x);break;case"BorderStyle":d=parseInt(g,10);break;case"BackColour":u=U1(g);break;case"OutlineColour":let m=U1(g);m&&(c=m);break;case"Bold":parseInt(g)&&(r["font-weight"]="bold");break;case"Italic":parseInt(g)&&(r["font-style"]="italic");break;case"Underline":parseInt(g)&&(r["text-decoration"]="underline");break;case"StrikeOut":parseInt(g)&&(r["text-decoration"]="line-through");break;case"Spacing":r["letter-spacing"]=g+"px";break;case"AlphaLevel":r.opacity=parseFloat(g);break;case"ScaleX":p.push(`scaleX(${parseFloat(g)/100})`);break;case"ScaleY":p.push(`scaleY(${parseFloat(g)/100})`);break;case"Angle":p.push(`rotate(${g}deg)`);break;case"Shadow":l=parseInt(g,10)*1.2;break;case"MarginL":r["--cue-width"]="auto",r["--cue-left"]=parseFloat(g)+"px";break;case"MarginR":r["--cue-width"]="auto",r["--cue-right"]=parseFloat(g)+"px";break;case"MarginV":s=parseFloat(g);break;case"Outline":i=parseInt(g,10);break;case"Alignment":let y=parseInt(g,10);switch(y>=4&&(a=y>=7?"top":"center"),y%3){case 1:o="start";break;case 2:o="center";break;case 3:o="end";break}}}if(r.S=a,r["--cue-white-space"]="normal",r["--cue-line-height"]="normal",r["--cue-text-align"]=o,a==="center"?(r["--cue-top"]="50%",p.push("translateY(-50%)")):r[`--cue-${a}`]=(s||0)+"px",d===1&&(r["--cue-padding-y"]="0"),(d===1||u)&&(r["--cue-bg-color"]=d===1?"none":u),d===3&&c&&(r["--cue-outline"]=`${i}px solid ${c}`),d===1&&typeof i=="number"){let f=u??"#000";r["--cue-text-shadow"]=[c&&B1(i*1.2,l*1.2,c),c?B1(i*(i/2),l*(i/2),f):B1(i,l,f)].filter(Boolean).join(", ")}p.length&&(r["--cue-transform"]=p.join(" ")),this.Q[n]=r}U(e,n){let r=this.V(e),i=this.o(r.Start,r.End,n);if(!i)return;let o=new rs(i[0],i[1],""),a={...this.Q[r.Style]||{}},s=r.Name?`<v ${r.Name}>`:"",l=a.S,c=r.MarginL&&parseFloat(r.MarginL),u=r.MarginR&&parseFloat(r.MarginR),d=r.MarginV&&parseFloat(r.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"),o.text=s+e.slice(this.O.length-1).join(", ").replace(d6,"").replace(p6,`
|
|
`),delete a.S,Object.keys(a).length&&(o.style=a),o}V(e){let n={};for(let r=0;r<this.O.length;r++)n[this.O[r]]=e[r];return n}o(e,n,r){let i=vl(e),o=vl(n);if(i!==null&&o!==null&&o>i)return[i,o];i===null&&this.e(this.d?.q(e,r)),o===null&&this.e(this.d?.r(n,r)),i!=null&&o!==null&&o>i&&this.e(this.d?.s(i,o,r))}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}}});async function j1(t,e){let n=new ReadableStream({start(r){let i=t.split(cae);for(let o of i)r.enqueue(o);r.close()}});return x6(n,e)}async function x6(t,e){let n=e?.type??"vtt",r;if(typeof n=="string")switch(n){case"srt":r=(await Promise.resolve().then(()=>(l6(),s6))).default;break;case"ssa":case"ass":r=(await Promise.resolve().then(()=>(m6(),h6))).default;break;default:r=(await Promise.resolve().then(function(){return Cae})).default}else r=n;let i,o=t.getReader(),a=r(),s=!!e?.strict||!!e?.errors;await a.init({strict:!1,...e,errors:s,type:n,cancel(){o.cancel(),i=a.done(!0)}});let l=1;for(;;){let{value:c,done:u}=await o.read();if(u){a.parse("",l),i=a.done(!1);break}a.parse(c,l),l++}return i}function fae(t){let e=parseInt(t,10);return Number.isNaN(e)?null:e}function Wh(t){let e=parseInt(t.replace(pae,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function y6(t){if(!t.includes(g6))return null;let[e,n]=t.split(g6).map(Wh);return e!==null&&n!==null?[e,n]:null}function hae(t){let e=parseFloat(t);return Number.isNaN(e)?null:e}function vl(t){let e=t.match(Eae);if(!e)return null;let n=e[1]?parseInt(e[1],10):0,r=parseInt(e[2],10),i=parseInt(e[3],10),o=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,a=n*3600+r*60+i+o/1e3;return n<0||r<0||i<0||o<0||r>59||i>59?null:a}function Pae(){return new Ku}var Ti,br,cae,Cb,uae,dae,rs,Mb,g6,pae,mae,v6,gae,Gu,yae,vae,xae,wae,Hh,bae,_ae,kae,Tae,Sae,Eae,qu,Ku,Cae,Mae,QLe,XLe,ZLe,jh=rt(()=>{"use strict";Ti={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5},br=class extends Error{constructor(n){super(n.reason);T(this,"code");T(this,"line");this.code=n.code,this.line=n.line}},cae=/\r?\n|\r/gm;Cb=class extends EventTarget{constructor(n,r,i){super();T(this,"id","");T(this,"startTime");T(this,"endTime");T(this,"text");T(this,"pauseOnExit",!1);this.startTime=n,this.endTime=r,this.text=i}addEventListener(n,r,i){super.addEventListener(n,r,i)}removeEventListener(n,r,i){super.removeEventListener(n,r,i)}},uae=typeof document>"u",dae=uae?Cb:window.VTTCue,rs=class extends dae{constructor(){super(...arguments);T(this,"region",null);T(this,"vertical","");T(this,"snapToLines",!0);T(this,"line","auto");T(this,"lineAlign","start");T(this,"position","auto");T(this,"positionAlign","auto");T(this,"size",100);T(this,"align","center");T(this,"style")}},Mb=class{constructor(){T(this,"id","");T(this,"width",100);T(this,"lines",3);T(this,"regionAnchorX",0);T(this,"regionAnchorY",100);T(this,"viewportAnchorX",0);T(this,"viewportAnchorY",100);T(this,"scroll","")}},g6=",",pae="%";mae="WEBVTT",v6=",",gae="%",Gu=/[:=]/,yae=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,vae="NOTE",xae="REGION",wae=/^REGION:?[\s\t]+/,Hh=/[\s\t]+/,bae="-->",_ae=/[\s\t]*-->[\s\t]+/,kae=/start|center|end|left|right/,Tae=/start|center|end/,Sae=/line-(?:left|right)|center|auto/,Eae=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/,qu=(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))(qu||{}),Ku=class{constructor(){T(this,"f");T(this,"c",0);T(this,"g",{});T(this,"h",{});T(this,"j",[]);T(this,"a",null);T(this,"b",null);T(this,"k",[]);T(this,"d");T(this,"l","")}async init(e){this.f=e,e.strict&&(this.c=1),e.errors&&(this.d=(await Promise.resolve().then(()=>(V1(),N1))).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 r=this.a.text.length>0;!r&&yae.test(e)?this.m(e.split(Hh),n):this.a.text+=(r?`
|
|
`:"")+e}break;case 3:this.n(e.split(Hh),n);break}else if(e.startsWith(vae))this.c=4;else if(e.startsWith(xae))this.c=3,this.b=new Mb,this.n(e.replace(wae,"").split(Hh),n);else if(e.includes(bae)){let r=this.o(e,n);r&&(this.a=new rs(r[0],r[1],""),this.a.id=this.l,this.m(r[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(Gu.test(e)){let[r,i]=e.split(Gu);r&&(this.g[r]=(i||"").replace(Hh,""))}}else e.startsWith(mae)?this.c=1:this.e(this.d?.p())}o(e,n){let[r,i=""]=e.split(_ae),[o,...a]=i.split(Hh),s=vl(r),l=vl(o);if(s!==null&&l!==null&&l>s)return[s,l,a];s===null&&this.e(this.d?.q(r,n)),l===null&&this.e(this.d?.r(o,n)),s!=null&&l!==null&&l>s&&this.e(this.d?.s(s,l,n))}n(e,n){let r;for(let i=0;i<e.length;i++)if(Gu.test(e[i])){r=!1;let[o,a]=e[i].split(Gu);switch(o){case"id":this.b.id=a;break;case"width":let s=Wh(a);s!==null?this.b.width=s:r=!0;break;case"lines":let l=fae(a);l!==null?this.b.lines=l:r=!0;break;case"regionanchor":let c=y6(a);c!==null?(this.b.regionAnchorX=c[0],this.b.regionAnchorY=c[1]):r=!0;break;case"viewportanchor":let u=y6(a);u!==null?(this.b.viewportAnchorX=u[0],this.b.viewportAnchorY=u[1]):r=!0;break;case"scroll":a==="up"?this.b.scroll="up":r=!0;break;default:this.e(this.d?.t(o,a,n))}r&&this.e(this.d?.u(o,a,n))}}m(e,n){let r;for(let i=0;i<e.length;i++)if(r=!1,Gu.test(e[i])){let[o,a]=e[i].split(Gu);switch(o){case"region":let s=this.h[a];s&&(this.a.region=s);break;case"vertical":a==="lr"||a==="rl"?(this.a.vertical=a,this.a.region=null):r=!0;break;case"line":let[l,c]=a.split(v6);if(l.includes(gae)){let h=Wh(l);h!==null?(this.a.line=h,this.a.snapToLines=!1):r=!0}else{let h=hae(l);h!==null?this.a.line=h:r=!0}Tae.test(c)?this.a.lineAlign=c:c&&(r=!0),this.a.line!=="auto"&&(this.a.region=null);break;case"position":let[u,d]=a.split(v6),p=Wh(u);p!==null?this.a.position=p:r=!0,d&&Sae.test(d)?this.a.positionAlign=d:d&&(r=!0);break;case"size":let f=Wh(a);f!==null?(this.a.size=f,f<100&&(this.a.region=null)):r=!0;break;case"align":kae.test(a)?this.a.align=a:r=!0;break;default:this.e(this.d?.v(o,a,n))}r&&this.e(this.d?.w(o,a,n))}}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}};Cae=Object.freeze({__proto__:null,VTTBlock:qu,VTTParser:Ku,default:Pae,parseVTTTimestamp:vl}),Mae={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},QLe=new Set(Object.keys(Mae)),XLe=Symbol(0),ZLe=Symbol(0)});var Yse={};Ot(Yse,{default:()=>Jb});module.exports=RB(Yse);var GC=require("obsidian");function n_(t,e){let n={};for(let r of e)r in t&&(n[r]=t[r]);return n}function em(t,e){let n={...t};for(let r of e)delete n[r];return n}var r_={bilibili:"https://www.bilibili.com",youtube:"https://www.youtube.com",vimeo:"https://www.vimeo.com",coursera:"https://www.coursera.org"},tm={bilibili:"bilibili",youtube:"YouTube",generic:"Website",vimeo:"Vimeo",coursera:"Coursera"},KC=t=>em(t,["generic"]);var $B={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($B).forEach(([t,e])=>{e&&(0,GC.addIcon)(t,e)});var e_=require("obsidian");function yt(t,e){let n=Object.keys(e).map(r=>IB(t,r,e[r]));return n.length===1?n[0]:function(){n.forEach(r=>r())}}function IB(t,e,n){let r=t[e],i=t.hasOwnProperty(e),o=n(r);return r&&Object.setPrototypeOf(o,r),Object.setPrototypeOf(a,o),t[e]=a,s;function a(...l){return o===r&&t[e]===a&&s(),o.apply(this,l)}function s(){t[e]===a&&(i?t[e]=r:delete t[e]),o!==r&&(o=r,Object.setPrototypeOf(a,r||Function))}}var Er=require("obsidian");var QC=require("obsidian");var ud={video:["mp4","webm","ogv","mov","mkv"],audio:["mp3","wav","m4a","3gp","flac","ogg","oga","opus"]},Go=t=>[...ud[t]],i_={video:new Set(ud.video),audio:new Set(ud.audio)};function Ft(t){t=t.replace(/^\./,"").toLowerCase();for(let e of LB)if(i_[e].has(t))return e;return null}function o_(t){return i_.video.has(t)||i_.audio.has(t)}var YC=[...ud.video,...ud.audio],LB=["video","audio"];function Se(t){return t?.file instanceof QC.TFile}function Si(t,e){if(!t)return null;let n=Ft(t.extension);return n?{type:n,file:t,hash:e}:null}function Ct(t){return Se(t)?`file:${t.file.path}`:`url:${t.jsonState.source}`}var rM=require("obsidian");function XC(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 ZC(t,e){let n=e.getCursor("from");console.debug("insert before cursor [from]",n.ch,n.line),e.replaceRange(t,n,n)}var pd=require("obsidian");var dd={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.:]+)$/},Sr=({start:t,end:e})=>t>=0&&e<0;function Dn(t){if(!t)return null;let n=new URLSearchParams(t.replace(/^#+/,"")).get("t");if(!n)return null;let r=n.match(dd.main);if(!r)return null;let{start:i,end:o}=r.groups;return AB(i,o)}var AB=(t,e)=>{let n=t||null,r=e??null,i,o;if(n&&r)i=nm(n),o=r==="e"?1/0:nm(r);else if(n)i=nm(n),o=-1;else if(r)i=-1,o=nm(r);else throw console.error("Missing startTime and endTime",t,e),new Error("Missing startTime and endTime");return i===null||o===null?null:{start:i,end:o}};function nm(t){let e=t.match(dd.npt_time);if(!e)return null;let n=e[1],r=n.match(dd.npt_sec);if(r)return Number(r[0]);let i=n.match(dd.npt_mmss);if(i){let{mm:a,ss:s}=i.groups;return Number(a)*60+Number(s)}let o=n.match(dd.npt_hhmmss);if(o){let{hh:a,mm:s,ss:l}=o.groups;return Number(a)*60*60+Number(s)*60+Number(l)}return null}function Yo(t){return t===0?"00:00":pd.moment.utc(pd.moment.duration({seconds:t}).as("milliseconds")).format("HH:mm:ss").replace(/^00:/,"")}function tM(t){return t===0?"DT0S":pd.moment.duration(t,"seconds").toISOString()}var JC=(t,e=2)=>{let n,r;return Number.isInteger(t)?n=t.toString():[n,r]=t.toFixed(e).split("."),n.length===1&&(n="0"+n),r?n+"."+r:n};function fd(t){return t.replace(/t=[^&]+/,"")}function a_(t,e){if(t=fd(t.trim().replace(/^#/,"")),!e)return t;let n=s_(e);return t?`${t}&${n}`:n??""}function nM(t,e){let n=Number.isNaN(t)?-1:t,r=Number.isNaN(e)?-1:e;return{start:n,end:r}}function s_(t){let{start:e,end:n}=t,r={get start(){return eM(e)},get end(){return eM(n)}};return Sr(t)?`t=${r.start}`:e<0&&n>0?Number.isFinite(n)?`t=,${r.end}`:null:e>0&&n>0?`t=${r.start},${r.end}`:null}function eM(t){if(Number.isNaN(t)||t<0)throw new Error("durationInSecond must be positive");if(t===1/0)return"e";let e=pd.moment.duration(t,"seconds"),n=e.hours(),r=e.minutes(),i=e.seconds()+e.milliseconds()/1e3;if(n>0)return[n,...[r,i].map(o=>JC(o))].join(":");if(r>0)return[r,i].map(o=>JC(o)).join(":");if(i>0)return i.toFixed(2);throw new Error("durationInSecond must be positive")}function El({timestamp:t,screenshot:e},{template:n,editor:r,insertBefore:i}){console.debug("insert timestamp",{timestamp:t,screenshot:e,template:n});let o=n.replace("{{TIMESTAMP}}",t);e&&(o=o.replace("{{SCREENSHOT}}",e)),console.debug("content to insert",o);try{console.debug(`inserting timestamp ${i?"before":"after"} cursor`),i?ZC(o,r):XC(o,r)}catch(a){new rM.Notice("Failed to insert timestamp, see console for details"),console.error("Failed to insert timestamp",a)}}function Qo(t,e,{app:{fileManager:n},settings:{timestampOffset:r},duration:i=1/0}){t+=r,t<0?t=0:t>i&&(t=i);let o=Yo(t),a=t>0?{start:t,end:-1}:void 0,s=a?`#${s_(a)}`:"";if(Se(e)){let{file:l}=e;return c=>n.generateMarkdownLink(l,c,s,o).replace(/^!/,"")}else{let l=e.print(a);return()=>`[${o}](${l}${s})`}}var rm=class extends Er.Component{constructor(n){super();this.plugin=n;T(this,"_recording",null);T(this,"_recordedEditors",new Map)}onload(){this.rec||console.info("recorder not found, skip patching for recorder note"),this.patch(),this.addCommand()}get app(){return this.plugin.app}get rec(){return this.app.internalPlugins.plugins["audio-recorder"]}get settings(){return this.plugin.settings.getState()}onunload(){this._recordedEditors.clear()}async onRecordingSaved(n){if(!this._recording)return;let{start:r}=this._recording;this._recording=null;let i=Si(n,"");if(!i){new Er.Notice("Failed to get media info from the saved file: "+n.path);return}for(let o of this._recordedEditors){let a=o[0],s=()=>{},l=o[1];if(!a.containerEl.isConnected){if(!l){new Er.Notice("One of the note with timestamp is closed, the timestamp will not be updated");continue}if(a=DB(l,this.app),!a){let c=this.app.workspace.getLeaf("tab");if(await c.openFile(l,{state:{mode:"source"}}),!(c.view instanceof Er.MarkdownView)){new Er.Notice("Failed to open note for timestamp update: "+l.path);continue}a=c.view.editor,s=()=>c.detach()}}try{let c=a.getValue().replaceAll(OB(r),(u,d)=>{let p=parseInt(d,10);return Qo(p/1e3,i,{app:this.app,settings:this.plugin.settings.getState()})(l?.path??"")});a.setValue(c)}catch(c){console.error("failed to insert timestamp",c)}finally{s()}}this._recordedEditors.clear()}patch(){if(!this.rec.instance)return;let n=this.rec.instance,r=this,{vault:i,workspace:o}=this.app;this.register(yt(n,{saveRecording(a){return function(...s){o.getLeaf("split").setViewState({type:"empty",active:!0});let l=a.apply(this,s),c=()=>i.off("create",d),u=window.setTimeout(c,3e5),d=p=>{p instanceof Er.TFile?r.onRecordingSaved(p):console.error("unexpected folder"),c(),window.clearTimeout(u)};return i.on("create",d),l}},startRecording(a){return function(...s){let l=a.apply(this,s),c=this.recorder;if(r._recording={start:Date.now()},console.debug("recording start called",r._recording.start),c&&c instanceof MediaRecorder){c.addEventListener("start",()=>{r._recording={start:Date.now()},console.debug("recording started in MediaRecorder",r._recording.start)},{once:!0});let u=()=>{r._recording&&(r._recording.end=Date.now(),console.debug("recording stopped in MediaRecorder",r._recording.end)),c.removeEventListener("stop",u),c.removeEventListener("error",u)};c.addEventListener("stop",u,{once:!0}),c.addEventListener("error",u,{once:!0})}return l}}}))}addCommand(){this.plugin.addCommand({id:"take-rec-timestamp",name:"Take timestamp on current recording",editorCheckCallback:(n,r,i)=>{if(!this._recording)return!1;if(n)return!0;let{start:o,notified:a}=this._recording;!a&&!i.file&&(new Er.Notice("You've taken a timestamp for the recording, probably in canvas node, keep editor in foreground and in live preview mode. Otherwise, the dummy timestamp cannot be updated when recording is saved."),this._recording.notified=!0);let s=FB(o,Date.now()-o);El({timestamp:s},{editor:r,template:this.settings.timestampTemplate,insertBefore:this.settings.insertBefore}),this._recordedEditors.set(r,i.file)}})}};function OB(t){return new RegExp(`%%REC_${t}_(?<offset>\\d+)%%`,"g")}function FB(t,e){return`%%REC_${t}_${e}%%`}function DB(t,e){let n=null;return e.workspace.iterateAllLeaves(r=>{r.view instanceof Er.MarkdownView&&t.path===r.view.file?.path&&r.view.getMode()==="source"&&(n=r.view)}),n?.editor}var YM=$(hd()),bm=require("obsidian");var vd=class{constructor(t,e,n,r,i,o){T(this,"type",3);T(this,"name","");T(this,"prefix","");T(this,"value","");T(this,"suffix","");T(this,"modifier",3);this.type=t,this.name=e,this.prefix=n,this.value=r,this.suffix=i,this.modifier=o}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},NB=/[$_\p{ID_Start}]/u,VB=/[$_\u200C\u200D\p{ID_Continue}]/u,c_=".*";function zB(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function cM(t,e=!1){let n=[],r=0;for(;r<t.length;){let i=t[r],o=function(a){if(!e)throw new TypeError(a);n.push({type:"INVALID_CHAR",index:r,value:t[r++]})};if(i==="*"){n.push({type:"ASTERISK",index:r,value:t[r++]});continue}if(i==="+"||i==="?"){n.push({type:"OTHER_MODIFIER",index:r,value:t[r++]});continue}if(i==="\\"){n.push({type:"ESCAPED_CHAR",index:r++,value:t[r++]});continue}if(i==="{"){n.push({type:"OPEN",index:r,value:t[r++]});continue}if(i==="}"){n.push({type:"CLOSE",index:r,value:t[r++]});continue}if(i===":"){let a="",s=r+1;for(;s<t.length;){let l=t.substr(s,1);if(s===r+1&&NB.test(l)||s!==r+1&&VB.test(l)){a+=t[s++];continue}break}if(!a){o(`Missing parameter name at ${r}`);continue}n.push({type:"NAME",index:r,value:a}),r=s;continue}if(i==="("){let a=1,s="",l=r+1,c=!1;if(t[l]==="?"){o(`Pattern cannot start with "?" at ${l}`);continue}for(;l<t.length;){if(!zB(t[l],!1)){o(`Invalid character '${t[l]}' at ${l}.`),c=!0;break}if(t[l]==="\\"){s+=t[l++]+t[l++];continue}if(t[l]===")"){if(a--,a===0){l++;break}}else if(t[l]==="("&&(a++,t[l+1]!=="?")){o(`Capturing groups are not allowed at ${l}`),c=!0;break}s+=t[l++]}if(c)continue;if(a){o(`Unbalanced pattern at ${r}`);continue}if(!s){o(`Missing pattern at ${r}`);continue}n.push({type:"REGEX",index:r,value:s}),r=l;continue}n.push({type:"CHAR",index:r,value:t[r++]})}return n.push({type:"END",index:r,value:""}),n}function uM(t,e={}){let n=cM(t);e.delimiter??(e.delimiter="/#?"),e.prefixes??(e.prefixes="./");let r=`[^${Pr(e.delimiter)}]+?`,i=[],o=0,a=0,s="",l=new Set,c=v=>{if(a<n.length&&n[a].type===v)return n[a++].value},u=()=>c("OTHER_MODIFIER")??c("ASTERISK"),d=v=>{let w=c(v);if(w!==void 0)return w;let{type:k,index:b}=n[a];throw new TypeError(`Unexpected ${k} at ${b}, expected ${v}`)},p=()=>{let v="",w;for(;w=c("CHAR")??c("ESCAPED_CHAR");)v+=w;return v},f=v=>v,h=e.encodePart||f,g="",x=v=>{g+=v},m=()=>{g.length&&(i.push(new vd(3,"","",h(g),"",3)),g="")},y=(v,w,k,b,S)=>{let C=3;switch(S){case"?":C=1;break;case"*":C=0;break;case"+":C=2;break}if(!w&&!k&&C===3){x(v);return}if(m(),!w&&!k){if(!v)return;i.push(new vd(3,"","",h(v),"",C));return}let R;k?k==="*"?R=c_:R=k:R=r;let _=2;R===r?(_=1,R=""):R===c_&&(_=0,R="");let D;if(w?D=w:k&&(D=o++),l.has(D))throw new TypeError(`Duplicate name '${D}'.`);l.add(D),i.push(new vd(_,D,h(v),R,h(b),C))};for(;a<n.length;){let v=c("CHAR"),w=c("NAME"),k=c("REGEX");if(!w&&!k&&(k=c("ASTERISK")),w||k){let S=v??"";e.prefixes.indexOf(S)===-1&&(x(S),S=""),m();let C=u();y(S,w,k,"",C);continue}let b=v??c("ESCAPED_CHAR");if(b){x(b);continue}if(c("OPEN")){let S=p(),C=c("NAME"),R=c("REGEX");!C&&!R&&(R=c("ASTERISK"));let _=p();d("CLOSE");let D=u();y(S,C,R,_,D);continue}m(),d("END")}return i}function Pr(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function oM(t){return t&&t.ignoreCase?"ui":"u"}function UB(t,e,n){return dM(uM(t,n),e,n)}function Cl(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function dM(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 r=n.start?"^":"";for(let s of t){if(s.type===3){s.modifier===3?r+=Pr(s.value):r+=`(?:${Pr(s.value)})${Cl(s.modifier)}`;continue}e&&e.push(s.name);let l=`[^${Pr(n.delimiter)}]+?`,c=s.value;if(s.type===1?c=l:s.type===0&&(c=c_),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?r+=`(${c})${Cl(s.modifier)}`:r+=`((?:${c})${Cl(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){r+=`(?:${Pr(s.prefix)}(${c})${Pr(s.suffix)})`,r+=Cl(s.modifier);continue}r+=`(?:${Pr(s.prefix)}`,r+=`((?:${c})(?:`,r+=Pr(s.suffix),r+=Pr(s.prefix),r+=`(?:${c}))*)${Pr(s.suffix)})`,s.modifier===0&&(r+="?")}let i=`[${Pr(n.endsWith)}]|$`,o=`[${Pr(n.delimiter)}]`;if(n.end)return n.strict||(r+=`${o}?`),n.endsWith.length?r+=`(?=${i})`:r+="$",new RegExp(r,oM(n));n.strict||(r+=`(?:${o}(?=${i}))?`);let a=!1;if(t.length){let s=t[t.length-1];s.type===3&&s.modifier===3&&(a=n.delimiter.indexOf(s)>-1)}return a||(r+=`(?=${o}|${i})`),new RegExp(r,oM(n))}var Zo={delimiter:"",prefixes:"",sensitive:!0,strict:!0},BB={delimiter:".",prefixes:"",sensitive:!0,strict:!0},jB={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function HB(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function pM(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function WB(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function fM(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}var hM=["ftp","file","http","https","ws","wss"];function mM(t){if(!t)return!0;for(let e of hM)if(t.test(e))return!0;return!1}function qB(t,e){if(t=pM(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 KB(t,e){if(t=pM(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 GB(t,e){return e||t===""?t:fM(t)?vM(t):yM(t)}function YB(t,e){if(e||t==="")return t;let n=new URL("https://example.com");return n.password=t,n.password}function QB(t,e){if(e||t==="")return t;let n=new URL("https://example.com");return n.username=t,n.username}function XB(t,e,n){if(n||t==="")return t;if(e&&!hM.includes(e))return new URL(`${e}:${t}`).pathname;let r=t[0]=="/";return t=new URL(r?t:"/-"+t,"https://example.com").pathname,r||(t=t.substring(2,t.length)),t}function ZB(t,e,n){return gM(e)===t&&(t=""),n||t===""?t:xM(t)}function JB(t,e){return t=WB(t,":"),e||t===""?t:p_(t)}function gM(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function p_(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function ej(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function tj(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function yM(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 vM(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function xM(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function nj(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 rj(t){return t===""?t:new URL(`data:${t}`).pathname}function ij(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function oj(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}var Ml,kn,Bt,Ye,ls,Rl,tr,$l,Il,Ll,vt,Dt,lm,wM,xd,u_,cs,gd,Al,om,Nn,Cr,wd,d_,cm,bM,Ol,am,um,_M,dm,kM,Fl,sm,Jo,Pl,ro,ss,pm,TM,fm,SM,hm,EM,mm,PM,Mr,Ei,gm,CM,sM,aj=(sM=class{constructor(t){Z(this,vt);Z(this,lm);Z(this,xd);Z(this,cs);Z(this,Al);Z(this,Nn);Z(this,wd);Z(this,cm);Z(this,Ol);Z(this,um);Z(this,dm);Z(this,Fl);Z(this,Jo);Z(this,ro);Z(this,pm);Z(this,fm);Z(this,hm);Z(this,mm);Z(this,Mr);Z(this,gm);Z(this,Ml,void 0);Z(this,kn,[]);Z(this,Bt,{});Z(this,Ye,0);Z(this,ls,1);Z(this,Rl,0);Z(this,tr,0);Z(this,$l,0);Z(this,Il,0);Z(this,Ll,!1);Ue(this,Ml,t)}get result(){return L(this,Bt)}parse(){for(Ue(this,kn,cM(L(this,Ml),!0));L(this,Ye)<L(this,kn).length;Ue(this,Ye,L(this,Ye)+L(this,ls))){if(Ue(this,ls,1),L(this,kn)[L(this,Ye)].type==="END"){if(L(this,tr)===0){V(this,xd,u_).call(this),V(this,ro,ss).call(this)?V(this,vt,Dt).call(this,9,1):V(this,Jo,Pl).call(this)?V(this,vt,Dt).call(this,8,1):V(this,vt,Dt).call(this,7,0);continue}else if(L(this,tr)===2){V(this,cs,gd).call(this,5);continue}V(this,vt,Dt).call(this,10,0);break}if(L(this,$l)>0)if(V(this,fm,SM).call(this))Ue(this,$l,L(this,$l)-1);else continue;if(V(this,pm,TM).call(this)){Ue(this,$l,L(this,$l)+1);continue}switch(L(this,tr)){case 0:V(this,wd,d_).call(this)&&V(this,cs,gd).call(this,1);break;case 1:if(V(this,wd,d_).call(this)){V(this,gm,CM).call(this);let t=7,e=1;V(this,cm,bM).call(this)?(t=2,e=3):L(this,Ll)&&(t=2),V(this,vt,Dt).call(this,t,e)}break;case 2:V(this,Ol,am).call(this)?V(this,cs,gd).call(this,3):(V(this,Fl,sm).call(this)||V(this,Jo,Pl).call(this)||V(this,ro,ss).call(this))&&V(this,cs,gd).call(this,5);break;case 3:V(this,um,_M).call(this)?V(this,vt,Dt).call(this,4,1):V(this,Ol,am).call(this)&&V(this,vt,Dt).call(this,5,1);break;case 4:V(this,Ol,am).call(this)&&V(this,vt,Dt).call(this,5,1);break;case 5:V(this,hm,EM).call(this)?Ue(this,Il,L(this,Il)+1):V(this,mm,PM).call(this)&&Ue(this,Il,L(this,Il)-1),V(this,dm,kM).call(this)&&!L(this,Il)?V(this,vt,Dt).call(this,6,1):V(this,Fl,sm).call(this)?V(this,vt,Dt).call(this,7,0):V(this,Jo,Pl).call(this)?V(this,vt,Dt).call(this,8,1):V(this,ro,ss).call(this)&&V(this,vt,Dt).call(this,9,1);break;case 6:V(this,Fl,sm).call(this)?V(this,vt,Dt).call(this,7,0):V(this,Jo,Pl).call(this)?V(this,vt,Dt).call(this,8,1):V(this,ro,ss).call(this)&&V(this,vt,Dt).call(this,9,1);break;case 7:V(this,Jo,Pl).call(this)?V(this,vt,Dt).call(this,8,1):V(this,ro,ss).call(this)&&V(this,vt,Dt).call(this,9,1);break;case 8:V(this,ro,ss).call(this)&&V(this,vt,Dt).call(this,9,1);break;case 9:break;case 10:break}}L(this,Bt).hostname!==void 0&&L(this,Bt).port===void 0&&(L(this,Bt).port="")}},Ml=new WeakMap,kn=new WeakMap,Bt=new WeakMap,Ye=new WeakMap,ls=new WeakMap,Rl=new WeakMap,tr=new WeakMap,$l=new WeakMap,Il=new WeakMap,Ll=new WeakMap,vt=new WeakSet,Dt=function(t,e){var n,r,i;switch(L(this,tr)){case 0:break;case 1:L(this,Bt).protocol=V(this,Mr,Ei).call(this);break;case 2:break;case 3:L(this,Bt).username=V(this,Mr,Ei).call(this);break;case 4:L(this,Bt).password=V(this,Mr,Ei).call(this);break;case 5:L(this,Bt).hostname=V(this,Mr,Ei).call(this);break;case 6:L(this,Bt).port=V(this,Mr,Ei).call(this);break;case 7:L(this,Bt).pathname=V(this,Mr,Ei).call(this);break;case 8:L(this,Bt).search=V(this,Mr,Ei).call(this);break;case 9:L(this,Bt).hash=V(this,Mr,Ei).call(this);break;case 10:break}L(this,tr)!==0&&t!==10&&([1,2,3,4].includes(L(this,tr))&&[6,7,8,9].includes(t)&&((n=L(this,Bt)).hostname??(n.hostname="")),[1,2,3,4,5,6].includes(L(this,tr))&&[8,9].includes(t)&&((r=L(this,Bt)).pathname??(r.pathname=L(this,Ll)?"/":"")),[1,2,3,4,5,6,7].includes(L(this,tr))&&t===9&&((i=L(this,Bt)).search??(i.search=""))),V(this,lm,wM).call(this,t,e)},lm=new WeakSet,wM=function(t,e){Ue(this,tr,t),Ue(this,Rl,L(this,Ye)+e),Ue(this,Ye,L(this,Ye)+e),Ue(this,ls,0)},xd=new WeakSet,u_=function(){Ue(this,Ye,L(this,Rl)),Ue(this,ls,0)},cs=new WeakSet,gd=function(t){V(this,xd,u_).call(this),Ue(this,tr,t)},Al=new WeakSet,om=function(t){return t<0&&(t=L(this,kn).length-t),t<L(this,kn).length?L(this,kn)[t]:L(this,kn)[L(this,kn).length-1]},Nn=new WeakSet,Cr=function(t,e){let n=V(this,Al,om).call(this,t);return n.value===e&&(n.type==="CHAR"||n.type==="ESCAPED_CHAR"||n.type==="INVALID_CHAR")},wd=new WeakSet,d_=function(){return V(this,Nn,Cr).call(this,L(this,Ye),":")},cm=new WeakSet,bM=function(){return V(this,Nn,Cr).call(this,L(this,Ye)+1,"/")&&V(this,Nn,Cr).call(this,L(this,Ye)+2,"/")},Ol=new WeakSet,am=function(){return V(this,Nn,Cr).call(this,L(this,Ye),"@")},um=new WeakSet,_M=function(){return V(this,Nn,Cr).call(this,L(this,Ye),":")},dm=new WeakSet,kM=function(){return V(this,Nn,Cr).call(this,L(this,Ye),":")},Fl=new WeakSet,sm=function(){return V(this,Nn,Cr).call(this,L(this,Ye),"/")},Jo=new WeakSet,Pl=function(){if(V(this,Nn,Cr).call(this,L(this,Ye),"?"))return!0;if(L(this,kn)[L(this,Ye)].value!=="?")return!1;let t=V(this,Al,om).call(this,L(this,Ye)-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"},ro=new WeakSet,ss=function(){return V(this,Nn,Cr).call(this,L(this,Ye),"#")},pm=new WeakSet,TM=function(){return L(this,kn)[L(this,Ye)].type=="OPEN"},fm=new WeakSet,SM=function(){return L(this,kn)[L(this,Ye)].type=="CLOSE"},hm=new WeakSet,EM=function(){return V(this,Nn,Cr).call(this,L(this,Ye),"[")},mm=new WeakSet,PM=function(){return V(this,Nn,Cr).call(this,L(this,Ye),"]")},Mr=new WeakSet,Ei=function(){let t=L(this,kn)[L(this,Ye)],e=V(this,Al,om).call(this,L(this,Rl)).index;return L(this,Ml).substring(e,t.index)},gm=new WeakSet,CM=function(){let t={};Object.assign(t,Zo),t.encodePart=p_;let e=UB(V(this,Mr,Ei).call(this),void 0,t);Ue(this,Ll,mM(e))},sM),l_=["protocol","username","password","hostname","port","pathname","search","hash"],Xo="*";function aM(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 no(t,e){return e?yd(t):t}function md(t,e,n){let r;if(typeof e.baseURL=="string")try{r=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=no(r.protocol.substring(0,r.protocol.length-1),n)),!n&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=no(r.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=no(r.password,n)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=no(r.hostname,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=no(r.port,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=no(r.pathname,n)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=no(r.search.substring(1,r.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=no(r.hash.substring(1,r.hash.length),n))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=JB(e.protocol,n)),typeof e.username=="string"&&(t.username=QB(e.username,n)),typeof e.password=="string"&&(t.password=YB(e.password,n)),typeof e.hostname=="string"&&(t.hostname=GB(e.hostname,n)),typeof e.port=="string"&&(t.port=ZB(e.port,t.protocol,n)),typeof e.pathname=="string"){if(t.pathname=e.pathname,r&&!HB(t.pathname,n)){let i=r.pathname.lastIndexOf("/");i>=0&&(t.pathname=no(r.pathname.substring(0,i+1),n)+t.pathname)}t.pathname=XB(t.pathname,t.protocol,n)}return typeof e.search=="string"&&(t.search=KB(e.search,n)),typeof e.hash=="string"&&(t.hash=qB(e.hash,n)),t}function yd(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function sj(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function lj(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=".*",r=`[^${sj(e.delimiter)}]+?`,i=/[$_\u200C\u200D\p{ID_Continue}]/u,o="";for(let a=0;a<t.length;++a){let s=t[a];if(s.type===3){if(s.modifier===3){o+=yd(s.value);continue}o+=`{${yd(s.value)}}${Cl(s.modifier)}`;continue}let l=s.hasCustomName(),c=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!e.prefixes.includes(s.prefix)),u=a>0?t[a-1]:null,d=a<t.length-1?t[a+1]:null;if(!c&&l&&s.type===1&&s.modifier===3&&d&&!d.prefix.length&&!d.suffix.length)if(d.type===3){let p=d.value.length>0?d.value[0]:"";c=i.test(p)}else c=!d.hasCustomName();if(!c&&!s.prefix.length&&u&&u.type===3){let p=u.value[u.value.length-1];c=e.prefixes.includes(p)}c&&(o+="{"),o+=yd(s.prefix),l&&(o+=`:${s.name}`),s.type===2?o+=`(${s.value})`:s.type===1?l||(o+=`(${r})`):s.type===0&&(!l&&(!u||u.type===3||u.modifier!==3||c||s.prefix!=="")?o+="*":o+=`(${n})`),s.type===1&&l&&s.suffix.length&&i.test(s.suffix[0])&&(o+="\\"),o+=yd(s.suffix),c&&(o+="}"),s.modifier!==3&&(o+=Cl(s.modifier))}return o}var Pi,us,Dl,jt,ei,Nl,lM,ym=(lM=class{constructor(t={},e,n){Z(this,Pi,void 0);Z(this,us,{});Z(this,Dl,{});Z(this,jt,{});Z(this,ei,{});Z(this,Nl,!1);try{let r;if(typeof e=="string"?r=e:n=e,typeof t=="string"){let s=new aj(t);if(s.parse(),t=s.result,r===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=r}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(r)throw new TypeError("parameter 1 is not of type 'string'.")}typeof n>"u"&&(n={ignoreCase:!1});let i={ignoreCase:n.ignoreCase===!0};Ue(this,Pi,md({pathname:Xo,protocol:Xo,username:Xo,password:Xo,hostname:Xo,port:Xo,search:Xo,hash:Xo},t,!0)),gM(L(this,Pi).protocol)===L(this,Pi).port&&(L(this,Pi).port="");let a;for(a of l_){if(!(a in L(this,Pi)))continue;let s={},l=L(this,Pi)[a];switch(L(this,Dl)[a]=[],a){case"protocol":Object.assign(s,Zo),s.encodePart=p_;break;case"username":Object.assign(s,Zo),s.encodePart=ej;break;case"password":Object.assign(s,Zo),s.encodePart=tj;break;case"hostname":Object.assign(s,BB),fM(l)?s.encodePart=vM:s.encodePart=yM;break;case"port":Object.assign(s,Zo),s.encodePart=xM;break;case"pathname":mM(L(this,us).protocol)?(Object.assign(s,jB,i),s.encodePart=nj):(Object.assign(s,Zo,i),s.encodePart=rj);break;case"search":Object.assign(s,Zo,i),s.encodePart=ij;break;case"hash":Object.assign(s,Zo,i),s.encodePart=oj;break}try{L(this,ei)[a]=uM(l,s),L(this,us)[a]=dM(L(this,ei)[a],L(this,Dl)[a],s),L(this,jt)[a]=lj(L(this,ei)[a],s),Ue(this,Nl,L(this,Nl)||L(this,ei)[a].some(c=>c.type===2))}catch{throw new TypeError(`invalid ${a} pattern '${L(this,Pi)[a]}'.`)}}}catch(r){throw new TypeError(`Failed to construct 'URLPattern': ${r.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=md(n,t,!1):n=md(n,aM(t,e),!1)}catch{return!1}let r;for(r of l_)if(!L(this,us)[r].exec(n[r]))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=md(n,t,!1):n=md(n,aM(t,e),!1)}catch{return null}let r={};e?r.inputs=[t,e]:r.inputs=[t];let i;for(i of l_){let o=L(this,us)[i].exec(n[i]);if(!o)return null;let a={};for(let[s,l]of L(this,Dl)[i].entries())if(typeof l=="string"||typeof l=="number"){let c=o[s+1];a[l]=c}r[i]={input:n[i]??"",groups:a}}return r}static compareComponent(t,e,n){let r=(s,l)=>{for(let c of["type","modifier","prefix","value","suffix"]){if(s[c]<l[c])return-1;if(s[c]!==l[c])return 1}return 0},i=new vd(3,"","","","",3),o=new vd(0,"","","","",3),a=(s,l)=>{let c=0;for(;c<Math.min(s.length,l.length);++c){let u=r(s[c],l[c]);if(u)return u}return s.length===l.length?0:r(s[c]??i,l[c]??i)};return!L(e,jt)[t]&&!L(n,jt)[t]?0:L(e,jt)[t]&&!L(n,jt)[t]?a(L(e,ei)[t],[o]):!L(e,jt)[t]&&L(n,jt)[t]?a([o],L(n,ei)[t]):a(L(e,ei)[t],L(n,ei)[t])}get protocol(){return L(this,jt).protocol}get username(){return L(this,jt).username}get password(){return L(this,jt).password}get hostname(){return L(this,jt).hostname}get port(){return L(this,jt).port}get pathname(){return L(this,jt).pathname}get search(){return L(this,jt).search}get hash(){return L(this,jt).hash}get hasRegExpGroups(){return L(this,Nl)}},Pi=new WeakMap,us=new WeakMap,Dl=new WeakMap,jt=new WeakMap,ei=new WeakMap,Nl=new WeakMap,lM);globalThis.URLPattern||(globalThis.URLPattern=ym);var nr={video:"mx-url-video",audio:"mx-url-audio"},cj=new Set(Object.values(nr));function uj(t){return cj.has(t)}var ds="mx-embed",Rr="mx-webpage",Vn={video:"mx-file-video",audio:"mx-file-audio"},dj=new Set(Object.values(Vn));function pj(t){return dj.has(t)}function fj(t){return uj(t)||ds===t||Rr===t}function f_(t){return pj(t)||fj(t)}var MM=new Set([nr.video,Vn.video,Rr]);var GM=require("url"),xm=require("obsidian");var RM=require("obsidian"),hj=RM.Platform.isWin?require("path/win32"):require("path/posix"),en=hj;function ea(t){return ti(t).href}function ti(t){let e=new URL(t);return e.hash="",e}function rr(t){try{return new URL(t)}catch{return null}}function Ci(t){let e=new URL(t.href),n=fd(e.hash);return e.hash===n?t:e}function IM(t){return t.hostname==="b23.tv"?!1:t.hostname!=="bilibili.com"&&!t.hostname.endsWith(".bilibili.com")?null:t.pathname.startsWith("/video/")||t.pathname.startsWith("/bangumi/play/")?t.pathname.split("/").filter(Boolean).slice(-1)[0]:null}var LM=t=>IM(t)===null?null:"bilibili",AM=t=>{let e=IM(t);if(e===null)throw new Error("Invalid bilibili url");let n=Dn(t.hash),r=mj(t),i=ti(t);i.hostname==="bilibili.com"&&(i.hostname="www.bilibili.com"),i.searchParams.forEach((s,l,c)=>{l==="p"&&s!=="1"||c.delete(l)}),i.searchParams.sort();let o=i.searchParams.get("p")??"1",a=new URL(i);return!n&&r>0&&(n={start:r,end:-1}),n&&Sr(n)&&(a=$M(a,n)),a=Ci(a),{source:a,cleaned:i,tempFrag:n,print:s=>$M(a,s).href,id:`${o}@${e}`||void 0}};function $M(t,e){let n=new URL(t.href);return n.searchParams.set("t",String(e.start)),n}function mj(t){let e=t.searchParams.get("t"),n=e?Number(e):NaN;return Number.isNaN(n)?NaN:n}var OM=t=>t.hostname==="www.coursera.org"?"coursera":null,FM=t=>{let e=ti(t);e.search="";let n=new URL(t);return{cleaned:e,source:Ci(n),tempFrag:Dn(t.hash)}};var DM=require("obsidian");var NM=t=>({type:"generic",cleaned:ti(t),source:Ci(t.protocol==="file:"?gj(t):t),tempFrag:Dn(t.hash)});function gj(t){let e=new URL(DM.Platform.resourcePathPrefix+t.href.substring(8));return e.search=Date.now().toString(),e}var VM=t=>t.hostname!=="vimeo.com"||!t.pathname.substring(1).match(/^\d+$/)?null:"vimeo",zM=t=>{let e=t.pathname.substring(1);if(!e.match(/^\d+$/))throw new Error("Invalid vimeo url");let n=ti(t);n.search="";let r=new URL(t);return{cleaned:n,source:Ci(r),tempFrag:Dn(t.hash),id:e}};function jM(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 HM=t=>jM(t)?"youtube":null,WM=t=>{let e=Dn(t.hash),n=h_(t.searchParams.get("t")),r=h_(t.searchParams.get("start")),i=h_(t.searchParams.get("end")),o=jM(t);if(!o)throw new Error("Invalid youtube url");let a=ti("https://www.youtube.com/watch");a.search=new URLSearchParams({v:o}).toString();let s=new URL(a);return t.searchParams.has("list")&&s.searchParams.set("list",t.searchParams.get("list")),e||(r>0&&i>0?e=nM(r,i):r>0?e={start:r,end:1/0}:i>0?e={start:0,end:i}:n>0&&(e={start:n,end:-1})),e&&(s=UM(s,e)),s=Ci(s),{source:s,cleaned:a,tempFrag:e,print:l=>UM(s,l).href,id:o}};function UM(t,e){let n=new URL(t),r=BM(e.start),i=BM(e.end);return Sr(e)||e.start>0&&e.end>0&&r===i?n.searchParams.set("t",r):(e.start>0&&n.searchParams.set("start",r),e.end>0&&n.searchParams.set("end",i)),n}function BM(t){return t.toFixed(0)}function h_(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)?$/,r=t.match(n);if(!r)return NaN;let{h:i,m:o,s:a}=r.groups,s=i?Number(i):0,l=o?Number(o):0,c=a?Number(a):0;return s*3600+l*60+c}function qM(t){let e=yj.reduce((r,i)=>r??i(t),null)??"generic",n=vj[e](t);return{type:e,resolved:n}}var yj=[LM,HM,VM,OM],vj={bilibili:AM,youtube:WM,vimeo:zM,coursera:FM,generic:NM};function KM(t,{getUrlMapping:e},n){if(!t)return null;if(t.protocol!=="mx:")return o(t);let[,,r]=t.pathname.split("/"),i=e(r);if(!i)return null;return o(t.href.replace(`mx://${r}/`,i.replace(/\/*$/,"/")),t);function o(a,s){let l=xt.create(a,s);if(!l)return null;if(!l.isFileUrl)return l;let c=l.getVaultFile(n.vault);return c?Ft(c.extension)===null?null:Si(c,l.hash):l.inferredType===null?null:l}}var xj=new Set(["https:","http:","file:"]),Mi,vm=class vm extends URL{constructor(n,r){super(n);Z(this,Mi,void 0);T(this,"type");T(this,"mxUrl");if(this.mxUrl=r?new URL(r):null,!xj.has(this.protocol))throw new Error("Unsupported protocol: "+this.protocol);let{type:i,resolved:o}=qM(this);Ue(this,Mi,o),this.type=i}static create(n,r){try{return new vm(n,r)}catch{return null}}get inferredType(){let n=this.pathname.split(".").pop();return n?Ft(n):null}get isFileUrl(){return this.protocol==="file:"}get filePath(){if(this.isFileUrl)try{return(0,GM.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 xm.FileSystemAdapter))return null;let r=this.filePath,i=n.adapter.getBasePath();if(!r)return null;let o=en.relative(i,r);if(/^\.\.[/\\]/.test(o)||en.isAbsolute(o))return null;let a=(0,xm.normalizePath)(o);return n.getFileByPath(a)}compare(n){return!!n&&this.jsonState.source===n.jsonState.source}print(n){return this.mxUrl?ea(this.mxUrl.href):n?L(this,Mi).print?L(this,Mi).print(n):this.jsonState.source:this.jsonState.source}get tempFrag(){return Dn(this.hash)}setTempFrag(n){let r=this.clone(),i=fd(this.hash);return n?r.hash=a_(i,n):r.hash=i,r}clone(){return new vm(this,this.mxUrl??void 0)}get readableHref(){return decodeURI(this.href)}get source(){return L(this,Mi).source}get cleaned(){return L(this,Mi).cleaned}get id(){return L(this,Mi).id}get jsonState(){return{source:ea(this.mxUrl??this.cleaned),hash:a_(this.hash,L(this,Mi).tempFrag)}}};Mi=new WeakMap;var xt=vm;var bd,m_,wm=class extends bm.Component{constructor(n){super();this.plugin=n;Z(this,bd);T(this,"matcher");V(this,bd,m_).call(this)}onload(){let n=(0,bm.debounce)(()=>V(this,bd,m_).call(this),500,!0);this.register(this.plugin.settings.subscribe((r,i)=>{r.linkHandler!==i.linkHandler&&n()}))}getPreferred(n,r){let i=this.getSupported(n),o=null;for(let a of i)for(let s of this.matcher.get(a)){if(!s.test(n))continue;let l=wj(s);(!o||l>o.specifity)&&(o={type:a,specifity:l})}return o?.type??(r?null:i[0])}setPreferred(n,r){this.plugin.settings.getState().setLinkHandler(n,r)}getSupported(n){if(!(n instanceof xt))return[Vn[n.type]];if(n.type==="generic")switch(n.inferredType){case"video":return[nr.video,Rr];case"audio":return[nr.audio,Rr];default:return[Rr,nr.video,nr.audio]}switch(n.type){case"youtube":case"vimeo":return[Rr,ds];case"bilibili":case"coursera":return[Rr];default:(0,YM.assertNever)(n.type)}}};bd=new WeakSet,m_=function(){this.matcher=new Map(Object.entries(this.plugin.settings.getState().linkHandler).map(([n,r])=>[n,r.map(i=>new ym(i))]))};function wj(t){return["protocol","username","password","hostname","port","pathname","search","hash"].reduce((e,n)=>{let r=t[n];return e+(r!=="*"?1:0)},0)}var Mt=require("obsidian");function Vl(t,e){let n="target"in t?t.target:t;if(!n.instanceOf?.(HTMLElement))return;let r=n.getBoundingClientRect();return e.setParentElement(n).showAtPosition({x:r.x,y:r.bottom,width:r.width,overlap:!0,left:!0},n.doc)}var QM="mx-port";var zl=t=>`persist:mx-player-${t}`;var XM=require("obsidian");function _d(t){let e=require("@electron/remote"),n=zl(t);return n?e.session.fromPartition(n):(console.log("No partition, skip modifying session"),null)}var bj;function ps(){return XM.Platform.isDesktopApp?bj??(bj=require("fs/promises")):null}async function ZM(t){let e=ps();if(!e)throw new Error("fs not available");return await e.readFile(t,"utf-8")}function JM(t){return require("@electron/remote").webContents.fromId(t)}function _m(){return require("@electron/remote").dialog}function eR(t){return require("@electron/remote").require(t)}function tR(){return require("@electron/remote").app.getPath("userData")}var ta=class extends Mt.Modal{constructor(n){super(n);T(this,"navEl",this.contentEl.insertAdjacentElement("beforebegin",createDiv({cls:"mx-login-nav"})));T(this,"webview",createEl("webview",{attr:{partition:this.partition,allowpopups:""}}));T(this,"backButton",new Mt.ButtonComponent(this.navEl).setIcon("arrow-left").setTooltip("Back").setClass("mx-login-back").setDisabled(!0).onClick(()=>{try{this.webview.goBack()}catch(n){new Mt.Notice("Failed to go back, see console for details"),console.error("err go back",n)}}));T(this,"forwardButton",new Mt.ButtonComponent(this.navEl).setIcon("arrow-right").setTooltip("Forward").setClass("mx-login-forward").setDisabled(!0).onClick(()=>{try{this.webview.goForward()}catch(n){new Mt.Notice("Failed to go forward, see console for details"),console.error("err go forward",n)}}));T(this,"refreshButton",new Mt.ButtonComponent(this.navEl).setIcon("rotate-ccw").setTooltip("Refresh").setClass("mx-login-refresh").setDisabled(!0).onClick(()=>{try{this.webview.reload()}catch(n){new Mt.Notice("Failed to refresh, see console for details"),console.error("err refresh",n)}}));T(this,"addressBarForm",this.navEl.createEl("form"));T(this,"addressBar",new Mt.TextComponent(this.addressBarForm).then(n=>{n.inputEl.type="url",n.inputEl.placeholder="https://example.com",n.inputEl.classList.add("mx-login-address")}));T(this,"addressSubmit",new Mt.ButtonComponent(this.addressBarForm).setIcon("arrow-right-circle").then(n=>n.buttonEl.type="submit"));T(this,"moreOptionsButton",new Mt.ButtonComponent(this.navEl).setIcon("more-horizontal").setTooltip("More options").setClass("mx-login-more").onClick(n=>{let r=new Mt.Menu;this.onMoreOptions(r),Vl(n,r)}));T(this,"callbacks",[]);T(this,"handledWebcontents",new Set);this.containerEl.addClasses(["mx-login-modal"]),this.titleEl.style.display="none",this.buildWelcome()}get partition(){return zl(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 r=n.createEl("ul");r.createEl("li").setText("Enter the site address in the address bar");let i=r.createEl("li");i.setText("Select from a list of "),new Mt.DropdownComponent(i).addOptions({...KC(tm),".":"supported websites..."}).setValue(".").onChange(o=>{o in r_&&this.setUrl(r_[o])})}getSession(){return _d(this.app.appId)}onMoreOptions(n){n.addItem(r=>r.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 Mt.Notice("Cache cleared")}catch(o){new Mt.Notice("Failed to clear cache, see console for details"),console.error("err clear cache",o)}}))}setUrl(n){this.initWebview(),this.webview.src=n,this.addressBar.setValue(n)}register(n){this.callbacks.push(n)}registerWebviewEvent(n,r){this.webview.addEventListener(n,r),this.register(()=>this.webview.removeEventListener(n,r))}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),JM(n)?.setWindowOpenHandler(({url:i,disposition:o})=>((o==="new-window"||o==="foreground-tab"||o==="default")&&this.setUrl(i),{action:"deny"}))}))}onOpen(){this.addressBarForm.onsubmit=n=>{n.preventDefault();let r=this.addressBar.getValue();r&&this.setUrl(r)}}};function nR(){this.addCommand({id:"login",name:"Login website",callback:()=>{new ta(this.app).open()}})}var h5=require("obsidian");var Ou=require("obsidian");var km=require("obsidian"),Ul=class t extends km.Modal{constructor(n,r,i){super(n);this.onSubmit=r;this.onExit=i;this.containerEl.addClass("mx-playback-prompt"),this.onSubmit=r}static run(){return new Promise(n=>{new t(app,i=>n(Number(i)),()=>n(null)).open()})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText("Playback Speed");let i=n.createEl("form",{},o=>{o.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"}}),o.createEl("button",{attr:{type:"submit"},text:"Submit"})});i.oninvalid=o=>{o.preventDefault(),new km.Notice("Invalid playback rate")},i.onsubmit=o=>{o.preventDefault();let a=new FormData(i);this.onSubmit(a.get("playback-speed").toString()),this.close()}}onClose(){let{contentEl:n}=this;n.empty(),this.onExit()}};var $r=[.25,.5,.75,1,1.25,1.5,2,3,5,10];function rR(t,e){let n=e.state.playbackRate,r=!$r.includes(n),i=t.setTitle(_j(n)).setIcon("gauge").setSection("mx-player").setSubmenu();$r.forEach(o=>i.addItem(a=>a.setTitle(`${o}x`).setChecked(o===n).onClick(()=>{e.playbackRate=o}))),i.addItem(o=>o.setTitle(kj(n)).setChecked(r).onClick(async()=>{let a=await Ul.run();a&&(e.playbackRate=a)}))}function _j(t){let e=new DocumentFragment;return e.appendText("Speed "),e.createEl("code",{text:`(${t}x)`}),e}function kj(t){let e=new DocumentFragment;return e.appendText("Custom"),$r.includes(t)?e.appendText("..."):(e.appendText(" "),e.createEl("code",{text:`(${t}x)`})),e}var Xw=require("obsidian");var Au=require("obsidian");var iR=require("obsidian");function Bl(t){let e=iR.Keymap.isModEvent(t);return na(e)}function na(t){return t===!0?"tab":t}var jw=require("obsidian"),n5=$(xc());var Yr=$(K());var VL={},NL=t=>{let e,n=new Set,r=(u,d)=>{let p=typeof u=="function"?u(e):u;if(!Object.is(p,e)){let f=e;e=d??(typeof p!="object"||p===null)?p:Object.assign({},e,p),n.forEach(h=>h(e,f))}},i=()=>e,l={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(VL.env?VL.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(r,i,l);return l},wc=t=>t?NL(t):NL;var QL=$(K(),1),XL=$(KL(),1),YL={},{useDebugValue:r8}=QL.default,{useSyncExternalStoreWithSelector:i8}=XL.default,GL=!1,o8=t=>t;function mp(t,e=o8,n){(YL.env?YL.env.MODE:void 0)!=="production"&&n&&!GL&&(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"),GL=!0);let r=i8(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return r8(r),r}function Kg(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:a8(e.get("vol")),tempFragment:Dn(t)}}function a8(t){if(!t)return;let e=parseInt(t,10);if(!isNaN(e)&&e>=0&&e<=100)return e/100}var ZL=()=>({emit(t,...e){for(let n=0,r=this.events[t]||[],i=r.length;n<i;n++)r[n](...e)},events:{},on(t,e){var n;return((n=this.events)[t]||(n[t]=[])).push(e),()=>{this.events[t]=this.events[t]?.filter(r=>e!==r)}}});function Gg(){let t=ZL();return t.once=function(n,r){let i=this.on(n,(...o)=>{i(),r(...o)});return i},t}function JL(t){let e=t;return typeof e.id=="string"&&typeof e.invoke=="string"}function eA(t,...e){return{id:s8(),invoke:t,args:e}}function tA(t){return typeof t.id=="string"}function nA(t){return typeof t.send=="string"}function rA(t,e){return{send:t,payload:e}}function s8(){return Math.random().toString(36).substring(2,9)}var Yg=class extends Error{constructor(e){super(`no handler for ${e}`)}},F0="mx-port-ready";var Qg=class{constructor(){T(this,"port",null);T(this,"actions",Object.create(null));T(this,"emitter",Gg());T(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]=(...r)=>this.invoke(n.toString(),r))}}))}load(e){this.port&&this.port.close(),this.port=e;let n=({data:r})=>{this.onMessage(r)};e.addEventListener("message",n),e.start(),e.postMessage(F0)}unload(){this.port?.close(),this.emitter.events={}}onMessage(e){e===F0?this.emitter.emit("ready"):JL(e)?this.response(e):tA(e)?this.emitter.emit("resp",e.id,e.payload,e.error):nA(e)&&this.emitter.emit(`send:${e.send}`,{type:e.send,payload:e.payload})}invoke(e,n,{transfer:r,timeout:i=1e3}={}){if(!this.port)throw new Error("port not loaded");let o=eA(e,...n);return this.port.postMessage(o,{transfer:r}),new Promise((a,s)=>{let l=-1,c=this.emitter.on("resp",(u,d,p)=>{if(u===o.id)if(c(),window.clearTimeout(l),p){let{message:f,stack:h}=p,g=new Error(f);g.stack=h,s(g)}else a(d)});i>0&&i<1/0&&(l=window.setTimeout(()=>{c(),console.error(`${e} timeout after ${i}ms`),s(new go(i))},i))})}handle(e,n){return this.actions[e]=n,()=>{this.actions[e]===n&&delete this.actions[e]}}send(e,n,r){if(!this.port)throw new Error("port not loaded");let i=rA(e,n);this.port.postMessage(i,{transfer:r})}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:r=[]}){if(!this.port)throw new Error("port not loaded");let i={id:e,payload:null};try{let o=this.actions[n];if(!o)throw new Yg(n);let a=await o(...r);a===void 0?this.port.postMessage(i):(i.payload=await a.value,this.port.postMessage(i,{transfer:a.transfer}))}catch(o){console.error("port messaging error",o),o instanceof Error?i.error={message:o.message,stack:o.stack}:i.error={message:String(o)},this.port.postMessage(i)}}},go=class extends Error{constructor(e){super(`timeout after ${e}ms`)}};var l8=()=>{},gp=l8;In();In();Gn();Gn();var ne=$(K(),1);var A=$(K(),1);In();Gn();var RF=$(mo(),1);function Bi(){return cy(Af)}var hK=we(df,{domEventsRegex:/^onMedia/}),$F=A.forwardRef(({children:t,...e},n)=>A.createElement(hK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));$F.displayName="AirPlayButton";var mK=we(uf,{domEventsRegex:/^onMedia/}),$v=A.forwardRef(({children:t,...e},n)=>A.createElement(mK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));$v.displayName="PlayButton";var gK=we(of,{domEventsRegex:/^onMedia/}),jS=A.forwardRef(({children:t,...e},n)=>A.createElement(gK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));jS.displayName="CaptionButton";var yK=we(af,{domEventsRegex:/^onMedia/}),Iv=A.forwardRef(({children:t,...e},n)=>A.createElement(yK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));Iv.displayName="FullscreenButton";var vK=we(lf,{domEventsRegex:/^onMedia/}),Lv=A.forwardRef(({children:t,...e},n)=>A.createElement(vK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));Lv.displayName="MuteButton";var xK=we(cf,{domEventsRegex:/^onMedia/}),HS=A.forwardRef(({children:t,...e},n)=>A.createElement(xK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));HS.displayName="PIPButton";var wK=we(ff,{domEventsRegex:/^onMedia/}),Nf=A.forwardRef(({children:t,...e},n)=>A.createElement(wK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));Nf.displayName="SeekButton";var bK=we(sf,{domEventsRegex:/^onMedia/}),IF=A.forwardRef(({children:t,...e},n)=>A.createElement(bK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));IF.displayName="LiveButton";var WS=we(bf),_K=we(yf,{events:["onDragStart","onDragEnd","onDragValueChange","onValueChange","onPointerValueChange"]}),kK=A.forwardRef(({children:t,...e},n)=>A.createElement(_K,{...e,ref:n},r=>A.createElement(oe.div,{...r},t)));kK.displayName="Slider";var TK=A.forwardRef((t,e)=>A.createElement(oe.div,{...t,ref:e}));TK.displayName="SliderThumb";var SK=A.forwardRef((t,e)=>A.createElement(oe.div,{...t,ref:e}));SK.displayName="SliderTrack";var EK=A.forwardRef((t,e)=>A.createElement(oe.div,{...t,ref:e}));EK.displayName="SliderTrackFill";var PK=we(kf),CK=A.forwardRef(({children:t,...e},n)=>A.createElement(PK,{...e},r=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));CK.displayName="SliderPreview";var MK=A.forwardRef(({children:t,...e},n)=>A.createElement(WS,{...e},(r,i)=>{let o=Ie(()=>i.getValueText(),i);return A.createElement(oe.div,{...r,ref:n},o,t)}));MK.displayName="SliderValue";var RK=we(xf,{domEventsRegex:/^onMedia/}),$K=A.forwardRef(({children:t,...e},n)=>A.createElement(RK,{...e,ref:n},r=>A.createElement(oe.div,{...r},t)));$K.displayName="VolumeSlider";var IK=A.forwardRef(({children:t,...e},n)=>A.createElement(WS,{...e},(r,i)=>{let o=Ie(()=>i.getValueText(),i);return A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},o,t)}));IK.displayName="SliderValue";function LK(t=0,e=0,n=""){return Y?{startTime:t,endTime:e,text:n,addEventListener:qn,removeEventListener:qn,dispatchEvent:qn}:new window.VTTCue(t,e,n)}var AK=we(Gc),LF=A.forwardRef(({children:t,...e},n)=>A.createElement(AK,{...e},r=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));LF.displayName="Thumbnail";var AF=A.forwardRef(({children:t,...e},n)=>{let{src:r,img:i,crossOrigin:o}=Ta(Gc.state),a=Ie(r),s=Ie(o);return A.createElement(oe.img,{crossOrigin:s,...e,src:a,ref:Pe(i.set,n)},t)});AF.displayName="ThumbnailImg";var Av=Object.freeze({__proto__:null,Img:AF,Root:LF}),Ov=A.createContext({$chapters:J(null)});Ov.displayName="TimeSliderContext";var OK=we(vf,{domEventsRegex:/^onMedia/}),FK=A.forwardRef(({children:t,...e},n)=>{let r=A.useMemo(()=>J(null),[]);return A.createElement(Ov.Provider,{value:{$chapters:r}},A.createElement(OK,{...e,ref:n},i=>A.createElement(oe.div,{...i},t)))});FK.displayName="TimeSlider";var DK=we(Tf),NK=A.forwardRef(({children:t,...e},n)=>A.createElement(DK,{...e},(r,i)=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},A.createElement(OF,{instance:i},t))));NK.displayName="SliderChapters";function OF({instance:t,children:e}){let n=Ie(()=>t.cues,t),r=A.useRef([]),i=A.useRef(),{$chapters:o}=A.useContext(Ov);return i.current||(i.current=LK()),A.useEffect(()=>(o.set(t),()=>void o.set(null)),[t]),A.useEffect(()=>{t.setRefs(r.current)},[n]),e(n.length?n:[i.current],a=>{if(!a){r.current.length=0;return}r.current.push(a)})}OF.displayName="SliderChapterTracks";var VK=A.forwardRef(({children:t,...e},n)=>{let{$chapters:r}=A.useContext(Ov),[i,o]=A.useState();return A.useEffect(()=>M(()=>{let a=r(),s=a?.activePointerCue||a?.activeCue;o(s?.text||"")}),[]),A.createElement(oe.div,{...e,ref:n},i,t)});VK.displayName="SliderChapterTitle";var zK=A.forwardRef(({children:t,...e},n)=>A.createElement(WS,{...e},(r,i)=>{let o=Ie(()=>i.getValueText(),i);return A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},o,t)}));zK.displayName="SliderValue";var UK=A.forwardRef((t,e)=>A.createElement(oe.div,{...t,ref:e}));UK.displayName="SliderProgress";var BK=we(wf),jK=A.forwardRef(({children:t,...e},n)=>A.createElement(BK,{...e},r=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));jK.displayName="SliderThumbnail";var HK=we(_f,{events:["onCanPlay","onError"]}),WK=A.forwardRef(({children:t,...e},n)=>A.createElement(HK,{...e},(r,i)=>A.createElement(FF,{...r,instance:i,ref:Pe(r.ref,n)},t)));WK.displayName="SliderVideo";var FF=A.forwardRef(({instance:t,children:e,...n},r)=>{let{canLoad:i}=Ta(Ws),{src:o,video:a,crossOrigin:s}=t.$state,l=Ie(o),c=Ie(i),u=Ie(s);return A.createElement(oe.video,{style:{maxWidth:"unset"},...n,src:l||void 0,muted:!0,playsInline:!0,preload:c?"auto":"none",crossOrigin:u||void 0,ref:Pe(a.set,r)},e)});FF.displayName="SliderVideoProvider";var qK=we(Mf,{events:["onChange"]}),KK=A.forwardRef(({children:t,...e},n)=>A.createElement(qK,{...e,ref:n},r=>A.createElement(oe.div,{...r},t)));KK.displayName="RadioGroup";var GK=we(Rf,{events:["onChange","onSelect"]}),YK=A.forwardRef(({children:t,...e},n)=>A.createElement(GK,{...e},r=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));YK.displayName="RadioItem";var QK=typeof document>"u",XK=we(Sf,{events:["onOpen","onClose"],domEventsRegex:/^onMedia/}),ZK=A.forwardRef(({children:t,...e},n)=>A.createElement(XK,{...e,ref:n},(r,i)=>A.createElement(oe.div,{...r,style:{display:i.isSubmenu?void 0:"contents",...r.style}},t)));ZK.displayName="Menu";var JK=we(Ef,{events:["onSelect"]}),eG=A.forwardRef(({children:t,...e},n)=>A.createElement(JK,{...e},r=>A.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));eG.displayName="MenuButton";var tG=A.forwardRef(({disabled:t=!1,children:e,...n},r)=>{let i=qe("fullscreen");return QK||!(t==="fullscreen"?!i:!t)?e:(0,RF.createPortal)(A.createElement(oe.div,{...n,style:{display:"contents",...n.style},ref:r},e),document.body)});tG.displayName="MenuPortal";var nG=we(Pf),rG=A.forwardRef(({children:t,...e},n)=>A.createElement(nG,{...e},r=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));rG.displayName="MenuItems";var iG=we(Cf),oG=A.forwardRef(({children:t,...e},n)=>A.createElement(iG,{...e},r=>A.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));oG.displayName="MenuItem";var aG=we(If,{events:["onWillTrigger","onTrigger"]}),Hr=A.forwardRef(({children:t,...e},n)=>A.createElement(aG,{...e,ref:n},r=>A.createElement(oe.div,{...r},t)));Hr.displayName="Gesture";var sG=we(Lf),Vf=A.forwardRef(({children:t,...e},n)=>A.createElement(sG,{...e},(r,i)=>A.createElement(DF,{...r,instance:i,ref:Pe(r.ref,n)},t)));Vf.displayName="Time";var DF=A.forwardRef(({instance:t,children:e,...n},r)=>{let{timeText:i}=t.$state,o=Ie(i);return A.createElement(oe.div,{...n,ref:r},o,e)});DF.displayName="TimeText";function Wr(){return Bi()?.player||null}function qS({off:t=!0}={}){let e=Bi(),{textTracks:n,textTrack:r}=e.$state,i=Ie(n);return Ie(r),A.useMemo(()=>{let o=i.filter(It),a=o.map(s=>({track:s,label:s.label,value:MF(s),get selected(){return r()===s},select(l){let c=n().indexOf(s);c>=0&&e.remote.changeTextTrackMode(c,"showing",l)}}));return t&&a.unshift({track:null,label:ee(t)?t:"Off",value:"off",get selected(){return!r()},select(s){e.remote.toggleCaptions(s)}}),Object.defineProperty(a,"disabled",{get(){return!o.length}}),Object.defineProperty(a,"selectedTrack",{get(){return r()}}),Object.defineProperty(a,"selectedValue",{get(){let s=r();return s?MF(s):"off"}}),a},[i])}function MF(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}var Fv=$(K(),1),KS=Fv.forwardRef((t,e)=>{let{width:n,height:r,size:i=null,paths:o,...a}=t;return Fv.createElement("svg",{viewBox:"0 0 32 32",...a,width:n??i,height:r??i,fill:"none","aria-hidden":"true",focusable:"false",xmlns:"http://www.w3.org/2000/svg",ref:e,dangerouslySetInnerHTML:{__html:o}})});KS.displayName="VidstackIcon";var ke=$(K(),1);In();Gn();var lG=we(nf),NF=ke.forwardRef(({children:t,...e},n)=>ke.createElement(lG,{...e},r=>ke.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));NF.displayName="Controls";var cG=we(rf),VF=ke.forwardRef(({children:t,...e},n)=>ke.createElement(cG,{...e},r=>ke.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));VF.displayName="ControlsGroup";var Mo=Object.freeze({__proto__:null,Group:VF,Root:NF}),uG=we(hf);function dG({children:t,...e}){return ke.createElement(uG,{...e},t)}dG.displayName="Tooltip";var pG=we(mf),fG=ke.forwardRef(({children:t,...e},n)=>ke.createElement(pG,{...e},r=>ke.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));fG.displayName="TooltipTrigger";var hG=we(gf),mG=ke.forwardRef(({children:t,...e},n)=>ke.createElement(hG,{...e},r=>ke.createElement(oe.div,{...r,ref:Pe(r.ref,n)},t)));mG.displayName="TooltipContent";var gG=we(pf,{domEventsRegex:/^onMedia/}),zF=ke.forwardRef(({children:t,...e},n)=>ke.createElement(gG,{...e},r=>ke.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));zF.displayName="GoogleCastButton";var UF=ke.forwardRef(({children:t,...e},n)=>{let r=qe("title");return ke.createElement(oe.span,{...e,ref:n},r,t)});UF.displayName="Title";function BF(t){let[e,n]=ke.useState([]);return ke.useEffect(()=>{if(!t){n([]);return}function r(){n(t.activeCues)}return r(),z(t,"cue-change",r)},[t]),e}function jF(t){let e=Bi(),[n,r]=ke.useState(null);return ke.useEffect(()=>Yc(e.textTracks,t,r),[t]),n}function Dv(){let t=jF("chapters");return BF(t)[0]?.text||""}var HF=ke.forwardRef(({children:t,...e},n)=>{let r=Dv();return ke.createElement(oe.span,{...e,ref:n},r,t)});HF.displayName="ChapterTitle";var yG=we($f),Nv=ke.forwardRef(({children:t,...e},n)=>ke.createElement(yG,{...e,ref:n},r=>ke.createElement(oe.div,{...r},t)));Nv.displayName="Captions";var Mde=ke.forwardRef(({size:t=96,children:e,...n},r)=>ke.createElement("svg",{width:t,height:t,fill:"none",viewBox:"0 0 120 120","aria-hidden":"true","data-part":"root",...n,ref:r},e)),Rde=ke.forwardRef(({width:t=8,children:e,...n},r)=>ke.createElement("circle",{cx:"60",cy:"60",r:"54",stroke:"currentColor",strokeWidth:t,"data-part":"track",...n,ref:r},e)),$de=ke.forwardRef(({width:t=8,fillPercent:e=50,children:n,...r},i)=>ke.createElement("circle",{cx:"60",cy:"60",r:"54",stroke:"currentColor",pathLength:"100",strokeWidth:t,strokeDasharray:100,strokeDashoffset:100-e,"data-part":"track-fill",...r,ref:i},n));var Vv=$(K(),1);Gn();function zv(t){let e=Bi(),n=Vv.useRef();return n.current||(n.current=new zc),Vv.useEffect(()=>{let r=t&&"current"in t?t.current:t,i=r instanceof Hs,o=i?r:e?.player;n.current.setPlayer(o??null),n.current.setTarget(r??null)},[e,t&&"current"in t?t.current:t]),n.current}var upe=$(mo(),1);var xG=["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"],wG=we(Hs,{events:xG,eventsRegex:/^onHls/,domEventsRegex:/^onMedia/}),GS=ne.forwardRef(({aspectRatio:t,children:e,...n},r)=>ne.createElement(wG,{...n,src:n.src,ref:r,style:{aspectRatio:t,...n.style}},i=>ne.createElement(oe.div,{...i},e)));GS.displayName="MediaPlayer";var bG=we(kv),YS=ne.forwardRef(({loaders:t=[],children:e,mediaProps:n,buildMediaEl:r,...i},o)=>{let a=ne.useMemo(()=>t.map(s=>new s),t);return ne.createElement(bG,{...i,loaders:a,ref:o},(s,l)=>ne.createElement("div",{...s},ne.createElement(KF,{...n,provider:l,buildMediaEl:r}),e))});YS.displayName="MediaProvider";function KF({provider:t,buildMediaEl:e,...n}){let{controls:r,crossOrigin:i,poster:o,remotePlaybackInfo:a}=Ta(Ws),{loader:s}=t.$state,{$iosControls:l,$provider:c,$providerSetup:u}=Bi(),d=Ie(r),p=Ie(l),f=d||p,h=Ie(i),g=Ie(o),x=Ie(s),m=Ie(c),y=Ie(u),v=Ie(a),w=x?.mediaType(),k=x?.name==="youtube",b=x?.name==="vimeo",S=k||b,C=x?.name==="remotion",R=x?.name==="google-cast",[_,D]=ne.useState("");return ne.useEffect(()=>{!R||_||Promise.resolve().then(()=>(qF(),WF)).then(I=>{D(I.default)})},[R]),R?ne.createElement("div",{className:"vds-google-cast",ref:I=>{t.load(I)}},ne.createElement(KS,{paths:_}),v?.deviceName?ne.createElement("span",{className:"vds-google-cast-info"},"Google Cast on"," ",ne.createElement("span",{className:"vds-google-cast-device-name"},v.deviceName)):null):C?ne.createElement("div",{"data-remotion-canvas":!0},ne.createElement("div",{"data-remotion-container":!0,ref:I=>{t.load(I)}},CF(m)&&y?ne.createElement(m.render):null)):e?.(x,t)??(S?ne.createElement(ne.Fragment,null,ne.createElement("iframe",{className:k?"vds-youtube":"vds-vimeo",suppressHydrationWarning:!0,tabIndex:f?void 0:-1,"aria-hidden":"true","data-no-controls":f?void 0:"",ref(I){t.load(I)}}),f?null:ne.createElement("div",{className:"vds-blocker"})):w?ne.createElement(w==="audio"?"audio":"video",{...n,controls:f?!0:null,crossOrigin:typeof h=="boolean"?"":h,poster:w==="video"&&f&&g?g:null,preload:"none","aria-hidden":"true",suppressHydrationWarning:!0,ref(I){t.load(I)}}):null)}KF.displayName="MediaOutlet";function _G(t){let e=Bi(),n=ne.useMemo(()=>new gn(t),Object.values(t));return ne.useEffect(()=>(e.textTracks.add(n),()=>void e.textTracks.remove(n)),[n]),n}function kG({lang:t,...e}){return _G({language:t,...e}),null}kG.displayName="Track";var TG=we(Tv),SG=ne.forwardRef(({children:t,...e},n)=>ne.createElement(TG,{...e},r=>ne.createElement(oe.button,{...r,ref:Pe(r.ref,n)},t)));SG.displayName="ToggleButton";var EG=we(Sv),PG=ne.forwardRef(({children:t,...e},n)=>ne.createElement(EG,{...e},(r,i)=>ne.createElement(GF,{...r,instance:i,ref:Pe(r.ref,n)},t)));PG.displayName="Poster";var GF=ne.forwardRef(({instance:t,children:e,...n},r)=>{let{src:i,img:o,alt:a,crossOrigin:s,loading:l,hidden:c}=t.$state,u=Ie(i),d=Ie(a),p=Ie(s),f=Ie(l),h=Ie(c);return ne.createElement(oe.img,{...n,src:u||"",alt:d||void 0,crossOrigin:p||void 0,ref:Pe(o.set,r),style:{display:f||h?"none":void 0}},e)});GF.displayName="PosterImg";var CG=ne.forwardRef(({children:t,...e},n)=>ne.createElement(oe.div,{translate:"yes","aria-live":"off","aria-atomic":"true",...e,ref:n},t));CG.displayName="Caption";var MG=ne.forwardRef((t,e)=>{let n=qe("textTrack"),[r,i]=ne.useState();return ne.useEffect(()=>{if(!n)return;function o(){i(n?.activeCues[0])}return n.addEventListener("cue-change",o),()=>{n.removeEventListener("cue-change",o),i(void 0)}},[n]),ne.createElement(oe.span,{...t,"data-part":"cue",dangerouslySetInnerHTML:{__html:r?.text||""},ref:e})});MG.displayName="CaptionText";function Uv(){let[t,e]=ne.useState(null),n=Bi();return ne.useEffect(()=>{if(n)return M(()=>{e(n.$provider())})},[]),t}function YF({clamp:t=!1,offset:e=0,orientation:n="horizontal"}={}){let[r,i]=ne.useState(null),[o,a]=ne.useState(null),[s,l]=ne.useState(0),[c,u]=ne.useState(!1);return ne.useEffect(()=>{if(!r)return;let d=J(!1);function p(f){r&&l(RG(r,f,n))}return M(()=>{if(!d()){z(r,"pointerenter",()=>{u(!0),o?.setAttribute("data-visible","")}),z(r,"pointerdown",f=>{d.set(!0),p(f)}),z(r,"pointerleave",()=>{u(!1),o?.removeAttribute("data-visible")}),z(r,"pointermove",f=>{p(f)});return}o?.setAttribute("data-dragging",""),z(document,"pointerup",f=>{d.set(!1),o?.removeAttribute("data-dragging"),p(f)}),z(document,"pointermove",f=>{p(f)}),z(document,"touchmove",f=>f.preventDefault(),{passive:!1})})},[r]),ne.useEffect(()=>{o&&o.style.setProperty("--slider-pointer",s+"%")},[o,s]),ne.useEffect(()=>{if(!o)return;let d=()=>{DS(o,{offset:e,clamp:t,orientation:n})};d();let p=new ResizeObserver(d);return p.observe(o),()=>p.disconnect()},[o,t,e,n]),{previewRootRef:i,previewRef:a,previewValue:s,isPreviewVisible:c}}function RG(t,e,n){let r,i=t.getBoundingClientRect();if(n==="vertical"){let{bottom:o,height:a}=i;r=(o-e.clientY)/a}else{let{left:o,width:a}=i;r=(e.clientX-o)/a}return $G(Math.max(0,Math.min(100,100*r)))}function $G(t){return Number(t.toFixed(3))}var QF='"use strict";var X=()=>({emit(t,...e){for(let n=0,r=this.events[t]||[],i=r.length;n<i;n++)r[n](...e)},events:{},on(t,e){return(this.events[t]||=[]).push(e),()=>{this.events[t]=this.events[t]?.filter(n=>e!==n)}}});function Z(){let t=X();return t.once=function(n,r){let i=this.on(n,(...s)=>{i(),r(...s)});return i},t}function ee(t){let e=t;return typeof e.id=="string"&&typeof e.invoke=="string"}function te(t,...e){return{id:Le(),invoke:t,args:e}}function ne(t){return typeof t.id=="string"}function re(t){return typeof t.send=="string"}function ie(t,e){return{send:t,payload:e}}function Le(){return Math.random().toString(36).substring(2,9)}var k=class extends Error{constructor(e){super(`no handler for ${e}`)}},N="mx-port-ready";var R=class{port=null;load(e){this.port&&this.port.close(),this.port=e;let n=({data:r})=>{this.onMessage(r)};e.addEventListener("message",n),e.start(),e.postMessage(N)}unload(){this.port?.close(),this.emitter.events={}}actions=Object.create(null);emitter=Z();onMessage(e){e===N?this.emitter.emit("ready"):ee(e)?this.response(e):ne(e)?this.emitter.emit("resp",e.id,e.payload,e.error):re(e)&&this.emitter.emit(`send:${e.send}`,{type:e.send,payload:e.payload})}methods=new Proxy({},{get:(e,n)=>{if(typeof n=="symbol")throw new Error("Remote invoke does not support symbol property");return e[n]??=(...r)=>this.invoke(n.toString(),r)}});invoke(e,n,{transfer:r,timeout:i=1e3}={}){if(!this.port)throw new Error("port not loaded");let s=te(e,...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(e,n){return this.actions[e]=n,()=>{this.actions[e]===n&&delete this.actions[e]}}send(e,n,r){if(!this.port)throw new Error("port not loaded");let i=ie(e,n);this.port.postMessage(i,{transfer:r})}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:r=[]}){if(!this.port)throw new Error("port not loaded");let i={id:e,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(e){super(`timeout after ${e}ms`)}};var se="mx-port";async function q(){let t=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)}),e=new R;return e.load(t),e}var A=class{#e=[];#t=!1;async load(){if(!this.#t){this.#t=!0,await this.onload();for(let e of this.#n)await e.load()}}async onload(){}async unload(){if(!this.#t)return;this.#t=!1;let e;for(;e=this.#e.pop();)await e();let n;for(;n=this.#n.pop();)await n.unload();await this.onunload()}async onunload(){}register(e){this.#e.push(e)}registerInterval(e,n){let r=setInterval(e,n);this.register(()=>clearInterval(r))}registerDomEvent(e,n,r,i){e.addEventListener(n,r,i),this.register(()=>e.removeEventListener(n,r,i))}#n=[];async addChild(e){return this.#n.push(e),this.#t&&await e.load(),e}async removeChild(e){let n=this.#n.indexOf(e);return n!==-1&&(this.#n.splice(n,1),e.unload()),e}};function d(t){let e=[];for(let n=0;n<t.length;n++)e.push([t.start(n),t.end(n)]);return{type:"TimeRanges",value:e}}function ae(t){let e=t.media,n=t.controller;t.registerDomEvent(e,"abort",r),t.registerDomEvent(e,"emptied",i),t.registerDomEvent(e,"error",s),t.registerDomEvent(e,"volumechange",o),t.registerDomEvent(e,"durationchange",a),t.registerDomEvent(e,"progress",l),t.registerDomEvent(e,"stalled",u),t.registerDomEvent(e,"suspend",c),t.registerDomEvent(e,"ratechange",p),t.registerDomEvent(e,"seeked",y),t.registerDomEvent(e,"seeking",K),t.registerDomEvent(e,"ended",z),t.registerDomEvent(e,"waiting",S),e instanceof HTMLVideoElement&&(t.registerDomEvent(e,"enterpictureinpicture",()=>n.send("enterpictureinpicture",void 0)),t.registerDomEvent(e,"leavepictureinpicture",()=>n.send("leavepictureinpicture",void 0)));function r(){n.send("abort",void 0)}function i(){n.send("emptied",void 0)}function s(){e.error&&n.send("error",{code:e.error.code,message:e.error.message})}function o(){n.send("volumechange",{muted:e.muted,volume:e.volume})}function a(){n.send("durationchange",{played:d(e.played),duration:e.duration})}function l(){n.send("progress",{buffered:d(e.buffered),seekable:d(e.seekable)})}function u(){n.send("stalled",{readyState:e.readyState})}function c(){n.send("suspend",void 0)}function p(){n.send("ratechange",{rate:e.playbackRate})}function y(){n.send("seeked",{current:e.currentTime,played:d(e.played),duration:e.duration,ended:e.ended})}function K(){n.send("seeking",{current:e.currentTime})}function z(){n.send("ended",{controls:e.controls,current:e.currentTime,played:d(e.played),duration:e.duration,ended:e.ended})}function S(){n.send("waiting",{readyState:e.readyState})}}var U=class{value;next;constructor(e){this.value=e}},T=class{#e;#t;#n;constructor(){this.clear()}enqueue(e){let n=new U(e);this.#e?(this.#t.next=n,this.#t=n):(this.#e=n,this.#t=n),this.#n++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}};var le={bind(t,e,n){return t.bind(n)}};function F(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new T,n=0,r=()=>{n--,e.size>0&&e.dequeue()()},i=async(a,l,u)=>{n++;let c=(async()=>a(...u))();l(c);try{await c}catch{}r()},s=(a,l,u)=>{e.enqueue(le.bind(i.bind(void 0,a,l,u))),(async()=>(await Promise.resolve(),n<t&&e.size>0&&e.dequeue()()))()},o=(a,...l)=>new Promise(u=>{s(a,u,l)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}}}),o}async function ue(t,e,n){let r=document.createElement("canvas"),{videoWidth:i,videoHeight:s}=t;if(!i||!s)throw new Error("Cannot screenshot video without width or height");Object.assign(r,{width:i,height:s});let o=r.getContext("2d",{alpha:!1});if(!o)throw new Error("Canvas context creation failed");o.drawImage(t,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"))},e,n)}catch(p){c(p)}}),l=await a.arrayBuffer();return{time:t.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(t){return t[0].toUpperCase()+t.slice(1)}function V(t){return t instanceof TimeRanges?d(t):t}function pe(){let t=this.media,e=this.controller,n=this.stateRef;ce.forEach(i=>{this.register(e.handle(`get${x(i)}`,()=>({value:V(t[i])})))}),this.register(e.handle("getTrack",async i=>({value:await this.getTrack(i)}))),this.register(e.handle("pictureInPictureEnabled",()=>({value:document.pictureInPictureElement===t}))),this.register(e.handle("requestPictureInPicture",()=>{t instanceof HTMLVideoElement&&t.requestPictureInPicture()})),this.register(e.handle("exitPictureInPicture",()=>{document.exitPictureInPicture()})),de.forEach(i=>{this.register(e.handle(`get${x(i)}`,()=>({value:V(t[i])}))),i==="currentTime"?this.register(e.handle(`set${x(i)}`,s=>{n.prevSeek={value:t.currentTime,time:Date.now()},t[i]=s})):this.register(e.handle(`set${x(i)}`,s=>{t[i]=s}))}),me.forEach(i=>{this.register(e.handle(i,async(...s)=>({value:await t[i](...s)})))}),this.register(e.handle("screenshot",async(i,s)=>{if(!(t instanceof HTMLVideoElement))throw new Error("Cannot take screenshot of non-video element");let o=await ue(t,i,s);return{value:o,transfer:[o.blob.arrayBuffer]}}));let r=F(4);return this.register(e.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(t){let e=t.getReader(),n=[];for(;;){let{done:s,value:o}=await e.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(t){let e=t.media,n=t.controller;t.registerDomEvent(e,"loadstart",o),t.registerDomEvent(e,"loadeddata",l),t.registerDomEvent(e,"loadedmetadata",a),t.registerDomEvent(e,"canplay",u),t.registerDomEvent(e,"canplaythrough",c),e.readyState>=0&&o(),e.readyState>=1&&a(),e.readyState>=2&&l(),e.readyState>=3&&u(),e.readyState>=4&&c(),t.registerDomEvent(e,"play",s),t.registerDomEvent(e,"pause",r),t.registerDomEvent(e,"playing",i),e.readyState>=3&&!e.paused?(s(),i()):r();function r(){n.send("pause",{readyState:e.readyState})}function i(){n.send("playing",void 0)}function s(){n.send("play",void 0)}function o(){n.send("loadstart",{networkState:e.networkState})}function a(){n.send("loadedmetadata",void 0)}function l(){n.send("loadeddata",void 0)}function u(){n.send("canplay",{buffered:d(e.buffered),seekable:d(e.seekable),duration:e.duration})}function c(){n.send("canplaythrough",{buffered:d(e.buffered),seekable:d(e.seekable),duration:e.duration})}}var g=Symbol(0),L=!1,he=!1,$=null,b=null,f=null,m=0,E=[],j={};var w=0,we=1,P=2,B=3;function Ie(){L=!0,queueMicrotask(Oe)}function Oe(){if(!E.length){L=!1;return}he=!0;for(let t=0;t<E.length;t++)E[t].$st!==w&&He(E[t]);E=[],L=!1,he=!1}function He(t){let e=[t];for(;t=t[g];)t.$e&&t.$st!==w&&e.push(t);for(let n=e.length-1;n>=0;n--)J(e[n])}function G(t=!0){if(this.$st===B)return;let e=t?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;t&&ye(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function ye(t){t.$st=B,t.$d&&Me(t),t.$s&&C(t,0),t.$ps&&(t.$ps.$ns=null),t[g]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=j,t.$eh=null}function Me(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){Te(t,e)}}function _e(t,e,n){let r=$,i=b;$=t,b=n;try{return e.call(t)}finally{$=r,b=i}}function Te(t,e){if(!t||!t.$eh)throw e;let n=0,r=t.$eh.length,i=ve(e);for(n=0;n<r;n++)try{t.$eh[n](i);break}catch(s){i=ve(s)}if(n===r)throw i}function ve(t){return t instanceof Error?t:Error(JSON.stringify(t))}function Ke(){return this.$st===B?this.$v:(b&&!this.$e&&(!f&&b.$s&&b.$s[m]==this?m++:f?f.push(this):f=[this]),this.$c&&J(this),this.$v)}function ze(t){let e=Ue(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++)$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(t){if(t[g]=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===j?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};v.dispose=function(){G.call(this)};var Ne=function(e,n,r){xe.call(this),this.$st=n?P:w,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,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(t,e){return t!==e}function Ue(t){return typeof t=="function"}function J(t){if(t.$st===we)for(let e=0;e<t.$s.length&&(J(t.$s[e]),t.$st!==P);e++);t.$st===P?Fe(t):t.$st=w}function Ee(t){t.$ns&&t.$ns[g]===t&&G.call(t,!1),t.$d&&Me(t),t.$eh=t[g]?t[g].$eh:null}function Fe(t){let e=f,n=m;f=null,m=0;try{Ee(t);let r=_e(t,t.$c,t);if(f){if(t.$s&&C(t,m),t.$s&&m>0){t.$s.length=m+f.length;for(let s=0;s<f.length;s++)t.$s[m+s]=f[s]}else t.$s=f;let i;for(let s=m;s<t.$s.length;s++)i=t.$s[s],i.$o?i.$o.push(t):i.$o=[t]}else t.$s&&m<t.$s.length&&(C(t,m),t.$s.length=m);!t.$e&&t.$i?ze.call(t,r):(t.$v=r,t.$i=!0)}catch(r){Te(t,r),t.$st===P&&(Ee(t),t.$s&&C(t,0));return}f=e,m=n,t.$st=w}function $e(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===w&&(E.push(t),L||Ie()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)$e(t.$o[n],we)}function C(t,e){let n,r;for(let i=e;i<t.$s.length;i++)n=t.$s[i],n.$o&&(r=n.$o.indexOf(t),n.$o[r]=n.$o[n.$o.length-1],n.$o.pop())}function Pe(...t){}function I(t){return typeof t>"u"}function Q(t){return typeof t=="number"&&!Number.isNaN(t)}var be,Ve=Event,Se=Symbol("DOM_EVENT"),W=class extends Ve{constructor(e,...n){super(e,n[0]),this[be]=!0,this.triggers=new D,this.detail=n[0]?.detail;let r=n[0]?.trigger;r&&this.triggers.add(r)}static{be=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(e){this.chain.push(e),ke(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 r=e(n);if(r)return[n,r]}}[Symbol.iterator](){return this.chain.values()}};function ke(t){return!!t?.[Se]}var dn=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):Pe;var O=class{constructor(e){this._callback=e}_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(t){let e=t.media,n=t.controller,r=new O(a);t.register(()=>r._stop());let i,s=e.currentTime;function o(){i!==e.paused&&(i=e.paused,e.paused?e.addEventListener("timeupdate",a):e.removeEventListener("timeupdate",a))}o(),e.addEventListener("ended",()=>{r._stop(),o()}),e.addEventListener("pause",()=>{r._stop(),o()}),e.addEventListener("playing",()=>{r._start(),o()});function a(){s!==e.currentTime&&(s=e.currentTime,n.send("timeupdate",{current:s,played:d(e.played)}))}}function H(t,e=document.body,n=1e4){return new Promise((r,i)=>{let s=e.querySelector(t);if(s){r(s);return}let o=new MutationObserver(()=>{let l=e.querySelector(t);l&&(o.disconnect(),r(l),window.clearTimeout(a))}),a=window.setTimeout(()=>{o.disconnect(),i(new Error(`timeout waiting for ${t}`))},n);o.observe(e,{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())}async getTrack(n){return null}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)}rehookMediaEl(n){this.#e=n,this.hookMediaEl()}async hookMediaEl(){ge(this),Re(this),ae(this),pe.call(this),this.controller.send(fe,void 0)}};function*je(t,e=!1){for(e&&(yield t);t.parentElement&&t.parentElement!==document.body;)t=t.parentElement,yield t}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=(t=>function(n){if(n in t)return t[n];throw new Error(`Module not found: ${n.toString()}`)})({"media-extended":Ye});async function Ce(t,e){if(!t)return new h(e);let n=window.eval(`(function anonymous(require,module,exports){${t}\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(e);if(!(o instanceof h))throw new Error("Failed to load plugin. plugin not extends MediaPlugin");return o}var _;q().then(t=>{t.handle("loadPlugin",async e=>{_&&_.unload(),_=await Ce(e,t),_.load()})});\n';var Ro=Symbol(0),jv=!1,XF=!1,qs=null,Zc=null,qr=null,gr=0,Xc=[],XS={},LG=()=>{},Jc=0,nD=1,zf=2,Wv=3;function AG(){jv=!0,queueMicrotask(OG)}function OG(){if(!Xc.length){jv=!1;return}XF=!0;for(let t=0;t<Xc.length;t++)Xc[t].$st!==Jc&&FG(Xc[t]);Xc=[],jv=!1,XF=!1}function FG(t){let e=[t];for(;t=t[Ro];)t.$e&&t.$st!==Jc&&e.push(t);for(let n=e.length-1;n>=0;n--)eE(e[n])}function rD(t){if(!t||!qs)return t||LG;let e=qs;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==Wv&&(t.call(null),sD(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function ZS(t=!0){if(this.$st===Wv)return;let e=t?this.$ps||this[Ro]:this,n=this.$ns,r=null;for(;n&&n[Ro]===this;)ZS.call(n,!0),ZF(n),r=n.$ns,n.$ns=null,n=r;t&&ZF(this),n&&(n.$ps=t?this.$ps:this),e&&(e.$ns=n)}function ZF(t){t.$st=Wv,t.$d&&iD(t),t.$s&&Bv(t,0),t.$ps&&(t.$ps.$ns=null),t[Ro]=null,t.$s=null,t.$o=null,t.$ps=null,t.$cx=XS,t.$eh=null}function iD(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){oD(t,e)}}function DG(t,e,n){let r=qs,i=Zc;qs=t,Zc=n;try{return e.call(t)}finally{qs=r,Zc=i}}function oD(t,e){if(!t||!t.$eh)throw e;let n=0,r=t.$eh.length,i=JF(e);for(n=0;n<r;n++)try{t.$eh[n](i);break}catch(o){i=JF(o)}if(n===r)throw i}function JF(t){return t instanceof Error?t:Error(JSON.stringify(t))}function NG(){return this.$st===Wv?this.$v:(Zc&&!this.$e&&(!qr&&Zc.$s&&Zc.$s[gr]==this?gr++:qr?qr.push(this):qr=[this]),this.$c&&eE(this),this.$v)}function VG(t){let e=sD(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++)lD(this.$o[n],zf);return this.$v}var aD=function(){this[Ro]=null,this.$ns=null,this.$ps=null,qs&&qs.append(this)},Ks=aD.prototype;Ks.$cx=XS;Ks.$eh=null;Ks.$c=null;Ks.$d=null;Ks.append=function(t){if(t[Ro]=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===XS?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)};Ks.dispose=function(){ZS.call(this)};var zG=function(e,n,r){aD.call(this),this.$st=n?zf:Jc,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,n&&(this.$c=n),r&&r.dirty&&(this.$ch=r.dirty)},JS=zG.prototype;Object.setPrototypeOf(JS,Ks);JS.$ch=UG;JS.call=NG;function UG(t,e){return t!==e}function sD(t){return typeof t=="function"}function eE(t){if(t.$st===nD)for(let e=0;e<t.$s.length&&(eE(t.$s[e]),t.$st!==zf);e++);t.$st===zf?BG(t):t.$st=Jc}function eD(t){t.$ns&&t.$ns[Ro]===t&&ZS.call(t,!1),t.$d&&iD(t),t.$eh=t[Ro]?t[Ro].$eh:null}function BG(t){let e=qr,n=gr;qr=null,gr=0;try{eD(t);let r=DG(t,t.$c,t);if(qr){if(t.$s&&Bv(t,gr),t.$s&&gr>0){t.$s.length=gr+qr.length;for(let o=0;o<qr.length;o++)t.$s[gr+o]=qr[o]}else t.$s=qr;let i;for(let o=gr;o<t.$s.length;o++)i=t.$s[o],i.$o?i.$o.push(t):i.$o=[t]}else t.$s&&gr<t.$s.length&&(Bv(t,gr),t.$s.length=gr);!t.$e&&t.$i?VG.call(t,r):(t.$v=r,t.$i=!0)}catch(r){oD(t,r),t.$st===zf&&(eD(t),t.$s&&Bv(t,0));return}qr=e,gr=n,t.$st=Jc}function lD(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===Jc&&(Xc.push(t),jv||AG()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)lD(t.$o[n],nD)}function Bv(t,e){let n,r;for(let i=e;i<t.$s.length;i++)n=t.$s[i],n.$o&&(r=n.$o.indexOf(t),n.$o[r]=n.$o[n.$o.length-1],n.$o.pop())}function cD(...t){}function Uf(t){return typeof t=="string"}var tD,jG=Event,uD=Symbol("DOM_EVENT"),QS=class extends jG{constructor(e,...n){super(e,n[0]),this[tD]=!0,this.triggers=new Hv,this.detail=n[0]?.detail;let r=n[0]?.trigger;r&&this.triggers.add(r)}get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){return this.triggers.origin?.isTrusted??!1}};tD=uD;var Hv=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),dD(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 r=e(n);if(r)return[n,r]}}[Symbol.iterator](){return this.chain.values()}};function dD(t){return!!t?.[uD]}function HG(){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 pD(){let t=HG();return rD(t.empty),t}var efe=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):cD;var Oa=require("obsidian");var fD='"use strict";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var h=(s,e)=>{for(var t in e)c(s,t,{get:e[t],enumerable:!0})},w=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!y.call(s,r)&&r!==t&&c(s,r,{get:()=>e[r],enumerable:!(i=b(e,r))||i.enumerable});return s};var g=s=>w(c({},"__esModule",{value:!0}),s);var x={};h(x,{default:()=>l});module.exports=g(x);var a=class extends Error{constructor(e,t){super(`${e} (code: ${t})`)}};var p=(s=>{if(!s)throw new Error("env var BILI_REQ_STORE not inited");return s})(process.env.BILI_REQ_STORE);var d=()=>require("media-extended");var{waitForSelector:u,MediaPlugin:k}=d(),T=`\n#bilibili-player .bpx-player-control-wrap {\n opacity: 0 !important;\n}\n.mx-show-controls #bilibili-player .bpx-player-control-wrap {\n opacity: 100 !important;\n}\n`,l=class extends k{#e=new Map;findMedia(){return u("#bilibili-player video")}getStyle(){return T}async getTracks(){let e=window[p];try{let t=await e.getRequest(),i=JSON.parse(t);if(i.code!==0)throw new a(i.message,i.code);return i.data.subtitle.subtitles.map(r=>{let o=r.lan.startsWith("ai-")?r.lan.substring(3):r.lan,n={wid:r.id.toString(),kind:"subtitles",label:r.lan_doc,language:o};return this.#e.set(n.wid,{url:r.subtitle_url}),n})}catch{return[]}}async getTrack(e){let t=this.#e.get(e);if(!t)return null;let i=await fetch(t.url);if(!i.ok)throw new Error("Failed to fetch subtitle, "+i.statusText);let r=await i.json(),o={Kind:"subtitles",ID:e};return{cues:r.body.map((n,m)=>({id:`${n.sid??m}`,startTime:n.from,endTime:n.to,text:n.content})),metadata:o}}async onload(){this.register(this.controller.handle("bili_getManifest",()=>({value:window.player.getManifest()}))),await super.onload(),this.revertAutoSeek(),Promise.all([this.toggleDanmaku(!1)]),await this.untilWebFullscreen(),await this.getTracks().then(e=>{e.length>0&&this.controller.send("mx-text-tracks",{tracks:e})})}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 u(".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()||u(".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},r=new MutationObserver(o=>{o.find(n=>n.type==="childList"&&n.addedNodes.length>0)?.addedNodes.forEach(n=>{n.textContent?.includes("\\u5DF2\\u4E3A\\u60A8\\u5B9A\\u4F4D\\u81F3")&&(n.style.opacity="0",i())})});r.observe(t,{childList:!0,subtree:!0}),this.register(()=>r.disconnect())}async untilWebFullscreen(){let e=this.player;this.isWebFullscreen()||await new Promise(t=>{let i=new MutationObserver(r=>{r.find(n=>n.type==="attributes"&&n.attributeName==="class"&&e?.classList.contains("mode-webscreen"))&&(i.disconnect(),t(void 0))});i.observe(e,{attributes:!0}),setTimeout(()=>{i.disconnect(),t(void 0)},6e3)})}};\n';var hD=`"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 mD=`"use strict";var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var x=(n,t)=>{for(var e in t)u(n,e,{get:t[e],enumerable:!0})},E=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of v(t))!T.call(n,o)&&o!==e&&u(n,o,{get:()=>t[o],enumerable:!(i=f(t,o))||i.enumerable});return n};var k=n=>E(u({},"__esModule",{value:!0}),n);var D={};x(D,{default:()=>c});module.exports=k(D);var p=()=>require("media-extended");var M=\`
|
|
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(),P=\`
|
|
/* \\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:l,MediaPlugin:A}=p(),a=class extends A{async findMedia(){let t=await l("ytd-app #movie_player video");if(this.app=t.closest("ytd-app"),this.moviePlayer=t.closest("#movie_player"),!this.app||!this.moviePlayer)throw new Error("Failed to find media");return this.watchIfDetached(),t}captionSrc=new Map;getTracks(){let t=window.ytInitialPlayerResponse?.captions?.playerCaptionsTracklistRenderer?.captionTracks;return Array.isArray(t)?t.map((e,i)=>{let o=e,r=o.vssId||\`tract\${i}\`;return this.captionSrc.set(r,{url:o.baseUrl}),{wid:r,kind:"subtitles",language:o.languageCode,label:o.name?.simpleText||o.trackName}}):[]}#t=new DOMParser;#e(t){return this.#t.parseFromString(t,"text/html").documentElement.textContent??t}async getTrack(t){let e=this.captionSrc.get(t);if(!e)return null;let i=await fetch(e.url);if(!i.ok)return null;let o=await i.text(),s=[...this.#t.parseFromString(o,"text/xml").getElementsByTagName("text")],h={Kind:"subtitles",ID:t};return{cues:s.map((d,y)=>{let m=parseFloat(d.getAttribute("start")),g=parseFloat(d.getAttribute("dur")),b=m+g,w=this.#e(d.textContent);return{id:y.toString(),startTime:m,endTime:b,text:w}}),metadata:h}}watchIfDetached(){let t=this.moviePlayer,e=new MutationObserver(async()=>{if(this.media.isConnected)return;let i=await this.findMedia();i&&this.rehookMediaEl(i)});e.observe(t,{childList:!0,subtree:!0}),this.register(()=>e.disconnect())}getStyle(){return M+\`
|
|
\`+P}async onload(){await super.onload();let t=this.getTracks();t.length>0&&this.controller.send("mx-text-tracks",{tracks:t}),this.disableAutoPlay(),l("ytd-consent-bump-v2-lightbox",this.app).then(()=>{this.controller.send("mx-open-browser",{message:"Seems like YouTube is showing a consent popup that block playback. To continue playback, you should handle it in dedicated login browser. ",url:"https://youtube.com"})})}app;moviePlayer;async disableAutoPlay(){let e=await l('button.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"]',this.app);if(!e)throw new Error("Autoplay button not found");let i=e.querySelector(".ytp-autonav-toggle-button");if(!i)throw new Error("Autoplay button label not found");let o=()=>i.getAttribute("aria-checked")==="true";o()&&(e.click(),await new Promise(r=>{let s=new MutationObserver(()=>{o()||(s.disconnect(),r())});s.observe(i,{attributes:!0})}))}enterWebFullscreen(){this.assignParentClass(this.moviePlayer),(async()=>{let t=await l("#movie_player .ytp-size-button"),e=0;for(;!this.isCinematicsMode()&&e++<5;)t.click(),await C(500);e>=5,window.dispatchEvent(new Event("resize"))})()}isCinematicsMode(){return this.media.offsetWidth===window.innerWidth}};function C(n){return new Promise(t=>setTimeout(t,n))}var c=class extends a{actualDuration=parseInt(ytInitialPlayerResponse?.videoDetails?.lengthSeconds,10);_runningAd=Number.isNaN(this.actualDuration)?null:!1;#t=null;get runningAd(){return this._runningAd}set runningAd(t){if(this._runningAd=t,t===!1)window.clearInterval(this.#t?.id??-1),this.#t=null;else if(t===!0&&!this.#t){let e={id:window.setTimeout(()=>{e.retry++>=2?(this._runningAd=!1,window.clearInterval(e.id),this.#t=null):this.adContinue()},500),retry:0};this.#t=e}}adContinue(){let t=this.moviePlayer.querySelector(".ytp-play-button")??this.moviePlayer;t.click(),S.call(t)}async onload(){if(await super.onload(),this.runningAd!==null){let t=this.media,e=()=>{if(Math.abs(t.duration-this.actualDuration)<=1){this.runningAd=!1;return}this.runningAd=!0,window.location.href.includes("https://m.youtube.com/")&&(t.muted=!0),t.currentTime=t.duration,this.adContinue()};e(),this.media.addEventListener("durationchange",e)}}};function S(){let n=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:[n],targetTouches:[n],changedTouches:[n]});this.dispatchEvent(t);let e=new TouchEvent("touchend",{bubbles:!0,cancelable:!0,view:window,touches:[],targetTouches:[],changedTouches:[n]});this.dispatchEvent(e)}
|
|
`;var gD={bilibili:fD,youtube:mD,vimeo:hD,coursera:void 0,generic:void 0};var yD="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var vD=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=yD[n[t]&63];return e};var Bf=vD(12);function eu(t){return t.replaceAll("process.env.BILI_REQ_STORE",JSON.stringify(Bf))}var xD={generic:t=>t,bilibili:t=>t.replaceAll(/[-_]哔哩哔哩.+$|[-_]bilibili.+$|-(?:番剧|电影|纪录片|国创|电视剧|综艺)-.+/g,""),youtube:t=>t.replace(/^\(\d+\) /,"").replace(/ - YouTube$/,""),vimeo:t=>t.replace(/ on Vimeo$/,""),coursera:t=>t.replace(/ \| Coursera$/,"")};function wD(t){return`webpage::${btoa(t)}`}function bD(t){return atob(t.replace(/^webpage::/,""))}function _D(t){return typeof t=="string"&&t.startsWith("webpage::")}function kD(t){return t.type==="TimeRanges"}var qv=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 fi(t){return kD(t)?new qv(t.value):t}var{onDispose:tE,peek:GG}=Ea,Kv=class{constructor(e,n){this._provider=e;this._ctx=n;T(this,"_disposal",pD());T(this,"_waiting",!1);T(this,"_attachedLoadStart",!1);T(this,"_attachedCanPlay",!1);T(this,"_handlers");T(this,"_handleDevEvent");this._attachInitialListeners(),tE(this._media.on("timeupdate",this._onTimeUpdate.bind(this))),tE(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 r=n.bind(this),i=this._media.on(e,r);return tE(i)}_onDevEvent(e){}_updateCurrentTime(e,n,r){let i={currentTime:Math.min(e,this._ctx.$state.seekableEnd()),played:n};this._notify("time-update",i,r&&new Event(r.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:r}){return{provider:GG(this._ctx.$provider),duration:e,buffered:n,seekable:r}}_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 r=fi(n.buffered),i=fi(n.seekable);this._ctx.delegate._ready(this._getCanPlayDetail({duration:n.duration,buffered:r,seekable:i}),new Event(e))}_onCanPlayThrough({type:e,payload:n}){if(this._ctx.$state.started())return;let r=fi(n.buffered),i=fi(n.seekable);this._notify("can-play-through",this._getCanPlayDetail({duration:n.duration,buffered:r,seekable:i}),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,r=fi(n.played);this._updateCurrentTime(n.duration,r,e),this._notify("end",void 0,new Event(e.type))}_onTimeUpdate(e){let{payload:n}=e,r=fi(n.played);this._updateCurrentTime(n.current,r,e)}_onDurationChange(e){let{payload:n}=e,r=fi(n.played);this._ctx.$state.ended()&&this._updateCurrentTime(n.duration,r,e),this._notify("duration-change",n.duration,new Event(e.type))}_onVolumeChange({type:e,payload:n}){let r={volume:n.volume,muted:n.muted};this._notify("volume-change",r,new Event(e))}_onSeeked(e){let{payload:n}=e,r=fi(n.played);this._updateCurrentTime(n.current,r,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 r={buffered:fi(n.buffered),seekable:fi(n.seekable)};this._notify("progress",r,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 r={message:n.message,code:n.code};this._notify("error",r,new ErrorEvent(e,{error:n}))}};async function TD(t,e){return await e.executeJavaScript(`(async function(){${t}})()`)}function SD(t){switch(t.code){case-202:return"SSL certificate isn't trusted by the browser. If the website is self-hosted, double check the SSL certificate and test it with a browser. ";default:return t.message}}var jf=class extends Error{constructor(n){super(`${n.errorCode}: ${n.errorDescription}`);T(this,"code");T(this,"description");T(this,"url");this.code=n.errorCode,this.url=n.validatedURL,this.description=n.errorDescription}};var{onDispose:ED}=Ea,Hf,Gv=class{constructor(e,n,r){this._video=e;this._media=n;this.userGesture=r;Z(this,Hf,!1);T(this,"_onChange",(e,n)=>{this._media.delegate._notify("picture-in-picture-change",e,n)});ED(e.on("enterpictureinpicture",i=>this._onChange(!0,new Event(i.type)))),ED(e.on("leavepictureinpicture",i=>this._onChange(!1,new Event(i.type))))}async updateActive(){let e=await this._video.methods.pictureInPictureEnabled();return Ue(this,Hf,e),e}get active(){return this.updateActive(),L(this,Hf)}get supported(){return!!document.pictureInPictureEnabled}async enter(){await this.userGesture(),await this._video.methods.requestPictureInPicture()}async exit(){await this._video.methods.exitPictureInPicture()}};Hf=new WeakMap;var{createScope:YG,onDispose:Yv,scoped:QG}=Ea,Gs,yn=class{constructor(e,n){this._webview=e;this._ctx=n;T(this,"scope",YG());T(this,"$$PROVIDER_TYPE","WEBVIEW");T(this,"_currentSrc",null);T(this,"_port",new Qg);T(this,"pictureInPicture");Z(this,Gs,null);T(this,"onDomReady",async e=>{let n=this._webview;new Kv(this,this._ctx),Ea.effect(()=>{this._ctx.$state.autoPlay()&&this.userGesture()}),this._updateTitle(e),await TD(QF,n),await this.loadPlugin(this.currentWebHost)});QG(()=>{this.pictureInPicture=new Gv(this._port,n,()=>this.userGesture(!0))},this.scope)}setup(){Yv(()=>{this._webview.src=""}),XG(),this.type==="webview"&&this._ctx.delegate._notify("provider-setup",this),this.registerTitleChange(),Yv(()=>{this._webview.removeEventListener("dom-ready",this.onDomReady)}),Yv(this._port.on("mx-open-browser",({payload:{url:e,message:n=""}})=>{CD({message:n+`Open ${e} in login browser?`,cancelText:"No",onConfirm:()=>{let r=new ta(app);r.open(),r.setUrl(e)}})}))}get type(){return"webview"}get webview(){return this._webview}get media(){return this._port}get currentSrc(){return this._currentSrc}get currentWebHost(){return this._currentSrc?.host??"generic"}setPlaybackRate(e){this._port.methods.setPlaybackRate(e)}async userGesture(e=!1){if(!e&&L(this,Gs)){await L(this,Gs);return}await Ue(this,Gs,this.webview.executeJavaScript("1",!0).finally(()=>{Ue(this,Gs,null)}))}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._ctx.$state.ended.set(!1),this._port.methods.setCurrentTime(e)}get _notify(){return this._ctx.delegate._notify}async _updateTitle(e,n){let r=e=typeof e=="string"?new Event(e):e,i=n??this._webview.getTitle(),o=xD[this.currentWebHost](i),a=this._ctx.$state.title();o!==a&&this._notify("title-change",o,r)}loadPlugin(e){return new Promise((n,r)=>{let i=this._webview,o=this.media.onReady(async()=>{window.clearTimeout(a),await this.media.methods.loadPlugin(eu(gD[e])),n()},{once:!0}),a=setTimeout(()=>{o(),r(new go(5e3))},5e3),{port1:s,port2:l}=new MessageChannel;this._port.load(s),i.contentWindow.postMessage(QM,"*",[l])})}handlePlayReady(){let e=new Promise((a,s)=>{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=>{s(new jf(d)),l()};this.webview.addEventListener("did-stop-loading",c),this.webview.addEventListener("did-finish-load",c),this.webview.addEventListener("did-fail-load",u)}),n,r=a=>new Promise((s,l)=>{n=window.setTimeout(()=>l(new go(a)),a)}),i=new Promise(a=>{this._port.once("mx-play-ready",()=>{a(),window.clearTimeout(n)})}),o=1e4;e.then(()=>Promise.race([i,r(o)])).then(()=>{this.togglePlayReady(!0)}).catch(a=>{if(a instanceof go)ZG(o);else if(a instanceof jf){let s=SD(a);new Oa.Notice(createFragment(l=>{l.appendText(`Failed to load webpage: ${s}`),l.createEl("p",{text:"Click to copy "},c=>c.createEl("a",{href:a.url,text:a.url.length>50?`${a.url.substring(0,50)}...`:a.url},u=>{u.addEventListener("click",d=>{d.preventDefault(),navigator.clipboard.writeText(a.url),new Oa.Notice("URL copied to clipboard.")})}))}))}else throw a}).finally(()=>{this.togglePlayReady(!0)})}registerTitleChange(){let e=this._webview,n=r=>{this._updateTitle(r,r.title)};e.addEventListener("page-title-updated",n),Yv(()=>{e.removeEventListener("page-title-updated",n)})}togglePlayReady(e){typeof e>"u"&&(e=!("playReady"in this._webview.dataset)),e?this._webview.dataset.playReady="":delete this._webview.dataset.playReady}untilPluginReady(){let e=this._webview;return this.togglePlayReady(!1),e.removeEventListener("dom-ready",this.onDomReady),this.handlePlayReady(),new Promise((n,r)=>{let i=o=>{this.onDomReady(o).then(n).catch(r),e.removeEventListener("dom-ready",i),e.addEventListener("dom-ready",this.onDomReady)};e.addEventListener("dom-ready",i)})}async loadSource({src:e,type:n}){if(!Uf(e))throw new Error("Webview provider only supports string src.");let r=xt.create(bD(e)),i=this._webview;if(this._currentSrc={src:r?.source.href??"",type:n,host:r?.type??"generic"},!r){i.src="";return}let o=!i.src||ea(r.source)!==ea(i.src);i.src=r.href,o&&await this.untilPluginReady()}};Gs=new WeakMap;function XG(){let t="mx:webview-login-notified";localStorage.getItem(t)||(new Oa.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:"},r=>{r.createEl("br"),r.appendText('- the "Login" command'),r.createEl("br"),r.appendText("- the entry in settings tab")}),n.appendText("Click to dismiss this notice.")}),0),localStorage.setItem(t,"1"))}function ZG(t){let e="mx:webview-timeout-ignore";if(localStorage.getItem(e))return;let r=(t/1e3).toFixed(1);CD({message:`Webpage not fully loaded within ${r}s. You can still try to play.`,onCancel(){console.log("ignore webview timeout notice"),localStorage.setItem(e,"1")},cancelText:"Don't show again",timeout:5e3})}function CD({message:t,cancelText:e="Ignore",confirmText:n="OK",onConfirm:r,onCancel:i,timeout:o}){let a=new Oa.Notice(createFragment(s=>{s.createDiv({text:t}),s.createDiv({},l=>{l.style.display="flex",l.style.justifyContent="flex-end",l.style.gap="1em",l.style.marginTop="1em";let c=new Oa.ButtonComponent(l).setButtonText(n);r&&c.onClick(async()=>{await r(),a.hide()});let u=new Oa.ButtonComponent(l).setButtonText(e);i&&u.onClick(async()=>{await i(),a.hide()})})}),o);return a}var JG=typeof global=="object"&&global&&global.Object===Object&&global,Qv=JG;var eY=typeof self=="object"&&self&&self.Object===Object&&self,tY=Qv||eY||Function("return this")(),Gt=tY;var nY=Gt.Symbol,Kr=nY;var MD=Object.prototype,rY=MD.hasOwnProperty,iY=MD.toString,Wf=Kr?Kr.toStringTag:void 0;function oY(t){var e=rY.call(t,Wf),n=t[Wf];try{t[Wf]=void 0;var r=!0}catch{}var i=iY.call(t);return r&&(e?t[Wf]=n:delete t[Wf]),i}var RD=oY;var aY=Object.prototype,sY=aY.toString;function lY(t){return sY.call(t)}var $D=lY;var cY="[object Null]",uY="[object Undefined]",ID=Kr?Kr.toStringTag:void 0;function dY(t){return t==null?t===void 0?uY:cY:ID&&ID in Object(t)?RD(t):$D(t)}var hi=dY;function pY(t){return t!=null&&typeof t=="object"}var mi=pY;var fY="[object Symbol]";function hY(t){return typeof t=="symbol"||mi(t)&&hi(t)==fY}var tu=hY;function mY(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var LD=mY;var gY=Array.isArray,ln=gY;var yY=1/0,AD=Kr?Kr.prototype:void 0,OD=AD?AD.toString:void 0;function FD(t){if(typeof t=="string")return t;if(ln(t))return LD(t,FD)+"";if(tu(t))return OD?OD.call(t):"";var e=t+"";return e=="0"&&1/t==-yY?"-0":e}var DD=FD;function vY(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var nu=vY;function xY(t){return t}var ND=xY;var wY="[object AsyncFunction]",bY="[object Function]",_Y="[object GeneratorFunction]",kY="[object Proxy]";function TY(t){if(!nu(t))return!1;var e=hi(t);return e==bY||e==_Y||e==wY||e==kY}var Xv=TY;var SY=Gt["__core-js_shared__"],Zv=SY;var VD=function(){var t=/[^.]+$/.exec(Zv&&Zv.keys&&Zv.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function EY(t){return!!VD&&VD in t}var zD=EY;var PY=Function.prototype,CY=PY.toString;function MY(t){if(t!=null){try{return CY.call(t)}catch{}try{return t+""}catch{}}return""}var $o=MY;var RY=/[\\^$.*+?()[\]{}|]/g,$Y=/^\[object .+?Constructor\]$/,IY=Function.prototype,LY=Object.prototype,AY=IY.toString,OY=LY.hasOwnProperty,FY=RegExp("^"+AY.call(OY).replace(RY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function DY(t){if(!nu(t)||zD(t))return!1;var e=Xv(t)?FY:$Y;return e.test($o(t))}var UD=DY;function NY(t,e){return t?.[e]}var BD=NY;function VY(t,e){var n=BD(t,e);return UD(n)?n:void 0}var Xn=VY;var zY=Xn(Gt,"WeakMap"),Jv=zY;var UY=function(){try{var t=Xn(Object,"defineProperty");return t({},"",{}),t}catch{}}(),nE=UY;var BY=9007199254740991,jY=/^(?:0|[1-9]\d*)$/;function HY(t,e){var n=typeof t;return e=e??BY,!!e&&(n=="number"||n!="symbol"&&jY.test(t))&&t>-1&&t%1==0&&t<e}var ex=HY;function WY(t,e,n){e=="__proto__"&&nE?nE(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var jD=WY;function qY(t,e){return t===e||t!==t&&e!==e}var tx=qY;var KY=9007199254740991;function GY(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KY}var ru=GY;function YY(t){return t!=null&&ru(t.length)&&!Xv(t)}var HD=YY;var QY=Object.prototype;function XY(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||QY;return t===n}var WD=XY;function ZY(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var qD=ZY;var JY="[object Arguments]";function eQ(t){return mi(t)&&hi(t)==JY}var rE=eQ;var KD=Object.prototype,tQ=KD.hasOwnProperty,nQ=KD.propertyIsEnumerable,rQ=rE(function(){return arguments}())?rE:function(t){return mi(t)&&tQ.call(t,"callee")&&!nQ.call(t,"callee")},nx=rQ;function iQ(){return!1}var GD=iQ;var XD=typeof exports=="object"&&exports&&!exports.nodeType&&exports,YD=XD&&typeof module=="object"&&module&&!module.nodeType&&module,oQ=YD&&YD.exports===XD,QD=oQ?Gt.Buffer:void 0,aQ=QD?QD.isBuffer:void 0,sQ=aQ||GD,qf=sQ;var lQ="[object Arguments]",cQ="[object Array]",uQ="[object Boolean]",dQ="[object Date]",pQ="[object Error]",fQ="[object Function]",hQ="[object Map]",mQ="[object Number]",gQ="[object Object]",yQ="[object RegExp]",vQ="[object Set]",xQ="[object String]",wQ="[object WeakMap]",bQ="[object ArrayBuffer]",_Q="[object DataView]",kQ="[object Float32Array]",TQ="[object Float64Array]",SQ="[object Int8Array]",EQ="[object Int16Array]",PQ="[object Int32Array]",CQ="[object Uint8Array]",MQ="[object Uint8ClampedArray]",RQ="[object Uint16Array]",$Q="[object Uint32Array]",Je={};Je[kQ]=Je[TQ]=Je[SQ]=Je[EQ]=Je[PQ]=Je[CQ]=Je[MQ]=Je[RQ]=Je[$Q]=!0;Je[lQ]=Je[cQ]=Je[bQ]=Je[uQ]=Je[_Q]=Je[dQ]=Je[pQ]=Je[fQ]=Je[hQ]=Je[mQ]=Je[gQ]=Je[yQ]=Je[vQ]=Je[xQ]=Je[wQ]=!1;function IQ(t){return mi(t)&&ru(t.length)&&!!Je[hi(t)]}var ZD=IQ;function LQ(t){return function(e){return t(e)}}var JD=LQ;var eN=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kf=eN&&typeof module=="object"&&module&&!module.nodeType&&module,AQ=Kf&&Kf.exports===eN,iE=AQ&&Qv.process,OQ=function(){try{var t=Kf&&Kf.require&&Kf.require("util").types;return t||iE&&iE.binding&&iE.binding("util")}catch{}}(),oE=OQ;var tN=oE&&oE.isTypedArray,FQ=tN?JD(tN):ZD,rx=FQ;var DQ=Object.prototype,NQ=DQ.hasOwnProperty;function VQ(t,e){var n=ln(t),r=!n&&nx(t),i=!n&&!r&&qf(t),o=!n&&!r&&!i&&rx(t),a=n||r||i||o,s=a?qD(t.length,String):[],l=s.length;for(var c in t)(e||NQ.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ex(c,l)))&&s.push(c);return s}var nN=VQ;function zQ(t,e){return function(n){return t(e(n))}}var rN=zQ;var UQ=rN(Object.keys,Object),iN=UQ;var BQ=Object.prototype,jQ=BQ.hasOwnProperty;function HQ(t){if(!WD(t))return iN(t);var e=[];for(var n in Object(t))jQ.call(t,n)&&n!="constructor"&&e.push(n);return e}var oN=HQ;function WQ(t){return HD(t)?nN(t):oN(t)}var iu=WQ;var qQ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,KQ=/^\w*$/;function GQ(t,e){if(ln(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||tu(t)?!0:KQ.test(t)||!qQ.test(t)||e!=null&&t in Object(e)}var ou=GQ;var YQ=Xn(Object,"create"),Io=YQ;function QQ(){this.__data__=Io?Io(null):{},this.size=0}var aN=QQ;function XQ(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var sN=XQ;var ZQ="__lodash_hash_undefined__",JQ=Object.prototype,eX=JQ.hasOwnProperty;function tX(t){var e=this.__data__;if(Io){var n=e[t];return n===ZQ?void 0:n}return eX.call(e,t)?e[t]:void 0}var lN=tX;var nX=Object.prototype,rX=nX.hasOwnProperty;function iX(t){var e=this.__data__;return Io?e[t]!==void 0:rX.call(e,t)}var cN=iX;var oX="__lodash_hash_undefined__";function aX(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Io&&e===void 0?oX:e,this}var uN=aX;function au(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}au.prototype.clear=aN;au.prototype.delete=sN;au.prototype.get=lN;au.prototype.has=cN;au.prototype.set=uN;var aE=au;function sX(){this.__data__=[],this.size=0}var dN=sX;function lX(t,e){for(var n=t.length;n--;)if(tx(t[n][0],e))return n;return-1}var Fa=lX;var cX=Array.prototype,uX=cX.splice;function dX(t){var e=this.__data__,n=Fa(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():uX.call(e,n,1),--this.size,!0}var pN=dX;function pX(t){var e=this.__data__,n=Fa(e,t);return n<0?void 0:e[n][1]}var fN=pX;function fX(t){return Fa(this.__data__,t)>-1}var hN=fX;function hX(t,e){var n=this.__data__,r=Fa(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var mN=hX;function su(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}su.prototype.clear=dN;su.prototype.delete=pN;su.prototype.get=fN;su.prototype.has=hN;su.prototype.set=mN;var Da=su;var mX=Xn(Gt,"Map"),Na=mX;function gX(){this.size=0,this.__data__={hash:new aE,map:new(Na||Da),string:new aE}}var gN=gX;function yX(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var yN=yX;function vX(t,e){var n=t.__data__;return yN(e)?n[typeof e=="string"?"string":"hash"]:n.map}var Va=vX;function xX(t){var e=Va(this,t).delete(t);return this.size-=e?1:0,e}var vN=xX;function wX(t){return Va(this,t).get(t)}var xN=wX;function bX(t){return Va(this,t).has(t)}var wN=bX;function _X(t,e){var n=Va(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var bN=_X;function lu(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}lu.prototype.clear=gN;lu.prototype.delete=vN;lu.prototype.get=xN;lu.prototype.has=wN;lu.prototype.set=bN;var Ys=lu;var kX="Expected a function";function sE(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(kX);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(sE.Cache||Ys),n}sE.Cache=Ys;var _N=sE;var TX=500;function SX(t){var e=_N(t,function(r){return n.size===TX&&n.clear(),r}),n=e.cache;return e}var kN=SX;var EX=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PX=/\\(\\)?/g,CX=kN(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(EX,function(n,r,i,o){e.push(i?o.replace(PX,"$1"):r||n)}),e}),TN=CX;function MX(t){return t==null?"":DD(t)}var cu=MX;function RX(t,e){return ln(t)?t:ou(t,e)?[t]:TN(cu(t))}var ix=RX;var $X=1/0;function IX(t){if(typeof t=="string"||tu(t))return t;var e=t+"";return e=="0"&&1/t==-$X?"-0":e}var za=IX;function LX(t,e){e=ix(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[za(e[n++])];return n&&n==r?t:void 0}var ox=LX;function AX(t,e,n){var r=t==null?void 0:ox(t,e);return r===void 0?n:r}var SN=AX;function OX(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var EN=OX;function FX(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}var PN=FX;function DX(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:PN(t,e,n)}var CN=DX;var NX="\\ud800-\\udfff",VX="\\u0300-\\u036f",zX="\\ufe20-\\ufe2f",UX="\\u20d0-\\u20ff",BX=VX+zX+UX,jX="\\ufe0e\\ufe0f",HX="\\u200d",WX=RegExp("["+HX+NX+BX+jX+"]");function qX(t){return WX.test(t)}var ax=qX;function KX(t){return t.split("")}var MN=KX;var RN="\\ud800-\\udfff",GX="\\u0300-\\u036f",YX="\\ufe20-\\ufe2f",QX="\\u20d0-\\u20ff",XX=GX+YX+QX,ZX="\\ufe0e\\ufe0f",JX="["+RN+"]",lE="["+XX+"]",cE="\\ud83c[\\udffb-\\udfff]",eZ="(?:"+lE+"|"+cE+")",$N="[^"+RN+"]",IN="(?:\\ud83c[\\udde6-\\uddff]){2}",LN="[\\ud800-\\udbff][\\udc00-\\udfff]",tZ="\\u200d",AN=eZ+"?",ON="["+ZX+"]?",nZ="(?:"+tZ+"(?:"+[$N,IN,LN].join("|")+")"+ON+AN+")*",rZ=ON+AN+nZ,iZ="(?:"+[$N+lE+"?",lE,IN,LN,JX].join("|")+")",oZ=RegExp(cE+"(?="+cE+")|"+iZ+rZ,"g");function aZ(t){return t.match(oZ)||[]}var FN=aZ;function sZ(t){return ax(t)?FN(t):MN(t)}var DN=sZ;function lZ(t){return function(e){e=cu(e);var n=ax(e)?DN(e):void 0,r=n?n[0]:e.charAt(0),i=n?CN(n,1).join(""):e.slice(1);return r[t]()+i}}var NN=lZ;var cZ=NN("toUpperCase"),Gf=cZ;function uZ(){this.__data__=new Da,this.size=0}var VN=uZ;function dZ(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var zN=dZ;function pZ(t){return this.__data__.get(t)}var UN=pZ;function fZ(t){return this.__data__.has(t)}var BN=fZ;var hZ=200;function mZ(t,e){var n=this.__data__;if(n instanceof Da){var r=n.__data__;if(!Na||r.length<hZ-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ys(r)}return n.set(t,e),this.size=n.size,this}var jN=mZ;function uu(t){var e=this.__data__=new Da(t);this.size=e.size}uu.prototype.clear=VN;uu.prototype.delete=zN;uu.prototype.get=UN;uu.prototype.has=BN;uu.prototype.set=jN;var du=uu;function gZ(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}var HN=gZ;function yZ(){return[]}var WN=yZ;var vZ=Object.prototype,xZ=vZ.propertyIsEnumerable,qN=Object.getOwnPropertySymbols,wZ=qN?function(t){return t==null?[]:(t=Object(t),HN(qN(t),function(e){return xZ.call(t,e)}))}:WN,KN=wZ;function bZ(t,e,n){var r=e(t);return ln(t)?r:EN(r,n(t))}var GN=bZ;function _Z(t){return GN(t,iu,KN)}var uE=_Z;var kZ=Xn(Gt,"DataView"),sx=kZ;var TZ=Xn(Gt,"Promise"),lx=TZ;var SZ=Xn(Gt,"Set"),cx=SZ;var YN="[object Map]",EZ="[object Object]",QN="[object Promise]",XN="[object Set]",ZN="[object WeakMap]",JN="[object DataView]",PZ=$o(sx),CZ=$o(Na),MZ=$o(lx),RZ=$o(cx),$Z=$o(Jv),Qs=hi;(sx&&Qs(new sx(new ArrayBuffer(1)))!=JN||Na&&Qs(new Na)!=YN||lx&&Qs(lx.resolve())!=QN||cx&&Qs(new cx)!=XN||Jv&&Qs(new Jv)!=ZN)&&(Qs=function(t){var e=hi(t),n=e==EZ?t.constructor:void 0,r=n?$o(n):"";if(r)switch(r){case PZ:return JN;case CZ:return YN;case MZ:return QN;case RZ:return XN;case $Z:return ZN}return e});var dE=Qs;var IZ=Gt.Uint8Array,pE=IZ;var LZ="__lodash_hash_undefined__";function AZ(t){return this.__data__.set(t,LZ),this}var e2=AZ;function OZ(t){return this.__data__.has(t)}var t2=OZ;function ux(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Ys;++e<n;)this.add(t[e])}ux.prototype.add=ux.prototype.push=e2;ux.prototype.has=t2;var n2=ux;function FZ(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var r2=FZ;function DZ(t,e){return t.has(e)}var i2=DZ;var NZ=1,VZ=2;function zZ(t,e,n,r,i,o){var a=n&NZ,s=t.length,l=e.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(t),u=o.get(e);if(c&&u)return c==e&&u==t;var d=-1,p=!0,f=n&VZ?new n2:void 0;for(o.set(t,e),o.set(e,t);++d<s;){var h=t[d],g=e[d];if(r)var x=a?r(g,h,d,e,t,o):r(h,g,d,t,e,o);if(x!==void 0){if(x)continue;p=!1;break}if(f){if(!r2(e,function(m,y){if(!i2(f,y)&&(h===m||i(h,m,n,r,o)))return f.push(y)})){p=!1;break}}else if(!(h===g||i(h,g,n,r,o))){p=!1;break}}return o.delete(t),o.delete(e),p}var dx=zZ;function UZ(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}var o2=UZ;function BZ(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var a2=BZ;var jZ=1,HZ=2,WZ="[object Boolean]",qZ="[object Date]",KZ="[object Error]",GZ="[object Map]",YZ="[object Number]",QZ="[object RegExp]",XZ="[object Set]",ZZ="[object String]",JZ="[object Symbol]",eJ="[object ArrayBuffer]",tJ="[object DataView]",s2=Kr?Kr.prototype:void 0,fE=s2?s2.valueOf:void 0;function nJ(t,e,n,r,i,o,a){switch(n){case tJ:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case eJ:return!(t.byteLength!=e.byteLength||!o(new pE(t),new pE(e)));case WZ:case qZ:case YZ:return tx(+t,+e);case KZ:return t.name==e.name&&t.message==e.message;case QZ:case ZZ:return t==e+"";case GZ:var s=o2;case XZ:var l=r&jZ;if(s||(s=a2),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;r|=HZ,a.set(t,e);var u=dx(s(t),s(e),r,i,o,a);return a.delete(t),u;case JZ:if(fE)return fE.call(t)==fE.call(e)}return!1}var l2=nJ;var rJ=1,iJ=Object.prototype,oJ=iJ.hasOwnProperty;function aJ(t,e,n,r,i,o){var a=n&rJ,s=uE(t),l=s.length,c=uE(e),u=c.length;if(l!=u&&!a)return!1;for(var d=l;d--;){var p=s[d];if(!(a?p in e:oJ.call(e,p)))return!1}var f=o.get(t),h=o.get(e);if(f&&h)return f==e&&h==t;var g=!0;o.set(t,e),o.set(e,t);for(var x=a;++d<l;){p=s[d];var m=t[p],y=e[p];if(r)var v=a?r(y,m,p,e,t,o):r(m,y,p,t,e,o);if(!(v===void 0?m===y||i(m,y,n,r,o):v)){g=!1;break}x||(x=p=="constructor")}if(g&&!x){var w=t.constructor,k=e.constructor;w!=k&&"constructor"in t&&"constructor"in e&&!(typeof w=="function"&&w instanceof w&&typeof k=="function"&&k instanceof k)&&(g=!1)}return o.delete(t),o.delete(e),g}var c2=aJ;var sJ=1,u2="[object Arguments]",d2="[object Array]",px="[object Object]",lJ=Object.prototype,p2=lJ.hasOwnProperty;function cJ(t,e,n,r,i,o){var a=ln(t),s=ln(e),l=a?d2:dE(t),c=s?d2:dE(e);l=l==u2?px:l,c=c==u2?px:c;var u=l==px,d=c==px,p=l==c;if(p&&qf(t)){if(!qf(e))return!1;a=!0,u=!1}if(p&&!u)return o||(o=new du),a||rx(t)?dx(t,e,n,r,i,o):l2(t,e,l,n,r,i,o);if(!(n&sJ)){var f=u&&p2.call(t,"__wrapped__"),h=d&&p2.call(e,"__wrapped__");if(f||h){var g=f?t.value():t,x=h?e.value():e;return o||(o=new du),i(g,x,n,r,o)}}return p?(o||(o=new du),c2(t,e,n,r,i,o)):!1}var f2=cJ;function h2(t,e,n,r,i){return t===e?!0:t==null||e==null||!mi(t)&&!mi(e)?t!==t&&e!==e:f2(t,e,n,r,h2,i)}var fx=h2;var uJ=1,dJ=2;function pJ(t,e,n,r){var i=n.length,o=i,a=!r;if(t==null)return!o;for(t=Object(t);i--;){var s=n[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){s=n[i];var l=s[0],c=t[l],u=s[1];if(a&&s[2]){if(c===void 0&&!(l in t))return!1}else{var d=new du;if(r)var p=r(c,u,l,t,e,d);if(!(p===void 0?fx(u,c,uJ|dJ,r,d):p))return!1}}return!0}var m2=pJ;function fJ(t){return t===t&&!nu(t)}var hx=fJ;function hJ(t){for(var e=iu(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,hx(i)]}return e}var g2=hJ;function mJ(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var mx=mJ;function gJ(t){var e=g2(t);return e.length==1&&e[0][2]?mx(e[0][0],e[0][1]):function(n){return n===t||m2(n,t,e)}}var y2=gJ;function yJ(t,e){return t!=null&&e in Object(t)}var v2=yJ;function vJ(t,e,n){e=ix(e,t);for(var r=-1,i=e.length,o=!1;++r<i;){var a=za(e[r]);if(!(o=t!=null&&n(t,a)))break;t=t[a]}return o||++r!=i?o:(i=t==null?0:t.length,!!i&&ru(i)&&ex(a,i)&&(ln(t)||nx(t)))}var x2=vJ;function xJ(t,e){return t!=null&&x2(t,e,v2)}var w2=xJ;var wJ=1,bJ=2;function _J(t,e){return ou(t)&&hx(e)?mx(za(t),e):function(n){var r=SN(n,t);return r===void 0&&r===e?w2(n,t):fx(e,r,wJ|bJ)}}var b2=_J;function kJ(t){return function(e){return e?.[t]}}var _2=kJ;function TJ(t){return function(e){return ox(e,t)}}var k2=TJ;function SJ(t){return ou(t)?_2(za(t)):k2(t)}var T2=SJ;function EJ(t){return typeof t=="function"?t:t==null?ND:typeof t=="object"?ln(t)?b2(t[0],t[1]):y2(t):T2(t)}var S2=EJ;function PJ(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),s=a.length;s--;){var l=a[t?s:++i];if(n(o[l],l,o)===!1)break}return e}}var E2=PJ;var CJ=E2(),P2=CJ;function MJ(t,e){return t&&P2(t,e,iu)}var C2=MJ;var M2=/[\\^$.*+?()[\]{}|]/g,RJ=RegExp(M2.source);function $J(t){return t=cu(t),t&&RJ.test(t)?t.replace(M2,"\\$&"):t}var gx=$J;function IJ(t,e){var n={};return e=S2(e,3),C2(t,function(r,i,o){jD(n,i,e(r,i,o))}),n}var hE=IJ;var yr=$(K());var z2=require("url"),U2=require("obsidian");function gi(t,e="/"){let n=t.split(e).pop(),r=n.split(".").pop(),i={name:n,path:t,parent:t.slice(0,-n.length-1)};return r===n?{extension:"",basename:n,...i}:{extension:r,basename:n.slice(0,-r.length-1),...i}}var wx=$(mE());function xx(t,e){let n=new Map;for(let r of t){let i=e(r),o=n.get(i);o?o.push(r):n.set(i,[r])}return n}var N2={"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"},V2=()=>xx(Object.entries(N2),([t])=>t.split("-")[0]),D2={"zh-Hans":["CN","SG","MY"],"zh-Hant":["TW","HK","MO"]};function pu(t,e=n=>n){if(!t?.trim())return"";t=t.trim();let n=t.split("-"),r=n[0].toLowerCase();if(n.length===1)return e(wx.default.getNativeName(r));let i=n.slice(0,2).join("-");return e(N2[i]||`${wx.default.getNativeName(n[0])} - ${t}`)}function AJ(t){return t.toLowerCase()==="hans"||D2["zh-Hans"].includes(t.toUpperCase())?"zh-Hans":t.toLowerCase()==="hant"||D2["zh-Hant"].includes(t.toUpperCase())?"zh-Hant":"zh"}function Qf(t){if(!t)return!1;let e=t.split("-")[0].toLowerCase();return wx.default.validate(e)}function bx(t){if(!Qf(t))return null;let e=t.split("-"),n=e[0].toLowerCase();if(e.length===1)return n;let r=e[1];return n==="zh"?AJ(r):`${n}-${e.slice(1).map((i,o)=>o===0?i.toUpperCase():i).join("-")}`}var OJ=new Set(["https:","http:","file:"]),Xf={subtitles:{singular:"subtitle",plural:"subtitles"},captions:{singular:"caption",plural:"captions"}},B2=Object.keys(Xf),FJ="wid";function j2(t,e={}){let n=rr(t);if(!n||!OJ.has(n.protocol))return null;if(n.protocol==="file:")try{let r=(0,z2.fileURLToPath)(n),i=Ua(gi(r),{kind:e.kind,subpath:n.hash});return i||null}catch(r){return console.error("Failed to resolve file path",r,n.href),null}try{return DJ(n,e)}catch(r){return console.error("Invalid track URL",r,n.href),null}}function H2(t){let e=new URLSearchParams(t.replace(/^#/,"")),n=e.get("type")??void 0;(!n||!Xs(n))&&(n=void 0);let r=e.get("kind")??void 0;return r!=="captions"&&r!=="subtitles"&&(r=void 0),{language:e.get("lang")??void 0,label:e.get("label")??void 0,type:n,kind:r,wid:e.get(FJ)??void 0}}function DJ(t,{kind:e}){let n=H2(t.hash),{wid:r,kind:i=e??"subtitles",label:o}=n,{language:a,type:s}=n,{basename:l,extension:c}=gi(t.pathname,"/");if(Xs(c)){let{language:u}=W2(l);return u&&(a??(a=u)),s??(s=c),{wid:r,language:a,label:o,type:s,kind:i,src:t}}if(!s)throw new Error("Cannot infer format from URL, provide format in hash: "+t.href);return{wid:r,language:a,label:o,type:s,kind:i,src:t}}function W2(t){let e=t.split("."),n=e.length>1?bx(e.last()):null;return{basename:n?t.replace(new RegExp(`\\.?${e.last()}$`),""):t,language:n}}var q2=["vtt","srt","ass","ssa"],NJ=new Set(q2),_x=()=>[...q2];function Xs(t){return NJ.has(t)}function VJ(t){return Xs(t.extension)}function Ua(t,{kind:e="subtitles",subpath:n="",alias:r}={}){if(!VJ(t))return null;let{basename:i,language:o}=W2(t.basename),a=H2(n);return{wid:a.wid,kind:a.kind??e,basename:i,label:r??a.label,language:a.language??o??void 0,src:t,type:a.type??t.extension}}function Lo({wid:t,src:e}){let n=e instanceof URL?"url":e instanceof U2.TFile?"file":"file-url",r=e instanceof URL?ea(e):e.path;return{id:`${n}:${r}`,wid:t}}function K2(t){return t.startsWith("file:")}function kx(t){return Array.from(new Set(t))}function G2(t,e){let n=kx(t.reduce((i,o)=>{let a=bx(o.language);return a&&i.push(a),i},[]));return e?n.find(i=>{if(i)return i===e})??n.find(i=>{if(!i)return;let o=i.split("-")[0],a=e.split("-")[0];return o===a}):n.filter(i=>!!i)[0]}function gE(){let t=et(r=>r.source?.url?`mx-last-track:${Ct(r.source.url)}`:null),[e,n]=(0,yr.useState)(()=>t&&window?window.localStorage.getItem(t):null);return(0,yr.useEffect)(()=>{},[t]),[e===""?!1:e,(0,yr.useCallback)(r=>{t&&(r?window?.localStorage.setItem(t,r):window?.localStorage.setItem(t,""))},[t])]}function zJ(){let t=yi(n=>n.defaultLanguage),e=yi(n=>n.getDefaultLang);return(0,yr.useMemo)(()=>e(),[t])}function UJ(){let[t]=gE(),e=zJ(),n=yi(r=>r.enableSubtitle);return(0,yr.useCallback)((...r)=>{if(t===!1)return()=>!1;if(t){let i=jJ(t);return({id:o,wid:a})=>o===t||a===i}if(n){let i=G2(r,e);return i?({language:o})=>o===i:(o,a)=>a===0}return()=>!1},[e,n,t])}function Y2(){let t=et(s=>s.textTracks.local),e=et(s=>s.textTracks.remote),n=et(s=>s.updateWebsiteTracks),r=Uv(),i=UJ();(0,yr.useEffect)(()=>{if(!(r instanceof yn))return;let s=o.current;return r.media.on("mx-text-tracks",({payload:{tracks:l}})=>{s.set(l,r),n(l),l.length!==0&&console.debug("Remote tracks loaded",l)})},[r,n]);let o=(0,yr.useRef)();o.current??(o.current=new WeakMap);let a=Wr();(0,yr.useEffect)(()=>{if(!a)return;let s=o.current.get(e),l=async(p,f)=>{let h=HJ(p);if(!h)return fetch(p,f);if(!s)return new Response(null,{status:500});let g=await s.media.methods.getTrack(h);return g?new Response(JSON.stringify(g),{headers:{"Content-Type":"application/json"}}):new Response(null,{status:404})},c=i(...t,...e),u=t.map((p,f)=>{let{wid:h,src:g,...x}=p,m=Lo(p).id,y=c({id:m,language:x.language,wid:h},f);return new gn({...x,id:m,default:y})}),d=Jf(e,t).map(({wid:p,...f},h)=>{let g=Q2(p),x=c({id:g,language:f.language,wid:p},h+t.length),m=new gn({...f,id:g,type:"json",src:BJ(p),default:x});return m.customFetch=l,m});a.textTracks.clear(),a.textTracks._defaults={},[...u,...d].sort(yE).forEach((p,f)=>{p.label=Zf(p,f),a.textTracks.add(p)})},[i,a,t,e])}var Tx="webpage:";function Q2(t){return Tx+t}function BJ(t){return`webview://${Q2(t)}`}function jJ(t){return t.startsWith(Tx)?t.slice(Tx.length):null}function HJ(t){return typeof t!="string"||!t.startsWith("webview://")?null:t.slice(`webview://${Tx}`.length)}function Jf(t,e){return t.filter(n=>!e.some(({wid:r})=>r===n.wid))}function Zf(t,e){return t.label||pu(t.language)||`${Gf(t.kind)} ${e+1}`}function yE(t,e){if(t&&e){if(t.language&&e.language)return t.language.localeCompare(e.language);if(!t.language&&!e.language)return Zf(t,-1).localeCompare(Zf(e,-1));if(t.language&&!e.language)return-1;if(!t.language&&e.language)return 1}return t===null&&e!==null?1:t!==null&&e===null?-1:0}var X2={"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(X2);var Z2=X2;var J2={"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(J2);var e3=J2;var Gr=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},fu,eh,Zs,vE=class{constructor(...e){fu.set(this,new Map),eh.set(this,new Map),Zs.set(this,new Map);for(let n of e)this.define(n)}define(e,n=!1){for(let[r,i]of Object.entries(e)){r=r.toLowerCase(),i=i.map(s=>s.toLowerCase()),Gr(this,Zs,"f").has(r)||Gr(this,Zs,"f").set(r,new Set);let o=Gr(this,Zs,"f").get(r),a=!0;for(let s of i){let l=s.startsWith("*");if(s=l?s.slice(1):s,o?.add(s),a&&Gr(this,eh,"f").set(r,s),a=!1,l)continue;let c=Gr(this,fu,"f").get(s);if(c&&c!=r&&!n)throw new Error(`"${r} -> ${s}" conflicts with "${c} -> ${s}". Pass \`force=true\` to override this definition.`);Gr(this,fu,"f").set(s,r)}}return this}getType(e){if(typeof e!="string")return null;let n=e.replace(/^.*[/\\]/,"").toLowerCase(),r=n.replace(/^.*\./,"").toLowerCase(),i=n.length<e.length;return!(r.length<n.length-1)&&i?null:Gr(this,fu,"f").get(r)??null}getExtension(e){return typeof e!="string"?null:(e=e?.split?.(";")[0],(e&&Gr(this,eh,"f").get(e.trim().toLowerCase()))??null)}getAllExtensions(e){return typeof e!="string"?null:Gr(this,Zs,"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 Gr(this,Zs,"f").values())Object.freeze(e);return this}_getTestState(){return{types:Gr(this,fu,"f"),extensions:Gr(this,eh,"f")}}};fu=new WeakMap,eh=new WeakMap,Zs=new WeakMap;var xE=vE;var wE=new xE(e3,Z2)._freeze();var vn=require("obsidian");var th=require("obsidian");async function t3(t,e,n){let r=document.createElement("canvas"),{videoWidth:i,videoHeight:o}=t;if(!i||!o)throw new Error("Cannot screenshot video without width or height");Object.assign(r,{width:i,height:o});let a=r.getContext("2d",{alpha:!1});if(!a)throw new Error("Canvas context creation failed");a.drawImage(t,0,0,i,o);let s=await new Promise((c,u)=>{try{r.toBlob(d=>{d?c(d):u(new Error("Canvas to blob failed"))},e,n)}catch(d){u(d)}}),l=await s.arrayBuffer();return{time:t.currentTime,blob:{arrayBuffer:l,type:s.type}}}function Js(t){return Qc(t)||t instanceof yn}async function nh(t,e,n){let r=th.Platform.isSafari&&e==="image/webp"?"image/jpeg":e;try{if(Qc(t))return await t3(t.video,r,n);if(t instanceof yn)return await t.media.methods.screenshot(r,n);throw new Error("Unsupported provider for screenshot")}catch(i){throw i?.name==="SecurityError"||i?.message?.match(/Tainted canvas/i)?new th.Notice("Cannot take screenshot due to CORS restriction, you may try open media as webpage to bypass this"):new th.Notice("Cannot take screenshot: "+(i instanceof Error?i.message:String(i))),i}}var el=require("obsidian");async function Sx(t,{plugin:e,sourcePath:n}){let{fileManager:r,vault:i}=e.app;if(!t){let a=`${Date.now()}.${Math.random().toString(36).substring(2)}`;t=(0,el.normalizePath)((await r.getAvailablePathForAttachment(a,n)).replace(a,""))}let o=i.getAbstractFileByPath(t);if(o instanceof el.TFolder)return o;if(o===null)return await i.createFolder(t).catch(a=>{throw new el.Notice(`Failed to create folder ${t}: ${a instanceof Error?a.message:a}`),a});throw new el.Notice(`Folder path occupied, check your preferences: ${o.path}`),new Error(`Folder occupied: ${o.path}`)}function Ex(){return/[<>:"/\\|?*\u0000-\u001F]/g}function n3(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var WJ=100,qJ=/^\.+(\\|\/)|^\.+$/,KJ=/\.+$/;function bE(t,e={}){let n=/[\u0000-\u001F\u0080-\u009F]/g,r=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof t!="string")throw new TypeError("Expected a string");let i=e.replacement===void 0?"!":e.replacement;if(Ex().test(i)&&n.test(i))throw new Error("Replacement string cannot contain reserved filename characters");i.length>0&&(t=t.replace(r,"$1")),t=t.normalize("NFD"),t=t.replace(qJ,i),t=t.replace(Ex(),i),t=t.replace(n,i),t=t.replace(KJ,""),i.length>0&&(!(t[0]===".")&&t[0]==="."&&(t=i+t),t[t.length-1]==="."&&(t+=i)),t=n3().test(t)?t+i:t;let o=typeof e.maxLength=="number"?e.maxLength:WJ;if(t.length>o){let a=t.lastIndexOf(".");if(a===-1)t=t.slice(0,o);else{let s=t.slice(0,a),l=t.slice(a);t=s.slice(0,Math.max(1,o-l.length))+l}}return t}function hu(t){return bE(t,{replacement:"_"}).replaceAll(/[[\]#^|]/g,"_")}function GJ(t,e){if(e?.title)return e.title;if(t.isFileUrl){let{basename:n,extension:r}=gi(t.pathname);if(r)return n}return t.type!=="generic"&&t.id?`${t.type}: ${t.id}`:t.source.hostname+decodeURI(t.source.pathname).replaceAll("/","_")}function Ao(t,{state:e}={}){return Se(t)?t.file.basename:GJ(t,e)}function Px(t){let e=t.player;if(!e)return new vn.Notice("Player not initialized"),!1;let n=t.getMediaInfo();return n?!e?.provider||!Js(e.provider)?(new vn.Notice("Screenshot is not supported for this media"),!1):{media:n,provider:e.provider,state:e.state,app:t.plugin.app,settings:t.plugin.settings.getState()}:(new vn.Notice("No media is opened"),!1)}async function rh(t,{file:e,editor:n}){let r=Px(t);if(!r)return!1;let{provider:i,state:o,media:a,app:{fileManager:s,vault:l},settings:{insertBefore:c,screenshotTemplate:u,screenshotEmbedTemplate:d,screenshotQuality:p,screenshotFormat:f,screenshotFolderPath:h}}=r,{blob:g,time:x}=await nh(i,f,p),m=Qo(x,a,r),y=wE.getExtension(g.type);if(!y)return new vn.Notice("Unknown mime type: "+g.type),!1;let v=Ao(a,{state:o}),w=hu(v)+tM(x),k=x>0?` - ${Yo(x)}`:"",b=await Sx(h,{plugin:t.plugin,sourcePath:e.path}),S=`${w}.${y}`,C=(0,vn.normalizePath)(`${b.path}/${S}`),R=!1,_=l.getAbstractFileByPath(C);if(_ instanceof vn.TFile)await l.modifyBinary(_,g.arrayBuffer).catch(D=>{throw new vn.Notice(`Failed to save screenshot to ${_}: ${D instanceof Error?D.message:D}`),D});else if(_===null)R=!0,_=await l.createBinary(C,g.arrayBuffer).catch(D=>{throw new vn.Notice(`Failed to create screenshot in ${_}: ${D instanceof Error?D.message:D}`),D});else return new vn.Notice(`Screenshot file occupied by a folder: ${_.path}`),!1;new vn.Notice(`Screenshot ${R?"created in":"save to"} ${_.path}`);try{return El({timestamp:m(e.path),screenshot:s.generateMarkdownLink(_,e.path,"",d.replaceAll("{{TITLE}}",v).replaceAll("{{DURATION}}",k)).replace(/^!/,"")},{editor:n,template:u,insertBefore:c}),!0}catch(D){return new vn.Notice("Failed to insert screenshot, see console for details"),console.error("Failed to insert screenshot",D),!1}}async function ih(t){let{provider:e}=t,{blob:{arrayBuffer:n,type:r}}=await nh(e,"image/png",void 0),i;try{i=new ClipboardItem({[r]:new Blob([n],{type:r})})}catch(o){return new vn.Notice("Failed to copy screenshot, see console for details"),console.error("Failed to copy screenshot",o),!1}await navigator.clipboard.write([i]),new vn.Notice("Screenshot copied to clipboard")}var oh=require("obsidian");async function ah(t,{file:e,editor:n}){let r=t.player;if(!r)return new oh.Notice("Player not initialized"),!1;let i=t.getMediaInfo();if(!i)return new oh.Notice("No media is opened"),!1;let o=r.currentTime,a=Qo(o,i,{app:t.plugin.app,settings:t.plugin.settings.getState(),duration:r.state.duration});if(o<=0)return new oh.Notice("Playback not started yet"),!1;let{insertBefore:s,timestampTemplate:l}=t.plugin.settings.getState();try{return El({timestamp:a(e.path)},{editor:n,template:l,insertBefore:s}),!0}catch(c){return new oh.Notice("Failed to insert timestamp, see console for details"),console.error("Failed to insert timestamp",c),!1}}var r3=require("obsidian");function _E(t){let e="mx:media-notetaking-notified";localStorage.getItem(e)||(new r3.Notice(createFragment(r=>{r.appendText(`You are taking ${t} from media player. By default, they will only be saved in the media note. `),r.createEl("p",{text:`To take ${t} or control playback from abritrary note, use command when focused on the note`}),r.createEl("p",{text:"PS: you can assign a hotkey to each command in the settings"}),r.appendText("Click to dismiss this notice.")}),0),localStorage.setItem(e,"1"))}function Cx(t){let e=rr(t);if(!e)return"";let{basename:n,extension:r}=gi(e.pathname);return r?decodeURI(n):""}function Mx(t){let{plugin:e}=t;t.addAction("star","Take timestamp in media note",()=>{let r=t.getMediaInfo();r&&(_E("timestamp"),e.mediaNote.getNote(r,t.player).then(i=>e.leafOpener.openNote(i)).then(i=>ah(t,i)))});let n=t.getViewType();MM.has(n)&&t.addAction("camera","Take screenshot in media",()=>{let r=t.getMediaInfo();r&&(_E("screenshot"),e.mediaNote.getNote(r,t.player).then(i=>e.leafOpener.openNote(i)).then(i=>rh(t,i)))})}function Rx(t,e,n){let{player:r,source:i,toggleControls:o,controls:a,setTransform:s,transform:l,toggleWebFullscreen:c,disableWebFullscreen:u,textTracks:d}=t.store.getState();!r||!i||t.plugin.app.workspace.trigger("mx:media-menu",e,{source:i.url,viewType:i.viewType,tracks:{local:d.local,remote:Jf(d.remote,d.local)},player:r,toggleControls:o,controls:a,setTransform:s,transform:l,plugin:t.plugin,disableWebFullscreen:u,toggleWebFullscreen:c,reload:()=>t.render()},n,t.leaf)}var sh={generic:"media",video:"video",audio:"audio"},i3=Object.values(sh);function Zn(t,e){if(!t||!e)return!1;let n=Ct(t),r=Ct(e);return n===r}var kE=new WeakSet;function o3(t){t.subscribe((e,n)=>{e.player!==n.player&&lh(e)}),t.subscribe((e,n)=>{let r=e.player;if(!r)return;let i=e.source,o=n.source;if(i===o)return;let a=i?.url,s=o?.url;a!==s&&(!a&&s!==void 0||a!==void 0&&!Zn(s,a))&&kE.delete(r)})}async function lh({player:t,hash:{tempFragment:e}}){if(!t||!e)return;let n=!kE.has(t);kE.add(t);let r=null,i=.25;if(Sr(e)||t.currentTime<e.start||Math.abs(t.currentTime-e.end)<i?r=e.start:t.currentTime-i>e.end&&(r=e.end),r!==null){let o=r;t.currentTime=o,!t.state.canPlay&&["video/youtube"].includes(t.state.source.type)&&!t.state.autoPlay&&(await YJ(t,"seeked"),await t.pause())}Sr(e)&&t.state.canPlay&&!n&&await t.play(new Event("hashchange"))}function YJ(t,e){return new Promise(n=>{let r=window.setTimeout(()=>{n(),i()},5e3),i=t.listen(e,()=>{n(),window.clearTimeout(r),i()})})}function a3(t,e){return tl(t,n=>n.subscribe(({textTrack:r})=>{if(!r)return;let i=()=>{let o=t.getState().source?.url;o&&e.trigger("mx:cue-change",o,r.id,r.activeCues.map(a=>a.id))};return i(),r.addEventListener("cue-change",i),()=>{r.removeEventListener("cue-change",i)}}))}function Ba(t){let e=wc((n,r,i)=>({player:null,setPlayer:o=>{n({player:o})},source:void 0,hash:{autoplay:void 0,controls:void 0,loop:void 0,muted:void 0,tempFragment:null,volume:void 0},setTextTracks(o){n(({textTracks:a})=>({textTracks:{...a,local:o}}))},async getPlayer(o=1e4){let{player:a}=r();return a||new Promise((s,l)=>{let c=i.subscribe(({player:d})=>{d&&(c(),s(d),window.clearTimeout(u))}),u=window.setTimeout(()=>{c(),l(new go(o))},o)})},setSource(o,{hash:a,viewType:s,title:l,textTracks:c}){n(u=>({source:{...u.source,viewType:s,url:o},textTracks:{local:c??u.textTracks.local,remote:u.textTracks.remote},hash:{...u.hash,...Kg(a||o.hash)},title:(l===!0?Cx(o.source.href):l)??u.title})),lh(r())},setHash(o){n(a=>({hash:{...a.hash,...Kg(o)}})),lh(r())},async loadFile(o,{subpath:a}){let s=Si(o,a??"");if(!s)throw new Error("Invalid media file: "+o.path);let l=await t.transcript.getTracks(s);n(({source:c,hash:u,textTracks:{remote:d}})=>({source:{...c,url:s,viewType:Vn[s.type]},textTracks:{local:l,remote:d},title:o.name,hash:a?{...u,...Kg(a)}:u})),await lh(r())},title:"",transform:null,setTransform:o=>{n(o?a=>{let s={transform:{...a.transform,...o}};return s.transform.flipHorizontal&&s.transform.flipVertical&&s.transform.rotate==="180"&&(s.transform={...s.transform,flipHorizontal:!1,flipVertical:!1,rotate:void 0}),s}:{transform:null})},toggleControls(o){let{player:a}=r();n({controls:o}),a&&a.provider instanceof yn&&a.provider.media.send("mx-toggle-controls",!o)},toggleWebFullscreen(o){let{player:a}=r();n({disableWebFullscreen:!o}),a&&a.provider instanceof yn&&a.provider.media.send("mx-toggle-webfs",o)},textTracks:{local:[],remote:[]},updateWebsiteTracks:o=>n(({textTracks:a})=>({textTracks:{...a,remote:o}})),updateWebHost:o=>n({webHost:o==="generic"?void 0:o})}));return o3(e),a3(e,t.app.workspace),e}var cn=(0,Yr.createContext)(null);function et(t){let{store:e}=(0,Yr.useContext)(cn);return mp(e,t)}function yi(t){let{plugin:{settings:e}}=(0,Yr.useContext)(cn);return mp(e,t)}function $x(){let{store:t}=(0,Yr.useContext)(cn);return t}function s3(){return(0,Yr.useContext)(cn).reload}function nl(t){let e=(0,Yr.useContext)(cn).plugin.app;return t?t(e):e}function mu(){return(0,Yr.useContext)(cn).plugin}function l3(){return(0,Yr.useContext)(cn).onScreenshot}function Ix(){return(0,Yr.useContext)(cn).onPlaylistChange}var gu=()=>(0,Yr.useContext)(cn).embed;function tl(t,e){let n=gp,r=[()=>n(),t.subscribe((i,o)=>{if(i.player===o.player||(n(),!i.player))return;let a=e(i.player);a?Array.isArray(a)?n=()=>a.forEach(s=>s()):n=a:n=gp})];return()=>r.forEach(i=>i())}var hP=require("obsidian"),Yz=$(K());var f3=$(K());var ch=$(K());var c3=function(t){return typeof t=="function"};var QJ=!1,u3=QJ;function XJ(t){u3&&(c3(t)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof t)));var e=(0,ch.useRef)(t);e.current=(0,ch.useMemo)(function(){return t},[t]);var n=(0,ch.useRef)();return n.current||(n.current=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return e.current.apply(this,r)}),n.current}var Lx=XJ;var vu=$(K());var TE={">":"video","^":"audio",_:"subtitle","#":"generic","/":"chapter"};function d3(t){return!!t&&t in TE}function yu(t){return!!t.media}function p3(t,e,{fromIndex:n,reverse:r=!1}={}){if(r)for(let i=n??t.length-1;i>=0;i--){let o=t[i];if(o&&yu(o)&&e(o,i,t))return o}else for(let i=n??0;i<t.length;i++){let o=t[i];if(o&&yu(o)&&e(o,i,t))return o}return null}var SE=[];function Ax(){let t=et(i=>i.source?.url),e=mu(),[n,r]=(0,vu.useState)(()=>e.playlist.get(t));return(0,vu.useEffect)(()=>{function i(){r(e.playlist.get(t))}return i(),e.app.metadataCache.on("mx:playlist-change",i),()=>{e.app.metadataCache.off("mx:playlist-change",i)}},[t,e.playlist,e.app.metadataCache]),n.sort((i,o)=>i.file.stat.mtime-o.file.stat.mtime).last()}function Ox(){let{target:t,action:e}=Fx("next"),n=Ax()?.autoplay;return{onEnded:Lx(()=>{!n||!t||e()})}}function Fx(t){let e=Ix(),n=Ax(),r=(0,vu.useMemo)(()=>{if(!n)return;let o=n.list[n.active];if(!(o&&yu(o)))return;let a=p3(n.list,s=>!Zn(o.media,s.media),{fromIndex:t==="next"?n.active+1:n.active-1,reverse:t==="previous"});if(a)return a},[n,t]),i=Lx(()=>{!r||!n||!e||e(r,n)});return{target:r,action:i}}function h3(){let t=Wr(),e=$x(),{onEnded:n}=Ox();(0,f3.useEffect)(()=>{if(t)return ZJ(t,e,n)},[t,e,n])}function ZJ(t,e,n){let r={currentTime:t.state.currentTime,paused:t.state.paused,loop:t.state.loop},i=!1,o=[t.subscribe(({currentTime:a,paused:s,loop:l})=>{let c=JJ(e.getState().hash.tempFragment,t.state.duration);if(!c||Sr(c))return;let{start:u,end:d}=c;if(r.paused!==s&&!s)a>d&&!l&&n?.(),(a>d||a<u)&&(i=!0,t.currentTime=u);else if(r.currentTime!==a){if(a<u)t.currentTime=u;else if(a>d)if(l)t.currentTime=u,s&&t.play();else{if(n?.(),i){i=!1;return}s||t.pause()}}Object.assign(r,{currentTime:a,paused:s,loop:l})})];return()=>o.forEach(a=>a())}function JJ(t,e){if(!t)return null;if(Sr(t))return t;let{start:n,end:r}=t;return e&&e<n?null:{start:n<0?0:n,end:r<0?1/0:r}}function m3(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=m3(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function g3(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=m3(t))&&(r&&(r+=" "),r+=e);return r}var PE="-";function eee(t){let e=nee(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;function i(a){let s=a.split(PE);return s[0]===""&&s.length!==1&&s.shift(),x3(s,e)||tee(a)}function o(a,s){let l=n[a]||[];return s&&r[a]?[...l,...r[a]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function x3(t,e){if(t.length===0)return e.classGroupId;let n=t[0],r=e.nextPart.get(n),i=r?x3(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;let o=t.join(PE);return e.validators.find(({validator:a})=>a(o))?.classGroupId}var y3=/^\[(.+)\]$/;function tee(t){if(y3.test(t)){let e=y3.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function nee(t){let{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return iee(Object.entries(t.classGroups),n).forEach(([o,a])=>{EE(a,r,o,e)}),r}function EE(t,e,n,r){t.forEach(i=>{if(typeof i=="string"){let o=i===""?e:v3(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(ree(i)){EE(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,a])=>{EE(a,v3(e,o),n,r)})})}function v3(t,e){let n=t;return e.split(PE).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function ree(t){return t.isThemeGetter}function iee(t,e){return e?t.map(([n,r])=>{let i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([a,s])=>[e+a,s])):o);return[n,i]}):t}function oee(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;function i(o,a){n.set(o,a),e++,e>t&&(e=0,r=n,n=new Map)}return{get(o){let a=n.get(o);if(a!==void 0)return a;if((a=r.get(o))!==void 0)return i(o,a),a},set(o,a){n.has(o)?n.set(o,a):i(o,a)}}}var w3="!";function aee(t){let e=t.separator,n=e.length===1,r=e[0],i=e.length;return function(a){let s=[],l=0,c=0,u;for(let g=0;g<a.length;g++){let x=a[g];if(l===0){if(x===r&&(n||a.slice(g,g+i)===e)){s.push(a.slice(c,g)),c=g+i;continue}if(x==="/"){u=g;continue}}x==="["?l++:x==="]"&&l--}let d=s.length===0?a:a.substring(c),p=d.startsWith(w3),f=p?d.substring(1):d,h=u&&u>c?u-c:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:h}}}function see(t){if(t.length<=1)return t;let e=[],n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e}function lee(t){return{cache:oee(t.cacheSize),splitModifiers:aee(t),...eee(t)}}var cee=/\s+/;function uee(t,e){let{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=new Set;return t.trim().split(cee).map(a=>{let{modifiers:s,hasImportantModifier:l,baseClassName:c,maybePostfixModifierPosition:u}=n(a),d=r(u?c.substring(0,u):c),p=!!u;if(!d){if(!u)return{isTailwindClass:!1,originalClassName:a};if(d=r(c),!d)return{isTailwindClass:!1,originalClassName:a};p=!1}let f=see(s).join(":");return{isTailwindClass:!0,modifierId:l?f+w3:f,classGroupId:d,originalClassName:a,hasPostfixModifier:p}}).reverse().filter(a=>{if(!a.isTailwindClass)return!0;let{modifierId:s,classGroupId:l,hasPostfixModifier:c}=a,u=s+l;return o.has(u)?!1:(o.add(u),i(l,c).forEach(d=>o.add(s+d)),!0)}).reverse().map(a=>a.originalClassName).join(" ")}function dee(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=b3(e))&&(r&&(r+=" "),r+=n);return r}function b3(t){if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=b3(t[r]))&&(n&&(n+=" "),n+=e);return n}function pee(t,...e){let n,r,i,o=a;function a(l){let c=e.reduce((u,d)=>d(u),t());return n=lee(c),r=n.cache.get,i=n.cache.set,o=s,s(l)}function s(l){let c=r(l);if(c)return c;let u=uee(l,n);return i(l,u),u}return function(){return o(dee.apply(null,arguments))}}function tt(t){let e=n=>n[t]||[];return e.isThemeGetter=!0,e}var _3=/^\[(?:([a-z-]+):)?(.+)\]$/i,fee=/^\d+\/\d+$/,hee=new Set(["px","full","screen"]),mee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gee=/\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$/,yee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,vee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function Oo(t){return rl(t)||hee.has(t)||fee.test(t)}function ja(t){return xu(t,"length",Pee)}function rl(t){return!!t&&!Number.isNaN(Number(t))}function Dx(t){return xu(t,"number",rl)}function uh(t){return!!t&&Number.isInteger(Number(t))}function wee(t){return t.endsWith("%")&&rl(t.slice(0,-1))}function ve(t){return _3.test(t)}function Ha(t){return mee.test(t)}var bee=new Set(["length","size","percentage"]);function _ee(t){return xu(t,bee,k3)}function kee(t){return xu(t,"position",k3)}var Tee=new Set(["image","url"]);function See(t){return xu(t,Tee,Mee)}function Eee(t){return xu(t,"",Cee)}function dh(){return!0}function xu(t,e,n){let r=_3.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1}function Pee(t){return gee.test(t)&&!yee.test(t)}function k3(){return!1}function Cee(t){return vee.test(t)}function Mee(t){return xee.test(t)}function Ree(){let t=tt("colors"),e=tt("spacing"),n=tt("blur"),r=tt("brightness"),i=tt("borderColor"),o=tt("borderRadius"),a=tt("borderSpacing"),s=tt("borderWidth"),l=tt("contrast"),c=tt("grayscale"),u=tt("hueRotate"),d=tt("invert"),p=tt("gap"),f=tt("gradientColorStops"),h=tt("gradientColorStopPositions"),g=tt("inset"),x=tt("margin"),m=tt("opacity"),y=tt("padding"),v=tt("saturate"),w=tt("scale"),k=tt("sepia"),b=tt("skew"),S=tt("space"),C=tt("translate"),R=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",ve,e],I=()=>[ve,e],N=()=>["",Oo,ja],O=()=>["auto",rl,ve],j=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Q=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],xe=()=>["start","end","center","between","around","evenly","stretch"],se=()=>["","0",ve],E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ne=()=>[rl,Dx],Pt=()=>[rl,ve];return{cacheSize:500,separator:":",theme:{colors:[dh],spacing:[Oo,ja],blur:["none","",Ha,ve],brightness:Ne(),borderColor:[t],borderRadius:["none","","full",Ha,ve],borderSpacing:I(),borderWidth:N(),contrast:Ne(),grayscale:se(),hueRotate:Pt(),invert:se(),gap:I(),gradientColorStops:[t],gradientColorStopPositions:[wee,ja],inset:D(),margin:D(),opacity:Ne(),padding:I(),saturate:Ne(),scale:Ne(),sepia:se(),skew:Pt(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",ve]}],container:["container"],columns:[{columns:[Ha]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:[...j(),ve]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uh,ve]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ve]}],grow:[{grow:se()}],shrink:[{shrink:se()}],order:[{order:["first","last","none",uh,ve]}],"grid-cols":[{"grid-cols":[dh]}],"col-start-end":[{col:["auto",{span:["full",uh,ve]},ve]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[dh]}],"row-start-end":[{row:["auto",{span:[uh,ve]},ve]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ve]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...xe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...xe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...xe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ve,e]}],"min-w":[{"min-w":[ve,e,"min","max","fit"]}],"max-w":[{"max-w":[ve,e,"none","full","min","max","fit","prose",{screen:[Ha]},Ha]}],h:[{h:[ve,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ve,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ve,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ve,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ha,ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Dx]}],"font-family":[{font:[dh]}],"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",ve]}],"line-clamp":[{"line-clamp":["none",rl,Dx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Oo,ve]}],"list-image":[{"list-image":["none",ve]}],"list-style-type":[{list:["none","disc","decimal",ve]}],"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:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Oo,ja]}],"underline-offset":[{"underline-offset":["auto",Oo,ve]}],"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:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve]}],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",ve]}],"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:[...j(),kee]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_ee]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},See]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...Q(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:Q()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...Q()]}],"outline-offset":[{"outline-offset":[Oo,ve]}],"outline-w":[{outline:[Oo,ja]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Oo,ja]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ha,Eee]}],"shadow-color":[{shadow:[dh]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":X()}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ha,ve]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"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":[v]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"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",ve]}],duration:[{duration:Pt()}],ease:[{ease:["linear","in","out","in-out",ve]}],delay:[{delay:Pt()}],animate:[{animate:["none","spin","ping","pulse","bounce",ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[uh,ve]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ve]}],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",ve]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",ve]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Oo,ja,Dx]}],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 T3=pee(Ree);function gt(...t){return T3(g3(t))}var S3=$(K());function E3(t){let e=Wr();(0,S3.useEffect)(()=>{if(e)return e.listen("loaded-metadata",n=>{let r=n.target;if(!Qc(r.provider)){t("unknown");return}let{videoHeight:i,videoWidth:o}=r.provider.video;t(i===0||o===0?"audio":"unknown")})},[e])}var P3=require("obsidian"),ph=$(K());function Nx(){let{controls:t}=CE(),e=et(i=>i.controls);return e===void 0&&t===void 0?!0:e||t}function CE(){let{volume:t,tempFragment:e,...n}=et(r=>r.hash);return n}function C3(){let t=Wr(),{volume:e}=et(a=>a.hash),n=yi(a=>a.defaultVolume/100),r=e??n,i=(0,ph.useRef)(r);i.current=r;let o=(0,ph.useRef)(!1);(0,ph.useEffect)(()=>{let a=(0,P3.debounce)(()=>{o.current=!1},1e3,!0),s=c=>{c.target.provider?.setVolume(i.current),o.current=!0,a()};if(!t)return;let l=[t.listen("can-play-through",s),t.listen("can-play",s),t.listen("loaded-data",s),t.listen("loaded-metadata",s),t.subscribe(({volume:c})=>{!o.current||c===i.current||t.provider?.setVolume(i.current)})];return()=>l.forEach(c=>c())},[t])}var ge=$(K());function Ke(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t?.(i),n===!1||!i.defaultPrevented)return e?.(i)}}var M3=$(K(),1);function $ee(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function ME(...t){return e=>t.forEach(n=>$ee(n,e))}function ze(...t){return(0,M3.useCallback)(ME(...t),t)}var vi=$(K(),1);function ji(t,e=[]){let n=[];function r(o,a){let s=(0,vi.createContext)(a),l=n.length;n=[...n,a];function c(d){let{scope:p,children:f,...h}=d,g=p?.[t][l]||s,x=(0,vi.useMemo)(()=>h,Object.values(h));return(0,vi.createElement)(g.Provider,{value:x},f)}function u(d,p){let f=p?.[t][l]||s,h=(0,vi.useContext)(f);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,u]}let i=()=>{let o=n.map(a=>(0,vi.createContext)(a));return function(s){let l=s?.[t]||o;return(0,vi.useMemo)(()=>({[`__scope${t}`]:{...s,[t]:l}}),[s,l])}};return i.scopeName=t,[r,Iee(i,...e)]}function Iee(...t){let e=t[0];if(t.length===1)return e;let n=()=>{let r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){let a=r.reduce((s,{useScope:l,scopeName:c})=>{let d=l(o)[`__scope${c}`];return{...s,...d}},{});return(0,vi.useMemo)(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function ue(){return ue=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ue.apply(this,arguments)}var _t=$(K(),1);var bu=$(K(),1),R3=$(mo(),1);var ft=$(K(),1);var wu=(0,ft.forwardRef)((t,e)=>{let{children:n,...r}=t,i=ft.Children.toArray(n),o=i.find(Lee);if(o){let a=o.props.children,s=i.map(l=>l===o?ft.Children.count(a)>1?ft.Children.only(null):(0,ft.isValidElement)(a)?a.props.children:null:l);return(0,ft.createElement)(RE,ue({},r,{ref:e}),(0,ft.isValidElement)(a)?(0,ft.cloneElement)(a,void 0,s):null)}return(0,ft.createElement)(RE,ue({},r,{ref:e}),n)});wu.displayName="Slot";var RE=(0,ft.forwardRef)((t,e)=>{let{children:n,...r}=t;return(0,ft.isValidElement)(n)?(0,ft.cloneElement)(n,{...Aee(r,n.props),ref:e?ME(e,n.ref):n.ref}):ft.Children.count(n)>1?ft.Children.only(null):null});RE.displayName="SlotClone";var $E=({children:t})=>(0,ft.createElement)(ft.Fragment,null,t);function Lee(t){return(0,ft.isValidElement)(t)&&t.type===$E}function Aee(t,e){let n={...e};for(let r in e){let i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{o(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}var Oee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],at=Oee.reduce((t,e)=>{let n=(0,bu.forwardRef)((r,i)=>{let{asChild:o,...a}=r,s=o?wu:e;return(0,bu.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,bu.createElement)(s,ue({},a,{ref:i}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function $3(t,e){t&&(0,R3.flushSync)(()=>t.dispatchEvent(e))}var _u=$(K(),1);function Yt(t){let e=(0,_u.useRef)(t);return(0,_u.useEffect)(()=>{e.current=t}),(0,_u.useMemo)(()=>(...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}var I3=$(K(),1);function L3(t,e=globalThis?.document){let n=Yt(t);(0,I3.useEffect)(()=>{let r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e])}var IE="dismissableLayer.update",Fee="dismissableLayer.pointerDownOutside",Dee="dismissableLayer.focusOutside",A3,Nee=(0,_t.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),F3=(0,_t.forwardRef)((t,e)=>{var n;let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=t,u=(0,_t.useContext)(Nee),[d,p]=(0,_t.useState)(null),f=(n=d?.ownerDocument)!==null&&n!==void 0?n:globalThis?.document,[,h]=(0,_t.useState)({}),g=ze(e,C=>p(C)),x=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(m),v=d?x.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,k=v>=y,b=Vee(C=>{let R=C.target,_=[...u.branches].some(D=>D.contains(R));!k||_||(o?.(C),s?.(C),C.defaultPrevented||l?.())},f),S=zee(C=>{let R=C.target;[...u.branches].some(D=>D.contains(R))||(a?.(C),s?.(C),C.defaultPrevented||l?.())},f);return L3(C=>{v===u.layers.size-1&&(i?.(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},f),(0,_t.useEffect)(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(A3=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),O3(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=A3)}},[d,f,r,u]),(0,_t.useEffect)(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),O3())},[d,u]),(0,_t.useEffect)(()=>{let C=()=>h({});return document.addEventListener(IE,C),()=>document.removeEventListener(IE,C)},[]),(0,_t.createElement)(at.div,ue({},c,{ref:g,style:{pointerEvents:w?k?"auto":"none":void 0,...t.style},onFocusCapture:Ke(t.onFocusCapture,S.onFocusCapture),onBlurCapture:Ke(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Ke(t.onPointerDownCapture,b.onPointerDownCapture)}))});function Vee(t,e=globalThis?.document){let n=Yt(t),r=(0,_t.useRef)(!1),i=(0,_t.useRef)(()=>{});return(0,_t.useEffect)(()=>{let o=s=>{if(s.target&&!r.current){let u=function(){D3(Fee,n,c,{discrete:!0})};var l=u;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function zee(t,e=globalThis?.document){let n=Yt(t),r=(0,_t.useRef)(!1);return(0,_t.useEffect)(()=>{let i=o=>{o.target&&!r.current&&D3(Dee,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function O3(){let t=new CustomEvent(IE);document.dispatchEvent(t)}function D3(t,e,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?$3(i,o):i.dispatchEvent(o)}var Vx=$(K(),1);var N3=$(K(),1),Qr=globalThis?.document?N3.useLayoutEffect:()=>{};var Uee=Vx.useId||(()=>{}),Bee=0;function V3(t){let[e,n]=Vx.useState(Uee());return Qr(()=>{t||n(r=>r??String(Bee++))},[t]),t||(e?`radix-${e}`:"")}var wr=$(K());var z3=["top","right","bottom","left"];var vr=Math.min,Qt=Math.max,hh=Math.round,mh=Math.floor,Fo=t=>({x:t,y:t}),jee={left:"right",right:"left",bottom:"top",top:"bottom"},Hee={start:"end",end:"start"};function Ux(t,e,n){return Qt(t,vr(e,n))}function xi(t,e){return typeof t=="function"?t(e):t}function Xr(t){return t.split("-")[0]}function il(t){return t.split("-")[1]}function Bx(t){return t==="x"?"y":"x"}function jx(t){return t==="y"?"height":"width"}function Wa(t){return["top","bottom"].includes(Xr(t))?"y":"x"}function Hx(t){return Bx(Wa(t))}function U3(t,e,n){n===void 0&&(n=!1);let r=il(t),i=Hx(t),o=jx(i),a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=fh(a)),[a,fh(a)]}function B3(t){let e=fh(t);return[zx(t),e,zx(e)]}function zx(t){return t.replace(/start|end/g,e=>Hee[e])}function Wee(t,e,n){let r=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:a;default:return[]}}function j3(t,e,n,r){let i=il(t),o=Wee(Xr(t),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),e&&(o=o.concat(o.map(zx)))),o}function fh(t){return t.replace(/left|right|bottom|top/g,e=>jee[e])}function qee(t){return{top:0,right:0,bottom:0,left:0,...t}}function Wx(t){return typeof t!="number"?qee(t):{top:t,right:t,bottom:t,left:t}}function Do(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function H3(t,e,n){let{reference:r,floating:i}=t,o=Wa(e),a=Hx(e),s=jx(a),l=Xr(e),c=o==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(il(e)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1);break}return f}var K3=async(t,e,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=o.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e)),c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=H3(c,r,l),p=r,f={},h=0;for(let g=0;g<s.length;g++){let{name:x,fn:m}=s[g],{x:y,y:v,data:w,reset:k}=await m({x:u,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:t,floating:e}});if(u=y??u,d=v??d,f={...f,[x]:{...f[x],...w}},k&&h<=50){h++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(c=k.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):k.rects),{x:u,y:d}=H3(c,p,l)),g=-1;continue}}return{x:u,y:d,placement:p,strategy:i,middlewareData:f}};async function ol(t,e){var n;e===void 0&&(e={});let{x:r,y:i,platform:o,rects:a,elements:s,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=xi(e,t),h=Wx(f),x=s[p?d==="floating"?"reference":"floating":d],m=Do(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),y=d==="floating"?{...a.floating,x:r,y:i}:a.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),w=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},k=Do(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:v,strategy:l}):y);return{top:(m.top-k.top+h.top)/w.y,bottom:(k.bottom-m.bottom+h.bottom)/w.y,left:(m.left-k.left+h.left)/w.x,right:(k.right-m.right+h.right)/w.x}}var G3=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:i,rects:o,platform:a,elements:s,middlewareData:l}=e,{element:c,padding:u=0}=xi(t,e)||{};if(c==null)return{};let d=Wx(u),p={x:n,y:r},f=Hx(i),h=jx(f),g=await a.getDimensions(c),x=f==="y",m=x?"top":"left",y=x?"bottom":"right",v=x?"clientHeight":"clientWidth",w=o.reference[h]+o.reference[f]-p[f]-o.floating[h],k=p[f]-o.reference[f],b=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c)),S=b?b[v]:0;(!S||!await(a.isElement==null?void 0:a.isElement(b)))&&(S=s.floating[v]||o.floating[h]);let C=w/2-k/2,R=S/2-g[h]/2-1,_=vr(d[m],R),D=vr(d[y],R),I=_,N=S-g[h]-D,O=S/2-g[h]/2+C,j=Ux(I,O,N),Q=!l.arrow&&il(i)!=null&&O!=j&&o.reference[h]/2-(O<I?_:D)-g[h]/2<0,X=Q?O<I?O-I:O-N:0;return{[f]:p[f]+X,data:{[f]:j,centerOffset:O-j-X,...Q&&{alignmentOffset:X}},reset:Q}}});var Y3=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:i,middlewareData:o,rects:a,initialPlacement:s,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...x}=xi(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let m=Xr(i),y=Xr(s)===s,v=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=p||(y||!g?[fh(s)]:B3(s));!p&&h!=="none"&&w.push(...j3(s,g,h,v));let k=[s,...w],b=await ol(e,x),S=[],C=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&S.push(b[m]),d){let I=U3(i,a,v);S.push(b[I[0]],b[I[1]])}if(C=[...C,{placement:i,overflows:S}],!S.every(I=>I<=0)){var R,_;let I=(((R=o.flip)==null?void 0:R.index)||0)+1,N=k[I];if(N)return{data:{index:I,overflows:C},reset:{placement:N}};let O=(_=C.filter(j=>j.overflows[0]<=0).sort((j,Q)=>j.overflows[1]-Q.overflows[1])[0])==null?void 0:_.placement;if(!O)switch(f){case"bestFit":{var D;let j=(D=C.map(Q=>[Q.placement,Q.overflows.filter(X=>X>0).reduce((X,xe)=>X+xe,0)]).sort((Q,X)=>Q[1]-X[1])[0])==null?void 0:D[0];j&&(O=j);break}case"initialPlacement":O=s;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function W3(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function q3(t){return z3.some(e=>t[e]>=0)}var Q3=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...i}=xi(t,e);switch(r){case"referenceHidden":{let o=await ol(e,{...i,elementContext:"reference"}),a=W3(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:q3(a)}}}case"escaped":{let o=await ol(e,{...i,altBoundary:!0}),a=W3(o,n.floating);return{data:{escapedOffsets:a,escaped:q3(a)}}}default:return{}}}}};function X3(t){let e=vr(...t.map(o=>o.left)),n=vr(...t.map(o=>o.top)),r=Qt(...t.map(o=>o.right)),i=Qt(...t.map(o=>o.bottom));return{x:e,y:n,width:r-e,height:i-n}}function Kee(t){let e=t.slice().sort((i,o)=>i.y-o.y),n=[],r=null;for(let i=0;i<e.length;i++){let o=e[i];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(i=>Do(X3(i)))}var Z3=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){let{placement:n,elements:r,rects:i,platform:o,strategy:a}=e,{padding:s=2,x:l,y:c}=xi(t,e),u=Array.from(await(o.getClientRects==null?void 0:o.getClientRects(r.reference))||[]),d=Kee(u),p=Do(X3(u)),f=Wx(s);function h(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&c!=null)return d.find(x=>l>x.left-f.left&&l<x.right+f.right&&c>x.top-f.top&&c<x.bottom+f.bottom)||p;if(d.length>=2){if(Wa(n)==="y"){let _=d[0],D=d[d.length-1],I=Xr(n)==="top",N=_.top,O=D.bottom,j=I?_.left:D.left,Q=I?_.right:D.right,X=Q-j,xe=O-N;return{top:N,bottom:O,left:j,right:Q,width:X,height:xe,x:j,y:N}}let x=Xr(n)==="left",m=Qt(...d.map(_=>_.right)),y=vr(...d.map(_=>_.left)),v=d.filter(_=>x?_.left===y:_.right===m),w=v[0].top,k=v[v.length-1].bottom,b=y,S=m,C=S-b,R=k-w;return{top:w,bottom:k,left:b,right:S,width:C,height:R,x:b,y:w}}return p}let g=await o.getElementRects({reference:{getBoundingClientRect:h},floating:r.floating,strategy:a});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}};async function Gee(t,e){let{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Xr(n),s=il(n),l=Wa(n)==="y",c=["left","top"].includes(a)?-1:1,u=o&&l?-1:1,d=xi(e,t),{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof h=="number"&&(f=s==="end"?h*-1:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}var qx=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:i,y:o,placement:a,middlewareData:s}=e,l=await Gee(e,t);return a===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:a}}}}},J3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:x=>{let{x:m,y}=x;return{x:m,y}}},...l}=xi(t,e),c={x:n,y:r},u=await ol(e,l),d=Wa(Xr(i)),p=Bx(d),f=c[p],h=c[d];if(o){let x=p==="y"?"top":"left",m=p==="y"?"bottom":"right",y=f+u[x],v=f-u[m];f=Ux(y,f,v)}if(a){let x=d==="y"?"top":"left",m=d==="y"?"bottom":"right",y=h+u[x],v=h-u[m];h=Ux(y,h,v)}let g=s.fn({...e,[p]:f,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},eV=function(t){return t===void 0&&(t={}),{options:t,fn(e){let{x:n,y:r,placement:i,rects:o,middlewareData:a}=e,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=xi(t,e),u={x:n,y:r},d=Wa(i),p=Bx(d),f=u[p],h=u[d],g=xi(s,e),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){let v=p==="y"?"height":"width",w=o.reference[p]-o.floating[v]+x.mainAxis,k=o.reference[p]+o.reference[v]-x.mainAxis;f<w?f=w:f>k&&(f=k)}if(c){var m,y;let v=p==="y"?"width":"height",w=["top","left"].includes(Xr(i)),k=o.reference[d]-o.floating[v]+(w&&((m=a.offset)==null?void 0:m[d])||0)+(w?0:x.crossAxis),b=o.reference[d]+o.reference[v]+(w?0:((y=a.offset)==null?void 0:y[d])||0)-(w?x.crossAxis:0);h<k?h=k:h>b&&(h=b)}return{[p]:f,[d]:h}}}},tV=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){let{placement:n,rects:r,platform:i,elements:o}=e,{apply:a=()=>{},...s}=xi(t,e),l=await ol(e,s),c=Xr(n),u=il(n),d=Wa(n)==="y",{width:p,height:f}=r.floating,h,g;c==="top"||c==="bottom"?(h=c,g=u===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=c,h=u==="end"?"top":"bottom");let x=f-l[h],m=p-l[g],y=!e.middlewareData.shift,v=x,w=m;if(d){let b=p-l.left-l.right;w=u||y?vr(m,b):b}else{let b=f-l.top-l.bottom;v=u||y?vr(x,b):b}if(y&&!u){let b=Qt(l.left,0),S=Qt(l.right,0),C=Qt(l.top,0),R=Qt(l.bottom,0);d?w=p-2*(b!==0||S!==0?b+S:Qt(l.left,l.right)):v=f-2*(C!==0||R!==0?C+R:Qt(l.top,l.bottom))}await a({...e,availableWidth:w,availableHeight:v});let k=await i.getDimensions(o.floating);return p!==k.width||f!==k.height?{reset:{rects:!0}}:{}}}};function No(t){return rV(t)?(t.nodeName||"").toLowerCase():"#document"}function Jn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Hi(t){var e;return(e=(rV(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rV(t){return t instanceof Node||t instanceof Jn(t).Node}function Wi(t){return t instanceof Element||t instanceof Jn(t).Element}function wi(t){return t instanceof HTMLElement||t instanceof Jn(t).HTMLElement}function nV(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Jn(t).ShadowRoot}function ku(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=xr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function iV(t){return["table","td","th"].includes(No(t))}function Kx(t){let e=Gx(),n=xr(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(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function oV(t){let e=al(t);for(;wi(e)&&!gh(e);){if(Kx(e))return e;e=al(e)}return null}function Gx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function gh(t){return["html","body","#document"].includes(No(t))}function xr(t){return Jn(t).getComputedStyle(t)}function yh(t){return Wi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function al(t){if(No(t)==="html")return t;let e=t.assignedSlot||t.parentNode||nV(t)&&t.host||Hi(t);return nV(e)?e.host:e}function aV(t){let e=al(t);return gh(e)?t.ownerDocument?t.ownerDocument.body:t.body:wi(e)&&ku(e)?e:aV(e)}function sl(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=aV(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),a=Jn(i);return o?e.concat(a,a.visualViewport||[],ku(i)?i:[],a.frameElement&&n?sl(a.frameElement):[]):e.concat(i,sl(i,[],n))}function cV(t){let e=xr(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=wi(t),o=i?t.offsetWidth:n,a=i?t.offsetHeight:r,s=hh(n)!==o||hh(r)!==a;return s&&(n=o,r=a),{width:n,height:r,$:s}}function LE(t){return Wi(t)?t:t.contextElement}function Tu(t){let e=LE(t);if(!wi(e))return Fo(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=cV(e),a=(o?hh(n.width):n.width)/r,s=(o?hh(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var Yee=Fo(0);function uV(t){let e=Jn(t);return!Gx()||!e.visualViewport?Yee:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Qee(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Jn(t)?!1:e}function ll(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=LE(t),a=Fo(1);e&&(r?Wi(r)&&(a=Tu(r)):a=Tu(t));let s=Qee(o,n,r)?uV(o):Fo(0),l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(o){let p=Jn(o),f=r&&Wi(r)?Jn(r):r,h=p,g=h.frameElement;for(;g&&r&&f!==h;){let x=Tu(g),m=g.getBoundingClientRect(),y=xr(g),v=m.left+(g.clientLeft+parseFloat(y.paddingLeft))*x.x,w=m.top+(g.clientTop+parseFloat(y.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=v,c+=w,h=Jn(g),g=h.frameElement}}return Do({width:u,height:d,x:l,y:c})}var Xee=[":popover-open",":modal"];function dV(t){return Xee.some(e=>{try{return t.matches(e)}catch{return!1}})}function Zee(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t,o=i==="fixed",a=Hi(r),s=e?dV(e.floating):!1;if(r===a||s&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Fo(1),u=Fo(0),d=wi(r);if((d||!d&&!o)&&((No(r)!=="body"||ku(a))&&(l=yh(r)),wi(r))){let p=ll(r);c=Tu(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function Jee(t){return Array.from(t.getClientRects())}function pV(t){return ll(Hi(t)).left+yh(t).scrollLeft}function ete(t){let e=Hi(t),n=yh(t),r=t.ownerDocument.body,i=Qt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Qt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),a=-n.scrollLeft+pV(t),s=-n.scrollTop;return xr(r).direction==="rtl"&&(a+=Qt(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:s}}function tte(t,e){let n=Jn(t),r=Hi(t),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;let c=Gx();(!c||c&&e==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s,y:l}}function nte(t,e){let n=ll(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=wi(t)?Tu(t):Fo(1),a=t.clientWidth*o.x,s=t.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:a,height:s,x:l,y:c}}function sV(t,e,n){let r;if(e==="viewport")r=tte(t,n);else if(e==="document")r=ete(Hi(t));else if(Wi(e))r=nte(e,n);else{let i=uV(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Do(r)}function fV(t,e){let n=al(t);return n===e||!Wi(n)||gh(n)?!1:xr(n).position==="fixed"||fV(n,e)}function rte(t,e){let n=e.get(t);if(n)return n;let r=sl(t,[],!1).filter(s=>Wi(s)&&No(s)!=="body"),i=null,o=xr(t).position==="fixed",a=o?al(t):t;for(;Wi(a)&&!gh(a);){let s=xr(a),l=Kx(a);!l&&s.position==="fixed"&&(i=null),(o?!l&&!i:!l&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||ku(a)&&!l&&fV(t,a))?r=r.filter(u=>u!==a):i=s,a=al(a)}return e.set(t,r),r}function ite(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,a=[...n==="clippingAncestors"?rte(e,this._c):[].concat(n),r],s=a[0],l=a.reduce((c,u)=>{let d=sV(e,u,i);return c.top=Qt(d.top,c.top),c.right=vr(d.right,c.right),c.bottom=vr(d.bottom,c.bottom),c.left=Qt(d.left,c.left),c},sV(e,s,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ote(t){let{width:e,height:n}=cV(t);return{width:e,height:n}}function ate(t,e,n){let r=wi(e),i=Hi(e),o=n==="fixed",a=ll(t,!0,o,e),s={scrollLeft:0,scrollTop:0},l=Fo(0);if(r||!r&&!o)if((No(e)!=="body"||ku(i))&&(s=yh(e)),r){let d=ll(e,!0,o,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else i&&(l.x=pV(i));let c=a.left+s.scrollLeft-l.x,u=a.top+s.scrollTop-l.y;return{x:c,y:u,width:a.width,height:a.height}}function lV(t,e){return!wi(t)||xr(t).position==="fixed"?null:e?e(t):t.offsetParent}function hV(t,e){let n=Jn(t);if(!wi(t)||dV(t))return n;let r=lV(t,e);for(;r&&iV(r)&&xr(r).position==="static";)r=lV(r,e);return r&&(No(r)==="html"||No(r)==="body"&&xr(r).position==="static"&&!Kx(r))?n:r||oV(t)||n}var ste=async function(t){let e=this.getOffsetParent||hV,n=this.getDimensions;return{reference:ate(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,...await n(t.floating)}}};function lte(t){return xr(t).direction==="rtl"}var mV={convertOffsetParentRelativeRectToViewportRelativeRect:Zee,getDocumentElement:Hi,getClippingRect:ite,getOffsetParent:hV,getElementRects:ste,getClientRects:Jee,getDimensions:ote,getScale:Tu,isElement:Wi,isRTL:lte};function cte(t,e){let n=null,r,i=Hi(t);function o(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function a(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),o();let{left:c,top:u,width:d,height:p}=t.getBoundingClientRect();if(s||e(),!d||!p)return;let f=mh(u),h=mh(i.clientWidth-(c+d)),g=mh(i.clientHeight-(u+p)),x=mh(c),y={rootMargin:-f+"px "+-h+"px "+-g+"px "+-x+"px",threshold:Qt(0,vr(1,l))||1},v=!0;function w(k){let b=k[0].intersectionRatio;if(b!==l){if(!v)return a();b?a(!1,b):r=setTimeout(()=>{a(!1,1e-7)},100)}v=!1}try{n=new IntersectionObserver(w,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(w,y)}n.observe(t)}return a(!0),o}function AE(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=LE(t),u=i||o?[...c?sl(c):[],...sl(e)]:[];u.forEach(m=>{i&&m.addEventListener("scroll",n,{passive:!0}),o&&m.addEventListener("resize",n)});let d=c&&s?cte(c,n):null,p=-1,f=null;a&&(f=new ResizeObserver(m=>{let[y]=m;y&&y.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),n()}),c&&!l&&f.observe(c),f.observe(e));let h,g=l?ll(t):null;l&&x();function x(){let m=ll(t);g&&(m.x!==g.x||m.y!==g.y||m.width!==g.width||m.height!==g.height)&&n(),g=m,h=requestAnimationFrame(x)}return n(),()=>{var m;u.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),d?.(),(m=f)==null||m.disconnect(),f=null,l&&cancelAnimationFrame(h)}}var OE=J3,FE=Y3,DE=tV,NE=Q3,VE=G3,zE=Z3,UE=eV,BE=(t,e,n)=>{let r=new Map,i={platform:mV,...n},o={...i.platform,_c:r};return K3(t,e,{...i,platform:o})};var Lt=$(K(),1),Xx=$(K(),1),vV=$(mo(),1),xV=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){let{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?VE({element:r.current,padding:i}).fn(n):{}:r?VE({element:r,padding:i}).fn(n):{}}}},Yx=typeof document<"u"?Xx.useLayoutEffect:Xx.useEffect;function Qx(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Qx(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){let o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Qx(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function wV(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function gV(t,e){let n=wV(t);return Math.round(e*n)/n}function yV(t){let e=Lt.useRef(t);return Yx(()=>{e.current=t}),e}function bV(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=t,[u,d]=Lt.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[p,f]=Lt.useState(r);Qx(p,r)||f(r);let[h,g]=Lt.useState(null),[x,m]=Lt.useState(null),y=Lt.useCallback(X=>{X!==b.current&&(b.current=X,g(X))},[]),v=Lt.useCallback(X=>{X!==S.current&&(S.current=X,m(X))},[]),w=o||h,k=a||x,b=Lt.useRef(null),S=Lt.useRef(null),C=Lt.useRef(u),R=l!=null,_=yV(l),D=yV(i),I=Lt.useCallback(()=>{if(!b.current||!S.current)return;let X={placement:e,strategy:n,middleware:p};D.current&&(X.platform=D.current),BE(b.current,S.current,X).then(xe=>{let se={...xe,isPositioned:!0};N.current&&!Qx(C.current,se)&&(C.current=se,vV.flushSync(()=>{d(se)}))})},[p,e,n,D]);Yx(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(X=>({...X,isPositioned:!1})))},[c]);let N=Lt.useRef(!1);Yx(()=>(N.current=!0,()=>{N.current=!1}),[]),Yx(()=>{if(w&&(b.current=w),k&&(S.current=k),w&&k){if(_.current)return _.current(w,k,I);I()}},[w,k,I,_,R]);let O=Lt.useMemo(()=>({reference:b,floating:S,setReference:y,setFloating:v}),[y,v]),j=Lt.useMemo(()=>({reference:w,floating:k}),[w,k]),Q=Lt.useMemo(()=>{let X={position:n,left:0,top:0};if(!j.floating)return X;let xe=gV(j.floating,u.x),se=gV(j.floating,u.y);return s?{...X,transform:"translate("+xe+"px, "+se+"px)",...wV(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:xe,top:se}},[n,s,j.floating,u.x,u.y]);return Lt.useMemo(()=>({...u,update:I,refs:O,elements:j,floatingStyles:Q}),[u,I,O,j,Q])}var vh=$(K(),1);var ute=(0,vh.forwardRef)((t,e)=>{let{children:n,width:r=10,height:i=5,...o}=t;return(0,vh.createElement)(at.svg,ue({},o,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),t.asChild?n:(0,vh.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),_V=ute;var kV=$(K(),1);function Zx(t){let[e,n]=(0,kV.useState)(void 0);return Qr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;let o=i[0],a,s;if("borderBoxSize"in o){let l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,s=c.blockSize}else a=t.offsetWidth,s=t.offsetHeight;n({width:a,height:s})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var qa=$(ie());var jE="Popper",[PV,ew]=ji(jE),[vte,CV]=PV(jE),HE=t=>{let{__scopePopper:e,children:n}=t,[r,i]=wr.useState(null);return(0,qa.jsx)(vte,{scope:e,anchor:r,onAnchorChange:i,children:n})};HE.displayName=jE;var MV="PopperAnchor",WE=wr.forwardRef((t,e)=>{let{__scopePopper:n,virtualRef:r,...i}=t,o=CV(MV,n),a=wr.useRef(null),s=ze(e,a);return wr.useEffect(()=>{o.onAnchorChange(r?.current||a.current)}),r?null:(0,qa.jsx)(at.div,{...i,ref:s})});WE.displayName=MV;var qE="PopperContent",[xte,wte]=PV(qE),KE=wr.forwardRef((t,e)=>{let{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:h,inlineAlign:g=!1,...x}=t,m=CV(qE,n),[y,v]=wr.useState(null),w=ze(e,st=>v(st)),[k,b]=wr.useState(null),S=Zx(k),C=S?.width??0,R=S?.height??0,_=r+(o!=="center"?"-"+o:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},I=Array.isArray(c)?c:[c],N=I.length>0,O={padding:D,boundary:I.filter(_te),altBoundary:N},{refs:j,floatingStyles:Q,placement:X,isPositioned:xe,middlewareData:se}=bV({strategy:"fixed",placement:_,whileElementsMounted:(...st)=>AE(...st,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[qx({mainAxis:i+R,alignmentAxis:a}),l&&OE({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?UE():void 0,...O}),l&&FE({...O}),DE({...O,apply:({elements:st,rects:Wo,availableWidth:kr,availableHeight:qo})=>{let{width:Ko,height:ad}=Wo.reference,os=st.floating.style;os.setProperty("--radix-popper-available-width",`${kr}px`),os.setProperty("--radix-popper-available-height",`${qo}px`),os.setProperty("--radix-popper-anchor-width",`${Ko}px`),os.setProperty("--radix-popper-anchor-height",`${ad}px`)}}),k&&xV({element:k,padding:s}),kte({arrowWidth:C,arrowHeight:R}),p&&NE({strategy:"referenceHidden",...O}),g&&zE(g===!0?{}:g)]}),[E,Ne]=$V(X),Pt=Yt(h);Qr(()=>{xe&&Pt?.()},[xe,Pt]);let P=se.arrow?.x,_n=se.arrow?.y,Ji=se.arrow?.centerOffset!==0,[od,Tl]=wr.useState();return Qr(()=>{y&&Tl(window.getComputedStyle(y).zIndex)},[y]),(0,qa.jsx)("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...Q,transform:xe?Q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:od,"--radix-popper-transform-origin":[se.transformOrigin?.x,se.transformOrigin?.y].join(" ")},dir:t.dir,children:(0,qa.jsx)(xte,{scope:n,placedSide:E,onArrowChange:b,arrowX:P,arrowY:_n,shouldHideArrow:Ji,children:(0,qa.jsx)(at.div,{"data-side":E,"data-align":Ne,...x,ref:w,style:{...x.style,animation:xe?void 0:"none",visibility:se.hide?.referenceHidden?"hidden":void 0}})})})});KE.displayName=qE;var RV="PopperArrow",bte={top:"bottom",right:"left",bottom:"top",left:"right"},GE=wr.forwardRef(function(e,n){let{__scopePopper:r,...i}=e,o=wte(RV,r),a=bte[o.placedSide];return(0,qa.jsx)("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:(0,qa.jsx)(_V,{...i,ref:n,style:{...i.style,display:"block"}})})});GE.displayName=RV;function _te(t){return t!==null}var kte=t=>({name:"transformOrigin",options:t,fn(e){let{placement:n,rects:r,middlewareData:i}=e,a=i.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,l=a?0:t.arrowHeight,[c,u]=$V(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(i.arrow?.x??0)+s/2,f=(i.arrow?.y??0)+l/2,h="",g="";return c==="bottom"?(h=a?d:`${p}px`,g=`${-l}px`):c==="top"?(h=a?d:`${p}px`,g=`${r.floating.height+l}px`):c==="right"?(h=`${-l}px`,g=a?d:`${f}px`):c==="left"&&(h=`${r.floating.width+l}px`,g=a?d:`${f}px`),{data:{x:h,y:g}}}});function $V(t){let[e,n="center"]=t.split("-");return[e,n]}var YE=HE,QE=WE,XE=KE,ZE=GE;var tw=$(K(),1),IV=$(mo(),1);var LV=(0,tw.forwardRef)((t,e)=>{var n;let{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=t;return r?IV.default.createPortal((0,tw.createElement)(at.div,ue({},i,{ref:e})),r):null});var xn=$(K(),1),AV=$(mo(),1);function Ste(t,e){return(0,xn.useReducer)((n,r)=>{let i=e[n][r];return i??n},t)}var Vo=t=>{let{present:e,children:n}=t,r=Ete(e),i=typeof n=="function"?n({present:r.isPresent}):xn.Children.only(n),o=ze(r.ref,i.ref);return typeof n=="function"||r.isPresent?(0,xn.cloneElement)(i,{ref:o}):null};Vo.displayName="Presence";function Ete(t){let[e,n]=(0,xn.useState)(),r=(0,xn.useRef)({}),i=(0,xn.useRef)(t),o=(0,xn.useRef)("none"),a=t?"mounted":"unmounted",[s,l]=Ste(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,xn.useEffect)(()=>{let c=nw(r.current);o.current=s==="mounted"?c:"none"},[s]),Qr(()=>{let c=r.current,u=i.current;if(u!==t){let p=o.current,f=nw(c);t?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&p!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Qr(()=>{if(e){let c=d=>{let f=nw(r.current).includes(d.animationName);d.target===e&&f&&(0,AV.flushSync)(()=>l("ANIMATION_END"))},u=d=>{d.target===e&&(o.current=nw(r.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:(0,xn.useCallback)(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function nw(t){return t?.animationName||"none"}var Ka=$(K(),1);function rw({prop:t,defaultProp:e,onChange:n=()=>{}}){let[r,i]=Pte({defaultProp:e,onChange:n}),o=t!==void 0,a=o?t:r,s=Yt(n),l=(0,Ka.useCallback)(c=>{if(o){let d=typeof c=="function"?c(t):c;d!==t&&s(d)}else i(c)},[o,t,i,s]);return[a,l]}function Pte({defaultProp:t,onChange:e}){let n=(0,Ka.useState)(t),[r]=n,i=(0,Ka.useRef)(r),o=Yt(e);return(0,Ka.useEffect)(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var iw=$(K(),1);var Cte=(0,iw.forwardRef)((t,e)=>(0,iw.createElement)(at.span,ue({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}))),OV=Cte;var At=$(ie()),[ow,Rte]=ji("Tooltip",[ew]),aw=ew(),FV="TooltipProvider",$te=700,JE="tooltip.open",[Ite,tP]=ow(FV),nP=t=>{let{__scopeTooltip:e,delayDuration:n=$te,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[a,s]=ge.useState(!0),l=ge.useRef(!1),c=ge.useRef(0);return ge.useEffect(()=>{let u=c.current;return()=>window.clearTimeout(u)},[]),(0,At.jsx)(Ite,{scope:e,isOpenDelayed:a,delayDuration:n,onOpen:ge.useCallback(()=>{window.clearTimeout(c.current),s(!1)},[]),onClose:ge.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>s(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:ge.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:o})};nP.displayName=FV;var sw="Tooltip",[Lte,xh]=ow(sw),DV=t=>{let{__scopeTooltip:e,children:n,open:r,defaultOpen:i=!1,onOpenChange:o,disableHoverableContent:a,delayDuration:s}=t,l=tP(sw,t.__scopeTooltip),c=aw(e),[u,d]=ge.useState(null),p=V3(),f=ge.useRef(0),h=a??l.disableHoverableContent,g=s??l.delayDuration,x=ge.useRef(!1),[m=!1,y]=rw({prop:r,defaultProp:i,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(JE))):l.onClose(),o?.(S)}}),v=ge.useMemo(()=>m?x.current?"delayed-open":"instant-open":"closed",[m]),w=ge.useCallback(()=>{window.clearTimeout(f.current),x.current=!1,y(!0)},[y]),k=ge.useCallback(()=>{window.clearTimeout(f.current),y(!1)},[y]),b=ge.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,y(!0)},g)},[g,y]);return ge.useEffect(()=>()=>window.clearTimeout(f.current),[]),(0,At.jsx)(YE,{...c,children:(0,At.jsx)(Lte,{scope:e,contentId:p,open:m,stateAttribute:v,trigger:u,onTriggerChange:d,onTriggerEnter:ge.useCallback(()=>{l.isOpenDelayed?b():w()},[l.isOpenDelayed,b,w]),onTriggerLeave:ge.useCallback(()=>{h?k():window.clearTimeout(f.current)},[k,h]),onOpen:w,onClose:k,disableHoverableContent:h,children:n})})};DV.displayName=sw;var eP="TooltipTrigger",NV=ge.forwardRef((t,e)=>{let{__scopeTooltip:n,...r}=t,i=xh(eP,n),o=tP(eP,n),a=aw(n),s=ge.useRef(null),l=ze(e,s,i.onTriggerChange),c=ge.useRef(!1),u=ge.useRef(!1),d=ge.useCallback(()=>c.current=!1,[]);return ge.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,At.jsx)(QE,{asChild:!0,...a,children:(0,At.jsx)(at.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ke(t.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ke(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ke(t.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ke(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ke(t.onBlur,i.onClose),onClick:Ke(t.onClick,i.onClose)})})});NV.displayName=eP;var rP="TooltipPortal",[Ate,Ote]=ow(rP,{forceMount:void 0}),VV=t=>{let{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,o=xh(rP,e);return(0,At.jsx)(Ate,{scope:e,forceMount:n,children:(0,At.jsx)(Vo,{present:n||o.open,children:(0,At.jsx)(LV,{asChild:!0,container:i,children:r})})})};VV.displayName=rP;var Su="TooltipContent",zV=ge.forwardRef((t,e)=>{let n=Ote(Su,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,a=xh(Su,t.__scopeTooltip);return(0,At.jsx)(Vo,{present:r||a.open,children:a.disableHoverableContent?(0,At.jsx)(UV,{side:i,...o,ref:e}):(0,At.jsx)(Fte,{side:i,...o,ref:e})})}),Fte=ge.forwardRef((t,e)=>{let n=xh(Su,t.__scopeTooltip),r=tP(Su,t.__scopeTooltip),i=ge.useRef(null),o=ze(e,i),[a,s]=ge.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,p=ge.useCallback(()=>{s(null),d(!1)},[d]),f=ge.useCallback((h,g)=>{let x=h.currentTarget,m={x:h.clientX,y:h.clientY},y=Vte(m,x.getBoundingClientRect()),v=zte(m,y),w=Ute(g.getBoundingClientRect()),k=jte([...v,...w]);s(k),d(!0)},[d]);return ge.useEffect(()=>()=>p(),[p]),ge.useEffect(()=>{if(l&&u){let h=x=>f(x,u),g=x=>f(x,l);return l.addEventListener("pointerleave",h),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",g)}}},[l,u,f,p]),ge.useEffect(()=>{if(a){let h=g=>{let x=g.target,m={x:g.clientX,y:g.clientY},y=l?.contains(x)||u?.contains(x),v=!Bte(m,a);y?p():v&&(p(),c())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[l,u,a,c,p]),(0,At.jsx)(UV,{...t,ref:o})}),[Dte,Nte]=ow(sw,{isInside:!1}),UV=ge.forwardRef((t,e)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:a,...s}=t,l=xh(Su,n),c=aw(n),{onClose:u}=l;return ge.useEffect(()=>(document.addEventListener(JE,u),()=>document.removeEventListener(JE,u)),[u]),ge.useEffect(()=>{if(l.trigger){let d=p=>{p.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),(0,At.jsx)(F3,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:(0,At.jsxs)(XE,{"data-state":l.stateAttribute,...c,...s,ref:e,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,At.jsx)($E,{children:r}),(0,At.jsx)(Dte,{scope:n,isInside:!0,children:(0,At.jsx)(OV,{id:l.contentId,role:"tooltip",children:i||r})})]})})});zV.displayName=Su;var BV="TooltipArrow",jV=ge.forwardRef((t,e)=>{let{__scopeTooltip:n,...r}=t,i=aw(n);return Nte(BV,n).isInside?null:(0,At.jsx)(ZE,{...i,...r,ref:e})});jV.displayName=BV;function Vte(t,e){let n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function zte(t,e,n=5){let r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function Ute(t){let{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function Bte(t,e){let{x:n,y:r}=t,i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o].x,l=e[o].y,c=e[a].x,u=e[a].y;l>r!=u>r&&n<(c-s)*(r-l)/(u-l)+s&&(i=!i)}return i}function jte(t){let e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Hte(e)}function Hte(t){if(t.length<=1)return t.slice();let e=[];for(let r=0;r<t.length;r++){let i=t[r];for(;e.length>=2;){let o=e[e.length-1],a=e[e.length-2];if((o.x-a.x)*(i.y-a.y)>=(o.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();let n=[];for(let r=t.length-1;r>=0;r--){let i=t[r];for(;n.length>=2;){let o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(i.y-a.y)>=(o.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var wh=nP;var uw=$(K());var WV=require("obsidian"),lw=$(K()),sz=$(ie());function Wte(t){let e=(0,lw.useRef)(null);return[(0,lw.useCallback)(r=>{e.current&&e.current.empty(),r&&(0,WV.setIcon)(r,t),e.current=r},[t])]}function nt(t){return function(n){let[r]=Wte(t);return(0,sz.jsx)("div",{ref:r,...n})}}var cw=nt("play"),qV=nt("pause"),Kke=nt("volume"),KV=nt("volume-1"),GV=nt("volume-2"),YV=nt("volume-x"),QV=nt("maximize"),XV=nt("minimize"),qte=nt("picture-in-picture-2"),Kte=nt("picture-in-picture"),iP=nt("subtitles"),Gke=nt("check-circle"),Yke=nt("circle"),ZV=nt("fast-forward"),JV=nt("rewind"),ez=nt("edit"),tz=nt("image-down"),Gte=nt("pin"),nz=nt("more-horizontal"),Qke=nt("plus"),Xke=nt("trash"),rz=nt("list-video"),iz=nt("skip-forward"),oz=nt("skip-back"),az=nt("copy");var ht=$(ie()),bh="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 dw(){let t=qe("paused");return(0,ht.jsx)($v,{className:bh,"aria-label":t?"Play":"Pause",children:t?(0,ht.jsx)(cw,{className:"w-7 h-7 translate-x-px"}):(0,ht.jsx)(qV,{className:"w-7 h-7"})})}function lz({seconds:t}){return(0,ht.jsx)(Nf,{className:bh,seconds:t,"aria-label":`Fast forward ${t}s`,children:(0,ht.jsx)(ZV,{className:"w-7 h-7"})})}function cz({seconds:t}){return(0,ht.jsx)(Nf,{className:bh,seconds:-t,"aria-label":`Rewind ${t}s`,children:(0,ht.jsx)(JV,{className:"w-7 h-7"})})}function pw(){let t=qe("volume"),e=qe("muted");return(0,ht.jsx)(Lv,{className:bh,"aria-label":e?"Unmute":"Mute",children:e||t==0?(0,ht.jsx)(YV,{className:"w-7 h-7"}):t<.5?(0,ht.jsx)(KV,{className:"w-7 h-7"}):(0,ht.jsx)(GV,{className:"w-7 h-7"})})}function uz(){let t=qe("fullscreen");return(0,ht.jsx)(Iv,{className:bh,"aria-label":t?"Exit fullscreen":"Enter fullscreen",children:t?(0,ht.jsx)(XV,{className:"w-7 h-7"}):(0,ht.jsx)(QV,{className:"w-7 h-7"})})}function fw(){return gu()?(0,ht.jsx)("button",{className:gt("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:()=>{},[qi]:!0,"aria-label":"Edit in editor",children:(0,ht.jsx)(ez,{className:"w-7 h-7"})}):null}function Yte(){let t=Uv(),[e,n]=(0,uw.useState)(()=>Js(t)),r=l3(),i=yi(a=>a.screenshotFormat),o=yi(a=>a.screenshotQuality);return(0,uw.useEffect)(()=>{n(Js(t))},[t]),!e||!r||!t?null:async()=>{r(await nh(t,i,o))}}function dz(){let t=Yte();return t?(0,ht.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,ht.jsx)(tz,{className:"w-7 h-7"})}):null}function hw(){let{target:t,action:e}=Fx("next");return t?(0,ht.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:e,"aria-label":`Next: ${t.title}`,children:(0,ht.jsx)(iz,{className:"w-7 h-7"})}):null}function mw(){let{target:t,action:e}=Fx("previous");if(t)return(0,ht.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:e,"aria-label":`Prev: ${t.title}`,children:(0,ht.jsx)(oz,{className:"w-7 h-7"})})}var qi="data-lp-pass-through";var mz=require("obsidian"),gz=$(K());function fz(t,e,n){let r=Qte(e);hz(t,r,n,new Map)}function hz(t,e,n,r){e.forEach(i=>{let o=n(t,i,r);if(o&&i.children.length>0){r.set(i.index,o);let a=o.setSubmenu();hz(a,i.children,n,r)}})}function Qte(t){let e=[],n=t.map((r,i)=>({...r,index:i,children:[]}));return n.forEach(r=>{r.parent>=0?n[r.parent]?.children.push(r):e.push(r)}),e}var oP=$(ie());function aP(){let t=qS(),e=qe("textTracks"),[,n]=gE(),r=gw(i=>(t.forEach(({label:o,select:a,selected:s,track:l},c)=>{i.addItem(u=>{u.setTitle(l?Zf(l,c):o).setChecked(s).onClick(()=>{a(),n(l?.id??null)})})}),!0));return e.length===0?null:(0,oP.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",[qi]:!0,onClick:r,"aria-label":"Select Caption",children:(0,oP.jsx)(iP,{className:"w-7 h-7"})})}var _h=$(ie());function gw(t){let e=(0,gz.useRef)(null);return n=>{e.current?.close(),e.current=null;let r=new mz.Menu;t(r)?(Vl(n.nativeEvent,r),n.nativeEvent.stopImmediatePropagation(),yt(r,{close:i=>function(...o){return e.current===this&&(e.current=null),i.call(this,...o)}}),e.current=r):r.close()}}function yw(){let t=Ax(),e=Ix(),n=et(o=>o.source?.url),r=nl(),i=gw(o=>!e||!n||!t?!1:(o.addItem(a=>a.setTitle(t.title).setIcon("list-video").onClick(()=>{r.workspace.openLinkText(t.file.path,"","tab")})).addSeparator(),fz(o,t.list,(a,s,l)=>{if(s.type==="subtitle")return null;let c=null;if(yu(s)){let u=s.children.length>0;a.addItem(d=>{if(d.setTitle(s.title).onClick(()=>{e(s,t)}),Zn(n,s.media)){d.setChecked(!0);let p=f=>{if(f.parent<0)return;l.get(f.parent)?.setChecked(!0);let h=t.list[f.parent];h&&p(h)};p(s)}u||(c=d)}),u&&a.addItem(d=>{d.setTitle(" \u21B3"),c=d})}else a.addItem(u=>{u.setTitle(s.title).setIcon("hash"),c=u});return c}),!0));return!e||!n||!t?null:(0,_h.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",[qi]:!0,onClick:i,"aria-label":"Select Playlist",children:(0,_h.jsx)(rz,{className:"w-7 h-7"})})}function vw(){let t=Wr(),e=nl(l=>l.workspace),n=mu(),r=gu(),i=s3(),o=et(l=>l.source),a=$x(),s=gw(l=>{if(!t||!o)return!1;let{toggleControls:c,controls:u,setTransform:d,transform:p,disableWebFullscreen:f,toggleWebFullscreen:h,textTracks:g}=a.getState();return e.trigger("mx:media-menu",l,{player:t,reload:i,source:o.url,viewType:o.viewType,toggleControls:c,controls:u,setTransform:d,tracks:{local:g.local,remote:Jf(g.remote,g.local)},transform:p,plugin:n,disableWebFullscreen:f,toggleWebFullscreen:h},r?"player-menu-embed":"player-menu-view"),!0});return!t||!o?null:(0,_h.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",[qi]:!0,onClick:s,"aria-label":"More options",children:(0,_h.jsx)(nz,{className:"w-7 h-7"})})}var kw=$(K());var ce=$(K(),1);function kh(t,[e,n]){return Math.min(n,Math.max(e,t))}var Th=$(K(),1),Xte=(0,Th.createContext)(void 0);function xw(t){let e=(0,Th.useContext)(Xte);return t||e||"ltr"}var ww=$(K(),1);function vz(t){let e=(0,ww.useRef)({value:t,previous:t});return(0,ww.useMemo)(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var bi=$(K(),1);function xz(t){let e=t+"CollectionProvider",[n,r]=ji(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=f=>{let{scope:h,children:g}=f,x=bi.default.useRef(null),m=bi.default.useRef(new Map).current;return bi.default.createElement(i,{scope:h,itemMap:m,collectionRef:x},g)},s=t+"CollectionSlot",l=bi.default.forwardRef((f,h)=>{let{scope:g,children:x}=f,m=o(s,g),y=ze(h,m.collectionRef);return bi.default.createElement(wu,{ref:y},x)}),c=t+"CollectionItemSlot",u="data-radix-collection-item",d=bi.default.forwardRef((f,h)=>{let{scope:g,children:x,...m}=f,y=bi.default.useRef(null),v=ze(h,y),w=o(c,g);return bi.default.useEffect(()=>(w.itemMap.set(y,{ref:y,...m}),()=>void w.itemMap.delete(y))),bi.default.createElement(wu,{[u]:"",ref:v},x)});function p(f){let h=o(t+"CollectionConsumer",f);return bi.default.useCallback(()=>{let x=h.collectionRef.current;if(!x)return[];let m=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((w,k)=>m.indexOf(w.ref.current)-m.indexOf(k.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:l,ItemSlot:d},p,r]}var _z=["PageUp","PageDown"],kz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Tz={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Sh="Slider",[sP,Zte,Jte]=xz(Sh),[Sz,G0e]=ji(Sh,[Jte]),[ene,bw]=Sz(Sh),tne=(0,ce.forwardRef)((t,e)=>{let{name:n,min:r=0,max:i=100,step:o=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:p=()=>{},inverted:f=!1,...h}=t,[g,x]=(0,ce.useState)(null),m=ze(e,O=>x(O)),y=(0,ce.useRef)(new Set),v=(0,ce.useRef)(0),w=a==="horizontal",k=g?!!g.closest("form"):!0,b=w?nne:rne,[S=[],C]=rw({prop:u,defaultProp:c,onChange:O=>{var j;(j=[...y.current][v.current])===null||j===void 0||j.focus(),d(O)}}),R=(0,ce.useRef)(S);function _(O){let j=pne(S,O);N(O,j)}function D(O){N(O,v.current)}function I(){let O=R.current[v.current];S[v.current]!==O&&p(S)}function N(O,j,{commit:Q}={commit:!1}){let X=gne(o),xe=yne(Math.round((O-r)/o)*o+r,X),se=kh(xe,[r,i]);C((E=[])=>{let Ne=une(E,se,j);if(mne(Ne,l*o)){v.current=Ne.indexOf(se);let Pt=String(Ne)!==String(E);return Pt&&Q&&p(Ne),Pt?Ne:E}else return E})}return(0,ce.createElement)(ene,{scope:t.__scopeSlider,disabled:s,min:r,max:i,valueIndexToChangeRef:v,thumbs:y.current,values:S,orientation:a},(0,ce.createElement)(sP.Provider,{scope:t.__scopeSlider},(0,ce.createElement)(sP.Slot,{scope:t.__scopeSlider},(0,ce.createElement)(b,ue({"aria-disabled":s,"data-disabled":s?"":void 0},h,{ref:m,onPointerDown:Ke(h.onPointerDown,()=>{s||(R.current=S)}),min:r,max:i,inverted:f,onSlideStart:s?void 0:_,onSlideMove:s?void 0:D,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&N(r,0,{commit:!0}),onEndKeyDown:()=>!s&&N(i,S.length-1,{commit:!0}),onStepKeyDown:({event:O,direction:j})=>{if(!s){let xe=_z.includes(O.key)||O.shiftKey&&kz.includes(O.key)?10:1,se=v.current,E=S[se],Ne=o*xe*j;N(E+Ne,se,{commit:!0})}}})))),k&&S.map((O,j)=>(0,ce.createElement)(cne,{key:j,name:n?n+(S.length>1?"[]":""):void 0,value:O})))}),[Ez,Pz]=Sz(Sh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),nne=(0,ce.forwardRef)((t,e)=>{let{min:n,max:r,dir:i,inverted:o,onSlideStart:a,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=t,[d,p]=(0,ce.useState)(null),f=ze(e,v=>p(v)),h=(0,ce.useRef)(),g=xw(i),x=g==="ltr",m=x&&!o||!x&&o;function y(v){let w=h.current||d.getBoundingClientRect(),k=[0,w.width],S=lP(k,m?[n,r]:[r,n]);return h.current=w,S(v-w.left)}return(0,ce.createElement)(Ez,{scope:t.__scopeSlider,startEdge:m?"left":"right",endEdge:m?"right":"left",direction:m?1:-1,size:"width"},(0,ce.createElement)(Cz,ue({dir:g,"data-orientation":"horizontal"},u,{ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{let w=y(v.clientX);a?.(w)},onSlideMove:v=>{let w=y(v.clientX);s?.(w)},onSlideEnd:()=>{h.current=void 0,l?.()},onStepKeyDown:v=>{let k=Tz[m?"from-left":"from-right"].includes(v.key);c?.({event:v,direction:k?-1:1})}})))}),rne=(0,ce.forwardRef)((t,e)=>{let{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:a,onSlideEnd:s,onStepKeyDown:l,...c}=t,u=(0,ce.useRef)(null),d=ze(e,u),p=(0,ce.useRef)(),f=!i;function h(g){let x=p.current||u.current.getBoundingClientRect(),m=[0,x.height],v=lP(m,f?[r,n]:[n,r]);return p.current=x,v(g-x.top)}return(0,ce.createElement)(Ez,{scope:t.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1},(0,ce.createElement)(Cz,ue({"data-orientation":"vertical"},c,{ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{let x=h(g.clientY);o?.(x)},onSlideMove:g=>{let x=h(g.clientY);a?.(x)},onSlideEnd:()=>{p.current=void 0,s?.()},onStepKeyDown:g=>{let m=Tz[f?"from-bottom":"from-top"].includes(g.key);l?.({event:g,direction:m?-1:1})}})))}),Cz=(0,ce.forwardRef)((t,e)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:l,...c}=t,u=bw(Sh,n);return(0,ce.createElement)(at.span,ue({},c,{ref:e,onKeyDown:Ke(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):_z.concat(kz).includes(d.key)&&(l(d),d.preventDefault())}),onPointerDown:Ke(t.onPointerDown,d=>{let p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),u.thumbs.has(p)?p.focus():r(d)}),onPointerMove:Ke(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&i(d)}),onPointerUp:Ke(t.onPointerUp,d=>{let p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),o(d))})}))}),ine="SliderTrack",one=(0,ce.forwardRef)((t,e)=>{let{__scopeSlider:n,...r}=t,i=bw(ine,n);return(0,ce.createElement)(at.span,ue({"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation},r,{ref:e}))}),wz="SliderRange",ane=(0,ce.forwardRef)((t,e)=>{let{__scopeSlider:n,...r}=t,i=bw(wz,n),o=Pz(wz,n),a=(0,ce.useRef)(null),s=ze(e,a),l=i.values.length,c=i.values.map(p=>Mz(p,i.min,i.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,ce.createElement)(at.span,ue({"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0},r,{ref:s,style:{...t.style,[o.startEdge]:u+"%",[o.endEdge]:d+"%"}}))}),bz="SliderThumb",sne=(0,ce.forwardRef)((t,e)=>{let n=Zte(t.__scopeSlider),[r,i]=(0,ce.useState)(null),o=ze(e,s=>i(s)),a=(0,ce.useMemo)(()=>r?n().findIndex(s=>s.ref.current===r):-1,[n,r]);return(0,ce.createElement)(lne,ue({},t,{ref:o,index:a}))}),lne=(0,ce.forwardRef)((t,e)=>{let{__scopeSlider:n,index:r,...i}=t,o=bw(bz,n),a=Pz(bz,n),[s,l]=(0,ce.useState)(null),c=ze(e,x=>l(x)),u=Zx(s),d=o.values[r],p=d===void 0?0:Mz(d,o.min,o.max),f=dne(r,o.values.length),h=u?.[a.size],g=h?fne(h,p,a.direction):0;return(0,ce.useEffect)(()=>{if(s)return o.thumbs.add(s),()=>{o.thumbs.delete(s)}},[s,o.thumbs]),(0,ce.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${p}% + ${g}px)`}},(0,ce.createElement)(sP.ItemSlot,{scope:t.__scopeSlider},(0,ce.createElement)(at.span,ue({role:"slider","aria-label":t["aria-label"]||f,"aria-valuemin":o.min,"aria-valuenow":d,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0},i,{ref:c,style:d===void 0?{display:"none"}:t.style,onFocus:Ke(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})}))))}),cne=t=>{let{value:e,...n}=t,r=(0,ce.useRef)(null),i=vz(e);return(0,ce.useEffect)(()=>{let o=r.current,a=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(a,"value").set;if(i!==e&&l){let c=new Event("input",{bubbles:!0});l.call(o,e),o.dispatchEvent(c)}},[i,e]),(0,ce.createElement)("input",ue({style:{display:"none"}},n,{ref:r,defaultValue:e}))};function une(t=[],e,n){let r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function Mz(t,e,n){let o=100/(n-e)*(t-e);return kh(o,[0,100])}function dne(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function pne(t,e){if(t.length===1)return 0;let n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function fne(t,e,n){let r=t/2,o=lP([0,50],[0,r]);return(r-o(e)*n)*n}function hne(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function mne(t,e){if(e>0){let n=hne(t);return Math.min(...n)>=e}return!0}function lP(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function gne(t){return(String(t).split(".")[1]||"").length}function yne(t,e){let n=Math.pow(10,e);return Math.round(t*n)/n}var cP=tne,Rz=one,$z=ane,Iz=sne;var Lz=$(K());var Eu=$(ie()),_w=Lz.forwardRef(({className:t,variant:e="regular",autoHidden:n,children:r,...i},o)=>(0,Eu.jsxs)(cP,{ref:o,className:gt("group relative flex w-full touch-none select-none items-center",t),...i,children:[(0,Eu.jsx)(Rz,{className:"relative h-slider-track w-full grow overflow-hidden rounded-sm bg-slider-track",children:(0,Eu.jsx)($z,{className:"absolute h-full bg-ia-accent rounded-sm will-change-[width]"})}),(0,Eu.jsx)(Iz,{className:gt("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")}),r]}));_w.displayName=cP.displayName;var Ga=$(ie());function Tw(){let t=qe("volume"),e=qe("canSetVolume"),n=zv();return e?(0,Ga.jsx)(_w,{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:([r])=>{n.changeVolume(r/100)},"aria-label":"Volume",autoHidden:!0}):null}function Sw({thumbnails:t}){let e=qe("currentTime"),n=qe("canSeek"),r=qe("duration"),i=qe("seeking"),o=zv(),a=1/r*100,[s,l]=(0,kw.useState)(0),{previewRootRef:c,previewRef:u,previewValue:d}=YF({clamp:!0,offset:6,orientation:"horizontal"}),p=d/100*r;return(0,kw.useEffect)(()=>{i||l(e/r*100)},[e,r,i]),(0,Ga.jsx)(_w,{className:"group relative inline-flex h-9 w-full cursor-pointer touch-none select-none items-center outline-none",value:[s],disabled:!n,step:Number.isFinite(a)?a:1,ref:c,onValueChange:([f])=>{l(f),o.seeking(f/100*r)},onValueCommit:([f])=>{o.seek(f/100*r)},autoHidden:!0,"aria-label":"Current Time",children:(0,Ga.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,Ga.jsx)(Av.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,Ga.jsx)(Av.Img,{})}):null,(0,Ga.jsx)("span",{className:"text-[13px]",children:Aa(p)})]})})}var Pu=$(ie());function Ew(){return(0,Pu.jsxs)("div",{className:"ml-2.5 flex items-center text-sm font-medium",children:[(0,Pu.jsx)(Vf,{className:"time",type:"current"}),(0,Pu.jsx)("div",{className:"mx-1 text-white/80",children:"/"}),(0,Pu.jsx)(Vf,{className:"time",type:"duration"})]})}var Eh=$(ie());function Pw(){let t=qe("title").trim(),e=Dv().trim();return!t&&!e?null:(0,Eh.jsxs)("span",{className:"inline-block flex-1 overflow-hidden text-ellipsis whitespace-nowrap px-2 text-sm font-medium text-white/70",children:[(0,Eh.jsx)("span",{className:"mr-1",children:"|"}),(0,Eh.jsx)("span",{children:e||t})]})}var Ae=$(ie());function Oz({thumbnails:t}){return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(xne,{}),(0,Ae.jsx)(Mo.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,Ae.jsxs)(wh,{children:[(0,Ae.jsx)("div",{className:"flex-1"}),(0,Ae.jsx)(Mo.Group,{className:"flex w-full items-center px-2",children:(0,Ae.jsx)(Sw,{thumbnails:t})}),(0,Ae.jsxs)(Mo.Group,{className:"-mt-0.5 flex w-full items-center px-2 pb-2",children:[(0,Ae.jsx)(cz,{seconds:30}),(0,Ae.jsx)(dw,{}),(0,Ae.jsx)(lz,{seconds:30}),(0,Ae.jsx)(mw,{}),(0,Ae.jsx)(hw,{}),(0,Ae.jsx)(pw,{}),(0,Ae.jsx)(Tw,{}),(0,Ae.jsx)(Ew,{}),(0,Ae.jsx)(Pw,{}),(0,Ae.jsx)("div",{className:"flex-1"}),(0,Ae.jsx)(fw,{}),(0,Ae.jsx)(yw,{}),(0,Ae.jsx)(vw,{})]})]})})]})}function xne(){return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Hr,{className:"absolute inset-0 z-0 block h-full w-full",event:"pointerup",action:"toggle:paused"}),(0,Ae.jsx)(Hr,{className:"absolute inset-0 z-0 block h-full w-full",event:"dblpointerup",action:"toggle:fullscreen"}),(0,Ae.jsx)(Hr,{className:"absolute left-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:-10"}),(0,Ae.jsx)(Hr,{className:"absolute right-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:10"})]})}var Re=$(ie());function Fz({thumbnails:t}){return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(wne,{}),(0,Re.jsx)(Nv,{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,Re.jsx)(Mo.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,Re.jsxs)(wh,{children:[(0,Re.jsx)("div",{className:"flex-1"}),(0,Re.jsx)(Mo.Group,{className:"flex w-full items-center px-2",children:(0,Re.jsx)(Sw,{thumbnails:t})}),(0,Re.jsxs)(Mo.Group,{className:"-mt-0.5 flex w-full items-center px-2 pb-2",children:[(0,Re.jsx)(dw,{}),(0,Re.jsx)(mw,{}),(0,Re.jsx)(hw,{}),(0,Re.jsx)(pw,{}),(0,Re.jsx)(Tw,{}),(0,Re.jsx)(Ew,{}),(0,Re.jsx)(Pw,{}),(0,Re.jsx)("div",{className:"flex-1"}),(0,Re.jsx)(aP,{}),(0,Re.jsx)(yw,{}),(0,Re.jsx)(dz,{}),(0,Re.jsx)(uz,{}),(0,Re.jsx)(fw,{}),(0,Re.jsx)(vw,{})]})]})})]})}function wne(){return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(Hr,{className:"absolute inset-0 z-0 block h-full w-full",event:"pointerup",action:"toggle:paused"}),(0,Re.jsx)(Hr,{className:"absolute inset-0 z-0 block h-full w-full",event:"dblpointerup",action:"toggle:fullscreen"}),(0,Re.jsx)(Hr,{className:"absolute left-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:-10"}),(0,Re.jsx)(Hr,{className:"absolute right-0 top-0 z-10 block h-full w-1/5",event:"dblpointerup",action:"seek:10"})]})}var Wz=$(K());var Ph=class{constructor(){T(this,"name","webview");T(this,"target")}canPlay({src:e}){return Uf(e)&&_D(e)}mediaType(){return"video"}async load(e){return new yn(this.target,e)}};function Cw(t){return{enable:`mx-enable-preload-${t}`,disable:`mx-disable-preload-${t}`,preload:`file:///mx-preload-${t}`}}function uP(t){return{enable:e=>t.ipcRenderer.invoke(t.channel.enable,e),disable:()=>t.ipcRenderer.invoke(t.channel.disable)}}var On=$(K());function Mw(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var Dz=$(K());function Nz(t,e){var n=(0,Dz.useState)(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var zz=$(K());var Vz=new WeakMap;function Ch(t,e){var n=Nz(e||null,function(r){return t.forEach(function(i){return Mw(i,r)})});return zz.useLayoutEffect(function(){var r=Vz.get(n);if(r){var i=new Set(r),o=new Set(t),a=n.current;i.forEach(function(s){o.has(s)||Mw(s,null)}),o.forEach(function(s){i.has(s)||Mw(s,a)})}Vz.set(n,t)},[t]),n}var $w=require("obsidian"),Rw={mac:"Mozilla/5.0 (Macintosh; Intel Mac OS X 12.1; rv:95.0) Gecko/20100101 Firefox/95.0",windows:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0",linux:"Mozilla/5.0 (Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0"};function dP(t){return $w.Platform.isWin?Rw.windows:$w.Platform.isMacOS?Rw.mac:$w.Platform.isLinux?Rw.linux:Rw.windows}var Uz=$(K()),pP={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 bne(t){return Object.entries(t).reduce((e,[n,r])=>(n in pP?e.event[n]=r:e.rest[n]=r,e),{event:{},rest:{}})}function Bz(t,e){let{event:n,rest:r}=bne(t);for(let i of Object.keys(pP)){let o=i,a=pP[o],s=n[o];(0,Uz.useEffect)(()=>{if(!e.current||!s)return;let l=e.current;return l.addEventListener(a,s),()=>{l.removeEventListener(a,s)}},[a,s,e])}return r}var Hz=$(ie());function _ne(){let t=mu(),[e,n]=(0,On.useState)(!1);return(0,On.useEffect)(()=>{t.preload.untilReady().then(()=>n(!0)).catch(()=>n(null))},[t.preload]),e}var jz=(0,On.forwardRef)(function({devtools:e=!1,muted:n=!1,className:r,useragent:i,...o},a){let s=(0,On.useRef)(null),l=_ne(),[c,u]=(0,On.useState)(!1),d=Bz(o,s);Tne(n,s,c);let p=kne(i??navigator.userAgent,s,c);(0,On.useEffect)(()=>{if(!s.current)return;let h=s.current;return h.addEventListener("dom-ready",g),h.addEventListener("will-navigate",x),()=>{h.removeEventListener("dom-ready",g),h.removeEventListener("will-navigate",x)};function g(){u(!0)}function x(){u(!1)}},[]);let f=Ch([s,a]);if(d.preload){if(l===!1)return null;l===null&&(d.preload=void 0)}return(0,Hz.jsx)("webview",{ref:f,className:gt("h-full w-full",r),useragent:p,...d})});function kne(t,e,n){let r=(0,On.useMemo)(()=>{let i=t??navigator.userAgent;return dP(i)},[t]);return(0,On.useEffect)(()=>{!e.current||!n||r===e.current.useragent||e.current.setUserAgent(r)},[r,n,e]),r}function Tne(t,e,n){(0,On.useEffect)(()=>{!e.current||!n||t===e.current.isAudioMuted()||e.current.setAudioMuted(t)},[t,n,e])}var fP=$(ie()),{preload:Sne}=Cw(Bf);function qz({loaders:t,...e}){let n=nl(l=>l.appId),r=qe("viewType"),i=et(l=>!!l.transform?.flipHorizontal),o=et(l=>!!l.transform?.flipVertical),a=et(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}}),s=Nx();return(0,fP.jsx)(YS,{className:gt(r==="video"&&i&&"-scale-x-100",r==="video"&&o&&"-scale-y-100",r==="video"&&a),loaders:[Ph,...t??[]],buildMediaEl:(0,Wz.useCallback)((l,c)=>l instanceof Ph?(0,fP.jsx)(jz,{"aria-hidden":!0,className:gt("data-[play-ready]:blur-none blur-lg transition-opacity",s&&"pointer-events-none"),webpreferences:"autoplayPolicy=user-gesture-required",partition:zl(n),preload:Sne,ref:u=>{c.load(u)}}):null,[n,s]),...e})}var Kz=$(K());function Gz(){let t=et(o=>o.source?.url),{vault:e}=nl(),n=t?Ct(t):null,r=(0,Kz.useMemo)(()=>{if(t)return Se(t)?e.getResourcePath(t.file):t.source.href},[n]),i=et(o=>{let a=o.source?.viewType;if(a){if(a==="mx-webpage")return"webpage";if(a?.endsWith("video"))return"video/mp4";if(a?.endsWith("audio"))return"audio/mp3"}});if(r)return i==="webpage"?{src:wD(r)}:{src:r,type:i}}var _i=$(ie());function Ene({onViewTypeChange:t}){return E3(t),h3(),C3(),Y2(),(0,_i.jsx)(_i.Fragment,{})}function Pne(){let t=qe("viewType"),e=Nx();return t==="audio"?(0,_i.jsx)(Oz,{}):e?(0,_i.jsx)(Fz,{}):null}function Ya(){let t=et(d=>d.setPlayer),{onEnded:e}=Ox(),n=Gz(),r=et(({source:d})=>{if(d)return Se(d.url)?d.url.file.extension==="webm":d.url.source.pathname.endsWith(".webm")}),i=yi(d=>d.loadStrategy),o=gu(),[a,s]=(0,Yz.useState)("unknown"),l=et(d=>d.title),{controls:c,...u}=CE();return n?(0,_i.jsxs)(GS,{className:gt("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:o?i:"eager",src:n,playsInline:!0,title:l,viewType:a,ref:t,onEnded:e,onError:d=>Cne(d,n.src),...u,children:[(0,_i.jsx)(qz,{}),(0,_i.jsx)(Ene,{onViewTypeChange:d=>{s(d),!r&&d==="audio"&&new hP.Notice("Unable to show video content due to a potentially unsupported codec by Obsidian. For verification, please disable this plugin, add the video to the vault, and check if video playback resumes normally.")}}),(0,_i.jsx)(Pne,{})]}):null}function Cne(t,e){new hP.Notice(createFragment(n=>{switch(n.appendText(`Failed to load media for ${e}: `),n.createEl("br"),t.code){case 1:n.appendText("The media playback was aborted");break;case 2:n.appendText("A network error caused the media playback to fail");break;case 3:n.appendText("The media playback was aborted due to a corruption problem or because the media encoding is not supported");break;case 4:n.appendText("The media is not supported to open as regular video or audio, try open as webpage");break;default:n.appendText(t.message||"Unknown error, check console for more details"),console.error("Failed to load media",e,t);break}}))}function Iw(t,e){let n=new WeakMap,r;t.register(tl(t.store,i=>[i.subscribe(({currentTime:o,paused:a,playbackRate:s})=>{o!==0&&i.el&&n.set(t.leaf.parent,{currentTime:o,paused:a,playbackRate:s})}),i.listen("can-play",()=>{if(!r)return;let o=n.get(r);if(!o){r=void 0;return}let{currentTime:a,paused:s,playbackRate:l}=o;if(!s)i.play(new Event("recover-state")).then(()=>{i.currentTime=a,i.playbackRate=l,r&&(n.delete(r),r=void 0)}).catch(c=>console.error("recov err play",c));else try{i.currentTime=a,i.playbackRate=l,r&&(n.delete(r),r=void 0)}catch(c){console.error("recov err paused",c)}})])),t.register(Rne(t,(i,o)=>{e(),n.has(o)?r=o:r=void 0})),t.register(()=>{r=void 0})}function Lw(t,e){let n=new WeakMap,r;t.register(tl(t.store,i=>[i.subscribe(({currentTime:o,paused:a,playbackRate:s})=>{o!==0&&i.el&&n.set(i.el.win,{currentTime:o,paused:a,playbackRate:s})}),i.listen("can-play",()=>{if(!r)return;let o=n.get(r);if(!o){r=void 0;return}let{currentTime:a,paused:s,playbackRate:l}=o;if(!s)i.play(new Event("recover-state")).then(()=>{i.currentTime=a,i.playbackRate=l,r&&(n.delete(r),r=void 0)}).catch(c=>console.error("recov err play",c));else try{i.currentTime=a,i.playbackRate=l,r&&(n.delete(r),r=void 0)}catch(c){console.error("recov err paused",c)}})])),t.register(Mne(t.containerEl,(i,o)=>{e(),n.has(o)?r=o:r=void 0})),t.register(()=>{r=void 0})}function Mne(t,e){let n=t.win;return t.onNodeInserted(()=>{let r=t.win;r!==n&&(e(r,n),n=r)})}function Rne(t,e){let n=t.containerEl.win,r=t.leaf.parent;return t.containerEl.onNodeInserted(()=>{let i=t.containerEl.win,o=t.leaf.parent;i===n?o!==r&&(e(o,r),r=o):n=i})}var zw=require("obsidian");var Aw=require("obsidian");function*Mh(t){for(let e of t.children)e instanceof Aw.TFolder?yield*Mh(e):e instanceof Aw.TFile&&(yield e)}function Ow(t,e){return t.initialized?Promise.resolve():new Promise(n=>{let r=t.on("initialized",()=>{t.offref(r),n()});e?.registerEvent(r)})}var Zz=require("obsidian");var Qz=require("obsidian");function Fw(t){return t.type==="link"}function Xz(t){let{frontmatter:e,frontmatterLinks:n}=t;return e?B2.reduce((r,i)=>{let o=Xf[i],a=e[o.plural];if(Array.isArray(a)&&a.length>0&&a.every(l=>typeof l=="string"))return r.push(...a.map((l,c)=>s({value:l,key:`${o.plural}.${c}`})).filter(l=>!!l)),r;if(a=e[o.singular],typeof a=="string"&&a){let l=s({value:a,key:o.singular});return l&&r.push(l),r}function s({value:l,key:c}){let u=n?.find(d=>d.key===c);if(u){let{path:d,subpath:p}=(0,Qz.parseLinktext)(u.link);return{type:"link",path:d,subpath:p,kind:i,alias:u.displayText}}else{let d=j2(l,{kind:i});if(d)return d}return null}return r},[]):[]}function mP({alias:t,kind:e,path:n,subpath:r},i,{metadataCache:o}){let a=o.getFirstLinkpathDest(n,i);return a?Ua(a,{kind:e,subpath:r,alias:t}):null}var cl,Rh,gP,$h,yP,Dw=class extends Zz.Component{constructor(n){super();this.plugin=n;Z(this,Rh);Z(this,$h);T(this,"app");T(this,"noteToTrack",new Map);Z(this,cl,Gg());T(this,"trackIDToNote",new Map);this.app=n.app}on(n,r){return L(this,cl).on("changed",r)}onload(){this.registerEvent(this.app.vault.on("rename",(n,r)=>{if(!this.noteToTrack.has(r))return;let i=this.noteToTrack.get(r);i&&(this.noteToTrack.delete(r),this.noteToTrack.set(n.path,i))})),this.registerEvent(this.app.metadataCache.on("resolve",this.onResolve,this))}onResolve(n){let r=this.noteToTrack.get(n.path);if(!r)return;let i=new Set;this.trackIDToNote.forEach((l,c,u)=>{!l.has(n)||!K2(c)||(i.add(c),l.delete(n),l.size>0?u.set(c,l):u.delete(c))});let o=r.filter(Fw).map(l=>V(this,Rh,gP).call(this,n,l)).filter(l=>!!l),a=new Set(o.filter(l=>i.has(l))),s=new Set([...o,...i].filter(l=>!a.has(l)));s.size>0&&L(this,cl).emit("changed",s,n)}add(n,r){let i=V(this,$h,yP).call(this,n);this.noteToTrack.set(n.path,r);let o=new Set;r.forEach(l=>{let c;if(Fw(l))c=V(this,Rh,gP).call(this,n,l);else{c=Lo(l).id;let u=this.trackIDToNote.get(c)??new Set;u.add(n),this.trackIDToNote.set(Lo(l).id,u)}c&&o.add(c)});let a=new Set(i.filter(l=>o.has(l))),s=new Set([...o,...i].filter(l=>!a.has(l)));s.size>0&&L(this,cl).emit("changed",s,n)}remove(n){let r=new Set(V(this,$h,yP).call(this,n));r.size>0&&L(this,cl).emit("changed",r,n)}clear(){this.noteToTrack.clear(),this.trackIDToNote.clear()}getLinkedTextTracks(n){let r=this.noteToTrack.get(n.path);return r?r.map(i=>Fw(i)?mP(i,n.path,this.app):i).filter(i=>!!i):[]}getLinkedMediaNotes(n){let r=Lo(n).id,i=this.trackIDToNote.get(r);return i?[...i]:[]}};cl=new WeakMap,Rh=new WeakSet,gP=function(n,r){let i=mP(r,n.path,this.app);if(!i)return null;let o=Lo(i).id,a=this.trackIDToNote.get(o)??new Set;return a.add(n),this.trackIDToNote.set(o,a),o},$h=new WeakSet,yP=function(n){this.noteToTrack.delete(n.path);let r=[];return this.trackIDToNote.forEach((i,o,a)=>{i.has(n)&&(r.push(o),i.delete(n),i.size>0?a.set(o,i):a.delete(o))}),r};var e5=require("obsidian");function Jz(t){return{textTracks:Xz(t)}}function xP(t,{metadataCache:e,plugin:n}){let r=e.getFileCache(t);if(!r)return null;let i={metadataCache:e,sourcePath:t.path,plugin:n},o=vP(sh.video,r,i)??vP(sh.audio,r,i)??vP(sh.generic,r,i);return o?{src:o,get data(){return Jz(r)}}:null}function vP(t,e,n){let{frontmatter:r,frontmatterLinks:i}=e;if(!r||!(t in r))return null;let o=i?.find(s=>s.key===t);if(o){let{path:s,subpath:l}=(0,e5.parseLinktext)(o.link),c=n.metadataCache.getFirstLinkpathDest(s,n.sourcePath);if(!c)return null;let u=Ft(c.extension);return u?{type:u,file:c,hash:l}:null}let a=r[t];return typeof a!="string"?null:n.plugin.resolveUrl(a)}var Ih,wP,Vw,t5,Nw=class extends zw.Component{constructor(n){super();this.plugin=n;Z(this,Ih);Z(this,Vw);T(this,"app");T(this,"noteToMediaIndex",new Map);T(this,"mediaToNoteIndex",new Map);T(this,"transcript");this.app=n.app,this.transcript=this.addChild(new Dw(this.plugin))}getLinkedTextTracks(n){let r=this.findNote(n);return r?this.transcript.getLinkedTextTracks(r):[]}getLinkedMedia(n){return this.transcript.getLinkedMediaNotes(n).map(i=>this.findMedia(i))}findNote(n){return this.mediaToNoteIndex.get(Ct(n))??null}findMedia(n){return this.noteToMediaIndex.get(n.path)}onResolved(){this.noteToMediaIndex.clear(),this.mediaToNoteIndex.clear(),this.transcript.clear();let n={metadataCache:this.app.metadataCache,vault:this.app.vault,plugin:this.plugin};for(let{file:r,meta:i}of $ne(n))this.addMediaNote(i,r);this.registerEvent(this.app.metadataCache.on("changed",r=>{let i=xP(r,n);i&&this.addMediaNote(i,r)})),this.registerEvent(this.app.metadataCache.on("deleted",r=>{this.removeMediaNote(r)})),this.registerEvent(this.app.vault.on("rename",(r,i)=>{if(!this.noteToMediaIndex.has(i))return;let o=this.noteToMediaIndex.get(i);this.noteToMediaIndex.delete(i),this.noteToMediaIndex.set(r.path,o)})),this.register(this.transcript.on("changed",(r,i)=>{let o=this.findMedia(i);if(!o){console.warn("Media not found for note while responding to transcript change",i.path);return}this.plugin.app.metadataCache.trigger("mx:transcript-changed",r,Ct(o))}))}getNote(n,r){let{metadataCache:i}=this.app;if(!r)throw new Error("Player not initialized");let o=Ao(n,{state:r.state});if(Se(n)){let a=Ft(n.file.extension),s=n.file;return V(this,Ih,wP).call(this,n,{title:o,fm:l=>({[a]:`[[${i.fileToLinktext(s,l)}]]`}),sourcePath:s.path})}else{let a=n.inferredType??"media";return V(this,Ih,wP).call(this,n,{title:o,fm:()=>({[a]:n.jsonState.source})})}}removeMediaNote(n){let r=this.noteToMediaIndex.get(n.path);if(!r)return;this.noteToMediaIndex.delete(n.path);let i=Ct(r);this.mediaToNoteIndex.delete(i),this.transcript.remove(n)}addMediaNote(n,r){let i=Ct(n.src),o=this.mediaToNoteIndex.get(i);o&&o!==r&&o.stat.ctime<=r.stat.ctime||(this.noteToMediaIndex.set(r.path,n.src),this.mediaToNoteIndex.set(i,r),this.transcript.add(r,n.data.textTracks))}onload(){Ow(this.app.metadataCache,this).then(()=>{this.onResolved()})}};Ih=new WeakSet,wP=async function(n,r){let i=this.plugin.mediaNote.findNote(n);if(i)return i;let a=`Media Note - ${hu(r.title)}`;return await V(this,Vw,t5).call(this,a,r.fm,r.sourcePath??"")},Vw=new WeakSet,t5=async function(n,r,i=""){let{fileManager:o}=this.app,a=o.getNewFileParent(i,n),s=await o.createNewFile(a,n,"md",`---
|
|
---
|
|
`);return await o.processFrontMatter(s,l=>{Object.assign(l,r(s.path))}),s};function*$ne(t){for(let e of Mh(t.vault.getRoot())){if(e.extension!=="md")continue;let n=xP(e,t);n&&(yield{meta:n,file:e})}}function Uw(){let t=Ine(async e=>{let n=await this.plugin.transcript.getTracks(e);this.store.getState().setTextTracks(n)});this.registerEvent(this.plugin.app.metadataCache.on("mx:transcript-changed",async(e,n)=>{let r=this.getMediaInfo();!r||Ct(r)!==n||await t(r)}))}function Ine(t,e){let n=new Set,r=new Set,i=(0,zw.debounce)(o=>{t(...o).then((...a)=>{n.forEach(s=>s(...a)),n.clear()}).catch((...a)=>{r.forEach(s=>s(...a)),r.clear()})},e);return(...o)=>new Promise((a,s)=>{n.add(a),r.add(s),i(o)})}var bP=$(ie()),Bw=class extends jw.EditableFileView{constructor(n,r){super(n);this.plugin=r;T(this,"allowNoFile",!1);T(this,"store");T(this,"scope");T(this,"root",null);this.store=Ba(r),this.scope=new jw.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Mx(this)}get player(){return this.store.getState().player}onload(){Uw.call(this),Lw(this,()=>this.render())}async onLoadFile(n){await this.store.getState().loadFile(n,{vault:this.app.vault})}onPaneMenu(n,r){super.onPaneMenu(n,r),Rx(this,n,r)}setEphemeralState(n){if("subpath"in n){let{subpath:r}=n;this.store.getState().setHash(r)}super.setEphemeralState(n)}async onOpen(){await super.onOpen(),this.render()}render(){this.root?.unmount(),this.root=n5.default.createRoot(this.contentEl),this.root.render((0,bP.jsx)(cn.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),onPlaylistChange:n=>{this.plugin.leafOpener.openMediaIn(this.leaf,n.media)},embed:!1},children:(0,bP.jsx)(Ya,{})}))}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}},Cu=class extends Bw{getIcon(){return"file-video"}getMediaInfo(){return this.file?{type:"video",file:this.file,hash:this.getEphemeralState().subpath}:null}getViewType(){return Vn.video}canAcceptExtension(e){return Ft(e)==="video"}},Mu=class extends Bw{getIcon(){return"file-audio"}getViewType(){return Vn.audio}getMediaInfo(){return this.file?{type:"audio",file:this.file,hash:this.getEphemeralState().subpath}:null}canAcceptExtension(e){return Ft(e)==="audio"}};var Hw=require("obsidian"),i5=$(xc());function r5(){let t=this.getDisplayText();this.titleEl.setText(t),this.app.workspace.activeLeaf===this.leaf&&this.app.workspace.requestActiveLeafEvents()&&this.leaf.updateHeader()}var _P=$(ie()),Qa=class extends Hw.ItemView{constructor(n,r){super(n);this.plugin=r;T(this,"store");T(this,"scope");T(this,"root",null);T(this,"navigation",!0);T(this,"updateTitle",r5);this.store=Ba(r),this.scope=new Hw.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Mx(this)}get player(){return this.store.getState().player}async setSource(n){let r=await this.plugin.transcript.getTracks(n);return{viewType:this.getViewType(),textTracks:r}}getMediaInfo(){let n=this.store.getState().source?.url;return n instanceof xt?n??null: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(),Uw.call(this),this.register(yt(this.leaf,{detach:r=>function(...i){return n.root?.unmount(),n.root=null,r.call(this,...i)}})),Lw(this,()=>this.render())}registerRemoteTitleChange(){this.register(tl(this.store,n=>n.subscribe(({title:r})=>{this.updateTitle()})))}onPaneMenu(n,r){super.onPaneMenu(n,r),Rx(this,n,r)}getState(){let n=super.getState(),r=this.store.getState().source?.url;if(Se(r))throw new Error("Remote view don't handle file media");return{...n,source:r?r.jsonState.source:n.source}}async setState(n,r){if(await super.setState(n,r),!("source"in n))return;let i=this.plugin.resolveUrl(n.source);if(!i)console.warn("Invalid URL",n.source);else if(Se(i))console.warn("Open in-vault media in remote view",i);else{let o=this.store.getState().source?.url;Zn(i,o)||(this.store.getState().setSource(i,await this.setSource(i)),this.render())}}setEphemeralState(n){if("subpath"in n){let{subpath:r}=n;this.store.getState().setHash(r)}super.setEphemeralState(n)}async onOpen(){await super.onOpen(),this.render()}render(){this.root&&this.root.unmount(),this.root=i5.default.createRoot(this.contentEl),this.root.render((0,_P.jsx)(cn.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),onPlaylistChange:n=>{n.media.hash+="&play",this.plugin.leafOpener.openMediaIn(this.leaf,n.media)},embed:!1},children:(0,_P.jsx)(Ya,{})}))}close(){return this.root?.unmount(),this.root=null,super.close()}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}};var Lne={"video/vimeo":"Vimeo","video/youtube":"YouTube"},Ru=class extends Qa{onload(){super.onload(),this.registerRemoteTitleChange(),Iw(this,()=>this.render())}getDisplayText(){let e=Lne[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 ds}};var Ww=class extends Qa{},$u=class extends Ww{getIcon(){return"file-video"}getViewType(){return nr.video}getDisplayText(){return this.playerTitle||"Video"}async setSource(e){let n=await super.setSource(e);return n.title=!0,n}},Iu=class extends Ww{getIcon(){return"file-audio"}getDisplayText(){return this.playerTitle||"Audio"}getViewType(){return nr.audio}async setSource(e){let n=await super.setSource(e);return n.title=!0,n}};var Lu=class extends Qa{onload(){super.onload(),this.registerRemoteTitleChange(),Iw(this,()=>this.render())}getViewType(){return Rr}getIcon(){let e=this.getHost();return e==="generic"?"globe":e}getHost(){let{source:e}=this.store.getState();if(Se(e?.url))throw new Error("Cannot get host for file");return e?.url?e.url.type:"generic"}getDisplayText(){return this.playerTitle?`${this.playerTitle} - ${tm[this.getHost()]}`:"Webpage"}};function o5(t,e){if(!(t.view instanceof Cu||t.view instanceof Mu))return!1;let{file:n}=t.view.getState();return n===e.file.path}function a5(t,e){if(!(t.view instanceof Ru||t.view instanceof Lu||t.view instanceof $u||t.view instanceof Iu))return!1;let{source:n}=t.view.store.getState();return Zn(n?.url,e)}function s5(t,e){let n=t.stat.mtime,r=e.stat.mtime;return!n||!r?0:r-n}var qw="mx-media-active",Gw,c5,Yw,u5,Kw=class extends Au.Component{constructor(n){super();this.plugin=n;Z(this,Gw);Z(this,Yw);T(this,"app");T(this,"activeMediaLeaf",null);T(this,"onLeafUpdate",(0,Au.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",r=>{this.onLeafUpdate(r)})),this.registerEvent(n.on("layout-change",()=>{this.onLeafUpdate()}))}onunload(){this.applyActiveMediaLeaf(null)}get workspace(){return this.app.workspace}onActiveLeafChange(n){let r=this.detectActiveMediaLeaf(n);this.activeMediaLeaf!==r&&this.applyActiveMediaLeaf(r)}applyActiveMediaLeaf(n){this.activeMediaLeaf?.tabHeaderEl.removeClass(qw),this.activeMediaLeaf?.containerEl.removeClass(qw),n?.tabHeaderEl.addClass(qw),n?.containerEl.addClass(qw),this.activeMediaLeaf=n}detectActiveMediaLeaf(n){let r=()=>{let i=this.findPinnedPlayer();if(i)return i;let o=l5(this.workspace),{activeTabGroup:a}=this.workspace;return(!n||!a?o:o.filter(l=>!a.children.includes(l))).at(0)??null};if(!n)return r();if(kP(n))return n;if(n.view instanceof Au.MarkdownView&&n.view.file){let{mediaNote:i}=this.plugin,o=i.findMedia(n.view.file);if(o)return this.findPlayerWithSameMedia(o)}return r()}findPlayerWithSameMedia(n){for(let r of this.plugin.urlViewType.getSupported(n)){let i=Ane(n,r,this.workspace);if(i.length>0)return i[0]}return null}findPinnedPlayer(){return l5(this.workspace).filter(n=>n.pinned)[0]??null}get settings(){return this.plugin.settings.getState()}getSplitBehavior(n,r){if(!r)return na(n)??!1;n=na(n);let{defaultMxLinkClick:{click:i,alt:o}}=this.settings;return i===null?n??!1:n===void 0||n===!1?i:o!==null&&n===i?o:n}async openMedia(n,r,{direction:i,viewType:o,fromUser:a=!1}={}){let{workspace:s}=this.app;if(!r){let u=await V(this,Gw,c5).call(this,n,o);if(u)return u}let l=this.getSplitBehavior(r,a),c;return l==="split-horizontal"?c=s.getLeaf("split",i??"horizontal"):c=s.getLeaf(l,i),this.openMediaIn(c,n,o)}async openMediaIn(n,r,i){if(Se(r))await n.openFile(r.file,{eState:{subpath:r.hash},active:!0});else{let{hash:o,source:a}=r.jsonState,s={source:a};i??(i=this.plugin.urlViewType.getPreferred(r)),await n.setViewState({type:i,state:s,active:!0},{subpath:o})}return n}async openNote(n,r="split",i="vertical"){let o=V(this,Yw,u5).call(this,[n]);if(o)return o.getMode()!=="source"&&await o.setState({mode:"source"},{history:!1}),o;let a=this.app.workspace.getLeaf(r,i);return await a.openFile(n,{state:{mode:"source"}}),{file:n,editor:a.view.editor}}};Gw=new WeakSet,c5=async function(n,r){let i=this.findPinnedPlayer();if(i)return await this.openMediaIn(i,n,r);let o=this.findPlayerWithSameMedia(n);return o?(One(n.hash,o),o):null},Yw=new WeakSet,u5=function(n){let{workspace:r}=this.app,i=r.getLeavesOfType("markdown").filter(a=>{let s=a.view.file?.path;return!!s&&n.some(l=>l.path===s)});return i.length===0?null:(i.find(a=>a===r.activeLeaf)??i.sort((a,s)=>s5(a.view.file,s.view.file)).at(0)).view};function l5(t){let e=[];return t.iterateAllLeaves(n=>{f_(n.view.getViewType())&&e.push(n)}),e.sort(Qw),e}function Ane(t,e,n){let r=n.getLeavesOfType(e).filter(i=>Se(t)?o5(i,t):a5(i,t));return r.sort(Qw),r}function kP(t){return!!t&&f_(t.view.getViewType())}function Qw(t,e){return e.activeTime-t.activeTime}function One(t,e){e.setEphemeralState({subpath:t})}function Fne(t,e,n){return r=>{let i=n.workspace.activeEditor;if(!i)return t?t(r):void 0;if(e&&i.getMode()!=="preview")return i instanceof Xw.MarkdownView&&i.inlineTitleEl.isActiveElement()?void 0:e(r,i.editor,i)}}function Xa({playerCheckCallback:t,noteCheckCallback:e,...n},r){let{app:i}=r,o=r.addCommand({...n,checkCallback:Fne(t&&(a=>!t||!kP(i.workspace.activeLeaf)?!1:a?!0:t(a,i.workspace.activeLeaf.view)),e&&((a,s,l)=>{if(!l.file)return!1;let c=r.mediaNote.findMedia(l.file),u=r.leafOpener.detectActiveMediaLeaf(i.workspace.activeLeaf);return e(a,u?.view,{isMediaNote:c,file:l.file,editor:s})}),i)});return!e||!n.menu||r.registerEvent(r.app.workspace.on("editor-menu",(a,s,l)=>{if(!l.file)return!1;let c=r.mediaNote.findMedia(l.file),u=r.leafOpener.detectActiveMediaLeaf(i.workspace.activeLeaf);if(!e(!0,u?.view,{isMediaNote:c,file:l.file,editor:s}))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:s})})})})),o}function d5(t,{onKeyDown:e,onTrigger:n,onKeyUp:r}){let i=null,o=new Set;return t.register(()=>{o.forEach(a=>{window.removeEventListener("keyup",a,{capture:!0})})}),t.registerDomEvent(window,"keydown",a=>{if(!i)return;let s=a.target;if(s.instanceOf(HTMLElement)&&s.matches("input.prompt-input"))return;let l=a;if(e(a,...i),r){let c=i,u=d=>{let p=Dne(l);(d.code===l.code&&p.every(f=>Xw.Keymap.isModifier(d,f))||p.some(f=>d.key===f))&&(r(d,...c),window.removeEventListener("keyup",u,{capture:!0}),o.delete(u))};o.add(u),window.addEventListener("keyup",u,{passive:!0,capture:!0})}i=null},!0),{callback:(...a)=>{i=a,setTimeout(()=>{i===null||(n?.(...a),i=null)},0)}}}function Dne(t){let e=[];return t.ctrlKey&&e.push("Ctrl"),t.altKey&&e.push("Alt"),t.shiftKey&&e.push("Shift"),t.metaKey&&e.push("Meta"),e}var Nne=t=>[{id:"toggle-play",label:"Play/pause",icon:"play",action:e=>{e.paused=!e.paused}},{id:"play",label:"Play",icon:"play",action:e=>{e.play()}},{id:"pause",label:"Pause",icon:"pause",action:e=>{e.pause()}},...[.5,1,2,5,10,30,60].flatMap(e=>[{id:`forward-${e}s`,label:`Forward ${e}s`,icon:"forward",action:n=>{n.currentTime+=e},repeat:!0},{id:`rewind-${e}s`,label:`Rewind ${e}s`,icon:"rewind",action:n=>{n.currentTime-=e},repeat:!0}]),{id:"toggle-mute",label:"Mute/unmute",icon:"volume-x",action:e=>{e.muted=!e.muted}},{id:"toggle-fullscreen",label:"Enter/exit fullscreen",icon:"expand",check:e=>e.state.canFullscreen,action:e=>{e.state.fullscreen?e.exitFullscreen():e.enterFullscreen()}},...Vne(t)];function Vne(t){let e=null,n=(0,Ou.debounce)(()=>e?.hide(),2e3,!0);function r(a){!e||e.noticeEl.isConnected===!1?e=new Ou.Notice(a,0):e.setMessage(a),n()}function i(a){!e||e.noticeEl.isConnected===!1?e=new Ou.Notice(a,0):e.setMessage(a)}function o(a){new Ou.Notice(a,2e3)}return[...$r.filter(a=>a>1).map(a=>{let s=!1,{callback:l}=d5(t,{onKeyDown(c,u){c.repeat&&!s&&(s=!0,u.playbackRate=a,i(`Fast forwarding at ${a}x`))},onKeyUp(c,u){s&&(u.playbackRate=1,e?.hide())}});return{id:`fast-forward-${a}x`,label:`Fast forward at ${a}x by holding hotkey`,icon:"forward",action:l,repeat:!0}}),...$r.map(a=>({id:`set-speed-${a}x`,label:`Set playback speed to ${a}x`,icon:"gauge",action:async s=>{s.playbackRate=a,r(`Speed set to ${a}x`)}})),{id:"reset-speed",label:"Reset playback speed",icon:"reset",check:a=>a.state.playbackRate!==1,action:a=>{a.playbackRate=1,o("Speed reset to 1x")}},{id:"increase-speed",label:"Increase playback speed",icon:"arrow-up",action:a=>{let s=a.playbackRate;if(s>=$r.last()){o("Cannot increase speed further");return}let l=$r.find(c=>c>s);a.playbackRate=l,r(`Speed increased to ${l}x`)}},{id:"decrease-speed",label:"Decrease playback speed",icon:"arrow-down",action:a=>{let s=a.playbackRate;if(s<=$r.first()){o("Cannot decrease speed further");return}let l=$r.slice().reverse().find(c=>c<s);a.playbackRate=l,r(`Speed decreased to ${l}x`)}},{id:"set-speed",label:"Set playback speed to custom value",icon:"gauge",action:async a=>{let s=await Ul.run();s&&(a.playbackRate=s,r(`Speed set to ${s}x`))}},{id:"increase-speed-granular",label:"Increase playback speed slightly",icon:"arrow-up",action:a=>{let s=a.playbackRate;if(s>=$r.last()){o("Cannot increase speed further");return}let l=t.settings.getState().speedStep,c=Math.round((s+l)*100)/100;a.playbackRate=c,r(`Speed increased to ${c}x`)}},{id:"decrease-speed-granular",label:"Decrease playback speed slightly",icon:"arrow-down",action:a=>{let s=a.playbackRate;if(s<=$r.first()){o("Cannot decrease speed further");return}let l=t.settings.getState().speedStep,c=Math.round((s-l)*100)/100;a.playbackRate=c,r(`Speed decreased to ${c}x`)}}]}function p5(t){Nne(t).forEach(({id:e,label:n,icon:r,action:i,repeat:o,check:a})=>{Xa({id:e,name:n,icon:r,repeatable:o,playerCheckCallback:(s,l)=>{if(!l)return!1;let c=l.player;if(!c||a&&!a(c))return!1;if(s)return!0;i(c)},noteCheckCallback(s,l){if(!l)return!1;let c=l.player;if(!c||a&&!a(c))return!1;if(s)return!0;if(c.el?.doc){let u=window.activeDocument;window.activeDocument=c.el.doc,i(c),window.activeDocument=u}else i(c)}},t)})}var Zw=require("obsidian");function f5(t){let e=null;Xa({id:"copy-screenshot",name:"Copy screenshot",icon:"focus",playerCheckCallback(r,i){if(r)return!0;let o=Px(i);o&&ih(o)},noteCheckCallback:n(r=>{let i=Px(r);i&&ih(i)}).noteCheckCallback},t),Xa({id:"take-timestamp",name:"Take timestamp",icon:"star",menu:!0,section:"selection-link",...n(async(r,i)=>{let o=e;e=i.file,await ah(r,i)&&i.from==="player"&&o!==i.file&&new Zw.Notice(`Timestamp taken in "${i.file.basename}"`)})},t),Xa({id:"save-screenshot",name:"Save screenshot",icon:"camera",section:"selection-link",menu:!0,...n(async(r,i)=>{let o=e;e=i.file,await rh(r,i)&&i.from==="player"&&o!==i.file&&new Zw.Notice(`Taking screenshot in "${i.file.basename}"`)})},t),Xa({id:"take-timestamp-media-note",name:"Take timestamp in media note",icon:"star",menu:!0,section:"selection-link",playerCheckCallback(r,i){let o=i.getMediaInfo();if(!o)return!1;if(r)return!0;t.mediaNote.getNote(o,i.player).then(a=>t.leafOpener.openNote(a)).then(a=>ah(i,a))}},t),Xa({id:"save-screenshot-media-note",name:"Save screenshot in media note",icon:"camera",section:"selection-link",menu:!0,playerCheckCallback(r,i){let o=i.getMediaInfo();if(!o)return!1;if(r)return!0;t.mediaNote.getNote(o,i.player).then(a=>t.leafOpener.openNote(a)).then(a=>rh(i,a))}},t);function n(r){return{playerCheckCallback:(i,o)=>{let a=zne(t.app);if(!a){if(i)return!1;new Zw.Notice("No active note can be edited");return}if(i)return!0;(async()=>{let s=window.activeDocument;window.activeDocument=a.containerEl.doc,await r(o,{file:a.view.file,editor:a.view.editor,from:"player"}),window.activeDocument=s})()},noteCheckCallback:(i,o,{isMediaNote:a,...s})=>{let l;if(o){if(i)return!0;t.app.workspace.revealLeaf(o.leaf),l=Promise.resolve(o)}else{if(!a)return!1;if(i)return!0;l=t.leafOpener.openMedia(a,void 0,{fromUser:!0}).then(c=>c.view)}l.then(async c=>{await r(c,{...s,from:"note"})})}}}}function zne(t){return t.workspace.getLeavesOfType("markdown").filter(n=>{let r=n.view;return r.file&&r.getMode()==="source"}).sort(Qw)[0]??null}function m5(){this.registerEvent(this.app.workspace.on("file-menu",(t,e,n,r)=>{if(!(e instanceof h5.TFile))return;let i=this.mediaNote.findMedia(e);i&&t.addItem(o=>o.setSection("view").setIcon("play").setTitle("Open linked media").onClick(()=>this.leafOpener.openMedia(i,void 0,{fromUser:!0})))})),f5(this),p5(this)}var Ki=require("obsidian");var Fu=require("obsidian");function Jw(t,e){if(Fu.Platform.isDesktopApp&&t.isFileUrl&&t.filePath){let n=t.filePath;e.addItem(r=>r.setIcon("folder").setTitle(Fu.Platform.isMacOS?"Reveal in Finder":"Show in system explorer").setSection("view").onClick(()=>{g5(n).catch(i=>{new Fu.Notice(`Failed to open file in file explorer: ${i.message}`),console.error("Failed to open file in file explorer",i)})})).addItem(r=>r.setIcon("arrow-up-right").setTitle("Open in default player").setSection("view").onClick(()=>{y5(n).catch(i=>{new Fu.Notice(`Failed to open file in system player: ${i.message}`),console.error("Failed to open file in system player",i)})}))}}var v5={"mx-embed":{label:"iframe",icon:"code"},"mx-url-audio":{label:"regular audio",icon:"headphones"},"mx-url-video":{label:"regular video",icon:"film"},"mx-webpage":{label:"webpage",icon:"globe"}};function TP(t,e,n=!1){let r=v5[e].label;return t.setTitle(n?r:`Open as ${r}`).setIcon(v5[e].icon)}function Lh(t,{mode:e,plugin:n,targetViewTypes:r,open:i=!0,url:o}){let{protocol:a,hostname:s,pathname:l,host:c,port:u}=o;r.length!==0&&(e==="once"&&r.forEach(d=>{if(!i)throw new Error("openAsMenu: cannot set 'open' to false in 'open once' mode");t.addItem(p=>TP(p,d).setSection("mx-link").onClick(async()=>{await n.leafOpener.openMedia(o,void 0,{viewType:d,fromUser:!0})}))}),e==="always"&&(t.addItem(d=>{let p=d.setTitle("Always open this url as").setIcon("external-link").setSection("mx-link").setSubmenu();r.forEach(f=>{p.addItem(h=>TP(h,f,!0).setSection("mx-link").onClick(async()=>{n.urlViewType.setPreferred({protocol:a,hostname:s,pathname:l,port:u},f),i&&await n.leafOpener.openMedia(o,void 0,{viewType:f,fromUser:!0})}))})}),s&&t.addItem(d=>{let p=d.setTitle(`Always open ${c} as`).setIcon("external-link").setSection("mx-link").setSubmenu();r.forEach(f=>{p.addItem(h=>TP(h,f,!0).setSection("mx-link").onClick(async()=>{n.urlViewType.setPreferred({protocol:a,hostname:s,port:u},f),i&&await n.leafOpener.openMedia(o,void 0,{viewType:f,fromUser:!0})}))})})))}function Du(t,e){return!!(t.type!=="generic"||t.inferredType||t.tempFrag||e.mediaNote.findNote(t)||e.urlViewType.getPreferred(t,!0))}var SP=async function(t,e,n){let r=this.resolveUrl(t);if(Se(r)){new Ki.Notice("For in-vault media, use internal link instead"),n();return}if(!r||!Du(r,this)){n();return}await this.leafOpener.openMedia(r,e,{fromUser:!0})};async function g5(t){if(!Ki.Platform.isDesktopApp)return;let e=window.electron;if(!e)return;await(Ki.Platform.isMacOS?e.remote.shell:e.shell).showItemInFolder(t)}async function y5(t){if(!Ki.Platform.isDesktopApp)return;let e=window.electron;if(!e)return;let r=await(Ki.Platform.isMacOS?e.remote.shell:e.shell).openPath(t);if(r)throw new Error(r)}function x5(t){t.registerEvent(t.app.workspace.on("url-menu",(e,n)=>{let r=t.resolveUrl(n);if(!r)return;if(Se(r)){new Ki.Notice("For in-vault media, use internal link instead");return}Jw(r,e);let i=t.urlViewType.getSupported(r),o=t.urlViewType.getPreferred(r),a=Du(r,t)?i.filter(s=>s!==o):i;Lh(e,{targetViewTypes:a,url:r,mode:"once",plugin:t}),Lh(e,{targetViewTypes:a,url:r,mode:"always",plugin:t})}))}var w5=async function(t,e,n,r){let{metadataCache:i}=this.app,{path:o,subpath:a}=(0,Ki.parseLinktext)(t),s=i.getFirstLinkpathDest(o,e),l;if(!s||!(l=Ft(s.extension))){r();return}let c={file:s,hash:a,type:l,viewType:Vn[l]};await this.leafOpener.openMedia(c,n,{fromUser:!0})};var yl=require("obsidian");var b5=require("url"),Nu=require("obsidian");function EP(t,e){let n=`#EXTM3U
|
|
`,r=[],i=!1;for(let o of t.list)if(o.media instanceof xt)n+=`#EXTINF:-1,${o.title}
|
|
${o.media.href}
|
|
`;else if(Se(o.media))if(e.adapter instanceof Nu.FileSystemAdapter){let a=e.adapter.getFullPath(o.media.file.path);try{let s=(0,b5.pathToFileURL)(a).href;n+=`#EXTINF:-1,${o.title}
|
|
${s}
|
|
`}catch(s){new Nu.Notice(`Failed to convert file path to URL: ${s}`),r.push(o.title||Ct(o.media))}}else i=!0,r.push(o.title||Ct(o.media));r.length>0&&(i?new Nu.Notice(createFragment(o=>{o.createDiv({text:"File URI is not supported in this environment. "}),o.createDiv({text:`Skipped items: ${r.join(", ")}`})})):new Nu.Notice(`Skipped items: ${r.join(", ")}`)),Une(n,t.title)}function Une(t,e){let n=new Blob([t],{type:"application/vnd.apple.mpegurl"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${e}.m3u8`,document.body.appendChild(r),r.click(),document.body.removeChild(r)}var t6=require("obsidian");function PP(t,e){let n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}var zt=Za(/[A-Za-z]/),Ut=Za(/[\dA-Za-z]/),_5=Za(/[#-'*+\--9=?A-Z^-~]/);function ul(t){return t!==null&&(t<32||t===127)}var Ah=Za(/\d/),k5=Za(/[\dA-Fa-f]/),T5=Za(/[!-/:-@[-`{-~]/);function q(t){return t!==null&&t<-2}function Te(t){return t!==null&&(t<0||t===32)}function re(t){return t===-2||t===-1||t===32}var dl=Za(/\p{P}|\p{S}/u),Gi=Za(/\s/);function Za(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function CP(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Ja=function(t){if(t==null)return Wne;if(typeof t=="function")return eb(t);if(typeof t=="object")return Array.isArray(t)?Bne(t):jne(t);if(typeof t=="string")return Hne(t);throw new Error("Expected function, string, or object as test")};function Bne(t){let e=[],n=-1;for(;++n<t.length;)e[n]=Ja(t[n]);return eb(r);function r(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function jne(t){let e=t;return eb(n);function n(r){let i=r,o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function Hne(t){return eb(e);function e(n){return n&&n.type===t}}function eb(t){return e;function e(n,r,i){return!!(qne(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Wne(){return!0}function qne(t){return t!==null&&typeof t=="object"&&"type"in t}var S5=[],tb=!0,Yi=!1,nb="skip";function Oh(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;let o=Ja(i),a=r?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=S5,h,g,x;if((!e||o(l,c,u[u.length-1]||void 0))&&(f=Kne(n(l,u)),f[0]===Yi))return f;if("children"in l&&l.children){let m=l;if(m.children&&f[0]!==nb)for(g=(r?m.children.length:-1)+a,x=u.concat(m);g>-1&&g<m.children.length;){let y=m.children[g];if(h=s(y,g,x)(),h[0]===Yi)return h;g=typeof h[1]=="number"?h[1]:g+a}}return f}}}function Kne(t){return Array.isArray(t)?t:typeof t=="number"?[tb,t]:t==null?S5:[t]}function MP(t,e,n){let i=Ja((n||{}).ignore||[]),o=Gne(e),a=-1;for(;++a<o.length;)Oh(t,"text",s);function s(c,u){let d=-1,p;for(;++d<u.length;){let f=u[d],h=p?p.children:void 0;if(i(f,h?h.indexOf(f):void 0,p))return;p=f}if(p)return l(c,u)}function l(c,u){let d=u[u.length-1],p=o[a][0],f=o[a][1],h=0,x=d.children.indexOf(c),m=!1,y=[];p.lastIndex=0;let v=p.exec(c.value);for(;v;){let w=v.index,k={index:v.index,input:v.input,stack:[...u,c]},b=f(...v,k);if(typeof b=="string"&&(b=b.length>0?{type:"text",value:b}:void 0),b===!1?p.lastIndex=w+1:(h!==w&&y.push({type:"text",value:c.value.slice(h,w)}),Array.isArray(b)?y.push(...b):b&&y.push(b),h=w+v[0].length,m=!0),!p.global)break;v=p.exec(c.value)}return m?(h<c.value.length&&y.push({type:"text",value:c.value.slice(h)}),d.children.splice(x,1,...y)):y=[c],x+y.length}}function Gne(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let n=!t[0]||Array.isArray(t[0])?t:[t],r=-1;for(;++r<n.length;){let i=n[r];e.push([Yne(i[0]),Qne(i[1])])}return e}function Yne(t){return typeof t=="string"?new RegExp(CP(t),"g"):t}function Qne(t){return typeof t=="function"?t:function(){return t}}var RP="phrasing",$P=["autolink","link","image","label"];function LP(){return{transforms:[nre],enter:{literalAutolink:Xne,literalAutolinkEmail:IP,literalAutolinkHttp:IP,literalAutolinkWww:IP},exit:{literalAutolink:tre,literalAutolinkEmail:ere,literalAutolinkHttp:Zne,literalAutolinkWww:Jne}}}function AP(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:RP,notInConstruct:$P},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:RP,notInConstruct:$P},{character:":",before:"[ps]",after:"\\/",inConstruct:RP,notInConstruct:$P}]}}function Xne(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function IP(t){this.config.enter.autolinkProtocol.call(this,t)}function Zne(t){this.config.exit.autolinkProtocol.call(this,t)}function Jne(t){this.config.exit.data.call(this,t);let e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function ere(t){this.config.exit.autolinkEmail.call(this,t)}function tre(t){this.exit(t)}function nre(t){MP(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,rre],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,ire]],{ignore:["link","linkReference"]})}function rre(t,e,n,r,i){let o="";if(!E5(i)||(/^w/i.test(e)&&(n=e+n,e="",o="http://"),!ore(n)))return!1;let a=are(n+r);if(!a[0])return!1;let s={type:"link",title:null,url:o+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function ire(t,e,n,r){return!E5(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function ore(t){let e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function are(t){let e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")"),i=PP(t,"("),o=PP(t,")");for(;r!==-1&&i>o;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[t,n]}function E5(t,e){let n=t.input.charCodeAt(t.index-1);return(t.index===0||Gi(n)||dl(n))&&(!e||n!==47)}function wn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}P5.peek=mre;function OP(){return{enter:{gfmFootnoteDefinition:sre,gfmFootnoteDefinitionLabelString:lre,gfmFootnoteCall:dre,gfmFootnoteCallString:pre},exit:{gfmFootnoteDefinition:ure,gfmFootnoteDefinitionLabelString:cre,gfmFootnoteCall:hre,gfmFootnoteCallString:fre}}}function FP(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:gre,footnoteReference:P5}}}function sre(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function lre(){this.buffer()}function cre(t){let e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=e,n.identifier=wn(this.sliceSerialize(t)).toLowerCase()}function ure(t){this.exit(t)}function dre(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function pre(){this.buffer()}function fre(t){let e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=e,n.identifier=wn(this.sliceSerialize(t)).toLowerCase()}function hre(t){this.exit(t)}function P5(t,e,n,r){let i=n.createTracker(r),o=i.move("[^"),a=n.enter("footnoteReference"),s=n.enter("reference");return o+=i.move(n.safe(n.associationId(t),{...i.current(),before:o,after:"]"})),s(),a(),o+=i.move("]"),o}function mre(){return"["}function gre(t,e,n,r){let i=n.createTracker(r),o=i.move("[^"),a=n.enter("footnoteDefinition"),s=n.enter("label");return o+=i.move(n.safe(n.associationId(t),{...i.current(),before:o,after:"]"})),s(),o+=i.move("]:"+(t.children&&t.children.length>0?" ":"")),i.shift(4),o+=i.move(n.indentLines(n.containerFlow(t,i.current()),yre)),a(),o}function yre(t,e,n){return e===0?t:(n?"":" ")+t}var vre=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];C5.peek=bre;function DP(){return{canContainEols:["delete"],enter:{strikethrough:xre},exit:{strikethrough:wre}}}function NP(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:vre}],handlers:{delete:C5}}}function xre(t){this.enter({type:"delete",children:[]},t)}function wre(t){this.exit(t)}function C5(t,e,n,r){let i=n.createTracker(r),o=n.enter("strikethrough"),a=i.move("~~");return a+=n.containerPhrasing(t,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function bre(){return"~"}function R5(t,e={}){let n=(e.align||[]).concat(),r=e.stringLength||kre,i=[],o=[],a=[],s=[],l=0,c=-1;for(;++c<t.length;){let h=[],g=[],x=-1;for(t[c].length>l&&(l=t[c].length);++x<t[c].length;){let m=_re(t[c][x]);if(e.alignDelimiters!==!1){let y=r(m);g[x]=y,(s[x]===void 0||y>s[x])&&(s[x]=y)}h.push(m)}o[c]=h,a[c]=g}let u=-1;if(typeof n=="object"&&"length"in n)for(;++u<l;)i[u]=M5(n[u]);else{let h=M5(n);for(;++u<l;)i[u]=h}u=-1;let d=[],p=[];for(;++u<l;){let h=i[u],g="",x="";h===99?(g=":",x=":"):h===108?g=":":h===114&&(x=":");let m=e.alignDelimiters===!1?1:Math.max(1,s[u]-g.length-x.length),y=g+"-".repeat(m)+x;e.alignDelimiters!==!1&&(m=g.length+m+x.length,m>s[u]&&(s[u]=m),p[u]=m),d[u]=y}o.splice(1,0,d),a.splice(1,0,p),c=-1;let f=[];for(;++c<o.length;){let h=o[c],g=a[c];u=-1;let x=[];for(;++u<l;){let m=h[u]||"",y="",v="";if(e.alignDelimiters!==!1){let w=s[u]-(g[u]||0),k=i[u];k===114?y=" ".repeat(w):k===99?w%2?(y=" ".repeat(w/2+.5),v=" ".repeat(w/2-.5)):(y=" ".repeat(w/2),v=y):v=" ".repeat(w)}e.delimiterStart!==!1&&!u&&x.push("|"),e.padding!==!1&&!(e.alignDelimiters===!1&&m==="")&&(e.delimiterStart!==!1||u)&&x.push(" "),e.alignDelimiters!==!1&&x.push(y),x.push(m),e.alignDelimiters!==!1&&x.push(v),e.padding!==!1&&x.push(" "),(e.delimiterEnd!==!1||u!==l-1)&&x.push("|")}f.push(e.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return f.join(`
|
|
`)}function _re(t){return t==null?"":String(t)}function kre(t){return t.length}function M5(t){let e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function $5(t,e,n,r){let i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);let a=n.indentLines(n.containerFlow(t,o.current()),Tre);return i(),a}function Tre(t,e,n){return">"+(n?"":" ")+t}function L5(t,e){return I5(t,e.inConstruct,!0)&&!I5(t,e.notInConstruct,!1)}function I5(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function VP(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
`&&L5(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
`}function A5(t,e){let n=String(t),r=n.indexOf(e),i=r,o=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+e.length,r=n.indexOf(e,i);return a}function O5(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function F5(t){let e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function D5(t,e,n,r){let i=F5(n),o=t.value||"",a=i==="`"?"GraveAccent":"Tilde";if(O5(t,n)){let d=n.enter("codeIndented"),p=n.indentLines(o,Sre);return d(),p}let s=n.createTracker(r),l=i.repeat(Math.max(A5(o,i)+1,3)),c=n.enter("codeFenced"),u=s.move(l);if(t.lang){let d=n.enter(`codeFencedLang${a}`);u+=s.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...s.current()})),d()}if(t.lang&&t.meta){let d=n.enter(`codeFencedMeta${a}`);u+=s.move(" "),u+=s.move(n.safe(t.meta,{before:u,after:`
|
|
`,encode:["`"],...s.current()})),d()}return u+=s.move(`
|
|
`),o&&(u+=s.move(o+`
|
|
`)),u+=s.move(l),c(),u}function Sre(t,e,n){return(n?"":" ")+t}function Vu(t){let e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function N5(t,e,n,r){let i=Vu(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition"),s=n.enter("label"),l=n.createTracker(r),c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),s(),!t.url||/[\0- \u007F]/.test(t.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
|
|
`,...l.current()}))),s(),t.title&&(s=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),s()),a(),c}function V5(t){let e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}zP.peek=Ere;function zP(t,e,n,r){let i=V5(n),o=n.enter("emphasis"),a=n.createTracker(r),s=a.move(i);return s+=a.move(n.containerPhrasing(t,{before:s,after:i,...a.current()})),s+=a.move(i),o(),s}function Ere(t,e,n){return n.options.emphasis||"*"}function zu(t,e,n,r){let i,o,a;typeof e=="function"&&typeof n!="function"?(o=void 0,a=e,i=n):(o=e,a=n,i=r),Oh(t,o,s,i);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return a(l,d,u)}}var Pre={};function pl(t,e){let n=e||Pre,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return U5(t,r,i)}function U5(t,e,n){if(Cre(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return z5(t.children,e,n)}return Array.isArray(t)?z5(t,e,n):""}function z5(t,e,n){let r=[],i=-1;for(;++i<t.length;)r[i]=U5(t[i],e,n);return r.join("")}function Cre(t){return!!(t&&typeof t=="object")}function B5(t,e){let n=!1;return zu(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Yi}),!!((!t.depth||t.depth<3)&&pl(t)&&(e.options.setext||n))}function j5(t,e,n,r){let i=Math.max(Math.min(6,t.depth||1),1),o=n.createTracker(r);if(B5(t,n)){let u=n.enter("headingSetext"),d=n.enter("phrasing"),p=n.containerPhrasing(t,{...o.current(),before:`
|
|
`,after:`
|
|
`});return d(),u(),p+`
|
|
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
`))+1))}let a="#".repeat(i),s=n.enter("headingAtx"),l=n.enter("phrasing");o.move(a+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
|
|
`,...o.current()});return/^[\t ]/.test(c)&&(c="&#x"+c.charCodeAt(0).toString(16).toUpperCase()+";"+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),s(),c}UP.peek=Mre;function UP(t){return t.value||""}function Mre(){return"<"}BP.peek=Rre;function BP(t,e,n,r){let i=Vu(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image"),s=n.enter("label"),l=n.createTracker(r),c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),s(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),s(),t.title&&(s=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),s()),c+=l.move(")"),a(),c}function Rre(){return"!"}jP.peek=$re;function jP(t,e,n,r){let i=t.referenceType,o=n.enter("imageReference"),a=n.enter("label"),s=n.createTracker(r),l=s.move("!["),c=n.safe(t.alt,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();let u=n.stack;n.stack=[],a=n.enter("reference");let d=n.safe(n.associationId(t),{before:l,after:"]",...s.current()});return a(),n.stack=u,o(),i==="full"||!c||c!==d?l+=s.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function $re(){return"!"}HP.peek=Ire;function HP(t,e,n){let r=t.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let a=n.unsafe[o],s=n.compilePattern(a),l;if(a.atBreak)for(;l=s.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function Ire(){return"`"}function WP(t,e){let n=pl(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}qP.peek=Lre;function qP(t,e,n,r){let i=Vu(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r),s,l;if(WP(t,n)){let u=n.stack;n.stack=[],s=n.enter("autolink");let d=a.move("<");return d+=a.move(n.containerPhrasing(t,{before:d,after:">",...a.current()})),d+=a.move(">"),s(),n.stack=u,d}s=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(t,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(t.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(t.url,{before:c,after:t.title?" ":")",...a.current()}))),l(),t.title&&(l=n.enter(`title${o}`),c+=a.move(" "+i),c+=a.move(n.safe(t.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),s(),c}function Lre(t,e,n){return WP(t,n)?"<":"["}KP.peek=Are;function KP(t,e,n,r){let i=t.referenceType,o=n.enter("linkReference"),a=n.enter("label"),s=n.createTracker(r),l=s.move("["),c=n.containerPhrasing(t,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();let u=n.stack;n.stack=[],a=n.enter("reference");let d=n.safe(n.associationId(t),{before:l,after:"]",...s.current()});return a(),n.stack=u,o(),i==="full"||!c||c!==d?l+=s.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function Are(){return"["}function Uu(t){let e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function H5(t){let e=Uu(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function W5(t){let e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function rb(t){let e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function q5(t,e,n,r){let i=n.enter("list"),o=n.bulletCurrent,a=t.ordered?W5(n):Uu(n),s=t.ordered?a==="."?")":".":H5(n),l=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){let u=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),rb(n)===a&&u){let d=-1;for(;++d<t.children.length;){let p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=s),n.bulletCurrent=a;let c=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),c}function K5(t){let e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function G5(t,e,n,r){let i=K5(n),o=n.bulletCurrent||Uu(n);e&&e.type==="list"&&e.ordered&&(o=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);let s=n.createTracker(r);s.move(o+" ".repeat(a-o.length)),s.shift(a);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,s.current()),u);return l(),c;function u(d,p,f){return p?(f?"":" ".repeat(a))+d:(f?o:o+" ".repeat(a-o.length))+d}}function Y5(t,e,n,r){let i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(t,r);return o(),i(),a}var GP=Ja(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Q5(t,e,n,r){return(t.children.some(function(a){return GP(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function X5(t){let e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}YP.peek=Ore;function YP(t,e,n,r){let i=X5(n),o=n.enter("strong"),a=n.createTracker(r),s=a.move(i+i);return s+=a.move(n.containerPhrasing(t,{before:s,after:i,...a.current()})),s+=a.move(i+i),o(),s}function Ore(t,e,n){return n.options.strong||"*"}function Z5(t,e,n,r){return n.safe(t.value,r)}function J5(t){let e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function e4(t,e,n){let r=(rb(n)+(n.options.ruleSpaces?" ":"")).repeat(J5(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Fh={blockquote:$5,break:VP,code:D5,definition:N5,emphasis:zP,hardBreak:VP,heading:j5,html:UP,image:BP,imageReference:jP,inlineCode:HP,link:qP,linkReference:KP,list:q5,listItem:G5,paragraph:Y5,root:Q5,strong:YP,text:Z5,thematicBreak:e4};var t4=document.createElement("i");function Bu(t){let e="&"+t+";";t4.innerHTML=e;let n=t4.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function ib(t,e){let n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}var Fre=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function n4(t){return t.replace(Fre,Dre)}function Dre(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){let i=n.charCodeAt(1),o=i===120||i===88;return ib(n.slice(o?2:1),o?16:10)}return Bu(n)||t}function XP(){return{enter:{table:Nre,tableData:r4,tableHeader:r4,tableRow:zre},exit:{codeText:Ure,table:Vre,tableData:QP,tableHeader:QP,tableRow:QP}}}function Nre(t){let e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Vre(t){this.exit(t),this.data.inTable=void 0}function zre(t){this.enter({type:"tableRow",children:[]},t)}function QP(t){this.exit(t)}function r4(t){this.enter({type:"tableCell",children:[]},t)}function Ure(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Bre));let n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Bre(t,e){return e==="|"?e:t}function ZP(t){let e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:a,tableCell:l,tableRow:s}};function a(f,h,g,x){return c(u(f,g,x),f.align)}function s(f,h,g,x){let m=d(f,g,x),y=c([m]);return y.slice(0,y.indexOf(`
|
|
`))}function l(f,h,g,x){let m=g.enter("tableCell"),y=g.enter("phrasing"),v=g.containerPhrasing(f,{...x,before:o,after:o});return y(),m(),v}function c(f,h){return R5(f,{align:h,alignDelimiters:r,padding:n,stringLength:i})}function u(f,h,g){let x=f.children,m=-1,y=[],v=h.enter("table");for(;++m<x.length;)y[m]=d(x[m],h,g);return v(),y}function d(f,h,g){let x=f.children,m=-1,y=[],v=h.enter("tableRow");for(;++m<x.length;)y[m]=l(x[m],f,h,g);return v(),y}function p(f,h,g){let x=Fh.inlineCode(f,h,g);return g.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function JP(){return{exit:{taskListCheckValueChecked:i4,taskListCheckValueUnchecked:i4,paragraph:jre}}}function e1(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Hre}}}function i4(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function jre(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let n=this.stack[this.stack.length-1];n.type;let r=n.children[0];if(r&&r.type==="text"){let i=e.children,o=-1,a;for(;++o<i.length;){let s=i[o];if(s.type==="paragraph"){a=s;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Hre(t,e,n,r){let i=t.children[0],o=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",s=n.createTracker(r);o&&s.move(a);let l=Fh.listItem(t,e,n,{...r,...s.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+a}}function t1(){return[LP(),OP(),DP(),XP(),JP()]}function n1(t){return{extensions:[AP(),FP(),NP(),ZP(t),e1()]}}function kt(t,e,n,r){let i=t.length,o=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(e,0),t.splice(...a),o+=1e4,e+=1e4}function Fn(t,e){return t.length>0?(kt(t,t.length,0,e),t):e}var o4={}.hasOwnProperty;function ob(t){let e={},n=-1;for(;++n<t.length;)Wre(e,t[n]);return e}function Wre(t,e){let n;for(n in e){let i=(o4.call(t,n)?t[n]:void 0)||(t[n]={}),o=e[n],a;if(o)for(a in o){o4.call(i,a)||(i[a]=[]);let s=o[a];qre(i[a],Array.isArray(s)?s:s?[s]:[])}}}function qre(t,e){let n=-1,r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);kt(t,0,0,r)}var Kre={tokenize:Zre,partial:!0},a4={tokenize:Jre,partial:!0},s4={tokenize:eie,partial:!0},l4={tokenize:tie,partial:!0},Gre={tokenize:nie,partial:!0},c4={tokenize:Qre,previous:d4},u4={tokenize:Xre,previous:p4},zo={tokenize:Yre,previous:f4},Qi={};function i1(){return{text:Qi}}var fl=48;for(;fl<123;)Qi[fl]=zo,fl++,fl===58?fl=65:fl===91&&(fl=97);Qi[43]=zo;Qi[45]=zo;Qi[46]=zo;Qi[95]=zo;Qi[72]=[zo,u4];Qi[104]=[zo,u4];Qi[87]=[zo,c4];Qi[119]=[zo,c4];function Yre(t,e,n){let r=this,i,o;return a;function a(d){return!r1(d)||!f4.call(r,r.previous)||o1(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),s(d))}function s(d){return r1(d)?(t.consume(d),s):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(Gre,u,c)(d):d===45||d===95||Ut(d)?(o=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return o&&i&&zt(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function Qre(t,e,n){let r=this;return i;function i(a){return a!==87&&a!==119||!d4.call(r,r.previous)||o1(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Kre,t.attempt(a4,t.attempt(s4,o),n),n)(a))}function o(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function Xre(t,e,n){let r=this,i="",o=!1;return a;function a(d){return(d===72||d===104)&&p4.call(r,r.previous)&&!o1(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),s):n(d)}function s(d){if(zt(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),s;if(d===58){let p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),o?c:(o=!0,l)):n(d)}function c(d){return d===null||ul(d)||Te(d)||Gi(d)||dl(d)?n(d):t.attempt(a4,t.attempt(s4,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function Zre(t,e,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),i):a===46&&r===3?(t.consume(a),o):n(a)}function o(a){return a===null?n(a):e(a)}}function Jre(t,e,n){let r,i,o;return a;function a(c){return c===46||c===95?t.check(l4,l,s)(c):c===null||Te(c)||Gi(c)||c!==45&&dl(c)?l(c):(o=!0,t.consume(c),a)}function s(c){return c===95?r=!0:(i=r,r=void 0),t.consume(c),a}function l(c){return i||r||!o?n(c):e(c)}}function eie(t,e){let n=0,r=0;return i;function i(a){return a===40?(n++,t.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(l4,e,o)(a):a===null||Te(a)||Gi(a)?e(a):(t.consume(a),i)}function o(a){return a===41&&r++,t.consume(a),i}}function tie(t,e,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(t.consume(s),r):s===38?(t.consume(s),o):s===93?(t.consume(s),i):s===60||s===null||Te(s)||Gi(s)?e(s):n(s)}function i(s){return s===null||s===40||s===91||Te(s)||Gi(s)?e(s):r(s)}function o(s){return zt(s)?a(s):n(s)}function a(s){return s===59?(t.consume(s),r):zt(s)?(t.consume(s),a):n(s)}}function nie(t,e,n){return r;function r(o){return t.consume(o),i}function i(o){return Ut(o)?n(o):e(o)}}function d4(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Te(t)}function p4(t){return!zt(t)}function f4(t){return!(t===47||r1(t))}function r1(t){return t===43||t===45||t===46||t===95||Ut(t)}function o1(t){let e=t.length,n=!1;for(;e--;){let r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function ju(t){if(t===null||Te(t)||Gi(t))return 1;if(dl(t))return 2}function es(t,e,n){let r=[],i=-1;for(;++i<t.length;){let o=t[i].resolveAll;o&&!r.includes(o)&&(e=o(e,n),r.push(o))}return e}var Dh={name:"attention",tokenize:iie,resolveAll:rie};function rie(t,e){let n=-1,r,i,o,a,s,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;let d=Object.assign({},t[r][1].end),p=Object.assign({},t[n][1].start);h4(d,-l),h4(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[r][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[n][1].start),end:p},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[r][1].end),end:Object.assign({},t[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},a.start),end:Object.assign({},s.end)},t[r][1].end=Object.assign({},a.start),t[n][1].start=Object.assign({},s.end),c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Fn(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Fn(c,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),c=Fn(c,es(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Fn(c,[["exit",o,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=Fn(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,kt(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function iie(t,e){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ju(r),o;return a;function a(l){return o=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===o)return t.consume(l),s;let c=t.exit("attentionSequence"),u=ju(l),d=!u||u===2&&i||n.includes(l),p=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?d:d&&(i||!p)),c._close=!!(o===42?p:p&&(u||!d)),e(l)}}function h4(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var a1={name:"autolink",tokenize:oie};function oie(t,e,n){let r=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),o}function o(f){return zt(f)?(t.consume(f),a):c(f)}function a(f){return f===43||f===45||f===46||Ut(f)?(r=1,s(f)):c(f)}function s(f){return f===58?(t.consume(f),r=0,l):(f===43||f===45||f===46||Ut(f))&&r++<32?(t.consume(f),s):(r=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||ul(f)?n(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):_5(f)?(t.consume(f),c):n(f)}function u(f){return Ut(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),r=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):p(f)}function p(f){if((f===45||Ut(f))&&r++<63){let h=f===45?p:d;return t.consume(f),h}return n(f)}}function te(t,e,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,o=0;return a;function a(l){return re(l)?(t.enter(n),s(l)):e(l)}function s(l){return re(l)&&o++<i?(t.consume(l),s):(t.exit(n),e(l))}}var Xi={tokenize:aie,partial:!0};function aie(t,e,n){return r;function r(o){return re(o)?te(t,i,"linePrefix")(o):i(o)}function i(o){return o===null||q(o)?e(o):n(o)}}var ab={name:"blockQuote",tokenize:sie,continuation:{tokenize:lie},exit:cie};function sie(t,e,n){let r=this;return i;function i(a){if(a===62){let s=r.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),o}return n(a)}function o(a){return re(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function lie(t,e,n){let r=this;return i;function i(a){return re(a)?te(t,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return t.attempt(ab,e,n)(a)}}function cie(t){t.exit("blockQuote")}var sb={name:"characterEscape",tokenize:uie};function uie(t,e,n){return r;function r(o){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(o),t.exit("escapeMarker"),i}function i(o){return T5(o)?(t.enter("characterEscapeValue"),t.consume(o),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(o)}}var lb={name:"characterReference",tokenize:die};function die(t,e,n){let r=this,i=0,o,a;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),o=31,a=Ut,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),o=6,a=k5,u):(t.enter("characterReferenceValue"),o=7,a=Ah,u(d))}function u(d){if(d===59&&i){let p=t.exit("characterReferenceValue");return a===Ut&&!Bu(r.sliceSerialize(p))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(d)&&i++<o?(t.consume(d),u):n(d)}}var m4={tokenize:fie,partial:!0},cb={name:"codeFenced",tokenize:pie,concrete:!0};function pie(t,e,n){let r=this,i={tokenize:k,partial:!0},o=0,a=0,s;return l;function l(b){return c(b)}function c(b){let S=r.events[r.events.length-1];return o=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,s=b,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(b)}function u(b){return b===s?(a++,t.consume(b),u):a<3?n(b):(t.exit("codeFencedFenceSequence"),re(b)?te(t,d,"whitespace")(b):d(b))}function d(b){return b===null||q(b)?(t.exit("codeFencedFence"),r.interrupt?e(b):t.check(m4,g,w)(b)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===null||q(b)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(b)):re(b)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),te(t,f,"whitespace")(b)):b===96&&b===s?n(b):(t.consume(b),p)}function f(b){return b===null||q(b)?d(b):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===null||q(b)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(b)):b===96&&b===s?n(b):(t.consume(b),h)}function g(b){return t.attempt(i,w,x)(b)}function x(b){return t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),m}function m(b){return o>0&&re(b)?te(t,y,"linePrefix",o+1)(b):y(b)}function y(b){return b===null||q(b)?t.check(m4,g,w)(b):(t.enter("codeFlowValue"),v(b))}function v(b){return b===null||q(b)?(t.exit("codeFlowValue"),y(b)):(t.consume(b),v)}function w(b){return t.exit("codeFenced"),e(b)}function k(b,S,C){let R=0;return _;function _(j){return b.enter("lineEnding"),b.consume(j),b.exit("lineEnding"),D}function D(j){return b.enter("codeFencedFence"),re(j)?te(b,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):I(j)}function I(j){return j===s?(b.enter("codeFencedFenceSequence"),N(j)):C(j)}function N(j){return j===s?(R++,b.consume(j),N):R>=a?(b.exit("codeFencedFenceSequence"),re(j)?te(b,O,"whitespace")(j):O(j)):C(j)}function O(j){return j===null||q(j)?(b.exit("codeFencedFence"),S(j)):C(j)}}}function fie(t,e,n){let r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}var Nh={name:"codeIndented",tokenize:mie},hie={tokenize:gie,partial:!0};function mie(t,e,n){let r=this;return i;function i(c){return t.enter("codeIndented"),te(t,o,"linePrefix",5)(c)}function o(c){let u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):q(c)?t.attempt(hie,a,l)(c):(t.enter("codeFlowValue"),s(c))}function s(c){return c===null||q(c)?(t.exit("codeFlowValue"),a(c)):(t.consume(c),s)}function l(c){return t.exit("codeIndented"),e(c)}}function gie(t,e,n){let r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):q(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):te(t,o,"linePrefix",5)(a)}function o(a){let s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):q(a)?i(a):n(a)}}var s1={name:"codeText",tokenize:xie,resolve:yie,previous:vie};function yie(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function vie(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xie(t,e,n){let r=this,i=0,o,a;return s;function s(p){return t.enter("codeText"),t.enter("codeTextSequence"),l(p)}function l(p){return p===96?(t.consume(p),i++,l):(t.exit("codeTextSequence"),c(p))}function c(p){return p===null?n(p):p===32?(t.enter("space"),t.consume(p),t.exit("space"),c):p===96?(a=t.enter("codeTextSequence"),o=0,d(p)):q(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(p))}function u(p){return p===null||p===32||p===96||q(p)?(t.exit("codeTextData"),c(p)):(t.consume(p),u)}function d(p){return p===96?(t.consume(p),o++,d):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(p)):(a.type="codeTextData",u(p))}}function ub(t){let e={},n=-1,r,i,o,a,s,l,c;for(;++n<t.length;){for(;n in e;)n=e[n];if(r=t[n],n&&r[1].type==="chunkFlow"&&t[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,wie(t,n)),n=e[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--&&(a=t[o],a[1].type==="lineEnding"||a[1].type==="lineEndingBlank");)a[0]==="enter"&&(i&&(t[i][1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);i&&(r[1].end=Object.assign({},t[i][1].start),s=t.slice(i,n),s.unshift(r),kt(t,i,n-i+1,s))}}return!c}function wie(t,e){let n=t[e][1],r=t[e][2],i=e-1,o=[],a=n._tokenizer||r.parser[n.contentType](n.start),s=a.events,l=[],c={},u,d,p=-1,f=n,h=0,g=0,x=[g];for(;f;){for(;t[++i][1]!==f;);o.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),d&&a.defineSkip(f.start),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++p<s.length;)s[p][0]==="exit"&&s[p-1][0]==="enter"&&s[p][1].type===s[p-1][1].type&&s[p][1].start.line!==s[p][1].end.line&&(g=p+1,x.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(a.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),p=x.length;p--;){let m=s.slice(x[p],x[p+1]),y=o.pop();l.unshift([y,y+m.length-1]),kt(t,y,2,m)}for(p=-1;++p<l.length;)c[h+l[p][0]]=h+l[p][1],h+=l[p][1]-l[p][0]-1;return c}var l1={tokenize:kie,resolve:_ie},bie={tokenize:Tie,partial:!0};function _ie(t){return ub(t),t}function kie(t,e){let n;return r;function r(s){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):q(s)?t.check(bie,a,o)(s):(t.consume(s),i)}function o(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function a(s){return t.consume(s),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Tie(t,e,n){let r=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),te(t,o,"linePrefix")}function o(a){if(a===null||q(a))return n(a);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function db(t,e,n,r,i,o,a,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(m){return m===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(m),t.exit(o),p):m===null||m===32||m===41||ul(m)?n(m):(t.enter(r),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),g(m))}function p(m){return m===62?(t.enter(o),t.consume(m),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(s),p(m)):m===null||m===60||q(m)?n(m):(t.consume(m),m===92?h:f)}function h(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function g(m){return!u&&(m===null||m===41||Te(m))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(m)):u<c&&m===40?(t.consume(m),u++,g):m===41?(t.consume(m),u--,g):m===null||m===32||m===40||ul(m)?n(m):(t.consume(m),m===92?x:g)}function x(m){return m===40||m===41||m===92?(t.consume(m),g):g(m)}}function pb(t,e,n,r,i,o){let a=this,s=0,l;return c;function c(f){return t.enter(r),t.enter(i),t.consume(f),t.exit(i),t.enter(o),u}function u(f){return s>999||f===null||f===91||f===93&&!l||f===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(t.exit(o),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):q(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||q(f)||s++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!re(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),s++,d):d(f)}}function fb(t,e,n,r,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),c(p))}function c(p){return p===a?(t.exit(o),l(a)):p===null?n(p):q(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),te(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===a||p===null||q(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?d:u)}function d(p){return p===a||p===92?(t.consume(p),u):u(p)}}function hl(t,e){let n;return r;function r(i){return q(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):re(i)?te(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}var c1={name:"definition",tokenize:Eie},Sie={tokenize:Pie,partial:!0};function Eie(t,e,n){let r=this,i;return o;function o(f){return t.enter("definition"),a(f)}function a(f){return pb.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function s(f){return i=wn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return Te(f)?hl(t,c)(f):c(f)}function c(f){return db(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(Sie,d,d)(f)}function d(f){return re(f)?te(t,p,"whitespace")(f):p(f)}function p(f){return f===null||q(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function Pie(t,e,n){return r;function r(s){return Te(s)?hl(t,i)(s):n(s)}function i(s){return fb(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return re(s)?te(t,a,"whitespace")(s):a(s)}function a(s){return s===null||q(s)?e(s):n(s)}}var u1={name:"hardBreakEscape",tokenize:Cie};function Cie(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return q(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}var d1={name:"headingAtx",tokenize:Rie,resolve:Mie};function Mie(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},kt(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function Rie(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),o(u)}function o(u){return t.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(t.consume(u),a):u===null||Te(u)?(t.exit("atxHeadingSequence"),s(u)):n(u)}function s(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||q(u)?(t.exit("atxHeading"),e(u)):re(u)?te(t,s,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||Te(u)?(t.exit("atxHeadingText"),s(u)):(t.consume(u),c)}}var g4=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],p1=["pre","script","style","textarea"];var f1={name:"htmlFlow",tokenize:Aie,resolveTo:Lie,concrete:!0},$ie={tokenize:Fie,partial:!0},Iie={tokenize:Oie,partial:!0};function Lie(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Aie(t,e,n){let r=this,i,o,a,s,l;return c;function c(P){return u(P)}function u(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),d}function d(P){return P===33?(t.consume(P),p):P===47?(t.consume(P),o=!0,g):P===63?(t.consume(P),i=3,r.interrupt?e:E):zt(P)?(t.consume(P),a=String.fromCharCode(P),x):n(P)}function p(P){return P===45?(t.consume(P),i=2,f):P===91?(t.consume(P),i=5,s=0,h):zt(P)?(t.consume(P),i=4,r.interrupt?e:E):n(P)}function f(P){return P===45?(t.consume(P),r.interrupt?e:E):n(P)}function h(P){let _n="CDATA[";return P===_n.charCodeAt(s++)?(t.consume(P),s===_n.length?r.interrupt?e:I:h):n(P)}function g(P){return zt(P)?(t.consume(P),a=String.fromCharCode(P),x):n(P)}function x(P){if(P===null||P===47||P===62||Te(P)){let _n=P===47,Ji=a.toLowerCase();return!_n&&!o&&p1.includes(Ji)?(i=1,r.interrupt?e(P):I(P)):g4.includes(a.toLowerCase())?(i=6,_n?(t.consume(P),m):r.interrupt?e(P):I(P)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):o?y(P):v(P))}return P===45||Ut(P)?(t.consume(P),a+=String.fromCharCode(P),x):n(P)}function m(P){return P===62?(t.consume(P),r.interrupt?e:I):n(P)}function y(P){return re(P)?(t.consume(P),y):_(P)}function v(P){return P===47?(t.consume(P),_):P===58||P===95||zt(P)?(t.consume(P),w):re(P)?(t.consume(P),v):_(P)}function w(P){return P===45||P===46||P===58||P===95||Ut(P)?(t.consume(P),w):k(P)}function k(P){return P===61?(t.consume(P),b):re(P)?(t.consume(P),k):v(P)}function b(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),l=P,S):re(P)?(t.consume(P),b):C(P)}function S(P){return P===l?(t.consume(P),l=null,R):P===null||q(P)?n(P):(t.consume(P),S)}function C(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Te(P)?k(P):(t.consume(P),C)}function R(P){return P===47||P===62||re(P)?v(P):n(P)}function _(P){return P===62?(t.consume(P),D):n(P)}function D(P){return P===null||q(P)?I(P):re(P)?(t.consume(P),D):n(P)}function I(P){return P===45&&i===2?(t.consume(P),Q):P===60&&i===1?(t.consume(P),X):P===62&&i===4?(t.consume(P),Ne):P===63&&i===3?(t.consume(P),E):P===93&&i===5?(t.consume(P),se):q(P)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check($ie,Pt,N)(P)):P===null||q(P)?(t.exit("htmlFlowData"),N(P)):(t.consume(P),I)}function N(P){return t.check(Iie,O,Pt)(P)}function O(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),j}function j(P){return P===null||q(P)?N(P):(t.enter("htmlFlowData"),I(P))}function Q(P){return P===45?(t.consume(P),E):I(P)}function X(P){return P===47?(t.consume(P),a="",xe):I(P)}function xe(P){if(P===62){let _n=a.toLowerCase();return p1.includes(_n)?(t.consume(P),Ne):I(P)}return zt(P)&&a.length<8?(t.consume(P),a+=String.fromCharCode(P),xe):I(P)}function se(P){return P===93?(t.consume(P),E):I(P)}function E(P){return P===62?(t.consume(P),Ne):P===45&&i===2?(t.consume(P),E):I(P)}function Ne(P){return P===null||q(P)?(t.exit("htmlFlowData"),Pt(P)):(t.consume(P),Ne)}function Pt(P){return t.exit("htmlFlow"),e(P)}}function Oie(t,e,n){let r=this;return i;function i(a){return q(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Fie(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Xi,e,n)}}var h1={name:"htmlText",tokenize:Die};function Die(t,e,n){let r=this,i,o,a;return s;function s(E){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(E),l}function l(E){return E===33?(t.consume(E),c):E===47?(t.consume(E),k):E===63?(t.consume(E),v):zt(E)?(t.consume(E),C):n(E)}function c(E){return E===45?(t.consume(E),u):E===91?(t.consume(E),o=0,h):zt(E)?(t.consume(E),y):n(E)}function u(E){return E===45?(t.consume(E),f):n(E)}function d(E){return E===null?n(E):E===45?(t.consume(E),p):q(E)?(a=d,X(E)):(t.consume(E),d)}function p(E){return E===45?(t.consume(E),f):d(E)}function f(E){return E===62?Q(E):E===45?p(E):d(E)}function h(E){let Ne="CDATA[";return E===Ne.charCodeAt(o++)?(t.consume(E),o===Ne.length?g:h):n(E)}function g(E){return E===null?n(E):E===93?(t.consume(E),x):q(E)?(a=g,X(E)):(t.consume(E),g)}function x(E){return E===93?(t.consume(E),m):g(E)}function m(E){return E===62?Q(E):E===93?(t.consume(E),m):g(E)}function y(E){return E===null||E===62?Q(E):q(E)?(a=y,X(E)):(t.consume(E),y)}function v(E){return E===null?n(E):E===63?(t.consume(E),w):q(E)?(a=v,X(E)):(t.consume(E),v)}function w(E){return E===62?Q(E):v(E)}function k(E){return zt(E)?(t.consume(E),b):n(E)}function b(E){return E===45||Ut(E)?(t.consume(E),b):S(E)}function S(E){return q(E)?(a=S,X(E)):re(E)?(t.consume(E),S):Q(E)}function C(E){return E===45||Ut(E)?(t.consume(E),C):E===47||E===62||Te(E)?R(E):n(E)}function R(E){return E===47?(t.consume(E),Q):E===58||E===95||zt(E)?(t.consume(E),_):q(E)?(a=R,X(E)):re(E)?(t.consume(E),R):Q(E)}function _(E){return E===45||E===46||E===58||E===95||Ut(E)?(t.consume(E),_):D(E)}function D(E){return E===61?(t.consume(E),I):q(E)?(a=D,X(E)):re(E)?(t.consume(E),D):R(E)}function I(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(t.consume(E),i=E,N):q(E)?(a=I,X(E)):re(E)?(t.consume(E),I):(t.consume(E),O)}function N(E){return E===i?(t.consume(E),i=void 0,j):E===null?n(E):q(E)?(a=N,X(E)):(t.consume(E),N)}function O(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Te(E)?R(E):(t.consume(E),O)}function j(E){return E===47||E===62||Te(E)?R(E):n(E)}function Q(E){return E===62?(t.consume(E),t.exit("htmlTextData"),t.exit("htmlText"),e):n(E)}function X(E){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),xe}function xe(E){return re(E)?te(t,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):se(E)}function se(E){return t.enter("htmlTextData"),a(E)}}var ml={name:"labelEnd",tokenize:jie,resolveTo:Bie,resolveAll:Uie},Nie={tokenize:Hie},Vie={tokenize:Wie},zie={tokenize:qie};function Uie(t){let e=-1;for(;++e<t.length;){let n=t[e][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(t.splice(e+1,n.type==="labelImage"?4:2),n.type="data",e++)}return t}function Bie(t,e){let n=t.length,r=0,i,o,a,s;for(;n--;)if(i=t[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);let l={type:t[o][1].type==="labelLink"?"link":"image",start:Object.assign({},t[o][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[o][1].start),end:Object.assign({},t[a][1].end)},u={type:"labelText",start:Object.assign({},t[o+r+2][1].end),end:Object.assign({},t[a-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=Fn(s,t.slice(o+1,o+r+3)),s=Fn(s,[["enter",u,e]]),s=Fn(s,es(e.parser.constructs.insideSpan.null,t.slice(o+r+4,a-3),e)),s=Fn(s,[["exit",u,e],t[a-2],t[a-1],["exit",c,e]]),s=Fn(s,t.slice(a+1)),s=Fn(s,[["exit",l,e]]),kt(t,o,t.length,s),t}function jie(t,e,n){let r=this,i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(p){return o?o._inactive?d(p):(a=r.parser.defined.includes(wn(r.sliceSerialize({start:o.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),l):n(p)}function l(p){return p===40?t.attempt(Nie,u,a?u:d)(p):p===91?t.attempt(Vie,u,a?c:d)(p):a?u(p):d(p)}function c(p){return t.attempt(zie,u,d)(p)}function u(p){return e(p)}function d(p){return o._balanced=!0,n(p)}}function Hie(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return Te(d)?hl(t,o)(d):o(d)}function o(d){return d===41?u(d):db(t,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Te(d)?hl(t,l)(d):u(d)}function s(d){return n(d)}function l(d){return d===34||d===39||d===40?fb(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Te(d)?hl(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function Wie(t,e,n){let r=this;return i;function i(s){return pb.call(r,t,o,a,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(wn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(s):n(s)}function a(s){return n(s)}}function qie(t,e,n){return r;function r(o){return t.enter("reference"),t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),i}function i(o){return o===93?(t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),t.exit("reference"),e):n(o)}}var m1={name:"labelStartImage",tokenize:Kie,resolveAll:ml.resolveAll};function Kie(t,e,n){let r=this;return i;function i(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),o}function o(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}var g1={name:"labelStartLink",tokenize:Gie,resolveAll:ml.resolveAll};function Gie(t,e,n){let r=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}var Vh={name:"lineEnding",tokenize:Yie};function Yie(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),te(t,e,"linePrefix")}}var gl={name:"thematicBreak",tokenize:Qie};function Qie(t,e,n){let r=0,i;return o;function o(c){return t.enter("thematicBreak"),a(c)}function a(c){return i=c,s(c)}function s(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||q(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),re(c)?te(t,s,"whitespace")(c):s(c))}}var bn={name:"list",tokenize:Jie,continuation:{tokenize:eoe},exit:noe},Xie={tokenize:roe,partial:!0},Zie={tokenize:toe,partial:!0};function Jie(t,e,n){let r=this,i=r.events[r.events.length-1],o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(f){let h=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Ah(f)){if(r.containerState.type||(r.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(gl,n,c)(f):c(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return Ah(f)&&++a<10?(t.consume(f),l):(!r.interrupt||a<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):n(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(Xi,r.interrupt?n:u,t.attempt(Xie,p,d))}function u(f){return r.containerState.initialBlankLine=!0,o++,p(f)}function d(f){return re(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function eoe(t,e,n){let r=this;return r.containerState._closeFlow=void 0,t.check(Xi,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,te(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!re(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Zie,e,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,te(t,t.attempt(bn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function toe(t,e,n){let r=this;return te(t,i,"listItemIndent",r.containerState.size+1);function i(o){let a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(o):n(o)}}function noe(t){t.exit(this.containerState.type)}function roe(t,e,n){let r=this;return te(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){let a=r.events[r.events.length-1];return!re(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}var hb={name:"setextUnderline",tokenize:ooe,resolveTo:ioe};function ioe(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);let a={type:"setextHeading",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",a,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end=Object.assign({},t[o][1].end)):t[r][1]=a,t.push(["exit",a,e]),t}function ooe(t,e,n){let r=this,i;return o;function o(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return t.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(t.consume(c),s):(t.exit("setextHeadingLineSequence"),re(c)?te(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||q(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}var aoe={tokenize:foe,partial:!0};function y1(){return{document:{91:{tokenize:uoe,continuation:{tokenize:doe},exit:poe}},text:{91:{tokenize:coe},93:{add:"after",tokenize:soe,resolveTo:loe}}}}function soe(t,e,n){let r=this,i=r.events.length,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a;for(;i--;){let l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return n(l);let c=wn(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!o.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function loe(t,e){let n=t.length,r;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){r=t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[t[n+1],t[n+2],["enter",i,e],t[n+3],t[n+4],["enter",o,e],["exit",o,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",i,e]];return t.splice(n,t.length-n+1,...l),t}function coe(t,e,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o=0,a;return s;function s(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(o>999||d===93&&!a||d===null||d===91||Te(d))return n(d);if(d===93){t.exit("chunkString");let p=t.exit("gfmFootnoteCallString");return i.includes(wn(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return Te(d)||(a=!0),o++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),o++,c):c(d)}}function uoe(t,e,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o,a=0,s;return l;function l(h){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(h)}function u(h){if(a>999||h===93&&!s||h===null||h===91||Te(h))return n(h);if(h===93){t.exit("chunkString");let g=t.exit("gfmFootnoteDefinitionLabelString");return o=wn(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Te(h)||(s=!0),a++,t.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(t.consume(h),a++,u):u(h)}function p(h){return h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),i.includes(o)||i.push(o),te(t,f,"gfmFootnoteDefinitionWhitespace")):n(h)}function f(h){return e(h)}}function doe(t,e,n){return t.check(Xi,e,t.attempt(aoe,e,n))}function poe(t){t.exit("gfmFootnoteDefinition")}function foe(t,e,n){let r=this;return te(t,i,"gfmFootnoteDefinitionIndent",5);function i(o){let a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(o):n(o)}}function v1(t){let n=(t||{}).singleTilde,r={tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},p=[["enter",u,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",d,s]],f=s.parser.constructs.insideSpan.null;f&&kt(p,p.length,0,es(f,a.slice(c+1,l),s)),kt(p,p.length,0,[["exit",d,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",u,s]]),kt(a,c-1,l-c+3,p),l=c+p.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function o(a,s,l){let c=this.previous,u=this.events,d=0;return p;function p(h){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),f(h))}function f(h){let g=ju(c);if(h===126)return d>1?l(h):(a.consume(h),d++,f);if(d<2&&!n)return l(h);let x=a.exit("strikethroughSequenceTemporary"),m=ju(h);return x._open=!m||m===2&&!!g,x._close=!g||g===2&&!!m,s(h)}}}var mb=class{constructor(){this.map=[]}add(e,n,r){hoe(this,e,n,r)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length,r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push([...e]),e.length=0;let i=r.pop();for(;i;)e.push(...i),i=r.pop();this.map.length=0}};function hoe(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function y4(t,e){let n=!1,r=[];for(;e<t.length;){let i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function x1(){return{flow:{null:{tokenize:moe,resolveAll:goe}}}}function moe(t,e,n){let r=this,i=0,o=0,a;return s;function s(_){let D=r.events.length-1;for(;D>-1;){let O=r.events[D][1].type;if(O==="lineEnding"||O==="linePrefix")D--;else break}let I=D>-1?r.events[D][1].type:null,N=I==="tableHead"||I==="tableRow"?b:l;return N===b&&r.parser.lazy[r.now().line]?n(_):N(_)}function l(_){return t.enter("tableHead"),t.enter("tableRow"),c(_)}function c(_){return _===124||(a=!0,o+=1),u(_)}function u(_){return _===null?n(_):q(_)?o>1?(o=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),f):n(_):re(_)?te(t,u,"whitespace")(_):(o+=1,a&&(a=!1,i+=1),_===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),a=!0,u):(t.enter("data"),d(_)))}function d(_){return _===null||_===124||Te(_)?(t.exit("data"),u(_)):(t.consume(_),_===92?p:d)}function p(_){return _===92||_===124?(t.consume(_),d):d(_)}function f(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(t.enter("tableDelimiterRow"),a=!1,re(_)?te(t,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):h(_))}function h(_){return _===45||_===58?x(_):_===124?(a=!0,t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),g):k(_)}function g(_){return re(_)?te(t,x,"whitespace")(_):x(_)}function x(_){return _===58?(o+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),m):_===45?(o+=1,m(_)):_===null||q(_)?w(_):k(_)}function m(_){return _===45?(t.enter("tableDelimiterFiller"),y(_)):k(_)}function y(_){return _===45?(t.consume(_),y):_===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(_))}function v(_){return re(_)?te(t,w,"whitespace")(_):w(_)}function w(_){return _===124?h(_):_===null||q(_)?!a||i!==o?k(_):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(_)):k(_)}function k(_){return n(_)}function b(_){return t.enter("tableRow"),S(_)}function S(_){return _===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),S):_===null||q(_)?(t.exit("tableRow"),e(_)):re(_)?te(t,S,"whitespace")(_):(t.enter("data"),C(_))}function C(_){return _===null||_===124||Te(_)?(t.exit("data"),S(_)):(t.consume(_),_===92?R:C)}function R(_){return _===92||_===124?(t.consume(_),C):C(_)}}function goe(t,e){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,u,d,p=new mb;for(;++n<t.length;){let f=t[n],h=f[1];f[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(v4(p,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},p.add(n,0,[["enter",c,e]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(r=!0,d=void 0,o=[0,0,0,0],a=[0,n+1,0,0],s&&(s=!1,u={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},p.add(n,0,[["enter",u,e]])),i=h.type==="tableDelimiterRow"?2:u?3:1):i&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],d=gb(p,e,o,i,void 0,d),o=[0,0,0,0]),a[2]=n)):h.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],d=gb(p,e,o,i,void 0,d)),o=a,a=[o[1],n,0,0])):h.type==="tableHead"?(s=!0,l=n):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=n,o[1]!==0?(a[0]=a[1],d=gb(p,e,o,i,n,d)):a[1]!==0&&(d=gb(p,e,a,i,n,d)),i=0):i&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&v4(p,e,l,c,u),p.consume(e.events),n=-1;++n<e.events.length;){let f=e.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=y4(e.events,n))}return t}function gb(t,e,n,r,i,o){let a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(o.end=Object.assign({},Hu(e.events,n[0])),t.add(n[0],0,[["exit",o,e]]));let l=Hu(e.events,n[1]);if(o={type:a,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",o,e]]),n[2]!==0){let c=Hu(e.events,n[2]),u=Hu(e.events,n[3]),d={type:s,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){let p=e.events[n[2]],f=e.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){let h=n[2]+1,g=n[3]-n[2]-1;t.add(h,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(o.end=Object.assign({},Hu(e.events,i)),t.add(i,0,[["exit",o,e]]),o=void 0),o}function v4(t,e,n,r,i){let o=[],a=Hu(e.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,e])),r.end=Object.assign({},a),o.push(["exit",r,e]),t.add(n+1,0,o)}function Hu(t,e){let n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}var yoe={tokenize:voe};function w1(){return{text:{91:yoe}}}function voe(t,e,n){let r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),o)}function o(l){return Te(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),s):n(l)}function s(l){return q(l)?e(l):re(l)?t.check({tokenize:xoe},e,n)(l):n(l)}}function xoe(t,e,n){return te(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function x4(t){return ob([i1(),y1(),v1(t),x1(),w1()])}var woe={};function yb(t){let e=this,n=t||woe,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(x4(n)),o.push(t1()),a.push(n1(n))}var w4={tokenize:boe};function boe(t){let e=t.attempt(this.parser.constructs.contentInitial,r,i),n;return e;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),te(t,e,"linePrefix")}function i(s){return t.enter("paragraph"),o(s)}function o(s){let l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return q(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),a)}}var _4={tokenize:_oe},b4={tokenize:koe};function _oe(t){let e=this,n=[],r=0,i,o,a;return s;function s(v){if(r<n.length){let w=n[r];return e.containerState=w[1],t.attempt(w[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&y();let w=e.events.length,k=w,b;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){b=e.events[k][1].end;break}m(r);let S=w;for(;S<e.events.length;)e.events[S][1].end=Object.assign({},b),S++;return kt(e.events,k+1,0,e.events.slice(w)),e.events.length=S,c(v)}return s(v)}function c(v){if(r===n.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return h(v);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(b4,u,d)(v)}function u(v){return i&&y(),m(r),p(v)}function d(v){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,h(v)}function p(v){return e.containerState={},t.attempt(b4,f,h)(v)}function f(v){return r++,n.push([e.currentConstruct,e.containerState]),p(v)}function h(v){if(v===null){i&&y(),m(0),t.consume(v);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:i}),g(v)}function g(v){if(v===null){x(t.exit("chunkFlow"),!0),m(0),t.consume(v);return}return q(v)?(t.consume(v),x(t.exit("chunkFlow")),r=0,e.interrupt=void 0,s):(t.consume(v),g)}function x(v,w){let k=e.sliceStream(v);if(w&&k.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(k),e.parser.lazy[v.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<a&&(!i.events[b][1].end||i.events[b][1].end.offset>a))return;let S=e.events.length,C=S,R,_;for(;C--;)if(e.events[C][0]==="exit"&&e.events[C][1].type==="chunkFlow"){if(R){_=e.events[C][1].end;break}R=!0}for(m(r),b=S;b<e.events.length;)e.events[b][1].end=Object.assign({},_),b++;kt(e.events,C+1,0,e.events.slice(S)),e.events.length=b}}function m(v){let w=n.length;for(;w-- >v;){let k=n[w];e.containerState=k[1],k[0].exit.call(e,t)}n.length=v}function y(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function koe(t,e,n){return te(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var k4={tokenize:Toe};function Toe(t){let e=this,n=t.attempt(Xi,r,t.attempt(this.parser.constructs.flowInitial,i,te(t,t.attempt(this.parser.constructs.flow,i,t.attempt(l1,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}var T4={resolveAll:C4()},S4=P4("string"),E4=P4("text");function P4(t){return{tokenize:e,resolveAll:C4(t==="text"?Soe:void 0)};function e(n){let r=this,i=this.parser.constructs[t],o=n.attempt(i,a,s);return a;function a(u){return c(u)?o(u):s(u)}function s(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;let d=i[u],p=-1;if(d)for(;++p<d.length;){let f=d[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function C4(t){return e;function e(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return t?t(n,r):n}}function Soe(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){let r=t[n-1][1],i=e.sliceStream(r),o=i.length,a=-1,s=0,l;for(;o--;){let c=i[o];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){o++;break}}if(s){let c={type:n===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-s,offset:r.end.offset-s,_index:r.start._index+o,_bufferIndex:o?a:r.start._bufferIndex+a},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}function M4(t,e,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},o=[],a=[],s=[],l=!0,c={consume:w,enter:k,exit:b,attempt:R(S),check:R(C),interrupt:R(C,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:g,sliceSerialize:h,now:x,defineSkip:m,write:f},d=e.tokenize.call(u,c),p;return e.resolveAll&&o.push(e),u;function f(N){return a=Fn(a,N),y(),a[a.length-1]!==null?[]:(_(e,0),u.events=es(o,u.events,u),u.events)}function h(N,O){return Poe(g(N),O)}function g(N){return Eoe(a,N)}function x(){let{line:N,column:O,offset:j,_index:Q,_bufferIndex:X}=r;return{line:N,column:O,offset:j,_index:Q,_bufferIndex:X}}function m(N){i[N.line]=N.column,I()}function y(){let N;for(;r._index<a.length;){let O=a[r._index];if(typeof O=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<O.length;)v(O.charCodeAt(r._bufferIndex));else v(O)}}function v(N){l=void 0,p=N,d=d(N)}function w(N){q(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,I()):N!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=N,l=!0}function k(N,O){let j=O||{};return j.type=N,j.start=x(),u.events.push(["enter",j,u]),s.push(j),j}function b(N){let O=s.pop();return O.end=x(),u.events.push(["exit",O,u]),O}function S(N,O){_(N,O.from)}function C(N,O){O.restore()}function R(N,O){return j;function j(Q,X,xe){let se,E,Ne,Pt;return Array.isArray(Q)?_n(Q):"tokenize"in Q?_n([Q]):P(Q);function P(st){return Wo;function Wo(kr){let qo=kr!==null&&st[kr],Ko=kr!==null&&st.null,ad=[...Array.isArray(qo)?qo:qo?[qo]:[],...Array.isArray(Ko)?Ko:Ko?[Ko]:[]];return _n(ad)(kr)}}function _n(st){return se=st,E=0,st.length===0?xe:Ji(st[E])}function Ji(st){return Wo;function Wo(kr){return Pt=D(),Ne=st,st.partial||(u.currentConstruct=st),st.name&&u.parser.constructs.disable.null.includes(st.name)?Tl(kr):st.tokenize.call(O?Object.assign(Object.create(u),O):u,c,od,Tl)(kr)}}function od(st){return l=!0,N(Ne,Pt),X}function Tl(st){return l=!0,Pt.restore(),++E<se.length?Ji(se[E]):xe}}}function _(N,O){N.resolveAll&&!o.includes(N)&&o.push(N),N.resolve&&kt(u.events,O,u.events.length-O,N.resolve(u.events.slice(O),u)),N.resolveTo&&(u.events=N.resolveTo(u.events,u))}function D(){let N=x(),O=u.previous,j=u.currentConstruct,Q=u.events.length,X=Array.from(s);return{restore:xe,from:Q};function xe(){r=N,u.previous=O,u.currentConstruct=j,u.events.length=Q,s=X,I()}}function I(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Eoe(t,e){let n=e.start._index,r=e.start._bufferIndex,i=e.end._index,o=e.end._bufferIndex,a;if(n===i)a=[t[n].slice(r,o)];else{if(a=t.slice(n,i),r>-1){let s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function Poe(t,e){let n=-1,r=[],i;for(;++n<t.length;){let o=t[n],a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
|
|
`;break}case-3:{a=`\r
|
|
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}var b1={};Ot(b1,{attentionMarkers:()=>Ooe,contentInitial:()=>Moe,disable:()=>Foe,document:()=>Coe,flow:()=>$oe,flowInitial:()=>Roe,insideSpan:()=>Aoe,string:()=>Ioe,text:()=>Loe});var Coe={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:ab},Moe={91:c1},Roe={[-2]:Nh,[-1]:Nh,32:Nh},$oe={35:d1,42:gl,45:[hb,gl],60:f1,61:hb,95:gl,96:cb,126:cb},Ioe={38:lb,92:sb},Loe={[-5]:Vh,[-4]:Vh,[-3]:Vh,33:m1,38:lb,42:Dh,60:[a1,h1],91:g1,92:[u1,sb],93:ml,95:Dh,96:s1},Aoe={null:[Dh,T4]},Ooe={null:[42,95]},Foe={null:[]};function _1(t){let n=ob([b1,...(t||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(w4),document:i(_4),flow:i(k4),string:i(S4),text:i(E4)};return r;function i(o){return a;function a(s){return M4(r,o,s)}}}function k1(t){for(;!ub(t););return t}var R4=/[\0\t\n\r]/g;function T1(){let t=1,e="",n=!0,r;return i;function i(o,a,s){let l=[],c,u,d,p,f;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),d=0,e="",n&&(o.charCodeAt(0)===65279&&d++,n=void 0);d<o.length;){if(R4.lastIndex=d,c=R4.exec(o),p=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(p),!c){e=o.slice(d);break}if(f===10&&d===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<p&&(l.push(o.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=p+1}return s&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}function ts(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?$4(t.position):"start"in t||"end"in t?$4(t):"line"in t||"column"in t?S1(t):""}function S1(t){return I4(t&&t.line)+":"+I4(t&&t.column)}function $4(t){return S1(t&&t.start)+"-"+S1(t&&t.end)}function I4(t){return t&&typeof t=="number"?t:1}var A4={}.hasOwnProperty;function E1(t,e,n){return typeof e!="string"&&(n=e,e=void 0),Doe(n)(k1(_1(n).document().write(T1()(t,e,!0))))}function Doe(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(HC),autolinkProtocol:R,autolinkEmail:R,atxHeading:o(os),blockQuote:o(Wo),characterEscape:R,characterReference:R,codeFenced:o(kr),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(kr,a),codeText:o(qo,a),codeTextData:R,data:R,codeFlowValue:R,definition:o(Ko),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(ad),hardBreakEscape:o(BC),hardBreakTrailing:o(BC),htmlFlow:o(jC,a),htmlFlowData:R,htmlText:o(jC,a),htmlTextData:R,image:o(vB),label:a,link:o(HC),listItem:o(xB),listItemValue:p,listOrdered:o(WC,d),listUnordered:o(WC),paragraph:o(wB),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(os),strong:o(bB),thematicBreak:o(kB)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:st,autolinkProtocol:Tl,blockQuote:l(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:Ji,characterReferenceMarkerNumeric:Ji,characterReferenceValue:od,codeFenced:l(x),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:h,codeFlowValue:_,codeIndented:l(m),codeText:l(j),codeTextData:_,data:_,definition:l(),definitionDestinationString:w,definitionLabelString:y,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(N),htmlFlowData:_,htmlText:l(O),htmlTextData:_,image:l(X),label:se,labelText:xe,lineEnding:D,link:l(Q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:_n,resourceDestinationString:E,resourceTitleString:Ne,resource:Pt,setextHeading:l(C),setextHeadingLineSequence:S,setextHeadingText:b,strong:l(),thematicBreak:l()}};O4(e,(t||{}).mdastExtensions||[]);let n={};return r;function r(F){let W={type:"root",children:[]},fe={stack:[W],tokenStack:[],config:e,enter:s,exit:c,buffer:a,resume:u,data:n},Ce=[],Ve=-1;for(;++Ve<F.length;)if(F[Ve][1].type==="listOrdered"||F[Ve][1].type==="listUnordered")if(F[Ve][0]==="enter")Ce.push(Ve);else{let Jr=Ce.pop();Ve=i(F,Jr,Ve)}for(Ve=-1;++Ve<F.length;){let Jr=e[F[Ve][0]];A4.call(Jr,F[Ve][1].type)&&Jr[F[Ve][1].type].call(Object.assign({sliceSerialize:F[Ve][2].sliceSerialize},fe),F[Ve][1])}if(fe.tokenStack.length>0){let Jr=fe.tokenStack[fe.tokenStack.length-1];(Jr[1]||L4).call(fe,void 0,Jr[0])}for(W.position={start:ns(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:ns(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<e.transforms.length;)W=e.transforms[Ve](W)||W;return W}function i(F,W,fe){let Ce=W-1,Ve=-1,Jr=!1,as,eo,sd,ld;for(;++Ce<=fe;){let er=F[Ce];switch(er[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{er[0]==="enter"?Ve++:Ve--,ld=void 0;break}case"lineEndingBlank":{er[0]==="enter"&&(as&&!ld&&!Ve&&!sd&&(sd=Ce),ld=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ld=void 0}if(!Ve&&er[0]==="enter"&&er[1].type==="listItemPrefix"||Ve===-1&&er[0]==="exit"&&(er[1].type==="listUnordered"||er[1].type==="listOrdered")){if(as){let Sl=Ce;for(eo=void 0;Sl--;){let to=F[Sl];if(to[1].type==="lineEnding"||to[1].type==="lineEndingBlank"){if(to[0]==="exit")continue;eo&&(F[eo][1].type="lineEndingBlank",Jr=!0),to[1].type="lineEnding",eo=Sl}else if(!(to[1].type==="linePrefix"||to[1].type==="blockQuotePrefix"||to[1].type==="blockQuotePrefixWhitespace"||to[1].type==="blockQuoteMarker"||to[1].type==="listItemIndent"))break}sd&&(!eo||sd<eo)&&(as._spread=!0),as.end=Object.assign({},eo?F[eo][1].start:er[1].end),F.splice(eo||Ce,0,["exit",as,er[2]]),Ce++,fe++}if(er[1].type==="listItemPrefix"){let Sl={type:"listItem",_spread:!1,start:Object.assign({},er[1].start),end:void 0};as=Sl,F.splice(Ce,0,["enter",Sl,er[2]]),Ce++,fe++,sd=void 0,ld=!0}}}return F[W][1]._spread=Jr,fe}function o(F,W){return fe;function fe(Ce){s.call(this,F(Ce),Ce),W&&W.call(this,Ce)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(F,W,fe){this.stack[this.stack.length-1].children.push(F),this.stack.push(F),this.tokenStack.push([W,fe]),F.position={start:ns(W.start),end:void 0}}function l(F){return W;function W(fe){F&&F.call(this,fe),c.call(this,fe)}}function c(F,W){let fe=this.stack.pop(),Ce=this.tokenStack.pop();if(Ce)Ce[0].type!==F.type&&(W?W.call(this,F,Ce[0]):(Ce[1]||L4).call(this,F,Ce[0]));else throw new Error("Cannot close `"+F.type+"` ("+ts({start:F.start,end:F.end})+"): it\u2019s not open");fe.position.end=ns(F.end)}function u(){return pl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(F){if(this.data.expectingFirstListItemValue){let W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(F),10),this.data.expectingFirstListItemValue=void 0}}function f(){let F=this.resume(),W=this.stack[this.stack.length-1];W.lang=F}function h(){let F=this.resume(),W=this.stack[this.stack.length-1];W.meta=F}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){let F=this.resume(),W=this.stack[this.stack.length-1];W.value=F.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){let F=this.resume(),W=this.stack[this.stack.length-1];W.value=F.replace(/(\r?\n|\r)$/g,"")}function y(F){let W=this.resume(),fe=this.stack[this.stack.length-1];fe.label=W,fe.identifier=wn(this.sliceSerialize(F)).toLowerCase()}function v(){let F=this.resume(),W=this.stack[this.stack.length-1];W.title=F}function w(){let F=this.resume(),W=this.stack[this.stack.length-1];W.url=F}function k(F){let W=this.stack[this.stack.length-1];if(!W.depth){let fe=this.sliceSerialize(F).length;W.depth=fe}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function S(F){let W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(F).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function R(F){let fe=this.stack[this.stack.length-1].children,Ce=fe[fe.length-1];(!Ce||Ce.type!=="text")&&(Ce=_B(),Ce.position={start:ns(F.start),end:void 0},fe.push(Ce)),this.stack.push(Ce)}function _(F){let W=this.stack.pop();W.value+=this.sliceSerialize(F),W.position.end=ns(F.end)}function D(F){let W=this.stack[this.stack.length-1];if(this.data.atHardBreak){let fe=W.children[W.children.length-1];fe.position.end=ns(F.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(W.type)&&(R.call(this,F),_.call(this,F))}function I(){this.data.atHardBreak=!0}function N(){let F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function O(){let F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function j(){let F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function Q(){let F=this.stack[this.stack.length-1];if(this.data.inReference){let W=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=W,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function X(){let F=this.stack[this.stack.length-1];if(this.data.inReference){let W=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=W,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function xe(F){let W=this.sliceSerialize(F),fe=this.stack[this.stack.length-2];fe.label=n4(W),fe.identifier=wn(W).toLowerCase()}function se(){let F=this.stack[this.stack.length-1],W=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){let Ce=F.children;fe.children=Ce}else fe.alt=W}function E(){let F=this.resume(),W=this.stack[this.stack.length-1];W.url=F}function Ne(){let F=this.resume(),W=this.stack[this.stack.length-1];W.title=F}function Pt(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function _n(F){let W=this.resume(),fe=this.stack[this.stack.length-1];fe.label=W,fe.identifier=wn(this.sliceSerialize(F)).toLowerCase(),this.data.referenceType="full"}function Ji(F){this.data.characterReferenceType=F.type}function od(F){let W=this.sliceSerialize(F),fe=this.data.characterReferenceType,Ce;fe?(Ce=ib(W,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ce=Bu(W);let Ve=this.stack.pop();Ve.value+=Ce,Ve.position.end=ns(F.end)}function Tl(F){_.call(this,F);let W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(F)}function st(F){_.call(this,F);let W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(F)}function Wo(){return{type:"blockquote",children:[]}}function kr(){return{type:"code",lang:null,meta:null,value:""}}function qo(){return{type:"inlineCode",value:""}}function Ko(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ad(){return{type:"emphasis",children:[]}}function os(){return{type:"heading",depth:0,children:[]}}function BC(){return{type:"break"}}function jC(){return{type:"html",value:""}}function vB(){return{type:"image",title:null,url:"",alt:null}}function HC(){return{type:"link",title:null,url:"",children:[]}}function WC(F){return{type:"list",ordered:F.type==="listOrdered",start:null,spread:F._spread,children:[]}}function xB(F){return{type:"listItem",spread:F._spread,checked:null,children:[]}}function wB(){return{type:"paragraph",children:[]}}function bB(){return{type:"strong",children:[]}}function _B(){return{type:"text",value:""}}function kB(){return{type:"thematicBreak"}}}function ns(t){return{line:t.line,column:t.column,offset:t.offset}}function O4(t,e){let n=-1;for(;++n<e.length;){let r=e[n];Array.isArray(r)?O4(t,r):Noe(t,r)}}function Noe(t,e){let n;for(n in e)if(A4.call(e,n))switch(n){case"canContainEols":{let r=e[n];r&&t[n].push(...r);break}case"transforms":{let r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{let r=e[n];r&&Object.assign(t[n],r);break}}}function L4(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ts({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ts({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ts({start:e.start,end:e.end})+") is still open")}function vb(t){let e=this;e.parser=n;function n(r){return E1(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function P1(t){if(t)throw t}var bb=$(H4(),1);function zh(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function W4(){let t=[],e={run:n,use:r};return e;function n(...i){let o=-1,a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);s(null,...i);function s(l,...c){let u=t[++o],d=-1;if(l){a(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?Voe(u,s)(...c):a(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function Voe(t,e){let n;return r;function r(...a){let s=t.length>a.length,l;s&&a.push(i);try{l=t.apply(this,a)}catch(c){let u=c;if(s&&n)throw u;return i(u)}s||(l instanceof Promise?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,e(a,...s))}function o(a){i(null,a)}}var Xt=class extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){let l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=ts(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}};Xt.prototype.file="";Xt.prototype.name="";Xt.prototype.reason="";Xt.prototype.message="";Xt.prototype.stack="";Xt.prototype.column=void 0;Xt.prototype.line=void 0;Xt.prototype.ancestors=void 0;Xt.prototype.cause=void 0;Xt.prototype.fatal=void 0;Xt.prototype.place=void 0;Xt.prototype.ruleId=void 0;Xt.prototype.source=void 0;var ki={basename:zoe,dirname:Uoe,extname:Boe,join:joe,sep:"/"};function zoe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Uh(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Uoe(t){if(Uh(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Boe(t){Uh(t);let e=t.length,n=-1,r=0,i=-1,o=0,a;for(;e--;){let s=t.codePointAt(e);if(s===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function joe(...t){let e=-1,n;for(;++e<t.length;)Uh(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Hoe(n)}function Hoe(t){Uh(t);let e=t.codePointAt(0)===47,n=Woe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Woe(t,e){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=t.length;){if(a<t.length)s=t.codePointAt(a);else{if(s===47)break;s=47}if(s===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function Uh(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var q4={cwd:qoe};function qoe(){return"/"}function Wu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function K4(t){if(typeof t=="string")t=new URL(t);else if(!Wu(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Koe(t)}function Koe(t){if(t.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let e=t.pathname,n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){let r=e.codePointAt(n+2);if(r===70||r===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var C1=["history","path","basename","stem","extname","dirname"],Bh=class{constructor(e){let n;e?Wu(e)?n={path:e}:typeof e=="string"||Goe(e)?n={value:e}:n=e:n={},this.cwd=q4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<C1.length;){let o=C1[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)C1.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ki.basename(this.path):void 0}set basename(e){R1(e,"basename"),M1(e,"basename"),this.path=ki.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ki.dirname(this.path):void 0}set dirname(e){G4(this.basename,"dirname"),this.path=ki.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ki.extname(this.path):void 0}set extname(e){if(M1(e,"extname"),G4(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ki.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Wu(e)&&(e=K4(e)),R1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ki.basename(this.path,this.extname):void 0}set stem(e){R1(e,"stem"),M1(e,"stem"),this.path=ki.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){let i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){let i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){let i=new Xt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function M1(t,e){if(t&&t.includes(ki.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ki.sep+"`")}function R1(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function G4(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Goe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var Y4=function(t){let r=this.constructor.prototype,i=r[t],o=function(){return i.apply(o,arguments)};Object.setPrototypeOf(o,r);let a=Object.getOwnPropertyNames(i);for(let s of a){let l=Object.getOwnPropertyDescriptor(i,s);l&&Object.defineProperty(o,s,l)}return o};var Yoe={}.hasOwnProperty,A1=class t extends Y4{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=W4()}copy(){let e=new t,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];e.use(...r)}return e.data((0,bb.default)(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(L1("data",this.frozen),this.namespace[e]=n,this):Yoe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(L1("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let n=wb(e),r=this.parser||this.Parser;return $1("parse",r),r(String(n),n)}process(e,n){let r=this;return this.freeze(),$1("process",this.parser||this.Parser),I1("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,a){let s=wb(e),l=r.parse(s);r.run(l,s,function(u,d,p){if(u||!d||!p)return c(u);let f=d,h=r.stringify(f,p);Xoe(h)?p.value=h:p.result=h,c(u,p)});function c(u,d){u||!d?a(u):o?o(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),$1("processSync",this.parser||this.Parser),I1("processSync",this.compiler||this.Compiler),this.process(e,i),X4("processSync","process",n),r;function i(o,a){n=!0,P1(o),r=a}}run(e,n,r){Q4(e),this.freeze();let i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,s){let l=wb(n);i.run(e,l,c);function c(u,d,p){let f=d||e;u?s(u):a?a(f):r(void 0,f,p)}}}runSync(e,n){let r=!1,i;return this.run(e,n,o),X4("runSync","run",r),i;function o(a,s){P1(a),i=s,r=!0}}stringify(e,n){this.freeze();let r=wb(n),i=this.compiler||this.Compiler;return I1("stringify",i),Q4(e),i(e,r)}use(e,...n){let r=this.attachers,i=this.namespace;if(L1("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?s(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function o(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(i.settings=(0,bb.default)(!0,i.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];o(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,p=-1;for(;++d<r.length;)if(r[d][0]===c){p=d;break}if(p===-1)r.push([c,...u]);else if(u.length>0){let[f,...h]=u,g=r[p][1];zh(g)&&zh(f)&&(f=(0,bb.default)(!0,g,f)),r[p]=[c,f,...h]}}}},O1=new A1().freeze();function $1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function I1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function L1(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Q4(t){if(!zh(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function X4(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function wb(t){return Qoe(t)?t:new Bh(t)}function Qoe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Xoe(t){return typeof t=="string"||Zoe(t)}function Zoe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function Z4(t){return O1().use(vb).use(yb).parse(t)}function J4(t,e){let n;if(zu(e,"link",a=>(n=a,Yi)),!n)return null;let r=n.children.first()?.position?.start.offset,i=n.children.last()?.position?.end.offset;return{display:r&&i?t.slice(r,i).trim():"",url:n.url,title:n.title}}function e6(t,e){let n="";return zu(e,"listItem",r=>{let i=r.children.first()?.position?.start.offset,o=r.children.last()?.position?.end.offset;return i&&o&&(n=t.slice(i,o)),Yi}),n}function Joe(t){return!t.frontmatter||!("autoplay"in t.frontmatter)?!0:!!t.frontmatter.autoplay}async function n6(t,e){let n=e.app.metadataCache.getFileCache(t);if(!n)return null;let i=await eae(n,{source:t,plugin:e});return i?{autoplay:Joe(n),title:nae(n,t),list:i,file:t}:null}async function eae(t,e){let{metadataCache:n,vault:r}=e.plugin.app,{frontmatter:i}=t;if(i?.playlist!==!0||!t.sections||!t.listItems)return null;let o=t.sections.find(p=>p.type==="list");if(!o)return[];let a=p=>F1(p,o),s=tae(t.listItems.filter(a)),l=t.links?.filter(a)??[],c=await r.cachedRead(e.source);return s.map((p,f,h)=>{let g=l.findIndex(S=>F1(S,p)),{parent:x,task:m}=p,y=m&&TE[m],v=x>=0?h.findIndex(S=>S.position.start.line===x):-1;if(g!==-1){let S=l[g],C=l.findLastIndex(_=>F1(_,p));return l.splice(g,C-g+1),{media:d(S),type:y??"generic",parent:v,title:S.displayText??""}}let w=rae(c,p.position),k=Z4(w),b=J4(w,k);if(b){let{url:S}=b,C=e.plugin.resolveUrl(S),{display:R}=b;return C&&(R===S||!R)&&(R=Ao(C)),{media:C,title:R,type:y||"generic",parent:v}}return{media:null,title:e6(w,k)||"Item",type:y||"chapter",parent:v}});function d({link:p}){let{path:f,subpath:h}=(0,t6.parseLinktext)(p),g=n.getFirstLinkpathDest(f,e.source.path);return Si(g,h)}}function tae(t){return t.map(({task:e,...n})=>d3(e)?{task:e,...n}:n)}function nae(t,e){return t.frontmatter?.title?.trim()||t.headings?.find(n=>n.level===1)?.heading?.trim()||e.basename.trim()}function F1(t,e){return t.position.start.offset>=e.position.start.offset&&t.position.end.offset<=e.position.end.offset}function rae(t,e){return t.slice(e.start.offset,e.end.offset)}var _b=class extends yl.Component{constructor(n){super();this.plugin=n;T(this,"app");T(this,"mediaToPlaylistIndex",new Map);T(this,"listVariantMap",new WeakMap);T(this,"listFileCache",new Map);T(this,"updateQueue",new Set);T(this,"updater",(0,yl.debounce)(async()=>{let n=[...this.updateQueue.values()];this.updateQueue.clear(),n.length!==0&&(await Promise.all(n.map(r=>n6(r,this.plugin).then(i=>{i?this.update(r,i):this.remove(r.path)}))),this.updateQueue.size>0&&this.updater())},500));T(this,"requestNotify",(0,yl.debounce)(()=>this.notify(),500));this.app=n.app}get(n){return n?this.mediaToPlaylistIndex.get(Ct(n))??SE:SE}onResolve(){this.mediaToPlaylistIndex.clear();for(let n of Mh(this.app.vault.getRoot()))n.extension==="md"&&this.requestUpdate(n);this.registerEvent(this.app.metadataCache.on("changed",n=>{this.requestUpdate(n)})),this.registerEvent(this.app.metadataCache.on("deleted",n=>{this.remove(n.path)})),this.registerEvent(this.app.vault.on("rename",(n,r)=>{if(!(n instanceof yl.TFile))return;let i=this.listFileCache.get(r);i&&(this.remove(r),this.update(n,i))}))}remove(n){let r=this.listFileCache.get(n);if(r){this.listFileCache.delete(n);for(let i of this.mediaToPlaylistIndex.keys()){let a=this.mediaToPlaylistIndex.get(i).filter(s=>!this.listVariantMap.has(s)||this.listVariantMap.get(s)!==r);a.length===0?this.mediaToPlaylistIndex.delete(i):this.mediaToPlaylistIndex.set(i,a)}this.requestNotify()}}requestUpdate(n){this.updateQueue.add(n),this.updater()}notify(){this.app.metadataCache.trigger("mx:playlist-change")}update(n,r){this.remove(n.path),this.listFileCache.set(n.path,r);let i=new Set;r.list.forEach(o=>{let{media:a}=o;if(!a)return;let s=Ct(a);if(i.has(s))return;let l=this.mediaToPlaylistIndex.get(s)??[],c={...r,active:r.list.findIndex(u=>u.media&&s===Ct(u.media))};this.listVariantMap.set(c,r),this.mediaToPlaylistIndex.set(s,[...l,c]),i.add(s)}),this.requestNotify()}onload(){Ow(this.app.metadataCache,this).then(()=>{this.onResolve()}),this.plugin.addCommand({id:"playlist-export",name:"Export current playlist to m3u8 file",editorCheckCallback:(n,r,i)=>{if(!i.file||!this.listFileCache.has(i.file.path))return!1;if(n)return!0;EP(this.listFileCache.get(i.file.path),this.app.vault)}}),this.registerEvent(this.app.workspace.on("file-menu",(n,r,i)=>i==="more-options"&&this.listFileCache.has(r.path)&&n.addItem(o=>o.setTitle("Export to m3u8...").setIcon("file-down").setSection("action").onClick(()=>{EP(this.listFileCache.get(r.path),this.app.vault)}))))}};var r6=require("obsidian"),i6=$(xc());var D1=$(ie()),kb=class extends r6.Component{constructor(n,r,i,o){super();this.info=n;this.file=r;this.subpath=i;this.plugin=o;T(this,"store");T(this,"root",null);T(this,"containerEl");this.containerEl=n.containerEl,this.store=Ba(o);let{containerEl:a}=n;a.addClasses(["mx","mx-media-embed","custom"]);function s(l){if(!(l instanceof Element))return!1;let c=l.closest("button");return c?c.hasAttribute(qi):!1}this.registerDomEvent(a,"click",l=>{s(l.target)||l.stopImmediatePropagation()})}get player(){return this.store.getState().player}getMediaInfo(){return Si(this.file,this.subpath)}render(){this.root?.unmount(),this.root=i6.default.createRoot(this.info.containerEl),this.root.render((0,D1.jsx)(cn.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!0},children:(0,D1.jsx)(Ya,{})}))}onload(){super.onload(),this.render()}async loadFile(){await this.store.getState().loadFile(this.file,{vault:this.plugin.app.vault,subpath:this.subpath})}onunload(){this.root?.unmount(),this.root=null,super.onunload()}};function o6(t,e){let n=e.muted;t.addItem(r=>r.setSection("mx-player").setIcon(n?"volume-2":"volume-x").setTitle(n?"Unmute":"Mute").onClick(()=>{e.muted=!n}))}function a6(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())))}var _r=require("obsidian");jh();var b6=require("obsidian");function w6(t){let e=b6.moment.utc(0);return e.add(t,"seconds"),e.format("HH:mm:ss.SSS")}var H1={"&":"&","<":"<",">":">","=":"=",":":":"},Rae=new RegExp(`[${gx(Object.keys(H1).join(""))}]`,"g"),_6=Object.fromEntries(Object.entries(H1).map(([t,e])=>[e,t])),$ae=new RegExp(`(${Object.keys(_6).map(gx).join("|")})`,"g");function Iae(t){return t=t.replace(/-->/g,""),t.replaceAll(Rae,e=>H1[e])}function Lae(t){return t.replaceAll($ae,e=>_6[e])}function k6({cues:t,metadata:e={},regions:n=[]},r={}){let i=[...Object.entries({...e,...r}).map(([s,l])=>l?`${s}: ${Iae(l)}`:void 0).filter(s=>!!s),""],o=t.flatMap(s=>{let{id:l,startTime:c,endTime:u,text:d}=s;return[l,`${w6(c)} --> ${w6(u)}`,d,""]}),a=n.flatMap(s=>{let{id:l,...c}=s;return["REGION",`id:${l}`,...Object.entries(c).map(([u,d])=>`${u}:${d}`),""]});return["WEBVTT",...i,...o,...a].join(`
|
|
`)}async function W1(t,e){let n=await j1(t,e);return n.metadata=hE(n.metadata,r=>Lae(r)),n}function T6(t,e){if(e.tracks.local.length===0&&e.tracks.remote.length===0)return;let n=[...e.tracks.local.map(r=>({...r,_type:"local"})),...e.tracks.remote.map(r=>({...r,_type:"remote"}))];t.addItem(r=>{let i=r.setSection("view").setTitle("Open transcript").setIcon("subtitles").setSubmenu();n.sort(yE).forEach((o,a)=>{let s=o.label||pu(o.language)||o.wid||`${Gf(o.kind)} ${a+1}`;i.addItem(l=>l.setTitle(s).onClick(async()=>{if(o._type==="remote"){let c=await Aae(o,e);c&&e.plugin.app.workspace.openLinkText(c.path,"","split")}else o._type==="local"&&(o.src instanceof _r.TFile?e.plugin.app.vault.getFileByPath(o.src.path)&&e.plugin.app.workspace.openLinkText(o.src.path,"","split"):new _r.Notice("Remote track not yet supported"))}))})})}async function Aae({wid:t,language:e,label:n,kind:r},{source:i,plugin:o,player:a}){let s=a.provider;if(!(s instanceof yn)||!(i instanceof xt))return new _r.Notice("Cannot save transcript from this media"),null;try{let l=await s.media.methods.getTrack(t);if(!l)return new _r.Notice(`Failed to save transcript: track ${t} not found`),null;let c=k6(l,{Source:i.jsonState.source,Title:Ao(i,a),Language:e,Label:n}),u=hu([Ao(i).replace(/\s+/gu,"").toLowerCase(),t.replaceAll(".","_"),e,"vtt"].filter(Boolean).join(".")).replaceAll(/_+-+|-+_+/gu,"-").replaceAll(/-{2,}/gu,"-").replaceAll(/_{2,}$/gu,"_"),d=await o.mediaNote.getNote(i,a),p=await Sx(o.settings.getState().subtitleFolderPath,{plugin:o,sourcePath:d.path}),f=(0,_r.normalizePath)(`${p.path}/${u}`),h=o.app.vault.getFileByPath(f);h?await o.app.vault.modify(h,c):h=await o.app.vault.create(f,c),new _r.Notice(`Transcript saved to ${h.path}`);let{fileManager:g}=o.app,x=(n||e||t).trim(),m=g.generateMarkdownLink(h,d.path,`#wid=${encodeURIComponent(t)}`,x).replace(/^!/u,""),y=Xf[r],v=w=>typeof w=="string";return await o.app.fileManager.processFrontMatter(d,w=>{let k=[];if(y.plural in w){let S=w[y.plural];if(!S)k=[];else if(Array.isArray(S)&&S.every(v))k=S;else{new _r.Notice(`Failed to save transcript: field \`${y.plural}\` in note ${d.path} is not an array of strings, you may need to fix it manually.`),console.log("EXISTING",S);return}}else if(y.singular in w){let S=w[y.singular];if(!S)k=[];else if(v(S))k=[S];else{new _r.Notice(`Failed to save transcript: field \`${y.singular}\` in note ${d.path} is not a string, you may need to fix it manually.`);return}}let b=kx([...k.filter(S=>{let C=S.match(/#wid=(?<wid>[^&|)\]]+)/u);return C?C.groups.wid!==t:!0}),m]);b.length===1?(delete w[y.plural],w[y.singular]=m):(delete w[y.singular],w[y.plural]=b)}),h}catch(l){return console.error("Failed to save transcript",l),l instanceof Error?new _r.Notice(`Failed to save transcript: ${l.message}`):new _r.Notice("Failed to save transcript, for details see console."),null}}function S6(t,{setTransform:e,transform:n}){let r=t.setTitle("Transform").setIcon("rotate-3d").setSection("mx-player").setSubmenu();(n?.flipHorizontal||n?.flipVertical||n?.rotate)&&r.addItem(i=>i.setIcon("reset").setTitle("Reset").onClick(()=>e(null))),r.addItem(i=>i.setTitle("Flip horizontally").setIcon("flip-horizontal").setChecked(!!n?.flipHorizontal).onClick(()=>e({flipHorizontal:!n?.flipHorizontal}))).addItem(i=>i.setTitle("Flip vertically").setIcon("flip-vertical").setChecked(!!n?.flipVertical).onClick(()=>e({flipVertical:!n?.flipVertical}))).addSeparator().addItem(i=>i.setChecked(n?.rotate==="180").setIcon("iteration-cw").setTitle("Rotate 180\xB0").onClick(()=>{e({rotate:n?.rotate==="180"?void 0:"180"})}))}var q1=require("obsidian");function E6(t,{source:e,plugin:n,viewType:r,player:i}){if(Se(e))return;if(e.isFileUrl){Jw(e,t);return}let o=e.jsonState.source,a=e.print({start:i.currentTime,end:-1});t.addItem(u=>u.setTitle("Copy URL").setIcon("copy").setSection("action").onClick(()=>{navigator.clipboard.writeText(o),new q1.Notice("URL copied to clipboard")})),a!==o&&t.addItem(u=>u.setTitle("Copy URL with timestamp").setIcon("copy-check").setSection("action").onClick(()=>{navigator.clipboard.writeText(a),new q1.Notice("URL with timestamp copied")})),t.addItem(u=>u.setTitle("Open in default browser").setIcon("globe").setSection("view").onClick(()=>{window.open(a)}));let s=n.urlViewType.getSupported(e),l=r,c=s.filter(u=>u!==l);Lh(t,{mode:"always",open:!1,url:e,plugin:n,targetViewTypes:c})}function P6(t,{controls:e=!0,toggleControls:n,player:r,source:i,disableWebFullscreen:o,toggleWebFullscreen:a},s){r.provider instanceof yn&&s==="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)})}),i.type!=="bilibili"&&i.type!=="youtube"&&t.addItem(l=>{l.setTitle(o?"Enable in-player fullscreen":"Disable in-player fullscreen").setSection("mx-web-player").setIcon(o?"maximize":"minimize").onClick(()=>{a(!!o)})}))}function K1(){x5(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("action").setIcon("reset").onClick(()=>{e.reload()})),n!=="sidebar-context-menu"&&n!=="tab-header"?(t.addItem(i=>rR(i,e.player)),e.player.state.viewType==="video"&&(t.addItem(i=>S6(i,e)),a6(t,e.player))):o6(t,e.player),n==="player-menu-embed"){let i=e.source;t.addItem(o=>o.setTitle("Open to the right").setIcon("separator-vertical").setSection("open").onClick(()=>{this.leafOpener.openMedia(i,"split")})).addItem(o=>o.setTitle("Open in new tab").setSection("open").setIcon("file-plus").onClick(()=>{this.leafOpener.openMedia(i,"tab")})).addItem(o=>o.setTitle("Open in new window").setSection("open").setIcon("maximize").onClick(()=>{this.leafOpener.openMedia(i,"window")}))}P6(t,e,n),(n==="player-menu-embed"||n==="more-options")&&(T6(t,e),t.addItem(i=>i.setTitle("Open media note").setIcon("book").setSection("view").onClick(async()=>{await e.plugin.leafOpener.openNote(await e.plugin.mediaNote.getNote(e.source,e.player),"split")})),E6(t,e));let r=e.player.provider;(n==="player-menu-embed"||n==="more-options"||n==="sidebar-context-menu")&&Js(r)&&t.addItem(i=>i.setTitle("Copy Screenshot").setSection("action").setIcon("focus").onClick(()=>{ih({app:this.app,media:e.source,provider:r,settings:this.settings.getState(),state:e.player.state})}))}))}var Oae=/^(?<x>\d+)?x(?<y>\d+)$|^(?<xOnly>\d+)$/;function C6(t){let e=parseInt(t,10);return Number.isNaN(e)?-1:e}var M6=t=>{let e=t?.match(Oae)?.groups;if(!e)return null;let n=C6(e.xOnly??e.x),r=C6(e.y);return[n,r]},qh=t=>{let e=t.lastIndexOf("|"),n,r=t;return e===-1?(n=M6(t),n&&(r="")):(n=M6(r.substring(e+1)),n&&(r=r.substring(0,e))),{title:r,size:n}};function Rb(t,{title:e,size:n}){e?t.setAttr("alt",e):t.removeAttribute("alt");let r=(i,o)=>{o<0?t.style.removeProperty(i):t.style[i]=`${o}px`};n?(r("width",n[0]),r("height",n[1])):(r("width",-1),r("height",-1))}var R6=require("obsidian"),$6=$(xc());var G1=$(ie()),Yu=class extends R6.MarkdownRenderChild{constructor(n,r){super(n);this.containerEl=n;this.plugin=r;T(this,"store");T(this,"root",null);this.store=Ba(r),n.addClasses(["mx","custom","mx-media-embed"])}get player(){return this.store.getState().player}getMediaInfo(){return this.store.getState().source?.url??null}async setSource(n,r={}){let i=this.plugin.urlViewType.getPreferred(n);this.store.getState().setSource(n,{title:r.title??!0,hash:r.hash,viewType:i,textTracks:await this.plugin.transcript.getTracks(n).catch(o=>(console.error("Failed to get text tracks",o,n.href),[]))})}render(){this.root?.unmount(),this.root=$6.default.createRoot(this.containerEl),this.root.render((0,G1.jsx)(cn.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),embed:!0},children:(0,G1.jsx)(Ya,{})}))}onload(){super.onload(),this.render()}onunload(){this.root?.unmount(),this.root=null,super.onunload()}};var A6=require("@codemirror/state"),Qu=require("@codemirror/view"),Xu=require("obsidian");var Ib=require("@codemirror/language"),nC=require("@codemirror/view");var I6=t=>!(!t.startsWith("./")&&!t.startsWith("../"))||t.indexOf(":")===-1;var eC=require("@codemirror/view"),tC=require("obsidian");var Y1=class extends Yu{constructor(n,r){super(n,r);this.containerEl=n;this.plugin=r;n.addClasses(["mx-external-media-embed"]);function i(o){if(!(o instanceof Element))return!1;let a=o.closest("button");return a?a.hasAttribute(qi):!1}this.registerDomEvent(n,"click",o=>{i(o.target)||o.stopImmediatePropagation()})}},$b=class t extends eC.WidgetType{constructor(n,r,i){super();this.message=n;this.start=r;this.end=i}toDOM(n){let r=document.createElement("div");return this.hookClickHandler(n,r),r.className="external-embed mx-external-media-embed mx-invalid-notice",r.createEl("p",{text:this.message}),r}eq(n){return n instanceof t&&n.message===this.message}updateDOM(n){return n.textContent!==this.message?(n.empty(),n.createEl("p",{text:this.message}),!0):!1}hookClickHandler(n,r){r.addEventListener("click",i=>{i.defaultPrevented||(this.selectElement(n,r),i.preventDefault())})}selectElement(n,r){let i=r.playerInfo,{start:o}=i??this,{end:a}=i??this;try{if(o<0||a<0){let s=n.posAtDOM(r);n.dispatch({selection:{head:s,anchor:s}}),n.focus()}else tC.Platform.isMobile&&(a=o),n.dispatch({selection:{head:o,anchor:a}}),n.focus()}catch{}}},xl=class extends eC.WidgetType{constructor(n,r,i,o,a){super();this.plugin=n;this.media=r;this.title=i;this.start=o;this.end=a}setPos(n){let r=n.playerInfo;r&&(r.start=this.start,r.end=this.end)}hookClickHandler(n,r){r.on("click","button.mx-lp-edit",i=>{i.defaultPrevented||(this.selectElement(n,r),i.preventDefault())})}selectElement(n,r){let i=r.playerInfo,{start:o}=i??this,{end:a}=i??this;try{if(o<0||a<0){let s=n.posAtDOM(r);n.dispatch({selection:{head:s,anchor:s}}),n.focus()}else tC.Platform.isMobile&&(a=o),n.dispatch({selection:{head:o,anchor:a}}),n.focus()}catch{}}resizeWidget(n,r){window.ResizeObserver&&new window.ResizeObserver(()=>n.requestMeasure()).observe(r,{box:"border-box"})}setInfo(n,r){n.playerInfo={title:this.title,start:this.start,end:this.end,child:r,url:this.media}}updateDOM(n){let r=n.playerInfo;if(!r)return!1;let{title:i}=r;return this.media.compare(r.url)?this.title!==i&&(r.title=this.title,this.applyTitle(n),this.setPos(n)):r.child.setSource(this.media),!0}destroy(n){let r=n.playerInfo;r&&(delete n.playerInfo,r.child.unload())}eq(n){return this.media.compare(n.media)&&this.title===n.title}setDOM(n,r){r.tabIndex=-1,this.applyTitle(r);let i=new Y1(r,this.plugin);i.setSource(this.media),i.load(),this.hookClickHandler(n,r),this.setInfo(r,i),this.resizeWidget(n,r)}applyTitle(n){Rb(n,qh(this.title))}toDOM(n){let r=createDiv();return r.style.display="none",r.setAttr("src",this.media.source.href),r.addClasses(["external-embed","cm-embed-block","mx-media-embed"]),r.style.removeProperty("display"),this.setDOM(n,r),r}};Object.defineProperty(xl.prototype,"estimatedHeight",{get:()=>100,enumerable:!1,configurable:!0});var Q1=class extends xl{constructor(){super(...arguments);T(this,"enableWebview",!1)}},X1=class extends xl{constructor(){super(...arguments);T(this,"enableWebview",!1)}},Z1=class extends xl{constructor(){super(...arguments);T(this,"enableWebview",!1)}},J1=class extends xl{constructor(){super(...arguments);T(this,"enableWebview",!0)}},L6={"mx-url-audio":X1,"mx-url-video":Q1,"mx-embed":Z1,"mx-webpage":J1};var Fae=(t,e,n,r,i)=>{let o=e.doc,a=null;(0,Ib.syntaxTree)(e).iterate({from:r,to:i,enter:({type:l,from:c,to:u})=>{let d=new Set(l.prop(Ib.tokenClassNodeProp)?.split(" "));if(d.size===0)return;if(d.has("image-marker")){a={imgMarkLoc:c};return}if(!a)return;if(d.has("image-alt-text")&&!d.has("formatting")){a.alt=o.sliceString(c,u);return}if(d.has("url")&&!d.has("formatting")){a.url=o.sliceString(c,u);return}if(!(d.has("formatting")&&a.url))return;let{imgMarkLoc:p,alt:f,url:h}=a;if(a=null,I6(h))return;let g=t.resolveUrl(h);if(g){if(Se(g)){let x=t.app.metadataCache.fileToLinktext(g.file,"");s(new $b(`Please use internal embed in favor of file url embed: ![[${x}]]`,p,u),p,u)}else if(Du(g,t)){let x=t.urlViewType.getPreferred(g),m=new L6[x](t,g,f??"",p,u);s(m,p,u)}}}});function s(l,c,u){let{from:p,text:f}=o.lineAt(c);f.substring(0,c-p).trim()===""&&f.substring(u-p).trim()===""?n.push(nC.Decoration.widget({widget:l,block:!0,side:-1}).range(p)):n.push(nC.Decoration.widget({widget:l,side:-1}).range(c))}},rC=Fae;var Dae=(t,e)=>Lb(t,e[0])||Lb(t,e[1]),Lb=(t,e)=>t[0]<e&&t[1]>e,Nae=(t,e)=>{let n=Lb(t,e[0])?t[0]:e[0],r=Lb(t,e[1])?t[1]:e[1];return[n,r]};function iC(t){return t.sort((e,n)=>e[0]-n[0]).reduce((e,n)=>{let r=e.findIndex(i=>Dae(i,n));return r!==-1?e[r]=Nae(e[r],n):e.push(n),e},[])}var Vae=t=>{let e=n=>{if(n.field(Xu.editorLivePreviewField)){let r=[];return rC(t,n,r),Qu.Decoration.set(r)}else return Qu.Decoration.none};return A6.StateField.define({create:e,update:(n,r)=>{let i=r.startState.field(Xu.editorLivePreviewField),o=r.state.field(Xu.editorLivePreviewField);if(i!==o)return e(r.state);if(!o)return Qu.Decoration.none;if(!r.docChanged)return n;if(r.state.field(Xu.editorEditorField).composing)return n.map(r.changes);n=n.map(r.changes);let a=[];r.changes.iterChangedRanges((l,c,u,d)=>{a.push([r.state.doc.lineAt(u).number,r.state.doc.lineAt(d).number])});let s=[];for(let[l,c]of iC(a)){let{from:u}=r.state.doc.line(l),{to:d}=r.state.doc.line(c);n=n.update({filterFrom:u,filterTo:d,filter:()=>!1}),rC(t,r.state,s,u,d)}return n.update({add:s,sort:!0})},provide:n=>Qu.EditorView.decorations.from(n)})},O6=Vae;function oC(t){t.registerEditorExtension(O6(t)),Uae(t)}var zae=["cm-line","cm-content"],F6="mxError";function D6(t){if(!t.parentElement)return!1;let e=t.parentElement;return zae.some(n=>e.classList.contains(n))}function N6(){D6(this)&&(this.dataset[F6]="",this.removeEventListener("load",V6))}function V6(){D6(this)&&(delete this.dataset[F6],this.removeEventListener("error",N6))}function Uae(t){t.register(yt(window,{createEl:e=>function(){let n=e.apply(this,arguments);return n instanceof HTMLImageElement&&(n.addEventListener("error",N6,{once:!0}),n.addEventListener("load",V6,{once:!0})),n}}))}var Bae=require("obsidian");function z6(t,e){let{app:n}=e;return new Promise(r=>{function i(){let o=n.workspace.getLeavesOfType(t)[0];return o?(r(o.view),!0):!1}n.workspace.onLayoutReady(()=>{if(i())return;let o=()=>{i()&&n.workspace.off("layout-change",o)};n.workspace.on("layout-change",o),e.register(()=>n.workspace.off("layout-change",o))})})}function Ab(t){return t.constructor.prototype}function aC(t){t.getLeavesOfType("markdown").forEach(async e=>{let n=e.getViewState();await e.setViewState({type:"empty"}),await e.setViewState(n)})}function lC(t){jae.call(this,t),Hae.call(this),oC(this)}function jae(t){let{app:e}=this;["video","audio"].forEach(i=>{let o=Go(i),a=r(o),s=n(o,t);this.register(()=>{s(),a()})}),aC(e.workspace),this.register(()=>{aC(e.workspace)});function n(i,o){return e.embedRegistry.registerExtensions(i,o),()=>{e.embedRegistry.unregisterExtensions(i)}}function r(i){let o=i.map(a=>e.embedRegistry.embedByExtension[a]);return e.embedRegistry.unregisterExtensions(i),()=>{i.forEach((a,s)=>{let l=o[s];l&&e.embedRegistry.registerExtension(a,l)})}}}var sC=class extends Yu{constructor(n,r,i){super(r,i);this.info=n;this.containerEl=r;this.plugin=i;r.addClasses(["mx-external-media-embed"])}onload(){this.setSource(this.info),super.onload()}};function Hae(){let t=this;this.registerMarkdownPostProcessor((e,n)=>{for(let i of e.querySelectorAll("img")){let o=Wae(i);o&&r(o,i)}for(let i of e.querySelectorAll('iframe.external-embed[src*="youtube.com/embed/"]')){let o=n.getSectionInfo(i)?.text,a=qae(o)??Kae(i);!a||!this.resolveUrl(a.url)||r(a,i)}function r(i,o){let a=t.resolveUrl(i.url);if(!a||Se(a)||!Du(a,t))return;let s=createDiv({cls:["media-embed","external-embed","is-loaded"],attr:{src:a.href}});Rb(s,i),o.replaceWith(s);let l=new sC(a,s,t);n.addChild(l)}})}function Wae(t){let e=t.alt,n=t.src;return n?{url:n,...qh(e)}:null}function qae(t){if(!t)return null;let e=t.match(/!\[(?<alt>[^\]]*)\]\((?<src>[^)]+)\)/);if(!e)return null;let{alt:n,src:r}=e.groups;return r?{url:r,...qh(n)}:null}function Kae(t){console.warn("cannot get source text of iframe, use src instead");let e=t.src;return e?{url:e,title:Cx(e),size:null}:null}function cC({onExternalLinkClick:t}){let e=this;return z6("markdown",e).then(n=>{if(!n.editMode){console.error("MarkdownView.editMode is not available, cannot patch editor click");return}e.register(yt(Ab(n.editMode),{triggerClickableToken:r=>async function(i,o,...a){let s=()=>r.call(this,i,o,...a);if(t&&i.type==="external-link")try{await t.call(e,i.text,na(o),s)}catch(l){console.error("onExternalLinkClick error in editor, fallback to default",l),s()}else s()}})),console.debug("editor click patched")})}var U6=require("obsidian");function uC(){let t=n=>{let r=n.target;if(!r.instanceOf(HTMLElement)||!r.matches(".metadata-property .metadata-property-value .external-link"))return;let i=r.closest(".metadata-property");if(!i)return;let o=i.dataset.propertyKey;if(!i3.includes(o))return;let a=this.resolveUrl(r.textContent);a&&(n.stopImmediatePropagation(),this.leafOpener.openMedia(a,Bl(n),{fromUser:!0}))},e=yt(U6.MarkdownView.prototype,{onload:n=>function(){return this.registerDomEvent(this.containerEl,"click",t,{capture:!0}),n.call(this)}});this.register(()=>{e(),this.app.workspace.getLeavesOfType("markdown").forEach(n=>n.view.containerEl.removeEventListener("click",t))})}var B6=require("obsidian");function dC({onInternalLinkClick:t}){let e=this;this.register(yt(B6.Workspace.prototype,{openLinkText:n=>async function(r,i,o,a,...s){let l=()=>n.call(this,r,i,o,a,...s);try{await t.call(e,r,i,na(o),l)}catch(c){console.error("onInternalLinkClick error in openLinktext, fallback to default",c),l()}}}))}function pC(){this.registerMarkdownPostProcessor(t=>t.querySelectorAll("a").forEach(e=>{let n=e.getAttr("aria-label");if(n)try{let r=decodeURI(n);n!==r&&e.setAttr("aria-label",r)}catch{}}))}var j6=require("obsidian");function fC(t){let e=this,n=yt(j6.MarkdownPreviewRenderer,{registerDomEvents:r=>function(i,o,...a){return Gae(o,t,e),n(),console.debug("preview click patched"),r.call(this,i,o,...a)}});e.register(n)}function Gae(t,{onExternalLinkClick:e},n){n.register(yt(Ab(t),{onExternalLinkClick:r=>async function(i,o,a,...s){let l=()=>r.call(this,i,o,a,...s);if(!e)return l();i.preventDefault();try{await e.call(n,a,Bl(i),l)}catch(c){console.error("onExternalLinkClick error in preview, fallback to default",c),l()}}}))}function hC(t,e,n){let{app:r}=this;this.registerView(t,e),this.register(i(n)),this.registerExtensions(n,t);function i(o){let a=o.map(s=>({ext:s,type:r.viewRegistry.typeByExtension[s]}));return r.viewRegistry.unregisterExtensions(o),()=>{Yae(a,"type").forEach((s,l)=>{l&&r.viewRegistry.registerExtensions(s.map(c=>c.ext),l)})}}}function Yae(t,e){return t.reduce((n,r)=>{let i=r[e],o=n.get(i);return o?o.push(r):n.set(i,[r]),n},new Map)}var H6=require("obsidian");function W6(t){return t?(t=t instanceof URL?t:rr(t),H6.Platform.isWin||!t||t.protocol!=="file:"||!t.pathname.includes("%5C")||(t.pathname=t.pathname.replaceAll(/%5C/g,"/")),t):null}var J6=$(hd()),Tt=require("obsidian");var q6=()=>(...t)=>t;var K6=require("obsidian");var G6={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 mC(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 Y6=q6()("defaultVolume","urlMappingData","devices","defaultMxLinkClick","linkHandler","speedStep","loadStrategy","timestampTemplate","screenshotTemplate","screenshotEmbedTemplate","insertBefore","timestampOffset","biliDefaultQuality","screenshotFormat","screenshotQuality","enableSubtitle","defaultLanguage","screenshotFolderPath","subtitleFolderPath"),Q6={defaultVolume:80,urlMappingData:[],devices:[],defaultMxLinkClick:{click:"split",alt:"window"},linkHandler:{"mx-embed":[],"mx-url-audio":[],"mx-url-video":[],"mx-webpage":[]},enableSubtitle:!1,loadStrategy:"eager",timestampTemplate:`
|
|
- {{TIMESTAMP}} `,screenshotEmbedTemplate:"{{TITLE}}{{DURATION}}|50",screenshotTemplate:`
|
|
- !{{SCREENSHOT}} {{TIMESTAMP}} `,insertBefore:!1,timestampOffset:0,biliDefaultQuality:80,screenshotFormat:"image/webp",speedStep:.1};function X6(){return Tt.Platform.isDesktopApp?require("os").hostname()||(Tt.Platform.isMacOS?"Mac":Tt.Platform.isWin?"Windows":Tt.Platform.isLinux?"Linux":"Desktop"):Tt.Platform.isIosApp?Tt.Platform.isPhone?"iPhone":Tt.Platform.isTablet?"iPad":"iOS Device":Tt.Platform.isAndroidApp?Tt.Platform.isPhone?"Android Phone":Tt.Platform.isTablet?"Android Tablet":"Android Device":"Unknown Device"}function Z6(t){return new Map(t.map(e=>[`${e.appId}%${e.protocol}`,e.replace]))}function Qae(t){return Array.from(t.entries()).map(([e,n])=>{let[r,i]=e.split("%");return{appId:r,protocol:i,replace:n}}).filter(e=>e.appId&&e.protocol&&e.replace)}function eU(t){let e=(0,Tt.debounce)(n=>{let r=n_(n,Y6);t.saveData({...r,urlMappingData:n.getUrlMappingData()})},1e3);return wc((n,r)=>({...em(Q6,["urlMappingData"]),setEnableSubtitle(i){n({enableSubtitle:i}),e(r())},setSpeedStep(i){i=Math.abs(i),i!==0&&(n({speedStep:i}),e(r()))},setScreenshotFormat(i){n({screenshotFormat:i}),e(r())},setScreenshotQuality(i){n({screenshotQuality:i??void 0}),e(r())},setDefaultLanguage(i){n({defaultLanguage:i?.format()}),e(r())},getDefaultLang(){let i=r().defaultLanguage,o=Tt.moment.locale();return i&&!Qf(i)?(new Tt.Notice(`Invalid language code detected in preferences: ${i}, reverting to ${o}.`),n({defaultLanguage:void 0}),e(r()),o):i??Tt.moment.locale()},getUrlMappingData(){return Qae(r().urlMapping)},setBiliDefaultQuality(i){n({biliDefaultQuality:i}),e(r())},setInsertPosition(i){n({insertBefore:i==="before"}),e(r())},setLinkHandler(i,o){n(a=>{let s={...a.linkHandler};for(let l of Object.keys(s)){let c=l;s[c]=s[c].filter(u=>typeof u=="string"?u!==i:typeof i=="string"||!Xae(u,i)),c===o&&(s[c]=[...s[c],i])}return{linkHandler:s}}),e(r())},setTimestampOffset(i){n({timestampOffset:i}),e(r())},setDefaultMxLinkBehavior:i=>{let o;i==="split"||i==="split-horizontal"?o="window":i==="window"?o="tab":i==="tab"?o="split":o=null,n({defaultMxLinkClick:{click:i,alt:o}}),e(r())},setTemplate(i,o){switch(i){case"screenshot":n({screenshotTemplate:o});break;case"screenshotEmbed":n({screenshotEmbedTemplate:o});break;case"timestamp":n({timestampTemplate:o});break;default:(0,J6.assertNever)(i)}e(r())},setMxLinkAltBehavior:i=>{n(({defaultMxLinkClick:o})=>({defaultMxLinkClick:{...o,alt:i}})),e(r())},urlMapping:Z6(Q6.urlMappingData),setDefaultVolume:i=>{n({defaultVolume:i}),e(r())},getUrlMapping:i=>r().urlMapping.get(`${t.app.appId}%${i}`),setUrlMapping:(i,o)=>{if(i.includes("%"))throw new Error("Protocol cannot contain %");let a=`${t.app.appId}%${i}`;n(s=>({urlMapping:new Map(s.urlMapping).set(a,o),devices:s.getDeviceName()?s.devices:[...s.devices,{appId:t.app.appId,name:X6()}]})),e(r())},removeUrlMapping:i=>{if(i.includes("%"))throw new Error("Protocol cannot contain %");n(o=>{let a=`${t.app.appId}%${i}`,s=new Map(o.urlMapping);return s.delete(a),{urlMapping:s}}),e(r())},getDeviceName(i=t.app.appId){return r().devices.find(o=>o.appId===i)?.name},getDeviceNameWithDefault(i=t.app.appId){let o=r().devices.find(a=>a.appId===i);return o?o.name:i===t.app.appId?X6():"Unknown Device"},setDeviceName(i,o=t.app.appId){n({devices:[...r().devices.filter(a=>a.appId!==o),{appId:o,name:i}]}),e(r())},setLoadStrategy:i=>{n({loadStrategy:i}),e(r())},setScreenshotFolder(i){i!==null?(i=(0,Tt.normalizePath)(i),i==="."?i="/":i.startsWith("./")&&(i=i.slice(2)),n({screenshotFolderPath:i})):n({screenshotFolderPath:void 0})},setSubtitleFolder(i){i!==null?(i=(0,Tt.normalizePath)(i),i==="."?i="/":i.startsWith("./")&&(i=i.slice(2)),n({subtitleFolderPath:i})):n({subtitleFolderPath:void 0})},load:async()=>{let i=await t.loadData();if(!i)return;let{urlMappingData:o,...a}=n_(i,Y6);n({...a,urlMapping:Z6(o??[])})},save:()=>{e(r())}}))}function Xae(t,e){let n=new Set([...Object.keys(t),...Object.keys(e)]);for(let r of n)if(t[r]!==e[r])return!1;return!0}var nU=require("url"),yC=$(mE()),pe=require("obsidian");var Fb=class extends pe.PluginSettingTab{constructor(n){super(n.app,n);T(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 pe.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 pe.Setting(n).setHeading().setName("This device").addText(s=>s.setPlaceholder(this.state.getDeviceNameWithDefault()).setValue(this.state.getDeviceName()??"").onChange(l=>this.state.setDeviceName(l))).addExtraButton(s=>s.setIcon("plus").setTooltip("Add new protocol").onClick(()=>{let l=new pe.Menu().addItem(c=>c.setIcon("link").setTitle("Link mapping").onClick(()=>{let u=i({protocol:"",replace:"https://"});r.insertAdjacentElement("afterbegin",u.settingEl)}));pe.Platform.isDesktopApp&&l.addItem(c=>c.setIcon("folder").setTitle("Folder mapping").onClick(async()=>{let u=(await _m().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=i({protocol:"",replace:(0,nU.pathToFileURL)(u).href});r.insertAdjacentElement("afterbegin",d.settingEl)})),Vl(s.extraSettingsEl,l)}));let r=n.createDiv({cls:"mx-protocol-list"}),i=s=>new pe.Setting(r).then(l=>{let c=s.protocol,u=new pe.TextComponent(l.controlEl).setPlaceholder("Protocol name").setValue(c).onChange(f=>{if(!f)return;let h=c;c=f,this.state.removeUrlMapping(h);let g=p.getValue();g&&this.state.setUrlMapping(f,g)}),d="Target URL prefix";if(s.devices){d="Configured in ";let f=s.devices.filter(h=>!!h).slice(0,2);f.length>0?(d+=f.join(", "),f.length<s.devices.length&&(d+=", ...")):(d+="unknown device",s.devices.length>1&&(d+="s"))}let p=new pe.TextComponent(l.controlEl).setPlaceholder(d).setValue(s.replace).onChange(f=>{u.getValue()&&this.state.setUrlMapping(u.getValue(),f)});u.inputEl.addClass("mx-protocol-input"),p.inputEl.addClass("mx-replace-input"),l.addExtraButton(f=>f.setIcon("trash").setTooltip(`Remove ${u.getValue()||"empty"} protocol`).onClick(()=>{this.state.removeUrlMapping(u.getValue()),l.settingEl.remove()}))}),o=this.state.getUrlMappingData();[...new Set(o.map(s=>s.protocol))].sort().forEach(s=>{i({protocol:s,devices:o.filter(l=>l.protocol===s&&l.appId!==this.plugin.app.appId).map(l=>this.state.devices.find(c=>c.appId===l.appId)?.name??null),replace:this.state.getUrlMapping(s)??""})})}linkOpen(){let{containerEl:n}=this;new pe.Setting(n).setHeading().setName("Link open").setDesc("Configure how links to media are opened");let r={default:"Default obsidian behavior",replace:"In current pane",split:"New pane on the right","split-horizontal":"New pane on the bottom",tab:"New tab",window:"New window"},i=c=>{switch(c){case"split":case"split-horizontal":return pe.Platform.isMacOS?"click holding \u2318+\u2325":"click holding Ctrl+Alt";case"window":return pe.Platform.isMacOS?"click holding \u2318+\u2325+\u21E7":"click holding Ctrl+Alt+Shift";case"tab":default:return pe.Platform.isMacOS?"click holding \u2318 or middle-click":"middle-click or click holding Ctrl"}},o=c=>c===null?"default":c===!1?"replace":c,a=c=>{switch(c){case"replace":return!1;case"split":case"tab":case"window":return c;case"split-horizontal":return"split-horizontal";default:return null}};new pe.Setting(n).setName("Default link click").setDesc("Configure how links to media are opened").addDropdown(c=>c.addOptions(r).setValue(o(this.state.defaultMxLinkClick.click)).onChange(u=>this.state.setDefaultMxLinkBehavior(a(u))).then(()=>this.sub((u,d)=>{u.defaultMxLinkClick.click!==d.defaultMxLinkClick.click&&c.setValue(o(u.defaultMxLinkClick.click))})));let s=new pe.Setting(n).setName("Altnernative behavior").addDropdown(c=>c.addOptions(r).setValue(o(this.state.defaultMxLinkClick.alt)).onChange(u=>this.state.setMxLinkAltBehavior(a(u))).then(()=>this.sub((u,d)=>{u.defaultMxLinkClick.alt!==d.defaultMxLinkClick.alt&&c.setValue(o(u.defaultMxLinkClick.alt))})));function l(c){let u=i(c);s.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 pe.Setting(n).setHeading().setName("Playback"),new pe.Setting(n).setName("Default volume").setDesc("The default volume for media files").addSlider(r=>r.setLimits(0,100,1).setValue(this.state.defaultVolume).onChange(this.state.setDefaultVolume).then(i=>{this.sub((o,a)=>{o.defaultVolume!==a.defaultVolume&&i.setValue(o.defaultVolume)})})).addText(r=>r.setValue(Zu(this.state.defaultVolume)).onChange(tU(this.state.setDefaultVolume)).then(i=>{Ob.call(i,0,100,1),i.inputEl.type="number",i.inputEl.style.textAlign="center",this.sub((o,a)=>{o.defaultVolume!==a.defaultVolume&&i.setValue(Zu(o.defaultVolume))})})).then(r=>r.controlEl.appendText("%")),new pe.Setting(n).setName("Load strategy").setDesc(createFragment(r=>{r.appendText("Configure when media embeds are loaded in the note"),r.createEl("br"),r.appendText("Useful if you want lazy load media embeds in a note when there are many of them")})).addDropdown(r=>r.addOption("eager","On note open").addOption("play","When interacted with").setValue(this.state.loadStrategy).onChange(i=>this.state.setLoadStrategy(i)))}subtitle(){let{containerEl:n}=this;new pe.Setting(n).setName("Enable subtitle by default").setDesc("Toggle subtitle on by default when available").addToggle(a=>a.setValue(this.state.enableSubtitle).onChange(this.state.setEnableSubtitle));let r="_follow_",i=V2(),o=Object.fromEntries(yC.default.getAllCodes().flatMap(a=>i.has(a)?[...i.get(a).values()]:[[a,yC.default.getNativeName(a)]]));new pe.Setting(n).setName("Default locale").setDesc("The default locale for subtitles").addDropdown(a=>a.addOption(r,"Follow obsidian locale").addOptions(o).setValue(this.state.defaultLanguage??r).onChange(s=>this.state.setDefaultLanguage(s===r?null:s))),new pe.Setting(n).setName("Speed step").setDesc("Configure the step for command to slightly increasing or decreasing playback speed").addSlider(a=>a.setLimits(.01,2,.01).setValue(this.state.speedStep).onChange(this.state.setSpeedStep).then(s=>{this.sub((l,c)=>{l.speedStep!==c.speedStep&&s.setValue(l.speedStep)})})).addText(a=>a.setValue(Zu(this.state.speedStep)).onChange(gC(this.state.setSpeedStep)).then(s=>{Ob.call(s,.01,2,.01),s.inputEl.type="number",s.inputEl.style.textAlign="center",this.sub((l,c)=>{l.speedStep!==c.speedStep&&s.setValue(Zu(l.speedStep))})})).then(a=>a.controlEl.appendText("x")),new pe.Setting(n).setName("Default location for downloaded subtitle").setDesc("Where subtitles from website are placed.").addDropdown(a=>a.addOptions({default:"In attachment folder",specific:"In the folder specified below"}).onChange(s=>{this.state.setSubtitleFolder(s==="specific"?"":null)})),new pe.Setting(n).setName("Subtitle folder path").setDesc("Place newly created subtitle files in this folder.").addText(a=>a.setPlaceholder("Example: folder 1/folder").setValue(this.state.subtitleFolderPath??"").onChange(this.state.setSubtitleFolder)).then(a=>{a.settingEl.style.display=this.state.subtitleFolderPath!==void 0?"":"none",this.sub((s,l)=>{typeof s.subtitleFolderPath!=typeof l.subtitleFolderPath&&(a.settingEl.style.display=s.subtitleFolderPath!==void 0?"":"none")})})}timestamp(){let{containerEl:n}=this;new pe.Setting(n).setHeading().setName("Timestamp"),new pe.Setting(n).setName("Timestamp template").setDesc(createFragment(r=>{r.appendText("The template used to insert timestamps."),r.createEl("br"),r.appendText("Supported placeholders: {{TIMESTAMP}}")})).addTextArea(r=>{r.setValue(this.state.timestampTemplate).onChange(i=>this.state.setTemplate("timestamp",i)),r.inputEl.rows=5,r.inputEl.cols=40}),new pe.Setting(n).setName("Timestamp offset").setDesc("Offset in seconds to add to the timestamp").addSlider(r=>r.setLimits(-10,10,.01).setValue(this.state.timestampOffset).onChange(this.state.setTimestampOffset).then(i=>{this.sub((o,a)=>{o.timestampOffset!==a.timestampOffset&&i.setValue(o.timestampOffset)})})).addText(r=>r.setValue(Zu(this.state.timestampOffset)).onChange(gC(this.state.setTimestampOffset)).then(i=>{Ob.call(i,-10,10,.01),i.inputEl.type="number",i.inputEl.style.textAlign="center",this.sub((o,a)=>{o.timestampOffset!==a.timestampOffset&&i.setValue(Zu(o.timestampOffset))})})).then(r=>r.controlEl.appendText("s"))}screenshot(){let{containerEl:n}=this;new pe.Setting(n).setHeading().setName("Screenshot"),new pe.Setting(n).setName("Screenshot linktext template").setDesc(createFragment(i=>{i.appendText("The template used to create screenshot linktext."),i.createEl("br"),i.appendText("Supported placeholders: {{DURATION}}, {{TITLE}}"),i.createEl("br"),i.appendText("Remove `|50` suffix to embed image in full size")})).addTextArea(i=>{i.setValue(this.state.screenshotEmbedTemplate).onChange(o=>this.state.setTemplate("screenshotEmbed",o)),i.inputEl.rows=5,i.inputEl.cols=40}),new pe.Setting(n).setName("Screenshot template").setDesc(createFragment(i=>{i.appendText("The template used to insert screenshot."),i.createEl("br"),i.appendText("Supported placeholders: "),i.createEl("ul",{},o=>{o.createEl("li").appendText("{{TIMESTAMP}} - timestamp link"),o.createEl("li",{},a=>{a.appendText("{{SCREENSHOT}} - link to screenshot"),a.createEl("br"),a.appendText("add `!` prefix to insert as image embed")})})})).addTextArea(i=>{i.setValue(this.state.screenshotTemplate).onChange(o=>this.state.setTemplate("screenshot",o)),i.inputEl.rows=5,i.inputEl.cols=40}),new pe.Setting(n).setName("Screenshot format").setDesc(createFragment(i=>{i.appendText("The format to use when taking screenshots"),i.createEl("br"),i.appendText("Note that the webp format falls back to jpeg in iOS or iPadOS")})).addDropdown(i=>i.addOptions({"image/png":"PNG","image/jpeg":"JPEG","image/webp":"WEBP"}).setValue(this.state.screenshotFormat).onChange(o=>this.state.setScreenshotFormat(o))),new pe.Setting(n).setName("Default location for new screenshots").setDesc("Where newly added attachments are placed.").addDropdown(i=>i.addOptions({default:"In attachment folder",specific:"In the folder specified below"}).onChange(o=>{this.state.setScreenshotFolder(o==="specific"?"":null)})),new pe.Setting(n).setName("Attachment folder path").setDesc("Place newly created screenshot files in this folder.").addText(i=>i.setPlaceholder("Example: folder 1/folder").setValue(this.state.screenshotFolderPath??"").onChange(this.state.setScreenshotFolder)).then(i=>{i.settingEl.style.display=this.state.screenshotFolderPath!==void 0?"":"none",this.sub((o,a)=>{typeof o.screenshotFolderPath!=typeof a.screenshotFolderPath&&(i.settingEl.style.display=o.screenshotFolderPath!==void 0?"":"none")})});let r=i=>i.screenshotFormat==="image/webp"?.8:.92;new pe.Setting(n).setName("Screenshot quality").setDesc("Quality of the screenshot").addText(i=>i.setValue(this.state.screenshotQuality?.toString()??"").setPlaceholder(r(this.state).toString()).onChange(gC(this.state.setScreenshotQuality)).then(o=>{Ob.call(o,0,1,.01),o.inputEl.type="number",o.inputEl.style.textAlign="center",this.sub((a,s)=>{a.screenshotFormat!==s.screenshotFormat&&o.setPlaceholder(r(this.state).toString()),a.screenshotQuality!==s.screenshotQuality&&o.setValue(a.screenshotQuality?.toString()??"")})})).addButton(i=>i.setTooltip("Reset to default").setIcon("reset").onClick(()=>{this.state.setScreenshotQuality(null)}).setDisabled(this.state.screenshotQuality===null).then(()=>{this.sub((o,a)=>{o.screenshotQuality!==a.screenshotQuality&&i.setDisabled(o.screenshotQuality===null)})})).then(i=>{this.sub((o,a)=>{o.screenshotFormat!==a.screenshotFormat&&(i.settingEl.style.display=o.screenshotFormat==="image/png"?"none":"")})})}noteTaking(){let{containerEl:n}=this;new pe.Setting(n).setHeading().setName("Note taking"),new pe.Setting(n).setDesc("Configure where timestamps and screenshots are inserted").setName("Insert location").addDropdown(r=>r.addOption("before","Latest content on top").addOption("after","Latest content at end").setValue(this.state.insertBefore===!0?"before":"after").onChange(i=>this.state.setInsertPosition(i))),this.timestamp(),this.screenshot()}webpage(){if(!pe.Platform.isDesktopApp)return;let{containerEl:n}=this;new pe.Setting(n).setHeading().setName("Webpage"),new pe.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(r=>r.setCta().setButtonText("Open broswer").onClick(()=>{new ta(this.app).open()}))}bilibili(){let{containerEl:n}=this;new pe.Setting(n).setHeading().setName("Bilibili"),new pe.Setting(n).setName("Default quality").setDesc(createFragment(r=>{r.appendText("The default quality for bilibili videos, will fallback to closest quality if not available"),r.createEl("br"),r.appendText("Only new videos will use this quality")})).addDropdown(r=>r.addOptions(G6).setValue(this.state.biliDefaultQuality.toString()).onChange(tU(i=>this.state.setBiliDefaultQuality(i))))}display(){let{containerEl:n}=this;n.empty(),this.webpage(),this.playback(),this.subtitle(),this.noteTaking(),this.linkOpen(),this.protocol(),this.bilibili()}};function tU(t){return e=>t(parseInt(e,10))}function gC(t){return e=>t(parseFloat(e))}function Zu(t){return t.toString()}function Ob(t,e,n){return this.inputEl.min=t.toString(),this.inputEl.max=e.toString(),this.inputEl.step=n.toString(),this}var sU=require("url"),lU=$(hd()),St=require("obsidian");var rU=require("obsidian");async function vC(t){if(!rU.Platform.isDesktopApp)throw new Error("Not supported in web");let e=await _m().showOpenDialog({title:"Pick a media file",message:"Pick a media file to open",buttonLabel:"Pick",properties:["openFile"],filters:[{extensions:Go("video"),name:"Video"},{extensions:Go("audio"),name:"Audio"}],defaultPath:t});return e.canceled?null:e.filePaths[0]??null}var iU=require("url"),oU=require("obsidian");var Db=class t extends oU.FuzzySuggestModal{constructor(n){super(n.app);this.plugin=n;T(this,"resolve",gp)}static choose(n){return new Promise(r=>{let i=new t(n);i.open(),i.resolve=r})}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,iU.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 Zae=/^av(?<id>\d+)$/i,Jae=/^BV1(?<id>[1-9A-HJ-NP-Za-km-z]{9})$/,ese=/^[\w-]{11}$/,tse=/^(?:(?:[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 xC(t){try{return(0,sU.pathToFileURL)(t)}catch(e){return console.error(`Failed to convert path ${t} to URL: `,e),null}}function aU(t){let e=en.isAbsolute(t)?xC(t):rr(t);return!e||["http:","https:"].includes(e.protocol)&&!tse.test(e.hostname)?null:e}var Nb=class extends St.SuggestModal{constructor(n){super(n.app);this.plugin=n;this.inputEl.addEventListener("drop",r=>{if(!r.dataTransfer||r.dataTransfer.files.length===0)return;let i=[...r.dataTransfer.files],o=[...r.dataTransfer.files].filter(l=>Ft(en.extname(l.name)));if(o.length===0){new St.Notice(`Cannot open dropped file${i.length>1?"s":""}, not supported media file type`);return}let a=o[0];r.preventDefault();let s=r.target;s.value=a.path,s.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:St.Platform.isMacOS?"\u2318 \u21B5":"ctrl \u21B5",purpose:"to open in new tab"},{command:St.Platform.isMacOS?"\u2318 \u2325 \u21B5":"ctrl alt \u21B5",purpose:"to open to the right"},{command:"esc",purpose:"to dismiss"}]),this.scope.register(null,"Enter",r=>(this.chooser.useSelectedItem(r),!1))}getSuggestions(n){let r=aU(n),i=[];if(!r){let s;if((s=n.match(Zae))&&i.push(new URL(`https://www.bilibili.com/video/av${s.groups.id}`)),(s=n.match(Jae))&&i.push(new URL(`https://www.bilibili.com/video/${n}`)),(s=n.match(ese))&&i.push(new URL(`https://www.youtube.com/watch?v=${n}`)),!s){let l=aU(`https://${n}`);l&&i.push(l)}}let o=i.map(s=>xt.create(s.href)).filter(s=>!!s),a=this.plugin.resolveUrl(r?.href);return a?[a,...o]:o}onNoSuggestion(){super.onNoSuggestion(),this.chooser.setSuggestions(["file-picker","file-protocol-picker"])}renderSuggestion(n,r){n instanceof xt?r.setText(decodeURI(n.href)):Se(n)?r.setText(n.file.path):n==="file-picker"?r.setText("Open local file"):n==="file-protocol-picker"?r.setText("Pick from folders defined in custom protocol"):(0,lU.assertNever)(n)}async onChooseSuggestion(n,r){let i;if(n==="file-protocol-picker"){let o=await Db.choose(this.plugin);if(!o)return;let a=await vC(o.path);if(!a)return;if(!a.startsWith(o.path)){new St.Notice(`For protocol ${o.action}, the file must be in ${o.path}`);return}let s=xC(a);if(!s)return;let l=this.plugin.resolveUrl(s.href.replace(o.url.replace(/\/*$/,"/"),`mx://${o.action}/`));if(!l){new St.Notice(`Failed to resolve file protocol url: ${s.href} with ${o.url}`);return}i=l}else if(n==="file-picker"){let o=await vC();if(!o)return;let a=xC(o);if(!a){new St.Notice("Failed to convert file path to URL: "+o);return}let s=this.plugin.resolveUrl(a);if(!s){new St.Notice("Failed to resolve file: "+o);return}i=s}else i=n;if(!Se(i)){if(i.isFileUrl){if(i.hostname){new St.Notice(`Network path is not supported in obsidian, you need to map it to a local path: ${i.filePath??i.readableHref}`);return}let o=ps();if(!o){new St.Notice("File path is only supported in desktop app");return}try{if(!(await o.stat(i)).isFile()){new St.Notice("Not a file: "+i.readableHref);return}}catch(a){let s=a,l=i.filePath??i.href;s.code==="ENOENT"?new St.Notice("File not found: "+l):s.code==="EACCES"?new St.Notice("Permission denied: "+l):new St.Notice(`Failed to access file (${s.code}): `+l);return}}}console.debug("media selected",i),St.Keymap.isModifier(r,"Mod")&&St.Keymap.isModifier(r,"Alt")?this.plugin.leafOpener.openMedia(i,"split",{direction:"vertical"}):St.Keymap.isModifier(r,"Mod")?this.plugin.leafOpener.openMedia(i,"tab"):this.plugin.leafOpener.openMedia(i,!1)}};var Kh=require("obsidian");var cU="mx-open";function uU(t){window.OBS_ACT&&t.register(yt(window,{OBS_ACT:r=>function(o){if(o.action.startsWith(cU+"/")){e(o);return}return r.apply(this,arguments)}})),t.registerObsidianProtocolHandler("mx-open",async r=>{let i=rr(r.url);if(!i){new Kh.Notice("Invalid URL: "+r.url);return}await n(i)});async function e(r){let i=r.action.substring(cU.length+1),o=rr(i),a=new URLSearchParams(r);if(a.delete("action"),!o){new Kh.Notice("Invalid URL: "+i+"?"+a.toString());return}o.search=a.toString(),await n(o)}async function n(r){let i=t.resolveUrl(r);if(!i){new Kh.Notice("Invail URL: "+r.href);return}new Kh.Notice(createFragment(o=>{o.appendText(`Opening ${i.type} from browser: `),o.createEl("br"),o.createEl("a",{text:r.href.length>50?r.href.slice(0,25)+"..."+r.href.slice(-25):r.href,href:r.href})})),await t.leafOpener.openMedia(i,"tab")}}function dU(t){function e(){new Nb(t).open()}t.addCommand({id:"open-media-switcher",name:"Open media",icon:"play",callback:e}),t.addRibbonIcon("play","Open media",e),uU(t)}var Gb=require("obsidian"),nB=$(xc());var tB=$(hd()),_l=$(K());var Ge=function(){return Ge=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Ge.apply(this,arguments)};function nse(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):i(u.value).then(s,l)}c((r=r.apply(t,e||[])).next())})}function rse(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function _e(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Et(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}var ise="ENTRIES",gU="KEYS",yU="VALUES",un="",wC=function(){function t(e,n){var r=e._tree,i=Array.from(r.keys());this.set=e,this._type=n,this._path=i.length>0?[{node:r,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Ju(this._path),n=e.node,r=e.keys;if(Ju(r)===un)return{done:!1,value:this.result()};var i=n.get(Ju(r));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},t.prototype.backtrack=function(){if(this._path.length!==0){var e=Ju(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var n=e.keys;return Ju(n)}).filter(function(e){return e!==un}).join("")},t.prototype.value=function(){return Ju(this._path).node.get(un)},t.prototype.result=function(){switch(this._type){case yU:return this.value();case gU:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),Ju=function(t){return t[t.length-1]},ose=function(t,e,n){var r=new Map;if(e===void 0)return r;for(var i=e.length+1,o=i+n,a=new Uint8Array(o*i).fill(n+1),s=0;s<i;++s)a[s]=s;for(var l=1;l<o;++l)a[l*i]=l;return vU(t,e,n,r,a,1,i,""),r},vU=function(t,e,n,r,i,o,a,s){var l,c,u=o*a;try{e:for(var d=_e(t.keys()),p=d.next();!p.done;p=d.next()){var f=p.value;if(f===un){var h=i[u-1];h<=n&&r.set(s,[t.get(f),h])}else{for(var g=o,x=0;x<f.length;++x,++g){for(var m=f[x],y=a*g,v=y-a,w=i[y],k=Math.max(0,g-n-1),b=Math.min(a-1,g+n),S=k;S<b;++S){var C=m!==e[S],R=i[v+S]+ +C,_=i[v+S+1]+1,D=i[y+S]+1,I=i[y+S+1]=Math.min(R,_,D);I<w&&(w=I)}if(w>n)continue e}vU(t.get(f),e,n,r,i,g,a,s+f)}}}catch(N){l={error:N}}finally{try{p&&!p.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},bC=function(){function t(e,n){e===void 0&&(e=new Map),n===void 0&&(n=""),this._size=void 0,this._tree=e,this._prefix=n}return t.prototype.atPrefix=function(e){var n,r;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=Et(zb(this._tree,e.slice(this._prefix.length)),2),o=i[0],a=i[1];if(o===void 0){var s=Et(MC(a),2),l=s[0],c=s[1];try{for(var u=_e(l.keys()),d=u.next();!d.done;d=u.next()){var p=d.value;if(p!==un&&p.startsWith(c)){var f=new Map;return f.set(p.slice(c.length),l.get(p)),new t(f,e)}}}catch(h){n={error:h}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}return new t(o,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,ase(this._tree,e)},t.prototype.entries=function(){return new wC(this,ise)},t.prototype.forEach=function(e){var n,r;try{for(var i=_e(this),o=i.next();!o.done;o=i.next()){var a=Et(o.value,2),s=a[0],l=a[1];e(s,l,this)}}catch(c){n={error:c}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.fuzzyGet=function(e,n){return ose(this._tree,e,n)},t.prototype.get=function(e){var n=EC(this._tree,e);return n!==void 0?n.get(un):void 0},t.prototype.has=function(e){var n=EC(this._tree,e);return n!==void 0&&n.has(un)},t.prototype.keys=function(){return new wC(this,gU)},t.prototype.set=function(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=_C(this._tree,e);return r.set(un,n),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=_C(this._tree,e);return r.set(un,n(r.get(un))),this},t.prototype.fetch=function(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=_C(this._tree,e),i=r.get(un);return i===void 0&&r.set(un,i=n()),i},t.prototype.values=function(){return new wC(this,yU)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var n,r,i=new t;try{for(var o=_e(e),a=o.next();!a.done;a=o.next()){var s=Et(a.value,2),l=s[0],c=s[1];i.set(l,c)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),zb=function(t,e,n){var r,i;if(n===void 0&&(n=[]),e.length===0||t==null)return[t,n];try{for(var o=_e(t.keys()),a=o.next();!a.done;a=o.next()){var s=a.value;if(s!==un&&e.startsWith(s))return n.push([t,s]),zb(t.get(s),e.slice(s.length),n)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return n.push([t,e]),zb(void 0,"",n)},EC=function(t,e){var n,r;if(e.length===0||t==null)return t;try{for(var i=_e(t.keys()),o=i.next();!o.done;o=i.next()){var a=o.value;if(a!==un&&e.startsWith(a))return EC(t.get(a),e.slice(a.length))}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},_C=function(t,e){var n,r,i=e.length;e:for(var o=0;t&&o<i;){try{for(var a=(n=void 0,_e(t.keys())),s=a.next();!s.done;s=a.next()){var l=s.value;if(l!==un&&e[o]===l[0]){for(var c=Math.min(i-o,l.length),u=1;u<c&&e[o+u]===l[u];)++u;var d=t.get(l);if(u===l.length)t=d;else{var p=new Map;p.set(l.slice(u),d),t.set(e.slice(o,o+u),p),t.delete(l),t=p}o+=u;continue e}}}catch(h){n={error:h}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}var f=new Map;return t.set(e.slice(o),f),f}return t},ase=function(t,e){var n=Et(zb(t,e),2),r=n[0],i=n[1];if(r!==void 0){if(r.delete(un),r.size===0)xU(i);else if(r.size===1){var o=Et(r.entries().next().value,2),a=o[0],s=o[1];wU(i,a,s)}}},xU=function(t){if(t.length!==0){var e=Et(MC(t),2),n=e[0],r=e[1];if(n.delete(r),n.size===0)xU(t.slice(0,-1));else if(n.size===1){var i=Et(n.entries().next().value,2),o=i[0],a=i[1];o!==un&&wU(t.slice(0,-1),o,a)}}},wU=function(t,e,n){if(t.length!==0){var r=Et(MC(t),2),i=r[0],o=r[1];i.set(o+e,n),i.delete(o)}},MC=function(t){return t[t.length-1]},Gh,RC="or",bU="and",sse="and_not",_U=function(){function t(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var n=e.autoVacuum==null||e.autoVacuum===!0?SC:e.autoVacuum;this._options=Ge(Ge(Ge({},TC),e),{autoVacuum:n,searchOptions:Ge(Ge({},pU),e.searchOptions||{}),autoSuggestOptions:Ge(Ge({},pse),e.autoSuggestOptions||{})}),this._index=new bC,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=CC,this.addFields(this._options.fields)}return t.prototype.add=function(e){var n,r,i,o,a,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,p=l.fields,f=l.idField,h=c(e,f);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(f,'"'));if(this._idToShortId.has(h))throw new Error("MiniSearch: duplicate ID ".concat(h));var g=this.addDocumentId(h);this.saveStoredFields(g,e);try{for(var x=_e(p),m=x.next();!m.done;m=x.next()){var y=m.value,v=c(e,y);if(v!=null){var w=u(v.toString(),y),k=this._fieldIds[y],b=new Set(w).size;this.addFieldLength(g,k,this._documentCount-1,b);try{for(var S=(i=void 0,_e(w)),C=S.next();!C.done;C=S.next()){var R=C.value,_=d(R,y);if(Array.isArray(_))try{for(var D=(a=void 0,_e(_)),I=D.next();!I.done;I=D.next()){var N=I.value;this.addTerm(k,g,N)}}catch(O){a={error:O}}finally{try{I&&!I.done&&(s=D.return)&&s.call(D)}finally{if(a)throw a.error}}else _&&this.addTerm(k,g,_)}}catch(O){i={error:O}}finally{try{C&&!C.done&&(o=S.return)&&o.call(S)}finally{if(i)throw i.error}}}}}catch(O){n={error:O}}finally{try{m&&!m.done&&(r=x.return)&&r.call(x)}finally{if(n)throw n.error}}},t.prototype.addAll=function(e){var n,r;try{for(var i=_e(e),o=i.next();!o.done;o=i.next()){var a=o.value;this.add(a)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.addAllAsync=function(e,n){var r=this;n===void 0&&(n={});var i=n.chunkSize,o=i===void 0?10:i,a={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,d,p){var f=u.chunk,h=u.promise;return f.push(d),(p+1)%o===0?{chunk:[],promise:h.then(function(){return new Promise(function(g){return setTimeout(g,0)})}).then(function(){return r.addAll(f)})}:{chunk:f,promise:h}},a),l=s.chunk,c=s.promise;return c.then(function(){return r.addAll(l)})},t.prototype.remove=function(e){var n,r,i,o,a,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,p=l.fields,f=l.idField,h=d(e,f);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(f,'"'));var g=this._idToShortId.get(h);if(g==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(h,": it is not in the index"));try{for(var x=_e(p),m=x.next();!m.done;m=x.next()){var y=m.value,v=d(e,y);if(v!=null){var w=c(v.toString(),y),k=this._fieldIds[y],b=new Set(w).size;this.removeFieldLength(g,k,this._documentCount,b);try{for(var S=(i=void 0,_e(w)),C=S.next();!C.done;C=S.next()){var R=C.value,_=u(R,y);if(Array.isArray(_))try{for(var D=(a=void 0,_e(_)),I=D.next();!I.done;I=D.next()){var N=I.value;this.removeTerm(k,g,N)}}catch(O){a={error:O}}finally{try{I&&!I.done&&(s=D.return)&&s.call(D)}finally{if(a)throw a.error}}else _&&this.removeTerm(k,g,_)}}catch(O){i={error:O}}finally{try{C&&!C.done&&(o=S.return)&&o.call(S)}finally{if(i)throw i.error}}}}}catch(O){n={error:O}}finally{try{m&&!m.done&&(r=x.return)&&r.call(x)}finally{if(n)throw n.error}}this._storedFields.delete(g),this._documentIds.delete(g),this._idToShortId.delete(h),this._fieldLength.delete(g),this._documentCount-=1},t.prototype.removeAll=function(e){var n,r;if(e)try{for(var i=_e(e),o=i.next();!o.done;o=i.next()){var a=o.value;this.remove(a)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new bC,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var n=this,r=this._idToShortId.get(e);if(r==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach(function(i,o){n.removeFieldLength(r,o,n._documentCount,i)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,n=e.minDirtFactor,r=e.minDirtCount,i=e.batchSize,o=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:o},{minDirtCount:r,minDirtFactor:n})}},t.prototype.discardAll=function(e){var n,r,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var o=_e(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.discard(s)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var n=this._options,r=n.idField,i=n.extractField,o=i(e,r);this.discard(o),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,n){var r=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=r._enqueuedVacuumConditions;return r._enqueuedVacuumConditions=CC,r.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},t.prototype.performVacuuming=function(e,n){return nse(this,void 0,void 0,function(){var r,i,o,a,s,l,c,u,d,p,f,h,g,x,m,y,v,w,k,b,S,C,R,_,D;return rse(this,function(I){switch(I.label){case 0:if(r=this._dirtCount,!this.vacuumConditionsMet(n))return[3,10];i=e.batchSize||PC.batchSize,o=e.batchWait||PC.batchWait,a=1,I.label=1;case 1:I.trys.push([1,7,8,9]),s=_e(this._index),l=s.next(),I.label=2;case 2:if(l.done)return[3,6];c=Et(l.value,2),u=c[0],d=c[1];try{for(p=(C=void 0,_e(d)),f=p.next();!f.done;f=p.next()){h=Et(f.value,2),g=h[0],x=h[1];try{for(m=(_=void 0,_e(x)),y=m.next();!y.done;y=m.next())v=Et(y.value,1),w=v[0],!this._documentIds.has(w)&&(x.size<=1?d.delete(g):x.delete(w))}catch(N){_={error:N}}finally{try{y&&!y.done&&(D=m.return)&&D.call(m)}finally{if(_)throw _.error}}}}catch(N){C={error:N}}finally{try{f&&!f.done&&(R=p.return)&&R.call(p)}finally{if(C)throw C.error}}return this._index.get(u).size===0&&this._index.delete(u),a%i!==0?[3,4]:[4,new Promise(function(N){return setTimeout(N,o)})];case 3:I.sent(),I.label=4;case 4:a+=1,I.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return k=I.sent(),b={error:k},[3,9];case 8:try{l&&!l.done&&(S=s.return)&&S.call(s)}finally{if(b)throw b.error}return[7];case 9:this._dirtCount-=r,I.label=10;case 10:return[4,null];case 11:return I.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var n=e.minDirtCount,r=e.minDirtFactor;return n=n||SC.minDirtCount,r=r||SC.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.getStoredFields=function(e){var n=this._idToShortId.get(e);if(n!=null)return this._storedFields.get(n)},t.prototype.search=function(e,n){var r,i;n===void 0&&(n={});var o=this.executeQuery(e,n),a=[];try{for(var s=_e(o),l=s.next();!l.done;l=s.next()){var c=Et(l.value,2),u=c[0],d=c[1],p=d.score,f=d.terms,h=d.match,g=f.length||1,x={id:this._documentIds.get(u),score:p*g,terms:Object.keys(h),queryTerms:f,match:h};Object.assign(x,this._storedFields.get(u)),(n.filter==null||n.filter(x))&&a.push(x)}}catch(m){r={error:m}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e===t.wildcard&&n.boostDocument==null&&this._options.searchOptions.boostDocument==null||a.sort(hU),a},t.prototype.autoSuggest=function(e,n){var r,i,o,a;n===void 0&&(n={}),n=Ge(Ge({},this._options.autoSuggestOptions),n);var s=new Map;try{for(var l=_e(this.search(e,n)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,p=u.terms,f=p.join(" "),h=s.get(f);h!=null?(h.score+=d,h.count+=1):s.set(f,{score:d,terms:p,count:1})}}catch(k){r={error:k}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}var g=[];try{for(var x=_e(s),m=x.next();!m.done;m=x.next()){var y=Et(m.value,2),h=y[0],v=y[1],d=v.score,p=v.terms,w=v.count;g.push({suggestion:h,terms:p,score:d/w})}}catch(k){o={error:k}}finally{try{m&&!m.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}return g.sort(hU),g},Object.defineProperty(t.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),t.loadJSON=function(e,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),n)},t.getDefault=function(e){if(TC.hasOwnProperty(e))return kC(TC,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,n){var r,i,o,a,s,l,c=e.index,u=e.documentCount,d=e.nextId,p=e.documentIds,f=e.fieldIds,h=e.fieldLength,g=e.averageFieldLength,x=e.storedFields,m=e.dirtCount,y=e.serializationVersion;if(y!==1&&y!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var v=new t(n);v._documentCount=u,v._nextId=d,v._documentIds=Vb(p),v._idToShortId=new Map,v._fieldIds=f,v._fieldLength=Vb(h),v._avgFieldLength=g,v._storedFields=Vb(x),v._dirtCount=m||0,v._index=new bC;try{for(var w=_e(v._documentIds),k=w.next();!k.done;k=w.next()){var b=Et(k.value,2),S=b[0],C=b[1];v._idToShortId.set(C,S)}}catch(se){r={error:se}}finally{try{k&&!k.done&&(i=w.return)&&i.call(w)}finally{if(r)throw r.error}}try{for(var R=_e(c),_=R.next();!_.done;_=R.next()){var D=Et(_.value,2),I=D[0],N=D[1],O=new Map;try{for(var j=(s=void 0,_e(Object.keys(N))),Q=j.next();!Q.done;Q=j.next()){var X=Q.value,xe=N[X];y===1&&(xe=xe.ds),O.set(parseInt(X,10),Vb(xe))}}catch(se){s={error:se}}finally{try{Q&&!Q.done&&(l=j.return)&&l.call(j)}finally{if(s)throw s.error}}v._index.set(I,O)}}catch(se){o={error:se}}finally{try{_&&!_.done&&(a=R.return)&&a.call(R)}finally{if(o)throw o.error}}return v},t.prototype.executeQuery=function(e,n){var r=this;if(n===void 0&&(n={}),e===t.wildcard)return this.executeWildcardQuery(n);if(typeof e!="string"){var i=Ge(Ge(Ge({},n),e),{queries:void 0}),o=e.queries.map(function(x){return r.executeQuery(x,i)});return this.combineResults(o,i.combineWith)}var a=this._options,s=a.tokenize,l=a.processTerm,c=a.searchOptions,u=Ge(Ge({tokenize:s,processTerm:l},c),n),d=u.tokenize,p=u.processTerm,f=d(e).flatMap(function(x){return p(x)}).filter(function(x){return!!x}),h=f.map(dse(u)),g=h.map(function(x){return r.executeQuerySpec(x,u)});return this.combineResults(g,u.combineWith)},t.prototype.executeQuerySpec=function(e,n){var r,i,o,a,s=Ge(Ge({},this._options.searchOptions),n),l=(s.fields||this._options.fields).reduce(function(X,xe){var se;return Ge(Ge({},X),(se={},se[xe]=kC(s.boost,xe)||1,se))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,p=s.bm25,f=Ge(Ge({},pU.weights),u),h=f.fuzzy,g=f.prefix,x=this._index.get(e.term),m=this.termResults(e.term,e.term,1,x,l,c,p),y,v;if(e.prefix&&(y=this._index.atPrefix(e.term)),e.fuzzy){var w=e.fuzzy===!0?.2:e.fuzzy,k=w<1?Math.min(d,Math.round(e.term.length*w)):w;k&&(v=this._index.fuzzyGet(e.term,k))}if(y)try{for(var b=_e(y),S=b.next();!S.done;S=b.next()){var C=Et(S.value,2),R=C[0],_=C[1],D=R.length-e.term.length;if(D){v?.delete(R);var I=g*R.length/(R.length+.3*D);this.termResults(e.term,R,I,_,l,c,p,m)}}}catch(X){r={error:X}}finally{try{S&&!S.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}if(v)try{for(var N=_e(v.keys()),O=N.next();!O.done;O=N.next()){var R=O.value,j=Et(v.get(R),2),Q=j[0],D=j[1];if(D){var I=h*R.length/(R.length+D);this.termResults(e.term,R,I,Q,l,c,p,m)}}}catch(X){o={error:X}}finally{try{O&&!O.done&&(a=N.return)&&a.call(N)}finally{if(o)throw o.error}}return m},t.prototype.executeWildcardQuery=function(e){var n,r,i=new Map,o=Ge(Ge({},this._options.searchOptions),e);try{for(var a=_e(this._documentIds),s=a.next();!s.done;s=a.next()){var l=Et(s.value,2),c=l[0],u=l[1],d=o.boostDocument?o.boostDocument(u,"",this._storedFields.get(c)):1;i.set(c,{score:d,terms:[],match:{}})}}catch(p){n={error:p}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},t.prototype.combineResults=function(e,n){if(n===void 0&&(n=RC),e.length===0)return new Map;var r=n.toLowerCase();return e.reduce(lse[r])||new Map},t.prototype.toJSON=function(){var e,n,r,i,o=[];try{for(var a=_e(this._index),s=a.next();!s.done;s=a.next()){var l=Et(s.value,2),c=l[0],u=l[1],d={};try{for(var p=(r=void 0,_e(u)),f=p.next();!f.done;f=p.next()){var h=Et(f.value,2),g=h[0],x=h[1];d[g]=Object.fromEntries(x)}}catch(m){r={error:m}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}o.push([c,d])}}catch(m){e={error:m}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:o,serializationVersion:2}},t.prototype.termResults=function(e,n,r,i,o,a,s,l){var c,u,d,p,f;if(l===void 0&&(l=new Map),i==null)return l;try{for(var h=_e(Object.keys(o)),g=h.next();!g.done;g=h.next()){var x=g.value,m=o[x],y=this._fieldIds[x],v=i.get(y);if(v!=null){var w=v.size,k=this._avgFieldLength[y];try{for(var b=(d=void 0,_e(v.keys())),S=b.next();!S.done;S=b.next()){var C=S.value;if(!this._documentIds.has(C)){this.removeTerm(y,C,n),w-=1;continue}var R=a?a(this._documentIds.get(C),n,this._storedFields.get(C)):1;if(R){var _=v.get(C),D=this._fieldLength.get(C)[y],I=use(_,w,this._documentCount,D,k,s),N=r*m*R*I,O=l.get(C);if(O){O.score+=N,fse(O.terms,e);var j=kC(O.match,n);j?j.push(x):O.match[n]=[x]}else l.set(C,{score:N,terms:[e],match:(f={},f[n]=[x],f)})}}}catch(Q){d={error:Q}}finally{try{S&&!S.done&&(p=b.return)&&p.call(b)}finally{if(d)throw d.error}}}}}catch(Q){c={error:Q}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}return l},t.prototype.addTerm=function(e,n,r){var i=this._index.fetch(r,mU),o=i.get(e);if(o==null)o=new Map,o.set(n,1),i.set(e,o);else{var a=o.get(n);o.set(n,(a||0)+1)}},t.prototype.removeTerm=function(e,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,e,r);return}var i=this._index.fetch(r,mU),o=i.get(e);o==null||o.get(n)==null?this.warnDocumentChanged(n,e,r):o.get(n)<=1?o.size<=1?i.delete(e):o.delete(n):o.set(n,o.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)},t.prototype.warnDocumentChanged=function(e,n,r){var i,o;try{for(var a=_e(Object.keys(this._fieldIds)),s=a.next();!s.done;s=a.next()){var l=s.value;if(this._fieldIds[l]===n){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(r,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){i={error:c}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var n=this._nextId;return this._idToShortId.set(e,n),this._documentIds.set(n,e),this._documentCount+=1,this._nextId+=1,n},t.prototype.addFields=function(e){for(var n=0;n<e.length;n++)this._fieldIds[e[n]]=n},t.prototype.addFieldLength=function(e,n,r,i){var o=this._fieldLength.get(e);o==null&&this._fieldLength.set(e,o=[]),o[n]=i;var a=this._avgFieldLength[n]||0,s=a*r+i;this._avgFieldLength[n]=s/(r+1)},t.prototype.removeFieldLength=function(e,n,r,i){if(r===1){this._avgFieldLength[n]=0;return}var o=this._avgFieldLength[n]*r-i;this._avgFieldLength[n]=o/(r-1)},t.prototype.saveStoredFields=function(e,n){var r,i,o=this._options,a=o.storeFields,s=o.extractField;if(!(a==null||a.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=_e(a),u=c.next();!u.done;u=c.next()){var d=u.value,p=s(n,d);p!==void 0&&(l[d]=p)}}catch(f){r={error:f}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}},t.wildcard=Symbol("*"),t}(),kC=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},lse=(Gh={},Gh[RC]=function(t,e){var n,r;try{for(var i=_e(e.keys()),o=i.next();!o.done;o=i.next()){var a=o.value,s=t.get(a);if(s==null)t.set(a,e.get(a));else{var l=e.get(a),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),fU(s.terms,u)}}}catch(p){n={error:p}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},Gh[bU]=function(t,e){var n,r,i=new Map;try{for(var o=_e(e.keys()),a=o.next();!a.done;a=o.next()){var s=a.value,l=t.get(s);if(l!=null){var c=e.get(s),u=c.score,d=c.terms,p=c.match;fU(l.terms,d),i.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,p)})}}}catch(f){n={error:f}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},Gh[sse]=function(t,e){var n,r;try{for(var i=_e(e.keys()),o=i.next();!o.done;o=i.next()){var a=o.value;t.delete(a)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},Gh),cse={k:1.2,b:.7,d:.5},use=function(t,e,n,r,i,o){var a=o.k,s=o.b,l=o.d,c=Math.log(1+(n-e+.5)/(e+.5));return c*(l+t*(a+1)/(t+a*(1-s+s*r/i)))},dse=function(t){return function(e,n,r){var i=typeof t.fuzzy=="function"?t.fuzzy(e,n,r):t.fuzzy||!1,o=typeof t.prefix=="function"?t.prefix(e,n,r):t.prefix===!0;return{term:e,fuzzy:i,prefix:o}}},TC={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t){return t.split(hse)},processTerm:function(t){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e){typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},pU={combineWith:RC,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:cse},pse={combineWith:bU,prefix:function(t,e,n){return e===n.length-1}},PC={batchSize:1e3,batchWait:10},CC={minDirtFactor:.1,minDirtCount:20},SC=Ge(Ge({},PC),CC),fse=function(t,e){t.includes(e)||t.push(e)},fU=function(t,e){var n,r;try{for(var i=_e(e),o=i.next();!o.done;o=i.next()){var a=o.value;t.includes(a)||t.push(a)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},hU=function(t,e){var n=t.score,r=e.score;return r-n},mU=function(){return new Map},Vb=function(t){var e,n,r=new Map;try{for(var i=_e(Object.keys(t)),o=i.next();!o.done;o=i.next()){var a=o.value;r.set(parseInt(a,10),t[a])}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},hse=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var Yh=require("obsidian"),Qh=$(K());function kU(){return wc((e,n,r)=>({source:null,title:null,showSearchBox:!1,media:null,activeCueIDs:new Set,updateActiveCues(i){let o=n().activeCueIDs,a=new Set(i);o.size===a.size&&[...o].every(s=>a.has(s))||e({activeCueIDs:a})},setLinkedMedia(i){let o=n().media;return Zn(o,i)?!1:(e({media:i}),!0)},toggleSearchBox(i){e(typeof i=="boolean"?{showSearchBox:i}:({showSearchBox:o})=>({showSearchBox:!o}))},textTrack:null,setCaptions(i){if(!i){e({textTrack:null,title:null});return}let{track:o,locales:a}=i,{metadata:s,cues:l}=o.content,c=s.Label||o.label,u=s.Language||o.language,d=c||(Qf(u)?pu(u):"");d&&s.Title&&(d=s.Title+" - "+d),e({title:d??null}),n().textTrack?._minisearch?.removeAll();let p=mse(...i.locales),f=new _U({idField:"id",fields:["text"],tokenize:p?h=>[...p.segment(h)].filter(g=>g.isWordLike).map(g=>g.segment):void 0});f.addAll(l),e({textTrack:{_minisearch:f,locales:a,content:o.content,id:i.id}})},search(i,o){let a=n().textTrack?._minisearch;return a?a.search(i,o).map(l=>({matches:Object.keys(l.match),queryTerms:l.queryTerms,score:l.score,id:l.id})):[]}}))}function mse(...t){return typeof window.Intl>"u"||typeof Intl.Segmenter>"u"?null:new Intl.Segmenter(t,{granularity:"word"})}var Ub=(0,Qh.createContext)(null);function Uo(t){let{store:e}=(0,Qh.useContext)(Ub);return mp(e,t)}function TU(){let{plugin:t}=(0,Qh.useContext)(Ub);return t}function SU(){let t=Uo(n=>!!n.textTrack?._minisearch),e=Uo(n=>n.search);return t?e:null}function EU(){let t=Uo(n=>n.showSearchBox),e=Uo(n=>n.toggleSearchBox);return[t,e]}function PU(){let t=TU(),e=Uo(n=>n.media);if(e)return async(n,r)=>{let i=e instanceof xt?e.clone():{...e};i.hash=`#t=${r}`,await t.leafOpener.openMedia(i,Bl(n.nativeEvent),{fromUser:!0})}}function $C(){let t=TU(),e=Uo(n=>n.media);return e?function(n,r){let o=Qo(n,e,{app:t.app,settings:t.settings.getState()})(""),a=(0,Yh.htmlToMarkdown)(`<pre>${r}</pre>`);return{text:`${o} ${a}`,timestamp:o}}:function(n,r){let i=(0,Yh.htmlToMarkdown)(`<pre>${r}</pre>`),o=Yo(n);return{text:`${o} ${i}`,timestamp:o}}}function CU(){let t=$C();return async(e,n,r)=>{let{text:i,timestamp:o}=await t(n,r);await navigator.clipboard.writeText(i),new Yh.Notice(`Copied at ${o} to clipboard`)}}var Bo=$(K(),1),AU=$(mo(),1);function wl(t,e,n){let r=n.initialDeps??[],i;return()=>{var o,a,s,l;let c;n.key&&((o=n.debug)!=null&&o.call(n))&&(c=Date.now());let u=t();if(!(u.length!==r.length||u.some((f,h)=>r[h]!==f)))return i;r=u;let p;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(p=Date.now()),i=e(...u),n.key&&((s=n.debug)!=null&&s.call(n))){let f=Math.round((Date.now()-c)*100)/100,h=Math.round((Date.now()-p)*100)/100,g=h/16,x=(m,y)=>{for(m=String(m);m.length<y;)m=" "+m;return m};console.info(`%c\u23F1 ${x(h,5)} /${x(f,5)} ms`,`
|
|
font-size: .6rem;
|
|
font-weight: bold;
|
|
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return(l=n?.onChange)==null||l.call(n,i),i}}function Bb(t,e){if(t===void 0)throw new Error(`Unexpected undefined${e?`: ${e}`:""}`);return t}var MU=(t,e)=>Math.abs(t-e)<1;var gse=t=>t,yse=t=>{let e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let i=e;i<=n;i++)r.push(i);return r},RU=(t,e)=>{let n=t.scrollElement;if(!n)return;let r=o=>{let{width:a,height:s}=o;e({width:Math.round(a),height:Math.round(s)})};if(r(n.getBoundingClientRect()),typeof ResizeObserver>"u")return()=>{};let i=new ResizeObserver(o=>{let a=o[0];if(a?.borderBoxSize){let s=a.borderBoxSize[0];if(s){r({width:s.inlineSize,height:s.blockSize});return}}r(n.getBoundingClientRect())});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}};var $U=(t,e)=>{let n=t.scrollElement;if(!n)return;let r=()=>{e(n[t.options.horizontal?"scrollLeft":"scrollTop"])};return r(),n.addEventListener("scroll",r,{passive:!0}),()=>{n.removeEventListener("scroll",r)}};var vse=(t,e,n)=>{if(e?.borderBoxSize){let r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(t.getBoundingClientRect()[n.options.horizontal?"width":"height"])};var IU=(t,{adjustments:e=0,behavior:n},r)=>{var i,o;let a=t+e;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})},jb=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let n=null,r=()=>n||(typeof ResizeObserver<"u"?n=new ResizeObserver(i=>{i.forEach(o=>{this._measureElement(o.target,o)})}):null);return{disconnect:()=>{var i;return(i=r())==null?void 0:i.disconnect()},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:gse,rangeExtractor:yse,onChange:()=>{},measureElement:vse,initialRect:{width:0,height:0},scrollMargin:0,gap:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=wl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{let n=this.options.getScrollElement();this.scrollElement!==n&&(this.cleanup(),this.scrollElement=n,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,r=>{this.scrollAdjustments=0,this.scrollOffset!==r&&(this.isScrollingTimeoutId!==null&&(clearTimeout(this.isScrollingTimeoutId),this.isScrollingTimeoutId=null),this.isScrolling=!0,this.scrollDirection=this.scrollOffset<r?"forward":"backward",this.scrollOffset=r,this.maybeNotify(),this.isScrollingTimeoutId=setTimeout(()=>{this.isScrollingTimeoutId=null,this.isScrolling=!1,this.scrollDirection=null,this.maybeNotify()},this.options.scrollingDelay))})))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.memoOptions=wl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey],(n,r,i,o)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:o}),{key:!1}),this.getFurthestMeasurement=(n,r)=>{let i=new Map,o=new Map;for(let a=r-1;a>=0;a--){let s=n[a];if(i.has(s.lane))continue;let l=o.get(s.lane);if(l==null||s.end>l.end?o.set(s.lane,s):s.end<l.end&&i.set(s.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,s)=>a.end===s.end?a.index-s.index:a.end-s.end)[0]:void 0},this.getMeasurements=wl(()=>[this.memoOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:o},a)=>{let s=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let l=this.measurementsCache.slice(0,s);for(let c=s;c<n;c++){let u=o(c),d=this.options.lanes===1?l[c-1]:this.getFurthestMeasurement(l,c),p=d?d.end+this.options.gap:r+i,f=a.get(u),h=typeof f=="number"?f:this.options.estimateSize(c),g=p+h,x=d?d.lane:c%this.options.lanes;l[c]={index:c,start:p,size:h,end:g,key:u,lane:x}}return this.measurementsCache=l,l},{key:!1,debug:()=>this.options.debug}),this.calculateRange=wl(()=>[this.getMeasurements(),this.getSize(),this.scrollOffset],(n,r,i)=>this.range=n.length>0&&r>0?xse({measurements:n,outerSize:r,scrollOffset:i}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=wl(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,i,o)=>r===null?[]:n({...r,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{let r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{let i=this.measurementsCache[this.indexFromElement(n)];if(!i||!n.isConnected){this.measureElementCache.forEach((s,l)=>{s===n&&(this.observer.unobserve(n),this.measureElementCache.delete(l))});return}let o=this.measureElementCache.get(i.key);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.measureElementCache.set(i.key,n));let a=this.options.measureElement(n,r,this);this.resizeItem(i,a)},this.resizeItem=(n,r)=>{let i=this.itemSizeCache.get(n.key)??n.size,o=r-i;o!==0&&(n.start<this.scrollOffset+this.scrollAdjustments&&this._scrollToOffset(this.scrollOffset,{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(!1))},this.measureElement=n=>{n&&this._measureElement(n,void 0)},this.getVirtualItems=wl(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{let i=[];for(let o=0,a=n.length;o<a;o++){let s=n[o],l=r[s];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{let r=this.getMeasurements();return Bb(r[LU(0,r.length-1,i=>Bb(r[i]).start,n)])},this.getOffsetForAlignment=(n,r)=>{let i=this.getSize();r==="auto"&&(n<=this.scrollOffset?r="start":n>=this.scrollOffset+i?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-i:r==="center"&&(n=n-i/2);let o=this.options.horizontal?"scrollWidth":"scrollHeight",s=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[o]:this.scrollElement[o]:0)-this.getSize();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));let i=Bb(this.getMeasurements()[n]);if(r==="auto")if(i.end>=this.scrollOffset+this.getSize()-this.options.scrollPaddingEnd)r="end";else if(i.start<=this.scrollOffset+this.options.scrollPaddingStart)r="start";else return[this.scrollOffset,r];let o=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r),r]},this.isDynamicMode=()=>this.measureElementCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&(clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{this.cancelScrollToIndex(),i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let[o,a]=this.getOffsetForIndex(n,r);this._scrollToOffset(o,{adjustments:void 0,behavior:i}),i!=="smooth"&&this.isDynamicMode()&&(this.scrollToIndexTimeoutId=setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.measureElementCache.has(this.options.getItemKey(n))){let[l]=this.getOffsetForIndex(n,a);MU(l,this.scrollOffset)||this.scrollToIndex(n,{align:a,behavior:i})}else this.scrollToIndex(n,{align:a,behavior:i})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.scrollOffset+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;let r=this.getMeasurements(),i;return r.length===0?i=this.options.paddingStart:i=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(o=>o.end)),i-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(n=>{this.itemSizeCache.set(n.key,n.size)}),this.maybeNotify()}},LU=(t,e,n,r)=>{for(;t<=e;){let i=(t+e)/2|0,o=n(i);if(o<r)t=i+1;else if(o>r)e=i-1;else return i}return t>0?t-1:0};function xse({measurements:t,outerSize:e,scrollOffset:n}){let r=t.length-1,o=LU(0,r,s=>t[s].start,n),a=o;for(;a<r&&t[a].end<n+e;)a++;return{startIndex:o,endIndex:a}}var wse=typeof document<"u"?Bo.useLayoutEffect:Bo.useEffect;function bse(t){let e=Bo.useReducer(()=>({}),{})[1],n={...t,onChange:(i,o)=>{var a;o?(0,AU.flushSync)(e):e(),(a=t.onChange)==null||a.call(t,i,o)}},[r]=Bo.useState(()=>new jb(n));return r.setOptions(n),Bo.useEffect(()=>r._didMount(),[]),wse(()=>r._willUpdate()),r}function OU(t){return bse({observeElementRect:RU,observeElementOffset:$U,scrollToFn:IU,...t})}var Zi=$(K());var H=$(K(),1);function _se(t,e){return(0,H.useReducer)((n,r)=>{let i=e[n][r];return i??n},t)}var DU="ScrollArea",[NU,gDe]=ji(DU),[kse,Zr]=NU(DU),Tse=(0,H.forwardRef)((t,e)=>{let{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...a}=t,[s,l]=(0,H.useState)(null),[c,u]=(0,H.useState)(null),[d,p]=(0,H.useState)(null),[f,h]=(0,H.useState)(null),[g,x]=(0,H.useState)(null),[m,y]=(0,H.useState)(0),[v,w]=(0,H.useState)(0),[k,b]=(0,H.useState)(!1),[S,C]=(0,H.useState)(!1),R=ze(e,D=>l(D)),_=xw(i);return(0,H.createElement)(kse,{scope:n,type:r,dir:_,scrollHideDelay:o,scrollArea:s,viewport:c,onViewportChange:u,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:h,scrollbarXEnabled:k,onScrollbarXEnabledChange:b,scrollbarY:g,onScrollbarYChange:x,scrollbarYEnabled:S,onScrollbarYEnabledChange:C,onCornerWidthChange:y,onCornerHeightChange:w},(0,H.createElement)(at.div,ue({dir:_},a,{ref:R,style:{position:"relative","--radix-scroll-area-corner-width":m+"px","--radix-scroll-area-corner-height":v+"px",...t.style}})))}),Sse="ScrollAreaViewport",Ese=(0,H.forwardRef)((t,e)=>{let{__scopeScrollArea:n,children:r,...i}=t,o=Zr(Sse,n),a=(0,H.useRef)(null),s=ze(e,a,o.onViewportChange);return(0,H.createElement)(H.Fragment,null,(0,H.createElement)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),(0,H.createElement)(at.div,ue({"data-radix-scroll-area-viewport":""},i,{ref:s,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style}}),(0,H.createElement)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),jo="ScrollAreaScrollbar",LC=(0,H.forwardRef)((t,e)=>{let{forceMount:n,...r}=t,i=Zr(jo,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=i,s=t.orientation==="horizontal";return(0,H.useEffect)(()=>(s?o(!0):a(!0),()=>{s?o(!1):a(!1)}),[s,o,a]),i.type==="hover"?(0,H.createElement)(Pse,ue({},r,{ref:e,forceMount:n})):i.type==="scroll"?(0,H.createElement)(Cse,ue({},r,{ref:e,forceMount:n})):i.type==="auto"?(0,H.createElement)(VU,ue({},r,{ref:e,forceMount:n})):i.type==="always"?(0,H.createElement)(AC,ue({},r,{ref:e})):null}),Pse=(0,H.forwardRef)((t,e)=>{let{forceMount:n,...r}=t,i=Zr(jo,t.__scopeScrollArea),[o,a]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let s=i.scrollArea,l=0;if(s){let c=()=>{window.clearTimeout(l),a(!0)},u=()=>{l=window.setTimeout(()=>a(!1),i.scrollHideDelay)};return s.addEventListener("pointerenter",c),s.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),s.removeEventListener("pointerenter",c),s.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),(0,H.createElement)(Vo,{present:n||o},(0,H.createElement)(VU,ue({"data-state":o?"visible":"hidden"},r,{ref:e})))}),Cse=(0,H.forwardRef)((t,e)=>{let{forceMount:n,...r}=t,i=Zr(jo,t.__scopeScrollArea),o=t.orientation==="horizontal",a=qb(()=>l("SCROLL_END"),100),[s,l]=_se("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return(0,H.useEffect)(()=>{if(s==="idle"){let c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[s,i.scrollHideDelay,l]),(0,H.useEffect)(()=>{let c=i.viewport,u=o?"scrollLeft":"scrollTop";if(c){let d=c[u],p=()=>{let f=c[u];d!==f&&(l("SCROLL"),a()),d=f};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[i.viewport,o,l,a]),(0,H.createElement)(Vo,{present:n||s!=="hidden"},(0,H.createElement)(AC,ue({"data-state":s==="hidden"?"hidden":"visible"},r,{ref:e,onPointerEnter:Ke(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Ke(t.onPointerLeave,()=>l("POINTER_LEAVE"))})))}),VU=(0,H.forwardRef)((t,e)=>{let n=Zr(jo,t.__scopeScrollArea),{forceMount:r,...i}=t,[o,a]=(0,H.useState)(!1),s=t.orientation==="horizontal",l=qb(()=>{if(n.viewport){let c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;a(s?c:u)}},10);return ed(n.viewport,l),ed(n.content,l),(0,H.createElement)(Vo,{present:r||o},(0,H.createElement)(AC,ue({"data-state":o?"visible":"hidden"},i,{ref:e})))}),AC=(0,H.forwardRef)((t,e)=>{let{orientation:n="vertical",...r}=t,i=Zr(jo,t.__scopeScrollArea),o=(0,H.useRef)(null),a=(0,H.useRef)(0),[s,l]=(0,H.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=HU(s.viewport,s.content),u={...r,sizes:s,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>o.current=p,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:p=>a.current=p};function d(p,f){return Ose(p,a.current,s,f)}return n==="horizontal"?(0,H.createElement)(Mse,ue({},u,{ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){let p=i.viewport.scrollLeft,f=FU(p,s,i.dir);o.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=d(p,i.dir))}})):n==="vertical"?(0,H.createElement)(Rse,ue({},u,{ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){let p=i.viewport.scrollTop,f=FU(p,s);o.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=d(p))}})):null}),Mse=(0,H.forwardRef)((t,e)=>{let{sizes:n,onSizesChange:r,...i}=t,o=Zr(jo,t.__scopeScrollArea),[a,s]=(0,H.useState)(),l=(0,H.useRef)(null),c=ze(e,l,o.onScrollbarXChange);return(0,H.useEffect)(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,H.createElement)(UU,ue({"data-orientation":"horizontal"},i,{ref:c,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wb(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(o.viewport){let p=o.viewport.scrollLeft+u.deltaX;t.onWheelScroll(p),qU(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&o.viewport&&a&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Hb(a.paddingLeft),paddingEnd:Hb(a.paddingRight)}})}}))}),Rse=(0,H.forwardRef)((t,e)=>{let{sizes:n,onSizesChange:r,...i}=t,o=Zr(jo,t.__scopeScrollArea),[a,s]=(0,H.useState)(),l=(0,H.useRef)(null),c=ze(e,l,o.onScrollbarYChange);return(0,H.useEffect)(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,H.createElement)(UU,ue({"data-orientation":"vertical"},i,{ref:c,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wb(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(o.viewport){let p=o.viewport.scrollTop+u.deltaY;t.onWheelScroll(p),qU(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&o.viewport&&a&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Hb(a.paddingTop),paddingEnd:Hb(a.paddingBottom)}})}}))}),[$se,zU]=NU(jo),UU=(0,H.forwardRef)((t,e)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...p}=t,f=Zr(jo,n),[h,g]=(0,H.useState)(null),x=ze(e,R=>g(R)),m=(0,H.useRef)(null),y=(0,H.useRef)(""),v=f.viewport,w=r.content-r.viewport,k=Yt(u),b=Yt(l),S=qb(d,10);function C(R){if(m.current){let _=R.clientX-m.current.left,D=R.clientY-m.current.top;c({x:_,y:D})}}return(0,H.useEffect)(()=>{let R=_=>{let D=_.target;h?.contains(D)&&k(_,w)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[v,h,w,k]),(0,H.useEffect)(b,[r,b]),ed(h,S),ed(f.content,S),(0,H.createElement)($se,{scope:n,scrollbar:h,hasThumb:i,onThumbChange:Yt(o),onThumbPointerUp:Yt(a),onThumbPositionChange:b,onThumbPointerDown:Yt(s)},(0,H.createElement)(at.div,ue({},p,{ref:x,style:{position:"absolute",...p.style},onPointerDown:Ke(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),m.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),C(R))}),onPointerMove:Ke(t.onPointerMove,C),onPointerUp:Ke(t.onPointerUp,R=>{let _=R.target;_.hasPointerCapture(R.pointerId)&&_.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),m.current=null})})))}),IC="ScrollAreaThumb",BU=(0,H.forwardRef)((t,e)=>{let{forceMount:n,...r}=t,i=zU(IC,t.__scopeScrollArea);return(0,H.createElement)(Vo,{present:n||i.hasThumb},(0,H.createElement)(Ise,ue({ref:e},r)))}),Ise=(0,H.forwardRef)((t,e)=>{let{__scopeScrollArea:n,style:r,...i}=t,o=Zr(IC,n),a=zU(IC,n),{onThumbPositionChange:s}=a,l=ze(e,d=>a.onThumbChange(d)),c=(0,H.useRef)(),u=qb(()=>{c.current&&(c.current(),c.current=void 0)},100);return(0,H.useEffect)(()=>{let d=o.viewport;if(d){let p=()=>{if(u(),!c.current){let f=Fse(d,s);c.current=f,s()}};return s(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[o.viewport,u,s]),(0,H.createElement)(at.div,ue({"data-state":a.hasThumb?"visible":"hidden"},i,{ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ke(t.onPointerDownCapture,d=>{let f=d.target.getBoundingClientRect(),h=d.clientX-f.left,g=d.clientY-f.top;a.onThumbPointerDown({x:h,y:g})}),onPointerUp:Ke(t.onPointerUp,a.onThumbPointerUp)}))}),jU="ScrollAreaCorner",Lse=(0,H.forwardRef)((t,e)=>{let n=Zr(jU,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?(0,H.createElement)(Ase,ue({},t,{ref:e})):null}),Ase=(0,H.forwardRef)((t,e)=>{let{__scopeScrollArea:n,...r}=t,i=Zr(jU,n),[o,a]=(0,H.useState)(0),[s,l]=(0,H.useState)(0),c=!!(o&&s);return ed(i.scrollbarX,()=>{var u;let d=((u=i.scrollbarX)===null||u===void 0?void 0:u.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),ed(i.scrollbarY,()=>{var u;let d=((u=i.scrollbarY)===null||u===void 0?void 0:u.offsetWidth)||0;i.onCornerWidthChange(d),a(d)}),c?(0,H.createElement)(at.div,ue({},r,{ref:e,style:{width:o,height:s,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}})):null});function Hb(t){return t?parseInt(t,10):0}function HU(t,e){let n=t/e;return isNaN(n)?0:n}function Wb(t){let e=HU(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Ose(t,e,n,r="ltr"){let i=Wb(n),o=i/2,a=e||o,s=i-a,l=n.scrollbar.paddingStart+a,c=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return WU([l,c],d)(t)}function FU(t,e,n="ltr"){let r=Wb(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,a=e.content-e.viewport,s=o-r,l=n==="ltr"?[0,a]:[a*-1,0],c=kh(t,l);return WU([0,a],[0,s])(c)}function WU(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function qU(t,e){return t>0&&t<e}var Fse=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){let o={left:t.scrollLeft,top:t.scrollTop},a=n.left!==o.left,s=n.top!==o.top;(a||s)&&e(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function qb(t,e){let n=Yt(t),r=(0,H.useRef)(0);return(0,H.useEffect)(()=>()=>window.clearTimeout(r.current),[]),(0,H.useCallback)(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function ed(t,e){let n=Yt(e);Qr(()=>{let r=0;if(t){let i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}var OC=Tse,KU=Ese;var GU=Lse;var FC=$(K());var is=$(ie()),DC=FC.forwardRef(({className:t,children:e,...n},r)=>(0,is.jsxs)(OC,{className:gt("relative overflow-hidden",t),...n,children:[(0,is.jsx)(KU,{className:"h-full w-full rounded-[inherit]",ref:r,children:e}),(0,is.jsx)(YU,{}),(0,is.jsx)(GU,{})]}));DC.displayName=OC.displayName;var YU=FC.forwardRef(({className:t,orientation:e="vertical",...n},r)=>(0,is.jsx)(LC,{ref:r,orientation:e,className:gt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:(0,is.jsx)(BU,{className:"relative flex-1 rounded-full bg-mod-border"})}));YU.displayName=LC.displayName;var td=$(K());var Zt=$(ie());function QU({onPlay:t,onCopy:e}){return(0,Zt.jsxs)(Zt.Fragment,{children:[e&&(0,Zt.jsx)("div",{role:"button",tabIndex:0,onClick:e,"aria-label":"Copy markdown",onKeyDown:n=>{n.key==="Enter"&&e(n)},children:(0,Zt.jsx)(az,{className:"w-3 h-3"})}),t&&(0,Zt.jsx)("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:n=>{n.key==="Enter"&&t(n)},children:(0,Zt.jsx)(cw,{className:"w-3 h-3"})})]})}var XU=(0,td.forwardRef)(function({children:e,matches:n,time:r,className:i,actions:o,active:a=!1,...s},l){let c=n?Vse(e,n):(f=>{let h=[];return ZU(f,h,0),h})(e),u=$C(),d=(0,td.useRef)(null),p=Ch([l,d]);return(0,Zt.jsxs)("div",{...s,ref:p,className:gt("grid items-center group hover:bg-accent pr-2 py-1 mr-1 transition-all rounded-md hover:delay-100",i,n?.length&&"bg-text-highlight bg-opacity-10",a&&"text-md font-semibold"),children:[(0,Zt.jsx)("div",{className:"text-xs font-medium select-none text-gray-400 group-hover:text-black group-hover:pl-1 transition-all flex items-center group-hover:delay-100",children:(0,Zt.jsxs)("div",{className:"flex cursor-pointer items-center",draggable:!0,onDragStart:f=>{f.dataTransfer.setData("text/plain",u(r,e).text),f.dataTransfer.dropEffect="copy",f.dataTransfer.setDragImage(d.current,0,0)},children:[(0,Zt.jsx)(zse,{children:r}),(0,Zt.jsx)("div",{className:"ml-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity group-hover:duration-300 group-hover:delay-100",children:o})]})}),(0,Zt.jsx)("p",{className:"select-text",children:c})]})});function Nse(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Vse(t,e){let n=new RegExp(e.map(i=>i.trim()).filter(Boolean).map(Nse).join("|"),"gi"),r=[...t.matchAll(n)].reduceRight((i,o)=>{let a=o.index,s=o[0],l=t.slice(a+s.length);return ZU(l,i,a),i.push((0,Zt.jsx)("mark",{children:s},a)),t=t.slice(0,a),i},[]);return r.push(t),r.reverse(),r}function zse({children:t}){let e=(0,td.useMemo)(()=>Yo(t),[t]);return(0,Zt.jsx)("span",{children:e})}function ZU(t,e,n){t.includes(`
|
|
`)?t.split(`
|
|
`).forEach((r,i)=>{i===0?e.push(r):e.push((0,Zt.jsx)("br",{},`${n}seg-${i}`),r)}):e.push(t)}var nd=$(ie()),JU=(0,Zi.forwardRef)(function({children:e,className:n,searchResult:r,onPlay:i,onCopy:o,activeCueIDs:a},s){let l=(0,Zi.useRef)(null),c=(0,Zi.useMemo)(()=>new Map(r?.map(p=>[p.id,p.matches])??[]),[r]),u=OU({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>45,overscan:20});(0,Zi.useEffect)(()=>{if(!a)return;let[p]=a;if(!p)return;let f=e.findIndex(h=>h.id===p);f-1<0||u.scrollToIndex(f-1,{behavior:"smooth",align:"start"})},[a,e,u]),(0,Zi.useImperativeHandle)(s,()=>({scrollToIndex:p=>u.scrollToIndex(p,{behavior:"auto",align:"start"})}),[u]);let d=u.getVirtualItems();return(0,nd.jsx)(DC,{className:gt(n,"h-full"),ref:l,children:(0,nd.jsx)("div",{style:{height:`${u.getTotalSize()}px`},className:"w-full relative max-w-[var(--file-line-width)] mx-auto",children:(0,nd.jsx)("div",{className:"absolute w-full top-0 left-0",style:{transform:`translateY(${d[0]?.start??0}px)`},children:d.map(p=>{let f=e[p.index];return(0,nd.jsx)(XU,{active:a?.has(f.id),ref:u.measureElement,"data-index":p.index,time:f.startTime,matches:c?.get(f.id),actions:(0,nd.jsx)(QU,{onPlay:i&&(h=>i(h,f.startTime)),onCopy:o&&(h=>o(h,f.startTime,f.text))}),children:f.text},f.id)})})})})});var bl=$(K());var Ho=$(ie());function eB({onSubmit:t,onExit:e,noResult:n=!1}){let[r,i]=(0,bl.useState)(""),o=(0,bl.useRef)("");function a(l){l.preventDefault(),i(""),o.current="",e?.()}let s=(0,bl.useRef)(null);return(0,bl.useEffect)(()=>{s.current?.focus()},[]),(0,Ho.jsx)("div",{className:"document-search-container",children:(0,Ho.jsxs)("form",{className:gt("document-search"),onSubmit:l=>{l.preventDefault(),t(r,o.current!==r,"next"),o.current=r},children:[(0,Ho.jsx)("input",{type:"text",ref:s,value:r,onChange:l=>i(l.target.value),onKeyDown:l=>{l.key==="Escape"&&a(l)},placeholder:"Search transcript",className:gt("document-search keep-ob",n&&o.current&&o.current===r&&"bg-[rgba(var(--background-modifier-error-rgb),0.2)]")}),(0,Ho.jsxs)("div",{className:"document-search-buttons",children:[(0,Ho.jsx)("button",{type:"button",className:"document-search-button keep-ob",onClick:l=>{l.preventDefault(),t(r,o.current!==r,"prev"),o.current=r},children:"Prev"}),(0,Ho.jsx)("button",{type:"submit",className:"document-search-button keep-ob",children:"Next"})]}),(0,Ho.jsx)("span",{className:"document-search-close-button",tabIndex:0,role:"button",onKeyDown:l=>{l.key==="Enter"&&a(l)},onClick:a})]})})}var Xh=$(ie());function NC(){let t=Uo(p=>p.textTrack?.content.cues||[]),e=Uo(p=>p.activeCueIDs),n=PU(),r=CU(),i=(0,_l.useMemo)(()=>new Map(t.map((p,f)=>[p.id,{cue:p,index:f}])),[t]),[o,a]=EU(),[s,l]=(0,_l.useState)([]),c=(0,_l.useRef)(-1),u=SU(),d=(0,_l.useRef)(null);return(0,Xh.jsxs)("div",{className:"h-full",children:[u&&o&&(0,Xh.jsx)(eB,{noResult:s.length===0,onSubmit:(p,f,h)=>{if(!f){if(c.current<0||s.length===0)return;h==="next"?c.current<s.length-1?c.current+=1:c.current=0:h==="prev"?c.current>0?c.current-=1:c.current=s.length-1:(0,tB.assertNever)(h),d.current?.scrollToIndex(i.get(s[c.current].id)?.index??-1);return}let g=u(p.trim(),{prefix:!0,fuzzy:!0});if(g.length===0){l([]);return}let{top:x,alt:m}=g.reduce((b,S,C,R)=>(S.queryTerms.length>=R[0].queryTerms.length?b.top.push(S):b.alt.push(S),b),{top:[],alt:[]}),[{score:y},v]=x;v&&y-v.score<10&&x.sort((b,S)=>{let C=i.get(b.id)?.index??-1,R=i.get(S.id)?.index??-1;return C-R});let w=x[0].id,{index:k}=i.get(w)??{};typeof k=="number"&&(l([...x,...m]),d.current?.scrollToIndex(k),c.current=0)},onExit:()=>{a(!1),l([])}}),(0,Xh.jsx)(JU,{className:"p-[var(--file-margins)] pt-0",ref:d,onPlay:n,onCopy:r,activeCueIDs:e,searchResult:s,children:t})]})}var Kb={local:"mx-transcript-local",webpage:"mx-transcript-webpage"};var VC=$(ie()),Zh=class t extends Gb.EditableFileView{constructor(n,r){super(n);this.plugin=r;T(this,"store",kU());T(this,"root",null);T(this,"allowNoFile",!1);this.contentEl.addClasses(["mx","custom","mx-transcript-view"])}static register(n){n.registerView(Kb.local,r=>new t(r,n)),n.registerExtensions(_x(),Kb.local)}canAcceptExtension(n){return Xs(n)}getViewType(){return Kb.local}async onLoadFile(n){await super.onLoadFile(n);let r=Ua(n);if(!r)throw new Error(`Caption file not supported: ${n.path}`);this.registerEvent(this.app.workspace.on("mx:cue-change",(o,a,s)=>{let{media:l,textTrack:c,updateActiveCues:u}=this.store.getState();!l||!c||c.id!==a||!Zn(o,l)||u(s)}));let i=async()=>{let{setLinkedMedia:o,updateActiveCues:a}=this.store.getState(),[s]=await this.plugin.transcript.getLinkedMedia(r);if(!o(s||null)||!s)return;let l=this.plugin.leafOpener.findPlayerWithSameMedia(s);if(!l)return;let c=l.view.player?.textTracks.selected;c&&a(c.activeCues.map(u=>u.id))};this.registerEvent(this.app.metadataCache.on("mx:transcript-changed",o=>{let{textTrack:a}=this.store.getState();!a||!o.has(a.id)||i()})),await Promise.allSettled([i(),this.plugin.transcript.loadAndParseTrack(r).then(o=>{this.store.getState().setCaptions({track:o,id:Lo(o).id,locales:o.language?[o.language]:[]}),this.render()}).catch(o=>{new Gb.Notice(`Failed to load subtitle ${n.path}: ${o instanceof Error?o.message:"See console for details"}`),console.error("Failed to load subtitle",n,o)})])}async onOpen(){await super.onOpen(),this.render()}render(){this.root?.unmount(),this.root=nB.default.createRoot(this.contentEl),this.root.render((0,VC.jsx)(Ub.Provider,{value:{plugin:this.plugin,store:this.store},children:(0,VC.jsx)(NC,{})}))}getIcon(){return"subtitles"}onPaneMenu(n,r){super.onPaneMenu(n,r),r==="more-options"&&n.addItem(i=>{i.setTitle("Find...").setIcon("file-search").setSection("action").onClick(()=>this.store.getState().toggleSearchBox())})}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}};function rB(t){Zh.register(t),t.app.workspace.onLayoutReady(()=>t.register(yt(t.app.commands.commands["editor:open-search"],{checkCallback:e=>function(n){if(e?.(n))return!0;let r=t.app.workspace.getActiveViewOfType(Zh);if(!r)return!1;if(n)return!0;r.store.getState().toggleSearchBox()}})))}var kl=require("obsidian");var iB=require("url"),zC=require("obsidian");async function*Yb(t,e=[]){let n=ps();if(!n)return;let r=new Set(e),i=await n.opendir(t,{encoding:"utf-8"});for await(let o of i)!(o.isFile()||o.isSymbolicLink())||r.has(o.name)||(yield gi(en.join(t,o.name),en.sep))}function oB(t){for(let e of YC){let n=t.find(r=>r.extension===e);if(n)return n instanceof zC.TFile?{type:Ft(e),file:n,hash:""}:xt.create((0,iB.pathToFileURL)(n.path))}return null}async function aB(t){let e=t.src.path,n=en.dirname(e);try{let r=[];for await(let i of Yb(n,[en.basename(e)]))i.basename!==t.basename||!o_(i.extension)||r.push(i);return oB(r)}catch(r){return console.error(`Failed to resolve local media for ${e}`,r),null}}async function sB(t){let e=t.src.parent;if(!e)return null;let n=e.children.map(r=>r instanceof zC.TFile&&r.name!==t.src.name&&r.basename===t.basename&&o_(r.extension)?r:null).filter(r=>!!r);return oB(n)}var lB=require("obsidian");function cB(t){return[...xx(t,e=>e.language).values()].reduce((e,n)=>{let r=_x().reduce((i,o)=>i||n.find(a=>a.type===o),void 0);return r&&e.push(r),e},[])}async function uB(t){let e=t.filePath;if(!e||!t.inferredType)return[];let{name:n,basename:r,parent:i}=gi(e,en.sep);try{let o=[];for await(let a of Yb(i,[n])){let s=Ua(a);!s||s.basename!==r||o.push(s)}return cB(o)}catch(o){return console.error(`Failed to resolve local tracks for ${e}`,o),[]}}async function dB(t){if(!t.parent)return[];let e,n=t.parent.children.map(r=>r instanceof lB.TFile&&(e=Ua(r))&&e.basename===t.basename?e:null).filter(r=>!!r);return cB(n)}var rd,Qb,Jh,UC,Xb=class extends kl.Component{constructor(n){super();this.plugin=n;Z(this,rd);Z(this,Jh);T(this,"app");this.app=n.app}async loadCaption(n){if(!Xs(n.extension))return null;let r=await V(this,rd,Qb).call(this,n);return W1(r,{type:n.extension})}async loadAndParseTrack(n){let r=n.src instanceof URL?await V(this,Jh,UC).call(this,n.src):await V(this,rd,Qb).call(this,n.src);return{...n,content:await W1(r,{type:n.type})}}async loadTrack(n){let r=n.src instanceof URL?await V(this,Jh,UC).call(this,n.src):await V(this,rd,Qb).call(this,n.src);return{...n,content:r}}async loadTracks(...n){return(await Promise.all(n.map(i=>this.loadTrack(i)))).filter(i=>!!i.content.trim())}async getTracks(n){try{let r=await(Se(n)?dB(n.file):uB(n)),i=this.plugin.mediaNote.getLinkedTextTracks(n);return this.loadTracks(...r,...i)}catch(r){return console.error(`Failed to get tracks for ${Se(n)?n.file.path:n.toString()}`,r),[]}}async getLinkedMedia(n){let r=this.plugin.mediaNote.getLinkedMedia(n);if(!Bse(n)){let i=Use(n)?await sB(n):await aB(n);i&&r.push(i)}return r}};rd=new WeakSet,Qb=function(n){return n instanceof kl.TFile?this.app.vault.cachedRead(n):ZM(n.path)},Jh=new WeakSet,UC=async function(n){return(await(0,kl.requestUrl)({url:n.toString(),method:"GET"})).text};function Use(t){return t.src instanceof kl.TFile}function Bse(t){return t.src instanceof URL}var pB='"use strict";function o(e,...t){return e.reduce((r,c,s)=>{let n=t[s],d=n!==void 0?JSON.stringify(n):"";return r+c+d},"")}process.once("document-start",()=>{let e=document.createElement("script"),t="monkey-patch-xmlhttprequest";e.id=t,e.textContent="try{"+__USERSCRIPT__+"}finally{"+o`document.getElementById(${t})?.remove();`+"}",document.documentElement.prepend(e)});\n';var fB='"use strict";var n=require("electron"),i=require("electron/main");function d(e){return{enable:`mx-enable-preload-${e}`,disable:`mx-disable-preload-${e}`,preload:`file:///mx-preload-${e}`}}var t=(e=>{if(!e)throw new Error("env var BILI_REQ_STORE not inited");return e})(process.env.BILI_REQ_STORE);var r=d(t),o=new WeakMap,c=({sender:e},l)=>{let a=(b,s,p)=>{p.preload===r.preload&&(s.preload=l)};o.has(e)||(e.on("will-attach-webview",a),o.set(e,a))};n.ipcMain.handle(r.enable,c);n.ipcMain.handle(r.disable,()=>{for(let e of i.webContents.getAllWebContents()){let l=o.get(e);l&&e.off("will-attach-webview",l)}n.ipcMain.removeHandler(r.enable),n.ipcMain.removeHandler(r.disable)});\n';var hB=`"use strict";function l(r,e){let t=Object.keys(e).map(n=>w(r,n,e[n]));return t.length===1?t[0]:function(){t.forEach(n=>n())}}function w(r,e,t){let n=r[e],o=r.hasOwnProperty(e),s=t(n);return n&&Object.setPrototypeOf(s,n),Object.setPrototypeOf(a,s),r[e]=a,i;function a(...p){return s===n&&r[e]===a&&i(),s.apply(this,p)}function i(){r[e]===a&&(o?r[e]=n:delete r[e]),s!==n&&(s=n,Object.setPrototypeOf(a,n||Function))}}var f=()=>({emit(r,...e){for(let t=0,n=this.events[r]||[],o=n.length;t<o;t++)n[t](...e)},events:{},on(r,e){return(this.events[r]||=[]).push(e),()=>{this.events[r]=this.events[r]?.filter(t=>e!==t)}}});function m(){let r=f();return r.once=function(t,n){let o=this.on(t,(...s)=>{o(),n(...s)});return o},r}var u=class{#n=[];#e=!1;async load(){if(!this.#e){this.#e=!0,await this.onload();for(let e of this.#t)await e.load()}}async onload(){}async unload(){if(!this.#e)return;this.#e=!1;let e;for(;e=this.#n.pop();)await e();let t;for(;t=this.#t.pop();)await t.unload();await this.onunload()}async onunload(){}register(e){this.#n.push(e)}registerInterval(e,t){let n=setInterval(e,t);this.register(()=>clearInterval(n))}registerDomEvent(e,t,n,o){e.addEventListener(t,n,o),this.register(()=>e.removeEventListener(t,n,o))}#t=[];async addChild(e){return this.#t.push(e),this.#e&&await e.load(),e}async removeChild(e){let t=this.#t.indexOf(e);return t!==-1&&(this.#t.splice(t,1),e.unload()),e}};var L=()=>{},d=L;var c=class extends u{constructor(t){super();this.filter=t}event=m();respCache=new Map;stop=d;async getRequest(t,n=1e4){if(this.respCache.size>0){if(!t){let[o]=this.respCache.values();return o}for(let[o,s]of this.respCache)if(t(new URL(o)))return s}return new Promise((o,s)=>{let a=this.event.on("request",(p,y)=>{t&&!t(p)||(a(),window.clearTimeout(i),o(y))}),i=window.setTimeout(()=>{a(),s(new Error("XHR timeout"))},n)})}async onload(){let t=this;this.stop=l(XMLHttpRequest.prototype,{open:n=>function(o,s){let a=new URL(s,window.location.href);return t.filter(a,o)&&g(this).then(i=>{t.respCache.set(a.href,i),t.event.emit("request",a,i)}),n.apply(this,arguments)}})}async onunload(){this.stop(),this.respCache.clear()}};function g(r){return new Promise((e,t)=>{let n=()=>{try{if(r.status<200||r.status>=400){t(new Error("Request failed: "+r.status));return}e(r.responseText)}catch(s){t(s)}r.removeEventListener("error",o)},o=()=>{t(new Error("XHR error")),r.removeEventListener("load",n)};r.addEventListener("load",n,{once:!0}),r.addEventListener("error",o,{once:!0})})}var v=/codecs="?av01\\./;function h(){let r=[l(HTMLMediaElement.prototype,{canPlayType:e=>function(n){return v.test(n)?"":e.call(this,n)}}),l(window.MediaSource,{isTypeSupported:e=>function(n){return v.test(n)?!1:e.call(this,n)}})];return()=>r.forEach(e=>e())}var E=(r=>{if(!r)throw new Error("env var BILI_REQ_STORE not inited");return r})(process.env.BILI_REQ_STORE);h();if(location.hostname.includes("bilibili.com")){let r=[{hostname:"api.bilibili.com",pathname:"/x/player/v2"},{hostname:"api.bilibili.com",pathname:"/x/player/wbi/v2"}].map(n=>new URLPattern(n)),e=new c(n=>r.some(o=>o.test(n)));e.load(),window[E]=e;let t;(i=>(i[i.default=0]="default",i[i.hevc=1]="hevc",i[i.avc=2]="avc",i[i.av1=3]="av1"))(t||={}),localStorage.setItem("recommend_auto_play","close"),localStorage.setItem("bpx_player_profile",JSON.stringify({media:{autoplay:!1}})),localStorage.setItem("bilibili_player_codec_prefer_type",JSON.stringify(1))}
|
|
`;var id=require("obsidian");var qse=eu(fB),Kse=eu(hB),Gse=eu(pB).replace("__USERSCRIPT__",JSON.stringify(Kse)),mB=Cw(Bf),Zb=class extends id.Component{constructor(n){super();this.plugin=n;T(this,"ready",!1)}get app(){return this.plugin.app}onReady(){this.ready=!0,this.app.metadataCache.trigger("mx:preload-ready")}onError(n){console.error("Failed to load preload",n),this.ready=null,this.app.metadataCache.trigger("mx:preload-error",n)}untilReady(n=5e3){return new Promise((r,i)=>{if(this.ready)return r();if(this.ready===null)return i(new Error("Cannot load"));let o=()=>{this.app.metadataCache.off("mx:preload-ready",o),this.app.metadataCache.off("mx:preload-error",a),r()},a=s=>{this.app.metadataCache.off("mx:preload-ready",o),this.app.metadataCache.off("mx:preload-error",a),i(s)};this.app.metadataCache.on("mx:preload-ready",o),this.app.metadataCache.on("mx:preload-error",a),setTimeout(()=>{a(new Error("Timeout"))},n)})}onload(){if(!id.Platform.isDesktopApp){this.onReady();return}let n=ps(),r=tR(),i=en.join(r,`mx-player-hack.${Date.now()}.js`),o=en.join(r,`mx-preload.${Date.now()}.js`);(async()=>{await Promise.all([n.writeFile(i,qse,"utf-8"),n.writeFile(o,Gse,"utf-8")]),this.register(()=>{n.rm(o,{force:!0,maxRetries:5}).catch(l=>console.warn("Failed to remove preload script",o,l))});try{await eR(i),console.debug("preload patch loaded")}finally{await n.rm(i,{force:!0,maxRetries:5}).catch(l=>console.warn("Failed to remove hack script",i,l))}let{enable:a,disable:s}=uP({ipcRenderer:require("electron").ipcRenderer,channel:mB});await a(o),this.app.workspace.onLayoutReady(()=>{this.app.workspace.floatingSplit.children.forEach(l=>{l instanceof id.WorkspaceWindow&&this.enablePreload(o,l.win)}),this.registerEvent(this.app.workspace.on("window-open",async(l,c)=>{await this.enablePreload(o,c)}))}),this.register(s),console.log("mx-player-hack loaded"),this.onReady()})().catch(a=>this.onError(a))}async enablePreload(n,r){let{ipcRenderer:i}=r.require("electron"),{enable:o}=uP({ipcRenderer:i,channel:mB});await o(n)}};var gB=require("obsidian");async function yB(){if(!gB.Platform.isDesktopApp)return;let t=_d(this.app.appId);t&&(this.settings.subscribe((e,n)=>{e.biliDefaultQuality!==n.biliDefaultQuality&&mC(t,e.biliDefaultQuality)}),await mC(t,this.settings.getState().biliDefaultQuality))}var Jb=class extends e_.Plugin{constructor(){super(...arguments);T(this,"settings",eU(this));T(this,"transcript",this.addChild(new Xb(this)));T(this,"api",{openUrl:async(n,r,i)=>{let o=this.resolveUrl(n);if(!o){new e_.Notice("Protocol not yet supported");return}await this.leafOpener.openMedia(o,r,{direction:i})}});T(this,"urlViewType",this.addChild(new wm(this)));T(this,"mediaNote",this.addChild(new Nw(this)));T(this,"playlist",this.addChild(new _b(this)));T(this,"preload",this.addChild(new Zb(this)));T(this,"leafOpener",this.addChild(new Kw(this)));T(this,"recorderNote",this.addChild(new rm(this)));T(this,"handleMediaNote",m5);T(this,"injectMediaEmbed",lC);T(this,"injectMediaView",hC);T(this,"registerMediaMenu",K1);T(this,"fixLinkLabel",pC);T(this,"patchEditorClick",cC);T(this,"patchPreviewClick",fC);T(this,"patchInlineUrl",uC);T(this,"patchLinktextOpen",dC);T(this,"modifySession",yB);T(this,"initLogin",nR)}resolveUrl(n){let r=W6(n);return r?KM(rr(r),this.settings.getState(),this.app):null}async onload(){this.addSettingTab(new Fb(this)),await this.loadSettings(),this.initLogin(),this.loadPatches(),this.registerMediaMenu(),this.handleMediaNote(),rB(this),await this.modifySession(),dU(this)}async loadSettings(){await this.settings.getState().load()}loadPatches(){this.injectMediaView(Vn.audio,n=>new Mu(n,this),Go("audio")),this.injectMediaView(Vn.video,n=>new Cu(n,this),Go("video")),this.injectMediaEmbed((n,r,i)=>new kb(n,r,i,this)),this.registerView(Rr,n=>new Lu(n,this)),this.registerView(ds,n=>new Ru(n,this)),this.registerView(nr.video,n=>new $u(n,this)),this.registerView(nr.audio,n=>new Iu(n,this)),this.patchEditorClick({onExternalLinkClick:SP}),this.patchPreviewClick({onExternalLinkClick:SP}),this.fixLinkLabel(),this.patchInlineUrl(),this.patchLinktextOpen({onInternalLinkClick:w5})}};
|
|
/*! 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.
|
|
*)
|
|
|
|
lodash-es/lodash.js:
|
|
(**
|
|
* @license
|
|
* Lodash (Custom Build) <https://lodash.com/>
|
|
* Build: `lodash modularize exports="es" -o ./`
|
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
* Released under MIT license <https://lodash.com/license>
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
*)
|
|
*/
|