@music-lyric-player/base 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist/index.comm.js +1 -1
- package/dist/index.comm.js.map +1 -1
- package/dist/index.ecma.d.ts +13 -0
- package/dist/index.ecma.js +467 -446
- package/dist/index.ecma.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# @music-lyric-player/base
|
|
2
2
|
|
|
3
|
-
> Headless timing and state engine for `music-lyric-player`.
|
|
4
|
-
|
|
5
3
|
Owns playback time, active-line tracking, and event emission. Pure logic with **zero DOM dependencies** — pair it with [`@music-lyric-player/dom`](https://github.com/music-lyric/music-lyric-player-web/tree/main/packages/dom) for the default renderer, or plug in your own.
|
|
6
4
|
|
|
7
|
-
Part of [music-lyric-player-web](https://github.com/music-lyric/music-lyric-player-web).
|
|
8
|
-
|
|
9
5
|
## Install
|
|
10
6
|
|
|
11
7
|
```shell
|
|
@@ -14,12 +10,12 @@ npm install @music-lyric-player/base music-lyric-kit
|
|
|
14
10
|
|
|
15
11
|
## Events
|
|
16
12
|
|
|
17
|
-
| Event | Payload
|
|
18
|
-
| ------------- |
|
|
19
|
-
| `play` | `(currentTime: number)`
|
|
20
|
-
| `pause` | `(currentTime: number)`
|
|
21
|
-
| `lyricUpdate` | `(info: Info)`
|
|
22
|
-
| `linesUpdate` | `(lines, indexes,
|
|
13
|
+
| Event | Payload | Fires when |
|
|
14
|
+
| ------------- | -------------------------------------------- | -------------------------- |
|
|
15
|
+
| `play` | `(currentTime: number)` | Playback starts or resumes |
|
|
16
|
+
| `pause` | `(currentTime: number)` | Playback pauses |
|
|
17
|
+
| `lyricUpdate` | `(info: Info)` | A new lyric is loaded |
|
|
18
|
+
| `linesUpdate` | `(lines, indexes, firstActiveIndex, isSeek)` | Active lines change |
|
|
23
19
|
|
|
24
20
|
## Usage
|
|
25
21
|
|
|
@@ -32,7 +28,7 @@ const base = new BaseLyricPlayer()
|
|
|
32
28
|
base.event.add('play', (time) => {})
|
|
33
29
|
base.event.add('pause', (time) => {})
|
|
34
30
|
base.event.add('lyricUpdate', (info) => {})
|
|
35
|
-
base.event.add('linesUpdate', (lines, indexes,
|
|
31
|
+
base.event.add('linesUpdate', (lines, indexes, firstActiveIndex, isSeek) => {})
|
|
36
32
|
|
|
37
33
|
const { result } = new ParserPipeline({
|
|
38
34
|
content: { original: '[00:01.114]Hello world' },
|
|
@@ -50,9 +46,14 @@ base.play(0)
|
|
|
50
46
|
|
|
51
47
|
## Options
|
|
52
48
|
|
|
53
|
-
| Field
|
|
54
|
-
|
|
|
55
|
-
| `driver`
|
|
49
|
+
| Field | Type | Default | Description |
|
|
50
|
+
| ------------------------------- | ------------------------ | ------------- | ---------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `driver` | `'animation' \| 'timer'` | `'animation'` | Tick source. `animation` uses `requestAnimationFrame`; `timer` uses `setTimeout(16)` |
|
|
52
|
+
| `bridgeActive` | `boolean` | `true` | Promote lines sandwiched between active lines back to active so the block reads as continuous |
|
|
53
|
+
| `mergeWindow` | `number` | `300` | Merge deactivation of consecutive lines whose end times fall within this many ms (`0` disables) |
|
|
54
|
+
| `offset.global` | `number` | `0` | Global time offset in ms applied to every lyric |
|
|
55
|
+
| `offset.useMeta` | `boolean` | `true` | Apply the offset carried by the lyric's own meta (`MetaType.Offset`) |
|
|
56
|
+
| `offset.resetTempOnLyricChange` | `boolean` | `true` | Reset the temp offset (set via `updateTempOffset`) to `0` when a new lyric loads |
|
|
56
57
|
|
|
57
58
|
```js
|
|
58
59
|
base.config.update({ driver: 'animation' })
|
package/dist/index.comm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const We=require("@music-lyric-player/utils");require("lodash-es");const Yt=We.freezeObjectDeep({driver:"animation",bridgeActive:!0,offset:{global:0,useMeta:!0,resetTempOnLyricChange:!0}}),lr=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT:Yt},Symbol.toStringTag,{value:"Module"})),Ye=(t=8)=>{const n=new Uint8Array(t);if(typeof globalThis.crypto?.getRandomValues=="function")crypto.getRandomValues(n);else for(let r=0;r<n.length;r++)n[r]=Math.floor(Math.random()*256);return Array.from(n).map(r=>r.toString(16).padStart(2,"0")).join("")};class W{start=0;end=0;get duration(){return this.end-this.start}toJSON(){return{start:this.start,end:this.end,duration:this.duration}}}var ze=(t=>(t.Normal="Normal",t.Space="Space",t))(ze||{});class zt{stress=!1}class cr{type="Normal";time=new W;content="";extended=[];config=new zt}class ur{type="Space";count=1}var Jt=(t=>(t.Unknown="Unknown",t.Translate="Translate",t.Roman="Roman",t))(Jt||{});class fr{type="Unknown";content=""}var Kt=(t=>(t.Normal="Normal",t.Interlude="Interlude",t))(Kt||{});class hr{id=Ye(4).toUpperCase();type="Interlude";time=new W}class Zt{words=[];extended=[];get original(){return this.words.map(n=>n.type===ze.Normal?n.content:" ".repeat(n.count)).join("")}toJSON(){return{words:this.words,extended:this.extended,original:this.original}}}class Qt{type="Normal";id=Ye(4).toUpperCase();time=new W;content=new Zt;agent}class Er extends Qt{}class pr extends Qt{background}var er=(t=>(t.Offset="Offset",t.Duration="Duration",t.Title="Title",t.Singer="Singer",t.Album="Album",t.Creator="Creator",t.Unknown="Unknown",t))(er||{});class F{id=Ye(4).toUpperCase()}class mr extends F{type="Offset";content=0}class dr extends F{type="Duration";content=0}class Rr extends F{type="Title";content=""}class vr extends F{type="Singer";content=""}class Ir extends F{type="Album";content=""}class gr extends F{type="Creator";content={role:"",name:[]}}class $r extends F{type="Unknown";content=""}class Lr{id="";name="";count=0}class tr{global=0;block=0}class Tr{id="";index=new tr}const rr="0.6.0";var sr=(t=>(t.Invalid="Invalid",t.Normal="Normal",t.Syllable="Syllable",t.Pure="Pure",t.Empty="Empty",t.NoTime="NoTime",t))(sr||{});class Nr{version=rr;type="Invalid";metas=[];lines=[];agents=[]}const X=Object.freeze(Object.defineProperty({__proto__:null,Agent:Lr,Extended:fr,ExtendedType:Jt,Info:Nr,InfoType:sr,LineAgent:Tr,LineAgentIndex:tr,LineInterlude:hr,LineNormal:pr,LineNormalBackground:Er,LineNormalContent:Zt,LineType:Kt,MetaAlbum:Ir,MetaCreator:gr,MetaDuration:dr,MetaOffset:mr,MetaSinger:vr,MetaTitle:Rr,MetaType:er,MetaUnknown:$r,Time:W,Version:rr,WordNormal:cr,WordNormalConfig:zt,WordSpace:ur,WordType:ze},Symbol.toStringTag,{value:"Module"}));var H={exports:{}},se,rt;function Y(){if(rt)return se;rt=1;const t="2.0.0",n=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,i=n-6;return se={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},se}var ne,st;function z(){return st||(st=1,ne=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{}),ne}var nt;function B(){return nt||(nt=1,(function(t,n){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:i}=Y(),u=z();n=t.exports={};const l=n.re=[],h=n.safeRe=[],o=n.src=[],a=n.safeSrc=[],e=n.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[f,s]],S=N=>{for(const[A,G]of d)N=N.split(`${A}*`).join(`${A}{0,${G}}`).split(`${A}+`).join(`${A}{1,${G}}`);return N},p=(N,A,G)=>{const w=S(A),x=c++;u(N,x,A),e[N]=x,o[x]=A,a[x]=w,l[x]=new RegExp(A,G?"g":void 0),h[x]=new RegExp(w,G?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),p("MAINVERSION",`(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASE",`(?:-(${o[e.PRERELEASEIDENTIFIER]}(?:\\.${o[e.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${o[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[e.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${f}+`),p("BUILD",`(?:\\+(${o[e.BUILDIDENTIFIER]}(?:\\.${o[e.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${o[e.MAINVERSION]}${o[e.PRERELEASE]}?${o[e.BUILD]}?`),p("FULL",`^${o[e.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${o[e.MAINVERSIONLOOSE]}${o[e.PRERELEASELOOSE]}?${o[e.BUILD]}?`),p("LOOSE",`^${o[e.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${o[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${o[e.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:${o[e.PRERELEASE]})?${o[e.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:${o[e.PRERELEASELOOSE]})?${o[e.BUILD]}?)?)?`),p("XRANGE",`^${o[e.GTLT]}\\s*${o[e.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${o[e.GTLT]}\\s*${o[e.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${o[e.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",o[e.COERCEPLAIN]+`(?:${o[e.PRERELEASE]})?(?:${o[e.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",o[e.COERCE],!0),p("COERCERTLFULL",o[e.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${o[e.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",p("TILDE",`^${o[e.LONETILDE]}${o[e.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${o[e.LONETILDE]}${o[e.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${o[e.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",p("CARET",`^${o[e.LONECARET]}${o[e.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${o[e.LONECARET]}${o[e.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${o[e.GTLT]}\\s*(${o[e.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]}|${o[e.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${o[e.XRANGEPLAIN]})\\s+-\\s+(${o[e.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${o[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[e.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(H,H.exports)),H.exports}var ie,it;function Je(){if(it)return ie;it=1;const t=Object.freeze({loose:!0}),n=Object.freeze({});return ie=s=>s?typeof s!="object"?t:s:n,ie}var ae,at;function nr(){if(at)return ae;at=1;const t=/^[0-9]+$/,n=(s,i)=>{if(typeof s=="number"&&typeof i=="number")return s===i?0:s<i?-1:1;const u=t.test(s),l=t.test(i);return u&&l&&(s=+s,i=+i),s===i?0:u&&!l?-1:l&&!u?1:s<i?-1:1};return ae={compareIdentifiers:n,rcompareIdentifiers:(s,i)=>n(i,s)},ae}var oe,ot;function b(){if(ot)return oe;ot=1;const t=z(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:r}=Y(),{safeRe:s,t:i}=B(),u=Je(),{compareIdentifiers:l}=nr();class h{constructor(a,e){if(e=u(e),a instanceof h){if(a.loose===!!e.loose&&a.includePrerelease===!!e.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>n)throw new TypeError(`version is longer than ${n} characters`);t("SemVer",a,e),this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease;const c=a.trim().match(e.loose?s[i.LOOSE]:s[i.FULL]);if(!c)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map(f=>{if(/^[0-9]+$/.test(f)){const d=+f;if(d>=0&&d<r)return d}return f}):this.prerelease=[],this.build=c[5]?c[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(a){if(t("SemVer.compare",this.version,this.options,a),!(a instanceof h)){if(typeof a=="string"&&a===this.version)return 0;a=new h(a,this.options)}return a.version===this.version?0:this.compareMain(a)||this.comparePre(a)}compareMain(a){return a instanceof h||(a=new h(a,this.options)),this.major<a.major?-1:this.major>a.major?1:this.minor<a.minor?-1:this.minor>a.minor?1:this.patch<a.patch?-1:this.patch>a.patch?1:0}comparePre(a){if(a instanceof h||(a=new h(a,this.options)),this.prerelease.length&&!a.prerelease.length)return-1;if(!this.prerelease.length&&a.prerelease.length)return 1;if(!this.prerelease.length&&!a.prerelease.length)return 0;let e=0;do{const c=this.prerelease[e],f=a.prerelease[e];if(t("prerelease compare",e,c,f),c===void 0&&f===void 0)return 0;if(f===void 0)return 1;if(c===void 0)return-1;if(c===f)continue;return l(c,f)}while(++e)}compareBuild(a){a instanceof h||(a=new h(a,this.options));let e=0;do{const c=this.build[e],f=a.build[e];if(t("build compare",e,c,f),c===void 0&&f===void 0)return 0;if(f===void 0)return 1;if(c===void 0)return-1;if(c===f)continue;return l(c,f)}while(++e)}inc(a,e,c){if(a.startsWith("pre")){if(!e&&c===!1)throw new Error("invalid increment argument: identifier is empty");if(e){const f=`-${e}`.match(this.options.loose?s[i.PRERELEASELOOSE]:s[i.PRERELEASE]);if(!f||f[1]!==e)throw new Error(`invalid identifier: ${e}`)}}switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e,c);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e,c);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e,c),this.inc("pre",e,c);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",e,c),this.inc("pre",e,c);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const f=Number(c)?1:0;if(this.prerelease.length===0)this.prerelease=[f];else{let d=this.prerelease.length;for(;--d>=0;)typeof this.prerelease[d]=="number"&&(this.prerelease[d]++,d=-2);if(d===-1){if(e===this.prerelease.join(".")&&c===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(f)}}if(e){let d=[e,f];c===!1&&(d=[e]),l(this.prerelease[0],e)===0?isNaN(this.prerelease[1])&&(this.prerelease=d):this.prerelease=d}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return oe=h,oe}var le,lt;function V(){if(lt)return le;lt=1;const t=b();return le=(r,s,i=!1)=>{if(r instanceof t)return r;try{return new t(r,s)}catch(u){if(!i)return null;throw u}},le}var ce,ct;function Sr(){if(ct)return ce;ct=1;const t=V();return ce=(r,s)=>{const i=t(r,s);return i?i.version:null},ce}var ue,ut;function Or(){if(ut)return ue;ut=1;const t=V();return ue=(r,s)=>{const i=t(r.trim().replace(/^[=v]+/,""),s);return i?i.version:null},ue}var fe,ft;function Ar(){if(ft)return fe;ft=1;const t=b();return fe=(r,s,i,u,l)=>{typeof i=="string"&&(l=u,u=i,i=void 0);try{return new t(r instanceof t?r.version:r,i).inc(s,u,l).version}catch{return null}},fe}var he,ht;function wr(){if(ht)return he;ht=1;const t=V();return he=(r,s)=>{const i=t(r,null,!0),u=t(s,null,!0),l=i.compare(u);if(l===0)return null;const h=l>0,o=h?i:u,a=h?u:i,e=!!o.prerelease.length;if(!!a.prerelease.length&&!e){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}const f=e?"pre":"";return i.major!==u.major?f+"major":i.minor!==u.minor?f+"minor":i.patch!==u.patch?f+"patch":"prerelease"},he}var Ee,Et;function yr(){if(Et)return Ee;Et=1;const t=b();return Ee=(r,s)=>new t(r,s).major,Ee}var pe,pt;function Cr(){if(pt)return pe;pt=1;const t=b();return pe=(r,s)=>new t(r,s).minor,pe}var me,mt;function qr(){if(mt)return me;mt=1;const t=b();return me=(r,s)=>new t(r,s).patch,me}var de,dt;function Pr(){if(dt)return de;dt=1;const t=V();return de=(r,s)=>{const i=t(r,s);return i&&i.prerelease.length?i.prerelease:null},de}var Re,Rt;function U(){if(Rt)return Re;Rt=1;const t=b();return Re=(r,s,i)=>new t(r,i).compare(new t(s,i)),Re}var ve,vt;function Gr(){if(vt)return ve;vt=1;const t=U();return ve=(r,s,i)=>t(s,r,i),ve}var Ie,It;function xr(){if(It)return Ie;It=1;const t=U();return Ie=(r,s)=>t(r,s,!0),Ie}var ge,gt;function Ke(){if(gt)return ge;gt=1;const t=b();return ge=(r,s,i)=>{const u=new t(r,i),l=new t(s,i);return u.compare(l)||u.compareBuild(l)},ge}var $e,$t;function Dr(){if($t)return $e;$t=1;const t=Ke();return $e=(r,s)=>r.sort((i,u)=>t(i,u,s)),$e}var Le,Lt;function br(){if(Lt)return Le;Lt=1;const t=Ke();return Le=(r,s)=>r.sort((i,u)=>t(u,i,s)),Le}var Te,Tt;function J(){if(Tt)return Te;Tt=1;const t=U();return Te=(r,s,i)=>t(r,s,i)>0,Te}var Ne,Nt;function Ze(){if(Nt)return Ne;Nt=1;const t=U();return Ne=(r,s,i)=>t(r,s,i)<0,Ne}var Se,St;function ir(){if(St)return Se;St=1;const t=U();return Se=(r,s,i)=>t(r,s,i)===0,Se}var Oe,Ot;function ar(){if(Ot)return Oe;Ot=1;const t=U();return Oe=(r,s,i)=>t(r,s,i)!==0,Oe}var Ae,At;function Qe(){if(At)return Ae;At=1;const t=U();return Ae=(r,s,i)=>t(r,s,i)>=0,Ae}var we,wt;function et(){if(wt)return we;wt=1;const t=U();return we=(r,s,i)=>t(r,s,i)<=0,we}var ye,yt;function or(){if(yt)return ye;yt=1;const t=ir(),n=ar(),r=J(),s=Qe(),i=Ze(),u=et();return ye=(h,o,a,e)=>{switch(o){case"===":return typeof h=="object"&&(h=h.version),typeof a=="object"&&(a=a.version),h===a;case"!==":return typeof h=="object"&&(h=h.version),typeof a=="object"&&(a=a.version),h!==a;case"":case"=":case"==":return t(h,a,e);case"!=":return n(h,a,e);case">":return r(h,a,e);case">=":return s(h,a,e);case"<":return i(h,a,e);case"<=":return u(h,a,e);default:throw new TypeError(`Invalid operator: ${o}`)}},ye}var Ce,Ct;function _r(){if(Ct)return Ce;Ct=1;const t=b(),n=V(),{safeRe:r,t:s}=B();return Ce=(u,l)=>{if(u instanceof t)return u;if(typeof u=="number"&&(u=String(u)),typeof u!="string")return null;l=l||{};let h=null;if(!l.rtl)h=u.match(l.includePrerelease?r[s.COERCEFULL]:r[s.COERCE]);else{const d=l.includePrerelease?r[s.COERCERTLFULL]:r[s.COERCERTL];let S;for(;(S=d.exec(u))&&(!h||h.index+h[0].length!==u.length);)(!h||S.index+S[0].length!==h.index+h[0].length)&&(h=S),d.lastIndex=S.index+S[1].length+S[2].length;d.lastIndex=-1}if(h===null)return null;const o=h[2],a=h[3]||"0",e=h[4]||"0",c=l.includePrerelease&&h[5]?`-${h[5]}`:"",f=l.includePrerelease&&h[6]?`+${h[6]}`:"";return n(`${o}.${a}.${e}${c}${f}`,l)},Ce}var qe,qt;function Ur(){if(qt)return qe;qt=1;class t{constructor(){this.max=1e3,this.map=new Map}get(r){const s=this.map.get(r);if(s!==void 0)return this.map.delete(r),this.map.set(r,s),s}delete(r){return this.map.delete(r)}set(r,s){if(!this.delete(r)&&s!==void 0){if(this.map.size>=this.max){const u=this.map.keys().next().value;this.delete(u)}this.map.set(r,s)}return this}}return qe=t,qe}var Pe,Pt;function j(){if(Pt)return Pe;Pt=1;const t=/\s+/g;class n{constructor(E,I){if(I=i(I),E instanceof n)return E.loose===!!I.loose&&E.includePrerelease===!!I.includePrerelease?E:new n(E.raw,I);if(E instanceof u)return this.raw=E.value,this.set=[[E]],this.formatted=void 0,this;if(this.options=I,this.loose=!!I.loose,this.includePrerelease=!!I.includePrerelease,this.raw=E.trim().replace(t," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(g=>!p(g[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const g of this.set)if(g.length===1&&N(g[0])){this.set=[g];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let E=0;E<this.set.length;E++){E>0&&(this.formatted+="||");const I=this.set[E];for(let R=0;R<I.length;R++)R>0&&(this.formatted+=" "),this.formatted+=I[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(E){const R=((this.options.includePrerelease&&d)|(this.options.loose&&S))+":"+E,g=s.get(R);if(g)return g;const v=this.options.loose,$=v?o[a.HYPHENRANGELOOSE]:o[a.HYPHENRANGE];E=E.replace($,te(this.options.includePrerelease)),l("hyphen replace",E),E=E.replace(o[a.COMPARATORTRIM],e),l("comparator trim",E),E=E.replace(o[a.TILDETRIM],c),l("tilde trim",E),E=E.replace(o[a.CARETTRIM],f),l("caret trim",E);let O=E.split(" ").map(q=>G(q,this.options)).join(" ").split(/\s+/).map(q=>ee(q,this.options));v&&(O=O.filter(q=>(l("loose invalid filter",q,this.options),!!q.match(o[a.COMPARATORLOOSE])))),l("range list",O);const T=new Map,y=O.map(q=>new u(q,this.options));for(const q of y){if(p(q))return[q];T.set(q.value,q)}T.size>1&&T.has("")&&T.delete("");const D=[...T.values()];return s.set(R,D),D}intersects(E,I){if(!(E instanceof n))throw new TypeError("a Range is required");return this.set.some(R=>A(R,I)&&E.set.some(g=>A(g,I)&&R.every(v=>g.every($=>v.intersects($,I)))))}test(E){if(!E)return!1;if(typeof E=="string")try{E=new h(E,this.options)}catch{return!1}for(let I=0;I<this.set.length;I++)if(re(this.set[I],E,this.options))return!0;return!1}}Pe=n;const r=Ur(),s=new r,i=Je(),u=K(),l=z(),h=b(),{safeRe:o,t:a,comparatorTrimReplace:e,tildeTrimReplace:c,caretTrimReplace:f}=B(),{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:S}=Y(),p=m=>m.value==="<0.0.0-0",N=m=>m.value==="",A=(m,E)=>{let I=!0;const R=m.slice();let g=R.pop();for(;I&&R.length;)I=R.every(v=>g.intersects(v,E)),g=R.pop();return I},G=(m,E)=>(m=m.replace(o[a.BUILD],""),l("comp",m,E),m=C(m,E),l("caret",m),m=x(m,E),l("tildes",m),m=L(m,E),l("xrange",m),m=Q(m,E),l("stars",m),m),w=m=>!m||m.toLowerCase()==="x"||m==="*",x=(m,E)=>m.trim().split(/\s+/).map(I=>_(I,E)).join(" "),_=(m,E)=>{const I=E.loose?o[a.TILDELOOSE]:o[a.TILDE];return m.replace(I,(R,g,v,$,O)=>{l("tilde",m,R,g,v,$,O);let T;return w(g)?T="":w(v)?T=`>=${g}.0.0 <${+g+1}.0.0-0`:w($)?T=`>=${g}.${v}.0 <${g}.${+v+1}.0-0`:O?(l("replaceTilde pr",O),T=`>=${g}.${v}.${$}-${O} <${g}.${+v+1}.0-0`):T=`>=${g}.${v}.${$} <${g}.${+v+1}.0-0`,l("tilde return",T),T})},C=(m,E)=>m.trim().split(/\s+/).map(I=>P(I,E)).join(" "),P=(m,E)=>{l("caret",m,E);const I=E.loose?o[a.CARETLOOSE]:o[a.CARET],R=E.includePrerelease?"-0":"";return m.replace(I,(g,v,$,O,T)=>{l("caret",m,g,v,$,O,T);let y;return w(v)?y="":w($)?y=`>=${v}.0.0${R} <${+v+1}.0.0-0`:w(O)?v==="0"?y=`>=${v}.${$}.0${R} <${v}.${+$+1}.0-0`:y=`>=${v}.${$}.0${R} <${+v+1}.0.0-0`:T?(l("replaceCaret pr",T),v==="0"?$==="0"?y=`>=${v}.${$}.${O}-${T} <${v}.${$}.${+O+1}-0`:y=`>=${v}.${$}.${O}-${T} <${v}.${+$+1}.0-0`:y=`>=${v}.${$}.${O}-${T} <${+v+1}.0.0-0`):(l("no pr"),v==="0"?$==="0"?y=`>=${v}.${$}.${O}${R} <${v}.${$}.${+O+1}-0`:y=`>=${v}.${$}.${O}${R} <${v}.${+$+1}.0-0`:y=`>=${v}.${$}.${O} <${+v+1}.0.0-0`),l("caret return",y),y})},L=(m,E)=>(l("replaceXRanges",m,E),m.split(/\s+/).map(I=>k(I,E)).join(" ")),k=(m,E)=>{m=m.trim();const I=E.loose?o[a.XRANGELOOSE]:o[a.XRANGE];return m.replace(I,(R,g,v,$,O,T)=>{l("xRange",m,R,g,v,$,O,T);const y=w(v),D=y||w($),q=D||w(O),M=q;return g==="="&&M&&(g=""),T=E.includePrerelease?"-0":"",y?g===">"||g==="<"?R="<0.0.0-0":R="*":g&&M?(D&&($=0),O=0,g===">"?(g=">=",D?(v=+v+1,$=0,O=0):($=+$+1,O=0)):g==="<="&&(g="<",D?v=+v+1:$=+$+1),g==="<"&&(T="-0"),R=`${g+v}.${$}.${O}${T}`):D?R=`>=${v}.0.0${T} <${+v+1}.0.0-0`:q&&(R=`>=${v}.${$}.0${T} <${v}.${+$+1}.0-0`),l("xRange return",R),R})},Q=(m,E)=>(l("replaceStars",m,E),m.trim().replace(o[a.STAR],"")),ee=(m,E)=>(l("replaceGTE0",m,E),m.trim().replace(o[E.includePrerelease?a.GTE0PRE:a.GTE0],"")),te=m=>(E,I,R,g,v,$,O,T,y,D,q,M)=>(w(R)?I="":w(g)?I=`>=${R}.0.0${m?"-0":""}`:w(v)?I=`>=${R}.${g}.0${m?"-0":""}`:$?I=`>=${I}`:I=`>=${I}${m?"-0":""}`,w(y)?T="":w(D)?T=`<${+y+1}.0.0-0`:w(q)?T=`<${y}.${+D+1}.0-0`:M?T=`<=${y}.${D}.${q}-${M}`:m?T=`<${y}.${D}.${+q+1}-0`:T=`<=${T}`,`${I} ${T}`.trim()),re=(m,E,I)=>{for(let R=0;R<m.length;R++)if(!m[R].test(E))return!1;if(E.prerelease.length&&!I.includePrerelease){for(let R=0;R<m.length;R++)if(l(m[R].semver),m[R].semver!==u.ANY&&m[R].semver.prerelease.length>0){const g=m[R].semver;if(g.major===E.major&&g.minor===E.minor&&g.patch===E.patch)return!0}return!1}return!0};return Pe}var Ge,Gt;function K(){if(Gt)return Ge;Gt=1;const t=Symbol("SemVer ANY");class n{static get ANY(){return t}constructor(e,c){if(c=r(c),e instanceof n){if(e.loose===!!c.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),l("comparator",e,c),this.options=c,this.loose=!!c.loose,this.parse(e),this.semver===t?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const c=this.options.loose?s[i.COMPARATORLOOSE]:s[i.COMPARATOR],f=e.match(c);if(!f)throw new TypeError(`Invalid comparator: ${e}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new h(f[2],this.options.loose):this.semver=t}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===t||e===t)return!0;if(typeof e=="string")try{e=new h(e,this.options)}catch{return!1}return u(e,this.operator,this.semver,this.options)}intersects(e,c){if(!(e instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new o(e.value,c).test(this.value):e.operator===""?e.value===""?!0:new o(this.value,c).test(e.semver):(c=r(c),c.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!c.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||u(this.semver,"<",e.semver,c)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||u(this.semver,">",e.semver,c)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}Ge=n;const r=Je(),{safeRe:s,t:i}=B(),u=or(),l=z(),h=b(),o=j();return Ge}var xe,xt;function Z(){if(xt)return xe;xt=1;const t=j();return xe=(r,s,i)=>{try{s=new t(s,i)}catch{return!1}return s.test(r)},xe}var De,Dt;function jr(){if(Dt)return De;Dt=1;const t=j();return De=(r,s)=>new t(r,s).set.map(i=>i.map(u=>u.value).join(" ").trim().split(" ")),De}var be,bt;function Fr(){if(bt)return be;bt=1;const t=b(),n=j();return be=(s,i,u)=>{let l=null,h=null,o=null;try{o=new n(i,u)}catch{return null}return s.forEach(a=>{o.test(a)&&(!l||h.compare(a)===-1)&&(l=a,h=new t(l,u))}),l},be}var _e,_t;function Vr(){if(_t)return _e;_t=1;const t=b(),n=j();return _e=(s,i,u)=>{let l=null,h=null,o=null;try{o=new n(i,u)}catch{return null}return s.forEach(a=>{o.test(a)&&(!l||h.compare(a)===1)&&(l=a,h=new t(l,u))}),l},_e}var Ue,Ut;function kr(){if(Ut)return Ue;Ut=1;const t=b(),n=j(),r=J();return Ue=(i,u)=>{i=new n(i,u);let l=new t("0.0.0");if(i.test(l)||(l=new t("0.0.0-0"),i.test(l)))return l;l=null;for(let h=0;h<i.set.length;++h){const o=i.set[h];let a=null;o.forEach(e=>{const c=new t(e.semver.version);switch(e.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!a||r(c,a))&&(a=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),a&&(!l||r(l,a))&&(l=a)}return l&&i.test(l)?l:null},Ue}var je,jt;function Mr(){if(jt)return je;jt=1;const t=j();return je=(r,s)=>{try{return new t(r,s).range||"*"}catch{return null}},je}var Fe,Ft;function tt(){if(Ft)return Fe;Ft=1;const t=b(),n=K(),{ANY:r}=n,s=j(),i=Z(),u=J(),l=Ze(),h=et(),o=Qe();return Fe=(e,c,f,d)=>{e=new t(e,d),c=new s(c,d);let S,p,N,A,G;switch(f){case">":S=u,p=h,N=l,A=">",G=">=";break;case"<":S=l,p=o,N=u,A="<",G="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(e,c,d))return!1;for(let w=0;w<c.set.length;++w){const x=c.set[w];let _=null,C=null;if(x.forEach(P=>{P.semver===r&&(P=new n(">=0.0.0")),_=_||P,C=C||P,S(P.semver,_.semver,d)?_=P:N(P.semver,C.semver,d)&&(C=P)}),_.operator===A||_.operator===G||(!C.operator||C.operator===A)&&p(e,C.semver))return!1;if(C.operator===G&&N(e,C.semver))return!1}return!0},Fe}var Ve,Vt;function Xr(){if(Vt)return Ve;Vt=1;const t=tt();return Ve=(r,s,i)=>t(r,s,">",i),Ve}var ke,kt;function Br(){if(kt)return ke;kt=1;const t=tt();return ke=(r,s,i)=>t(r,s,"<",i),ke}var Me,Mt;function Hr(){if(Mt)return Me;Mt=1;const t=j();return Me=(r,s,i)=>(r=new t(r,i),s=new t(s,i),r.intersects(s,i)),Me}var Xe,Xt;function Wr(){if(Xt)return Xe;Xt=1;const t=Z(),n=U();return Xe=(r,s,i)=>{const u=[];let l=null,h=null;const o=r.sort((f,d)=>n(f,d,i));for(const f of o)t(f,s,i)?(h=f,l||(l=f)):(h&&u.push([l,h]),h=null,l=null);l&&u.push([l,null]);const a=[];for(const[f,d]of u)f===d?a.push(f):!d&&f===o[0]?a.push("*"):d?f===o[0]?a.push(`<=${d}`):a.push(`${f} - ${d}`):a.push(`>=${f}`);const e=a.join(" || "),c=typeof s.raw=="string"?s.raw:String(s);return e.length<c.length?e:s},Xe}var Be,Bt;function Yr(){if(Bt)return Be;Bt=1;const t=j(),n=K(),{ANY:r}=n,s=Z(),i=U(),u=(c,f,d={})=>{if(c===f)return!0;c=new t(c,d),f=new t(f,d);let S=!1;e:for(const p of c.set){for(const N of f.set){const A=o(p,N,d);if(S=S||A!==null,A)continue e}if(S)return!1}return!0},l=[new n(">=0.0.0-0")],h=[new n(">=0.0.0")],o=(c,f,d)=>{if(c===f)return!0;if(c.length===1&&c[0].semver===r){if(f.length===1&&f[0].semver===r)return!0;d.includePrerelease?c=l:c=h}if(f.length===1&&f[0].semver===r){if(d.includePrerelease)return!0;f=h}const S=new Set;let p,N;for(const L of c)L.operator===">"||L.operator===">="?p=a(p,L,d):L.operator==="<"||L.operator==="<="?N=e(N,L,d):S.add(L.semver);if(S.size>1)return null;let A;if(p&&N){if(A=i(p.semver,N.semver,d),A>0)return null;if(A===0&&(p.operator!==">="||N.operator!=="<="))return null}for(const L of S){if(p&&!s(L,String(p),d)||N&&!s(L,String(N),d))return null;for(const k of f)if(!s(L,String(k),d))return!1;return!0}let G,w,x,_,C=N&&!d.includePrerelease&&N.semver.prerelease.length?N.semver:!1,P=p&&!d.includePrerelease&&p.semver.prerelease.length?p.semver:!1;C&&C.prerelease.length===1&&N.operator==="<"&&C.prerelease[0]===0&&(C=!1);for(const L of f){if(_=_||L.operator===">"||L.operator===">=",x=x||L.operator==="<"||L.operator==="<=",p){if(P&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===P.major&&L.semver.minor===P.minor&&L.semver.patch===P.patch&&(P=!1),L.operator===">"||L.operator===">="){if(G=a(p,L,d),G===L&&G!==p)return!1}else if(p.operator===">="&&!s(p.semver,String(L),d))return!1}if(N){if(C&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===C.major&&L.semver.minor===C.minor&&L.semver.patch===C.patch&&(C=!1),L.operator==="<"||L.operator==="<="){if(w=e(N,L,d),w===L&&w!==N)return!1}else if(N.operator==="<="&&!s(N.semver,String(L),d))return!1}if(!L.operator&&(N||p)&&A!==0)return!1}return!(p&&x&&!N&&A!==0||N&&_&&!p&&A!==0||P||C)},a=(c,f,d)=>{if(!c)return f;const S=i(c.semver,f.semver,d);return S>0?c:S<0||f.operator===">"&&c.operator===">="?f:c},e=(c,f,d)=>{if(!c)return f;const S=i(c.semver,f.semver,d);return S<0?c:S>0||f.operator==="<"&&c.operator==="<="?f:c};return Be=u,Be}var He,Ht;function zr(){if(Ht)return He;Ht=1;const t=B(),n=Y(),r=b(),s=nr(),i=V(),u=Sr(),l=Or(),h=Ar(),o=wr(),a=yr(),e=Cr(),c=qr(),f=Pr(),d=U(),S=Gr(),p=xr(),N=Ke(),A=Dr(),G=br(),w=J(),x=Ze(),_=ir(),C=ar(),P=Qe(),L=et(),k=or(),Q=_r(),ee=K(),te=j(),re=Z(),m=jr(),E=Fr(),I=Vr(),R=kr(),g=Mr(),v=tt(),$=Xr(),O=Br(),T=Hr(),y=Wr(),D=Yr();return He={parse:i,valid:u,clean:l,inc:h,diff:o,major:a,minor:e,patch:c,prerelease:f,compare:d,rcompare:S,compareLoose:p,compareBuild:N,sort:A,rsort:G,gt:w,lt:x,eq:_,neq:C,gte:P,lte:L,cmp:k,coerce:Q,Comparator:ee,Range:te,satisfies:re,toComparators:m,maxSatisfying:E,minSatisfying:I,minVersion:R,validRange:g,outside:v,gtr:$,ltr:O,intersects:T,simplifyRange:y,subset:D,SemVer:r,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:n.SEMVER_SPEC_VERSION,RELEASE_TYPES:n.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers},He}var Jr=zr();const Wt=`^${X.Version}`;class Kr{config=new We.ConfigManager(Yt);event=new We.Event;state;active;time;offset;info;constructor(){this.state={playing:!1,frameId:null,timerId:null,scanIndex:0},this.active={lines:[],index:[]},this.time={start:0,seek:0},this.offset={temp:0,meta:0},this.info=new X.Info,this.config.event.add("update",this.onConfigUpdate)}onConfigUpdate=n=>{const r=n.has("offset.useMeta");r&&this.handleRefreshOffset(),(r||n.has("offset.global"))&&this.handleSyncTime()};handleGetCurrentTime(){return this.state.playing?this.time.seek+(performance.now()-this.time.start):this.time.seek}handleGetEffectiveTime(){return this.handleGetCurrentTime()+this.currentOffset}handleRefreshOffset(){if(this.config.current.offset.useMeta){const r=this.info.metas.find(i=>i.type===X.MetaType.Offset)?.content,s=typeof r=="number"&&Number.isFinite(r)?r:0;this.offset.meta=s}else this.offset.meta=0}handleGetLineTime(n){if(n<0||n>=this.info.lines.length)return 0;if(n===this.info.lines.length-1)return 1/0;const r=this.info.lines[n],s=this.info.lines[n+1];return Math.max(r.time.end,s.time.start)}handleGetActiveIndex(){return this.active.index.length>0?this.active.index[0]:-1}handleBridgeActive(n,r){if(!this.config.current.bridgeActive||r.length<2)return{lines:n,index:r};const s=r[0],i=r[r.length-1];if(i-s+1===r.length)return{lines:n,index:r};const u=new Map;for(let o=0;o<r.length;o++)u.set(r[o],n[o]);const l=[],h=[];for(let o=s;o<=i;o++){const a=u.get(o)??this.info.lines[o];a&&(l.push(a),h.push(o))}return{lines:l,index:h}}handleEmitLinesUpdate(n){const r=this.handleBridgeActive(this.active.lines,this.active.index);this.event.emit("linesUpdate",r.lines,r.index,this.handleGetActiveIndex(),n)}handleSyncTime(n){if(!this.info.lines.length||(n===void 0&&(n=this.handleGetEffectiveTime()),!Number.isFinite(n)))return;const r=[],s=[];let i=this.info.lines.length;for(let u=0;u<this.info.lines.length;u++){const l=this.info.lines[u];if(l.time.start>n){i=u;break}this.handleGetLineTime(u)>n&&(r.push(l),s.push(u))}this.state.scanIndex=i,this.active.lines=r,this.active.index=s,this.handleEmitLinesUpdate(!0)}handleUpdateActiveLines(n){let r=!1;const s=[],i=[];for(let u=0;u<this.active.lines.length;u++){const l=this.active.lines[u],h=this.active.index[u];n>=this.handleGetLineTime(h)?r=!0:(s.push(l),i.push(h))}for(;this.state.scanIndex<this.info.lines.length;){const u=this.info.lines[this.state.scanIndex];if(n>=u.time.start)n<this.handleGetLineTime(this.state.scanIndex)&&(s.push(u),i.push(this.state.scanIndex),r=!0),this.state.scanIndex++;else break}r&&(this.active.lines=s,this.active.index=i,this.handleEmitLinesUpdate(!1))}onTick=()=>{if(!this.state.playing)return;const n=this.handleGetEffectiveTime();switch(this.handleUpdateActiveLines(n),this.config.current.driver){case"animation":this.state.frameId=globalThis.requestAnimationFrame(this.onTick);break;case"timer":this.state.timerId=globalThis.setTimeout(this.onTick,16);break}};updateLyric(n){if(!n)return;let r=n;Jr.satisfies(n.version,Wt)||(console.warn(`[music-lyric-player] ignored lyric with incompatible version "${n.version}", expected "${Wt}"`),r=new X.Info),this.pause(),this.info=r,this.handleRefreshOffset(),this.config.current.offset.resetTempOnLyricChange&&(this.offset.temp=0),this.active.lines=[],this.active.index=[],this.state.scanIndex=0,this.time.seek=0,this.event.emit("lyricUpdate",r),this.event.emit("linesUpdate",[],[],-1,!1)}play(n){this.pause(),typeof n=="number"&&Number.isFinite(n)&&(this.time.seek=n,this.handleSyncTime()),this.time.start=performance.now(),this.state.playing=!0,this.onTick(),this.event.emit("play",this.handleGetCurrentTime())}pause(){this.state.playing&&(this.time.seek=this.handleGetCurrentTime(),this.state.playing=!1,this.event.emit("pause",this.time.seek)),this.state.frameId!==null&&(globalThis.cancelAnimationFrame(this.state.frameId),this.state.frameId=null),this.state.timerId!==null&&(globalThis.clearTimeout(this.state.timerId),this.state.timerId=null)}dispose(){this.pause(),this.event.clear(),this.config.event.remove("update",this.onConfigUpdate),this.active.lines=[],this.active.index=[],this.info=new X.Info}updateTempOffset(n){this.offset.temp=Number.isFinite(n)?n:0,this.handleSyncTime()}matchLinesWithTime(n){const r=n+this.currentOffset,s=[],i=[];for(let u=0;u<this.info.lines.length;u++){const l=this.info.lines[u];if(l.time.start>r)break;this.handleGetLineTime(u)>r&&(s.push(l),i.push(u))}return this.handleBridgeActive(s,i)}convertContentTime(n){return n-this.currentOffset}get currentPlaying(){return this.state.playing}get currentLines(){return this.handleBridgeActive(this.active.lines,this.active.index).lines}get currentIndex(){return this.handleBridgeActive(this.active.lines,this.active.index).index}get currentActive(){return this.handleGetActiveIndex()}get currentInfo(){return this.info}get currentTime(){return this.handleGetCurrentTime()}get currentOffset(){const n=this.config.current.offset.global+this.offset.meta+this.offset.temp;return Number.isFinite(n)?n:0}}exports.BaseLyricPlayer=Kr;exports.BaseLyricPlayerConfig=lr;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const We=require("@music-lyric-player/utils");require("lodash-es");const Yt=We.freezeObjectDeep({driver:"animation",bridgeActive:!0,mergeWindow:300,offset:{global:0,useMeta:!0,resetTempOnLyricChange:!0}}),lr=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT:Yt},Symbol.toStringTag,{value:"Module"})),Ye=(t=8)=>{const s=new Uint8Array(t);if(typeof globalThis.crypto?.getRandomValues=="function")crypto.getRandomValues(s);else for(let r=0;r<s.length;r++)s[r]=Math.floor(Math.random()*256);return Array.from(s).map(r=>r.toString(16).padStart(2,"0")).join("")};class W{start=0;end=0;get duration(){return this.end-this.start}toJSON(){return{start:this.start,end:this.end,duration:this.duration}}}var ze=(t=>(t.Normal="Normal",t.Space="Space",t))(ze||{});class zt{stress=!1}class cr{type="Normal";time=new W;content="";extended=[];config=new zt}class ur{type="Space";count=1}var Jt=(t=>(t.Unknown="Unknown",t.Translate="Translate",t.Roman="Roman",t))(Jt||{});class fr{type="Unknown";content=""}var Kt=(t=>(t.Normal="Normal",t.Interlude="Interlude",t))(Kt||{});class hr{id=Ye(4).toUpperCase();type="Interlude";time=new W}class Zt{words=[];extended=[];get original(){return this.words.map(s=>s.type===ze.Normal?s.content:" ".repeat(s.count)).join("")}toJSON(){return{words:this.words,extended:this.extended,original:this.original}}}class Qt{type="Normal";id=Ye(4).toUpperCase();time=new W;content=new Zt;agent}class dr extends Qt{}class mr extends Qt{background}var er=(t=>(t.Offset="Offset",t.Duration="Duration",t.Title="Title",t.Singer="Singer",t.Album="Album",t.Creator="Creator",t.Unknown="Unknown",t))(er||{});class F{id=Ye(4).toUpperCase()}class Er extends F{type="Offset";content=0}class pr extends F{type="Duration";content=0}class Rr extends F{type="Title";content=""}class vr extends F{type="Singer";content=""}class gr extends F{type="Album";content=""}class Ir extends F{type="Creator";content={role:"",name:[]}}class $r extends F{type="Unknown";content=""}class Lr{id="";name="";count=0}class tr{global=0;block=0}class Tr{id="";index=new tr}const rr="0.6.0";var sr=(t=>(t.Invalid="Invalid",t.Normal="Normal",t.Syllable="Syllable",t.Pure="Pure",t.Empty="Empty",t.NoTime="NoTime",t))(sr||{});class Nr{version=rr;type="Invalid";metas=[];lines=[];agents=[]}const X=Object.freeze(Object.defineProperty({__proto__:null,Agent:Lr,Extended:fr,ExtendedType:Jt,Info:Nr,InfoType:sr,LineAgent:Tr,LineAgentIndex:tr,LineInterlude:hr,LineNormal:mr,LineNormalBackground:dr,LineNormalContent:Zt,LineType:Kt,MetaAlbum:gr,MetaCreator:Ir,MetaDuration:pr,MetaOffset:Er,MetaSinger:vr,MetaTitle:Rr,MetaType:er,MetaUnknown:$r,Time:W,Version:rr,WordNormal:cr,WordNormalConfig:zt,WordSpace:ur,WordType:ze},Symbol.toStringTag,{value:"Module"}));var H={exports:{}},se,rt;function Y(){if(rt)return se;rt=1;const t="2.0.0",s=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=s-6;return se={MAX_LENGTH:s,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},se}var ne,st;function z(){return st||(st=1,ne=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...s)=>console.error("SEMVER",...s):()=>{}),ne}var nt;function B(){return nt||(nt=1,(function(t,s){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Y(),c=z();s=t.exports={};const l=s.re=[],h=s.safeRe=[],o=s.src=[],a=s.safeSrc=[],e=s.t={};let u=0;const f="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",i],[f,n]],S=N=>{for(const[A,G]of p)N=N.split(`${A}*`).join(`${A}{0,${G}}`).split(`${A}+`).join(`${A}{1,${G}}`);return N},m=(N,A,G)=>{const w=S(A),x=u++;c(N,x,A),e[N]=x,o[x]=A,a[x]=w,l[x]=new RegExp(A,G?"g":void 0),h[x]=new RegExp(w,G?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),m("MAINVERSION",`(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${o[e.PRERELEASEIDENTIFIER]}(?:\\.${o[e.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${o[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[e.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${f}+`),m("BUILD",`(?:\\+(${o[e.BUILDIDENTIFIER]}(?:\\.${o[e.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${o[e.MAINVERSION]}${o[e.PRERELEASE]}?${o[e.BUILD]}?`),m("FULL",`^${o[e.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${o[e.MAINVERSIONLOOSE]}${o[e.PRERELEASELOOSE]}?${o[e.BUILD]}?`),m("LOOSE",`^${o[e.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${o[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${o[e.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:${o[e.PRERELEASE]})?${o[e.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:${o[e.PRERELEASELOOSE]})?${o[e.BUILD]}?)?)?`),m("XRANGE",`^${o[e.GTLT]}\\s*${o[e.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${o[e.GTLT]}\\s*${o[e.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),m("COERCE",`${o[e.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",o[e.COERCEPLAIN]+`(?:${o[e.PRERELEASE]})?(?:${o[e.BUILD]})?(?:$|[^\\d])`),m("COERCERTL",o[e.COERCE],!0),m("COERCERTLFULL",o[e.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${o[e.LONETILDE]}\\s+`,!0),s.tildeTrimReplace="$1~",m("TILDE",`^${o[e.LONETILDE]}${o[e.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${o[e.LONETILDE]}${o[e.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${o[e.LONECARET]}\\s+`,!0),s.caretTrimReplace="$1^",m("CARET",`^${o[e.LONECARET]}${o[e.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${o[e.LONECARET]}${o[e.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${o[e.GTLT]}\\s*(${o[e.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]}|${o[e.XRANGEPLAIN]})`,!0),s.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${o[e.XRANGEPLAIN]})\\s+-\\s+(${o[e.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${o[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[e.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(H,H.exports)),H.exports}var ie,it;function Je(){if(it)return ie;it=1;const t=Object.freeze({loose:!0}),s=Object.freeze({});return ie=n=>n?typeof n!="object"?t:n:s,ie}var ae,at;function nr(){if(at)return ae;at=1;const t=/^[0-9]+$/,s=(n,i)=>{if(typeof n=="number"&&typeof i=="number")return n===i?0:n<i?-1:1;const c=t.test(n),l=t.test(i);return c&&l&&(n=+n,i=+i),n===i?0:c&&!l?-1:l&&!c?1:n<i?-1:1};return ae={compareIdentifiers:s,rcompareIdentifiers:(n,i)=>s(i,n)},ae}var oe,ot;function b(){if(ot)return oe;ot=1;const t=z(),{MAX_LENGTH:s,MAX_SAFE_INTEGER:r}=Y(),{safeRe:n,t:i}=B(),c=Je(),{compareIdentifiers:l}=nr();class h{constructor(a,e){if(e=c(e),a instanceof h){if(a.loose===!!e.loose&&a.includePrerelease===!!e.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>s)throw new TypeError(`version is longer than ${s} characters`);t("SemVer",a,e),this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease;const u=a.trim().match(e.loose?n[i.LOOSE]:n[i.FULL]);if(!u)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(f=>{if(/^[0-9]+$/.test(f)){const p=+f;if(p>=0&&p<r)return p}return f}):this.prerelease=[],this.build=u[5]?u[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(a){if(t("SemVer.compare",this.version,this.options,a),!(a instanceof h)){if(typeof a=="string"&&a===this.version)return 0;a=new h(a,this.options)}return a.version===this.version?0:this.compareMain(a)||this.comparePre(a)}compareMain(a){return a instanceof h||(a=new h(a,this.options)),this.major<a.major?-1:this.major>a.major?1:this.minor<a.minor?-1:this.minor>a.minor?1:this.patch<a.patch?-1:this.patch>a.patch?1:0}comparePre(a){if(a instanceof h||(a=new h(a,this.options)),this.prerelease.length&&!a.prerelease.length)return-1;if(!this.prerelease.length&&a.prerelease.length)return 1;if(!this.prerelease.length&&!a.prerelease.length)return 0;let e=0;do{const u=this.prerelease[e],f=a.prerelease[e];if(t("prerelease compare",e,u,f),u===void 0&&f===void 0)return 0;if(f===void 0)return 1;if(u===void 0)return-1;if(u===f)continue;return l(u,f)}while(++e)}compareBuild(a){a instanceof h||(a=new h(a,this.options));let e=0;do{const u=this.build[e],f=a.build[e];if(t("build compare",e,u,f),u===void 0&&f===void 0)return 0;if(f===void 0)return 1;if(u===void 0)return-1;if(u===f)continue;return l(u,f)}while(++e)}inc(a,e,u){if(a.startsWith("pre")){if(!e&&u===!1)throw new Error("invalid increment argument: identifier is empty");if(e){const f=`-${e}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!f||f[1]!==e)throw new Error(`invalid identifier: ${e}`)}}switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e,u);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e,u);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e,u),this.inc("pre",e,u);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",e,u),this.inc("pre",e,u);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const f=Number(u)?1:0;if(this.prerelease.length===0)this.prerelease=[f];else{let p=this.prerelease.length;for(;--p>=0;)typeof this.prerelease[p]=="number"&&(this.prerelease[p]++,p=-2);if(p===-1){if(e===this.prerelease.join(".")&&u===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(f)}}if(e){let p=[e,f];u===!1&&(p=[e]),l(this.prerelease[0],e)===0?isNaN(this.prerelease[1])&&(this.prerelease=p):this.prerelease=p}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return oe=h,oe}var le,lt;function M(){if(lt)return le;lt=1;const t=b();return le=(r,n,i=!1)=>{if(r instanceof t)return r;try{return new t(r,n)}catch(c){if(!i)return null;throw c}},le}var ce,ct;function Sr(){if(ct)return ce;ct=1;const t=M();return ce=(r,n)=>{const i=t(r,n);return i?i.version:null},ce}var ue,ut;function Or(){if(ut)return ue;ut=1;const t=M();return ue=(r,n)=>{const i=t(r.trim().replace(/^[=v]+/,""),n);return i?i.version:null},ue}var fe,ft;function Ar(){if(ft)return fe;ft=1;const t=b();return fe=(r,n,i,c,l)=>{typeof i=="string"&&(l=c,c=i,i=void 0);try{return new t(r instanceof t?r.version:r,i).inc(n,c,l).version}catch{return null}},fe}var he,ht;function wr(){if(ht)return he;ht=1;const t=M();return he=(r,n)=>{const i=t(r,null,!0),c=t(n,null,!0),l=i.compare(c);if(l===0)return null;const h=l>0,o=h?i:c,a=h?c:i,e=!!o.prerelease.length;if(!!a.prerelease.length&&!e){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}const f=e?"pre":"";return i.major!==c.major?f+"major":i.minor!==c.minor?f+"minor":i.patch!==c.patch?f+"patch":"prerelease"},he}var de,dt;function yr(){if(dt)return de;dt=1;const t=b();return de=(r,n)=>new t(r,n).major,de}var me,mt;function Cr(){if(mt)return me;mt=1;const t=b();return me=(r,n)=>new t(r,n).minor,me}var Ee,Et;function qr(){if(Et)return Ee;Et=1;const t=b();return Ee=(r,n)=>new t(r,n).patch,Ee}var pe,pt;function Pr(){if(pt)return pe;pt=1;const t=M();return pe=(r,n)=>{const i=t(r,n);return i&&i.prerelease.length?i.prerelease:null},pe}var Re,Rt;function U(){if(Rt)return Re;Rt=1;const t=b();return Re=(r,n,i)=>new t(r,i).compare(new t(n,i)),Re}var ve,vt;function Gr(){if(vt)return ve;vt=1;const t=U();return ve=(r,n,i)=>t(n,r,i),ve}var ge,gt;function xr(){if(gt)return ge;gt=1;const t=U();return ge=(r,n)=>t(r,n,!0),ge}var Ie,It;function Ke(){if(It)return Ie;It=1;const t=b();return Ie=(r,n,i)=>{const c=new t(r,i),l=new t(n,i);return c.compare(l)||c.compareBuild(l)},Ie}var $e,$t;function Dr(){if($t)return $e;$t=1;const t=Ke();return $e=(r,n)=>r.sort((i,c)=>t(i,c,n)),$e}var Le,Lt;function br(){if(Lt)return Le;Lt=1;const t=Ke();return Le=(r,n)=>r.sort((i,c)=>t(c,i,n)),Le}var Te,Tt;function J(){if(Tt)return Te;Tt=1;const t=U();return Te=(r,n,i)=>t(r,n,i)>0,Te}var Ne,Nt;function Ze(){if(Nt)return Ne;Nt=1;const t=U();return Ne=(r,n,i)=>t(r,n,i)<0,Ne}var Se,St;function ir(){if(St)return Se;St=1;const t=U();return Se=(r,n,i)=>t(r,n,i)===0,Se}var Oe,Ot;function ar(){if(Ot)return Oe;Ot=1;const t=U();return Oe=(r,n,i)=>t(r,n,i)!==0,Oe}var Ae,At;function Qe(){if(At)return Ae;At=1;const t=U();return Ae=(r,n,i)=>t(r,n,i)>=0,Ae}var we,wt;function et(){if(wt)return we;wt=1;const t=U();return we=(r,n,i)=>t(r,n,i)<=0,we}var ye,yt;function or(){if(yt)return ye;yt=1;const t=ir(),s=ar(),r=J(),n=Qe(),i=Ze(),c=et();return ye=(h,o,a,e)=>{switch(o){case"===":return typeof h=="object"&&(h=h.version),typeof a=="object"&&(a=a.version),h===a;case"!==":return typeof h=="object"&&(h=h.version),typeof a=="object"&&(a=a.version),h!==a;case"":case"=":case"==":return t(h,a,e);case"!=":return s(h,a,e);case">":return r(h,a,e);case">=":return n(h,a,e);case"<":return i(h,a,e);case"<=":return c(h,a,e);default:throw new TypeError(`Invalid operator: ${o}`)}},ye}var Ce,Ct;function _r(){if(Ct)return Ce;Ct=1;const t=b(),s=M(),{safeRe:r,t:n}=B();return Ce=(c,l)=>{if(c instanceof t)return c;if(typeof c=="number"&&(c=String(c)),typeof c!="string")return null;l=l||{};let h=null;if(!l.rtl)h=c.match(l.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const p=l.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let S;for(;(S=p.exec(c))&&(!h||h.index+h[0].length!==c.length);)(!h||S.index+S[0].length!==h.index+h[0].length)&&(h=S),p.lastIndex=S.index+S[1].length+S[2].length;p.lastIndex=-1}if(h===null)return null;const o=h[2],a=h[3]||"0",e=h[4]||"0",u=l.includePrerelease&&h[5]?`-${h[5]}`:"",f=l.includePrerelease&&h[6]?`+${h[6]}`:"";return s(`${o}.${a}.${e}${u}${f}`,l)},Ce}var qe,qt;function Ur(){if(qt)return qe;qt=1;class t{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const c=this.map.keys().next().value;this.delete(c)}this.map.set(r,n)}return this}}return qe=t,qe}var Pe,Pt;function j(){if(Pt)return Pe;Pt=1;const t=/\s+/g;class s{constructor(d,g){if(g=i(g),d instanceof s)return d.loose===!!g.loose&&d.includePrerelease===!!g.includePrerelease?d:new s(d.raw,g);if(d instanceof c)return this.raw=d.value,this.set=[[d]],this.formatted=void 0,this;if(this.options=g,this.loose=!!g.loose,this.includePrerelease=!!g.includePrerelease,this.raw=d.trim().replace(t," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(I=>!m(I[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const I of this.set)if(I.length===1&&N(I[0])){this.set=[I];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let d=0;d<this.set.length;d++){d>0&&(this.formatted+="||");const g=this.set[d];for(let R=0;R<g.length;R++)R>0&&(this.formatted+=" "),this.formatted+=g[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(d){const R=((this.options.includePrerelease&&p)|(this.options.loose&&S))+":"+d,I=n.get(R);if(I)return I;const v=this.options.loose,$=v?o[a.HYPHENRANGELOOSE]:o[a.HYPHENRANGE];d=d.replace($,te(this.options.includePrerelease)),l("hyphen replace",d),d=d.replace(o[a.COMPARATORTRIM],e),l("comparator trim",d),d=d.replace(o[a.TILDETRIM],u),l("tilde trim",d),d=d.replace(o[a.CARETTRIM],f),l("caret trim",d);let O=d.split(" ").map(q=>G(q,this.options)).join(" ").split(/\s+/).map(q=>ee(q,this.options));v&&(O=O.filter(q=>(l("loose invalid filter",q,this.options),!!q.match(o[a.COMPARATORLOOSE])))),l("range list",O);const T=new Map,y=O.map(q=>new c(q,this.options));for(const q of y){if(m(q))return[q];T.set(q.value,q)}T.size>1&&T.has("")&&T.delete("");const D=[...T.values()];return n.set(R,D),D}intersects(d,g){if(!(d instanceof s))throw new TypeError("a Range is required");return this.set.some(R=>A(R,g)&&d.set.some(I=>A(I,g)&&R.every(v=>I.every($=>v.intersects($,g)))))}test(d){if(!d)return!1;if(typeof d=="string")try{d=new h(d,this.options)}catch{return!1}for(let g=0;g<this.set.length;g++)if(re(this.set[g],d,this.options))return!0;return!1}}Pe=s;const r=Ur(),n=new r,i=Je(),c=K(),l=z(),h=b(),{safeRe:o,t:a,comparatorTrimReplace:e,tildeTrimReplace:u,caretTrimReplace:f}=B(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:S}=Y(),m=E=>E.value==="<0.0.0-0",N=E=>E.value==="",A=(E,d)=>{let g=!0;const R=E.slice();let I=R.pop();for(;g&&R.length;)g=R.every(v=>I.intersects(v,d)),I=R.pop();return g},G=(E,d)=>(E=E.replace(o[a.BUILD],""),l("comp",E,d),E=C(E,d),l("caret",E),E=x(E,d),l("tildes",E),E=L(E,d),l("xrange",E),E=Q(E,d),l("stars",E),E),w=E=>!E||E.toLowerCase()==="x"||E==="*",x=(E,d)=>E.trim().split(/\s+/).map(g=>_(g,d)).join(" "),_=(E,d)=>{const g=d.loose?o[a.TILDELOOSE]:o[a.TILDE];return E.replace(g,(R,I,v,$,O)=>{l("tilde",E,R,I,v,$,O);let T;return w(I)?T="":w(v)?T=`>=${I}.0.0 <${+I+1}.0.0-0`:w($)?T=`>=${I}.${v}.0 <${I}.${+v+1}.0-0`:O?(l("replaceTilde pr",O),T=`>=${I}.${v}.${$}-${O} <${I}.${+v+1}.0-0`):T=`>=${I}.${v}.${$} <${I}.${+v+1}.0-0`,l("tilde return",T),T})},C=(E,d)=>E.trim().split(/\s+/).map(g=>P(g,d)).join(" "),P=(E,d)=>{l("caret",E,d);const g=d.loose?o[a.CARETLOOSE]:o[a.CARET],R=d.includePrerelease?"-0":"";return E.replace(g,(I,v,$,O,T)=>{l("caret",E,I,v,$,O,T);let y;return w(v)?y="":w($)?y=`>=${v}.0.0${R} <${+v+1}.0.0-0`:w(O)?v==="0"?y=`>=${v}.${$}.0${R} <${v}.${+$+1}.0-0`:y=`>=${v}.${$}.0${R} <${+v+1}.0.0-0`:T?(l("replaceCaret pr",T),v==="0"?$==="0"?y=`>=${v}.${$}.${O}-${T} <${v}.${$}.${+O+1}-0`:y=`>=${v}.${$}.${O}-${T} <${v}.${+$+1}.0-0`:y=`>=${v}.${$}.${O}-${T} <${+v+1}.0.0-0`):(l("no pr"),v==="0"?$==="0"?y=`>=${v}.${$}.${O}${R} <${v}.${$}.${+O+1}-0`:y=`>=${v}.${$}.${O}${R} <${v}.${+$+1}.0-0`:y=`>=${v}.${$}.${O} <${+v+1}.0.0-0`),l("caret return",y),y})},L=(E,d)=>(l("replaceXRanges",E,d),E.split(/\s+/).map(g=>V(g,d)).join(" ")),V=(E,d)=>{E=E.trim();const g=d.loose?o[a.XRANGELOOSE]:o[a.XRANGE];return E.replace(g,(R,I,v,$,O,T)=>{l("xRange",E,R,I,v,$,O,T);const y=w(v),D=y||w($),q=D||w(O),k=q;return I==="="&&k&&(I=""),T=d.includePrerelease?"-0":"",y?I===">"||I==="<"?R="<0.0.0-0":R="*":I&&k?(D&&($=0),O=0,I===">"?(I=">=",D?(v=+v+1,$=0,O=0):($=+$+1,O=0)):I==="<="&&(I="<",D?v=+v+1:$=+$+1),I==="<"&&(T="-0"),R=`${I+v}.${$}.${O}${T}`):D?R=`>=${v}.0.0${T} <${+v+1}.0.0-0`:q&&(R=`>=${v}.${$}.0${T} <${v}.${+$+1}.0-0`),l("xRange return",R),R})},Q=(E,d)=>(l("replaceStars",E,d),E.trim().replace(o[a.STAR],"")),ee=(E,d)=>(l("replaceGTE0",E,d),E.trim().replace(o[d.includePrerelease?a.GTE0PRE:a.GTE0],"")),te=E=>(d,g,R,I,v,$,O,T,y,D,q,k)=>(w(R)?g="":w(I)?g=`>=${R}.0.0${E?"-0":""}`:w(v)?g=`>=${R}.${I}.0${E?"-0":""}`:$?g=`>=${g}`:g=`>=${g}${E?"-0":""}`,w(y)?T="":w(D)?T=`<${+y+1}.0.0-0`:w(q)?T=`<${y}.${+D+1}.0-0`:k?T=`<=${y}.${D}.${q}-${k}`:E?T=`<${y}.${D}.${+q+1}-0`:T=`<=${T}`,`${g} ${T}`.trim()),re=(E,d,g)=>{for(let R=0;R<E.length;R++)if(!E[R].test(d))return!1;if(d.prerelease.length&&!g.includePrerelease){for(let R=0;R<E.length;R++)if(l(E[R].semver),E[R].semver!==c.ANY&&E[R].semver.prerelease.length>0){const I=E[R].semver;if(I.major===d.major&&I.minor===d.minor&&I.patch===d.patch)return!0}return!1}return!0};return Pe}var Ge,Gt;function K(){if(Gt)return Ge;Gt=1;const t=Symbol("SemVer ANY");class s{static get ANY(){return t}constructor(e,u){if(u=r(u),e instanceof s){if(e.loose===!!u.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),l("comparator",e,u),this.options=u,this.loose=!!u.loose,this.parse(e),this.semver===t?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const u=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],f=e.match(u);if(!f)throw new TypeError(`Invalid comparator: ${e}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new h(f[2],this.options.loose):this.semver=t}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===t||e===t)return!0;if(typeof e=="string")try{e=new h(e,this.options)}catch{return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,u){if(!(e instanceof s))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new o(e.value,u).test(this.value):e.operator===""?e.value===""?!0:new o(this.value,u).test(e.semver):(u=r(u),u.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!u.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||c(this.semver,"<",e.semver,u)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||c(this.semver,">",e.semver,u)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}Ge=s;const r=Je(),{safeRe:n,t:i}=B(),c=or(),l=z(),h=b(),o=j();return Ge}var xe,xt;function Z(){if(xt)return xe;xt=1;const t=j();return xe=(r,n,i)=>{try{n=new t(n,i)}catch{return!1}return n.test(r)},xe}var De,Dt;function jr(){if(Dt)return De;Dt=1;const t=j();return De=(r,n)=>new t(r,n).set.map(i=>i.map(c=>c.value).join(" ").trim().split(" ")),De}var be,bt;function Fr(){if(bt)return be;bt=1;const t=b(),s=j();return be=(n,i,c)=>{let l=null,h=null,o=null;try{o=new s(i,c)}catch{return null}return n.forEach(a=>{o.test(a)&&(!l||h.compare(a)===-1)&&(l=a,h=new t(l,c))}),l},be}var _e,_t;function Mr(){if(_t)return _e;_t=1;const t=b(),s=j();return _e=(n,i,c)=>{let l=null,h=null,o=null;try{o=new s(i,c)}catch{return null}return n.forEach(a=>{o.test(a)&&(!l||h.compare(a)===1)&&(l=a,h=new t(l,c))}),l},_e}var Ue,Ut;function Vr(){if(Ut)return Ue;Ut=1;const t=b(),s=j(),r=J();return Ue=(i,c)=>{i=new s(i,c);let l=new t("0.0.0");if(i.test(l)||(l=new t("0.0.0-0"),i.test(l)))return l;l=null;for(let h=0;h<i.set.length;++h){const o=i.set[h];let a=null;o.forEach(e=>{const u=new t(e.semver.version);switch(e.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!a||r(u,a))&&(a=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),a&&(!l||r(l,a))&&(l=a)}return l&&i.test(l)?l:null},Ue}var je,jt;function kr(){if(jt)return je;jt=1;const t=j();return je=(r,n)=>{try{return new t(r,n).range||"*"}catch{return null}},je}var Fe,Ft;function tt(){if(Ft)return Fe;Ft=1;const t=b(),s=K(),{ANY:r}=s,n=j(),i=Z(),c=J(),l=Ze(),h=et(),o=Qe();return Fe=(e,u,f,p)=>{e=new t(e,p),u=new n(u,p);let S,m,N,A,G;switch(f){case">":S=c,m=h,N=l,A=">",G=">=";break;case"<":S=l,m=o,N=c,A="<",G="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(e,u,p))return!1;for(let w=0;w<u.set.length;++w){const x=u.set[w];let _=null,C=null;if(x.forEach(P=>{P.semver===r&&(P=new s(">=0.0.0")),_=_||P,C=C||P,S(P.semver,_.semver,p)?_=P:N(P.semver,C.semver,p)&&(C=P)}),_.operator===A||_.operator===G||(!C.operator||C.operator===A)&&m(e,C.semver))return!1;if(C.operator===G&&N(e,C.semver))return!1}return!0},Fe}var Me,Mt;function Xr(){if(Mt)return Me;Mt=1;const t=tt();return Me=(r,n,i)=>t(r,n,">",i),Me}var Ve,Vt;function Br(){if(Vt)return Ve;Vt=1;const t=tt();return Ve=(r,n,i)=>t(r,n,"<",i),Ve}var ke,kt;function Hr(){if(kt)return ke;kt=1;const t=j();return ke=(r,n,i)=>(r=new t(r,i),n=new t(n,i),r.intersects(n,i)),ke}var Xe,Xt;function Wr(){if(Xt)return Xe;Xt=1;const t=Z(),s=U();return Xe=(r,n,i)=>{const c=[];let l=null,h=null;const o=r.sort((f,p)=>s(f,p,i));for(const f of o)t(f,n,i)?(h=f,l||(l=f)):(h&&c.push([l,h]),h=null,l=null);l&&c.push([l,null]);const a=[];for(const[f,p]of c)f===p?a.push(f):!p&&f===o[0]?a.push("*"):p?f===o[0]?a.push(`<=${p}`):a.push(`${f} - ${p}`):a.push(`>=${f}`);const e=a.join(" || "),u=typeof n.raw=="string"?n.raw:String(n);return e.length<u.length?e:n},Xe}var Be,Bt;function Yr(){if(Bt)return Be;Bt=1;const t=j(),s=K(),{ANY:r}=s,n=Z(),i=U(),c=(u,f,p={})=>{if(u===f)return!0;u=new t(u,p),f=new t(f,p);let S=!1;e:for(const m of u.set){for(const N of f.set){const A=o(m,N,p);if(S=S||A!==null,A)continue e}if(S)return!1}return!0},l=[new s(">=0.0.0-0")],h=[new s(">=0.0.0")],o=(u,f,p)=>{if(u===f)return!0;if(u.length===1&&u[0].semver===r){if(f.length===1&&f[0].semver===r)return!0;p.includePrerelease?u=l:u=h}if(f.length===1&&f[0].semver===r){if(p.includePrerelease)return!0;f=h}const S=new Set;let m,N;for(const L of u)L.operator===">"||L.operator===">="?m=a(m,L,p):L.operator==="<"||L.operator==="<="?N=e(N,L,p):S.add(L.semver);if(S.size>1)return null;let A;if(m&&N){if(A=i(m.semver,N.semver,p),A>0)return null;if(A===0&&(m.operator!==">="||N.operator!=="<="))return null}for(const L of S){if(m&&!n(L,String(m),p)||N&&!n(L,String(N),p))return null;for(const V of f)if(!n(L,String(V),p))return!1;return!0}let G,w,x,_,C=N&&!p.includePrerelease&&N.semver.prerelease.length?N.semver:!1,P=m&&!p.includePrerelease&&m.semver.prerelease.length?m.semver:!1;C&&C.prerelease.length===1&&N.operator==="<"&&C.prerelease[0]===0&&(C=!1);for(const L of f){if(_=_||L.operator===">"||L.operator===">=",x=x||L.operator==="<"||L.operator==="<=",m){if(P&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===P.major&&L.semver.minor===P.minor&&L.semver.patch===P.patch&&(P=!1),L.operator===">"||L.operator===">="){if(G=a(m,L,p),G===L&&G!==m)return!1}else if(m.operator===">="&&!n(m.semver,String(L),p))return!1}if(N){if(C&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===C.major&&L.semver.minor===C.minor&&L.semver.patch===C.patch&&(C=!1),L.operator==="<"||L.operator==="<="){if(w=e(N,L,p),w===L&&w!==N)return!1}else if(N.operator==="<="&&!n(N.semver,String(L),p))return!1}if(!L.operator&&(N||m)&&A!==0)return!1}return!(m&&x&&!N&&A!==0||N&&_&&!m&&A!==0||P||C)},a=(u,f,p)=>{if(!u)return f;const S=i(u.semver,f.semver,p);return S>0?u:S<0||f.operator===">"&&u.operator===">="?f:u},e=(u,f,p)=>{if(!u)return f;const S=i(u.semver,f.semver,p);return S<0?u:S>0||f.operator==="<"&&u.operator==="<="?f:u};return Be=c,Be}var He,Ht;function zr(){if(Ht)return He;Ht=1;const t=B(),s=Y(),r=b(),n=nr(),i=M(),c=Sr(),l=Or(),h=Ar(),o=wr(),a=yr(),e=Cr(),u=qr(),f=Pr(),p=U(),S=Gr(),m=xr(),N=Ke(),A=Dr(),G=br(),w=J(),x=Ze(),_=ir(),C=ar(),P=Qe(),L=et(),V=or(),Q=_r(),ee=K(),te=j(),re=Z(),E=jr(),d=Fr(),g=Mr(),R=Vr(),I=kr(),v=tt(),$=Xr(),O=Br(),T=Hr(),y=Wr(),D=Yr();return He={parse:i,valid:c,clean:l,inc:h,diff:o,major:a,minor:e,patch:u,prerelease:f,compare:p,rcompare:S,compareLoose:m,compareBuild:N,sort:A,rsort:G,gt:w,lt:x,eq:_,neq:C,gte:P,lte:L,cmp:V,coerce:Q,Comparator:ee,Range:te,satisfies:re,toComparators:E,maxSatisfying:d,minSatisfying:g,minVersion:R,validRange:I,outside:v,gtr:$,ltr:O,intersects:T,simplifyRange:y,subset:D,SemVer:r,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:s.SEMVER_SPEC_VERSION,RELEASE_TYPES:s.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},He}var Jr=zr();const Wt=`^${X.Version}`;class Kr{config=new We.ConfigManager(Yt);event=new We.Event;state;active;time;offset;info;mergedLineEnd=[];constructor(){this.state={playing:!1,frameId:null,timerId:null,scanIndex:0},this.active={lines:[],index:[]},this.time={start:0,seek:0},this.offset={temp:0,meta:0},this.info=new X.Info,this.config.event.add("update",this.onConfigUpdate)}onConfigUpdate=s=>{const r=s.has("offset.useMeta");r&&this.handleRefreshOffset(),(r||s.has("offset.global"))&&this.handleSyncTime(),s.has("mergeWindow")&&(this.handleBuildMergedLineEnd(),this.handleSyncTime())};handleGetCurrentTime(){return this.state.playing?this.time.seek+(performance.now()-this.time.start):this.time.seek}handleGetEffectiveTime(){return this.handleGetCurrentTime()+this.currentOffset}handleRefreshOffset(){if(this.config.current.offset.useMeta){const r=this.info.metas.find(i=>i.type===X.MetaType.Offset)?.content,n=typeof r=="number"&&Number.isFinite(r)?r:0;this.offset.meta=n}else this.offset.meta=0}handleGetLineTime(s){if(s<0||s>=this.info.lines.length)return 0;if(s===this.info.lines.length-1)return 1/0;const r=this.info.lines[s],n=this.info.lines[s+1];return Math.max(r.time.end,n.time.start)}handleBuildMergedLineEnd(){const s=this.info.lines.length,r=new Array(s);if(s===0){this.mergedLineEnd=r;return}const n=Math.max(0,this.config.current.mergeWindow);let i=this.handleGetLineTime(s-1);r[s-1]=i;for(let c=s-2;c>=0;c--){const l=this.handleGetLineTime(c);n>0&&Math.abs(i-l)<n?r[c]=Math.max(l,r[c+1]):r[c]=l,i=l}this.mergedLineEnd=r}handleGetMergedLineTime(s){const r=this.mergedLineEnd[s];return r===void 0?this.handleGetLineTime(s):r}handleGetActiveIndex(){return this.active.index.length>0?this.active.index[0]:-1}handleBridgeActive(s,r){if(!this.config.current.bridgeActive||r.length<2)return{lines:s,index:r};const n=r[0],i=r[r.length-1];if(i-n+1===r.length)return{lines:s,index:r};const c=new Map;for(let o=0;o<r.length;o++)c.set(r[o],s[o]);const l=[],h=[];for(let o=n;o<=i;o++){const a=c.get(o)??this.info.lines[o];a&&(l.push(a),h.push(o))}return{lines:l,index:h}}handleEmitLinesUpdate(s){const r=this.handleBridgeActive(this.active.lines,this.active.index);this.event.emit("linesUpdate",r.lines,r.index,this.handleGetActiveIndex(),s)}handleSyncTime(s){if(!this.info.lines.length||(s===void 0&&(s=this.handleGetEffectiveTime()),!Number.isFinite(s)))return;const r=[],n=[];let i=this.info.lines.length;for(let c=0;c<this.info.lines.length;c++){const l=this.info.lines[c];if(l.time.start>s){i=c;break}this.handleGetMergedLineTime(c)>s&&(r.push(l),n.push(c))}this.state.scanIndex=i,this.active.lines=r,this.active.index=n,this.handleEmitLinesUpdate(!0)}handleUpdateActiveLines(s){let r=!1;const n=[],i=[];for(let c=0;c<this.active.lines.length;c++){const l=this.active.lines[c],h=this.active.index[c];s>=this.handleGetMergedLineTime(h)?r=!0:(n.push(l),i.push(h))}for(;this.state.scanIndex<this.info.lines.length;){const c=this.info.lines[this.state.scanIndex];if(s>=c.time.start)s<this.handleGetMergedLineTime(this.state.scanIndex)&&(n.push(c),i.push(this.state.scanIndex),r=!0),this.state.scanIndex++;else break}r&&(this.active.lines=n,this.active.index=i,this.handleEmitLinesUpdate(!1))}onTick=()=>{if(!this.state.playing)return;const s=this.handleGetEffectiveTime();switch(this.handleUpdateActiveLines(s),this.config.current.driver){case"animation":this.state.frameId=globalThis.requestAnimationFrame(this.onTick);break;case"timer":this.state.timerId=globalThis.setTimeout(this.onTick,16);break}};updateLyric(s){if(!s)return;let r=s;Jr.satisfies(s.version,Wt)||(console.warn(`[music-lyric-player] ignored lyric with incompatible version "${s.version}", expected "${Wt}"`),r=new X.Info),this.pause(),this.info=r,this.handleBuildMergedLineEnd(),this.handleRefreshOffset(),this.config.current.offset.resetTempOnLyricChange&&(this.offset.temp=0),this.active.lines=[],this.active.index=[],this.state.scanIndex=0,this.time.seek=0,this.event.emit("lyricUpdate",r),this.event.emit("linesUpdate",[],[],-1,!1)}play(s){this.pause(),typeof s=="number"&&Number.isFinite(s)&&(this.time.seek=s,this.handleSyncTime()),this.time.start=performance.now(),this.state.playing=!0,this.onTick(),this.event.emit("play",this.handleGetCurrentTime())}pause(){this.state.playing&&(this.time.seek=this.handleGetCurrentTime(),this.state.playing=!1,this.event.emit("pause",this.time.seek)),this.state.frameId!==null&&(globalThis.cancelAnimationFrame(this.state.frameId),this.state.frameId=null),this.state.timerId!==null&&(globalThis.clearTimeout(this.state.timerId),this.state.timerId=null)}dispose(){this.pause(),this.event.clear(),this.config.event.remove("update",this.onConfigUpdate),this.active.lines=[],this.active.index=[],this.info=new X.Info}updateTempOffset(s){this.offset.temp=Number.isFinite(s)?s:0,this.handleSyncTime()}matchLinesWithTime(s){const r=s+this.currentOffset,n=[],i=[];for(let c=0;c<this.info.lines.length;c++){const l=this.info.lines[c];if(l.time.start>r)break;this.handleGetMergedLineTime(c)>r&&(n.push(l),i.push(c))}return this.handleBridgeActive(n,i)}convertContentTime(s){return s-this.currentOffset}get currentPlaying(){return this.state.playing}get currentLines(){return this.handleBridgeActive(this.active.lines,this.active.index).lines}get currentIndex(){return this.handleBridgeActive(this.active.lines,this.active.index).index}get currentActive(){return this.handleGetActiveIndex()}get currentInfo(){return this.info}get currentTime(){return this.handleGetCurrentTime()}get currentOffset(){const s=this.config.current.offset.global+this.offset.meta+this.offset.temp;return Number.isFinite(s)?s:0}}exports.BaseLyricPlayer=Kr;exports.BaseLyricPlayerConfig=lr;
|
|
2
2
|
//# sourceMappingURL=index.comm.js.map
|