playlist-data-engine 1.5.7 → 1.5.9

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.
@@ -33,7 +33,7 @@ function Tr(s, e) {
33
33
  `downbeatBeatIndex ${t.downbeatBeatIndex} exceeds total beats ${e}`
34
34
  );
35
35
  }
36
- function Hv(s, e) {
36
+ function Wv(s, e) {
37
37
  _r(e), Tr(e, s.beats.length);
38
38
  const t = gl(e.segments, s.beats.length), i = s.beats.map((n, a) => {
39
39
  const r = pl(e.segments, a), o = e.segments[r], { downbeatBeatIndex: c, timeSignature: l } = o, { beatsPerMeasure: u } = l, d = a - c, h = (d % u + u) % u, m = h === 0, g = Math.max(0, Math.floor(d / u)) + t[r];
@@ -163,7 +163,7 @@ const ii = {
163
163
  customThresholds: {},
164
164
  useInterpolatedBeats: !1,
165
165
  ignoreKeyRequirements: !1
166
- }, qv = Cr;
166
+ }, Hv = Cr;
167
167
  function kn(s) {
168
168
  switch (s) {
169
169
  case "easy":
@@ -190,7 +190,7 @@ const _l = {
190
190
  minClusterBeats: 4,
191
191
  enableMultiTempo: !1
192
192
  };
193
- function Gv(s) {
193
+ function qv(s) {
194
194
  const e = [], t = ["perfect", "great", "good", "ok"];
195
195
  for (const n of t)
196
196
  if (n in s) {
@@ -282,7 +282,7 @@ function Tl(s, e) {
282
282
  for (const [t] of s.beatSubdivisions)
283
283
  ;
284
284
  }
285
- function Uv(s) {
285
+ function Gv(s) {
286
286
  const e = Dr(s);
287
287
  if (e > Ua)
288
288
  throw new Error(
@@ -325,7 +325,7 @@ function Ml(s) {
325
325
  const n = t.maxHotness - t.minHotness, r = (s - t.minHotness) / n, o = t.windowMs - i.windowMs;
326
326
  return t.windowMs - o * r;
327
327
  }
328
- function Vv(s) {
328
+ function Uv(s) {
329
329
  return _t.find((t) => t.tier === s)?.minHotness ?? 0;
330
330
  }
331
331
  const Il = {
@@ -430,7 +430,7 @@ function Fl(s, e, t) {
430
430
  }
431
431
  return s + i;
432
432
  }
433
- function jv(s) {
433
+ function Vv(s) {
434
434
  const e = {
435
435
  version: s.chartMetadata.seed ?? "1.0.0",
436
436
  algorithm: "procedural-generation",
@@ -461,7 +461,7 @@ function jv(s) {
461
461
  downbeatConfig: s.downbeatConfig
462
462
  };
463
463
  }
464
- function Kv(s, e) {
464
+ function jv(s, e) {
465
465
  const t = [], i = s.trackId === e.id, n = s.title.trim().toLowerCase() === e.title.trim().toLowerCase(), a = s.artist.trim().toLowerCase() === e.artist.trim().toLowerCase();
466
466
  return i || n && a ? { matches: !0, mismatchDetails: [] } : (i || t.push(`Track ID: expected "${s.trackId}", got "${e.id}"`), n || t.push(`Title: expected "${s.title}", got "${e.title}"`), a || t.push(`Artist: expected "${s.artist}", got "${e.artist}"`), {
467
467
  matches: !1,
@@ -502,13 +502,13 @@ const Ll = {
502
502
  9: "IX",
503
503
  10: "X"
504
504
  }, ni = 10, zl = 10, Wl = 1e3, ja = 1.5;
505
- function Yv(s) {
505
+ function Kv(s) {
506
506
  return typeof s == "number" && Number.isInteger(s) && s >= 0 && s <= 10;
507
507
  }
508
508
  function Hl(s) {
509
509
  return Math.max(0, Math.min(10, Math.floor(s)));
510
510
  }
511
- function Zv(s) {
511
+ function Yv(s) {
512
512
  return typeof s == "string" && ["normal", "aggressive"].includes(s);
513
513
  }
514
514
  const Vt = {
@@ -1816,7 +1816,7 @@ class ye {
1816
1816
  else if (u) {
1817
1817
  o = this.calculateSaveDC(e, u);
1818
1818
  for (const g of i) {
1819
- const y = u.toLowerCase() === "dexterity" && g.statusEffects.some((_) => _.mechanicalEffects?.disadvantageOnDexSaves);
1819
+ const y = u.toLowerCase() === "dexterity" && g.statusEffects.some((T) => T.mechanicalEffects?.disadvantageOnDexSaves);
1820
1820
  this.makeSavingThrow(g, u, o, y) || (r = this.diceRoller ? this.diceRoller.calculateDamage(c, 0, !1) : ue.calculateDamage(c, 0, !1), g.currentHP -= r.total, g.currentHP < 0 && (g.currentHP = 0, g.isDefeated = !0));
1821
1821
  }
1822
1822
  }
@@ -2067,19 +2067,19 @@ class Gl {
2067
2067
  assessThreat(e, t) {
2068
2068
  const i = e.character.hp.max, n = i > 0 ? e.currentHP / i : 0, a = this.getAllies(e, t), r = this.getEnemies(e, t), o = a.reduce((y, v) => {
2069
2069
  if (v.id === e.id) return y;
2070
- const _ = v.character.hp.max, T = _ > 0 ? v.currentHP / _ : 0;
2071
- return Math.min(y, T);
2070
+ const T = v.character.hp.max, _ = T > 0 ? v.currentHP / T : 0;
2071
+ return Math.min(y, _);
2072
2072
  }, 1), c = r.reduce(
2073
2073
  (y, v) => Math.min(y, v.currentHP),
2074
2074
  r.length > 0 ? 1 / 0 : 0
2075
2075
  ), l = r.reduce((y, v) => {
2076
- const _ = v.character.equipment?.weapons.filter((S) => S.equipped) || [];
2077
- let T = 5;
2078
- for (const S of _) {
2076
+ const T = v.character.equipment?.weapons.filter((S) => S.equipped) || [];
2077
+ let _ = 5;
2078
+ for (const S of T) {
2079
2079
  const I = Vt[S.name], D = S.damage_dice || (typeof S.damage != "string" ? S.damage?.dice : void 0) || I?.damage?.dice || "1d6", R = this.averageDamageFromFormula(D);
2080
- R > T && (T = R);
2080
+ R > _ && (_ = R);
2081
2081
  }
2082
- return Math.max(y, T);
2082
+ return Math.max(y, _);
2083
2083
  }, 0), d = (e.character.equipment?.items || []).some(
2084
2084
  (y) => y.quantity > 0 && !y.equipped && y.tags?.some((v) => v === "healing" || v === "consumable")
2085
2085
  ), h = e.spellSlots, m = h !== void 0 && Object.values(h).some((y) => y > 0), f = (e.legendaryActionsRemaining ?? 0) > 0, g = (e.legendaryResistancesRemaining ?? 0) > 0, p = f || g;
@@ -3077,13 +3077,13 @@ function Vl() {
3077
3077
  }
3078
3078
  var jl = Vl();
3079
3079
  const Kl = /* @__PURE__ */ Rr(jl);
3080
- function Xv(s, e, t) {
3080
+ function Zv(s, e, t) {
3081
3081
  return `${s}-${e}-${t}`;
3082
3082
  }
3083
3083
  function ht(s) {
3084
3084
  return Kl(s, 0) / 4294967295;
3085
3085
  }
3086
- function Jv(s, e, t) {
3086
+ function Xv(s, e, t) {
3087
3087
  const i = ht(s);
3088
3088
  return Math.floor(i * (t - e)) + e;
3089
3089
  }
@@ -3220,7 +3220,7 @@ const Yl = {
3220
3220
  13: 1,
3221
3221
  14: 1,
3222
3222
  15: 1
3223
- }, Qv = {
3223
+ }, Jv = {
3224
3224
  /** Default tuning factor (no adjustment) */
3225
3225
  DEFAULT: 1,
3226
3226
  /** 10% easier encounters */
@@ -3254,13 +3254,13 @@ function Br(s) {
3254
3254
  }
3255
3255
  return n;
3256
3256
  }
3257
- function eb(s, e = 1) {
3257
+ function Qv(s, e = 1) {
3258
3258
  return Math.round(s * e);
3259
3259
  }
3260
3260
  function Mi(s) {
3261
3261
  return s <= 0 ? 1 : s >= 15 ? Za[15] : Za[s] || 1;
3262
3262
  }
3263
- function tb(s, e) {
3263
+ function eb(s, e) {
3264
3264
  const t = s.reduce((n, a) => n + Pr(a), 0), i = e !== void 0 ? e : Mi(s.length);
3265
3265
  return Math.round(t * i);
3266
3266
  }
@@ -3269,7 +3269,7 @@ function Xl(s) {
3269
3269
  const e = s.reduce((t, i) => t + i, 0);
3270
3270
  return Math.floor(e / s.length);
3271
3271
  }
3272
- function ib(s) {
3272
+ function tb(s) {
3273
3273
  return typeof s == "string" && ["easy", "medium", "hard", "deadly"].includes(s);
3274
3274
  }
3275
3275
  class Jl {
@@ -6079,13 +6079,13 @@ const nu = [
6079
6079
  ...ou,
6080
6080
  ...cu
6081
6081
  ];
6082
- function nb(s) {
6082
+ function ib(s) {
6083
6083
  return jt.find((e) => e.id === s);
6084
6084
  }
6085
- function ab(s) {
6085
+ function nb(s) {
6086
6086
  return jt.filter((e) => e.category === s);
6087
6087
  }
6088
- function sb(s) {
6088
+ function ab(s) {
6089
6089
  return jt.filter((e) => e.archetype === s);
6090
6090
  }
6091
6091
  const Nr = {
@@ -6121,13 +6121,13 @@ const Nr = {
6121
6121
  function wt(s) {
6122
6122
  return Nr[s];
6123
6123
  }
6124
- function rb(s) {
6124
+ function sb(s) {
6125
6125
  return `1d${Nr[s].signatureDieSize}`;
6126
6126
  }
6127
6127
  function uu() {
6128
6128
  return ["common", "uncommon", "elite", "boss"];
6129
6129
  }
6130
- function ob(s) {
6130
+ function rb(s) {
6131
6131
  const e = uu(), t = e.indexOf(s);
6132
6132
  if (!(t === -1 || t === e.length - 1))
6133
6133
  return e[t + 1];
@@ -6502,16 +6502,16 @@ class It {
6502
6502
  return /^[a-z][a-z0-9_]*$/.test(e);
6503
6503
  }
6504
6504
  }
6505
- function cb(s, e) {
6505
+ function ob(s, e) {
6506
6506
  return It.validateClassFeature(s, e);
6507
6507
  }
6508
- function lb(s, e) {
6508
+ function cb(s, e) {
6509
6509
  return It.validateRacialTrait(s, e);
6510
6510
  }
6511
- function ub(s) {
6511
+ function lb(s) {
6512
6512
  return It.validateClassFeatures(s);
6513
6513
  }
6514
- function db(s) {
6514
+ function ub(s) {
6515
6515
  return It.validateRacialTraits(s);
6516
6516
  }
6517
6517
  function pu(s) {
@@ -6754,22 +6754,22 @@ class Ue {
6754
6754
  return Or(e, t);
6755
6755
  }
6756
6756
  }
6757
- function hb(s) {
6757
+ function db(s) {
6758
6758
  return Ue.validateSkill(s);
6759
6759
  }
6760
- function mb(s) {
6760
+ function hb(s) {
6761
6761
  return Ue.validateSkills(s);
6762
6762
  }
6763
- function fb(s) {
6763
+ function mb(s) {
6764
6764
  return Ue.validateSkillProficiency(s);
6765
6765
  }
6766
- function gb(s) {
6766
+ function fb(s) {
6767
6767
  return Ue.validateSkillProficiencies(s);
6768
6768
  }
6769
- function pb(s) {
6769
+ function gb(s) {
6770
6770
  return Ue.validateSkillListDefinition(s);
6771
6771
  }
6772
- function yb(s, e) {
6772
+ function pb(s, e) {
6773
6773
  return Ue.validateSkillPrerequisites(s, e);
6774
6774
  }
6775
6775
  const an = [
@@ -6889,16 +6889,16 @@ class rt {
6889
6889
  return sn.includes(e);
6890
6890
  }
6891
6891
  }
6892
- function vb(s) {
6892
+ function yb(s) {
6893
6893
  return rt.validateSpell(s);
6894
6894
  }
6895
- function bb(s) {
6895
+ function vb(s) {
6896
6896
  return rt.validateSpells(s);
6897
6897
  }
6898
- function wb(s) {
6898
+ function bb(s) {
6899
6899
  return rt.validatePrerequisites(s);
6900
6900
  }
6901
- function Sb(s, e) {
6901
+ function wb(s, e) {
6902
6902
  return rt.validateSpellPrerequisites(s, e);
6903
6903
  }
6904
6904
  class Ne {
@@ -7087,7 +7087,7 @@ class Ne {
7087
7087
  return this.getAllSkills().filter((t) => t.prerequisites ? this.validatePrerequisites(t, e).valid : !0);
7088
7088
  }
7089
7089
  }
7090
- function _b() {
7090
+ function Sb() {
7091
7091
  return Ne.getInstance();
7092
7092
  }
7093
7093
  const Pt = ["STR", "DEX", "CON", "INT", "WIS", "CHA"], rs = ["weapon", "armor", "item", "box"], os = ["common", "uncommon", "rare", "very_rare", "legendary"], cs = [
@@ -8332,7 +8332,7 @@ const Ii = {
8332
8332
  "Triumphant",
8333
8333
  "Immortal"
8334
8334
  ]
8335
- }, Tb = {
8335
+ }, _b = {
8336
8336
  // STR-based
8337
8337
  athletics: "STR",
8338
8338
  // DEX-based
@@ -8386,7 +8386,7 @@ function Hr(s, e) {
8386
8386
  } catch {
8387
8387
  }
8388
8388
  }
8389
- const Cb = 10, Su = 50;
8389
+ const Tb = 10, Su = 50;
8390
8390
  class it {
8391
8391
  constructor() {
8392
8392
  this.allSpellsCache = null, this.levelCache = null, this.schoolCache = null, this.manager = Y.getInstance();
@@ -8602,7 +8602,7 @@ class it {
8602
8602
  };
8603
8603
  }
8604
8604
  }
8605
- function kb() {
8605
+ function Cb() {
8606
8606
  return it.getInstance();
8607
8607
  }
8608
8608
  class Y {
@@ -9465,12 +9465,12 @@ const _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9465
9465
  traits: ["Darkvision", "Hellish Resistance", "Infernal Legacy"],
9466
9466
  description: "Tieflings are humanoids with infernal blood, often bearing horns, tails, and other fiendish features. Their ancestry grants them resistance to fire and innate magical abilities. Though often feared and distrusted due to their appearance, tieflings are as varied in morality and ambition as any other race, with many becoming powerful warlocks, sorcerers, or charismatic leaders."
9467
9467
  }
9468
- }, Ab = qr, Tu = Object.entries(qr).map(([s, e]) => ({
9468
+ }, kb = qr, Tu = Object.entries(qr).map(([s, e]) => ({
9469
9469
  race: s,
9470
9470
  ...e
9471
9471
  }));
9472
9472
  let rn = null, on = null;
9473
- async function Mb(s) {
9473
+ async function Ab(s) {
9474
9474
  try {
9475
9475
  rn || (on || (on = Promise.resolve().then(() => _u)), rn = (await on).ExtensionManager);
9476
9476
  const t = rn.getInstance().get("races.data");
@@ -9955,7 +9955,7 @@ class Me {
9955
9955
  return e;
9956
9956
  }
9957
9957
  }
9958
- function Ib() {
9958
+ function Mb() {
9959
9959
  return Me.getInstance();
9960
9960
  }
9961
9961
  const Cu = {
@@ -10876,10 +10876,10 @@ class Ze {
10876
10876
  const v = li[n]?.[p];
10877
10877
  if (!v || v === 0)
10878
10878
  continue;
10879
- const _ = [...y];
10880
- for (let T = 0; T < v && _.length > 0; T++) {
10881
- const S = r.randomInt(0, _.length), I = _[S];
10882
- h.push(I), _.splice(S, 1);
10879
+ const T = [...y];
10880
+ for (let _ = 0; _ < v && T.length > 0; _++) {
10881
+ const S = r.randomInt(0, T.length), I = T[S];
10882
+ h.push(I), T.splice(S, 1);
10883
10883
  }
10884
10884
  }
10885
10885
  const f = c.spells - h.length;
@@ -10887,13 +10887,13 @@ class Ze {
10887
10887
  const p = [];
10888
10888
  for (const v of m) {
10889
10889
  if (v > l) break;
10890
- const _ = o[`level${v}`];
10891
- _ && p.push(..._);
10890
+ const T = o[`level${v}`];
10891
+ T && p.push(...T);
10892
10892
  }
10893
10893
  const y = [...p];
10894
10894
  for (let v = 0; v < f && y.length > 0; v++) {
10895
- const _ = r.randomInt(0, y.length), T = y[_];
10896
- h.some((S) => S.id === T.id) || h.push(T), y.splice(_, 1);
10895
+ const T = r.randomInt(0, y.length), _ = y[T];
10896
+ h.some((S) => S.id === _.id) || h.push(_), y.splice(T, 1);
10897
10897
  }
10898
10898
  }
10899
10899
  const g = Ze.getSpellSlotsForCR(n);
@@ -10940,9 +10940,9 @@ class Ze {
10940
10940
  if (!y || y === 0)
10941
10941
  continue;
10942
10942
  const v = [...p];
10943
- for (let _ = 0; _ < y && v.length > 0; _++) {
10944
- const T = a.randomInt(0, v.length), S = v[T];
10945
- d.push(S), v.splice(T, 1);
10943
+ for (let T = 0; T < y && v.length > 0; T++) {
10944
+ const _ = a.randomInt(0, v.length), S = v[_];
10945
+ d.push(S), v.splice(_, 1);
10946
10946
  }
10947
10947
  }
10948
10948
  const m = o.spells - d.length;
@@ -10955,8 +10955,8 @@ class Ze {
10955
10955
  }
10956
10956
  const p = [...g];
10957
10957
  for (let y = 0; y < m && p.length > 0; y++) {
10958
- const v = a.randomInt(0, p.length), _ = p[v];
10959
- d.some((T) => T.id === _.id) || d.push(_), p.splice(v, 1);
10958
+ const v = a.randomInt(0, p.length), T = p[v];
10959
+ d.some((_) => _.id === T.id) || d.push(T), p.splice(v, 1);
10960
10960
  }
10961
10961
  }
10962
10962
  const f = Ze.getSpellSlotsForCR(n);
@@ -11599,7 +11599,7 @@ function Nu(s, e, t) {
11599
11599
  const i = Ur(t), n = Math.floor(((s[i] ?? 10) - 10) / 2), a = Math.floor(Gr * (e - 1));
11600
11600
  return n + a;
11601
11601
  }
11602
- const U = class U {
11602
+ const G = class G {
11603
11603
  /**
11604
11604
  * Get a seeded RNG instance with optional index offset
11605
11605
  *
@@ -11645,13 +11645,13 @@ const U = class U {
11645
11645
  const { bass_dominance: i = 0, mid_dominance: n = 0, treble_dominance: a = 0 } = t;
11646
11646
  let r = 0, o = 0, c = 0, l = 0, u = 0;
11647
11647
  return i > 0.6 ? (r = 1, c = 1) : i > 0.4 && (r = 1), a > 0.6 && (o = 1), n > 0.6 ? (l = 1, u = 1) : n > 0.4 && (l = 1), i < 0.5 && n < 0.5 && a < 0.5 && Math.abs(i - n) < 0.2 && Math.abs(n - a) < 0.2 && (r = 1, o = 1, c = 1, l = 1, u = 1), {
11648
- STR: Math.min(e.STR + r, e.STR + U.MAX_AUDIO_INFLUENCE),
11649
- DEX: Math.min(e.DEX + o, e.DEX + U.MAX_AUDIO_INFLUENCE),
11650
- CON: Math.min(e.CON + c, e.CON + U.MAX_AUDIO_INFLUENCE),
11648
+ STR: Math.min(e.STR + r, e.STR + G.MAX_AUDIO_INFLUENCE),
11649
+ DEX: Math.min(e.DEX + o, e.DEX + G.MAX_AUDIO_INFLUENCE),
11650
+ CON: Math.min(e.CON + c, e.CON + G.MAX_AUDIO_INFLUENCE),
11651
11651
  INT: e.INT,
11652
11652
  // INT not affected by audio
11653
- WIS: Math.min(e.WIS + l, e.WIS + U.MAX_AUDIO_INFLUENCE),
11654
- CHA: Math.min(e.CHA + u, e.CHA + U.MAX_AUDIO_INFLUENCE)
11653
+ WIS: Math.min(e.WIS + l, e.WIS + G.MAX_AUDIO_INFLUENCE),
11654
+ CHA: Math.min(e.CHA + u, e.CHA + G.MAX_AUDIO_INFLUENCE)
11655
11655
  };
11656
11656
  }
11657
11657
  /**
@@ -11687,7 +11687,7 @@ const U = class U {
11687
11687
  */
11688
11688
  static scaleStatsForRarity(e, t, i) {
11689
11689
  let a = wt(t).statMultiplier;
11690
- return i !== void 0 && (a = U.getStatMultiplierForFractionalCR(i) * a), {
11690
+ return i !== void 0 && (a = G.getStatMultiplierForFractionalCR(i) * a), {
11691
11691
  STR: Math.round(e.STR * a),
11692
11692
  DEX: Math.round(e.DEX * a),
11693
11693
  CON: Math.round(e.CON * a),
@@ -11733,7 +11733,7 @@ const U = class U {
11733
11733
  throw new Error(
11734
11734
  `No enemy templates match filters: category=${t}, archetype=${i}`
11735
11735
  );
11736
- return n ? U.weightedSelectionByAudio(a, n, e) : e.randomChoice(a);
11736
+ return n ? G.weightedSelectionByAudio(a, n, e) : e.randomChoice(a);
11737
11737
  }
11738
11738
  /**
11739
11739
  * Select template using audio profile for weighting
@@ -11819,11 +11819,11 @@ const U = class U {
11819
11819
  static generateBossName(e, t) {
11820
11820
  const i = t.random();
11821
11821
  if (i < 0.5) {
11822
- const r = t.randomChoice(U.BOSS_TITLES);
11822
+ const r = t.randomChoice(G.BOSS_TITLES);
11823
11823
  return `${e}, ${r}`;
11824
11824
  }
11825
11825
  if (i < 0.8)
11826
- return `${t.randomChoice(U.BOSS_PREFIXES)} ${e}`;
11826
+ return `${t.randomChoice(G.BOSS_PREFIXES)} ${e}`;
11827
11827
  const n = [
11828
11828
  "the Void",
11829
11829
  "Ruin",
@@ -11876,7 +11876,7 @@ const U = class U {
11876
11876
  }
11877
11877
  }
11878
11878
  n.push(a);
11879
- const r = U.generateUltimateAbility(e.archetype, i);
11879
+ const r = G.generateUltimateAbility(e.archetype, i);
11880
11880
  return n.push(r), n;
11881
11881
  }
11882
11882
  /**
@@ -12018,14 +12018,14 @@ const U = class U {
12018
12018
  * ```
12019
12019
  */
12020
12020
  static generateAbilities(e, t, i, n, a, r, o) {
12021
- const l = [a && r ? U.scaleSignatureAbility(
12021
+ const l = [a && r ? G.scaleSignatureAbility(
12022
12022
  e.signatureAbility,
12023
12023
  t,
12024
12024
  a,
12025
12025
  r,
12026
12026
  e.archetype,
12027
12027
  o
12028
- ) : U.scaleSignatureAbility(
12028
+ ) : G.scaleSignatureAbility(
12029
12029
  e.signatureAbility,
12030
12030
  t,
12031
12031
  e.baseStats,
@@ -12035,7 +12035,7 @@ const U = class U {
12035
12035
  )];
12036
12036
  let u;
12037
12037
  if (Ze.shouldHaveSpellcasting(e.archetype, t)) {
12038
- const m = n || U.getCRForRarity(t);
12038
+ const m = n || G.getCRForRarity(t);
12039
12039
  u = Ze.generateSpellListWithRNG({
12040
12040
  archetype: e.archetype,
12041
12041
  rarity: t,
@@ -12047,7 +12047,7 @@ const U = class U {
12047
12047
  }
12048
12048
  const h = wt(t).extraAbilityCount;
12049
12049
  if (h > 0) {
12050
- const m = U.selectExtraAbilities(
12050
+ const m = G.selectExtraAbilities(
12051
12051
  e.archetype,
12052
12052
  h,
12053
12053
  i
@@ -12068,7 +12068,7 @@ const U = class U {
12068
12068
  * @returns Array of selected feature objects
12069
12069
  */
12070
12070
  static selectExtraAbilities(e, t, i) {
12071
- const n = U.ARCHETYPE_TAGS[e], r = Me.getInstance().getAllClassFeatures(), o = [];
12071
+ const n = G.ARCHETYPE_TAGS[e], r = Me.getInstance().getAllClassFeatures(), o = [];
12072
12072
  for (const d of r.values())
12073
12073
  o.push(...d);
12074
12074
  const c = o.filter((d) => !d.tags || d.tags.length === 0 ? !1 : d.tags.some(
@@ -12147,25 +12147,25 @@ const U = class U {
12147
12147
  } = e;
12148
12148
  if (c && !l)
12149
12149
  throw new Error("track is required when audioProfile is provided");
12150
- const d = U.getSeededRNG(t);
12150
+ const d = G.getSeededRNG(t);
12151
12151
  let h;
12152
12152
  if (a) {
12153
- const j = U.getTemplateById(a);
12153
+ const j = G.getTemplateById(a);
12154
12154
  if (!j)
12155
12155
  throw new Error(`Unknown enemy template ID: ${a}`);
12156
12156
  h = j;
12157
12157
  } else {
12158
12158
  const j = e.category, X = e.archetype;
12159
- h = U.selectTemplate(d, j, X, c);
12159
+ h = G.selectTemplate(d, j, X, c);
12160
12160
  }
12161
- const m = i ?? U.getCRForRarity(r), f = n ?? U.getLevelFromCR(m);
12162
- let g = U.scaleStatsForRarity(
12161
+ const m = i ?? G.getCRForRarity(r), f = n ?? G.getLevelFromCR(m);
12162
+ let g = G.scaleStatsForRarity(
12163
12163
  h.baseStats,
12164
12164
  r,
12165
12165
  i
12166
12166
  // Only pass CR if explicitly provided (not derived from rarity)
12167
12167
  );
12168
- c && (g = U.applyAudioStatInfluence(g, c));
12168
+ c && (g = G.applyAudioStatInfluence(g, c));
12169
12169
  const p = {
12170
12170
  STR: Math.floor((g.STR - 10) / 2),
12171
12171
  DEX: Math.floor((g.DEX - 10) / 2),
@@ -12179,11 +12179,11 @@ const U = class U {
12179
12179
  u?.hpLevel !== void 0 ? y = bs(h.baseHP, u.hpLevel, r) : y = bs(h.baseHP, f, r), o !== 1 && (y = Math.round(y * o));
12180
12180
  const v = Math.ceil(1 + (f - 1) / 4);
12181
12181
  Ze.shouldHaveSpellcasting(h.archetype, r);
12182
- const { abilities: _, spellConfig: T } = U.generateAbilities(h, r, d, m, g, f, u);
12183
- let S = _;
12182
+ const { abilities: T, spellConfig: _ } = G.generateAbilities(h, r, d, m, g, f, u);
12183
+ let S = T;
12184
12184
  if (r === "boss") {
12185
12185
  const j = S[0];
12186
- S = U.generateBossFeatures(
12186
+ S = G.generateBossFeatures(
12187
12187
  h,
12188
12188
  j,
12189
12189
  d
@@ -12191,7 +12191,7 @@ const U = class U {
12191
12191
  }
12192
12192
  let I = [], D;
12193
12193
  if (Ke.shouldHaveLegendary(r)) {
12194
- const j = U.getSeededRNG(`${t}-legendary`);
12194
+ const j = G.getSeededRNG(`${t}-legendary`);
12195
12195
  D = Ke.generateWithRNG({
12196
12196
  archetype: h.archetype,
12197
12197
  cr: m,
@@ -12218,21 +12218,21 @@ const U = class U {
12218
12218
  rarity: r,
12219
12219
  seed: `${t}-equipment`
12220
12220
  });
12221
- let q, O;
12221
+ let U, O;
12222
12222
  if (u?.attackLevel !== void 0) {
12223
12223
  const j = mi(g, u.attackLevel, r, h.archetype);
12224
- q = j.damageDie, O = j.damageModifier;
12224
+ U = j.damageDie, O = j.damageModifier;
12225
12225
  } else {
12226
12226
  const j = mi(g, f, r, h.archetype);
12227
- q = j.damageDie, O = j.damageModifier;
12227
+ U = j.damageDie, O = j.damageModifier;
12228
12228
  }
12229
12229
  const W = [];
12230
12230
  if (R.weapon) {
12231
12231
  const j = Ct.getEquipmentName(R.weapon.id), X = Vt[j];
12232
12232
  X && W.push({
12233
12233
  name: j,
12234
- damage: `${q} + ${O}`,
12235
- damage_dice: q,
12234
+ damage: `${U} + ${O}`,
12235
+ damage_dice: U,
12236
12236
  damage_type: X.damage?.damageType || h.signatureAbility.damageType,
12237
12237
  type: h.signatureAbility.attackType,
12238
12238
  range: h.signatureAbility.range,
@@ -12242,8 +12242,8 @@ const U = class U {
12242
12242
  }
12243
12243
  W.length === 0 && W.push({
12244
12244
  name: h.signatureAbility.name,
12245
- damage: `${q} + ${O}`,
12246
- damage_dice: q,
12245
+ damage: `${U} + ${O}`,
12246
+ damage_dice: U,
12247
12247
  damage_type: h.signatureAbility.damageType,
12248
12248
  type: h.signatureAbility.attackType,
12249
12249
  range: h.signatureAbility.range,
@@ -12251,28 +12251,28 @@ const U = class U {
12251
12251
  equipped: !0
12252
12252
  });
12253
12253
  const Z = [];
12254
- let Q = 0;
12254
+ let te = 0;
12255
12255
  if (R.armor) {
12256
12256
  const j = Ct.getEquipmentName(R.armor.id);
12257
- Z.push(j), R.armor.acBonus && (Q = R.armor.acBonus - h.baseAC);
12257
+ Z.push(j), R.armor.acBonus && (te = R.armor.acBonus - h.baseAC);
12258
12258
  }
12259
12259
  if (R.shield) {
12260
12260
  const j = Ct.getEquipmentName(R.shield.id);
12261
- Z.push(j), R.shield.acBonus && (Q += R.shield.acBonus);
12261
+ Z.push(j), R.shield.acBonus && (te += R.shield.acBonus);
12262
12262
  }
12263
12263
  let se;
12264
12264
  if (u?.defenseLevel !== void 0 ? se = ws(g, u.defenseLevel, h.baseAC, R) : se = ws(g, f, h.baseAC, R), i !== void 0) {
12265
- const j = h.archetype === "brute" ? "STR" : h.archetype === "archer" ? "DEX" : "CHA", X = U.estimateWeaponDPR(
12266
- q,
12265
+ const j = h.archetype === "brute" ? "STR" : h.archetype === "archer" ? "DEX" : "CHA", X = G.estimateWeaponDPR(
12266
+ U,
12267
12267
  O,
12268
12268
  v,
12269
12269
  p[j]
12270
- ), fe = U.getMinHPRatio(i), ge = Math.ceil(X * fe);
12270
+ ), fe = G.getMinHPRatio(i), ge = Math.ceil(X * fe);
12271
12271
  y < ge && (y = ge);
12272
12272
  }
12273
12273
  return {
12274
12274
  // Use template name as enemy name, with boss enhancement
12275
- name: r === "boss" ? U.generateBossName(h.name, d) : h.name,
12275
+ name: r === "boss" ? G.generateBossName(h.name, d) : h.name,
12276
12276
  // Enemies don't use standard race/class - use placeholder values
12277
12277
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12278
12278
  race: "Enemy",
@@ -12322,15 +12322,15 @@ const U = class U {
12322
12322
  // Spells — populated from SpellcastingConfig when enemy has spellcasting
12323
12323
  // Boss enemies have spellConfig but abilities are replaced; spells remain populated
12324
12324
  // for future use but are not active in boss combat (boss uses ultimate abilities)
12325
- spells: T ? {
12325
+ spells: _ ? {
12326
12326
  spell_slots: Object.fromEntries(
12327
- Object.entries(T.slots).map(([j, X]) => [
12327
+ Object.entries(_.slots).map(([j, X]) => [
12328
12328
  Number(j),
12329
12329
  { total: X, used: 0 }
12330
12330
  ])
12331
12331
  ),
12332
- known_spells: T.spells.map((j) => j.name),
12333
- cantrips: T.cantrips.map((j) => j.name)
12332
+ known_spells: _.spells.map((j) => j.name),
12333
+ cantrips: _.cantrips.map((j) => j.name)
12334
12334
  } : {
12335
12335
  spell_slots: {},
12336
12336
  known_spells: [],
@@ -12338,8 +12338,8 @@ const U = class U {
12338
12338
  },
12339
12339
  // Combat-ready Spell objects for CombatEngine/SpellCaster/AI
12340
12340
  // InnateSpell extends Spell, so this array is directly usable by SpellCaster.castSpell()
12341
- ...T ? {
12342
- combat_spells: [...T.cantrips, ...T.spells]
12341
+ ..._ ? {
12342
+ combat_spells: [..._.cantrips, ..._.spells]
12343
12343
  } : {},
12344
12344
  // XP tracking
12345
12345
  xp: {
@@ -12534,11 +12534,11 @@ const U = class U {
12534
12534
  throw new Error(
12535
12535
  `Boss encounters must have count=1. Requested count=${n} with baseRarity='boss'. Boss enemies are designed for solo encounters against a party. Use a lower rarity (common/uncommon/elite) for multi-enemy encounters, or set count=1 for a boss encounter.`
12536
12536
  );
12537
- const y = e.map((Z) => Z.level), v = Zn(y, a), _ = Math.round(v * c), T = Mi(n), S = Math.round(_ / T / n);
12537
+ const y = e.map((Z) => Z.level), v = Zn(y, a), T = Math.round(v * c), _ = Mi(n), S = Math.round(T / _ / n);
12538
12538
  let I = Br(S);
12539
- const D = U.getSeededRNG(i), R = D.random();
12539
+ const D = G.getSeededRNG(i), R = D.random();
12540
12540
  R < 0.25 ? I = Math.min(I * 1.5, 30) : R > 0.75 && (I = Math.max(I * 0.67, 0.125));
12541
- const q = o ? U.getRarityDistribution(n, I) : Array(n).fill(r), O = U.selectTemplatesForMix(
12541
+ const U = o ? G.getRarityDistribution(n, I) : Array(n).fill(r), O = G.selectTemplatesForMix(
12542
12542
  n,
12543
12543
  D,
12544
12544
  h,
@@ -12548,15 +12548,15 @@ const U = class U {
12548
12548
  f
12549
12549
  ), W = [];
12550
12550
  for (let Z = 0; Z < n; Z++) {
12551
- const Q = O[Z];
12552
- if (!Q)
12551
+ const te = O[Z];
12552
+ if (!te)
12553
12553
  throw new Error(`No template available for enemy at index ${Z}`);
12554
- const se = U.generate({
12554
+ const se = G.generate({
12555
12555
  seed: `${i}-${Z}`,
12556
- templateId: Q.id,
12556
+ templateId: te.id,
12557
12557
  cr: I,
12558
12558
  // Pass CR for proper level scaling (Task 1.4)
12559
- rarity: q[Z],
12559
+ rarity: U[Z],
12560
12560
  // Use distributed rarity (Task 2.3)
12561
12561
  difficultyMultiplier: c,
12562
12562
  audioProfile: f,
@@ -12564,7 +12564,7 @@ const U = class U {
12564
12564
  });
12565
12565
  W.push(se);
12566
12566
  }
12567
- return p && !o && U.applyLeaderPromotion(W, D, r), W;
12567
+ return p && !o && G.applyLeaderPromotion(W, D, r), W;
12568
12568
  }
12569
12569
  /**
12570
12570
  * Generate an encounter based on target CR (no party needed)
@@ -12630,9 +12630,9 @@ const U = class U {
12630
12630
  const y = Mi(i);
12631
12631
  let v = n;
12632
12632
  y > 1 && i > 1 && (v = Math.max(n / Math.sqrt(y), 0.125));
12633
- const _ = r ? U.getRarityDistribution(i, n) : Array(i).fill(a), T = U.getSeededRNG(t), S = U.selectTemplatesForMix(
12633
+ const T = r ? G.getRarityDistribution(i, n) : Array(i).fill(a), _ = G.getSeededRNG(t), S = G.selectTemplatesForMix(
12634
12634
  i,
12635
- T,
12635
+ _,
12636
12636
  d,
12637
12637
  h,
12638
12638
  c,
@@ -12643,21 +12643,21 @@ const U = class U {
12643
12643
  const R = S[D];
12644
12644
  if (!R)
12645
12645
  throw new Error(`No template available for enemy at index ${D}`);
12646
- const q = U.generate({
12646
+ const U = G.generate({
12647
12647
  seed: `${t}-${D}`,
12648
12648
  templateId: R.id,
12649
12649
  cr: v,
12650
12650
  // Pass CR for proper level scaling (Task 1.4)
12651
- rarity: _[D],
12651
+ rarity: T[D],
12652
12652
  // Use distributed rarity (Task 2.3)
12653
12653
  difficultyMultiplier: o,
12654
12654
  audioProfile: m,
12655
12655
  track: f,
12656
12656
  ...p ? { statLevels: p } : {}
12657
12657
  });
12658
- I.push(q);
12658
+ I.push(U);
12659
12659
  }
12660
- return g && !r && U.applyLeaderPromotion(I, T, a), I;
12660
+ return g && !r && G.applyLeaderPromotion(I, _, a), I;
12661
12661
  }
12662
12662
  /**
12663
12663
  * Select templates for each enemy in an encounter based on mix mode
@@ -12677,7 +12677,7 @@ const U = class U {
12677
12677
  const c = [];
12678
12678
  if (i === "custom" && n)
12679
12679
  for (let l = 0; l < e; l++) {
12680
- const u = n[l % n.length], d = U.getTemplateById(u);
12680
+ const u = n[l % n.length], d = G.getTemplateById(u);
12681
12681
  if (!d)
12682
12682
  throw new Error(`Unknown template ID in custom mix: ${u}`);
12683
12683
  c.push(d);
@@ -12686,7 +12686,7 @@ const U = class U {
12686
12686
  if (!a)
12687
12687
  throw new Error('category option is required when using enemyMix: "category"');
12688
12688
  for (let l = 0; l < e; l++) {
12689
- const u = U.selectTemplate(
12689
+ const u = G.selectTemplate(
12690
12690
  t,
12691
12691
  a,
12692
12692
  r,
@@ -12696,7 +12696,7 @@ const U = class U {
12696
12696
  }
12697
12697
  } else if (i === "random")
12698
12698
  for (let l = 0; l < e; l++) {
12699
- const u = U.selectTemplate(
12699
+ const u = G.selectTemplate(
12700
12700
  t,
12701
12701
  void 0,
12702
12702
  // No category filter - select from all
@@ -12706,7 +12706,7 @@ const U = class U {
12706
12706
  c.push(u);
12707
12707
  }
12708
12708
  else {
12709
- const l = U.selectTemplate(
12709
+ const l = G.selectTemplate(
12710
12710
  t,
12711
12711
  a,
12712
12712
  r,
@@ -12738,10 +12738,10 @@ const U = class U {
12738
12738
  return;
12739
12739
  const a = [];
12740
12740
  if (n >= 4 && n <= 6) {
12741
- const r = t.randomInt(0, n), o = U.promoteRarity(i, 1);
12741
+ const r = t.randomInt(0, n), o = G.promoteRarity(i, 1);
12742
12742
  a.push({ index: r, rarity: o });
12743
12743
  } else if (n >= 7 && n <= 9) {
12744
- const r = t.randomInt(0, n), o = U.promoteRarity(i, 2);
12744
+ const r = t.randomInt(0, n), o = G.promoteRarity(i, 2);
12745
12745
  a.push({ index: r, rarity: o });
12746
12746
  } else if (n >= 10) {
12747
12747
  const r = t.randomInt(0, n);
@@ -12749,14 +12749,14 @@ const U = class U {
12749
12749
  for (; o === r && n > 1; )
12750
12750
  o = t.randomInt(0, n);
12751
12751
  a.push(
12752
- { index: r, rarity: U.promoteRarity(i, 1) },
12753
- { index: o, rarity: U.promoteRarity(i, 2) }
12752
+ { index: r, rarity: G.promoteRarity(i, 1) },
12753
+ { index: o, rarity: G.promoteRarity(i, 2) }
12754
12754
  );
12755
12755
  }
12756
12756
  for (const r of a) {
12757
- const o = e[r.index], c = o.name.toLowerCase().replace(/\s+/g, "-"), l = U.getTemplateById(c);
12757
+ const o = e[r.index], c = o.name.toLowerCase().replace(/\s+/g, "-"), l = G.getTemplateById(c);
12758
12758
  if (l) {
12759
- const u = U.generate({
12759
+ const u = G.generate({
12760
12760
  seed: o.seed + "-promoted",
12761
12761
  templateId: l.id,
12762
12762
  rarity: r.rarity
@@ -12784,7 +12784,7 @@ const U = class U {
12784
12784
  * ```
12785
12785
  */
12786
12786
  static calculateUpgradePoints(e) {
12787
- return e >= U.CR_TIERS.EPIC.min ? 6 : e >= U.CR_TIERS.VERY_HIGH.min ? 5 : e >= U.CR_TIERS.HIGH.min ? 4 : e >= U.CR_TIERS.MEDIUM_HIGH.min ? 3 : e >= U.CR_TIERS.MEDIUM.min ? 2 : e >= U.CR_TIERS.LOW_MEDIUM.min ? 1 : 0;
12787
+ return e >= G.CR_TIERS.EPIC.min ? 6 : e >= G.CR_TIERS.VERY_HIGH.min ? 5 : e >= G.CR_TIERS.HIGH.min ? 4 : e >= G.CR_TIERS.MEDIUM_HIGH.min ? 3 : e >= G.CR_TIERS.MEDIUM.min ? 2 : e >= G.CR_TIERS.LOW_MEDIUM.min ? 1 : 0;
12788
12788
  }
12789
12789
  /**
12790
12790
  * Upgrade rarity by one step, capped at elite
@@ -12818,10 +12818,10 @@ const U = class U {
12818
12818
  * ```
12819
12819
  */
12820
12820
  static getRarityDistribution(e, t) {
12821
- const i = U.calculateUpgradePoints(t), n = Array(e).fill("common");
12821
+ const i = G.calculateUpgradePoints(t), n = Array(e).fill("common");
12822
12822
  for (let a = 0; a < i; a++) {
12823
12823
  const r = a % e;
12824
- n[r] = U.upgradeRarity(n[r]);
12824
+ n[r] = G.upgradeRarity(n[r]);
12825
12825
  }
12826
12826
  return n;
12827
12827
  }
@@ -12846,11 +12846,11 @@ const U = class U {
12846
12846
  return i[a];
12847
12847
  }
12848
12848
  };
12849
- U.ARCHETYPE_TAGS = {
12849
+ G.ARCHETYPE_TAGS = {
12850
12850
  brute: ["combat", "damage", "defense", "melee", "durability"],
12851
12851
  archer: ["combat", "ranged", "accuracy", "mobility", "stealth"],
12852
12852
  support: ["support", "healing", "buff", "control", "utility"]
12853
- }, U.MAX_AUDIO_INFLUENCE = 2, U.BOSS_TITLES = [
12853
+ }, G.MAX_AUDIO_INFLUENCE = 2, G.BOSS_TITLES = [
12854
12854
  "the Destroyer",
12855
12855
  "the Unbreakable",
12856
12856
  "the Annihilator",
@@ -12874,7 +12874,7 @@ U.ARCHETYPE_TAGS = {
12874
12874
  "the World Breaker",
12875
12875
  "the Timeless",
12876
12876
  "the Forgotten"
12877
- ], U.BOSS_PREFIXES = [
12877
+ ], G.BOSS_PREFIXES = [
12878
12878
  "Great",
12879
12879
  "Eternal",
12880
12880
  "Ancient",
@@ -12885,7 +12885,7 @@ U.ARCHETYPE_TAGS = {
12885
12885
  "Blood",
12886
12886
  "Iron",
12887
12887
  "Storm"
12888
- ], U.CR_TIERS = {
12888
+ ], G.CR_TIERS = {
12889
12889
  LOW: { min: 0, max: 2, upgrades: 0 },
12890
12890
  // CR 0-2
12891
12891
  LOW_MEDIUM: { min: 3, max: 5, upgrades: 1 },
@@ -12901,7 +12901,7 @@ U.ARCHETYPE_TAGS = {
12901
12901
  EPIC: { min: 31, max: 1 / 0, upgrades: 6 }
12902
12902
  // CR 31+
12903
12903
  };
12904
- let Yt = U;
12904
+ let Yt = G;
12905
12905
  class $i {
12906
12906
  /**
12907
12907
  * Run a Monte Carlo combat simulation.
@@ -13176,7 +13176,7 @@ const jr = {
13176
13176
  hard: { min: 0.5, max: 0.6 },
13177
13177
  deadly: { min: 0.3, max: 0.4 }
13178
13178
  };
13179
- class Db {
13179
+ class Ib {
13180
13180
  /**
13181
13181
  * Validate an encounter by running simulations and analyzing results.
13182
13182
  *
@@ -13348,7 +13348,7 @@ class Db {
13348
13348
  return o;
13349
13349
  }
13350
13350
  }
13351
- class Eb {
13351
+ class Db {
13352
13352
  /**
13353
13353
  * Run a parameter sweep.
13354
13354
  *
@@ -13560,7 +13560,7 @@ class Eb {
13560
13560
  };
13561
13561
  }
13562
13562
  }
13563
- class xb {
13563
+ class Eb {
13564
13564
  /**
13565
13565
  * Compare two encounter configurations using identical-seed simulation.
13566
13566
  *
@@ -13812,10 +13812,10 @@ const ke = class ke {
13812
13812
  onProgress: h
13813
13813
  } = n, m = [];
13814
13814
  let f = 0;
13815
- const g = e.map((oe) => oe.level), p = Zn(g, i), y = Mi(u), v = p / y, _ = Br(v);
13816
- let T = ke.CR_FLOOR, S = ke.CR_CEILING, I = Math.max(T, Math.min(S, _));
13815
+ const g = e.map((oe) => oe.level), p = Zn(g, i), y = Mi(u), v = p / y, T = Br(v);
13816
+ let _ = ke.CR_FLOOR, S = ke.CR_CEILING, I = Math.max(_, Math.min(S, T));
13817
13817
  const D = jr[i];
13818
- let R = !1, q = null, O = !1;
13818
+ let R = !1, U = null, O = !1;
13819
13819
  for (let oe = 0; oe < l; oe++) {
13820
13820
  if (d?.aborted) {
13821
13821
  O = !0;
@@ -13843,34 +13843,34 @@ const ke = class ke {
13843
13843
  };
13844
13844
  m.push(X);
13845
13845
  const fe = (D.min + D.max) / 2;
13846
- if ((!q || Math.abs(X.winRate - fe) < Math.abs(q.winRate - fe)) && (q = X), X.winRate >= D.min && X.winRate <= D.max) {
13846
+ if ((!U || Math.abs(X.winRate - fe) < Math.abs(U.winRate - fe)) && (U = X), X.winRate >= D.min && X.winRate <= D.max) {
13847
13847
  R = !0;
13848
13848
  break;
13849
13849
  }
13850
- X.winRate > D.max ? T = I : S = I;
13851
- const ge = (T + S) / 2;
13850
+ X.winRate > D.max ? _ = I : S = I;
13851
+ const ge = (_ + S) / 2;
13852
13852
  if (Math.abs(ge - I) < ke.CR_STEP_MIN) {
13853
13853
  if (X.winRate > D.max ? I = Math.min(ke.CR_CEILING, I + ke.CR_STEP_MIN) : I = Math.max(ke.CR_FLOOR, I - ke.CR_STEP_MIN), I === m[m.length - 1].cr)
13854
13854
  break;
13855
13855
  } else
13856
13856
  I = ge;
13857
13857
  }
13858
- const W = q?.cr ?? I, Z = this.generateEnemy(t, W, o), Q = this.calculateMarginOfError(q?.totalRuns ?? c), se = this.formatConfidenceInterval(
13859
- q?.winRate ?? 0,
13860
- Q
13858
+ const W = U?.cr ?? I, Z = this.generateEnemy(t, W, o), te = this.calculateMarginOfError(U?.totalRuns ?? c), se = this.formatConfidenceInterval(
13859
+ U?.winRate ?? 0,
13860
+ te
13861
13861
  );
13862
13862
  return {
13863
13863
  targetDifficulty: i,
13864
13864
  recommendedCR: this.roundCR(W),
13865
- winRate: q?.winRate ?? 0,
13865
+ winRate: U?.winRate ?? 0,
13866
13866
  expectedWinRateRange: D,
13867
13867
  confidenceInterval: se,
13868
- marginOfError: Q,
13868
+ marginOfError: te,
13869
13869
  converged: R,
13870
13870
  totalSimulationsRun: f,
13871
13871
  iterationsUsed: m.length,
13872
13872
  probes: m,
13873
- initialCREstimate: this.roundCR(_),
13873
+ initialCREstimate: this.roundCR(T),
13874
13874
  suggestedEnemy: Z,
13875
13875
  wasCancelled: O
13876
13876
  };
@@ -14031,7 +14031,7 @@ function Pn(s) {
14031
14031
  maxMultiplier: s.maxMultiplier ?? nt.maxMultiplier
14032
14032
  } : nt;
14033
14033
  }
14034
- function Rb(s, e = nt.combo.okBreaksCombo) {
14034
+ function xb(s, e = nt.combo.okBreaksCombo) {
14035
14035
  return s === "miss" || s === "wrongKey" ? !0 : s === "ok" ? e : !1;
14036
14036
  }
14037
14037
  function E(s, e, t) {
@@ -15223,57 +15223,57 @@ const Mh = /* @__PURE__ */ E("$ZodObject", (s, e) => {
15223
15223
  }), Ih = /* @__PURE__ */ E("$ZodObjectJIT", (s, e) => {
15224
15224
  Mh.init(s, e);
15225
15225
  const t = s._zod.parse, i = Qn(() => ho(e)), n = (h) => {
15226
- const m = new Yd(["shape", "payload", "ctx"]), f = i.value, g = (_) => {
15227
- const T = Cs(_);
15228
- return `shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`;
15226
+ const m = new Yd(["shape", "payload", "ctx"]), f = i.value, g = (T) => {
15227
+ const _ = Cs(T);
15228
+ return `shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`;
15229
15229
  };
15230
15230
  m.write("const input = payload.value;");
15231
15231
  const p = /* @__PURE__ */ Object.create(null);
15232
15232
  let y = 0;
15233
- for (const _ of f.keys)
15234
- p[_] = `key_${y++}`;
15233
+ for (const T of f.keys)
15234
+ p[T] = `key_${y++}`;
15235
15235
  m.write("const newResult = {};");
15236
- for (const _ of f.keys) {
15237
- const T = p[_], S = Cs(_), D = h[_]?._zod?.optout === "optional";
15238
- m.write(`const ${T} = ${g(_)};`), D ? m.write(`
15239
- if (${T}.issues.length) {
15236
+ for (const T of f.keys) {
15237
+ const _ = p[T], S = Cs(T), D = h[T]?._zod?.optout === "optional";
15238
+ m.write(`const ${_} = ${g(T)};`), D ? m.write(`
15239
+ if (${_}.issues.length) {
15240
15240
  if (${S} in input) {
15241
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
15241
+ payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
15242
15242
  ...iss,
15243
15243
  path: iss.path ? [${S}, ...iss.path] : [${S}]
15244
15244
  })));
15245
15245
  }
15246
15246
  }
15247
15247
 
15248
- if (${T}.value === undefined) {
15248
+ if (${_}.value === undefined) {
15249
15249
  if (${S} in input) {
15250
15250
  newResult[${S}] = undefined;
15251
15251
  }
15252
15252
  } else {
15253
- newResult[${S}] = ${T}.value;
15253
+ newResult[${S}] = ${_}.value;
15254
15254
  }
15255
15255
 
15256
15256
  `) : m.write(`
15257
- if (${T}.issues.length) {
15258
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
15257
+ if (${_}.issues.length) {
15258
+ payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
15259
15259
  ...iss,
15260
15260
  path: iss.path ? [${S}, ...iss.path] : [${S}]
15261
15261
  })));
15262
15262
  }
15263
15263
 
15264
- if (${T}.value === undefined) {
15264
+ if (${_}.value === undefined) {
15265
15265
  if (${S} in input) {
15266
15266
  newResult[${S}] = undefined;
15267
15267
  }
15268
15268
  } else {
15269
- newResult[${S}] = ${T}.value;
15269
+ newResult[${S}] = ${_}.value;
15270
15270
  }
15271
15271
 
15272
15272
  `);
15273
15273
  }
15274
15274
  m.write("payload.value = newResult;"), m.write("return payload;");
15275
15275
  const v = m.compile();
15276
- return (_, T) => v(h, _, T);
15276
+ return (T, _) => v(h, T, _);
15277
15277
  };
15278
15278
  let a;
15279
15279
  const r = Di, o = !Yr.jitless, l = o && qu.value, u = e.catchall;
@@ -16599,7 +16599,7 @@ const ff = (s, e) => {
16599
16599
  }), Mf = /* @__PURE__ */ E("ZodString", (s, e) => {
16600
16600
  sa.init(s, e), So.init(s, e), s.email = (t) => s.check(/* @__PURE__ */ Vh(If, t)), s.url = (t) => s.check(/* @__PURE__ */ Xh(Df, t)), s.jwt = (t) => s.check(/* @__PURE__ */ hm(Gf, t)), s.emoji = (t) => s.check(/* @__PURE__ */ Jh(Ef, t)), s.guid = (t) => s.check(/* @__PURE__ */ Ns(Ls, t)), s.uuid = (t) => s.check(/* @__PURE__ */ jh(pi, t)), s.uuidv4 = (t) => s.check(/* @__PURE__ */ Kh(pi, t)), s.uuidv6 = (t) => s.check(/* @__PURE__ */ Yh(pi, t)), s.uuidv7 = (t) => s.check(/* @__PURE__ */ Zh(pi, t)), s.nanoid = (t) => s.check(/* @__PURE__ */ Qh(xf, t)), s.guid = (t) => s.check(/* @__PURE__ */ Ns(Ls, t)), s.cuid = (t) => s.check(/* @__PURE__ */ em(Rf, t)), s.cuid2 = (t) => s.check(/* @__PURE__ */ tm(Pf, t)), s.ulid = (t) => s.check(/* @__PURE__ */ im(Bf, t)), s.base64 = (t) => s.check(/* @__PURE__ */ lm(Wf, t)), s.base64url = (t) => s.check(/* @__PURE__ */ um(Hf, t)), s.xid = (t) => s.check(/* @__PURE__ */ nm(Nf, t)), s.ksuid = (t) => s.check(/* @__PURE__ */ am(Ff, t)), s.ipv4 = (t) => s.check(/* @__PURE__ */ sm($f, t)), s.ipv6 = (t) => s.check(/* @__PURE__ */ rm(Of, t)), s.cidrv4 = (t) => s.check(/* @__PURE__ */ om(Lf, t)), s.cidrv6 = (t) => s.check(/* @__PURE__ */ cm(zf, t)), s.e164 = (t) => s.check(/* @__PURE__ */ dm(qf, t)), s.datetime = (t) => s.check(of(t)), s.date = (t) => s.check(lf(t)), s.time = (t) => s.check(df(t)), s.duration = (t) => s.check(mf(t));
16601
16601
  });
16602
- function G(s) {
16602
+ function q(s) {
16603
16603
  return /* @__PURE__ */ Uh(Mf, s);
16604
16604
  }
16605
16605
  const de = /* @__PURE__ */ E("ZodStringFormat", (s, e) => {
@@ -16884,43 +16884,43 @@ function bg(s) {
16884
16884
  return /* @__PURE__ */ Nm(s);
16885
16885
  }
16886
16886
  const wg = et.map((s) => s), Sg = re({
16887
- id: G(),
16888
- uuid: G(),
16887
+ id: q(),
16888
+ uuid: q(),
16889
16889
  playlist_index: z().nonnegative(),
16890
- chain_name: G(),
16891
- token_address: G().optional(),
16892
- token_id: G().optional(),
16893
- tx_id: G().optional(),
16894
- platform: G(),
16895
- title: G(),
16896
- artist: G(),
16897
- description: G().optional(),
16898
- album: G().optional(),
16899
- image_url: G().url(),
16900
- image_thumb_url: G().url().optional(),
16901
- audio_url: G().url(),
16902
- audio_url_lossless: G().url().optional(),
16890
+ chain_name: q(),
16891
+ token_address: q().optional(),
16892
+ token_id: q().optional(),
16893
+ tx_id: q().optional(),
16894
+ platform: q(),
16895
+ title: q(),
16896
+ artist: q(),
16897
+ description: q().optional(),
16898
+ album: q().optional(),
16899
+ image_url: q().url(),
16900
+ image_thumb_url: q().url().optional(),
16901
+ audio_url: q().url(),
16902
+ audio_url_lossless: q().url().optional(),
16903
16903
  duration: z().nonnegative(),
16904
- genre: G(),
16905
- tags: Te(G()),
16904
+ genre: q(),
16905
+ tags: Te(q()),
16906
16906
  bpm: z().positive().optional(),
16907
- key: G().optional(),
16908
- attributes: Ci(G(), ra([G(), z()])).optional()
16907
+ key: q().optional(),
16908
+ attributes: Ci(q(), ra([q(), z()])).optional()
16909
16909
  }).refine(
16910
16910
  (s) => s.chain_name === "AR" ? !!s.tx_id : !!s.token_address && !!s.token_id,
16911
16911
  {
16912
16912
  message: "AR chain tracks must have tx_id; other chains must have token_address and token_id",
16913
16913
  path: ["chain_name"]
16914
16914
  }
16915
- ), Pb = re({
16916
- name: G(),
16917
- description: G().optional(),
16918
- image: G().url(),
16919
- creator: G(),
16920
- genre: G().optional(),
16921
- tags: Te(G()).optional(),
16915
+ ), Rb = re({
16916
+ name: q(),
16917
+ description: q().optional(),
16918
+ image: q().url(),
16919
+ creator: q(),
16920
+ genre: q().optional(),
16921
+ tags: Te(q()).optional(),
16922
16922
  tracks: Te(Sg)
16923
- }), Bb = re({
16923
+ }), Pb = re({
16924
16924
  bass_dominance: z().min(0).max(1),
16925
16925
  mid_dominance: z().min(0).max(1),
16926
16926
  treble_dominance: z().min(0).max(1),
@@ -16929,10 +16929,10 @@ const wg = et.map((s) => s), Sg = re({
16929
16929
  spectral_rolloff: z().optional(),
16930
16930
  zero_crossing_rate: z().optional(),
16931
16931
  color_palette: re({
16932
- colors: Te(G()),
16933
- primary_color: G(),
16934
- secondary_color: G().optional(),
16935
- accent_color: G().optional(),
16932
+ colors: Te(q()),
16933
+ primary_color: q(),
16934
+ secondary_color: q().optional(),
16935
+ accent_color: q().optional(),
16936
16936
  brightness: z().min(0).max(1),
16937
16937
  saturation: z().min(0).max(1),
16938
16938
  is_monochrome: Fn()
@@ -16941,7 +16941,7 @@ const wg = et.map((s) => s), Sg = re({
16941
16941
  duration_analyzed: z().positive(),
16942
16942
  full_buffer_analyzed: Fn(),
16943
16943
  sample_positions: Te(z()),
16944
- analyzed_at: G()
16944
+ analyzed_at: q()
16945
16945
  })
16946
16946
  }), Us = re({
16947
16947
  STR: z().min(1).max(20),
@@ -16950,8 +16950,8 @@ const wg = et.map((s) => s), Sg = re({
16950
16950
  INT: z().min(1).max(20),
16951
16951
  WIS: z().min(1).max(20),
16952
16952
  CHA: z().min(1).max(20)
16953
- }), Nb = re({
16954
- name: G(),
16953
+ }), Bb = re({
16954
+ name: q(),
16955
16955
  race: ki(["Human", "Elf", "Dwarf", "Halfling", "Dragonborn", "Gnome", "Half-Elf", "Half-Orc", "Tiefling"]),
16956
16956
  class: ki(wg),
16957
16957
  level: z().min(1).max(20),
@@ -16966,40 +16966,40 @@ const wg = et.map((s) => s), Sg = re({
16966
16966
  armor_class: z().positive(),
16967
16967
  initiative: z(),
16968
16968
  speed: z().positive(),
16969
- skills: Ci(G(), ki(["none", "proficient", "expertise"])),
16970
- saving_throws: Ci(G(), Fn()),
16971
- racial_traits: Te(G()),
16972
- class_features: Te(G()),
16969
+ skills: Ci(q(), ki(["none", "proficient", "expertise"])),
16970
+ saving_throws: Ci(q(), Fn()),
16971
+ racial_traits: Te(q()),
16972
+ class_features: Te(q()),
16973
16973
  spells: re({
16974
- spell_slots: Ci(G(), re({
16974
+ spell_slots: Ci(q(), re({
16975
16975
  total: z().nonnegative(),
16976
16976
  used: z().nonnegative()
16977
16977
  })),
16978
- known_spells: Te(G()),
16979
- cantrips: Te(G())
16978
+ known_spells: Te(q()),
16979
+ cantrips: Te(q())
16980
16980
  }).optional(),
16981
16981
  equipment: re({
16982
- weapons: Te(G()),
16983
- armor: Te(G()),
16984
- items: Te(G())
16982
+ weapons: Te(q()),
16983
+ armor: Te(q()),
16984
+ items: Te(q())
16985
16985
  }).optional(),
16986
16986
  appearance: re({
16987
- body_type: G(),
16988
- skin_tone: G(),
16989
- hair_style: G(),
16990
- hair_color: G(),
16991
- eye_color: G(),
16992
- facial_features: Te(G()),
16993
- primary_color: G().optional(),
16994
- secondary_color: G().optional(),
16995
- aura_color: G().optional()
16987
+ body_type: q(),
16988
+ skin_tone: q(),
16989
+ hair_style: q(),
16990
+ hair_color: q(),
16991
+ eye_color: q(),
16992
+ facial_features: Te(q()),
16993
+ primary_color: q().optional(),
16994
+ secondary_color: q().optional(),
16995
+ aura_color: q().optional()
16996
16996
  }).optional(),
16997
16997
  xp: re({
16998
16998
  current: z().nonnegative(),
16999
16999
  next_level: z().positive()
17000
17000
  }),
17001
- seed: G(),
17002
- generated_at: G()
17001
+ seed: q(),
17002
+ generated_at: q()
17003
17003
  });
17004
17004
  var _g = /* @__PURE__ */ ((s) => (s[s.DEBUG = 0] = "DEBUG", s[s.INFO = 1] = "INFO", s[s.WARN = 2] = "WARN", s[s.ERROR = 3] = "ERROR", s[s.NONE = 4] = "NONE", s))(_g || {});
17005
17005
  const Tg = {
@@ -17192,10 +17192,10 @@ class Se {
17192
17192
  return `${t}:${i}:${n}.${a}`;
17193
17193
  }
17194
17194
  }
17195
- function Fb(s) {
17195
+ function Nb(s) {
17196
17196
  return Se.for(s);
17197
17197
  }
17198
- class ee {
17198
+ class J {
17199
17199
  /**
17200
17200
  * Extract primary (compressed) audio URL with priority:
17201
17201
  * 1. mp3_url (Standard web audio - preferred)
@@ -17313,37 +17313,97 @@ class ee {
17313
17313
  return null;
17314
17314
  }
17315
17315
  /**
17316
- * Extract genre with support for string or array formats
17317
- * - If genre is a string, returns it directly
17318
- * - If genre is an array, returns the first element
17319
- * - Also checks OpenSea attributes array for "Genre" trait_type
17316
+ * Extract genre with support for string or array formats.
17317
+ * Sources are checked in priority order; first non-empty wins:
17318
+ * - `genre` field as a string
17319
+ * - `genre` field as an array (first element)
17320
+ * - OpenSea `attributes` array with `trait_type` of "genre" (case-insensitive)
17321
+ * - `attributes` as an object keyed by trait name (e.g. `attributes.Genre`)
17322
+ * - malformed `attribute ` key (literal trailing space) with `.genre`
17323
+ * Stays strict: only fields literally named "genre" are considered
17324
+ * (no fallback to `category` or similar).
17320
17325
  */
17321
17326
  static extractGenre(e) {
17322
17327
  if (typeof e.genre == "string")
17323
17328
  return e.genre;
17324
17329
  if (Array.isArray(e.genre) && e.genre.length > 0) {
17325
- const t = e.genre[0];
17326
- return typeof t == "string" ? t : "";
17330
+ const i = e.genre[0];
17331
+ return typeof i == "string" ? i : "";
17327
17332
  }
17328
17333
  if (Array.isArray(e.attributes)) {
17329
- const t = e.attributes.find(
17330
- (i) => i.trait_type?.toLowerCase() === "genre" && i.value !== void 0
17334
+ const i = e.attributes.find(
17335
+ (n) => n.trait_type?.toLowerCase() === "genre" && n.value !== void 0
17331
17336
  );
17332
- if (t) {
17333
- if (typeof t.value == "string")
17334
- return t.value;
17335
- if (Array.isArray(t.value) && t.value.length > 0) {
17336
- const i = t.value[0];
17337
- return typeof i == "string" ? i : "";
17337
+ if (i) {
17338
+ if (typeof i.value == "string")
17339
+ return i.value;
17340
+ if (Array.isArray(i.value) && i.value.length > 0) {
17341
+ const n = i.value[0];
17342
+ return typeof n == "string" ? n : "";
17338
17343
  }
17339
17344
  }
17340
17345
  }
17346
+ if (e.attributes && typeof e.attributes == "object" && !Array.isArray(e.attributes)) {
17347
+ const i = e.attributes;
17348
+ for (const n of Object.keys(i))
17349
+ if (n.toLowerCase() === "genre" && typeof i[n] == "string")
17350
+ return i[n];
17351
+ }
17352
+ const t = e["attribute "];
17353
+ if (t && typeof t == "object" && !Array.isArray(t)) {
17354
+ const i = t.genre;
17355
+ if (typeof i == "string")
17356
+ return i;
17357
+ }
17341
17358
  return "";
17342
17359
  }
17343
17360
  /**
17344
- * Convert OpenSea-style attributes array to key-value object
17345
- * Example: [{ trait_type: "BPM", value: 120 }] => { BPM: 120 }
17361
+ * Extract tags from track metadata, normalized to a deduped,
17362
+ * lowercased, trimmed string[] with empties removed.
17363
+ * Sources (concatenated, then deduped):
17364
+ * - `tags` field as an array, or a single comma-separated string
17365
+ * - `properties.tags` array (when `properties` is an object)
17366
+ * - OpenSea `attributes` array with `trait_type` of "tag"/"tags" (case-insensitive)
17367
+ * - `attributes` as an object keyed by trait name (e.g. `attributes.Tags`)
17346
17368
  */
17369
+ static extractTags(e) {
17370
+ const t = [];
17371
+ if (Array.isArray(e.tags) ? t.push(...e.tags) : typeof e.tags == "string" && t.push(...e.tags.split(",")), e.properties && typeof e.properties == "object" && !Array.isArray(e.properties)) {
17372
+ const i = e.properties.tags;
17373
+ Array.isArray(i) ? t.push(...i) : typeof i == "string" && t.push(...i.split(","));
17374
+ }
17375
+ if (Array.isArray(e.attributes))
17376
+ for (const i of e.attributes) {
17377
+ if (!i || typeof i != "object") continue;
17378
+ const n = i.trait_type;
17379
+ if (typeof n == "string" && n.toLowerCase().match(/^tags?$/)) {
17380
+ const a = i.value;
17381
+ Array.isArray(a) ? t.push(...a) : typeof a == "string" && t.push(...a.split(","));
17382
+ }
17383
+ }
17384
+ else if (e.attributes && typeof e.attributes == "object") {
17385
+ const i = e.attributes;
17386
+ for (const n of Object.keys(i))
17387
+ if (n.toLowerCase().match(/^tags?$/)) {
17388
+ const a = i[n];
17389
+ Array.isArray(a) ? t.push(...a) : typeof a == "string" && t.push(...a.split(","));
17390
+ }
17391
+ }
17392
+ return J.normalizeTags(t);
17393
+ }
17394
+ /**
17395
+ * Normalize a list of raw tag values into a deduped, lowercased,
17396
+ * trimmed string[] with empties removed.
17397
+ */
17398
+ static normalizeTags(e) {
17399
+ const t = /* @__PURE__ */ new Set();
17400
+ for (const i of e) {
17401
+ if (i == null) continue;
17402
+ const n = String(i).trim().toLowerCase();
17403
+ n && t.add(n);
17404
+ }
17405
+ return Array.from(t);
17406
+ }
17347
17407
  static convertAttributes(e) {
17348
17408
  if (!Array.isArray(e))
17349
17409
  return null;
@@ -17370,9 +17430,9 @@ function oa(s) {
17370
17430
  if ("audio_url" in s && typeof s.audio_url == "string")
17371
17431
  return s.audio_url;
17372
17432
  if ("metadata" in s) {
17373
- const e = ee.parseMetadata(s.metadata);
17433
+ const e = J.parseMetadata(s.metadata);
17374
17434
  if (e)
17375
- return ee.extractAudioUrl(e);
17435
+ return J.extractAudioUrl(e);
17376
17436
  }
17377
17437
  return null;
17378
17438
  }
@@ -17380,9 +17440,9 @@ function Cg(s) {
17380
17440
  if ("audio_url_lossless" in s && typeof s.audio_url_lossless == "string")
17381
17441
  return s.audio_url_lossless;
17382
17442
  if ("metadata" in s) {
17383
- const e = ee.parseMetadata(s.metadata);
17443
+ const e = J.parseMetadata(s.metadata);
17384
17444
  if (e)
17385
- return ee.extractAudioUrlLossless(e);
17445
+ return J.extractAudioUrlLossless(e);
17386
17446
  }
17387
17447
  return null;
17388
17448
  }
@@ -17392,9 +17452,9 @@ function ca(s) {
17392
17452
  if ("metadata" in s) {
17393
17453
  if ("artwork_url" in s && typeof s.artwork_url == "string")
17394
17454
  return s.artwork_url;
17395
- const e = ee.parseMetadata(s.metadata);
17455
+ const e = J.parseMetadata(s.metadata);
17396
17456
  if (e)
17397
- return ee.extractImageUrl(e);
17457
+ return J.extractImageUrl(e);
17398
17458
  }
17399
17459
  return null;
17400
17460
  }
@@ -17402,9 +17462,9 @@ function ko(s) {
17402
17462
  if ("image_thumb_url" in s && typeof s.image_thumb_url == "string")
17403
17463
  return s.image_thumb_url;
17404
17464
  if ("metadata" in s) {
17405
- const e = ee.parseMetadata(s.metadata);
17465
+ const e = J.parseMetadata(s.metadata);
17406
17466
  if (e)
17407
- return ee.extractImageThumbUrl(e);
17467
+ return J.extractImageThumbUrl(e);
17408
17468
  }
17409
17469
  return null;
17410
17470
  }
@@ -17412,13 +17472,13 @@ function Ao(s) {
17412
17472
  if ("audio_url" in s)
17413
17473
  return null;
17414
17474
  if ("metadata" in s) {
17415
- const e = ee.parseMetadata(s.metadata);
17475
+ const e = J.parseMetadata(s.metadata);
17416
17476
  if (e && typeof e.vrm == "string" && e.vrm)
17417
17477
  return e.vrm;
17418
17478
  }
17419
17479
  return null;
17420
17480
  }
17421
- function $b(s) {
17481
+ function Fb(s) {
17422
17482
  const e = [];
17423
17483
  for (const t of s.tracks) {
17424
17484
  const i = oa(t);
@@ -17426,7 +17486,7 @@ function $b(s) {
17426
17486
  }
17427
17487
  return e;
17428
17488
  }
17429
- function Ob(s) {
17489
+ function $b(s) {
17430
17490
  const e = [];
17431
17491
  for (const t of s.tracks) {
17432
17492
  const i = ca(t);
@@ -17434,7 +17494,7 @@ function Ob(s) {
17434
17494
  }
17435
17495
  return e;
17436
17496
  }
17437
- function Lb(s) {
17497
+ function Ob(s) {
17438
17498
  const e = [];
17439
17499
  for (const t of s.tracks) {
17440
17500
  if ("title" in t && typeof t.title == "string") {
@@ -17442,16 +17502,16 @@ function Lb(s) {
17442
17502
  continue;
17443
17503
  }
17444
17504
  if ("metadata" in t) {
17445
- const i = ee.parseMetadata(t.metadata);
17505
+ const i = J.parseMetadata(t.metadata);
17446
17506
  if (i) {
17447
- const n = ee.extractTitle(i);
17507
+ const n = J.extractTitle(i);
17448
17508
  n && e.push(n);
17449
17509
  }
17450
17510
  }
17451
17511
  }
17452
17512
  return e;
17453
17513
  }
17454
- function zb(s) {
17514
+ function Lb(s) {
17455
17515
  const e = [];
17456
17516
  for (const t of s.tracks) {
17457
17517
  if ("artist" in t && typeof t.artist == "string") {
@@ -17459,16 +17519,16 @@ function zb(s) {
17459
17519
  continue;
17460
17520
  }
17461
17521
  if ("metadata" in t) {
17462
- const i = ee.parseMetadata(t.metadata);
17522
+ const i = J.parseMetadata(t.metadata);
17463
17523
  if (i) {
17464
- const n = ee.extractArtist(i);
17524
+ const n = J.extractArtist(i);
17465
17525
  n && e.push(n);
17466
17526
  }
17467
17527
  }
17468
17528
  }
17469
17529
  return e;
17470
17530
  }
17471
- function Wb(s) {
17531
+ function zb(s) {
17472
17532
  const e = /* @__PURE__ */ new Set();
17473
17533
  for (const t of s.tracks) {
17474
17534
  if ("genre" in t && typeof t.genre == "string" && t.genre) {
@@ -17476,13 +17536,13 @@ function Wb(s) {
17476
17536
  continue;
17477
17537
  }
17478
17538
  if ("metadata" in t) {
17479
- const i = ee.parseMetadata(t.metadata);
17539
+ const i = J.parseMetadata(t.metadata);
17480
17540
  i && typeof i.genre == "string" && i.genre && e.add(i.genre);
17481
17541
  }
17482
17542
  }
17483
17543
  return Array.from(e).sort();
17484
17544
  }
17485
- function Hb(s) {
17545
+ function Wb(s) {
17486
17546
  const e = /* @__PURE__ */ new Set();
17487
17547
  for (const t of s.tracks) {
17488
17548
  if ("tags" in t && Array.isArray(t.tags)) {
@@ -17491,7 +17551,7 @@ function Hb(s) {
17491
17551
  continue;
17492
17552
  }
17493
17553
  if ("metadata" in t) {
17494
- const i = ee.parseMetadata(t.metadata);
17554
+ const i = J.parseMetadata(t.metadata);
17495
17555
  if (i && Array.isArray(i.tags))
17496
17556
  for (const n of i.tags)
17497
17557
  n && e.add(String(n).toLowerCase());
@@ -17499,7 +17559,7 @@ function Hb(s) {
17499
17559
  }
17500
17560
  return Array.from(e).sort();
17501
17561
  }
17502
- function qb(s) {
17562
+ function Hb(s) {
17503
17563
  let e = 0;
17504
17564
  for (const t of s.tracks) {
17505
17565
  if ("duration" in t && typeof t.duration == "number") {
@@ -17507,16 +17567,16 @@ function qb(s) {
17507
17567
  continue;
17508
17568
  }
17509
17569
  if ("metadata" in t) {
17510
- const i = ee.parseMetadata(t.metadata);
17570
+ const i = J.parseMetadata(t.metadata);
17511
17571
  i && typeof i.duration == "number" && (e += i.duration);
17512
17572
  }
17513
17573
  }
17514
17574
  return e;
17515
17575
  }
17516
- function Gb(s) {
17576
+ function qb(s) {
17517
17577
  return s.tracks.length;
17518
17578
  }
17519
- function Ub(s) {
17579
+ function Gb(s) {
17520
17580
  const e = [];
17521
17581
  for (const t of s.tracks) {
17522
17582
  const i = oa(t), n = ca(t), a = ko(t);
@@ -17524,8 +17584,8 @@ function Ub(s) {
17524
17584
  if ("title" in t)
17525
17585
  r = t.title || "", o = t.artist || "";
17526
17586
  else if ("metadata" in t) {
17527
- const c = ee.parseMetadata(t.metadata);
17528
- c && (r = ee.extractTitle(c) || "", o = ee.extractArtist(c) || "");
17587
+ const c = J.parseMetadata(t.metadata);
17588
+ c && (r = J.extractTitle(c) || "", o = J.extractArtist(c) || "");
17529
17589
  }
17530
17590
  if (i) {
17531
17591
  const c = {
@@ -17539,7 +17599,7 @@ function Ub(s) {
17539
17599
  }
17540
17600
  return e;
17541
17601
  }
17542
- function Vb(s) {
17602
+ function Ub(s) {
17543
17603
  const e = [];
17544
17604
  for (const t of s.tracks) {
17545
17605
  if ("audio_url" in t) {
@@ -17547,9 +17607,9 @@ function Vb(s) {
17547
17607
  continue;
17548
17608
  }
17549
17609
  if ("metadata" in t) {
17550
- const i = ee.parseMetadata(t.metadata);
17610
+ const i = J.parseMetadata(t.metadata);
17551
17611
  if (i) {
17552
- const n = ee.extractAudioUrlLossless(i), a = ee.extractAudioUrl(i);
17612
+ const n = J.extractAudioUrlLossless(i), a = J.extractAudioUrl(i);
17553
17613
  e.push({
17554
17614
  id: t.chain_name === "AR" ? `AR-${t.tx_id}` : `${t.chain_name}-${t.token_address}-${t.token_id}`,
17555
17615
  chain_name: t.chain_name,
@@ -17557,11 +17617,11 @@ function Vb(s) {
17557
17617
  token_id: t.token_id,
17558
17618
  tx_id: t.tx_id,
17559
17619
  platform: t.platform,
17560
- title: ee.extractTitle(i),
17561
- artist: ee.extractArtist(i),
17620
+ title: J.extractTitle(i),
17621
+ artist: J.extractArtist(i),
17562
17622
  audio_url: a,
17563
- image_url: ee.extractImageUrl(i),
17564
- image_thumb_url: ee.extractImageThumbUrl(i),
17623
+ image_url: J.extractImageUrl(i),
17624
+ image_thumb_url: J.extractImageThumbUrl(i),
17565
17625
  duration: i.duration,
17566
17626
  genre: i.genre,
17567
17627
  tags: i.tags,
@@ -17569,7 +17629,7 @@ function Vb(s) {
17569
17629
  key: i.key,
17570
17630
  album: i.album,
17571
17631
  description: i.description,
17572
- attributes: ee.convertAttributes(i.attributes),
17632
+ attributes: J.convertAttributes(i.attributes),
17573
17633
  ...n && n !== a ? { audio_url_lossless: n } : {},
17574
17634
  // v0.4 IPFS hash fields from raw track (mint fields live only in metadata interior)
17575
17635
  ...t.audio_ipfs_hash ? { audio_ipfs_hash: t.audio_ipfs_hash } : {},
@@ -17580,7 +17640,7 @@ function Vb(s) {
17580
17640
  }
17581
17641
  return e;
17582
17642
  }
17583
- function jb(s) {
17643
+ function Vb(s) {
17584
17644
  const e = [];
17585
17645
  for (const t of s.tracks) {
17586
17646
  const i = Ao(t);
@@ -17588,7 +17648,7 @@ function jb(s) {
17588
17648
  }
17589
17649
  return e;
17590
17650
  }
17591
- function Kb(s) {
17651
+ function jb(s) {
17592
17652
  const e = [];
17593
17653
  for (const t of s.tracks) {
17594
17654
  const i = Ao(t);
@@ -17598,8 +17658,8 @@ function Kb(s) {
17598
17658
  if ("title" in t)
17599
17659
  o = t.title || "", c = t.artist || "";
17600
17660
  else if ("metadata" in t) {
17601
- const u = ee.parseMetadata(t.metadata);
17602
- u && (o = ee.extractTitle(u) || "", c = ee.extractArtist(u) || "");
17661
+ const u = J.parseMetadata(t.metadata);
17662
+ u && (o = J.extractTitle(u) || "", c = J.extractArtist(u) || "");
17603
17663
  }
17604
17664
  const l = {
17605
17665
  title: o,
@@ -17675,7 +17735,7 @@ function Nt(s) {
17675
17735
  function qe(s, e, t = "") {
17676
17736
  return `${e.protocol || "https"}://${e.host}/${s}${t}`;
17677
17737
  }
17678
- function Yb(s, e = Mo, t = "") {
17738
+ function Kb(s, e = Mo, t = "") {
17679
17739
  return e.sort((i, n) => i.priority - n.priority).map((i) => qe(s, i, t));
17680
17740
  }
17681
17741
  async function kg() {
@@ -17933,12 +17993,12 @@ class Eg {
17933
17993
  // includes port if present
17934
17994
  protocol: g.protocol.replace(":", ""),
17935
17995
  priority: 0
17936
- }, y = Date.now(), v = await this.checkAndSetGateway(e, t, i, p, n), _ = Date.now() - y;
17996
+ }, y = Date.now(), v = await this.checkAndSetGateway(e, t, i, p, n), T = Date.now() - y;
17937
17997
  if (v) {
17938
- if (this.logger.info(`[gateway] Step 0 (original): ${v.kind}`, { host: p.host, ms: _, totalMs: Date.now() - r }), v.kind === "verified") return v.url;
17998
+ if (this.logger.info(`[gateway] Step 0 (original): ${v.kind}`, { host: p.host, ms: T, totalMs: Date.now() - r }), v.kind === "verified") return v.url;
17939
17999
  l ??= v.url;
17940
18000
  } else
17941
- this.logger.info("[gateway] Step 0 (original): failed", { host: p.host, ms: _ });
18001
+ this.logger.info("[gateway] Step 0 (original): failed", { host: p.host, ms: T });
17942
18002
  c = p.host;
17943
18003
  } catch {
17944
18004
  }
@@ -18103,14 +18163,14 @@ class Eg {
18103
18163
  if (n?.aborted || f.length === 0) return null;
18104
18164
  const g = new AbortController(), p = () => g.abort();
18105
18165
  n?.addEventListener("abort", p, { once: !0 });
18106
- let y = null, v = null, _ = !1;
18166
+ let y = null, v = null, T = !1;
18107
18167
  try {
18108
- const T = await Promise.allSettled(
18168
+ const _ = await Promise.allSettled(
18109
18169
  f.map(async (S) => {
18110
18170
  const I = await this.checkGateway(t, S, i, g.signal);
18111
18171
  if (!I) throw new Error(`Gateway ${S.host} failed check`);
18112
18172
  const D = qe(t, S, i), R = I === !0 ? "verified" : "maybe";
18113
- return _ || (_ = !0, R === "verified" ? (this.setActiveGateway(S, t), this.logger.info("Gateway resolved via fallback", {
18173
+ return T || (T = !0, R === "verified" ? (this.setActiveGateway(S, t), this.logger.info("Gateway resolved via fallback", {
18114
18174
  txId: t,
18115
18175
  gateway: S.host,
18116
18176
  pathSuffix: i,
@@ -18123,7 +18183,7 @@ class Eg {
18123
18183
  })), { kind: R, url: D };
18124
18184
  })
18125
18185
  );
18126
- for (const S of T) {
18186
+ for (const S of _) {
18127
18187
  if (S.status !== "fulfilled") continue;
18128
18188
  const I = S.value;
18129
18189
  if (I.kind === "verified" && !y ? y = { kind: "verified", url: I.url } : I.kind === "maybe" && !v && (v = { kind: "maybe", url: I.url }), y) break;
@@ -18758,12 +18818,12 @@ class Eg {
18758
18818
  const g = Date.now();
18759
18819
  let p = !1, y = this.timeout;
18760
18820
  try {
18761
- const v = qe(i, f), _ = new AbortController(), T = setTimeout(() => _.abort(), this.timeout), S = await fetch(v, {
18821
+ const v = qe(i, f), T = new AbortController(), _ = setTimeout(() => T.abort(), this.timeout), S = await fetch(v, {
18762
18822
  method: "HEAD",
18763
18823
  mode: "cors",
18764
- signal: _.signal
18824
+ signal: T.signal
18765
18825
  });
18766
- clearTimeout(T), y = Date.now() - g, p = S.ok || S.status >= 200 && S.status < 400;
18826
+ clearTimeout(_), y = Date.now() - g, p = S.ok || S.status >= 200 && S.status < 400;
18767
18827
  } catch {
18768
18828
  y = Date.now() - g, p = !1;
18769
18829
  }
@@ -18852,7 +18912,7 @@ function Rg(s) {
18852
18912
  }
18853
18913
  return null;
18854
18914
  }
18855
- function Zb(s) {
18915
+ function Yb(s) {
18856
18916
  if (!s || typeof s != "string") return !1;
18857
18917
  if (s.startsWith("ipfs://")) return !0;
18858
18918
  try {
@@ -18875,7 +18935,7 @@ function Pg(s) {
18875
18935
  return;
18876
18936
  }
18877
18937
  }
18878
- function Xb(s, e = {}) {
18938
+ function Zb(s, e = {}) {
18879
18939
  if (!s) return s;
18880
18940
  const t = typeof e == "string" ? { gatewayHost: e } : e, { gatewayHost: i = xg, preserveOriginalGateway: n = !1 } = t, a = Rg(s);
18881
18941
  if (a) {
@@ -18997,8 +19057,8 @@ function Bg() {
18997
19057
  var R;
18998
19058
  try {
18999
19059
  R = I(D);
19000
- } catch (q) {
19001
- return o.reject(S, q);
19060
+ } catch (U) {
19061
+ return o.reject(S, U);
19002
19062
  }
19003
19063
  R === S ? o.reject(S, new TypeError("Cannot resolve promise with itself")) : o.resolve(S, R);
19004
19064
  });
@@ -19012,8 +19072,8 @@ function Bg() {
19012
19072
  g(S, R);
19013
19073
  else {
19014
19074
  S.state = l, S.outcome = I;
19015
- for (var q = -1, O = S.queue.length; ++q < O; )
19016
- S.queue[q].callFulfilled(I);
19075
+ for (var U = -1, O = S.queue.length; ++U < O; )
19076
+ S.queue[U].callFulfilled(I);
19017
19077
  }
19018
19078
  return S;
19019
19079
  }, o.reject = function(S, I) {
@@ -19034,11 +19094,11 @@ function Bg() {
19034
19094
  function R(Z) {
19035
19095
  D || (D = !0, o.reject(S, Z));
19036
19096
  }
19037
- function q(Z) {
19097
+ function U(Z) {
19038
19098
  D || (D = !0, o.resolve(S, Z));
19039
19099
  }
19040
19100
  function O() {
19041
- I(q, R);
19101
+ I(U, R);
19042
19102
  }
19043
19103
  var W = p(O);
19044
19104
  W.status === "error" && R(W.value);
@@ -19061,42 +19121,42 @@ function Bg() {
19061
19121
  var I = new this(r);
19062
19122
  return o.reject(I, S);
19063
19123
  }
19064
- d.all = _;
19065
- function _(S) {
19124
+ d.all = T;
19125
+ function T(S) {
19066
19126
  var I = this;
19067
19127
  if (Object.prototype.toString.call(S) !== "[object Array]")
19068
19128
  return this.reject(new TypeError("must be an array"));
19069
19129
  var D = S.length, R = !1;
19070
19130
  if (!D)
19071
19131
  return this.resolve([]);
19072
- for (var q = new Array(D), O = 0, W = -1, Z = new this(r); ++W < D; )
19073
- Q(S[W], W);
19132
+ for (var U = new Array(D), O = 0, W = -1, Z = new this(r); ++W < D; )
19133
+ te(S[W], W);
19074
19134
  return Z;
19075
- function Q(se, oe) {
19135
+ function te(se, oe) {
19076
19136
  I.resolve(se).then(j, function(X) {
19077
19137
  R || (R = !0, o.reject(Z, X));
19078
19138
  });
19079
19139
  function j(X) {
19080
- q[oe] = X, ++O === D && !R && (R = !0, o.resolve(Z, q));
19140
+ U[oe] = X, ++O === D && !R && (R = !0, o.resolve(Z, U));
19081
19141
  }
19082
19142
  }
19083
19143
  }
19084
- d.race = T;
19085
- function T(S) {
19144
+ d.race = _;
19145
+ function _(S) {
19086
19146
  var I = this;
19087
19147
  if (Object.prototype.toString.call(S) !== "[object Array]")
19088
19148
  return this.reject(new TypeError("must be an array"));
19089
19149
  var D = S.length, R = !1;
19090
19150
  if (!D)
19091
19151
  return this.resolve([]);
19092
- for (var q = -1, O = new this(r); ++q < D; )
19093
- W(S[q]);
19152
+ for (var U = -1, O = new this(r); ++U < D; )
19153
+ W(S[U]);
19094
19154
  return O;
19095
19155
  function W(Z) {
19096
- I.resolve(Z).then(function(Q) {
19097
- R || (R = !0, o.resolve(O, Q));
19098
- }, function(Q) {
19099
- R || (R = !0, o.reject(O, Q));
19156
+ I.resolve(Z).then(function(te) {
19157
+ R || (R = !0, o.resolve(O, te));
19158
+ }, function(te) {
19159
+ R || (R = !0, o.reject(O, te));
19100
19160
  });
19101
19161
  }
19102
19162
  }
@@ -19176,7 +19236,7 @@ function Bg() {
19176
19236
  if (arguments.length && typeof arguments[arguments.length - 1] == "function")
19177
19237
  return arguments[arguments.length - 1];
19178
19238
  }
19179
- var p = "local-forage-detect-blob-support", y = void 0, v = {}, _ = Object.prototype.toString, T = "readonly", S = "readwrite";
19239
+ var p = "local-forage-detect-blob-support", y = void 0, v = {}, T = Object.prototype.toString, _ = "readonly", S = "readwrite";
19180
19240
  function I(b) {
19181
19241
  for (var C = b.length, w = new ArrayBuffer(C), A = new Uint8Array(w), M = 0; M < C; M++)
19182
19242
  A[M] = b.charCodeAt(M);
@@ -19200,7 +19260,7 @@ function Bg() {
19200
19260
  return y = C, y;
19201
19261
  });
19202
19262
  }
19203
- function q(b) {
19263
+ function U(b) {
19204
19264
  var C = v[b.name], w = {};
19205
19265
  w.promise = new d(function(A, M) {
19206
19266
  w.resolve = A, w.reject = M;
@@ -19222,7 +19282,7 @@ function Bg() {
19222
19282
  return new d(function(w, A) {
19223
19283
  if (v[b.name] = v[b.name] || le(), b.db)
19224
19284
  if (C)
19225
- q(b), b.db.close();
19285
+ U(b), b.db.close();
19226
19286
  else
19227
19287
  return w(b.db);
19228
19288
  var M = [b.name];
@@ -19248,7 +19308,7 @@ function Bg() {
19248
19308
  };
19249
19309
  });
19250
19310
  }
19251
- function Q(b) {
19311
+ function te(b) {
19252
19312
  return Z(b, !1);
19253
19313
  }
19254
19314
  function se(b) {
@@ -19296,12 +19356,12 @@ function Bg() {
19296
19356
  return m(w, b, b), w;
19297
19357
  }
19298
19358
  function Qt(b) {
19299
- q(b);
19359
+ U(b);
19300
19360
  for (var C = v[b.name], w = C.forages, A = 0; A < w.length; A++) {
19301
19361
  var M = w[A];
19302
19362
  M._dbInfo.db && (M._dbInfo.db.close(), M._dbInfo.db = null);
19303
19363
  }
19304
- return b.db = null, Q(b).then(function(k) {
19364
+ return b.db = null, te(b).then(function(k) {
19305
19365
  return b.db = k, oe(b) ? se(b) : k;
19306
19366
  }).then(function(k) {
19307
19367
  b.db = C.db = k;
@@ -19311,7 +19371,7 @@ function Bg() {
19311
19371
  throw W(b, k), k;
19312
19372
  });
19313
19373
  }
19314
- function J(b, C, w, A) {
19374
+ function Q(b, C, w, A) {
19315
19375
  A === void 0 && (A = 1);
19316
19376
  try {
19317
19377
  var M = b.db.transaction(b.storeName, C);
@@ -19323,7 +19383,7 @@ function Bg() {
19323
19383
  return b.db && (b.version = b.db.version + 1), se(b);
19324
19384
  }).then(function() {
19325
19385
  return Qt(b).then(function() {
19326
- J(b, C, w, A - 1);
19386
+ Q(b, C, w, A - 1);
19327
19387
  });
19328
19388
  }).catch(w);
19329
19389
  w(k);
@@ -19360,14 +19420,14 @@ function Bg() {
19360
19420
  }
19361
19421
  var N = M.forages.slice(0);
19362
19422
  return d.all(k).then(function() {
19363
- return w.db = M.db, Q(w);
19423
+ return w.db = M.db, te(w);
19364
19424
  }).then(function($) {
19365
19425
  return w.db = $, oe(w, C._defaultConfig.version) ? se(w) : $;
19366
19426
  }).then(function($) {
19367
19427
  w.db = M.db = $, C._dbInfo = w;
19368
19428
  for (var V = 0; V < N.length; V++) {
19369
- var te = N[V];
19370
- te !== C && (te._dbInfo.db = w.db, te._dbInfo.version = w.version);
19429
+ var ee = N[V];
19430
+ ee !== C && (ee._dbInfo.db = w.db, ee._dbInfo.version = w.version);
19371
19431
  }
19372
19432
  });
19373
19433
  }
@@ -19376,7 +19436,7 @@ function Bg() {
19376
19436
  b = f(b);
19377
19437
  var A = new d(function(M, k) {
19378
19438
  w.ready().then(function() {
19379
- J(w._dbInfo, T, function(x, P) {
19439
+ Q(w._dbInfo, _, function(x, P) {
19380
19440
  if (x)
19381
19441
  return k(x);
19382
19442
  try {
@@ -19398,7 +19458,7 @@ function Bg() {
19398
19458
  function _a(b, C) {
19399
19459
  var w = this, A = new d(function(M, k) {
19400
19460
  w.ready().then(function() {
19401
- J(w._dbInfo, T, function(x, P) {
19461
+ Q(w._dbInfo, _, function(x, P) {
19402
19462
  if (x)
19403
19463
  return k(x);
19404
19464
  try {
@@ -19406,9 +19466,9 @@ function Bg() {
19406
19466
  N.onsuccess = function() {
19407
19467
  var V = N.result;
19408
19468
  if (V) {
19409
- var te = V.value;
19410
- fe(te) && (te = X(te));
19411
- var ie = b(te, V.key, $++);
19469
+ var ee = V.value;
19470
+ fe(ee) && (ee = X(ee));
19471
+ var ie = b(ee, V.key, $++);
19412
19472
  ie !== void 0 ? M(ie) : V.continue();
19413
19473
  } else
19414
19474
  M();
@@ -19429,21 +19489,21 @@ function Bg() {
19429
19489
  var M = new d(function(k, x) {
19430
19490
  var P;
19431
19491
  A.ready().then(function() {
19432
- return P = A._dbInfo, _.call(C) === "[object Blob]" ? R(P.db).then(function(B) {
19492
+ return P = A._dbInfo, T.call(C) === "[object Blob]" ? R(P.db).then(function(B) {
19433
19493
  return B ? C : j(C);
19434
19494
  }) : C;
19435
19495
  }).then(function(B) {
19436
- J(A._dbInfo, S, function(N, $) {
19496
+ Q(A._dbInfo, S, function(N, $) {
19437
19497
  if (N)
19438
19498
  return x(N);
19439
19499
  try {
19440
19500
  var V = $.objectStore(A._dbInfo.storeName);
19441
19501
  B === null && (B = void 0);
19442
- var te = V.put(B, b);
19502
+ var ee = V.put(B, b);
19443
19503
  $.oncomplete = function() {
19444
19504
  B === void 0 && (B = null), k(B);
19445
19505
  }, $.onabort = $.onerror = function() {
19446
- var ie = te.error ? te.error : te.transaction.error;
19506
+ var ie = ee.error ? ee.error : ee.transaction.error;
19447
19507
  x(ie);
19448
19508
  };
19449
19509
  } catch (ie) {
@@ -19459,7 +19519,7 @@ function Bg() {
19459
19519
  b = f(b);
19460
19520
  var A = new d(function(M, k) {
19461
19521
  w.ready().then(function() {
19462
- J(w._dbInfo, S, function(x, P) {
19522
+ Q(w._dbInfo, S, function(x, P) {
19463
19523
  if (x)
19464
19524
  return k(x);
19465
19525
  try {
@@ -19483,7 +19543,7 @@ function Bg() {
19483
19543
  function _c(b) {
19484
19544
  var C = this, w = new d(function(A, M) {
19485
19545
  C.ready().then(function() {
19486
- J(C._dbInfo, S, function(k, x) {
19546
+ Q(C._dbInfo, S, function(k, x) {
19487
19547
  if (k)
19488
19548
  return M(k);
19489
19549
  try {
@@ -19505,7 +19565,7 @@ function Bg() {
19505
19565
  function Tc(b) {
19506
19566
  var C = this, w = new d(function(A, M) {
19507
19567
  C.ready().then(function() {
19508
- J(C._dbInfo, T, function(k, x) {
19568
+ Q(C._dbInfo, _, function(k, x) {
19509
19569
  if (k)
19510
19570
  return M(k);
19511
19571
  try {
@@ -19530,7 +19590,7 @@ function Bg() {
19530
19590
  return;
19531
19591
  }
19532
19592
  w.ready().then(function() {
19533
- J(w._dbInfo, T, function(x, P) {
19593
+ Q(w._dbInfo, _, function(x, P) {
19534
19594
  if (x)
19535
19595
  return k(x);
19536
19596
  try {
@@ -19556,7 +19616,7 @@ function Bg() {
19556
19616
  function kc(b) {
19557
19617
  var C = this, w = new d(function(A, M) {
19558
19618
  C.ready().then(function() {
19559
- J(C._dbInfo, T, function(k, x) {
19619
+ Q(C._dbInfo, _, function(k, x) {
19560
19620
  if (k)
19561
19621
  return M(k);
19562
19622
  try {
@@ -19587,7 +19647,7 @@ function Bg() {
19587
19647
  if (!b.name)
19588
19648
  M = d.reject("Invalid arguments");
19589
19649
  else {
19590
- var k = b.name === w.name && A._dbInfo.db, x = k ? d.resolve(A._dbInfo.db) : Q(b).then(function(P) {
19650
+ var k = b.name === w.name && A._dbInfo.db, x = k ? d.resolve(A._dbInfo.db) : te(b).then(function(P) {
19591
19651
  var B = v[b.name], N = B.forages;
19592
19652
  B.db = P;
19593
19653
  for (var $ = 0; $ < N.length; $++)
@@ -19597,12 +19657,12 @@ function Bg() {
19597
19657
  b.storeName ? M = x.then(function(P) {
19598
19658
  if (P.objectStoreNames.contains(b.storeName)) {
19599
19659
  var B = P.version + 1;
19600
- q(b);
19660
+ U(b);
19601
19661
  var N = v[b.name], $ = N.forages;
19602
19662
  P.close();
19603
19663
  for (var V = 0; V < $.length; V++) {
19604
- var te = $[V];
19605
- te._dbInfo.db = null, te._dbInfo.version = B;
19664
+ var ee = $[V];
19665
+ ee._dbInfo.db = null, ee._dbInfo.version = B;
19606
19666
  }
19607
19667
  var ie = new d(function(ne, ve) {
19608
19668
  var pe = c.open(b.name, B);
@@ -19629,14 +19689,14 @@ function Bg() {
19629
19689
  });
19630
19690
  }
19631
19691
  }) : M = x.then(function(P) {
19632
- q(b);
19692
+ U(b);
19633
19693
  var B = v[b.name], N = B.forages;
19634
19694
  P.close();
19635
19695
  for (var $ = 0; $ < N.length; $++) {
19636
19696
  var V = N[$];
19637
19697
  V._dbInfo.db = null;
19638
19698
  }
19639
- var te = new d(function(ie, ne) {
19699
+ var ee = new d(function(ie, ne) {
19640
19700
  var ve = c.deleteDatabase(b.name);
19641
19701
  ve.onerror = function() {
19642
19702
  var pe = ve.result;
@@ -19648,7 +19708,7 @@ function Bg() {
19648
19708
  pe && pe.close(), ie(pe);
19649
19709
  };
19650
19710
  });
19651
- return te.then(function(ie) {
19711
+ return ee.then(function(ie) {
19652
19712
  B.db = ie;
19653
19713
  for (var ne = 0; ne < N.length; ne++) {
19654
19714
  var ve = N[ne];
@@ -19813,9 +19873,9 @@ function Bg() {
19813
19873
  var x = w._dbInfo;
19814
19874
  x.db.transaction(function(P) {
19815
19875
  Je(P, x, "SELECT * FROM " + x.storeName, [], function(B, N) {
19816
- for (var $ = N.rows, V = $.length, te = 0; te < V; te++) {
19817
- var ie = $.item(te), ne = ie.value;
19818
- if (ne && (ne = x.serializer.deserialize(ne)), ne = b(ne, ie.key, te + 1), ne !== void 0) {
19876
+ for (var $ = N.rows, V = $.length, ee = 0; ee < V; ee++) {
19877
+ var ie = $.item(ee), ne = ie.value;
19878
+ if (ne && (ne = x.serializer.deserialize(ne)), ne = b(ne, ie.key, ee + 1), ne !== void 0) {
19819
19879
  M(ne);
19820
19880
  return;
19821
19881
  }
@@ -19837,19 +19897,19 @@ function Bg() {
19837
19897
  C === void 0 && (C = null);
19838
19898
  var B = C, N = M._dbInfo;
19839
19899
  N.serializer.serialize(C, function($, V) {
19840
- V ? P(V) : N.db.transaction(function(te) {
19841
- Je(te, N, "INSERT OR REPLACE INTO " + N.storeName + " (key, value) VALUES (?, ?)", [b, $], function() {
19900
+ V ? P(V) : N.db.transaction(function(ee) {
19901
+ Je(ee, N, "INSERT OR REPLACE INTO " + N.storeName + " (key, value) VALUES (?, ?)", [b, $], function() {
19842
19902
  x(B);
19843
19903
  }, function(ie, ne) {
19844
19904
  P(ne);
19845
19905
  });
19846
- }, function(te) {
19847
- if (te.code === te.QUOTA_ERR) {
19906
+ }, function(ee) {
19907
+ if (ee.code === ee.QUOTA_ERR) {
19848
19908
  if (A > 0) {
19849
19909
  x($a.apply(M, [b, B, w, A - 1]));
19850
19910
  return;
19851
19911
  }
19852
- P(te);
19912
+ P(ee);
19853
19913
  }
19854
19914
  });
19855
19915
  });
@@ -19982,7 +20042,7 @@ function Bg() {
19982
20042
  });
19983
20043
  });
19984
20044
  }
19985
- for (var $ = [], V = 0, te = k.storeNames.length; V < te; V++)
20045
+ for (var $ = [], V = 0, ee = k.storeNames.length; V < ee; V++)
19986
20046
  $.push(N(k.storeNames[V]));
19987
20047
  d.all($).then(function() {
19988
20048
  x();
@@ -20229,7 +20289,7 @@ function Bg() {
20229
20289
  P(N);
20230
20290
  return;
20231
20291
  }
20232
- for (var $ = Zi.concat("_initStorage"), V = 0, te = $.length; V < te; V++) {
20292
+ for (var $ = Zi.concat("_initStorage"), V = 0, ee = $.length; V < ee; V++) {
20233
20293
  var ie = $[V], ne = !sl(ti, ie);
20234
20294
  if ((ne || w[ie]) && typeof w[ie] != "function") {
20235
20295
  P(N);
@@ -20282,11 +20342,11 @@ function Bg() {
20282
20342
  }
20283
20343
  function N(V) {
20284
20344
  return function() {
20285
- var te = 0;
20345
+ var ee = 0;
20286
20346
  function ie() {
20287
- for (; te < V.length; ) {
20288
- var ne = V[te];
20289
- return te++, k._dbInfo = null, k._ready = null, k.getDriver(ne).then(B).catch(ie);
20347
+ for (; ee < V.length; ) {
20348
+ var ne = V[ee];
20349
+ return ee++, k._dbInfo = null, k._ready = null, k.getDriver(ne).then(B).catch(ie);
20290
20350
  }
20291
20351
  P();
20292
20352
  var ve = new Error("No available storage method found.");
@@ -20300,8 +20360,8 @@ function Bg() {
20300
20360
  }) : d.resolve();
20301
20361
  return this._driverSet = $.then(function() {
20302
20362
  var V = x[0];
20303
- return k._dbInfo = null, k._ready = null, k.getDriver(V).then(function(te) {
20304
- k._driver = te._driver, P(), k._wrapLibraryMethodsWithReady(), k._initDriver = N(x);
20363
+ return k._dbInfo = null, k._ready = null, k.getDriver(V).then(function(ee) {
20364
+ k._driver = ee._driver, P(), k._wrapLibraryMethodsWithReady(), k._initDriver = N(x);
20305
20365
  });
20306
20366
  }).catch(function() {
20307
20367
  P();
@@ -20561,7 +20621,7 @@ class zg {
20561
20621
  }
20562
20622
  }
20563
20623
  const Ht = new zg();
20564
- function Jb(s) {
20624
+ function Xb(s) {
20565
20625
  if (!s || !s.metadata) return null;
20566
20626
  if (typeof s.metadata == "string")
20567
20627
  try {
@@ -20679,7 +20739,7 @@ function Kg(s) {
20679
20739
  }
20680
20740
  return e;
20681
20741
  }
20682
- function Qb(s, e) {
20742
+ function Jb(s, e) {
20683
20743
  const t = [], i = /* @__PURE__ */ new Date();
20684
20744
  for (const n of s.mixes || []) {
20685
20745
  if (n.conditions.length === 0) {
@@ -22824,7 +22884,7 @@ const Js = [
22824
22884
  source: "default",
22825
22885
  description: "Covers influencing others through reason, charm, and good faith. Use this skill when you need to convince someone to see your point of view, negotiate favorable terms, get someone to do you a favor, or rally people to your cause. This skill works best when you're being honest."
22826
22886
  }
22827
- ], e0 = [
22887
+ ], Qb = [
22828
22888
  "physical",
22829
22889
  "exploration",
22830
22890
  "combat",
@@ -22987,10 +23047,10 @@ function lp() {
22987
23047
  function Lo() {
22988
23048
  lp() || Oo();
22989
23049
  }
22990
- function t0() {
23050
+ function e0() {
22991
23051
  Eo(), Ro(), Po(), No(), $o(), Oo(), zo(), Ho();
22992
23052
  }
22993
- function i0() {
23053
+ function t0() {
22994
23054
  xo(), Ln(), Bo(), Fo(), cp(), Lo(), Wo(), hp();
22995
23055
  }
22996
23056
  function zo() {
@@ -23385,8 +23445,8 @@ class pn {
23385
23445
  g = a;
23386
23446
  break;
23387
23447
  }
23388
- const p = f ? this.getSpicedValue(u, g, e) : g, y = f ? g : this.getSpicedValue(u, g, e), v = t.random(), _ = t.random();
23389
- o[h] = Math.floor(8 + v * l + p * c), o[m] = Math.floor(8 + _ * l + y * c);
23448
+ const p = f ? this.getSpicedValue(u, g, e) : g, y = f ? g : this.getSpicedValue(u, g, e), v = t.random(), T = t.random();
23449
+ o[h] = Math.floor(8 + v * l + p * c), o[m] = Math.floor(8 + T * l + y * c);
23390
23450
  }
23391
23451
  return o;
23392
23452
  }
@@ -23620,17 +23680,17 @@ class pp {
23620
23680
  */
23621
23681
  static generate(e, t, i) {
23622
23682
  xo();
23623
- const n = new Ve(e), a = Y.getInstance(), r = a.get("appearance.bodyTypes"), o = a.getWeights("appearance.bodyTypes"), c = a.getMode("appearance.bodyTypes") || "default", l = a.get("appearance.skinTones"), u = a.getWeights("appearance.skinTones"), d = a.getMode("appearance.skinTones") || "default", h = a.get("appearance.hairStyles"), m = a.getWeights("appearance.hairStyles"), f = a.getMode("appearance.hairStyles") || "default", g = a.get("appearance.hairColors"), p = a.getWeights("appearance.hairColors"), y = a.getMode("appearance.hairColors") || "default", v = a.get("appearance.eyeColors"), _ = a.getWeights("appearance.eyeColors"), T = a.getMode("appearance.eyeColors") || "default", S = a.get("appearance.facialFeatures"), I = a.getWeights("appearance.facialFeatures"), D = a.getMode("appearance.facialFeatures") || "default", R = Le.select(r, o, n, c), q = Le.select(l, u, n, d), O = Le.select(h, m, n, f), W = Le.select(g, p, n, y), Z = Le.select(v, _, n, T), Q = n.randomInt(1, 4), se = Le.selectMultiple(
23683
+ const n = new Ve(e), a = Y.getInstance(), r = a.get("appearance.bodyTypes"), o = a.getWeights("appearance.bodyTypes"), c = a.getMode("appearance.bodyTypes") || "default", l = a.get("appearance.skinTones"), u = a.getWeights("appearance.skinTones"), d = a.getMode("appearance.skinTones") || "default", h = a.get("appearance.hairStyles"), m = a.getWeights("appearance.hairStyles"), f = a.getMode("appearance.hairStyles") || "default", g = a.get("appearance.hairColors"), p = a.getWeights("appearance.hairColors"), y = a.getMode("appearance.hairColors") || "default", v = a.get("appearance.eyeColors"), T = a.getWeights("appearance.eyeColors"), _ = a.getMode("appearance.eyeColors") || "default", S = a.get("appearance.facialFeatures"), I = a.getWeights("appearance.facialFeatures"), D = a.getMode("appearance.facialFeatures") || "default", R = Le.select(r, o, n, c), U = Le.select(l, u, n, d), O = Le.select(h, m, n, f), W = Le.select(g, p, n, y), Z = Le.select(v, T, n, _), te = n.randomInt(1, 4), se = Le.selectMultiple(
23624
23684
  S,
23625
23685
  I,
23626
23686
  n,
23627
- Q,
23687
+ te,
23628
23688
  D
23629
23689
  ), oe = i.color_palette, j = oe?.primary_color, X = oe?.secondary_color, fe = oe?.accent_color;
23630
23690
  let ge;
23631
23691
  return gp.includes(t) && (ge = this.generateAuraColor(t, oe?.primary_color)), {
23632
23692
  body_type: R,
23633
- skin_tone: q,
23693
+ skin_tone: U,
23634
23694
  hair_style: O,
23635
23695
  hair_color: W,
23636
23696
  eye_color: Z,
@@ -25137,19 +25197,19 @@ class ua {
25137
25197
  if (n.forceRace)
25138
25198
  l = u, d = n.forceRace;
25139
25199
  else {
25140
- const J = c.getRaceForSubrace(u);
25141
- if (!J)
25200
+ const Q = c.getRaceForSubrace(u);
25201
+ if (!Q)
25142
25202
  throw new Error(
25143
25203
  `Cannot determine race for subrace "${u}". Either specify forceRace or ensure the subrace is registered in racial traits. Example: { forceRace: 'Elf', subrace: 'High Elf' }`
25144
25204
  );
25145
- d = J, l = u;
25205
+ d = Q, l = u;
25146
25206
  }
25147
25207
  const h = d || mp.select(a);
25148
25208
  if (l !== void 0 && u !== "pure") {
25149
- const J = c.getAvailableSubraces(h);
25150
- if (!J.includes(l))
25209
+ const Q = c.getAvailableSubraces(h);
25210
+ if (!Q.includes(l))
25151
25211
  throw new Error(
25152
- `Invalid subrace "${l}" for race "${h}". Available subraces: ${J.length > 0 ? J.join(", ") : "none"}`
25212
+ `Invalid subrace "${l}" for race "${h}". Available subraces: ${Q.length > 0 ? Q.join(", ") : "none"}`
25153
25213
  );
25154
25214
  } else if (l === void 0 && u === void 0) {
25155
25215
  const le = ["pure", ...c.getAvailableSubraces(h)], dt = a.randomChoice(le);
@@ -25164,14 +25224,14 @@ class ua {
25164
25224
  ), g = pn.calculateBaseScores(t, a), p = pn.applyRacialBonuses(g, h), y = pn.calculateModifiers(p), v = zr(m);
25165
25225
  if (!v)
25166
25226
  throw new Error(`Unknown class: ${m}. Cannot generate character.`);
25167
- const T = Xn(h)?.speed ?? 30, S = v.hit_die + y.CON, I = 10 + y.DEX, D = y.DEX, R = Wr[r], q = fp.assignSkills(m, a), O = {
25227
+ const _ = Xn(h)?.speed ?? 30, S = v.hit_die + y.CON, I = 10 + y.DEX, D = y.DEX, R = Wr[r], U = fp.assignSkills(m, a), O = {
25168
25228
  STR: v.saving_throws.includes("STR"),
25169
25229
  DEX: v.saving_throws.includes("DEX"),
25170
25230
  CON: v.saving_throws.includes("CON"),
25171
25231
  INT: v.saving_throws.includes("INT"),
25172
25232
  WIS: v.saving_throws.includes("WIS"),
25173
25233
  CHA: v.saving_throws.includes("CHA")
25174
- }, W = pp.generate(e, m, t), Z = c.getClassFeatures(m, r), Q = l ? c.getRacialTraitsForSubrace(h, l) : c.getBaseRacialTraits(h), se = Pi.initializeEquipment(m), oe = {
25234
+ }, W = pp.generate(e, m, t), Z = c.getClassFeatures(m, r), te = l ? c.getRacialTraitsForSubrace(h, l) : c.getBaseRacialTraits(h), se = Pi.initializeEquipment(m), oe = {
25175
25235
  name: f,
25176
25236
  race: h,
25177
25237
  subrace: l,
@@ -25184,8 +25244,8 @@ class ua {
25184
25244
  hp: { current: S, max: S, temp: 0 },
25185
25245
  armor_class: I,
25186
25246
  initiative: D,
25187
- speed: T,
25188
- skills: q,
25247
+ speed: _,
25248
+ skills: U,
25189
25249
  saving_throws: O,
25190
25250
  racial_traits: [],
25191
25251
  // Empty for now, will populate after validation
@@ -25204,14 +25264,14 @@ class ua {
25204
25264
  generated_at: (/* @__PURE__ */ new Date()).toISOString(),
25205
25265
  gameMode: o
25206
25266
  }, j = tr.initializeSpells(m, r, oe), X = [];
25207
- for (const J of Z) {
25208
- const le = c.validatePrerequisites(J, oe);
25209
- le.valid || console.warn(`Feature "${J.name}" (${J.id}) failed prerequisite validation:`, le.errors), X.push(J);
25267
+ for (const Q of Z) {
25268
+ const le = c.validatePrerequisites(Q, oe);
25269
+ le.valid || console.warn(`Feature "${Q.name}" (${Q.id}) failed prerequisite validation:`, le.errors), X.push(Q);
25210
25270
  }
25211
25271
  const fe = [];
25212
- for (const J of Q) {
25213
- const le = c.validatePrerequisites(J, oe);
25214
- le.valid || console.warn(`Trait "${J.name}" (${J.id}) failed prerequisite validation:`, le.errors), fe.push(J);
25272
+ for (const Q of te) {
25273
+ const le = c.validatePrerequisites(Q, oe);
25274
+ le.valid || console.warn(`Trait "${Q.name}" (${Q.id}) failed prerequisite validation:`, le.errors), fe.push(Q);
25215
25275
  }
25216
25276
  const ge = {
25217
25277
  name: f,
@@ -25230,11 +25290,11 @@ class ua {
25230
25290
  },
25231
25291
  armor_class: I,
25232
25292
  initiative: D,
25233
- speed: T,
25234
- skills: q,
25293
+ speed: _,
25294
+ skills: U,
25235
25295
  saving_throws: O,
25236
- racial_traits: fe.map((J) => J.id),
25237
- class_features: X.map((J) => J.id),
25296
+ racial_traits: fe.map((Q) => Q.id),
25297
+ class_features: X.map((Q) => Q.id),
25238
25298
  appearance: W,
25239
25299
  spells: j,
25240
25300
  equipment: se,
@@ -25247,12 +25307,12 @@ class ua {
25247
25307
  gameMode: o
25248
25308
  };
25249
25309
  if (Bi.applyMultipleEffects(ge, fe), Bi.applyMultipleEffects(ge, X), se) {
25250
- const J = [
25310
+ const Q = [
25251
25311
  ...se.weapons.filter((le) => le.equipped),
25252
25312
  ...se.armor.filter((le) => le.equipped),
25253
25313
  ...se.items.filter((le) => le.equipped)
25254
25314
  ];
25255
- for (const le of J) {
25315
+ for (const le of Q) {
25256
25316
  const dt = Pi.getEquipmentDataStatic(le.name);
25257
25317
  if (dt) {
25258
25318
  const Gi = le.instanceId;
@@ -25376,8 +25436,8 @@ function _p(s) {
25376
25436
  for (let f = 0; f < r / 2; f++) {
25377
25437
  const g = d + f, p = d + f + r / 2, y = i[p] * h - n[p] * m, v = i[p] * m + n[p] * h;
25378
25438
  i[p] = i[g] - y, n[p] = n[g] - v, i[g] += y, n[g] += v;
25379
- const _ = h * l - m * u;
25380
- m = h * u + m * l, h = _;
25439
+ const T = h * l - m * u;
25440
+ m = h * u + m * l, h = T;
25381
25441
  }
25382
25442
  }
25383
25443
  r *= 2;
@@ -25526,22 +25586,22 @@ class Ip {
25526
25586
  */
25527
25587
  analyzeBand(e, t, i, n, a, r, o) {
25528
25588
  const c = Ap(e, t.name, i), l = Go(c, n, a, i), u = l.numFrames, d = new Float32Array(u);
25529
- for (let T = 0; T < u; T++) {
25530
- const S = l.frames[T];
25589
+ for (let _ = 0; _ < u; _++) {
25590
+ const S = l.frames[_];
25531
25591
  let I = 0;
25532
25592
  for (let D = 0; D < S.length; D++)
25533
25593
  I += S[D] * S[D];
25534
- d[T] = Math.sqrt(I / S.length);
25594
+ d[_] = Math.sqrt(I / S.length);
25535
25595
  }
25536
25596
  const h = Math.max(...d);
25537
25597
  if (h > 0)
25538
- for (let T = 0; T < d.length; T++)
25539
- d[T] /= h;
25598
+ for (let _ = 0; _ < d.length; _++)
25599
+ d[_] /= h;
25540
25600
  const m = h, f = this.calculateOnsetEnvelope(l.frames), g = qo(f, this.config.smoothWindowMs, o), p = Math.max(...g), y = new Float32Array(g.length);
25541
25601
  if (p > 0)
25542
- for (let T = 0; T < g.length; T++)
25543
- y[T] = g[T] / p;
25544
- const v = this.findPeaks(y, this.config.peakThreshold), _ = v.map((T) => T * r);
25602
+ for (let _ = 0; _ < g.length; _++)
25603
+ y[_] = g[_] / p;
25604
+ const v = this.findPeaks(y, this.config.peakThreshold), T = v.map((_) => _ * r);
25545
25605
  return {
25546
25606
  name: t.name,
25547
25607
  frequencyRange: {
@@ -25550,7 +25610,7 @@ class Ip {
25550
25610
  },
25551
25611
  envelope: y,
25552
25612
  peaks: v,
25553
- peakTimes: _,
25613
+ peakTimes: T,
25554
25614
  energy: m,
25555
25615
  energyOverTime: d
25556
25616
  };
@@ -26717,8 +26777,8 @@ class Fp {
26717
26777
  analyzeBand(e, t, i, n) {
26718
26778
  const a = e.beats, o = (a.length > 0 ? Math.max(...a.map((v) => v.beatIndex)) : 0) + 1, c = /* @__PURE__ */ new Map();
26719
26779
  for (const v of a) {
26720
- const _ = c.get(v.beatIndex);
26721
- _ ? (_.count++, _.intensities.push(v.intensity)) : c.set(v.beatIndex, {
26780
+ const T = c.get(v.beatIndex);
26781
+ T ? (T.count++, T.intensities.push(v.intensity)) : c.set(v.beatIndex, {
26722
26782
  count: 1,
26723
26783
  intensities: [v.intensity]
26724
26784
  });
@@ -26726,13 +26786,13 @@ class Fp {
26726
26786
  const l = [];
26727
26787
  let u = 0;
26728
26788
  for (let v = 0; v < o; v++) {
26729
- const _ = c.get(v), T = _?.count ?? 0, S = _ ? _.intensities.reduce((I, D) => I + D, 0) / _.intensities.length : 0;
26789
+ const T = c.get(v), _ = T?.count ?? 0, S = T ? T.intensities.reduce((I, D) => I + D, 0) / T.intensities.length : 0;
26730
26790
  l.push({
26731
26791
  beatIndex: v,
26732
- transientCount: T,
26733
- bands: T > 0 ? [t] : [],
26792
+ transientCount: _,
26793
+ bands: _ > 0 ? [t] : [],
26734
26794
  averageIntensity: S
26735
- }), u += T;
26795
+ }), u += _;
26736
26796
  }
26737
26797
  const d = l.map((v) => v.transientCount);
26738
26798
  let h;
@@ -26825,7 +26885,7 @@ class Fp {
26825
26885
  calculateSectionMetrics(e, t, i) {
26826
26886
  const n = [], a = this.config.beatsPerSection, r = e.length;
26827
26887
  for (let o = 0; o < r; o += a) {
26828
- const c = Math.min(o + a - 1, r - 1), l = e.slice(o, c + 1), u = l.reduce((v, _) => v + _.transientCount, 0), d = l.length, h = d > 0 ? u / d * t : 0, m = l.map((v) => v.transientCount), f = m.length > 0 ? Math.min(...m) * t : 0, g = m.length > 0 ? Math.max(...m) * t : 0, p = this.categorizeDensity(h), y = this.determineNaturalDifficulty(p);
26888
+ const c = Math.min(o + a - 1, r - 1), l = e.slice(o, c + 1), u = l.reduce((v, T) => v + T.transientCount, 0), d = l.length, h = d > 0 ? u / d * t : 0, m = l.map((v) => v.transientCount), f = m.length > 0 ? Math.min(...m) * t : 0, g = m.length > 0 ? Math.max(...m) * t : 0, p = this.categorizeDensity(h), y = this.determineNaturalDifficulty(p);
26829
26889
  n.push({
26830
26890
  startBeat: o,
26831
26891
  endBeat: c,
@@ -26924,7 +26984,7 @@ const Yo = {
26924
26984
  densityWeight: 0.2
26925
26985
  }
26926
26986
  };
26927
- function n0(s) {
26987
+ function i0(s) {
26928
26988
  const e = Op[s];
26929
26989
  return {
26930
26990
  ...Yo,
@@ -27152,15 +27212,15 @@ class qp {
27152
27212
  generate(e, t, i, n) {
27153
27213
  const a = t.sectionWinners, r = { low: 0, mid: 0, high: 0 }, o = { low: 0, mid: 0, high: 0 }, l = a.filter((y) => {
27154
27214
  const v = ["low", "mid", "high"];
27155
- let _ = !1;
27156
- for (const T of v)
27157
- if (e.streams[T].beats.filter(
27215
+ let T = !1;
27216
+ for (const _ of v)
27217
+ if (e.streams[_].beats.filter(
27158
27218
  (D) => D.beatIndex >= y.beatRange.start && D.beatIndex <= y.beatRange.end
27159
27219
  ).length > 0) {
27160
- _ = !0;
27220
+ T = !0;
27161
27221
  break;
27162
27222
  }
27163
- return _;
27223
+ return T;
27164
27224
  }).map((y) => ({
27165
27225
  beatRange: y.beatRange,
27166
27226
  sourceBand: y.winner,
@@ -27171,12 +27231,12 @@ class qp {
27171
27231
  o[y.sourceBand]++;
27172
27232
  const u = [];
27173
27233
  for (const y of l) {
27174
- const v = e.streams[y.sourceBand], _ = this.extractSectionBeats(
27234
+ const v = e.streams[y.sourceBand], T = this.extractSectionBeats(
27175
27235
  v,
27176
27236
  y.beatRange,
27177
27237
  y.sourceBand
27178
27238
  );
27179
- u.push(..._), r[y.sourceBand] += _.length;
27239
+ u.push(...T), r[y.sourceBand] += T.length;
27180
27240
  }
27181
27241
  u.sort((y, v) => y.timestamp - v.timestamp);
27182
27242
  const d = this.deduplicateBeats(u), h = e.streams.low.quarterNoteInterval, m = 60 / h, f = this.determineNaturalDifficulty(
@@ -27282,7 +27342,7 @@ const da = {
27282
27342
  marginSeconds: 0.5
27283
27343
  }
27284
27344
  };
27285
- function a0(s) {
27345
+ function n0(s) {
27286
27346
  return { ...Gp[s] };
27287
27347
  }
27288
27348
  function Up(s) {
@@ -27527,7 +27587,7 @@ class Zp {
27527
27587
  return e.filter((r) => r.timestamp < n || r.timestamp > a ? (i.marginRemovals++, !1) : !0);
27528
27588
  }
27529
27589
  }
27530
- const s0 = [
27590
+ const a0 = [
27531
27591
  "straight_16th",
27532
27592
  "triplet_8th",
27533
27593
  "straight_8th",
@@ -27668,10 +27728,10 @@ const ny = {
27668
27728
  seed: void 0,
27669
27729
  rhythmicBalanceConfig: void 0
27670
27730
  };
27671
- function r0(s, e, t) {
27731
+ function s0(s, e, t) {
27672
27732
  return t !== void 0 ? at(e, t).includes(s) : Ge[e].allowedGridTypes.includes(s);
27673
27733
  }
27674
- function o0(s, e) {
27734
+ function r0(s, e) {
27675
27735
  return e !== void 0 ? at(s, e) : [...Ge[s].allowedGridTypes];
27676
27736
  }
27677
27737
  function Gn(s, e, t, i) {
@@ -27689,7 +27749,7 @@ function Gn(s, e, t, i) {
27689
27749
  return s;
27690
27750
  }
27691
27751
  }
27692
- function c0(s) {
27752
+ function o0(s) {
27693
27753
  return s;
27694
27754
  }
27695
27755
  function ay(s, e, t) {
@@ -27909,12 +27969,12 @@ class Un {
27909
27969
  m,
27910
27970
  c,
27911
27971
  u
27912
- ), _ = this.enforceSingleGridPerBeat(v.beats), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
27972
+ ), T = this.enforceSingleGridPerBeat(v.beats), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
27913
27973
  return {
27914
27974
  difficulty: "custom",
27915
- beats: _,
27975
+ beats: T,
27916
27976
  isUnedited: !1,
27917
- editType: T,
27977
+ editType: _,
27918
27978
  editAmount: v.metadata.totalBeatsBefore > 0 ? (v.metadata.totalBeatsAfter - v.metadata.totalBeatsBefore) / v.metadata.totalBeatsBefore : 0,
27919
27979
  patternsInserted: v.metadata.insertedPatternIds.length > 0 ? v.metadata.insertedPatternIds : void 0,
27920
27980
  enhancementMetadata: v.metadata
@@ -27924,7 +27984,7 @@ class Un {
27924
27984
  this.config.logConversions && console.log(
27925
27985
  `[DifficultyVariantGenerator] Density approximately equal (${f.toFixed(2)} ≈ ${u.toFixed(2)}), but grid restrictions needed`
27926
27986
  );
27927
- const _ = this.simplifyBeats(
27987
+ const T = this.simplifyBeats(
27928
27988
  h,
27929
27989
  "custom",
27930
27990
  e.quarterNoteInterval,
@@ -27938,11 +27998,11 @@ class Un {
27938
27998
  );
27939
27999
  return {
27940
28000
  difficulty: "custom",
27941
- beats: this.enforceSingleGridPerBeat(_.beats),
27942
- isUnedited: _.metadata.beatsRemoved === 0 && !d,
27943
- editType: _.metadata.beatsRemoved > 0 ? "simplified" : "none",
27944
- editAmount: _.metadata.totalBeatsBefore > 0 ? (_.metadata.totalBeatsBefore - _.metadata.totalBeatsAfter) / _.metadata.totalBeatsBefore : 0,
27945
- conversionMetadata: _.metadata,
28001
+ beats: this.enforceSingleGridPerBeat(T.beats),
28002
+ isUnedited: T.metadata.beatsRemoved === 0 && !d,
28003
+ editType: T.metadata.beatsRemoved > 0 ? "simplified" : "none",
28004
+ editAmount: T.metadata.totalBeatsBefore > 0 ? (T.metadata.totalBeatsBefore - T.metadata.totalBeatsAfter) / T.metadata.totalBeatsBefore : 0,
28005
+ conversionMetadata: T.metadata,
27946
28006
  densityClamped: d
27947
28007
  };
27948
28008
  }
@@ -28121,12 +28181,12 @@ class Un {
28121
28181
  r,
28122
28182
  e.quarterNoteInterval,
28123
28183
  h
28124
- ), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28184
+ ), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28125
28185
  return {
28126
28186
  difficulty: t,
28127
28187
  beats: v.beats,
28128
28188
  isUnedited: !1,
28129
- editType: _,
28189
+ editType: T,
28130
28190
  editAmount: v.metadata.totalBeatsBefore > 0 ? (v.metadata.totalBeatsAfter - v.metadata.totalBeatsBefore) / v.metadata.totalBeatsBefore : 0,
28131
28191
  enhancementMetadata: v.metadata
28132
28192
  };
@@ -28184,12 +28244,12 @@ class Un {
28184
28244
  r,
28185
28245
  e.quarterNoteInterval,
28186
28246
  h
28187
- ), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28247
+ ), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28188
28248
  return {
28189
28249
  difficulty: t,
28190
28250
  beats: v.beats,
28191
28251
  isUnedited: !1,
28192
- editType: _,
28252
+ editType: T,
28193
28253
  editAmount: 1,
28194
28254
  conversionMetadata: p.metadata,
28195
28255
  enhancementMetadata: v.metadata
@@ -28216,16 +28276,16 @@ class Un {
28216
28276
  h
28217
28277
  );
28218
28278
  let p = g.beats;
28219
- if (p.some((_) => !u.includes(_.gridType))) {
28220
- const _ = [];
28221
- for (const T of p)
28222
- if (u.includes(T.gridType))
28223
- _.push(T);
28279
+ if (p.some((T) => !u.includes(T.gridType))) {
28280
+ const T = [];
28281
+ for (const _ of p)
28282
+ if (u.includes(_.gridType))
28283
+ T.push(_);
28224
28284
  else {
28225
- const S = this.convertBeatGridType(T, t, e.quarterNoteInterval, c);
28226
- S && _.push(S);
28285
+ const S = this.convertBeatGridType(_, t, e.quarterNoteInterval, c);
28286
+ S && T.push(S);
28227
28287
  }
28228
- p = this.deduplicateConvertedBeats(_);
28288
+ p = this.deduplicateConvertedBeats(T);
28229
28289
  }
28230
28290
  const v = g.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28231
28291
  return {
@@ -28280,7 +28340,7 @@ class Un {
28280
28340
  d.totalBeatsBefore = m.length;
28281
28341
  const f = l ?? at(t, r);
28282
28342
  if (m.every((R) => f.includes(R.gridType)) && !n) {
28283
- const R = u !== void 0 ? Math.round(u * c) : this.calculateBeatCountTarget(m.length, c, t).targetCount, q = this.reduceDensityToTarget(
28343
+ const R = u !== void 0 ? Math.round(u * c) : this.calculateBeatCountTarget(m.length, c, t).targetCount, U = this.reduceDensityToTarget(
28284
28344
  m,
28285
28345
  t,
28286
28346
  d,
@@ -28289,7 +28349,7 @@ class Un {
28289
28349
  R,
28290
28350
  c
28291
28351
  );
28292
- return d.totalBeatsAfter = q.length, { beats: q, metadata: d };
28352
+ return d.totalBeatsAfter = U.length, { beats: U, metadata: d };
28293
28353
  }
28294
28354
  let p = m;
28295
28355
  n && (p = this.filterBeatsForHeavySimplification(m, d, h));
@@ -28299,7 +28359,7 @@ class Un {
28299
28359
  y.push(R);
28300
28360
  continue;
28301
28361
  }
28302
- const q = o?.get(R.beatIndex), O = this.convertBeatGridType(R, t, i, r, q, f);
28362
+ const U = o?.get(R.beatIndex), O = this.convertBeatGridType(R, t, i, r, U, f);
28303
28363
  if (O)
28304
28364
  if (y.push(O), R.gridType === "straight_16th") {
28305
28365
  if (d.sixteenthToEighth++, this.config.logConversions) {
@@ -28320,10 +28380,10 @@ class Un {
28320
28380
  }
28321
28381
  const v = this.deduplicateConvertedBeats(y);
28322
28382
  d.beatsRemoved += y.length - v.length;
28323
- const _ = y.length - v.length, T = this.calculateDensity(v, c), S = u !== void 0 ? Math.round(u * c) : this.calculateBeatCountTarget(v.length, c, t).targetCount, I = u ?? this.calculateBeatCountTarget(v.length, c, t).targetDensity;
28383
+ const T = y.length - v.length, _ = this.calculateDensity(v, c), S = u !== void 0 ? Math.round(u * c) : this.calculateBeatCountTarget(v.length, c, t).targetCount, I = u ?? this.calculateBeatCountTarget(v.length, c, t).targetDensity;
28324
28384
  if (v.length <= S)
28325
28385
  return this.config.logConversions && console.log(
28326
- `[DifficultyVariantGenerator] Grid conversion achieved target density: ${T.toFixed(2)} notes/sec (target midpoint ${I.toFixed(2)} nps, ${S} beats) for ${t}` + (_ > 0 ? ` (${_} beats collapsed)` : "")
28386
+ `[DifficultyVariantGenerator] Grid conversion achieved target density: ${_.toFixed(2)} notes/sec (target midpoint ${I.toFixed(2)} nps, ${S} beats) for ${t}` + (T > 0 ? ` (${T} beats collapsed)` : "")
28327
28387
  ), d.totalBeatsAfter = v.length, { beats: v, metadata: d };
28328
28388
  const D = this.reduceDensityToTarget(
28329
28389
  v,
@@ -28590,7 +28650,7 @@ class Un {
28590
28650
  }
28591
28651
  }
28592
28652
  d.sort((m, f) => {
28593
- const g = o.get(m) ?? 0, p = o.get(f) ?? 0, y = l(m), v = l(f), _ = y - g, S = v - p - _;
28653
+ const g = o.get(m) ?? 0, p = o.get(f) ?? 0, y = l(m), v = l(f), T = y - g, S = v - p - T;
28594
28654
  if (S !== 0) return S;
28595
28655
  const I = ht(Tt(a, `partial:${m}`)), D = ht(Tt(a, `partial:${f}`));
28596
28656
  return I - D;
@@ -28668,21 +28728,21 @@ class Un {
28668
28728
  this.config.logConversions && console.log(
28669
28729
  `[DifficultyVariantGenerator] Reducing density from ${l.toFixed(2)} notes/sec to target max ${c.max} notes/sec for ${t}`
28670
28730
  );
28671
- const u = this.buildDownbeatCountMap(e), d = e.map((T) => ({
28672
- beat: T,
28673
- priority: this.calculateRemovalPriority(T, n, u)
28731
+ const u = this.buildDownbeatCountMap(e), d = e.map((_) => ({
28732
+ beat: _,
28733
+ priority: this.calculateRemovalPriority(_, n, u)
28674
28734
  }));
28675
- d.sort((T, S) => T.priority - S.priority);
28735
+ d.sort((_, S) => _.priority - S.priority);
28676
28736
  const h = /* @__PURE__ */ new Set();
28677
28737
  let m = e.length;
28678
28738
  const f = this.config.maxReductionPasses;
28679
28739
  let g = 0;
28680
- for (let T = 1; T <= f; T++) {
28681
- g = T;
28740
+ for (let _ = 1; _ <= f; _++) {
28741
+ g = _;
28682
28742
  let S = 0;
28683
- const I = T === f;
28684
- let D, R, q = !1;
28685
- T === 1 ? (D = 1 - this.config.densityReductionMinIntensity, R = this.config.moderateSimplificationIntensityThreshold) : T === 2 ? (D = 1 - this.config.densityReductionMinIntensity - 0.15, R = this.config.moderateSimplificationIntensityThreshold - 0.1) : (q = !0, D = 0, R = 0);
28743
+ const I = _ === f;
28744
+ let D, R, U = !1;
28745
+ _ === 1 ? (D = 1 - this.config.densityReductionMinIntensity, R = this.config.moderateSimplificationIntensityThreshold) : _ === 2 ? (D = 1 - this.config.densityReductionMinIntensity - 0.15, R = this.config.moderateSimplificationIntensityThreshold - 0.1) : (U = !0, D = 0, R = 0);
28686
28746
  for (const { beat: O, priority: W } of d)
28687
28747
  if (!h.has(O)) {
28688
28748
  if (r !== void 0) {
@@ -28690,17 +28750,17 @@ class Un {
28690
28750
  break;
28691
28751
  } else if ((m - 1) / o <= c.max)
28692
28752
  break;
28693
- if (q) {
28753
+ if (U) {
28694
28754
  if (this.isStrongBeat(O.beatIndex))
28695
28755
  continue;
28696
28756
  } else if (W >= D || O.intensity >= R)
28697
28757
  continue;
28698
28758
  h.add(O), m--, S++, this.config.logConversions && console.log(
28699
- `[DifficultyVariantGenerator] Pass ${T}: Removed beat at index ${O.beatIndex} position ${O.gridPosition} (priority: ${W.toFixed(2)}, intensity: ${O.intensity.toFixed(2)})`
28759
+ `[DifficultyVariantGenerator] Pass ${_}: Removed beat at index ${O.beatIndex} position ${O.gridPosition} (priority: ${W.toFixed(2)}, intensity: ${O.intensity.toFixed(2)})`
28700
28760
  );
28701
28761
  }
28702
28762
  if (this.config.logConversions && console.log(
28703
- `[DifficultyVariantGenerator] Pass ${T}${I ? " (final)" : ""}: Removed ${S} beats, density now: ${(m / o).toFixed(2)} notes/sec`
28763
+ `[DifficultyVariantGenerator] Pass ${_}${I ? " (final)" : ""}: Removed ${S} beats, density now: ${(m / o).toFixed(2)} notes/sec`
28704
28764
  ), r !== void 0) {
28705
28765
  if (m <= r)
28706
28766
  break;
@@ -28709,18 +28769,18 @@ class Un {
28709
28769
  }
28710
28770
  const p = m / o;
28711
28771
  if ((r !== void 0 ? m > r : p > c.max) && this.config.logConversions) {
28712
- const T = r !== void 0 ? `${r} beats (midpoint ${(r / o).toFixed(2)} nps)` : `${c.max} notes/sec`;
28772
+ const _ = r !== void 0 ? `${r} beats (midpoint ${(r / o).toFixed(2)} nps)` : `${c.max} notes/sec`;
28713
28773
  console.warn(
28714
- `[DifficultyVariantGenerator] Could not reach target density ${T} for ${t} after ${f} passes. Final density: ${p.toFixed(2)} notes/sec (${m} beats remaining)`
28774
+ `[DifficultyVariantGenerator] Could not reach target density ${_} for ${t} after ${f} passes. Final density: ${p.toFixed(2)} notes/sec (${m} beats remaining)`
28715
28775
  );
28716
28776
  }
28717
- const v = e.filter((T) => !h.has(T));
28777
+ const v = e.filter((_) => !h.has(_));
28718
28778
  i.reductionPasses = g, i.beatsRemoved += h.size;
28719
- const _ = Math.ceil(c.min * o);
28720
- if (v.length < _ && e.length > 0) {
28721
- const T = d.filter(({ beat: S }) => h.has(S)).sort((S, I) => I.priority - S.priority);
28722
- for (const { beat: S } of T) {
28723
- if (v.length >= _) break;
28779
+ const T = Math.ceil(c.min * o);
28780
+ if (v.length < T && e.length > 0) {
28781
+ const _ = d.filter(({ beat: S }) => h.has(S)).sort((S, I) => I.priority - S.priority);
28782
+ for (const { beat: S } of _) {
28783
+ if (v.length >= T) break;
28724
28784
  v.push(S), i.beatsRemoved--;
28725
28785
  }
28726
28786
  }
@@ -28932,8 +28992,8 @@ class Un {
28932
28992
  if (l) {
28933
28993
  if (l.includes(O)) return O;
28934
28994
  const W = ["straight_16th", "triplet_8th", "straight_8th", "quarter_triplet", "straight_4th"], Z = W.indexOf(O);
28935
- for (let Q = Z + 1; Q < W.length; Q++)
28936
- if (l.includes(W[Q])) return W[Q];
28995
+ for (let te = Z + 1; te < W.length; te++)
28996
+ if (l.includes(W[te])) return W[te];
28937
28997
  return l[l.length - 1] ?? O;
28938
28998
  }
28939
28999
  return Gn(O, t, i);
@@ -28943,12 +29003,12 @@ class Un {
28943
29003
  let f = c ? e : this.enforceSingleGridPerBeat(e);
28944
29004
  if (l && f.some((W) => !l.includes(W.gridType))) {
28945
29005
  const W = [];
28946
- for (const Q of f)
28947
- if (l.includes(Q.gridType))
28948
- W.push(Q);
29006
+ for (const te of f)
29007
+ if (l.includes(te.gridType))
29008
+ W.push(te);
28949
29009
  else {
28950
29010
  const se = this.convertBeatGridType(
28951
- Q,
29011
+ te,
28952
29012
  t,
28953
29013
  o,
28954
29014
  i,
@@ -28975,7 +29035,7 @@ class Un {
28975
29035
  i,
28976
29036
  t
28977
29037
  ).beatsToAdd;
28978
- const v = this.config.seed ?? `enhance:${p}:${f.length}`, _ = this.distributeBeatsAcrossIndices(
29038
+ const v = this.config.seed ?? `enhance:${p}:${f.length}`, T = this.distributeBeatsAcrossIndices(
28979
29039
  y,
28980
29040
  g,
28981
29041
  c ?? /* @__PURE__ */ new Map(),
@@ -28983,22 +29043,22 @@ class Un {
28983
29043
  v,
28984
29044
  l
28985
29045
  // Pass through for max beats per index calculation
28986
- ), T = [], S = /* @__PURE__ */ new Map(), I = (O, W) => `${O}:${W}`;
29046
+ ), _ = [], S = /* @__PURE__ */ new Map(), I = (O, W) => `${O}:${W}`;
28987
29047
  for (const O of f) {
28988
29048
  const W = I(O.beatIndex, O.gridPosition);
28989
29049
  S.has(W) || S.set(W, O.gridType);
28990
29050
  }
28991
29051
  for (let O = 0; O <= p; O++) {
28992
- const W = g.get(O) ?? [], Z = _.get(O) ?? 0;
29052
+ const W = g.get(O) ?? [], Z = T.get(O) ?? 0;
28993
29053
  if (W.length >= Z) {
28994
- T.push(...W);
29054
+ _.push(...W);
28995
29055
  continue;
28996
29056
  }
28997
- const Q = Z - W.length;
29057
+ const te = Z - W.length;
28998
29058
  if (W.length === 0) {
28999
29059
  const X = c?.get(O), fe = X ? m(X) : void 0, ge = this.createBeatsForEmptyIndex(
29000
29060
  O,
29001
- Q,
29061
+ te,
29002
29062
  n,
29003
29063
  r,
29004
29064
  o,
@@ -29006,9 +29066,9 @@ class Un {
29006
29066
  S,
29007
29067
  fe
29008
29068
  ), Qt = fe ?? this.getGridForBeatIndex(O, ge, r);
29009
- for (const J of ge) {
29010
- const le = I(J.beatIndex, J.gridPosition);
29011
- !S.has(le) && J.gridType === Qt && (S.set(le, J.gridType), T.push(J), h.interpolatedBeats++);
29069
+ for (const Q of ge) {
29070
+ const le = I(Q.beatIndex, Q.gridPosition);
29071
+ !S.has(le) && Q.gridType === Qt && (S.set(le, Q.gridType), _.push(Q), h.interpolatedBeats++);
29012
29072
  }
29013
29073
  continue;
29014
29074
  }
@@ -29018,18 +29078,18 @@ class Un {
29018
29078
  const X = this.tryInsertPattern(
29019
29079
  W,
29020
29080
  O,
29021
- Q,
29081
+ te,
29022
29082
  a,
29023
29083
  S,
29024
29084
  oe
29025
29085
  );
29026
29086
  j = X.beatsAdded, X.patternId && (h.patternsInserted++, h.insertedPatternIds.push(X.patternId));
29027
29087
  }
29028
- if (j < Q) {
29088
+ if (j < te) {
29029
29089
  const X = this.interpolateBeats(
29030
29090
  W,
29031
29091
  O,
29032
- Q - j,
29092
+ te - j,
29033
29093
  o,
29034
29094
  S,
29035
29095
  oe,
@@ -29037,18 +29097,18 @@ class Un {
29037
29097
  );
29038
29098
  for (const fe of X) {
29039
29099
  const ge = I(fe.beatIndex, fe.gridPosition);
29040
- S.has(ge) || (S.set(ge, fe.gridType), T.push(fe), h.interpolatedBeats++);
29100
+ S.has(ge) || (S.set(ge, fe.gridType), _.push(fe), h.interpolatedBeats++);
29041
29101
  }
29042
29102
  }
29043
- T.push(...W);
29103
+ _.push(...W);
29044
29104
  }
29045
- const D = T.sort((O, W) => O.beatIndex !== W.beatIndex ? O.beatIndex - W.beatIndex : O.gridPosition - W.gridPosition);
29105
+ const D = _.sort((O, W) => O.beatIndex !== W.beatIndex ? O.beatIndex - W.beatIndex : O.gridPosition - W.gridPosition);
29046
29106
  let R;
29047
29107
  c ? (this.validateSingleGridPerBeat(D).isValid, R = D) : R = this.enforceSingleGridPerBeat(D);
29048
- const q = this.deduplicateEnhancedBeats(R);
29049
- return h.totalBeatsAfter = q.length, this.config.logConversions && console.log(
29108
+ const U = this.deduplicateEnhancedBeats(R);
29109
+ return h.totalBeatsAfter = U.length, this.config.logConversions && console.log(
29050
29110
  `[DifficultyVariantGenerator] Enhanced beats for ${t}: ${h.totalBeatsBefore} → ${h.totalBeatsAfter} beats (patterns: ${h.patternsInserted}, interpolated: ${h.interpolatedBeats})`
29051
- ), { beats: q, metadata: h };
29111
+ ), { beats: U, metadata: h };
29052
29112
  }
29053
29113
  /**
29054
29114
  * Group beats by their beat index
@@ -29097,12 +29157,12 @@ class Un {
29097
29157
  if (c.length === 0)
29098
29158
  return { beatsAdded: 0 };
29099
29159
  const l = c.filter(
29100
- (v) => v.pattern.some((_) => _.gridType === r)
29160
+ (v) => v.pattern.some((T) => T.gridType === r)
29101
29161
  );
29102
29162
  if (l.length === 0)
29103
29163
  return { beatsAdded: 0 };
29104
- l.sort((v, _) => _.significance - v.significance);
29105
- const u = l[0], d = u.pattern.filter((v) => v.beatIndex === 0), h = new Set(e.map((v) => v.gridPosition)), m = (v, _) => `${v}:${_}`, f = d.filter((v) => !(v.gridType !== r || h.has(v.gridPosition) || a.has(m(t, v.gridPosition))));
29164
+ l.sort((v, T) => T.significance - v.significance);
29165
+ const u = l[0], d = u.pattern.filter((v) => v.beatIndex === 0), h = new Set(e.map((v) => v.gridPosition)), m = (v, T) => `${v}:${T}`, f = d.filter((v) => !(v.gridType !== r || h.has(v.gridPosition) || a.has(m(t, v.gridPosition))));
29106
29166
  if (f.length === 0)
29107
29167
  return { beatsAdded: 0 };
29108
29168
  const g = f.slice(0, i), p = u.sourceBand, y = g.map((v) => ({
@@ -29139,12 +29199,12 @@ class Un {
29139
29199
  createBeatsForEmptyIndex(e, t, i, n, a = 0.5, r, o, c) {
29140
29200
  let l = c ?? "straight_16th", u = "mid", d = "mid";
29141
29201
  if (!c && n) {
29142
- const T = n.get(e);
29143
- T && (l = T.selectedGrid);
29202
+ const _ = n.get(e);
29203
+ _ && (l = _.selectedGrid);
29144
29204
  }
29145
29205
  if (!c && !n?.has(e) && r)
29146
- for (const T of [1, -1, 2, -2, 3, -3]) {
29147
- const S = r.get(e + T);
29206
+ for (const _ of [1, -1, 2, -2, 3, -3]) {
29207
+ const S = r.get(e + _);
29148
29208
  if (S && S.length > 0) {
29149
29209
  l = S[0].gridType, u = S[0].band, d = S[0].sourceBand;
29150
29210
  break;
@@ -29152,9 +29212,9 @@ class Un {
29152
29212
  }
29153
29213
  const h = /* @__PURE__ */ new Set();
29154
29214
  if (o) {
29155
- const T = (S, I) => `${S}:${I}`;
29215
+ const _ = (S, I) => `${S}:${I}`;
29156
29216
  for (let S = 0; S < 4; S++)
29157
- o.has(T(e, S)) && h.add(S);
29217
+ o.has(_(e, S)) && h.add(S);
29158
29218
  }
29159
29219
  const f = {
29160
29220
  straight_16th: 4,
@@ -29163,23 +29223,23 @@ class Un {
29163
29223
  straight_4th: 1,
29164
29224
  quarter_triplet: 1
29165
29225
  }[l], g = [];
29166
- for (let T = 0; T < f; T++)
29167
- h.has(T) || g.push(T);
29168
- g.sort((T, S) => {
29226
+ for (let _ = 0; _ < f; _++)
29227
+ h.has(_) || g.push(_);
29228
+ g.sort((_, S) => {
29169
29229
  const I = (D) => D === 0 ? 0 : D === f - 1 ? 2 : 1;
29170
- return I(T) - I(S);
29230
+ return I(_) - I(S);
29171
29231
  });
29172
- const p = g.slice(0, t), y = i?.beats[e]?.timestamp ?? e * a, _ = {
29232
+ const p = g.slice(0, t), y = i?.beats[e]?.timestamp ?? e * a, T = {
29173
29233
  straight_16th: a / 4,
29174
29234
  straight_8th: a / 2,
29175
29235
  triplet_8th: a / 3,
29176
29236
  straight_4th: a,
29177
29237
  quarter_triplet: a
29178
29238
  }[l];
29179
- return p.map((T) => ({
29180
- timestamp: y + T * _,
29239
+ return p.map((_) => ({
29240
+ timestamp: y + _ * T,
29181
29241
  beatIndex: e,
29182
- gridPosition: T,
29242
+ gridPosition: _,
29183
29243
  gridType: l,
29184
29244
  intensity: this.config.interpolatedBeatIntensity * 0.8,
29185
29245
  // Slightly lower for filled gaps
@@ -29206,14 +29266,14 @@ class Un {
29206
29266
  interpolateBeats(e, t, i, n = 0.5, a, r, o) {
29207
29267
  if (i <= 0 || e.length === 0)
29208
29268
  return [];
29209
- const c = r ?? e[0].gridType, u = ((T) => T === "straight_16th" ? 4 : T === "straight_8th" ? 2 : T === "straight_4th" || T === "quarter_triplet" ? 1 : 3)(c), d = (T, S) => `${T}:${S}`, h = new Set(e.map((T) => T.gridPosition));
29269
+ const c = r ?? e[0].gridType, u = ((_) => _ === "straight_16th" ? 4 : _ === "straight_8th" ? 2 : _ === "straight_4th" || _ === "quarter_triplet" ? 1 : 3)(c), d = (_, S) => `${_}:${S}`, h = new Set(e.map((_) => _.gridPosition));
29210
29270
  if (a)
29211
- for (let T = 0; T < u; T++)
29212
- a.has(d(t, T)) && h.add(T);
29271
+ for (let _ = 0; _ < u; _++)
29272
+ a.has(d(t, _)) && h.add(_);
29213
29273
  const m = [];
29214
- for (let T = 0; T < u; T++)
29215
- h.has(T) || m.push(T);
29216
- m.sort((T, S) => (T === 0 || T === 3 ? 2 : 1) - (S === 0 || S === 3 ? 2 : 1));
29274
+ for (let _ = 0; _ < u; _++)
29275
+ h.has(_) || m.push(_);
29276
+ m.sort((_, S) => (_ === 0 || _ === 3 ? 2 : 1) - (S === 0 || S === 3 ? 2 : 1));
29217
29277
  const f = m.slice(0, i), g = e[0], p = o?.beats[t]?.timestamp ?? t * n, v = {
29218
29278
  straight_16th: n / 4,
29219
29279
  straight_8th: n / 2,
@@ -29221,10 +29281,10 @@ class Un {
29221
29281
  straight_4th: n,
29222
29282
  quarter_triplet: n
29223
29283
  }[c];
29224
- return f.map((T) => ({
29225
- timestamp: p + T * v,
29284
+ return f.map((_) => ({
29285
+ timestamp: p + _ * v,
29226
29286
  beatIndex: t,
29227
- gridPosition: T,
29287
+ gridPosition: _,
29228
29288
  gridType: c,
29229
29289
  intensity: this.config.interpolatedBeatIntensity,
29230
29290
  band: g.band,
@@ -29434,10 +29494,10 @@ const Zo = {
29434
29494
  description: "Focus on bass/low-frequency rhythms"
29435
29495
  }
29436
29496
  };
29437
- function l0(s) {
29497
+ function c0(s) {
29438
29498
  return Zo[s];
29439
29499
  }
29440
- function u0() {
29500
+ function l0() {
29441
29501
  return Object.keys(Zo);
29442
29502
  }
29443
29503
  const sy = {
@@ -29624,7 +29684,7 @@ class mt {
29624
29684
  a("Phase 3", 0.6, `Balanced composite: ${p.beats.length} beats (${y.beatsAdded} added, ${y.beatsShifted} shifted for rhythmic structure)`);
29625
29685
  const v = this.options.skipDifficultyVariants ? null : this.generateDifficultyVariants(p, d, u, t);
29626
29686
  a("Phase 3", 0.8, this.options.skipDifficultyVariants ? "Skipped preset difficulty variants (density-based mode)" : "Generated easy/medium/hard difficulty variants"), a("Phase 3", 1, "Phase 3 complete"), i?.throwIfAborted();
29627
- const _ = {
29687
+ const T = {
29628
29688
  difficulty: this.options.difficulty,
29629
29689
  bandsAnalyzed: ["low", "mid", "high"],
29630
29690
  transientsDetected: l.metadata.totalTransients,
@@ -29637,7 +29697,7 @@ class mt {
29637
29697
  duration: e.duration,
29638
29698
  totalBeats: t.beats.length,
29639
29699
  balanceStats: y
29640
- }, T = {
29700
+ }, _ = {
29641
29701
  difficultyVariants: v,
29642
29702
  bandStreams: u.streams,
29643
29703
  composite: p,
@@ -29648,9 +29708,9 @@ class mt {
29648
29708
  densityAnalysis: h,
29649
29709
  scoringResult: m
29650
29710
  },
29651
- metadata: _
29711
+ metadata: T
29652
29712
  };
29653
- return this.setCache(r, T), T;
29713
+ return this.setCache(r, _), _;
29654
29714
  }
29655
29715
  // ================================================================
29656
29716
  // Pipeline Step Methods (exposed for testing and advanced use)
@@ -30452,9 +30512,9 @@ class Xo {
30452
30512
  midiNote: g.frequency > 0 ? g.midiNote : null,
30453
30513
  noteName: g.frequency > 0 ? this.midiToNoteName(g.midiNote) : null
30454
30514
  };
30455
- y.length > 1 && (v.alternativeHypotheses = y.slice(0, 5).map((_) => ({
30456
- frequency: _.frequency,
30457
- probability: _.probability
30515
+ y.length > 1 && (v.alternativeHypotheses = y.slice(0, 5).map((T) => ({
30516
+ frequency: T.frequency,
30517
+ probability: T.probability
30458
30518
  }))), h.push(v);
30459
30519
  }
30460
30520
  return h;
@@ -30518,13 +30578,13 @@ class Xo {
30518
30578
  l++;
30519
30579
  const v = g[0].probability;
30520
30580
  if (v < 0.1 ? d.below01++ : v < 0.2 ? d.b01_02++ : v < 0.3 ? d.b02_03++ : v < 0.4 ? d.b03_04++ : v < 0.5 ? d.b04_05++ : d.above05++, v >= a) {
30521
- const _ = g[0], T = Math.round(this.frequencyToMidi(_.frequency)), S = {
30581
+ const T = g[0], _ = Math.round(this.frequencyToMidi(T.frequency)), S = {
30522
30582
  timestamp: y,
30523
- frequency: _.frequency,
30524
- probability: _.probability,
30583
+ frequency: T.frequency,
30584
+ probability: T.probability,
30525
30585
  isVoiced: !0,
30526
- midiNote: T,
30527
- noteName: this.midiToNoteName(T)
30586
+ midiNote: _,
30587
+ noteName: this.midiToNoteName(_)
30528
30588
  };
30529
30589
  p.length > 1 && (S.alternativeHypotheses = p.slice(0, 5).map((I) => ({
30530
30590
  frequency: I.frequency,
@@ -30623,8 +30683,8 @@ class Xo {
30623
30683
  let g = !1;
30624
30684
  for (const p of d) {
30625
30685
  if (p.frequency <= f.frequency || p.probability < m * 0.9) continue;
30626
- const y = p.frequency / f.frequency, v = Math.round(y), _ = Math.abs(y - v);
30627
- if (v >= 2 && v <= 5 && _ < 0.1) {
30686
+ const y = p.frequency / f.frequency, v = Math.round(y), T = Math.abs(y - v);
30687
+ if (v >= 2 && v <= 5 && T < 0.1) {
30628
30688
  g = !0;
30629
30689
  break;
30630
30690
  }
@@ -31154,17 +31214,17 @@ class qi {
31154
31214
  const S = Ee.tensor(m, [1, n]);
31155
31215
  return this.crepeModel.execute(S).dataSync().slice();
31156
31216
  });
31157
- let v = 0, _ = 0, T = 0;
31217
+ let v = 0, T = 0, _ = 0;
31158
31218
  for (let S = 0; S < 360; S++) {
31159
31219
  const I = y[S];
31160
- v += S * 10 * I, _ += I, I > T && (T = I);
31220
+ v += S * 10 * I, T += I, I > _ && (_ = I);
31161
31221
  }
31162
- if (_ > 0 && T > 0.3) {
31163
- const S = v / _, I = l * Math.pow(2, S / 1200), D = Math.round(this.frequencyToMidi(I));
31222
+ if (T > 0 && _ > 0.3) {
31223
+ const S = v / T, I = l * Math.pow(2, S / 1200), D = Math.round(this.frequencyToMidi(I));
31164
31224
  g = {
31165
31225
  timestamp: f,
31166
31226
  frequency: I,
31167
- probability: T,
31227
+ probability: _,
31168
31228
  isVoiced: !0,
31169
31229
  midiNote: D,
31170
31230
  noteName: this.midiToNoteName(D)
@@ -31726,7 +31786,7 @@ const yy = {
31726
31786
  includeContour: !0,
31727
31787
  onProgress: void 0
31728
31788
  }, vy = 69, by = 440, wy = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
31729
- class d0 {
31789
+ class u0 {
31730
31790
  /**
31731
31791
  * Create a new PitchAnalyzer
31732
31792
  *
@@ -31854,7 +31914,7 @@ class d0 {
31854
31914
  * Compute summary statistics from pitch results
31855
31915
  */
31856
31916
  computeSummary(e) {
31857
- const t = e.length, i = e.filter((_) => _.isVoiced && _.frequency > 0), n = i.length;
31917
+ const t = e.length, i = e.filter((T) => T.isVoiced && T.frequency > 0), n = i.length;
31858
31918
  if (n === 0)
31859
31919
  return {
31860
31920
  voicingRatio: 0,
@@ -31869,14 +31929,14 @@ class d0 {
31869
31929
  totalFrames: t,
31870
31930
  voicedFrames: 0
31871
31931
  };
31872
- const a = i.map((_) => _.frequency), r = [...a].sort((_, T) => _ - T), o = a.reduce((_, T) => _ + T, 0) / a.length, c = Math.floor(r.length / 2), l = r.length % 2 !== 0 ? r[c] : (r[c - 1] + r[c]) / 2, u = r[0], d = r[r.length - 1], h = this.frequencyToMidi(u), m = this.frequencyToMidi(d), f = Math.abs(m - h), g = this.midiToNoteName(Math.round(h)), p = this.midiToNoteName(Math.round(m)), y = /* @__PURE__ */ new Map();
31873
- for (const _ of i)
31874
- _.noteName && y.set(_.noteName, (y.get(_.noteName) ?? 0) + 1);
31875
- const v = Array.from(y.entries()).map(([_, T]) => ({
31876
- note: _,
31877
- count: T,
31878
- percentage: T / n * 100
31879
- })).sort((_, T) => T.count - _.count);
31932
+ const a = i.map((T) => T.frequency), r = [...a].sort((T, _) => T - _), o = a.reduce((T, _) => T + _, 0) / a.length, c = Math.floor(r.length / 2), l = r.length % 2 !== 0 ? r[c] : (r[c - 1] + r[c]) / 2, u = r[0], d = r[r.length - 1], h = this.frequencyToMidi(u), m = this.frequencyToMidi(d), f = Math.abs(m - h), g = this.midiToNoteName(Math.round(h)), p = this.midiToNoteName(Math.round(m)), y = /* @__PURE__ */ new Map();
31933
+ for (const T of i)
31934
+ T.noteName && y.set(T.noteName, (y.get(T.noteName) ?? 0) + 1);
31935
+ const v = Array.from(y.entries()).map(([T, _]) => ({
31936
+ note: T,
31937
+ count: _,
31938
+ percentage: _ / n * 100
31939
+ })).sort((T, _) => _.count - T.count);
31880
31940
  return {
31881
31941
  voicingRatio: n / t,
31882
31942
  averageFrequency: o,
@@ -31921,11 +31981,11 @@ class d0 {
31921
31981
  h = v;
31922
31982
  continue;
31923
31983
  }
31924
- let _;
31925
- const T = Math.abs(v - h);
31926
- v > h ? (_ = "up", c.up++) : v < h ? (_ = "down", c.down++) : (_ = "stable", c.stable++);
31927
- const S = Jo(T);
31928
- l[S]++, !d || d.direction !== _ ? (d && u.push({
31984
+ let T;
31985
+ const _ = Math.abs(v - h);
31986
+ v > h ? (T = "up", c.up++) : v < h ? (T = "down", c.down++) : (T = "stable", c.stable++);
31987
+ const S = Jo(_);
31988
+ l[S]++, !d || d.direction !== T ? (d && u.push({
31929
31989
  startTime: d.startTime,
31930
31990
  endTime: d.endTime,
31931
31991
  startNote: d.startNote,
@@ -31937,7 +31997,7 @@ class d0 {
31937
31997
  endTime: y.timestamp,
31938
31998
  startNote: this.midiToNoteName(h),
31939
31999
  endNote: this.midiToNoteName(v),
31940
- direction: _,
32000
+ direction: T,
31941
32001
  startMidi: h,
31942
32002
  endMidi: v
31943
32003
  }) : (d.endTime = y.timestamp, d.endNote = this.midiToNoteName(v), d.endMidi = v), h = v;
@@ -33103,13 +33163,13 @@ const ec = Qo("ddr", xy), tc = Qo(
33103
33163
  "guitar_hero",
33104
33164
  Ry
33105
33165
  );
33106
- function h0(s) {
33166
+ function d0(s) {
33107
33167
  return s === "ddr" ? ec : tc;
33108
33168
  }
33109
- function m0(s, e) {
33169
+ function h0(s, e) {
33110
33170
  return s.byCategory.get(e) ?? [];
33111
33171
  }
33112
- function f0(s, e = 1, t = 10) {
33172
+ function m0(s, e = 1, t = 10) {
33113
33173
  const i = [];
33114
33174
  for (let n = e; n <= t; n++) {
33115
33175
  const a = s.byDifficulty.get(n);
@@ -33117,24 +33177,24 @@ function f0(s, e = 1, t = 10) {
33117
33177
  }
33118
33178
  return i;
33119
33179
  }
33120
- function g0(s, e) {
33180
+ function f0(s, e) {
33121
33181
  return s.patterns.filter(
33122
33182
  (t) => e.every((i) => t.tags.includes(i))
33123
33183
  );
33124
33184
  }
33125
- function p0(s, e) {
33185
+ function g0(s, e) {
33126
33186
  return s.patterns.filter((t) => t.keys.length === e);
33127
33187
  }
33128
- function y0(s, e) {
33188
+ function p0(s, e) {
33129
33189
  const t = e ? s.patterns.filter(e) : s.patterns;
33130
33190
  if (t.length === 0) return;
33131
33191
  const i = Math.floor(Math.random() * t.length);
33132
33192
  return t[i];
33133
33193
  }
33134
- function v0(s, e) {
33194
+ function y0(s, e) {
33135
33195
  return s.patterns.find((t) => t.id === e);
33136
33196
  }
33137
- function b0(s) {
33197
+ function v0(s) {
33138
33198
  const e = {
33139
33199
  basic: 0,
33140
33200
  roll: 0,
@@ -33569,8 +33629,8 @@ class bn {
33569
33629
  mapButtons(e, t, i) {
33570
33630
  const n = e.beats;
33571
33631
  if (this.config.controllerMode === "tap")
33572
- return n.map((v, _) => ({
33573
- beatIndex: _,
33632
+ return n.map((v, T) => ({
33633
+ beatIndex: T,
33574
33634
  timestamp: v.timestamp,
33575
33635
  key: "tap",
33576
33636
  source: "pattern",
@@ -33589,31 +33649,31 @@ class bn {
33589
33649
  l,
33590
33650
  this.config.pitchInfluenceWeight
33591
33651
  ), d = c.map(
33592
- (v, _) => v !== null && u[_] ? v : null
33593
- ), h = this.config.controllerMode === "ddr" ? ec.patterns : tc.patterns, m = Oy(d), f = /* @__PURE__ */ new Set(), g = m.map((v, _) => {
33594
- const T = Ly(
33652
+ (v, T) => v !== null && u[T] ? v : null
33653
+ ), h = this.config.controllerMode === "ddr" ? ec.patterns : tc.patterns, m = Oy(d), f = /* @__PURE__ */ new Set(), g = m.map((v, T) => {
33654
+ const _ = Ly(
33595
33655
  v,
33596
33656
  h,
33597
33657
  r,
33598
33658
  f,
33599
- () => this.seededRandom(`run:${_}:pick:${o++}`)
33659
+ () => this.seededRandom(`run:${T}:pick:${o++}`)
33600
33660
  );
33601
- for (const S of T)
33661
+ for (const S of _)
33602
33662
  S.pattern.id !== "__interpolated__" && f.add(S.pattern.id);
33603
- return T;
33663
+ return _;
33604
33664
  }), { keys: p, patternIds: y } = zy(
33605
33665
  d,
33606
33666
  m,
33607
33667
  g
33608
33668
  );
33609
33669
  for (let v = 0; v < n.length; v++) {
33610
- const _ = d[v] !== null;
33670
+ const T = d[v] !== null;
33611
33671
  a.push({
33612
33672
  beatIndex: v,
33613
33673
  timestamp: n[v].timestamp,
33614
33674
  key: p[v],
33615
- source: _ ? "pitch" : "pattern",
33616
- patternId: _ ? void 0 : y[v],
33675
+ source: T ? "pitch" : "pattern",
33676
+ patternId: T ? void 0 : y[v],
33617
33677
  probability: l[v]
33618
33678
  });
33619
33679
  }
@@ -34327,8 +34387,8 @@ class fa {
34327
34387
  * ```
34328
34388
  */
34329
34389
  async generateAtDensity(e, t, i, n, a) {
34330
- const r = (y, v, _) => {
34331
- n?.({ stage: y, progress: v, message: _ });
34390
+ const r = (y, v, T) => {
34391
+ n?.({ stage: y, progress: v, message: T });
34332
34392
  };
34333
34393
  a?.throwIfAborted();
34334
34394
  const o = t.audioId;
@@ -34345,8 +34405,8 @@ class fa {
34345
34405
  c = this.getFromCache(y), c ? r("rhythm", 1, "Rhythm loaded from cache") : (c = await this.generateRhythm(
34346
34406
  e,
34347
34407
  t,
34348
- (v, _, T) => {
34349
- r("rhythm", _, `[${v}] ${T}`);
34408
+ (v, T, _) => {
34409
+ r("rhythm", T, `[${v}] ${_}`);
34350
34410
  },
34351
34411
  a,
34352
34412
  !0
@@ -34371,8 +34431,8 @@ class fa {
34371
34431
  "pitch",
34372
34432
  this.createConfigFingerprint("pitch")
34373
34433
  );
34374
- h = this.getFromCache(y), h ? r("pitch", 0.5, "Pitch analysis loaded from cache") : (r("pitch", 0, "Starting pitch analysis..."), h = await this.analyzePitch(e, c, (v, _) => {
34375
- r("pitch", v, _);
34434
+ h = this.getFromCache(y), h ? r("pitch", 0.5, "Pitch analysis loaded from cache") : (r("pitch", 0, "Starting pitch analysis..."), h = await this.analyzePitch(e, c, (v, T) => {
34435
+ r("pitch", v, T);
34376
34436
  }), this.setCache(y, h), r("pitch", 1, "Pitch analysis complete"));
34377
34437
  } else
34378
34438
  r("pitch", 1, "Pitch analysis skipped");
@@ -34506,8 +34566,8 @@ class fa {
34506
34566
  g,
34507
34567
  c.metadata,
34508
34568
  l?.pitchByBeat
34509
- ), v = this.convertToChart(y, t), _ = this.buildLevel(v, y, c, l, "custom");
34510
- r.set(m, _);
34569
+ ), v = this.convertToChart(y, t), T = this.buildLevel(v, y, c, l, "custom");
34570
+ r.set(m, T);
34511
34571
  }
34512
34572
  return n?.({
34513
34573
  stage: "finalizing",
@@ -34643,7 +34703,7 @@ class fa {
34643
34703
  };
34644
34704
  }
34645
34705
  }
34646
- class w0 {
34706
+ class b0 {
34647
34707
  // ============================================================================
34648
34708
  // Export: GeneratedLevel → FullBeatMapExportData
34649
34709
  // ============================================================================
@@ -35569,7 +35629,7 @@ class w0 {
35569
35629
  `);
35570
35630
  }
35571
35631
  }
35572
- function S0(s) {
35632
+ function w0(s) {
35573
35633
  return typeof s == "string" && [
35574
35634
  "humanoid",
35575
35635
  "beast",
@@ -35581,16 +35641,16 @@ function S0(s) {
35581
35641
  "monstrosity"
35582
35642
  ].includes(s);
35583
35643
  }
35584
- function _0(s) {
35644
+ function S0(s) {
35585
35645
  return typeof s == "string" && ["common", "uncommon", "elite", "boss"].includes(s);
35586
35646
  }
35587
- function T0(s) {
35647
+ function _0(s) {
35588
35648
  return typeof s == "string" && ["brute", "archer", "support"].includes(s);
35589
35649
  }
35590
- function C0(s) {
35650
+ function T0(s) {
35591
35651
  return typeof s == "string" && ["easy", "medium", "hard", "deadly"].includes(s);
35592
35652
  }
35593
- class k0 {
35653
+ class C0 {
35594
35654
  /**
35595
35655
  * Calculate average party level
35596
35656
  *
@@ -35838,7 +35898,7 @@ function jy(s, e, t) {
35838
35898
  function Ky(s, e, t) {
35839
35899
  return ur.randomUUID && !s ? ur.randomUUID() : jy(s);
35840
35900
  }
35841
- class A0 {
35901
+ class k0 {
35842
35902
  constructor(e = {}) {
35843
35903
  this.options = {
35844
35904
  validateAudioUrls: !1,
@@ -35899,10 +35959,10 @@ class A0 {
35899
35959
  * See specs/001-core-engine/SPEC.md
35900
35960
  */
35901
35961
  async parseTrack(e, t) {
35902
- const i = ee.parseMetadata(e.metadata);
35962
+ const i = J.parseMetadata(e.metadata);
35903
35963
  if (!i && this.options.strict)
35904
35964
  throw new Error(`Failed to parse metadata for track at index ${t}`);
35905
- const n = e.chain_name, a = e.token_address, r = e.token_id, o = e.tx_id, c = e.platform, l = e.id || (n === "AR" ? `AR-${o}` : `${n}-${a}-${r}`), u = e.uuid || Ky(), d = ee.extractTitle(i || {}), h = ee.extractArtist(i || {}), f = typeof e.artwork_url == "string" && e.artwork_url || typeof e.image_url == "string" && e.image_url || null || ee.extractImageUrl(i || {}), g = ee.extractImageThumbUrl(i || {}), y = typeof e.audio_url == "string" && e.audio_url || null || ee.extractAudioUrl(i || {}), v = ee.extractAudioUrlLossless(i || {});
35965
+ const n = e.chain_name, a = e.token_address, r = e.token_id, o = e.tx_id, c = e.platform, l = e.id || (n === "AR" ? `AR-${o}` : `${n}-${a}-${r}`), u = e.uuid || Ky(), d = J.extractTitle(i || {}), h = J.extractArtist(i || {}), f = typeof e.artwork_url == "string" && e.artwork_url || typeof e.image_url == "string" && e.image_url || null || J.extractImageUrl(i || {}), g = J.extractImageThumbUrl(i || {}), y = typeof e.audio_url == "string" && e.audio_url || null || J.extractAudioUrl(i || {}), v = J.extractAudioUrlLossless(i || {});
35906
35966
  if (!y) {
35907
35967
  if (this.options.strict)
35908
35968
  throw new Error(`No audio URL found for track: ${d || l}`);
@@ -35918,7 +35978,7 @@ class A0 {
35918
35978
  throw new Error(`Missing required fields for track: ${JSON.stringify({ title: d, artist: h, imageUrl: f })}`);
35919
35979
  return null;
35920
35980
  }
35921
- const _ = typeof i?.description == "string" ? i.description : void 0, T = typeof i?.album == "string" ? i.album : void 0, S = i?.duration ? Number(i.duration) : 0, I = ee.extractGenre(i || {}), D = i?.tags || [], R = i?.bpm ? Number(i.bpm) : void 0, q = typeof i?.key == "string" ? i.key : void 0, O = ee.convertAttributes(i?.attributes), W = Wg(i || {}), Z = {
35981
+ const T = typeof i?.description == "string" ? i.description : void 0, _ = typeof i?.album == "string" ? i.album : void 0, S = i?.duration ? Number(i.duration) : 0, I = J.extractGenre(i || {}), D = J.extractTags(i || {}), R = i?.bpm ? Number(i.bpm) : void 0, U = typeof i?.key == "string" ? i.key : void 0, O = J.convertAttributes(i?.attributes), W = Wg(i || {}), Z = {
35922
35982
  id: l,
35923
35983
  uuid: u,
35924
35984
  playlist_index: t,
@@ -35926,16 +35986,16 @@ class A0 {
35926
35986
  platform: c,
35927
35987
  title: d,
35928
35988
  artist: h,
35929
- description: _,
35930
- album: T,
35989
+ description: T,
35990
+ album: _,
35931
35991
  image_url: f,
35932
35992
  audio_url: y,
35933
35993
  audio_url_lossless: v && v !== y ? v : void 0,
35934
35994
  duration: S,
35935
35995
  genre: I,
35936
- tags: Array.isArray(D) ? D.map((Q) => String(Q).toLowerCase()) : [],
35996
+ tags: D,
35937
35997
  bpm: R,
35938
- key: q,
35998
+ key: U,
35939
35999
  attributes: O || void 0,
35940
36000
  extras: W
35941
36001
  };
@@ -36088,26 +36148,26 @@ class Yy {
36088
36148
  r,
36089
36149
  i
36090
36150
  ), d = l.numFrames, h = [];
36091
- for (let _ = 0; _ < d; _++) {
36092
- const T = l.frames[_], S = new Float32Array(this.config.melBands);
36151
+ for (let T = 0; T < d; T++) {
36152
+ const _ = l.frames[T], S = new Float32Array(this.config.melBands);
36093
36153
  for (let I = 0; I < this.config.melBands; I++) {
36094
36154
  const D = u[I];
36095
36155
  let R = 0;
36096
- for (let q = 0; q < D.length && q < T.length; q++)
36097
- R += T[q] * D[q];
36156
+ for (let U = 0; U < D.length && U < _.length; U++)
36157
+ R += _[U] * D[U];
36098
36158
  S[I] = 20 * Math.log10(R + 1e-10);
36099
36159
  }
36100
36160
  h.push(S);
36101
36161
  }
36102
36162
  const m = new Float32Array(d);
36103
36163
  m[0] = 0;
36104
- for (let _ = 1; _ < d; _++) {
36105
- let T = 0;
36164
+ for (let T = 1; T < d; T++) {
36165
+ let _ = 0;
36106
36166
  for (let S = 0; S < this.config.melBands; S++) {
36107
- const I = h[_][S] - h[_ - 1][S];
36108
- I > 0 && (T += I);
36167
+ const I = h[T][S] - h[T - 1][S];
36168
+ I > 0 && (_ += I);
36109
36169
  }
36110
- m[_] = T;
36170
+ m[T] = _;
36111
36171
  }
36112
36172
  const f = 1 / c, g = wp(
36113
36173
  m,
@@ -36119,11 +36179,11 @@ class Yy {
36119
36179
  f
36120
36180
  ), y = Sp(p), v = new Float32Array(p.length);
36121
36181
  if (y > 1e-10)
36122
- for (let _ = 0; _ < p.length; _++)
36123
- v[_] = p[_] / y;
36182
+ for (let T = 0; T < p.length; T++)
36183
+ v[T] = p[T] / y;
36124
36184
  else
36125
- for (let _ = 0; _ < p.length; _++)
36126
- v[_] = p[_];
36185
+ for (let T = 0; T < p.length; T++)
36186
+ v[T] = p[T];
36127
36187
  return {
36128
36188
  envelope: v,
36129
36189
  numFrames: d,
@@ -36255,23 +36315,23 @@ class Xy {
36255
36315
  );
36256
36316
  let l = this.findPeak(c, 0, c.length);
36257
36317
  if (this.config.useOctaveResolution) {
36258
- const T = this.calculateTPS2(o.values, l), S = Math.floor(l / 2);
36259
- S >= 1 && S < c.length && this.calculateTPS2(o.values, S) > T && (l = S);
36318
+ const _ = this.calculateTPS2(o.values, l), S = Math.floor(l / 2);
36319
+ S >= 1 && S < c.length && this.calculateTPS2(o.values, S) > _ && (l = S);
36260
36320
  }
36261
36321
  if (this.config.useTripleMeter) {
36262
- const T = this.calculateTPS3(o.values, l), S = Math.floor(l / 3);
36263
- S >= 1 && S < c.length && this.calculateTPS3(o.values, S) > T && (l = S);
36322
+ const _ = this.calculateTPS3(o.values, l), S = Math.floor(l / 3);
36323
+ S >= 1 && S < c.length && this.calculateTPS3(o.values, S) > _ && (l = S);
36264
36324
  }
36265
36325
  const u = this.lagToBpm(l + o.minLag, t), d = u / 2, h = c[l] || 0, m = Math.min(l * 2, c.length - 1), f = c[m] || 0, g = Math.max(Math.floor(l / 2), 0), p = c[g] || 0, y = 1, v = Math.min(Math.max(
36266
36326
  Math.max(f, p) / (h + 1e-3),
36267
36327
  0
36268
- ), 1), _ = 60 / u;
36328
+ ), 1), T = 60 / u;
36269
36329
  return {
36270
36330
  primaryBpm: u,
36271
36331
  secondaryBpm: d,
36272
36332
  primaryWeight: y,
36273
36333
  secondaryWeight: v,
36274
- targetIntervalSeconds: _
36334
+ targetIntervalSeconds: T
36275
36335
  };
36276
36336
  }
36277
36337
  /**
@@ -36507,31 +36567,31 @@ class Qy {
36507
36567
  effectiveDpAlpha: c
36508
36568
  });
36509
36569
  const l = Math.max(1, Math.round(a * this.config.minPredecessorRatio)), u = Math.round(a * this.config.maxPredecessorRatio), d = new Float32Array(u - l + 1);
36510
- for (let _ = 0; _ < d.length; _++) {
36511
- const T = l + _, S = Math.log(T / a);
36512
- d[_] = -c * S * S;
36570
+ for (let T = 0; T < d.length; T++) {
36571
+ const _ = l + T, S = Math.log(_ / a);
36572
+ d[T] = -c * S * S;
36513
36573
  }
36514
36574
  const h = new Int32Array(n);
36515
36575
  h.fill(-1);
36516
36576
  const m = new Float32Array(e);
36517
- for (let _ = u + 1; _ < n; _++) {
36518
- let T = -1 / 0, S = -1;
36577
+ for (let T = u + 1; T < n; T++) {
36578
+ let _ = -1 / 0, S = -1;
36519
36579
  for (let I = 0; I < d.length; I++) {
36520
- const D = _ - (l + I);
36580
+ const D = T - (l + I);
36521
36581
  if (D >= 0 && D < n) {
36522
36582
  const R = d[I] + m[D];
36523
- R > T && (T = R, S = D);
36583
+ R > _ && (_ = R, S = D);
36524
36584
  }
36525
36585
  }
36526
- m[_] = T + e[_], h[_] = S;
36586
+ m[T] = _ + e[T], h[T] = S;
36527
36587
  }
36528
36588
  Ti.debug("BeatTracker: Starting backward pass", {
36529
36589
  maxCumulativeScore: Math.max(...m),
36530
36590
  envelopeLength: n
36531
36591
  });
36532
36592
  let f = 0, g = m[0];
36533
- for (let _ = 1; _ < n; _++)
36534
- m[_] > g && (g = m[_], f = _);
36593
+ for (let T = 1; T < n; T++)
36594
+ m[T] > g && (g = m[T], f = T);
36535
36595
  const p = [];
36536
36596
  let y = f;
36537
36597
  for (; y >= 0 && h[y] >= 0; )
@@ -37625,21 +37685,21 @@ class Ni {
37625
37685
  const u = this.generateGrid(e, c, l);
37626
37686
  let d = this.mergeBeats(t, u, o);
37627
37687
  const h = d.filter((I) => I.source === "interpolated").length, m = h > 0 ? d.filter((I) => I.source === "interpolated").reduce((I, D) => I + D.confidence, 0) / h : 0, f = this.calculateTempoDriftRatio(d), g = this.identifyTempoClusters(t), p = g.map((I) => Math.round(I.bpm)), y = this.filterOctaveMultiples(p), v = y.length > 1;
37628
- let _, T;
37688
+ let T, _;
37629
37689
  if (this.options.enableMultiTempo && v) {
37630
37690
  const I = this.runMultiTempoAnalysis(
37631
37691
  t,
37632
37692
  g,
37633
37693
  n
37634
37694
  );
37635
- I && (_ = I.tempoSections, T = !0, _.length > 1 && (d = this.reinterpolateBoundaryRegions(
37695
+ I && (T = I.tempoSections, _ = !0, T.length > 1 && (d = this.reinterpolateBoundaryRegions(
37636
37696
  d,
37637
- _,
37697
+ T,
37638
37698
  t,
37639
37699
  o
37640
37700
  )), Ie.debug("Multi-tempo analysis complete", {
37641
- sectionCount: _.length,
37642
- tempos: _.map((D) => D.bpm)
37701
+ sectionCount: T.length,
37702
+ tempos: T.map((D) => D.bpm)
37643
37703
  }));
37644
37704
  }
37645
37705
  const S = {
@@ -37654,8 +37714,8 @@ class Ni {
37654
37714
  // Multi-tempo fields
37655
37715
  detectedClusterTempos: y.length > 0 ? y : void 0,
37656
37716
  hasMultipleTempos: v,
37657
- tempoSections: _,
37658
- hasMultiTempoApplied: T
37717
+ tempoSections: T,
37718
+ hasMultiTempoApplied: _
37659
37719
  };
37660
37720
  return Ie.debug("Interpolation complete", {
37661
37721
  detectedBeats: t.length,
@@ -37663,7 +37723,7 @@ class Ni {
37663
37723
  totalBeats: d.length,
37664
37724
  interpolationRatio: S.interpolationRatio.toFixed(2),
37665
37725
  hasMultipleTempos: v,
37666
- hasMultiTempoApplied: T
37726
+ hasMultiTempoApplied: _
37667
37727
  }), {
37668
37728
  audioId: i,
37669
37729
  duration: n,
@@ -38296,8 +38356,8 @@ class Ni {
38296
38356
  for (let f = 0; f < l.length; f++) {
38297
38357
  const g = l[f], p = g.timestamp - u, y = Math.round(p / o);
38298
38358
  if (y > 0) {
38299
- const v = c + y * o, T = (g.timestamp - v) / y * n;
38300
- o = o + T;
38359
+ const v = c + y * o, _ = (g.timestamp - v) / y * n;
38360
+ o = o + _;
38301
38361
  for (let S = 1; S < y; S++) {
38302
38362
  const I = u + S * o;
38303
38363
  if (a !== void 0 && I > a) break;
@@ -38336,8 +38396,8 @@ class Ni {
38336
38396
  for (let f = 0; f < l.length; f++) {
38337
38397
  const g = l[f], p = u - g.timestamp, y = Math.round(p / o);
38338
38398
  if (y > 0) {
38339
- const v = c - y * o, T = (g.timestamp - v) / y * n;
38340
- o = o + T;
38399
+ const v = c - y * o, _ = (g.timestamp - v) / y * n;
38400
+ o = o + _;
38341
38401
  for (let S = 1; S < y; S++) {
38342
38402
  const I = u - S * o;
38343
38403
  if (a !== void 0 && I < a) break;
@@ -38379,9 +38439,9 @@ class Ni {
38379
38439
  for (let f = 0; f < i.length; f++) {
38380
38440
  const g = i[f];
38381
38441
  if (c.push(this.createDetectedBeat(g)), f < i.length - 1) {
38382
- const p = i[f + 1], y = p.timestamp - g.timestamp, v = Math.round(y / m), _ = h + v * m, T = p.timestamp - _;
38442
+ const p = i[f + 1], y = p.timestamp - g.timestamp, v = Math.round(y / m), T = h + v * m, _ = p.timestamp - T;
38383
38443
  if (v > 0) {
38384
- const S = T / v * o;
38444
+ const S = _ / v * o;
38385
38445
  m = m + S;
38386
38446
  }
38387
38447
  for (let S = 1; S < v; S++) {
@@ -38994,7 +39054,7 @@ const Ut = class Ut {
38994
39054
  const d = Math.floor(c * a), h = Math.floor((c + u) * a), m = this.extractAudioSegment(i, d, h), f = this.performFFT(m, this.options.fftSize), g = new Uint8Array(f.length);
38995
39055
  for (let R = 0; R < f.length; R++)
38996
39056
  g[R] = Math.min(255, Math.round(f[R]));
38997
- const p = Qe.separateFrequencyBands(g, a), y = Qe.calculateDominance(p.bass) * this.options.bassBoost, v = Qe.calculateDominance(p.mid) * this.options.midBoost, _ = Qe.calculateDominance(p.treble) * this.options.trebleBoost, T = y + v + _ || 1, S = this.calculateRMS(i, d, h), I = this.calculatePeak(i, d, h), D = [
39057
+ const p = Qe.separateFrequencyBands(g, a), y = Qe.calculateDominance(p.bass) * this.options.bassBoost, v = Qe.calculateDominance(p.mid) * this.options.midBoost, T = Qe.calculateDominance(p.treble) * this.options.trebleBoost, _ = y + v + T || 1, S = this.calculateRMS(i, d, h), I = this.calculatePeak(i, d, h), D = [
38998
39058
  ...p.bass,
38999
39059
  ...p.mid,
39000
39060
  ...p.treble
@@ -39002,9 +39062,9 @@ const Ut = class Ut {
39002
39062
  r.push({
39003
39063
  timestamp: c,
39004
39064
  duration: u,
39005
- bass: y / T,
39006
- mid: v / T,
39007
- treble: _ / T,
39065
+ bass: y / _,
39066
+ mid: v / _,
39067
+ treble: T / _,
39008
39068
  amplitude: S,
39009
39069
  rms_energy: S,
39010
39070
  peak: I,
@@ -40385,7 +40445,7 @@ function hv(s) {
40385
40445
  function Ot(s) {
40386
40446
  return Ai(s) ? `${s.embedding} -> ${s.classifier}` : s.modelUrl;
40387
40447
  }
40388
- function mv(s) {
40448
+ function A0(s) {
40389
40449
  if (!s || s.length === 0)
40390
40450
  return [];
40391
40451
  const e = s[0].length;
@@ -40458,14 +40518,14 @@ const _n = {
40458
40518
  mood: Object.keys(oc),
40459
40519
  danceability: Object.keys(cc)
40460
40520
  };
40461
- function fv(s) {
40521
+ function mv(s) {
40462
40522
  const e = {};
40463
40523
  return s.genre && (e.genre = rc[s.genre]), s.mood && (e.mood = oc[s.mood]), s.danceability && (e.danceability = cc[s.danceability]), e;
40464
40524
  }
40465
40525
  class I0 {
40466
40526
  constructor(e = {}) {
40467
40527
  this.essentiaWASM = null, this.essentiaModel = null, this.extractor = null, this.initialized = !1, this.embeddingModelCache = /* @__PURE__ */ new Map(), this.classifierModelCache = /* @__PURE__ */ new Map(), this.resolvedUrlCache = /* @__PURE__ */ new Map(), this.extractors = /* @__PURE__ */ new Map();
40468
- const t = e.preset ? fv(e.preset) : {};
40528
+ const t = e.preset ? mv(e.preset) : {};
40469
40529
  this.options = {
40470
40530
  models: {
40471
40531
  // Start with engine defaults, layer on presets, then explicit models
@@ -40678,111 +40738,32 @@ class I0 {
40678
40738
  clearAllCaches() {
40679
40739
  this.clearEmbeddingCache(), this.clearClassifierCache(), this.resolvedUrlCache.clear();
40680
40740
  }
40681
- /**
40682
- * Computes 128-band mel-spectrogram features for Discogs-EffNet models.
40683
- *
40684
- * Unlike the standard musicnn extractor (96 bands), EffNet requires 128 mel bands.
40685
- * This method uses Essentia WASM's core MelBands algorithm directly.
40686
- *
40687
- * @param audioSignal - Mono audio signal at 16kHz sample rate
40688
- * @returns 2D array of mel-spectrogram frames, shape [frames][128]
40689
- */
40690
- /**
40691
- * Creates a wrapper object that combines EssentiaJS algorithms with WASM utility methods.
40692
- * This is needed because EssentiaJS has algorithms (Windowing, Spectrum, etc.) but lacks
40693
- * utility methods like arrayToVector/vectorToArray which are on the WASM module directly.
40694
- */
40695
- createEssentiaWrapper() {
40696
- const e = new this.essentiaWASM.EssentiaJS(!1);
40697
- return {
40698
- Windowing: e.Windowing.bind(e),
40699
- Spectrum: e.Spectrum.bind(e),
40700
- MelBands: e.MelBands.bind(e),
40701
- UnaryOperator: e.UnaryOperator.bind(e),
40702
- // Utility methods are on the WASM module directly, not on EssentiaJS
40703
- arrayToVector: this.essentiaWASM.arrayToVector,
40704
- vectorToArray: this.essentiaWASM.vectorToArray
40705
- };
40706
- }
40707
- computeEffnetFeatures(e) {
40708
- if (!this.essentiaWASM)
40709
- throw new Error("Essentia WASM not initialized. Call initializeEssentia() first.");
40710
- const t = this.createEssentiaWrapper(), i = [], n = 512, a = 256, r = 16e3, o = 128;
40711
- for (let c = 0; c <= e.length - n; c += a) {
40712
- const l = e.slice(c, c + n), u = t.Windowing(
40713
- t.arrayToVector(l),
40714
- !0,
40715
- // normalized
40716
- n,
40717
- // size (must be explicit, not inferred from frame length)
40718
- "hann",
40719
- // type
40720
- 0,
40721
- // zeroPadding
40722
- !0
40723
- // zeroPhase
40724
- ), d = t.Spectrum(
40725
- u.frame,
40726
- n
40727
- ), h = t.MelBands(
40728
- d.spectrum,
40729
- 8e3,
40730
- // highFrequencyBound (16kHz / 2)
40731
- n / 2,
40732
- // inputSize (FFT output size)
40733
- !1,
40734
- // log (apply log later)
40735
- 0,
40736
- // lowFrequencyBound
40737
- "unit_sum",
40738
- // normalize
40739
- o,
40740
- // numberBands - THE MAGIC NUMBER!
40741
- r,
40742
- // sampleRate
40743
- "power",
40744
- // type
40745
- "slaneyMel",
40746
- // warpingFormula
40747
- "linear"
40748
- // weighting
40749
- ), m = t.UnaryOperator(
40750
- h.bands,
40751
- 1e4,
40752
- // scale pre-log to avoid log(0)
40753
- 1,
40754
- // shift
40755
- "log10"
40756
- // operation
40757
- ), f = Array.from(t.vectorToArray(m.array));
40758
- i.push(f);
40759
- }
40760
- return i;
40761
- }
40762
40741
  /**
40763
40742
  * Gets the appropriate mel-spectrogram features for a given model architecture.
40764
40743
  *
40765
40744
  * Different architectures require different mel-band configurations:
40766
40745
  * - musicnn: 96 bands (default)
40767
- * - effnet: 128 bands (custom)
40746
+ * - effnet: 96 bands (same features as musicnn)
40768
40747
  * - vggish: 64 bands
40769
40748
  * - tempocnn: 40 bands
40770
40749
  *
40771
40750
  * @param audioSignal - Mono audio signal at 16kHz sample rate
40772
40751
  * @param architecture - The model architecture type
40773
- * @returns 2D array of mel-spectrogram frames
40752
+ * @returns For 'effnet': number[][] of mel frames. For all other
40753
+ * architectures: the EssentiaTFInputExtractorOutput object that
40754
+ * essentia.js model predict() methods expect
40774
40755
  */
40775
40756
  getFeaturesForArchitecture(e, t) {
40776
40757
  switch (t) {
40777
40758
  case "effnet":
40778
- return this.computeEffnetFeatures(e);
40759
+ return this.extractor.computeFrameWise(e, 256).melSpectrum;
40779
40760
  case "vggish":
40780
40761
  const i = this.extractors.get("vggish");
40781
- return i ? i.computeFrameWise(e, 512) : (console.warn("VGGish extractor not initialized, falling back to default 96-band extractor."), this.extractor.computeFrameWise(e, 512));
40762
+ return i ? i.computeFrameWise(e, 160) : (console.warn("VGGish extractor not initialized, falling back to default 96-band extractor."), this.extractor.computeFrameWise(e, 256));
40782
40763
  case "tempocnn":
40783
- return console.warn("TempoCNN architecture requested but using default 96-band extractor. Results may be suboptimal for TempoCNN models."), this.extractor.computeFrameWise(e, 512);
40764
+ return console.warn("TempoCNN architecture requested but using default 96-band extractor. Results may be suboptimal for TempoCNN models."), this.extractor.computeFrameWise(e, 256);
40784
40765
  default:
40785
- return this.extractor.computeFrameWise(e, 512);
40766
+ return this.extractor.computeFrameWise(e, 256);
40786
40767
  }
40787
40768
  }
40788
40769
  /**
@@ -40800,76 +40781,91 @@ class I0 {
40800
40781
  /**
40801
40782
  * Analyzes audio to extract genre, mood, and vibe data.
40802
40783
  */
40784
+ /**
40785
+ * Analyze a track. Accepts either:
40786
+ * - a `string` URL: the engine fetches + decodes + downsamples via Web
40787
+ * Audio (main-thread path). Backward-compatible with all existing callers.
40788
+ * - an `{ audioSignal, sampleRate? }` object: caller has already fetched,
40789
+ * decoded, AND downsampled to mono PCM. Used when running inside a Web
40790
+ * Worker (no Web Audio available there). `sampleRate` defaults to 16000
40791
+ * (essentia.js's required rate); the engine skips fetch + decode +
40792
+ * downsample and runs only the slice + ML inference on the provided signal.
40793
+ */
40803
40794
  async analyze(e) {
40804
40795
  try {
40805
40796
  await this.initializeEssentia();
40806
- const i = await (await fetch(e)).arrayBuffer(), n = new (window.AudioContext || window.webkitAudioContext)(), a = await n.decodeAudioData(i), r = await this.extractor.downsampleAudioBuffer(
40807
- a,
40808
- n.sampleRate
40809
- ), o = this.sliceAudioSignal(r, n.sampleRate), c = this.extractor.computeFrameWise(o, 512), l = [], u = {
40797
+ let t;
40798
+ if (typeof e == "string") {
40799
+ const l = await (await fetch(e)).arrayBuffer(), u = typeof self < "u" ? self : typeof globalThis < "u" ? globalThis : {}, d = u.AudioContext || u.webkitAudioContext, h = u.OfflineAudioContext || u.webkitOfflineAudioContext, m = d ? new d() : h ? new h(1, 44100, 44100) : (() => {
40800
+ throw new Error("No Web Audio API available in this context");
40801
+ })(), f = await m.decodeAudioData(l);
40802
+ t = await this.extractor.downsampleAudioBuffer(f, m.sampleRate);
40803
+ } else
40804
+ t = e.audioSignal;
40805
+ const i = this.sliceAudioSignal(t, 16e3), n = Math.max(0, Math.floor((i.length - 512) / 256) + 1), a = [], r = {
40810
40806
  genres: [],
40811
40807
  moods: [],
40812
40808
  mood_tags: [],
40813
40809
  vibe_metrics: {}
40814
40810
  };
40815
40811
  if (this.options.models?.genre) {
40816
- const d = this.options.models.genre, h = Ai(d) ? d.classifier : d.modelUrl;
40817
- let m;
40818
- Ai(d) && d.classifierType ? m = d.classifierType : fr(d) && d.genreType ? m = d.genreType : m = dv(h);
40819
- const f = hv(m);
40820
- u.genres = await this.runModelPrediction(
40821
- d,
40812
+ const o = this.options.models.genre, c = Ai(o) ? o.classifier : o.modelUrl;
40813
+ let l;
40814
+ Ai(o) && o.classifierType ? l = o.classifierType : fr(o) && o.genreType ? l = o.genreType : l = dv(c);
40815
+ const u = hv(l);
40816
+ r.genres = await this.runModelPrediction(
40822
40817
  o,
40823
- f
40824
- ), u.primary_genre = u.genres.length > 0 ? u.genres[0].name : "Unknown", l.push(Ot(d));
40818
+ i,
40819
+ u
40820
+ ), r.primary_genre = r.genres.length > 0 ? r.genres[0].name : "Unknown", a.push(Ot(o));
40825
40821
  }
40826
40822
  if (this.options.models?.mood) {
40827
- const d = this.options.models.mood, h = fr(d) ? rv : ov;
40828
- u.moods = await this.runModelPrediction(
40829
- d,
40823
+ const o = this.options.models.mood, c = fr(o) ? rv : ov;
40824
+ r.moods = await this.runModelPrediction(
40830
40825
  o,
40831
- h
40832
- ), u.mood_tags = u.moods.slice(0, 3).map((m) => m.name), l.push(Ot(d));
40826
+ i,
40827
+ c
40828
+ ), r.mood_tags = r.moods.slice(0, 3).map((l) => l.name), a.push(Ot(o));
40833
40829
  }
40834
40830
  if (this.options.models?.danceability) {
40835
- const d = this.options.models.danceability, m = (await this.runModelPrediction(
40836
- d,
40831
+ const o = this.options.models.danceability, l = (await this.runModelPrediction(
40837
40832
  o,
40833
+ i,
40838
40834
  cv
40839
- )).find((f) => f.name === "danceable");
40840
- u.vibe_metrics.danceability = m?.confidence ?? 0, l.push(Ot(d));
40835
+ )).find((u) => u.name === "danceable");
40836
+ r.vibe_metrics.danceability = l?.confidence ?? 0, a.push(Ot(o));
40841
40837
  }
40842
40838
  if (this.options.models?.voice) {
40843
- const d = this.options.models.voice, m = (await this.runModelPrediction(
40844
- d,
40839
+ const o = this.options.models.voice, l = (await this.runModelPrediction(
40845
40840
  o,
40841
+ i,
40846
40842
  lv
40847
- )).find((f) => f.name === "instrumental");
40848
- u.vibe_metrics.instrumental_probability = m?.confidence ?? 0, l.push(Ot(d));
40843
+ )).find((u) => u.name === "instrumental");
40844
+ r.vibe_metrics.instrumental_probability = l?.confidence ?? 0, a.push(Ot(o));
40849
40845
  }
40850
40846
  if (this.options.models?.acoustic) {
40851
- const d = this.options.models.acoustic, m = (await this.runModelPrediction(
40852
- d,
40847
+ const o = this.options.models.acoustic, l = (await this.runModelPrediction(
40853
40848
  o,
40849
+ i,
40854
40850
  uv
40855
- )).find((f) => f.name === "electronic");
40856
- u.vibe_metrics.electronic_probability = m?.confidence ?? 0, l.push(Ot(d));
40851
+ )).find((u) => u.name === "electronic");
40852
+ r.vibe_metrics.electronic_probability = l?.confidence ?? 0, a.push(Ot(o));
40857
40853
  }
40858
- if (u.moods) {
40859
- const d = u.moods.find((m) => m.name === "energetic" || m.name === "upbeat" || m.name === "epic"), h = u.moods.find((m) => m.name === "happy" || m.name === "positive" || m.name === "uplifting");
40860
- d && (u.vibe_metrics.energy = d.confidence), h && (u.vibe_metrics.valence = h.confidence);
40854
+ if (r.moods) {
40855
+ const o = r.moods.find((l) => l.name === "energetic" || l.name === "upbeat" || l.name === "epic"), c = r.moods.find((l) => l.name === "happy" || l.name === "positive" || l.name === "uplifting");
40856
+ o && (r.vibe_metrics.energy = o.confidence), c && (r.vibe_metrics.valence = c.confidence);
40861
40857
  }
40862
40858
  return {
40863
- genres: u.genres || [],
40864
- moods: u.moods || [],
40865
- primary_genre: u.primary_genre || "Unknown",
40866
- mood_tags: u.mood_tags || [],
40867
- vibe_metrics: u.vibe_metrics,
40859
+ genres: r.genres || [],
40860
+ moods: r.moods || [],
40861
+ primary_genre: r.primary_genre || "Unknown",
40862
+ mood_tags: r.mood_tags || [],
40863
+ vibe_metrics: r.vibe_metrics,
40868
40864
  analysis_metadata: {
40869
- models_used: l,
40870
- model_used: l.length > 0 ? l[0] : void 0,
40871
- frames_analyzed: c.length,
40872
- duration_analyzed: a.duration,
40865
+ models_used: a,
40866
+ model_used: a.length > 0 ? a[0] : void 0,
40867
+ frames_analyzed: n,
40868
+ duration_analyzed: i.length / 16e3,
40873
40869
  analyzed_at: (/* @__PURE__ */ new Date()).toISOString()
40874
40870
  }
40875
40871
  };
@@ -40885,22 +40881,24 @@ class I0 {
40885
40881
  * 2. Classifier model produces class predictions from embeddings
40886
40882
  *
40887
40883
  * @param classifierUrl - URL to the classifier model (GraphModel format)
40888
- * @param embeddings - 2D array of embeddings, shape [frames][embedding_dim]
40889
- * @returns Promise resolving to 1D array of averaged class predictions
40884
+ * @param embeddings - 2D array of embeddings, shape [patches][embedding_dim]
40885
+ * @returns Promise resolving to 1D array of class predictions averaged across patches
40890
40886
  */
40891
40887
  async runClassifierOnEmbeddings(e, t) {
40892
- const i = mv(t);
40893
- if (i.length === 0)
40888
+ if (t.length === 0 || t[0].length === 0)
40894
40889
  return console.warn("Empty embeddings provided to classifier"), [];
40895
- const n = await this.loadModelWithRetry(e), a = Ee.tensor2d([i], [1, i.length]);
40896
- let r = [];
40890
+ const i = await this.loadModelWithRetry(e), n = Ee.tensor2d(t);
40891
+ let a = [];
40897
40892
  try {
40898
- const o = n.predict(a);
40899
- r = await o.data().then((c) => Array.from(c)), o.dispose();
40893
+ const r = i.predict(n), o = await r.data(), c = r.shape, l = c[c.length - 1], u = Math.max(1, Math.floor(o.length / l)), d = new Array(l).fill(0);
40894
+ for (let h = 0; h < u; h++)
40895
+ for (let m = 0; m < l; m++)
40896
+ d[m] += o[h * l + m];
40897
+ a = d.map((h) => h / u), r.dispose();
40900
40898
  } finally {
40901
- a.dispose(), n.dispose();
40899
+ n.dispose(), i.dispose();
40902
40900
  }
40903
- return r;
40901
+ return a;
40904
40902
  }
40905
40903
  /**
40906
40904
  * Runs a two-step model architecture prediction.
@@ -40972,70 +40970,54 @@ class I0 {
40972
40970
  *
40973
40971
  * EffNet models are TensorFlow.js GraphModels that expect:
40974
40972
  * - Named inputs discovered dynamically from model signature
40975
- * - Mel-spectrogram shape: [batch=64, mel_bands=128, time_frames=96]
40973
+ * - Mel-spectrogram shape: [batch=64, time_frames=128, mel_bands=96]
40976
40974
  *
40977
- * The 'bs64' in model name means fixed batch size of 64.
40975
+ * The input axis order is time-major: each of the 64 patches is 128
40976
+ * consecutive TensorflowInputMusiCNN frames of 96 mel bands. The 'bs64'
40977
+ * in the model name means a fixed batch size of 64.
40978
40978
  *
40979
40979
  * @param model - TensorFlow.js GraphModel instance
40980
- * @param features - 2D array of mel-spectrogram frames, shape [frames][128]
40981
- * @returns 2D array of embeddings, shape [segments][embedding_dim]
40980
+ * @param features - 2D array of mel-spectrogram frames, shape [frames][96]
40981
+ * @returns 2D array of embeddings, one per patch, shape [patches][embedding_dim]
40982
40982
  */
40983
40983
  async runEffnetEmbedding(e, t) {
40984
- const i = t[0]?.length || 128, n = t.length, a = 64, r = 128, o = 96;
40985
- let c = [], l = t;
40986
- if (n < o) {
40987
- const m = Array(i).fill(0);
40988
- for (; l.length < o; )
40989
- l = [...l, m];
40990
- }
40991
- const u = [];
40992
- for (let m = 0; m < a; m++) {
40993
- const f = m * o % l.length, g = [];
40994
- for (let p = 0; p < o; p++) {
40995
- const y = (f + p) % l.length;
40996
- g.push(l[y] || Array(i).fill(0));
40984
+ const i = t.length, n = 64, a = 128, r = 96;
40985
+ if (i === 0)
40986
+ return [];
40987
+ (t[0]?.length ?? 0) !== r && console.warn(
40988
+ `[MusicClassifier] EffNet expects ${r}-band mel features but got ${t[0]?.length}-band frames. Results will be unreliable.`
40989
+ );
40990
+ const o = [], c = Math.max(0, i - a), l = new Array(r).fill(0), u = new Float32Array(n * a * r);
40991
+ for (let h = 0; h < n; h++) {
40992
+ const m = Math.round(h * c / (n - 1));
40993
+ for (let f = 0; f < a; f++) {
40994
+ const g = t[m + f] ?? l, p = (h * a + f) * r;
40995
+ for (let y = 0; y < r; y++)
40996
+ u[p + y] = g[y] ?? 0;
40997
40997
  }
40998
- u.push(g);
40999
40998
  }
41000
- const d = [];
41001
- for (let m = 0; m < a; m++)
41002
- for (let f = 0; f < r; f++)
41003
- for (let g = 0; g < o; g++)
41004
- d.push(u[m][g]?.[f] ?? 0);
41005
- const h = Ee.tensor3d(d, [a, r, o]);
40999
+ const d = Ee.tensor3d(u, [n, a, r]);
41006
41000
  try {
41007
- const m = this.getModelInputNames(e);
41008
- if (m.length === 0)
41001
+ const h = this.getModelInputNames(e);
41002
+ if (h.length === 0)
41009
41003
  throw new Error("Could not discover model input names");
41010
- const f = {};
41011
- for (const _ of m)
41012
- _.includes("melspectrogram") || _.includes("mel") || _.includes("spectrogram") ? f[_] = h : _.includes("saver") || _.includes("filename") ? f[_] = Ee.scalar("") : f[_] = h;
41013
- const g = e.execute(f);
41014
- let p;
41015
- if (Array.isArray(g) ? p = g[0] : g && typeof g == "object" && !("data" in g) ? p = Object.values(g)[0] : p = g, !p || typeof p.data != "function")
41004
+ const m = {};
41005
+ for (const _ of h)
41006
+ _.includes("melspectrogram") || _.includes("mel") || _.includes("spectrogram") ? m[_] = d : _.includes("saver") || _.includes("filename") ? m[_] = Ee.scalar("") : m[_] = d;
41007
+ const f = e.execute(m);
41008
+ let g;
41009
+ if (Array.isArray(f) ? g = f[0] : f && typeof f == "object" && !("data" in f) ? g = Object.values(f)[0] : g = f, !g || typeof g.data != "function")
41016
41010
  throw new Error("Model execution did not return a valid tensor");
41017
- const y = await p.data(), v = p.shape;
41018
- if (v.length === 2) {
41019
- const _ = v[1], T = [];
41020
- for (let D = 0; D < _; D++) {
41021
- let R = 0;
41022
- for (let q = 0; q < a; q++)
41023
- R += y[q * _ + D];
41024
- T.push(R / a);
41025
- }
41026
- const S = Math.sqrt(T.reduce((D, R) => D + R * R, 0)), I = S > 0 ? T.map((D) => D / S) : T;
41027
- c.push(I);
41028
- } else {
41029
- const _ = Array.from(y.slice(0, v[v.length - 1])), T = Math.sqrt(_.reduce((I, D) => I + D * D, 0)), S = T > 0 ? _.map((I) => I / T) : _;
41030
- c.push(S);
41031
- }
41032
- p.dispose();
41033
- for (const [_, T] of Object.entries(f))
41034
- T !== h && T.dispose();
41011
+ const p = await g.data(), y = g.shape, v = y[y.length - 1], T = Math.max(1, Math.floor(p.length / v));
41012
+ for (let _ = 0; _ < T; _++)
41013
+ o.push(Array.from(p.slice(_ * v, (_ + 1) * v)));
41014
+ g.dispose();
41015
+ for (const [_, S] of Object.entries(m))
41016
+ S !== d && S.dispose();
41035
41017
  } finally {
41036
- h.dispose();
41018
+ d.dispose();
41037
41019
  }
41038
- return c;
41020
+ return o;
41039
41021
  }
41040
41022
  /**
41041
41023
  * Runs Essentia embedding model inference on mel-spectrogram features.
@@ -41116,7 +41098,9 @@ class I0 {
41116
41098
  return i.terminate && i.terminate(), r;
41117
41099
  }
41118
41100
  mapPredictions(e, t) {
41119
- return e.map((i, n) => ({
41101
+ return e.length > 0 && e.length !== t.length && console.warn(
41102
+ `[MusicClassifier] Model returned ${e.length} outputs but ${t.length} labels are configured — tags may be mislabeled. Check that the label list matches the model.`
41103
+ ), e.map((i, n) => ({
41120
41104
  name: t[n] || `unknown_${n}`,
41121
41105
  confidence: i
41122
41106
  })).sort((i, n) => n.confidence - i.confidence).filter((i) => i.confidence >= this.options.threshold).slice(0, this.options.topN);
@@ -41331,7 +41315,7 @@ class D0 {
41331
41315
  };
41332
41316
  }
41333
41317
  }
41334
- const Tn = Se.for("BeatSubdivider"), gv = {
41318
+ const Tn = Se.for("BeatSubdivider"), fv = {
41335
41319
  tolerance: 0.02,
41336
41320
  // 20ms tolerance
41337
41321
  defaultIntensity: 0.5,
@@ -41347,7 +41331,7 @@ class Xt {
41347
41331
  */
41348
41332
  constructor(e) {
41349
41333
  this.options = {
41350
- ...gv,
41334
+ ...fv,
41351
41335
  ...e
41352
41336
  }, Tn.debug("BeatSubdivider initialized", { options: this.options });
41353
41337
  }
@@ -41385,19 +41369,19 @@ class Xt {
41385
41369
  t.beatSubdivisions.has(g) && r++, i.add(p);
41386
41370
  const y = Dr(p);
41387
41371
  n = Math.max(n, y);
41388
- const v = e.beats[g], _ = g < e.beats.length - 1 ? e.beats[g + 1] : null, T = e.detectedBeatIndices.includes(g);
41372
+ const v = e.beats[g], T = g < e.beats.length - 1 ? e.beats[g + 1] : null, _ = e.detectedBeatIndices.includes(g);
41389
41373
  if (p === "rest" || p === "half" && v.beatInMeasure % 2 !== 0)
41390
41374
  continue;
41391
41375
  const S = p === "dotted4" && v.beatInMeasure % 2 !== 0;
41392
41376
  if (p === "offbeat8" || p === "triplet4" && o(g) === 1 || S || c.push({
41393
41377
  ...v,
41394
- isDetected: T,
41378
+ isDetected: _,
41395
41379
  originalBeatIndex: g,
41396
41380
  subdivisionType: p
41397
- }), _) {
41381
+ }), T) {
41398
41382
  const D = this.createInterpolatedBeatsForSubdivision(
41399
41383
  v,
41400
- _,
41384
+ T,
41401
41385
  g,
41402
41386
  p,
41403
41387
  e,
@@ -42778,7 +42762,7 @@ class L0 {
42778
42762
  this.stop(), this.subscribers.clear(), this.state.scheduledBeats.clear(), we.debug("SubdivisionPlaybackController disposed");
42779
42763
  }
42780
42764
  }
42781
- const pv = [
42765
+ const gv = [
42782
42766
  0,
42783
42767
  // Level 1
42784
42768
  300,
@@ -42819,7 +42803,7 @@ const pv = [
42819
42803
  // Level 19
42820
42804
  355e3
42821
42805
  // Level 20
42822
- ], yv = {
42806
+ ], pv = {
42823
42807
  stationary: 1,
42824
42808
  walking: 1.2,
42825
42809
  running: 1.5,
@@ -42842,11 +42826,11 @@ class lc {
42842
42826
  */
42843
42827
  constructor(e) {
42844
42828
  this.config = {
42845
- level_thresholds: e?.level_thresholds || pv,
42829
+ level_thresholds: e?.level_thresholds || gv,
42846
42830
  xp_per_second: e?.xp_per_second ?? 1,
42847
42831
  xp_per_track_completion: e?.xp_per_track_completion ?? 50,
42848
42832
  activity_bonuses: {
42849
- ...yv,
42833
+ ...pv,
42850
42834
  ...e?.activity_bonuses
42851
42835
  },
42852
42836
  track_mastery_threshold: e?.track_mastery_threshold ?? 10,
@@ -43647,7 +43631,7 @@ class je {
43647
43631
  e.equipment && xe.reapplyEquipmentEffects(e);
43648
43632
  }
43649
43633
  }
43650
- class vv {
43634
+ class yv {
43651
43635
  constructor() {
43652
43636
  this.name = "D&D 5e Standard";
43653
43637
  }
@@ -43664,7 +43648,7 @@ class vv {
43664
43648
  return !e?.forcedAbilities || e.forcedAbilities.length === 0;
43665
43649
  }
43666
43650
  }
43667
- class bv {
43651
+ class vv {
43668
43652
  constructor() {
43669
43653
  this.name = "D&D 5e Smart";
43670
43654
  }
@@ -43713,7 +43697,7 @@ class bv {
43713
43697
  return n;
43714
43698
  }
43715
43699
  }
43716
- class wv {
43700
+ class bv {
43717
43701
  constructor() {
43718
43702
  this.name = "Balanced";
43719
43703
  }
@@ -43735,7 +43719,7 @@ class wv {
43735
43719
  return !1;
43736
43720
  }
43737
43721
  }
43738
- class Sv {
43722
+ class wv {
43739
43723
  constructor() {
43740
43724
  this.name = "Primary Only";
43741
43725
  }
@@ -43758,7 +43742,7 @@ class Sv {
43758
43742
  return n;
43759
43743
  }
43760
43744
  }
43761
- class _v {
43745
+ class Sv {
43762
43746
  constructor() {
43763
43747
  this.name = "Random";
43764
43748
  }
@@ -43775,7 +43759,7 @@ class _v {
43775
43759
  return !1;
43776
43760
  }
43777
43761
  }
43778
- class Tv {
43762
+ class _v {
43779
43763
  constructor() {
43780
43764
  this.name = "Manual";
43781
43765
  }
@@ -43786,7 +43770,7 @@ class Tv {
43786
43770
  return !0;
43787
43771
  }
43788
43772
  }
43789
- class Cv {
43773
+ class Tv {
43790
43774
  constructor(e, t) {
43791
43775
  this.fn = e, this.name = t || "Custom Function";
43792
43776
  }
@@ -43801,20 +43785,20 @@ function pr(s) {
43801
43785
  if (typeof s != "string" && typeof s != "function")
43802
43786
  return s;
43803
43787
  if (typeof s == "function")
43804
- return new Cv(s);
43788
+ return new Tv(s);
43805
43789
  switch (s) {
43806
43790
  case "dnD5e":
43807
- return new vv();
43791
+ return new yv();
43808
43792
  case "dnD5e_smart":
43809
- return new bv();
43793
+ return new vv();
43810
43794
  case "balanced":
43811
- return new wv();
43795
+ return new bv();
43812
43796
  case "primary_only":
43813
- return new Sv();
43797
+ return new wv();
43814
43798
  case "random":
43815
- return new _v();
43799
+ return new Sv();
43816
43800
  case "manual":
43817
- return new Tv();
43801
+ return new _v();
43818
43802
  default:
43819
43803
  const e = s;
43820
43804
  throw new Error(`Unknown strategy type: ${e}`);
@@ -43824,7 +43808,7 @@ const yr = [4, 8, 12, 16, 19], vr = {
43824
43808
  strategy: "dnD5e",
43825
43809
  autoApply: !0
43826
43810
  };
43827
- class kv {
43811
+ class Cv {
43828
43812
  constructor(e) {
43829
43813
  this.config = this.mergeWithDefaults(e), this.strategy = pr(this.config.strategy);
43830
43814
  }
@@ -44370,7 +44354,7 @@ class W0 {
44370
44354
  };
44371
44355
  if (n.xp.current += t, !this.statManager) {
44372
44356
  const d = (n.gameMode || "standard") === "standard" ? "dnD5e" : "dnD5e_smart";
44373
- this.statManager = new kv({ strategy: d }), je.setStatManager(this.statManager);
44357
+ this.statManager = new Cv({ strategy: d }), je.setStatManager(this.statManager);
44374
44358
  }
44375
44359
  let a = !1, r;
44376
44360
  const o = [], c = n.gameMode === "uncapped", l = je.calculateLevel(n.xp.current, c);
@@ -45589,7 +45573,7 @@ const jn = {
45589
45573
  tags: ["magic", "enhanced", "+2", "armor"]
45590
45574
  }
45591
45575
  };
45592
- class Av {
45576
+ class kv {
45593
45577
  /**
45594
45578
  * Open a box and generate its contents
45595
45579
  *
@@ -46176,7 +46160,7 @@ class G0 {
46176
46160
  const o = Y.getInstance().get("equipment").find((d) => d.name === t);
46177
46161
  if (!o || o.type !== "box")
46178
46162
  return null;
46179
- const c = e.equipment.items, l = Av.openBox(o, i, c);
46163
+ const c = e.equipment.items, l = kv.openBox(o, i, c);
46180
46164
  if (!l.success)
46181
46165
  return { character: e, result: l };
46182
46166
  if (l.consumedItems && l.consumedItems.length > 0)
@@ -46548,7 +46532,7 @@ class br {
46548
46532
  return e >= 7 && e <= 18 && t >= 275 && t <= 290 || e >= 33 && e <= 43 && t >= 124 && t <= 132 || e >= 36 && e <= 47 && t >= 8 && t <= 19 || e >= 36 && e <= 44 && t >= 358 && t <= 360 || e >= 36 && e <= 44 && t >= 0 && t <= 10 || e >= 55 && e <= 71 && t >= 4 && t <= 32 || e >= 24 && e <= 31 && t >= 268 && t <= 272 || e >= 55 && e <= 62 && t >= 210 && t <= 220 || e >= 50 && e <= 62 && t >= 156 && t <= 163;
46549
46533
  }
46550
46534
  }
46551
- class Mv {
46535
+ class Av {
46552
46536
  constructor() {
46553
46537
  this.logger = Se.for("MotionDetector"), this.isListening = !1, this.lastMotion = null, this.motionCallback = null, this.lastProcessedTime = 0, this.minSampleIntervalMs = 83, this.deltaBuffer = [], this.bufferSize = 24, this.confirmedActivity = "unknown", this.candidateActivity = null, this.candidateStartTime = 0, this.confirmationMs = 1500, this.handleMotion = (e) => {
46554
46538
  if (!this.isListening || !this.motionCallback) return;
@@ -46660,9 +46644,9 @@ class Mv {
46660
46644
  }
46661
46645
  const uc = re({
46662
46646
  id: z(),
46663
- main: G(),
46664
- description: G(),
46665
- icon: G().optional()
46647
+ main: q(),
46648
+ description: q(),
46649
+ icon: q().optional()
46666
46650
  }), dc = re({
46667
46651
  temp: z(),
46668
46652
  feels_like: z().optional(),
@@ -46679,13 +46663,13 @@ const uc = re({
46679
46663
  gust: z().optional()
46680
46664
  }), mc = re({
46681
46665
  all: z().min(0).max(100)
46682
- }), Iv = re({
46666
+ }), Mv = re({
46683
46667
  type: z().optional(),
46684
46668
  id: z().optional(),
46685
- country: G().optional(),
46669
+ country: q().optional(),
46686
46670
  sunrise: z().nonnegative(),
46687
46671
  sunset: z().nonnegative(),
46688
- pod: G().optional()
46672
+ pod: q().optional()
46689
46673
  // Part of day (d/n) - forecast only
46690
46674
  }), fc = re({
46691
46675
  "1h": z().optional(),
@@ -46698,10 +46682,10 @@ const uc = re({
46698
46682
  }), pc = re({
46699
46683
  lon: z().min(-180).max(180),
46700
46684
  lat: z().min(-90).max(90)
46701
- }), Dv = re({
46685
+ }), Iv = re({
46702
46686
  coord: pc.optional(),
46703
46687
  weather: Te(uc).min(1),
46704
- base: G().optional(),
46688
+ base: q().optional(),
46705
46689
  main: dc,
46706
46690
  visibility: z().nonnegative().optional(),
46707
46691
  wind: hc.optional(),
@@ -46709,12 +46693,12 @@ const uc = re({
46709
46693
  snow: gc.optional(),
46710
46694
  clouds: mc.optional(),
46711
46695
  dt: z().nonnegative(),
46712
- sys: Iv,
46696
+ sys: Mv,
46713
46697
  timezone: z().optional(),
46714
46698
  id: z().optional(),
46715
- name: G().optional(),
46699
+ name: q().optional(),
46716
46700
  cod: z().optional()
46717
- }), Ev = re({
46701
+ }), Dv = re({
46718
46702
  dt: z().nonnegative(),
46719
46703
  main: dc,
46720
46704
  weather: Te(uc).min(1),
@@ -46726,26 +46710,26 @@ const uc = re({
46726
46710
  rain: fc.optional(),
46727
46711
  snow: gc.optional(),
46728
46712
  sys: re({
46729
- pod: G().optional()
46713
+ pod: q().optional()
46730
46714
  }).optional(),
46731
- dt_txt: G().optional()
46732
- }), xv = re({
46733
- cod: ra([G(), z()]),
46715
+ dt_txt: q().optional()
46716
+ }), Ev = re({
46717
+ cod: ra([q(), z()]),
46734
46718
  message: z().optional(),
46735
46719
  cnt: z().nonnegative().optional(),
46736
- list: Te(Ev).min(1),
46720
+ list: Te(Dv).min(1),
46737
46721
  city: re({
46738
46722
  id: z(),
46739
- name: G(),
46723
+ name: q(),
46740
46724
  coord: pc,
46741
- country: G().optional(),
46725
+ country: q().optional(),
46742
46726
  population: z().optional(),
46743
46727
  timezone: z().optional(),
46744
46728
  sunrise: z().optional(),
46745
46729
  sunset: z().optional()
46746
46730
  }).optional()
46747
46731
  }), wr = "weather_api_cache";
46748
- class Rv {
46732
+ class xv {
46749
46733
  constructor(e, t, i) {
46750
46734
  if (this.baseUrl = "https://api.openweathermap.org/data/2.5/weather", this.forecastUrl = "https://api.openweathermap.org/data/2.5/forecast", this.cache = /* @__PURE__ */ new Map(), this.forecastCache = /* @__PURE__ */ new Map(), this.cacheTTL = 720 * 1e3, this.forecastCacheTTL = 3600 * 1e3, this.cacheStats = { hits: 0, misses: 0 }, this.logger = Se.for("WeatherAPIClient"), this.lastKnownLocation = null, this.weatherApiMetrics = {
46751
46735
  successCount: 0,
@@ -47100,8 +47084,8 @@ class Rv {
47100
47084
  const l = this.calculateJulianDate(c), u = this.calculateJulianCentury(l), d = this.calculateSolarDeclination(u), h = this.calculateHourAngle(e, d, o);
47101
47085
  if (isNaN(h))
47102
47086
  return /* @__PURE__ */ new Date(NaN);
47103
- const m = this.calculateEquationOfTime(u), f = (a ? -h : h) / 15, p = 12 - t / 15 - m / 60 + f, y = Math.floor(p), v = Math.floor((p - y) * 60), _ = Math.floor(((p - y) * 60 - v) * 60), T = new Date(i);
47104
- return T.setUTCHours(y, v, _, 0), T;
47087
+ const m = this.calculateEquationOfTime(u), f = (a ? -h : h) / 15, p = 12 - t / 15 - m / 60 + f, y = Math.floor(p), v = Math.floor((p - y) * 60), T = Math.floor(((p - y) * 60 - v) * 60), _ = new Date(i);
47088
+ return _.setUTCHours(y, v, T, 0), _;
47105
47089
  }
47106
47090
  /**
47107
47091
  * Calculate current sun position (altitude and azimuth)
@@ -47147,7 +47131,7 @@ class Rv {
47147
47131
  const o = `${this.baseUrl}?lat=${e}&lon=${t}&appid=${this.apiKey}&units=metric`, c = await fetch(o);
47148
47132
  if (!c.ok)
47149
47133
  throw new Error(`Weather API error: ${c.statusText}`);
47150
- const l = await c.json(), u = Dv.safeParse(l);
47134
+ const l = await c.json(), u = Iv.safeParse(l);
47151
47135
  if (!u.success)
47152
47136
  return this.logger.error("Weather API response validation failed", {
47153
47137
  errors: u.error.issues,
@@ -47266,7 +47250,7 @@ class Rv {
47266
47250
  const l = Math.ceil(n / 3), u = `${this.forecastUrl}?lat=${e}&lon=${t}&appid=${this.apiKey}&units=metric&cnt=${l}`, d = await fetch(u);
47267
47251
  if (!d.ok)
47268
47252
  throw new Error(`Weather Forecast API error: ${d.statusText}`);
47269
- const h = await d.json(), m = xv.safeParse(h);
47253
+ const h = await d.json(), m = Ev.safeParse(h);
47270
47254
  if (!m.success)
47271
47255
  return this.logger.error("Weather Forecast API response validation failed", {
47272
47256
  errors: m.error.issues,
@@ -47472,7 +47456,7 @@ function ya(s) {
47472
47456
  function H(s, e, t) {
47473
47457
  return t ? `${e}${s}${F.reset}` : s;
47474
47458
  }
47475
- function Pv(s, e) {
47459
+ function Rv(s, e) {
47476
47460
  switch (s) {
47477
47461
  case "healthy":
47478
47462
  return H("●", F.green, e);
@@ -47484,10 +47468,10 @@ function Pv(s, e) {
47484
47468
  return H("○", F.dim, e);
47485
47469
  }
47486
47470
  }
47487
- function Bv(s, e) {
47471
+ function Pv(s, e) {
47488
47472
  return s ? H("✓ Granted", F.green, e) : H("✗ Denied", F.red, e);
47489
47473
  }
47490
- function Nv(s, e) {
47474
+ function Bv(s, e) {
47491
47475
  return s ? H("Available", F.green, e) : H("Unavailable", F.red, e);
47492
47476
  }
47493
47477
  function va(s) {
@@ -47525,13 +47509,13 @@ function yc(s, e = {}) {
47525
47509
  const t = { ...pa, ...e }, i = ya(t), n = 60;
47526
47510
  console.log(ba("ENVIRONMENTAL SENSORS", n, i)), t.showTimestamp && (console.log(`${H("Timestamp:", F.dim, i)} ${va(s.timestamp)}`), console.log(`${H("Diagnostic Mode:", F.dim, i)} ${s.diagnosticMode ? H("ENABLED", F.yellow, i) : "Disabled"}`), console.log("")), console.log(H("┌─ SENSOR STATUS", F.cyan, i)), console.log(Pe(22) + (i ? F.reset : ""));
47527
47511
  for (const o of s.sensors) {
47528
- const c = Pv(o.status.health, i), l = H(
47512
+ const c = Rv(o.status.health, i), l = H(
47529
47513
  o.status.health.toUpperCase().padEnd(8),
47530
47514
  o.status.health === "healthy" ? F.green : o.status.health === "failed" ? F.red : F.yellow,
47531
47515
  i
47532
47516
  );
47533
47517
  if (console.log(`
47534
- ${H(o.type.toUpperCase().padEnd(12), F.bright, i)}`), console.log(` Health: ${c} ${l}`), console.log(` Permission: ${Bv(o.permission, i)}`), console.log(` Availability:${Nv(o.availability, i)}`), o.status.consecutiveFailures > 0 && console.log(` Failures: ${H(o.status.consecutiveFailures.toString(), F.red, i)} consecutive`), o.status.lastError) {
47518
+ ${H(o.type.toUpperCase().padEnd(12), F.bright, i)}`), console.log(` Health: ${c} ${l}`), console.log(` Permission: ${Pv(o.permission, i)}`), console.log(` Availability:${Bv(o.availability, i)}`), o.status.consecutiveFailures > 0 && console.log(` Failures: ${H(o.status.consecutiveFailures.toString(), F.red, i)} consecutive`), o.status.lastError) {
47535
47519
  const u = o.status.lastError.length > 40 ? o.status.lastError.substring(0, 37) + "..." : o.status.lastError;
47536
47520
  console.log(` Last Error: ${H(u, F.red, i)}`);
47537
47521
  }
@@ -47614,7 +47598,7 @@ ${H("┌─ API PERFORMANCE", F.cyan, i)}`), console.log(Pe(20) + (i ? F.reset :
47614
47598
  ${Pe(n)}
47615
47599
  `);
47616
47600
  }
47617
- function Fv(s, e = {}) {
47601
+ function Nv(s, e = {}) {
47618
47602
  const t = { ...pa, ...e }, i = ya(t);
47619
47603
  if (console.log(ba("SENSOR SYSTEM DASHBOARD", 70, i)), t.showTimestamp) {
47620
47604
  const a = s.environmental?.timestamp || s.gaming?.timestamp || Date.now();
@@ -47638,7 +47622,7 @@ function Fv(s, e = {}) {
47638
47622
  const bc = {
47639
47623
  displayEnvironmentalDiagnostics: yc,
47640
47624
  displayGamingDiagnostics: vc,
47641
- displaySystemDashboard: Fv
47625
+ displaySystemDashboard: Nv
47642
47626
  };
47643
47627
  class U0 {
47644
47628
  /**
@@ -47688,7 +47672,7 @@ class U0 {
47688
47672
  const a = e;
47689
47673
  i = a.weather?.apiKey ?? "", n = a.geolocation, a.retry && (this.retryConfig = { ...this.retryConfig, ...a.retry }), a.xpModifier && (this.xpConfig = { ...this.xpConfig, ...a.xpModifier });
47690
47674
  }
47691
- this.geolocation = n ? new br(n) : new br(), this.motion = new Mv(), this.weather = new Rv(i), this.initializeSensorStatuses();
47675
+ this.geolocation = n ? new br(n) : new br(), this.motion = new Av(), this.weather = new xv(i), this.initializeSensorStatuses();
47692
47676
  }
47693
47677
  /**
47694
47678
  * Initialize sensor statuses to 'unknown' state
@@ -48209,7 +48193,7 @@ class U0 {
48209
48193
  return this.weather.getSolarInfo(e, t, i);
48210
48194
  }
48211
48195
  }
48212
- class $v {
48196
+ class Fv {
48213
48197
  constructor(e = "") {
48214
48198
  this.baseUrl = "https://api.steampowered.com", this.logger = Se.for("SteamAPIClient"), this.currentGameApiMetrics = {
48215
48199
  successCount: 0,
@@ -48427,7 +48411,7 @@ class V0 {
48427
48411
  totalGamingMinutes: 0,
48428
48412
  gamesPlayedWhileListening: [],
48429
48413
  lastUpdated: Date.now()
48430
- }, this.contextCallback = null, this.gameMetadataCache = /* @__PURE__ */ new Map(), this.cacheExpiryMs = 864e5, "steam" in e && e.steam && (this.steamApiKey = e.steam.apiKey, this.steamUserId = e.steam.steamId, e.steam.pollInterval && (this.pollIntervalMs = e.steam.pollInterval)), "metadataCacheExpiry" in e && e.metadataCacheExpiry && (this.cacheExpiryMs = e.metadataCacheExpiry), "maxBackoffMs" in e && e.maxBackoffMs && (this.maxBackoffMs = e.maxBackoffMs), "xpModifier" in e && e.xpModifier && (this.xpConfig = { ...this.xpConfig, ...e.xpModifier }), this.steam = new $v(this.steamApiKey);
48414
+ }, this.contextCallback = null, this.gameMetadataCache = /* @__PURE__ */ new Map(), this.cacheExpiryMs = 864e5, "steam" in e && e.steam && (this.steamApiKey = e.steam.apiKey, this.steamUserId = e.steam.steamId, e.steam.pollInterval && (this.pollIntervalMs = e.steam.pollInterval)), "metadataCacheExpiry" in e && e.metadataCacheExpiry && (this.cacheExpiryMs = e.metadataCacheExpiry), "maxBackoffMs" in e && e.maxBackoffMs && (this.maxBackoffMs = e.maxBackoffMs), "xpModifier" in e && e.xpModifier && (this.xpConfig = { ...this.xpConfig, ...e.xpModifier }), this.steam = new Fv(this.steamApiKey);
48431
48415
  }
48432
48416
  /**
48433
48417
  * Authenticate with Steam
@@ -48601,7 +48585,7 @@ class V0 {
48601
48585
  bc.displayGamingDiagnostics(this.getDiagnostics(), e);
48602
48586
  }
48603
48587
  }
48604
- const Ov = {
48588
+ const $v = {
48605
48589
  geolocation: {
48606
48590
  cacheTTL: 300 * 1e3,
48607
48591
  // 5 minutes
@@ -48653,7 +48637,7 @@ const Ov = {
48653
48637
  backoffMultiplier: 2
48654
48638
  }
48655
48639
  };
48656
- function Lv() {
48640
+ function Ov() {
48657
48641
  const s = {};
48658
48642
  if (typeof process < "u" && process.env?.WEATHER_API_KEY && (s.weather = { ...s.weather, apiKey: process.env.WEATHER_API_KEY }), typeof process < "u" && process.env?.STEAM_API_KEY && (s.gaming = {
48659
48643
  ...s.gaming,
@@ -48668,8 +48652,8 @@ function Lv() {
48668
48652
  return s;
48669
48653
  }
48670
48654
  function j0(s = {}) {
48671
- const e = Lv();
48672
- return Kn(Ov, Kn(e, s));
48655
+ const e = Ov();
48656
+ return Kn($v, Kn(e, s));
48673
48657
  }
48674
48658
  function Kn(s, e) {
48675
48659
  const t = { ...s };
@@ -48679,7 +48663,7 @@ function Kn(s, e) {
48679
48663
  }
48680
48664
  return t;
48681
48665
  }
48682
- const zv = [
48666
+ const Lv = [
48683
48667
  0,
48684
48668
  300,
48685
48669
  900,
@@ -48702,7 +48686,7 @@ const zv = [
48702
48686
  355e3
48703
48687
  ], Lt = {
48704
48688
  xp: {
48705
- level_thresholds: zv,
48689
+ level_thresholds: Lv,
48706
48690
  xp_per_second: 1,
48707
48691
  xp_per_track_completion: 50,
48708
48692
  activity_bonuses: {
@@ -51360,7 +51344,7 @@ export {
51360
51344
  eu as AICombatRunner,
51361
51345
  vu as ALL_CLASSES,
51362
51346
  Q0 as ALL_ENCHANTMENTS,
51363
- s0 as ALL_GRID_TYPES,
51347
+ a0 as ALL_GRID_TYPES,
51364
51348
  wu as ALL_RACES,
51365
51349
  Z0 as ARMOR_ENCHANTMENTS,
51366
51350
  M0 as AVAILABLE_PRESETS,
@@ -51370,21 +51354,21 @@ export {
51370
51354
  Eg as ArweaveGatewayManager,
51371
51355
  Re as AttackResolver,
51372
51356
  hr as AudioAnalyzer,
51373
- Bb as AudioProfileSchema,
51357
+ Pb as AudioProfileSchema,
51374
51358
  zl as BASE_PLAYS_THRESHOLD,
51375
51359
  Wl as BASE_XP_THRESHOLD,
51376
- qv as BEAT_ACCURACY_THRESHOLDS,
51360
+ Hv as BEAT_ACCURACY_THRESHOLDS,
51377
51361
  Al as BEAT_DETECTION_ALGORITHM,
51378
51362
  kl as BEAT_DETECTION_VERSION,
51379
- Db as BalanceValidator,
51380
- wv as BalancedStrategy,
51363
+ Ib as BalanceValidator,
51364
+ bv as BalancedStrategy,
51381
51365
  ma as BeatConverter,
51382
51366
  Ni as BeatInterpolator,
51383
51367
  Ye as BeatMapGenerator,
51384
51368
  iv as BeatStream,
51385
51369
  Xt as BeatSubdivider,
51386
51370
  Qy as BeatTracker,
51387
- Av as BoxOpener,
51371
+ kv as BoxOpener,
51388
51372
  bn as ButtonMapper,
51389
51373
  bu as CLASS_AUDIO_PREFERENCES,
51390
51374
  tt as CLASS_DATA,
@@ -51394,7 +51378,7 @@ export {
51394
51378
  En as CR_TO_XP,
51395
51379
  J0 as CURSES,
51396
51380
  ua as CharacterGenerator,
51397
- Nb as CharacterSheetSchema,
51381
+ Bb as CharacterSheetSchema,
51398
51382
  W0 as CharacterUpdater,
51399
51383
  zn as ClassSuggester,
51400
51384
  D0 as ColorExtractor,
@@ -51403,7 +51387,7 @@ export {
51403
51387
  Ql as CombatMetricsTracker,
51404
51388
  $i as CombatSimulator,
51405
51389
  $u as CombatantAccumulator,
51406
- xb as ComparativeAnalyzer,
51390
+ Eb as ComparativeAnalyzer,
51407
51391
  qp as CompositeStreamGenerator,
51408
51392
  cc as DANCEABILITY_PRESETS,
51409
51393
  ec as DDR_PATTERN_LIBRARY,
@@ -51425,9 +51409,9 @@ export {
51425
51409
  Qs as DEFAULT_RACIAL_TRAITS,
51426
51410
  da as DEFAULT_RHYTHMIC_BALANCE_CONFIG,
51427
51411
  nt as DEFAULT_RHYTHM_XP_CONFIG,
51428
- Ov as DEFAULT_SENSOR_CONFIG,
51412
+ $v as DEFAULT_SENSOR_CONFIG,
51429
51413
  er as DEFAULT_SKILLS,
51430
- e0 as DEFAULT_SKILL_CATEGORIES,
51414
+ Qb as DEFAULT_SKILL_CATEGORIES,
51431
51415
  Ir as DEFAULT_SUBDIVISION_CONFIG,
51432
51416
  Cl as DEFAULT_SUBDIVISION_PLAYBACK_OPTIONS,
51433
51417
  Ko as DEFAULT_TEMPO_AWARE_CONFIG,
@@ -51437,8 +51421,8 @@ export {
51437
51421
  ue as DiceRoller,
51438
51422
  _s as DifficultyCalculator,
51439
51423
  Un as DifficultyVariantGenerator,
51440
- bv as DnD5eSmartStrategy,
51441
- vv as DnD5eStandardStrategy,
51424
+ vv as DnD5eSmartStrategy,
51425
+ yv as DnD5eStandardStrategy,
51442
51426
  yl as EASY_ACCURACY_THRESHOLDS,
51443
51427
  Dl as EASY_GROOVE_PENALTIES,
51444
51428
  Qp as EASY_QUARTER_NOTE_BPM,
@@ -51475,13 +51459,13 @@ export {
51475
51459
  Vs as KNOWN_GATEWAY_HOSTS,
51476
51460
  la as KNOWN_IPFS_GATEWAY_HOSTS,
51477
51461
  fa as LevelGenerator,
51478
- w0 as LevelSerializer,
51462
+ b0 as LevelSerializer,
51479
51463
  je as LevelUpProcessor,
51480
51464
  _g as LogLevel,
51481
51465
  Se as Logger,
51482
51466
  Jt as MAGIC_ITEMS,
51483
51467
  Su as MASTERY_BONUS_XP,
51484
- Cb as MASTERY_THRESHOLD,
51468
+ Tb as MASTERY_THRESHOLD,
51485
51469
  qa as MAX_BEATS_PER_MEASURE,
51486
51470
  ni as MAX_PRESTIGE_LEVEL,
51487
51471
  Ua as MAX_SUBDIVISION_DENSITY,
@@ -51491,8 +51475,8 @@ export {
51491
51475
  bl as MEL_BANDS_PRESETS,
51492
51476
  Ha as MIN_BEATS_PER_MEASURE,
51493
51477
  oc as MOOD_PRESETS,
51494
- Tv as ManualStrategy,
51495
- ee as MetadataExtractor,
51478
+ _v as ManualStrategy,
51479
+ J as MetadataExtractor,
51496
51480
  zg as ModelCache,
51497
51481
  Ip as MultiBandAnalyzer,
51498
51482
  I0 as MusicClassifier,
@@ -51501,34 +51485,34 @@ export {
51501
51485
  Ll as PRESTIGE_ROMAN_NUMERALS,
51502
51486
  ja as PRESTIGE_SCALING_FACTOR,
51503
51487
  Wr as PROFICIENCY_BONUS,
51504
- Eb as ParameterSweep,
51505
- k0 as PartyAnalyzer,
51488
+ Db as ParameterSweep,
51489
+ C0 as PartyAnalyzer,
51506
51490
  Bp as PhraseAnalyzer,
51507
- d0 as PitchAnalyzer,
51491
+ u0 as PitchAnalyzer,
51508
51492
  dy as PitchBeatLinker,
51509
51493
  Xo as PitchDetector,
51510
- A0 as PlaylistParser,
51494
+ k0 as PlaylistParser,
51511
51495
  Sg as PlaylistTrackSchema,
51512
51496
  Ce as PrestigeSystem,
51513
- Sv as PrimaryOnlyStrategy,
51514
- Ab as RACE_DATA,
51497
+ wv as PrimaryOnlyStrategy,
51498
+ kb as RACE_DATA,
51515
51499
  Nr as RARITY_CONFIGS,
51516
51500
  X0 as RESISTANCE_ENCHANTMENTS,
51517
51501
  Zo as RHYTHM_PRESETS,
51518
51502
  mp as RaceSelector,
51519
- _v as RandomStrategy,
51503
+ Sv as RandomStrategy,
51520
51504
  mt as RhythmGenerator,
51521
51505
  jo as RhythmQuantizer,
51522
51506
  H0 as RhythmXPCalculator,
51523
51507
  Zp as RhythmicBalancer,
51524
- Tb as SKILL_ABILITY_MAP,
51508
+ _b as SKILL_ABILITY_MAP,
51525
51509
  Lr as SPELL_DATABASE,
51526
51510
  ms as SPELL_SLOTS_BY_CLASS,
51527
51511
  Ge as SUBDIVISION_LIMITS,
51528
51512
  iu as SeededDiceRoller,
51529
51513
  Ve as SeededRNG,
51530
51514
  bc as SensorDashboard,
51531
- Pb as ServerlessPlaylistSchema,
51515
+ Rb as ServerlessPlaylistSchema,
51532
51516
  z0 as SessionTracker,
51533
51517
  Fu as SimulationAggregator,
51534
51518
  fp as SkillAssigner,
@@ -51539,10 +51523,10 @@ export {
51539
51523
  tr as SpellManager,
51540
51524
  it as SpellQuery,
51541
51525
  rt as SpellValidator,
51542
- kv as StatManager,
51526
+ Cv as StatManager,
51543
51527
  Lp as StreamScorer,
51544
51528
  L0 as SubdivisionPlaybackController,
51545
- Qv as TUNING_FACTORS,
51529
+ Jv as TUNING_FACTORS,
51546
51530
  Rp as TempoAwareQuantizer,
51547
51531
  Xy as TempoDetector,
51548
51532
  Ep as TransientDetector,
@@ -51553,7 +51537,7 @@ export {
51553
51537
  Yl as XP_BUDGET_PER_LEVEL,
51554
51538
  Ii as XP_THRESHOLDS,
51555
51539
  pw as applyTemplate,
51556
- eb as applyTuning,
51540
+ Qv as applyTuning,
51557
51541
  ep as areAppearanceDefaultsInitialized,
51558
51542
  lp as areClassDefaultsInitialized,
51559
51543
  sp as areEquipmentDefaultsInitialized,
@@ -51566,12 +51550,12 @@ export {
51566
51550
  fu as asClass,
51567
51551
  R0 as assignKeyToBeat,
51568
51552
  P0 as assignKeysToBeats,
51569
- mv as averageEmbeddings,
51570
- tb as calculateAdjustedXP,
51553
+ A0 as averageEmbeddings,
51554
+ eb as calculateAdjustedXP,
51571
51555
  Fl as calculateBeatInMeasure,
51572
51556
  iy as calculateMaxAchievableDensity,
51573
51557
  Sp as calculateStdDev,
51574
- jv as chartedBeatMapToBeatMap,
51558
+ Vv as chartedBeatMapToBeatMap,
51575
51559
  N0 as clearAllKeys,
51576
51560
  qe as constructGatewayUrl,
51577
51561
  Gn as convertToAllowedGridType,
@@ -51579,7 +51563,7 @@ export {
51579
51563
  ow as createConstitutionEnchantment,
51580
51564
  rw as createDexterityEnchantment,
51581
51565
  cw as createIntelligenceEnchantment,
51582
- Fb as createLogger,
51566
+ Nb as createLogger,
51583
51567
  bp as createMelFilterbank,
51584
51568
  tu as createSeededRoller,
51585
51569
  pr as createStatIncreaseStrategy,
@@ -51591,8 +51575,8 @@ export {
51591
51575
  Sn as detectModelArchitecture,
51592
51576
  yc as displayEnvironmentalDiagnostics,
51593
51577
  vc as displayGamingDiagnostics,
51594
- Fv as displaySystemDashboard,
51595
- i0 as ensureAllDefaultsInitialized,
51578
+ Nv as displaySystemDashboard,
51579
+ t0 as ensureAllDefaultsInitialized,
51596
51580
  xo as ensureAppearanceDefaultsInitialized,
51597
51581
  Lo as ensureClassDefaultsInitialized,
51598
51582
  Bo as ensureEquipmentDefaultsInitialized,
@@ -51601,45 +51585,45 @@ export {
51601
51585
  Fo as ensureRaceDefaultsInitialized,
51602
51586
  hp as ensureSkillDefaultsInitialized,
51603
51587
  Ln as ensureSpellDefaultsInitialized,
51604
- Qb as evaluateMixConditions,
51588
+ Jb as evaluateMixConditions,
51605
51589
  Rg as extractIPFSPath,
51606
51590
  B0 as extractKeyMap,
51607
51591
  Kp as findActiveSegment,
51608
51592
  Ot as formatModelForMetadata,
51609
51593
  qo as gaussianSmooth,
51610
- Xv as generateSeed,
51594
+ Zv as generateSeed,
51611
51595
  kn as getAccuracyThresholdsForPreset,
51612
51596
  nw as getAllCurses,
51613
51597
  iw as getAllEnchantments,
51614
- Yb as getAllGatewayUrls,
51598
+ Kb as getAllGatewayUrls,
51615
51599
  uu as getAllRarities,
51616
- o0 as getAllowedGridTypes,
51617
- zb as getArtists,
51618
- $b as getAudioUrls,
51600
+ r0 as getAllowedGridTypes,
51601
+ Lb as getArtists,
51602
+ Fb as getAudioUrls,
51619
51603
  Xl as getAveragePartyLevel,
51620
51604
  Br as getCRFromXP,
51621
51605
  zr as getClassData,
51622
51606
  fs as getClassSpellList,
51623
51607
  yp as getClassStartingEquipment,
51624
51608
  Pl as getConsecutiveKeyLimit,
51625
- a0 as getControllerModeBalanceDefaults,
51626
- n0 as getControllerModeScoringDefaults,
51609
+ n0 as getControllerModeBalanceDefaults,
51610
+ i0 as getControllerModeScoringDefaults,
51627
51611
  tw as getCurse,
51628
51612
  fw as getCursedItems,
51629
51613
  ew as getEnchantment,
51630
51614
  aw as getEnchantmentsByType,
51631
51615
  Mi as getEncounterMultiplier,
51632
- Ib as getFeatureQuery,
51633
- Vb as getFullTracks,
51616
+ Mb as getFeatureQuery,
51617
+ Ub as getFullTracks,
51634
51618
  Mr as getGaussianSmoothMs,
51635
51619
  hv as getGenreLabels,
51636
- Wb as getGenres,
51620
+ zb as getGenres,
51637
51621
  Rl as getGroovePenaltiesForPreset,
51638
51622
  en as getGrooveTier,
51639
51623
  Ml as getGrooveWindowMs,
51640
- ob as getHigherRarity,
51624
+ rb as getHigherRarity,
51641
51625
  kr as getHopSizeMs,
51642
- Ob as getImageUrls,
51626
+ $b as getImageUrls,
51643
51627
  gw as getItemsWithProperty,
51644
51628
  $0 as getKeyCount,
51645
51629
  dw as getMagicItem,
@@ -51647,48 +51631,48 @@ export {
51647
51631
  hw as getMagicItemsByType,
51648
51632
  Ar as getMelBands,
51649
51633
  Up as getMetricGroupSize,
51650
- Vv as getMinHotnessForTier,
51651
- v0 as getPatternById,
51652
- h0 as getPatternLibrary,
51653
- b0 as getPatternLibraryStats,
51654
- m0 as getPatternsByCategory,
51655
- f0 as getPatternsByDifficulty,
51656
- p0 as getPatternsByKeyCount,
51657
- g0 as getPatternsByTags,
51634
+ Uv as getMinHotnessForTier,
51635
+ y0 as getPatternById,
51636
+ d0 as getPatternLibrary,
51637
+ v0 as getPatternLibraryStats,
51638
+ h0 as getPatternsByCategory,
51639
+ m0 as getPatternsByDifficulty,
51640
+ g0 as getPatternsByKeyCount,
51641
+ f0 as getPatternsByTags,
51658
51642
  Xn as getRaceData,
51659
- Mb as getRaceDataAsync,
51660
- y0 as getRandomPattern,
51643
+ Ab as getRaceDataAsync,
51644
+ p0 as getRandomPattern,
51661
51645
  wt as getRarityConfig,
51662
- l0 as getRhythmPreset,
51663
- u0 as getRhythmPresetNames,
51664
- rb as getSignatureDie,
51665
- _b as getSkillQuery,
51666
- kb as getSpellQuery,
51646
+ c0 as getRhythmPreset,
51647
+ l0 as getRhythmPresetNames,
51648
+ sb as getSignatureDie,
51649
+ Sb as getSkillQuery,
51650
+ Cb as getSpellQuery,
51667
51651
  Hr as getSpellSlotsForClass,
51668
51652
  Dr as getSubdivisionDensity,
51669
- Hb as getTags,
51670
- nb as getTemplateById,
51671
- sb as getTemplatesByArchetype,
51672
- ab as getTemplatesByCategory,
51653
+ Wb as getTags,
51654
+ ib as getTemplateById,
51655
+ ab as getTemplatesByArchetype,
51656
+ nb as getTemplatesByCategory,
51673
51657
  at as getTempoAwareAllowedGridTypes,
51674
- qb as getTotalDuration,
51675
- Gb as getTrackCount,
51658
+ Hb as getTotalDuration,
51659
+ qb as getTrackCount,
51676
51660
  Wg as getTrackExtras,
51677
- Jb as getTrackMetadata,
51678
- Lb as getTrackTitles,
51679
- Ub as getTracks,
51661
+ Xb as getTrackMetadata,
51662
+ Ob as getTrackTitles,
51663
+ Gb as getTracks,
51680
51664
  O0 as getUsedKeys,
51681
- Kb as getVRMTracks,
51682
- jb as getVRMs,
51665
+ jb as getVRMTracks,
51666
+ Vb as getVRMs,
51683
51667
  Zn as getXPBudgetForParty,
51684
51668
  Zl as getXPBudgetPerLevel,
51685
51669
  Pr as getXPForCR,
51686
51670
  F0 as hasRequiredKeys,
51687
51671
  ht as hashSeedToFloat,
51688
- Jv as hashSeedToInt,
51672
+ Xv as hashSeedToInt,
51689
51673
  wp as highPassFilter,
51690
51674
  nr as hzToMel,
51691
- t0 as initializeAllDefaults,
51675
+ e0 as initializeAllDefaults,
51692
51676
  Eo as initializeAppearanceDefaults,
51693
51677
  Oo as initializeClassDefaults,
51694
51678
  Po as initializeEquipmentDefaults,
@@ -51699,24 +51683,24 @@ export {
51699
51683
  Ro as initializeSpellDefaults,
51700
51684
  Wt as isArweaveUrl,
51701
51685
  $l as isFullBeatMapExportData,
51702
- r0 as isGridTypeAllowed,
51703
- Zb as isIPFS,
51686
+ s0 as isGridTypeAllowed,
51687
+ Yb as isIPFS,
51704
51688
  Ol as isLevelPackExport,
51705
51689
  Vp as isMetricStrongBeat,
51706
51690
  jp as isMetricWeakBeat,
51707
- Yv as isPrestigeLevel,
51691
+ Kv as isPrestigeLevel,
51708
51692
  fr as isSingleStepModel,
51709
51693
  Yp as isStrongBeatForEmphasis,
51710
51694
  Ai as isTwoStepModel,
51711
- Zv as isValidAIPlayStyle,
51695
+ Yv as isValidAIPlayStyle,
51712
51696
  Xa as isValidClass,
51713
- C0 as isValidEncounterDifficulty,
51714
- ib as isValidEncounterDifficultyUtil,
51715
- T0 as isValidEnemyArchetype,
51716
- S0 as isValidEnemyCategory,
51717
- _0 as isValidEnemyRarity,
51697
+ T0 as isValidEncounterDifficulty,
51698
+ tb as isValidEncounterDifficultyUtil,
51699
+ _0 as isValidEnemyArchetype,
51700
+ w0 as isValidEnemyCategory,
51701
+ S0 as isValidEnemyRarity,
51718
51702
  Mn as isValidSubdivisionType,
51719
- Lv as loadConfigFromEnv,
51703
+ Ov as loadConfigFromEnv,
51720
51704
  Nl as mapGridToSubdivision,
51721
51705
  vp as melToHz,
51722
51706
  xr as mergeButtonMappingConfig,
@@ -51724,38 +51708,38 @@ export {
51724
51708
  K0 as mergeProgressionConfig,
51725
51709
  Pn as mergeRhythmXPConfig,
51726
51710
  Ht as modelCache,
51727
- c0 as naturalDifficultyToLevel,
51711
+ o0 as naturalDifficultyToLevel,
51728
51712
  Nt as parseArweaveUrl,
51729
51713
  _p as performBeatFFT,
51730
51714
  Go as performSTFT,
51731
- Hv as reapplyDownbeatConfig,
51715
+ Wv as reapplyDownbeatConfig,
51732
51716
  Hi as resampleAudio,
51733
- Xb as resolveIPFSLink,
51734
- Rb as shouldAccuracyBreakCombo,
51717
+ Zb as resolveIPFSLink,
51718
+ xb as shouldAccuracyBreakCombo,
51735
51719
  x0 as subdivideBeatMap,
51736
51720
  Hl as toPrestigeLevel,
51737
51721
  Vn as unifyBeatMap,
51738
51722
  Bl as validateButtonMappingConfig,
51739
- cb as validateClassFeature,
51740
- ub as validateClassFeatures,
51723
+ ob as validateClassFeature,
51724
+ lb as validateClassFeatures,
51741
51725
  _r as validateDownbeatConfig,
51742
51726
  Tr as validateDownbeatConfigAgainstBeats,
51743
- lb as validateRacialTrait,
51744
- db as validateRacialTraits,
51745
- hb as validateSkill,
51746
- pb as validateSkillListDefinition,
51747
- yb as validateSkillPrerequisites,
51748
- gb as validateSkillProficiencies,
51749
- fb as validateSkillProficiency,
51750
- mb as validateSkills,
51751
- vb as validateSpell,
51752
- Sb as validateSpellPrerequisites,
51753
- wb as validateSpellPrerequisitesSchema,
51754
- bb as validateSpells,
51727
+ cb as validateRacialTrait,
51728
+ ub as validateRacialTraits,
51729
+ db as validateSkill,
51730
+ gb as validateSkillListDefinition,
51731
+ pb as validateSkillPrerequisites,
51732
+ fb as validateSkillProficiencies,
51733
+ mb as validateSkillProficiency,
51734
+ hb as validateSkills,
51735
+ yb as validateSpell,
51736
+ wb as validateSpellPrerequisites,
51737
+ bb as validateSpellPrerequisitesSchema,
51738
+ vb as validateSpells,
51755
51739
  Er as validateSubdivisionConfig,
51756
51740
  Tl as validateSubdivisionConfigAgainstBeats,
51757
- Uv as validateSubdivisionDensity,
51741
+ Gv as validateSubdivisionDensity,
51758
51742
  ay as validateSubdivisionLimits,
51759
- Gv as validateThresholds,
51760
- Kv as validateTrackMatch
51743
+ qv as validateThresholds,
51744
+ jv as validateTrackMatch
51761
51745
  };