@music-lyric-player/base 0.13.0 → 0.15.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 +16 -14
- package/dist/index.comm.js +1 -1
- package/dist/index.comm.js.map +1 -1
- package/dist/index.ecma.d.ts +34 -3
- package/dist/index.ecma.js +1279 -823
- package/dist/index.ecma.js.map +1 -1
- package/package.json +3 -3
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,15 @@ 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
|
+
| `mergeLimit` | `number` | `3` | Max lines per merge batch; longer runs force-flush every `mergeLimit` lines (`0` unbounded) |
|
|
55
|
+
| `offset.global` | `number` | `0` | Global time offset in ms applied to every lyric |
|
|
56
|
+
| `offset.useMeta` | `boolean` | `true` | Apply the offset carried by the lyric's own meta (`MetaType.Offset`) |
|
|
57
|
+
| `offset.resetTempOnLyricChange` | `boolean` | `true` | Reset the temp offset (set via `updateTempOffset`) to `0` when a new lyric loads |
|
|
56
58
|
|
|
57
59
|
```js
|
|
58
60
|
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 Ye=require("@music-lyric-player/utils");require("lodash-es");const zt=Ye.freezeObjectDeep({driver:"animation",bridgeActive:!0,mergeWindow:300,mergeLimit:3,offset:{global:0,useMeta:!0,resetTempOnLyricChange:!0}}),mr=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT:zt},Symbol.toStringTag,{value:"Module"})),B=(s=8)=>{let e="";for(;e.length<s;)e+=Math.random().toString(36).slice(2);return e.slice(0,s)};var Yt=(s=>(s.ChineseSimplified="zh-hans",s.ChineseTraditional="zh-hant",s.English="en",s.Japanese="ja",s.Korean="ko",s.Russian="ru",s.French="fr",s.German="de",s.Spanish="es",s.Italian="it",s.Portuguese="pt",s))(Yt||{});class pr{tag="";percent=0}class Kt{list=[];get primary(){let e;for(let t=0,n=this.list.length;t<n;t++)(!e||this.list[t].percent>e.percent)&&(e=this.list[t]);return e}}class Jt{start=0;end=0;get duration(){return this.end-this.start}}class dr{id=B(6).toUpperCase();time;content=""}class Zt{id=B(6).toUpperCase();time;words=[];language;get content(){let e="";for(let t=0,n=this.words.length;t<n;t++)e+=this.words[t].content;return e}}class Er extends Zt{key=""}class gr{ruby;romans;unknowns}var k=(s=>(s.Normal="Normal",s.Space="Space",s))(k||{});class Rr{id=B(6).toUpperCase();type="Normal";time;content="";language;annotation;stress=!1}class vr{type="Space";count=1}class Y{language;content=""}class Qt extends Y{key=""}class er{#e;constructor(e){this.#e=e}#i(e){let t="",n=0,i,c=!1;for(let h=0,o=this.#e.words.length;h<o;h++){const a=this.#e.words[h];if(a.type===k.Space){n+=a.count;continue}const r=e(a);r&&(c&&(t+=" ".repeat(n)),t+=r.content,i??=r.language,n=0,c=!0)}if(!c)return;const l=new Y;return l.content=t,l.language=i,l}#a(e){const t=[];for(let i=0,c=this.#e.words.length;i<c;i++){const l=this.#e.words[i];if(l.type===k.Space)continue;const h=e(l);if(h)for(const o of h){const a=o.language??"";t.includes(a)||t.push(a)}}if(!t.length)return;const n=[];for(const i of t){let c="",l=0,h=!1;for(let a=0,r=this.#e.words.length;a<r;a++){const u=this.#e.words[a];if(u.type===k.Space){l+=u.count;continue}const f=e(u)?.find(E=>(E.language??"")===i);f&&(h&&(c+=" ".repeat(l)),c+=f.content,l=0,h=!0)}const o=new Y;o.content=c,o.language=i||void 0,n.push(o)}return n}#o(){const e=[];for(let n=0,i=this.#e.words.length;n<i;n++){const c=this.#e.words[n];if(c.type===k.Space)continue;const l=c.annotation?.unknowns;if(l)for(const h of l)e.includes(h.key)||e.push(h.key)}if(!e.length)return;const t=[];for(const n of e){let i="",c=0,l,h=!1;for(let a=0,r=this.#e.words.length;a<r;a++){const u=this.#e.words[a];if(u.type===k.Space){c+=u.count;continue}const f=u.annotation?.unknowns?.find(E=>E.key===n);f&&(h&&(i+=" ".repeat(c)),i+=f.content,l??=f.language,c=0,h=!0)}const o=new Qt;o.key=n,o.content=i,o.language=l,t.push(o)}return t}#t;get ruby(){return this.#t??this.#i(e=>e.annotation?.ruby)}set ruby(e){this.#t=e}#r;get romans(){return this.#r??this.#a(e=>e.annotation?.romans)}set romans(e){this.#r=e}#s;get translates(){return this.#s}set translates(e){this.#s=e}#n;get unknowns(){return this.#n??this.#o()}set unknowns(e){this.#n=e}}var tr=(s=>(s.Normal="Normal",s.Interlude="Interlude",s))(tr||{});class rr{id=B(6).toUpperCase();time=new Jt}class sr extends rr{type="Normal";agent;words=[];get original(){let e="";for(let t=0,n=this.words.length;t<n;t++){const i=this.words[t];e+=i.type===k.Normal?i.content:" ".repeat(i.count)}return e}annotation=new er(this);#e;get languages(){if(this.#e?.length)return this.#e;const e=new Set;for(let t=0,n=this.words.length;t<n;t++){const i=this.words[t];i.type===k.Normal&&i.language&&e.add(i.language)}return[...e]}set languages(e){this.#e=e}}class Ir extends sr{background}class $r extends rr{type="Interlude"}var _=(s=>(s.Offset="Offset",s.Duration="Duration",s.Title="Title",s.Singer="Singer",s.Album="Album",s.Creator="Creator",s.Author="Author",s.Isrc="Isrc",s.Unknown="Unknown",s))(_||{});const Lr=(s,e,t)=>({id:B(6).toUpperCase(),type:s,key:e,value:t});class nr{list=[];listOf(e){return this.list.filter(t=>t.type===e)}get offsets(){return this.listOf(_.Offset)}get durations(){return this.listOf(_.Duration)}get titles(){return this.listOf(_.Title)}get singers(){return this.listOf(_.Singer)}get albums(){return this.listOf(_.Album)}get creators(){return this.listOf(_.Creator)}get authors(){return this.listOf(_.Author)}get isrcs(){return this.listOf(_.Isrc)}get unknowns(){return this.listOf(_.Unknown)}}var ir=(s=>(s.Person="Person",s.Group="Group",s.Other="Other",s.Unknown="Unknown",s))(ir||{});class Tr{id="";type="Unknown";count=0;names=[]}class Sr{id="";globalIndex=0;blockIndex=0}const ar="0.8.0";var or=(s=>(s.Invalid="Invalid",s.Empty="Empty",s.Normal="Normal",s))(or||{}),lr=(s=>(s.None="None",s.Line="Line",s.Syllable="Syllable",s))(lr||{});class Or{version=ar;type="Invalid";timing="None";meta=new nr;language=new Kt;agents=[];lines=[]}const z=Object.freeze(Object.defineProperty({__proto__:null,Agent:Tr,AgentType:ir,Info:Or,InfoTiming:lr,InfoType:or,Language:Kt,LanguageItem:pr,LanguageType:Yt,LineAgent:Sr,LineAnnotation:er,LineAnnotationItem:Y,LineInterlude:$r,LineNormal:Ir,LineNormalBase:sr,LineType:tr,LineUnknownAnnotation:Qt,Meta:nr,MetaType:_,Time:Jt,Version:ar,WordAnnotation:gr,WordAnnotationContent:dr,WordAnnotationItem:Zt,WordNormal:Rr,WordSpace:vr,WordType:k,WordUnknownAnnotation:Er,createMetaItem:Lr},Symbol.toStringTag,{value:"Module"}));class Nr{lines=[];mergedEnd=[];getRawTime(e){const t=this.lines;return e<0||e>=t.length?0:e===t.length-1?1/0:Math.max(t[e].time.end,t[e+1].time.start)}build(e,t,n){this.lines=e;const i=e.length,c=new Array(i);if(i===0){this.mergedEnd=c;return}const l=Math.max(0,t),h=n>0?n:1/0;let o=this.getRawTime(i-1);c[i-1]=o;let a=1;for(let r=i-2;r>=0;r--){const u=this.getRawTime(r);l>0&&a<h&&Math.abs(o-u)<l?(c[r]=Math.max(u,c[r+1]),a++):(c[r]=u,a=1),o=u}this.mergedEnd=c}getMergedTime(e){const t=this.mergedEnd[e];return t===void 0?this.getRawTime(e):t}}class wr{temp=0;meta=0;setTemp(e){this.temp=Number.isFinite(e)?e:0}resetTemp(){this.temp=0}refreshFromMeta(e,t){if(!t){this.meta=0;return}const n=e.meta.offsets[0]?.value;this.meta=typeof n=="number"&&Number.isFinite(n)?n:0}resolve(e){const t=e+this.meta+this.temp;return Number.isFinite(t)?t:0}}class Ar{frameId=null;timerId=null;schedule(e,t){switch(e){case"animation":this.frameId=globalThis.requestAnimationFrame(t);break;case"timer":this.timerId=globalThis.setTimeout(t,16);break}}cancel(){this.frameId!==null&&(globalThis.cancelAnimationFrame(this.frameId),this.frameId=null),this.timerId!==null&&(globalThis.clearTimeout(this.timerId),this.timerId=null)}}var H={exports:{}},ie,rt;function K(){if(rt)return ie;rt=1;const s="2.0.0",e=256,t=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=e-6;return ie={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:s,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},ie}var ae,st;function J(){return st||(st=1,ae=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}),ae}var nt;function W(){return nt||(nt=1,(function(s,e){const{MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=K(),c=J();e=s.exports={};const l=e.re=[],h=e.safeRe=[],o=e.src=[],a=e.safeSrc=[],r=e.t={};let u=0;const f="[a-zA-Z0-9-]",E=[["\\s",1],["\\d",i],[f,n]],O=S=>{for(const[w,G]of E)S=S.split(`${w}*`).join(`${w}{0,${G}}`).split(`${w}+`).join(`${w}{1,${G}}`);return S},p=(S,w,G)=>{const A=O(w),b=u++;c(S,b,w),r[S]=b,o[b]=w,a[b]=A,l[b]=new RegExp(w,G?"g":void 0),h[b]=new RegExp(A,G?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),p("MAINVERSION",`(${o[r.NUMERICIDENTIFIER]})\\.(${o[r.NUMERICIDENTIFIER]})\\.(${o[r.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${o[r.NUMERICIDENTIFIERLOOSE]})\\.(${o[r.NUMERICIDENTIFIERLOOSE]})\\.(${o[r.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${o[r.NONNUMERICIDENTIFIER]}|${o[r.NUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${o[r.NONNUMERICIDENTIFIER]}|${o[r.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASE",`(?:-(${o[r.PRERELEASEIDENTIFIER]}(?:\\.${o[r.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${o[r.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[r.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${f}+`),p("BUILD",`(?:\\+(${o[r.BUILDIDENTIFIER]}(?:\\.${o[r.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${o[r.MAINVERSION]}${o[r.PRERELEASE]}?${o[r.BUILD]}?`),p("FULL",`^${o[r.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${o[r.MAINVERSIONLOOSE]}${o[r.PRERELEASELOOSE]}?${o[r.BUILD]}?`),p("LOOSE",`^${o[r.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${o[r.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${o[r.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${o[r.XRANGEIDENTIFIER]})(?:\\.(${o[r.XRANGEIDENTIFIER]})(?:\\.(${o[r.XRANGEIDENTIFIER]})(?:${o[r.PRERELEASE]})?${o[r.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${o[r.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[r.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[r.XRANGEIDENTIFIERLOOSE]})(?:${o[r.PRERELEASELOOSE]})?${o[r.BUILD]}?)?)?`),p("XRANGE",`^${o[r.GTLT]}\\s*${o[r.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${o[r.GTLT]}\\s*${o[r.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`),p("COERCE",`${o[r.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",o[r.COERCEPLAIN]+`(?:${o[r.PRERELEASE]})?(?:${o[r.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",o[r.COERCE],!0),p("COERCERTLFULL",o[r.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${o[r.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",p("TILDE",`^${o[r.LONETILDE]}${o[r.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${o[r.LONETILDE]}${o[r.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${o[r.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",p("CARET",`^${o[r.LONECARET]}${o[r.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${o[r.LONECARET]}${o[r.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${o[r.GTLT]}\\s*(${o[r.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${o[r.GTLT]}\\s*(${o[r.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${o[r.GTLT]}\\s*(${o[r.LOOSEPLAIN]}|${o[r.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${o[r.XRANGEPLAIN]})\\s+-\\s+(${o[r.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${o[r.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[r.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 oe,it;function Ke(){if(it)return oe;it=1;const s=Object.freeze({loose:!0}),e=Object.freeze({});return oe=n=>n?typeof n!="object"?s:n:e,oe}var le,at;function cr(){if(at)return le;at=1;const s=/^[0-9]+$/,e=(n,i)=>{if(typeof n=="number"&&typeof i=="number")return n===i?0:n<i?-1:1;const c=s.test(n),l=s.test(i);return c&&l&&(n=+n,i=+i),n===i?0:c&&!l?-1:l&&!c?1:n<i?-1:1};return le={compareIdentifiers:e,rcompareIdentifiers:(n,i)=>e(i,n)},le}var ce,ot;function x(){if(ot)return ce;ot=1;const s=J(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:t}=K(),{safeRe:n,t:i}=W(),c=Ke(),{compareIdentifiers:l}=cr();class h{constructor(a,r){if(r=c(r),a instanceof h){if(a.loose===!!r.loose&&a.includePrerelease===!!r.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>e)throw new TypeError(`version is longer than ${e} characters`);s("SemVer",a,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const u=a.trim().match(r.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>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(f=>{if(/^[0-9]+$/.test(f)){const E=+f;if(E>=0&&E<t)return E}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(s("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 r=0;do{const u=this.prerelease[r],f=a.prerelease[r];if(s("prerelease compare",r,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(++r)}compareBuild(a){a instanceof h||(a=new h(a,this.options));let r=0;do{const u=this.build[r],f=a.build[r];if(s("build compare",r,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(++r)}inc(a,r,u){if(a.startsWith("pre")){if(!r&&u===!1)throw new Error("invalid increment argument: identifier is empty");if(r){const f=`-${r}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!f||f[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,u);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,u);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,u),this.inc("pre",r,u);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,u),this.inc("pre",r,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 E=this.prerelease.length;for(;--E>=0;)typeof this.prerelease[E]=="number"&&(this.prerelease[E]++,E=-2);if(E===-1){if(r===this.prerelease.join(".")&&u===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(f)}}if(r){let E=[r,f];u===!1&&(E=[r]),l(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=E):this.prerelease=E}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ce=h,ce}var ue,lt;function M(){if(lt)return ue;lt=1;const s=x();return ue=(t,n,i=!1)=>{if(t instanceof s)return t;try{return new s(t,n)}catch(c){if(!i)return null;throw c}},ue}var he,ct;function yr(){if(ct)return he;ct=1;const s=M();return he=(t,n)=>{const i=s(t,n);return i?i.version:null},he}var fe,ut;function Cr(){if(ut)return fe;ut=1;const s=M();return fe=(t,n)=>{const i=s(t.trim().replace(/^[=v]+/,""),n);return i?i.version:null},fe}var me,ht;function Pr(){if(ht)return me;ht=1;const s=x();return me=(t,n,i,c,l)=>{typeof i=="string"&&(l=c,c=i,i=void 0);try{return new s(t instanceof s?t.version:t,i).inc(n,c,l).version}catch{return null}},me}var pe,ft;function qr(){if(ft)return pe;ft=1;const s=M();return pe=(t,n)=>{const i=s(t,null,!0),c=s(n,null,!0),l=i.compare(c);if(l===0)return null;const h=l>0,o=h?i:c,a=h?c:i,r=!!o.prerelease.length;if(!!a.prerelease.length&&!r){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}const f=r?"pre":"";return i.major!==c.major?f+"major":i.minor!==c.minor?f+"minor":i.patch!==c.patch?f+"patch":"prerelease"},pe}var de,mt;function Gr(){if(mt)return de;mt=1;const s=x();return de=(t,n)=>new s(t,n).major,de}var Ee,pt;function br(){if(pt)return Ee;pt=1;const s=x();return Ee=(t,n)=>new s(t,n).minor,Ee}var ge,dt;function Dr(){if(dt)return ge;dt=1;const s=x();return ge=(t,n)=>new s(t,n).patch,ge}var Re,Et;function xr(){if(Et)return Re;Et=1;const s=M();return Re=(t,n)=>{const i=s(t,n);return i&&i.prerelease.length?i.prerelease:null},Re}var ve,gt;function F(){if(gt)return ve;gt=1;const s=x();return ve=(t,n,i)=>new s(t,i).compare(new s(n,i)),ve}var Ie,Rt;function Ur(){if(Rt)return Ie;Rt=1;const s=F();return Ie=(t,n,i)=>s(n,t,i),Ie}var $e,vt;function _r(){if(vt)return $e;vt=1;const s=F();return $e=(t,n)=>s(t,n,!0),$e}var Le,It;function Je(){if(It)return Le;It=1;const s=x();return Le=(t,n,i)=>{const c=new s(t,i),l=new s(n,i);return c.compare(l)||c.compareBuild(l)},Le}var Te,$t;function Fr(){if($t)return Te;$t=1;const s=Je();return Te=(t,n)=>t.sort((i,c)=>s(i,c,n)),Te}var Se,Lt;function jr(){if(Lt)return Se;Lt=1;const s=Je();return Se=(t,n)=>t.sort((i,c)=>s(c,i,n)),Se}var Oe,Tt;function Z(){if(Tt)return Oe;Tt=1;const s=F();return Oe=(t,n,i)=>s(t,n,i)>0,Oe}var Ne,St;function Ze(){if(St)return Ne;St=1;const s=F();return Ne=(t,n,i)=>s(t,n,i)<0,Ne}var we,Ot;function ur(){if(Ot)return we;Ot=1;const s=F();return we=(t,n,i)=>s(t,n,i)===0,we}var Ae,Nt;function hr(){if(Nt)return Ae;Nt=1;const s=F();return Ae=(t,n,i)=>s(t,n,i)!==0,Ae}var ye,wt;function Qe(){if(wt)return ye;wt=1;const s=F();return ye=(t,n,i)=>s(t,n,i)>=0,ye}var Ce,At;function et(){if(At)return Ce;At=1;const s=F();return Ce=(t,n,i)=>s(t,n,i)<=0,Ce}var Pe,yt;function fr(){if(yt)return Pe;yt=1;const s=ur(),e=hr(),t=Z(),n=Qe(),i=Ze(),c=et();return Pe=(h,o,a,r)=>{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 s(h,a,r);case"!=":return e(h,a,r);case">":return t(h,a,r);case">=":return n(h,a,r);case"<":return i(h,a,r);case"<=":return c(h,a,r);default:throw new TypeError(`Invalid operator: ${o}`)}},Pe}var qe,Ct;function kr(){if(Ct)return qe;Ct=1;const s=x(),e=M(),{safeRe:t,t:n}=W();return qe=(c,l)=>{if(c instanceof s)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?t[n.COERCEFULL]:t[n.COERCE]);else{const E=l.includePrerelease?t[n.COERCERTLFULL]:t[n.COERCERTL];let O;for(;(O=E.exec(c))&&(!h||h.index+h[0].length!==c.length);)(!h||O.index+O[0].length!==h.index+h[0].length)&&(h=O),E.lastIndex=O.index+O[1].length+O[2].length;E.lastIndex=-1}if(h===null)return null;const o=h[2],a=h[3]||"0",r=h[4]||"0",u=l.includePrerelease&&h[5]?`-${h[5]}`:"",f=l.includePrerelease&&h[6]?`+${h[6]}`:"";return e(`${o}.${a}.${r}${u}${f}`,l)},qe}var Ge,Pt;function Mr(){if(Pt)return Ge;Pt=1;class s{constructor(){this.max=1e3,this.map=new Map}get(t){const n=this.map.get(t);if(n!==void 0)return this.map.delete(t),this.map.set(t,n),n}delete(t){return this.map.delete(t)}set(t,n){if(!this.delete(t)&&n!==void 0){if(this.map.size>=this.max){const c=this.map.keys().next().value;this.delete(c)}this.map.set(t,n)}return this}}return Ge=s,Ge}var be,qt;function j(){if(qt)return be;qt=1;const s=/\s+/g;class e{constructor(m,v){if(v=i(v),m instanceof e)return m.loose===!!v.loose&&m.includePrerelease===!!v.includePrerelease?m:new e(m.raw,v);if(m instanceof c)return this.raw=m.value,this.set=[[m]],this.formatted=void 0,this;if(this.options=v,this.loose=!!v.loose,this.includePrerelease=!!v.includePrerelease,this.raw=m.trim().replace(s," "),this.set=this.raw.split("||").map(g=>this.parseRange(g.trim())).filter(g=>g.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const g=this.set[0];if(this.set=this.set.filter(I=>!p(I[0])),this.set.length===0)this.set=[g];else if(this.set.length>1){for(const I of this.set)if(I.length===1&&S(I[0])){this.set=[I];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let m=0;m<this.set.length;m++){m>0&&(this.formatted+="||");const v=this.set[m];for(let g=0;g<v.length;g++)g>0&&(this.formatted+=" "),this.formatted+=v[g].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(m){const g=((this.options.includePrerelease&&E)|(this.options.loose&&O))+":"+m,I=n.get(g);if(I)return I;const R=this.options.loose,$=R?o[a.HYPHENRANGELOOSE]:o[a.HYPHENRANGE];m=m.replace($,se(this.options.includePrerelease)),l("hyphen replace",m),m=m.replace(o[a.COMPARATORTRIM],r),l("comparator trim",m),m=m.replace(o[a.TILDETRIM],u),l("tilde trim",m),m=m.replace(o[a.CARETTRIM],f),l("caret trim",m);let N=m.split(" ").map(P=>G(P,this.options)).join(" ").split(/\s+/).map(P=>re(P,this.options));R&&(N=N.filter(P=>(l("loose invalid filter",P,this.options),!!P.match(o[a.COMPARATORLOOSE])))),l("range list",N);const T=new Map,y=N.map(P=>new c(P,this.options));for(const P of y){if(p(P))return[P];T.set(P.value,P)}T.size>1&&T.has("")&&T.delete("");const D=[...T.values()];return n.set(g,D),D}intersects(m,v){if(!(m instanceof e))throw new TypeError("a Range is required");return this.set.some(g=>w(g,v)&&m.set.some(I=>w(I,v)&&g.every(R=>I.every($=>R.intersects($,v)))))}test(m){if(!m)return!1;if(typeof m=="string")try{m=new h(m,this.options)}catch{return!1}for(let v=0;v<this.set.length;v++)if(ne(this.set[v],m,this.options))return!0;return!1}}be=e;const t=Mr(),n=new t,i=Ke(),c=Q(),l=J(),h=x(),{safeRe:o,t:a,comparatorTrimReplace:r,tildeTrimReplace:u,caretTrimReplace:f}=W(),{FLAG_INCLUDE_PRERELEASE:E,FLAG_LOOSE:O}=K(),p=d=>d.value==="<0.0.0-0",S=d=>d.value==="",w=(d,m)=>{let v=!0;const g=d.slice();let I=g.pop();for(;v&&g.length;)v=g.every(R=>I.intersects(R,m)),I=g.pop();return v},G=(d,m)=>(d=d.replace(o[a.BUILD],""),l("comp",d,m),d=C(d,m),l("caret",d),d=b(d,m),l("tildes",d),d=L(d,m),l("xrange",d),d=te(d,m),l("stars",d),d),A=d=>!d||d.toLowerCase()==="x"||d==="*",b=(d,m)=>d.trim().split(/\s+/).map(v=>U(v,m)).join(" "),U=(d,m)=>{const v=m.loose?o[a.TILDELOOSE]:o[a.TILDE];return d.replace(v,(g,I,R,$,N)=>{l("tilde",d,g,I,R,$,N);let T;return A(I)?T="":A(R)?T=`>=${I}.0.0 <${+I+1}.0.0-0`:A($)?T=`>=${I}.${R}.0 <${I}.${+R+1}.0-0`:N?(l("replaceTilde pr",N),T=`>=${I}.${R}.${$}-${N} <${I}.${+R+1}.0-0`):T=`>=${I}.${R}.${$} <${I}.${+R+1}.0-0`,l("tilde return",T),T})},C=(d,m)=>d.trim().split(/\s+/).map(v=>q(v,m)).join(" "),q=(d,m)=>{l("caret",d,m);const v=m.loose?o[a.CARETLOOSE]:o[a.CARET],g=m.includePrerelease?"-0":"";return d.replace(v,(I,R,$,N,T)=>{l("caret",d,I,R,$,N,T);let y;return A(R)?y="":A($)?y=`>=${R}.0.0${g} <${+R+1}.0.0-0`:A(N)?R==="0"?y=`>=${R}.${$}.0${g} <${R}.${+$+1}.0-0`:y=`>=${R}.${$}.0${g} <${+R+1}.0.0-0`:T?(l("replaceCaret pr",T),R==="0"?$==="0"?y=`>=${R}.${$}.${N}-${T} <${R}.${$}.${+N+1}-0`:y=`>=${R}.${$}.${N}-${T} <${R}.${+$+1}.0-0`:y=`>=${R}.${$}.${N}-${T} <${+R+1}.0.0-0`):(l("no pr"),R==="0"?$==="0"?y=`>=${R}.${$}.${N}${g} <${R}.${$}.${+N+1}-0`:y=`>=${R}.${$}.${N}${g} <${R}.${+$+1}.0-0`:y=`>=${R}.${$}.${N} <${+R+1}.0.0-0`),l("caret return",y),y})},L=(d,m)=>(l("replaceXRanges",d,m),d.split(/\s+/).map(v=>V(v,m)).join(" ")),V=(d,m)=>{d=d.trim();const v=m.loose?o[a.XRANGELOOSE]:o[a.XRANGE];return d.replace(v,(g,I,R,$,N,T)=>{l("xRange",d,g,I,R,$,N,T);const y=A(R),D=y||A($),P=D||A(N),X=P;return I==="="&&X&&(I=""),T=m.includePrerelease?"-0":"",y?I===">"||I==="<"?g="<0.0.0-0":g="*":I&&X?(D&&($=0),N=0,I===">"?(I=">=",D?(R=+R+1,$=0,N=0):($=+$+1,N=0)):I==="<="&&(I="<",D?R=+R+1:$=+$+1),I==="<"&&(T="-0"),g=`${I+R}.${$}.${N}${T}`):D?g=`>=${R}.0.0${T} <${+R+1}.0.0-0`:P&&(g=`>=${R}.${$}.0${T} <${R}.${+$+1}.0-0`),l("xRange return",g),g})},te=(d,m)=>(l("replaceStars",d,m),d.trim().replace(o[a.STAR],"")),re=(d,m)=>(l("replaceGTE0",d,m),d.trim().replace(o[m.includePrerelease?a.GTE0PRE:a.GTE0],"")),se=d=>(m,v,g,I,R,$,N,T,y,D,P,X)=>(A(g)?v="":A(I)?v=`>=${g}.0.0${d?"-0":""}`:A(R)?v=`>=${g}.${I}.0${d?"-0":""}`:$?v=`>=${v}`:v=`>=${v}${d?"-0":""}`,A(y)?T="":A(D)?T=`<${+y+1}.0.0-0`:A(P)?T=`<${y}.${+D+1}.0-0`:X?T=`<=${y}.${D}.${P}-${X}`:d?T=`<${y}.${D}.${+P+1}-0`:T=`<=${T}`,`${v} ${T}`.trim()),ne=(d,m,v)=>{for(let g=0;g<d.length;g++)if(!d[g].test(m))return!1;if(m.prerelease.length&&!v.includePrerelease){for(let g=0;g<d.length;g++)if(l(d[g].semver),d[g].semver!==c.ANY&&d[g].semver.prerelease.length>0){const I=d[g].semver;if(I.major===m.major&&I.minor===m.minor&&I.patch===m.patch)return!0}return!1}return!0};return be}var De,Gt;function Q(){if(Gt)return De;Gt=1;const s=Symbol("SemVer ANY");class e{static get ANY(){return s}constructor(r,u){if(u=t(u),r instanceof e){if(r.loose===!!u.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),l("comparator",r,u),this.options=u,this.loose=!!u.loose,this.parse(r),this.semver===s?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(r){const u=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],f=r.match(u);if(!f)throw new TypeError(`Invalid comparator: ${r}`);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=s}toString(){return this.value}test(r){if(l("Comparator.test",r,this.options.loose),this.semver===s||r===s)return!0;if(typeof r=="string")try{r=new h(r,this.options)}catch{return!1}return c(r,this.operator,this.semver,this.options)}intersects(r,u){if(!(r instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new o(r.value,u).test(this.value):r.operator===""?r.value===""?!0:new o(this.value,u).test(r.semver):(u=t(u),u.includePrerelease&&(this.value==="<0.0.0-0"||r.value==="<0.0.0-0")||!u.includePrerelease&&(this.value.startsWith("<0.0.0")||r.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&r.operator.startsWith(">")||this.operator.startsWith("<")&&r.operator.startsWith("<")||this.semver.version===r.semver.version&&this.operator.includes("=")&&r.operator.includes("=")||c(this.semver,"<",r.semver,u)&&this.operator.startsWith(">")&&r.operator.startsWith("<")||c(this.semver,">",r.semver,u)&&this.operator.startsWith("<")&&r.operator.startsWith(">")))}}De=e;const t=Ke(),{safeRe:n,t:i}=W(),c=fr(),l=J(),h=x(),o=j();return De}var xe,bt;function ee(){if(bt)return xe;bt=1;const s=j();return xe=(t,n,i)=>{try{n=new s(n,i)}catch{return!1}return n.test(t)},xe}var Ue,Dt;function Vr(){if(Dt)return Ue;Dt=1;const s=j();return Ue=(t,n)=>new s(t,n).set.map(i=>i.map(c=>c.value).join(" ").trim().split(" ")),Ue}var _e,xt;function Xr(){if(xt)return _e;xt=1;const s=x(),e=j();return _e=(n,i,c)=>{let l=null,h=null,o=null;try{o=new e(i,c)}catch{return null}return n.forEach(a=>{o.test(a)&&(!l||h.compare(a)===-1)&&(l=a,h=new s(l,c))}),l},_e}var Fe,Ut;function Br(){if(Ut)return Fe;Ut=1;const s=x(),e=j();return Fe=(n,i,c)=>{let l=null,h=null,o=null;try{o=new e(i,c)}catch{return null}return n.forEach(a=>{o.test(a)&&(!l||h.compare(a)===1)&&(l=a,h=new s(l,c))}),l},Fe}var je,_t;function Wr(){if(_t)return je;_t=1;const s=x(),e=j(),t=Z();return je=(i,c)=>{i=new e(i,c);let l=new s("0.0.0");if(i.test(l)||(l=new s("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(r=>{const u=new s(r.semver.version);switch(r.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!a||t(u,a))&&(a=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${r.operator}`)}}),a&&(!l||t(l,a))&&(l=a)}return l&&i.test(l)?l:null},je}var ke,Ft;function Hr(){if(Ft)return ke;Ft=1;const s=j();return ke=(t,n)=>{try{return new s(t,n).range||"*"}catch{return null}},ke}var Me,jt;function tt(){if(jt)return Me;jt=1;const s=x(),e=Q(),{ANY:t}=e,n=j(),i=ee(),c=Z(),l=Ze(),h=et(),o=Qe();return Me=(r,u,f,E)=>{r=new s(r,E),u=new n(u,E);let O,p,S,w,G;switch(f){case">":O=c,p=h,S=l,w=">",G=">=";break;case"<":O=l,p=o,S=c,w="<",G="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(r,u,E))return!1;for(let A=0;A<u.set.length;++A){const b=u.set[A];let U=null,C=null;if(b.forEach(q=>{q.semver===t&&(q=new e(">=0.0.0")),U=U||q,C=C||q,O(q.semver,U.semver,E)?U=q:S(q.semver,C.semver,E)&&(C=q)}),U.operator===w||U.operator===G||(!C.operator||C.operator===w)&&p(r,C.semver))return!1;if(C.operator===G&&S(r,C.semver))return!1}return!0},Me}var Ve,kt;function zr(){if(kt)return Ve;kt=1;const s=tt();return Ve=(t,n,i)=>s(t,n,">",i),Ve}var Xe,Mt;function Yr(){if(Mt)return Xe;Mt=1;const s=tt();return Xe=(t,n,i)=>s(t,n,"<",i),Xe}var Be,Vt;function Kr(){if(Vt)return Be;Vt=1;const s=j();return Be=(t,n,i)=>(t=new s(t,i),n=new s(n,i),t.intersects(n,i)),Be}var We,Xt;function Jr(){if(Xt)return We;Xt=1;const s=ee(),e=F();return We=(t,n,i)=>{const c=[];let l=null,h=null;const o=t.sort((f,E)=>e(f,E,i));for(const f of o)s(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,E]of c)f===E?a.push(f):!E&&f===o[0]?a.push("*"):E?f===o[0]?a.push(`<=${E}`):a.push(`${f} - ${E}`):a.push(`>=${f}`);const r=a.join(" || "),u=typeof n.raw=="string"?n.raw:String(n);return r.length<u.length?r:n},We}var He,Bt;function Zr(){if(Bt)return He;Bt=1;const s=j(),e=Q(),{ANY:t}=e,n=ee(),i=F(),c=(u,f,E={})=>{if(u===f)return!0;u=new s(u,E),f=new s(f,E);let O=!1;e:for(const p of u.set){for(const S of f.set){const w=o(p,S,E);if(O=O||w!==null,w)continue e}if(O)return!1}return!0},l=[new e(">=0.0.0-0")],h=[new e(">=0.0.0")],o=(u,f,E)=>{if(u===f)return!0;if(u.length===1&&u[0].semver===t){if(f.length===1&&f[0].semver===t)return!0;E.includePrerelease?u=l:u=h}if(f.length===1&&f[0].semver===t){if(E.includePrerelease)return!0;f=h}const O=new Set;let p,S;for(const L of u)L.operator===">"||L.operator===">="?p=a(p,L,E):L.operator==="<"||L.operator==="<="?S=r(S,L,E):O.add(L.semver);if(O.size>1)return null;let w;if(p&&S){if(w=i(p.semver,S.semver,E),w>0)return null;if(w===0&&(p.operator!==">="||S.operator!=="<="))return null}for(const L of O){if(p&&!n(L,String(p),E)||S&&!n(L,String(S),E))return null;for(const V of f)if(!n(L,String(V),E))return!1;return!0}let G,A,b,U,C=S&&!E.includePrerelease&&S.semver.prerelease.length?S.semver:!1,q=p&&!E.includePrerelease&&p.semver.prerelease.length?p.semver:!1;C&&C.prerelease.length===1&&S.operator==="<"&&C.prerelease[0]===0&&(C=!1);for(const L of f){if(U=U||L.operator===">"||L.operator===">=",b=b||L.operator==="<"||L.operator==="<=",p){if(q&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===q.major&&L.semver.minor===q.minor&&L.semver.patch===q.patch&&(q=!1),L.operator===">"||L.operator===">="){if(G=a(p,L,E),G===L&&G!==p)return!1}else if(p.operator===">="&&!n(p.semver,String(L),E))return!1}if(S){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(A=r(S,L,E),A===L&&A!==S)return!1}else if(S.operator==="<="&&!n(S.semver,String(L),E))return!1}if(!L.operator&&(S||p)&&w!==0)return!1}return!(p&&b&&!S&&w!==0||S&&U&&!p&&w!==0||q||C)},a=(u,f,E)=>{if(!u)return f;const O=i(u.semver,f.semver,E);return O>0?u:O<0||f.operator===">"&&u.operator===">="?f:u},r=(u,f,E)=>{if(!u)return f;const O=i(u.semver,f.semver,E);return O<0?u:O>0||f.operator==="<"&&u.operator==="<="?f:u};return He=c,He}var ze,Wt;function Qr(){if(Wt)return ze;Wt=1;const s=W(),e=K(),t=x(),n=cr(),i=M(),c=yr(),l=Cr(),h=Pr(),o=qr(),a=Gr(),r=br(),u=Dr(),f=xr(),E=F(),O=Ur(),p=_r(),S=Je(),w=Fr(),G=jr(),A=Z(),b=Ze(),U=ur(),C=hr(),q=Qe(),L=et(),V=fr(),te=kr(),re=Q(),se=j(),ne=ee(),d=Vr(),m=Xr(),v=Br(),g=Wr(),I=Hr(),R=tt(),$=zr(),N=Yr(),T=Kr(),y=Jr(),D=Zr();return ze={parse:i,valid:c,clean:l,inc:h,diff:o,major:a,minor:r,patch:u,prerelease:f,compare:E,rcompare:O,compareLoose:p,compareBuild:S,sort:w,rsort:G,gt:A,lt:b,eq:U,neq:C,gte:q,lte:L,cmp:V,coerce:te,Comparator:re,Range:se,satisfies:ne,toComparators:d,maxSatisfying:m,minSatisfying:v,minVersion:g,validRange:I,outside:R,gtr:$,ltr:N,intersects:T,simplifyRange:y,subset:D,SemVer:t,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},ze}var es=Qr();const Ht=`^${z.Version}`;class ts{config=new Ye.ConfigManager(zt);event=new Ye.Event;state;active;time;info;merger=new Nr;offset=new wr;driver=new Ar;constructor(){this.state={playing:!1,scanIndex:0},this.active={lines:[],index:[]},this.time={start:0,seek:0},this.info=new z.Info,this.config.event.add("update",this.onConfigUpdate)}onConfigUpdate=e=>{const t=e.has("offset.useMeta");t&&this.offset.refreshFromMeta(this.info,this.config.current.offset.useMeta),(t||e.has("offset.global"))&&this.handleSyncTime(),(e.has("mergeWindow")||e.has("mergeLimit"))&&(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}handleBuildMergedLineEnd(){this.merger.build(this.info.lines,this.config.current.mergeWindow,this.config.current.mergeLimit)}handleGetActiveIndex(){return this.active.index.length>0?this.active.index[0]:-1}handleBridgeActive(e,t){if(!this.config.current.bridgeActive||t.length<2)return{lines:e,index:t};const n=t[0],i=t[t.length-1];if(i-n+1===t.length)return{lines:e,index:t};const c=new Map;for(let o=0;o<t.length;o++)c.set(t[o],e[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(e){const t=this.handleBridgeActive(this.active.lines,this.active.index);this.event.emit("linesUpdate",t.lines,t.index,this.handleGetActiveIndex(),e)}handleSyncTime(e){if(!this.info.lines.length||(e===void 0&&(e=this.handleGetEffectiveTime()),!Number.isFinite(e)))return;const t=[],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>e){i=c;break}this.merger.getMergedTime(c)>e&&(t.push(l),n.push(c))}this.state.scanIndex=i,this.active.lines=t,this.active.index=n,this.handleEmitLinesUpdate(!0)}handleUpdateActiveLines(e){let t=!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];e>=this.merger.getMergedTime(h)?t=!0:(n.push(l),i.push(h))}for(;this.state.scanIndex<this.info.lines.length;){const c=this.info.lines[this.state.scanIndex];if(e>=c.time.start)e<this.merger.getMergedTime(this.state.scanIndex)&&(n.push(c),i.push(this.state.scanIndex),t=!0),this.state.scanIndex++;else break}t&&(this.active.lines=n,this.active.index=i,this.handleEmitLinesUpdate(!1))}onTick=()=>{if(!this.state.playing)return;const e=this.handleGetEffectiveTime();this.handleUpdateActiveLines(e),this.driver.schedule(this.config.current.driver,this.onTick)};updateLyric(e){if(!e)return;let t=e;es.satisfies(e.version,Ht)||(console.warn(`[music-lyric-player] ignored lyric with incompatible version "${e.version}", expected "${Ht}"`),t=new z.Info),this.pause(),this.info=t,this.handleBuildMergedLineEnd(),this.offset.refreshFromMeta(this.info,this.config.current.offset.useMeta),this.config.current.offset.resetTempOnLyricChange&&this.offset.resetTemp(),this.active.lines=[],this.active.index=[],this.state.scanIndex=0,this.time.seek=0,this.event.emit("lyricUpdate",t),this.event.emit("linesUpdate",[],[],-1,!1)}play(e){this.pause(),typeof e=="number"&&Number.isFinite(e)&&(this.time.seek=e,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.driver.cancel()}dispose(){this.pause(),this.event.clear(),this.config.event.remove("update",this.onConfigUpdate),this.active.lines=[],this.active.index=[],this.info=new z.Info}updateTempOffset(e){this.offset.setTemp(e),this.handleSyncTime()}matchLinesWithTime(e){const t=e+this.currentOffset,n=[],i=[];for(let c=0;c<this.info.lines.length;c++){const l=this.info.lines[c];if(l.time.start>t)break;this.merger.getMergedTime(c)>t&&(n.push(l),i.push(c))}return this.handleBridgeActive(n,i)}convertContentTime(e){return e-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(){return this.offset.resolve(this.config.current.offset.global)}}exports.BaseLyricPlayer=ts;exports.BaseLyricPlayerConfig=mr;
|
|
2
2
|
//# sourceMappingURL=index.comm.js.map
|