playlist-data-engine 1.5.6 → 1.5.8

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() {
@@ -17695,7 +17755,7 @@ async function Ag() {
17695
17755
  const Mg = "https://solana-rpc.publicnode.com", Ig = 5e3, Dg = 864e5, hn = "arweave_active_gateway", mn = "arweave_ranked_gateways";
17696
17756
  class Eg {
17697
17757
  constructor(e) {
17698
- this.cache = /* @__PURE__ */ new Map(), this.logger = Se.for("ArweaveGateway"), this.hitCount = 0, this.missCount = 0, this.healthData = /* @__PURE__ */ new Map(), this.originalPriorities = /* @__PURE__ */ new Map(), this.MAX_HEALTH_RECORDS = 50, this.inflightResolves = /* @__PURE__ */ new Map(), this.inflightControllers = /* @__PURE__ */ new Map(), this.wayfinder = null, this.wayfinderGatewaysProvider = null, this.rankedGatewaysCache = null, this.rankedGatewaysCacheTimestamp = 0, this.RANKED_GATEWAYS_TTL_MS = 7200 * 1e3, this.activeGateway = null, this.lastFetchTiming = 0, this.consecutiveSlowResponses = 0, this.gateways = (e?.gateways ?? Mo).map((i) => ({ ...i })), this.timeout = e?.timeout ?? Ig, this.cacheTTL = e?.cacheTTL ?? Dg, this.slowResponseThreshold = e?.slowResponseThreshold ?? 8e3, this.maxSlowResponses = e?.maxSlowResponses ?? 3, this.solanaRpcUrl = e?.solanaRpcUrl ?? Mg, this.hasCustomSolanaRpc = typeof e?.solanaRpcUrl == "string" && e.solanaRpcUrl.length > 0, this.wayfinderSortBy = e?.wayfinderSortBy ?? "weights.compositeWeight", this.wayfinderPrimaryLimit = e?.wayfinderPrimaryLimit ?? 50, this.wayfinderFallbackLimit = e?.wayfinderFallbackLimit ?? 100, this.wayfinderStrategy = e?.wayfinderStrategy ?? "composite-ping-random", this.gateways.sort((i, n) => i.priority - n.priority), this.gateways.forEach((i) => {
17758
+ this.cache = /* @__PURE__ */ new Map(), this.logger = Se.for("ArweaveGateway"), this.hitCount = 0, this.missCount = 0, this.healthData = /* @__PURE__ */ new Map(), this.originalPriorities = /* @__PURE__ */ new Map(), this.MAX_HEALTH_RECORDS = 50, this.inflightResolves = /* @__PURE__ */ new Map(), this.inflightControllers = /* @__PURE__ */ new Map(), this.wayfinder = null, this.wayfinderGatewaysProvider = null, this.rankedGatewaysCache = null, this.rankedGatewaysCacheTimestamp = 0, this.RANKED_GATEWAYS_TTL_MS = 1440 * 60 * 1e3, this.activeGateway = null, this.lastFetchTiming = 0, this.consecutiveSlowResponses = 0, this.gateways = (e?.gateways ?? Mo).map((i) => ({ ...i })), this.timeout = e?.timeout ?? Ig, this.cacheTTL = e?.cacheTTL ?? Dg, this.slowResponseThreshold = e?.slowResponseThreshold ?? 8e3, this.maxSlowResponses = e?.maxSlowResponses ?? 3, this.solanaRpcUrl = e?.solanaRpcUrl ?? Mg, this.hasCustomSolanaRpc = typeof e?.solanaRpcUrl == "string" && e.solanaRpcUrl.length > 0, this.wayfinderSortBy = e?.wayfinderSortBy ?? "weights.compositeWeight", this.wayfinderPrimaryLimit = e?.wayfinderPrimaryLimit ?? 50, this.wayfinderFallbackLimit = e?.wayfinderFallbackLimit ?? 100, this.wayfinderStrategy = e?.wayfinderStrategy ?? "composite-ping-random", this.gateways.sort((i, n) => i.priority - n.priority), this.gateways.forEach((i) => {
17699
17759
  this.originalPriorities.set(i.host, i.priority);
17700
17760
  }), this.activeGateway = this.loadPersistedGateway();
17701
17761
  const t = this.loadPersistedRankedGateways();
@@ -17708,15 +17768,19 @@ class Eg {
17708
17768
  CompositeRoutingStrategy: c,
17709
17769
  RoundRobinRoutingStrategy: l,
17710
17770
  NetworkGatewaysProvider: u
17711
- } = i, d = n.ARIO, h = a.createSolanaRpc(this.solanaRpcUrl), m = d.init({ rpc: h }), f = new u({
17712
- ario: m,
17713
- sortBy: this.wayfinderSortBy,
17714
- limit: this.wayfinderPrimaryLimit
17715
- }), g = new u({
17716
- ario: m,
17717
- sortBy: this.wayfinderSortBy,
17718
- limit: this.wayfinderFallbackLimit
17719
- });
17771
+ } = i, d = n.ARIO, h = a.createSolanaRpc(this.solanaRpcUrl), m = d.init({ rpc: h }), f = this.wrapProviderWithCache(
17772
+ new u({
17773
+ ario: m,
17774
+ sortBy: this.wayfinderSortBy,
17775
+ limit: this.wayfinderPrimaryLimit
17776
+ })
17777
+ ), g = this.wrapProviderWithCache(
17778
+ new u({
17779
+ ario: m,
17780
+ sortBy: this.wayfinderSortBy,
17781
+ limit: this.wayfinderFallbackLimit
17782
+ })
17783
+ );
17720
17784
  this.wayfinderGatewaysProvider = f;
17721
17785
  const p = (() => {
17722
17786
  switch (this.wayfinderStrategy) {
@@ -17771,6 +17835,40 @@ class Eg {
17771
17835
  );
17772
17836
  });
17773
17837
  }
17838
+ /**
17839
+ * Wrap a raw upstream gateways provider (NetworkGatewaysProvider) in a
17840
+ * long-TTL cache. This is the single lever that keeps us off the Solana
17841
+ * RPC (Helius): every Wayfinder routing strategy and the ranked walk in
17842
+ * tryWayfinder() read through this wrapper, so the upstream is queried at
17843
+ * most once per RANKED_GATEWAYS_TTL_MS regardless of how many resolves fail.
17844
+ *
17845
+ * Behaviour:
17846
+ * - Fresh cache → return immediately, no network.
17847
+ * - Cache miss → one upstream fetch; concurrent callers share the in-flight
17848
+ * promise (dedupe) so we never fire two fetches for the same refresh.
17849
+ * - Fetch fails → serve the stale in-memory list if present (better than
17850
+ * empty); otherwise let the upstream's [] fall through. This keeps a
17851
+ * Helius rate-limit blip from restarting the hammering.
17852
+ * - On success → write to both in-memory cache and localStorage so the
17853
+ * list survives reloads.
17854
+ */
17855
+ wrapProviderWithCache(e) {
17856
+ let t = null, i = 0, n = null;
17857
+ const a = () => t !== null && t.length > 0 && Date.now() < i, o = this.loadPersistedRankedGateways();
17858
+ return o && o.length > 0 && (t = o, i = (this.rankedGatewaysCacheTimestamp || Date.now()) + this.RANKED_GATEWAYS_TTL_MS), {
17859
+ getGateways: async () => a() ? t : n || (n = (async () => {
17860
+ try {
17861
+ const c = await e.getGateways();
17862
+ return c && c.length > 0 && (t = c, i = Date.now() + this.RANKED_GATEWAYS_TTL_MS, this.rankedGatewaysCacheTimestamp = Date.now(), this.rankedGatewaysCache = c, this.persistRankedGateways(c, this.rankedGatewaysCacheTimestamp)), c;
17863
+ } catch (c) {
17864
+ if (this.logger.warn("Ranked gateway fetch failed, serving stale list", { error: c }), t && t.length > 0) return t;
17865
+ throw c;
17866
+ } finally {
17867
+ n = null;
17868
+ }
17869
+ })(), n)
17870
+ };
17871
+ }
17774
17872
  /**
17775
17873
  * Resolve an Arweave URL to a gateway URL using the active gateway, with no network checks.
17776
17874
  *
@@ -17895,12 +17993,12 @@ class Eg {
17895
17993
  // includes port if present
17896
17994
  protocol: g.protocol.replace(":", ""),
17897
17995
  priority: 0
17898
- }, 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;
17899
17997
  if (v) {
17900
- 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;
17901
17999
  l ??= v.url;
17902
18000
  } else
17903
- 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 });
17904
18002
  c = p.host;
17905
18003
  } catch {
17906
18004
  }
@@ -18065,14 +18163,14 @@ class Eg {
18065
18163
  if (n?.aborted || f.length === 0) return null;
18066
18164
  const g = new AbortController(), p = () => g.abort();
18067
18165
  n?.addEventListener("abort", p, { once: !0 });
18068
- let y = null, v = null, _ = !1;
18166
+ let y = null, v = null, T = !1;
18069
18167
  try {
18070
- const T = await Promise.allSettled(
18168
+ const _ = await Promise.allSettled(
18071
18169
  f.map(async (S) => {
18072
18170
  const I = await this.checkGateway(t, S, i, g.signal);
18073
18171
  if (!I) throw new Error(`Gateway ${S.host} failed check`);
18074
18172
  const D = qe(t, S, i), R = I === !0 ? "verified" : "maybe";
18075
- 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", {
18076
18174
  txId: t,
18077
18175
  gateway: S.host,
18078
18176
  pathSuffix: i,
@@ -18085,7 +18183,7 @@ class Eg {
18085
18183
  })), { kind: R, url: D };
18086
18184
  })
18087
18185
  );
18088
- for (const S of T) {
18186
+ for (const S of _) {
18089
18187
  if (S.status !== "fulfilled") continue;
18090
18188
  const I = S.value;
18091
18189
  if (I.kind === "verified" && !y ? y = { kind: "verified", url: I.url } : I.kind === "maybe" && !v && (v = { kind: "maybe", url: I.url }), y) break;
@@ -18107,34 +18205,23 @@ class Eg {
18107
18205
  return m;
18108
18206
  }
18109
18207
  /**
18110
- * Try Wayfinder as a last resort when all static gateways fail.
18111
- * Returns the URL of a working Wayfinder-selected gateway, or null if it fails.
18112
- */
18113
- /**
18114
- * Return the ranked gateway list from the primary `NetworkGatewaysProvider`,
18115
- * using an in-memory cache to avoid hitting Solana on every walk. Returns null
18116
- * if the provider is unavailable or the fetch fails.
18208
+ * Return the ranked gateway list. The provider itself is already wrapped in
18209
+ * the 24h cache (see wrapProviderWithCache), so this is now a thin reader —
18210
+ * no separate fetch, TTL, or stale logic here. Kept as an indirection point
18211
+ * so tryWayfinder's Step B reads through a named method. Returns null if the
18212
+ * provider is unavailable or both fetch and stale fallback fail.
18117
18213
  */
18118
18214
  async getRankedGatewaysCached(e) {
18119
18215
  if (!this.wayfinderGatewaysProvider) return null;
18120
- const t = Date.now(), i = t - this.rankedGatewaysCacheTimestamp;
18121
- if (this.rankedGatewaysCache && i < this.RANKED_GATEWAYS_TTL_MS)
18122
- return this.logger.debug("Reusing cached ranked gateway list", {
18123
- size: this.rankedGatewaysCache.length,
18124
- ageMs: i
18125
- }), this.rankedGatewaysCache;
18126
18216
  try {
18127
- const n = await this.withTimeout(
18217
+ const t = await this.withTimeout(
18128
18218
  this.wayfinderGatewaysProvider.getGateways(),
18129
18219
  this.timeout + 2e3,
18130
18220
  "Wayfinder provider getGateways timed out"
18131
18221
  );
18132
- return e?.aborted ? null : (this.rankedGatewaysCache = n, this.rankedGatewaysCacheTimestamp = t, this.persistRankedGateways(n, t), this.logger.info("Refreshed ranked gateway list cache", { size: n.length }), n);
18133
- } catch (n) {
18134
- return this.logger.debug("Failed to fetch ranked gateway list from provider", { error: n }), this.rankedGatewaysCache ? (this.logger.debug("Falling back to stale ranked gateway cache", {
18135
- size: this.rankedGatewaysCache.length,
18136
- ageMs: i
18137
- }), this.rankedGatewaysCache) : null;
18222
+ return e?.aborted ? null : t && t.length > 0 ? t : null;
18223
+ } catch (t) {
18224
+ return this.logger.debug("Ranked gateway list unavailable", { error: t }), null;
18138
18225
  }
18139
18226
  }
18140
18227
  async tryWayfinder(e, t, i, n) {
@@ -18731,12 +18818,12 @@ class Eg {
18731
18818
  const g = Date.now();
18732
18819
  let p = !1, y = this.timeout;
18733
18820
  try {
18734
- 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, {
18735
18822
  method: "HEAD",
18736
18823
  mode: "cors",
18737
- signal: _.signal
18824
+ signal: T.signal
18738
18825
  });
18739
- 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;
18740
18827
  } catch {
18741
18828
  y = Date.now() - g, p = !1;
18742
18829
  }
@@ -18825,7 +18912,7 @@ function Rg(s) {
18825
18912
  }
18826
18913
  return null;
18827
18914
  }
18828
- function Zb(s) {
18915
+ function Yb(s) {
18829
18916
  if (!s || typeof s != "string") return !1;
18830
18917
  if (s.startsWith("ipfs://")) return !0;
18831
18918
  try {
@@ -18848,7 +18935,7 @@ function Pg(s) {
18848
18935
  return;
18849
18936
  }
18850
18937
  }
18851
- function Xb(s, e = {}) {
18938
+ function Zb(s, e = {}) {
18852
18939
  if (!s) return s;
18853
18940
  const t = typeof e == "string" ? { gatewayHost: e } : e, { gatewayHost: i = xg, preserveOriginalGateway: n = !1 } = t, a = Rg(s);
18854
18941
  if (a) {
@@ -18970,8 +19057,8 @@ function Bg() {
18970
19057
  var R;
18971
19058
  try {
18972
19059
  R = I(D);
18973
- } catch (q) {
18974
- return o.reject(S, q);
19060
+ } catch (U) {
19061
+ return o.reject(S, U);
18975
19062
  }
18976
19063
  R === S ? o.reject(S, new TypeError("Cannot resolve promise with itself")) : o.resolve(S, R);
18977
19064
  });
@@ -18985,8 +19072,8 @@ function Bg() {
18985
19072
  g(S, R);
18986
19073
  else {
18987
19074
  S.state = l, S.outcome = I;
18988
- for (var q = -1, O = S.queue.length; ++q < O; )
18989
- S.queue[q].callFulfilled(I);
19075
+ for (var U = -1, O = S.queue.length; ++U < O; )
19076
+ S.queue[U].callFulfilled(I);
18990
19077
  }
18991
19078
  return S;
18992
19079
  }, o.reject = function(S, I) {
@@ -19007,11 +19094,11 @@ function Bg() {
19007
19094
  function R(Z) {
19008
19095
  D || (D = !0, o.reject(S, Z));
19009
19096
  }
19010
- function q(Z) {
19097
+ function U(Z) {
19011
19098
  D || (D = !0, o.resolve(S, Z));
19012
19099
  }
19013
19100
  function O() {
19014
- I(q, R);
19101
+ I(U, R);
19015
19102
  }
19016
19103
  var W = p(O);
19017
19104
  W.status === "error" && R(W.value);
@@ -19034,42 +19121,42 @@ function Bg() {
19034
19121
  var I = new this(r);
19035
19122
  return o.reject(I, S);
19036
19123
  }
19037
- d.all = _;
19038
- function _(S) {
19124
+ d.all = T;
19125
+ function T(S) {
19039
19126
  var I = this;
19040
19127
  if (Object.prototype.toString.call(S) !== "[object Array]")
19041
19128
  return this.reject(new TypeError("must be an array"));
19042
19129
  var D = S.length, R = !1;
19043
19130
  if (!D)
19044
19131
  return this.resolve([]);
19045
- for (var q = new Array(D), O = 0, W = -1, Z = new this(r); ++W < D; )
19046
- 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);
19047
19134
  return Z;
19048
- function Q(se, oe) {
19135
+ function te(se, oe) {
19049
19136
  I.resolve(se).then(j, function(X) {
19050
19137
  R || (R = !0, o.reject(Z, X));
19051
19138
  });
19052
19139
  function j(X) {
19053
- 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));
19054
19141
  }
19055
19142
  }
19056
19143
  }
19057
- d.race = T;
19058
- function T(S) {
19144
+ d.race = _;
19145
+ function _(S) {
19059
19146
  var I = this;
19060
19147
  if (Object.prototype.toString.call(S) !== "[object Array]")
19061
19148
  return this.reject(new TypeError("must be an array"));
19062
19149
  var D = S.length, R = !1;
19063
19150
  if (!D)
19064
19151
  return this.resolve([]);
19065
- for (var q = -1, O = new this(r); ++q < D; )
19066
- W(S[q]);
19152
+ for (var U = -1, O = new this(r); ++U < D; )
19153
+ W(S[U]);
19067
19154
  return O;
19068
19155
  function W(Z) {
19069
- I.resolve(Z).then(function(Q) {
19070
- R || (R = !0, o.resolve(O, Q));
19071
- }, function(Q) {
19072
- 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));
19073
19160
  });
19074
19161
  }
19075
19162
  }
@@ -19149,7 +19236,7 @@ function Bg() {
19149
19236
  if (arguments.length && typeof arguments[arguments.length - 1] == "function")
19150
19237
  return arguments[arguments.length - 1];
19151
19238
  }
19152
- 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";
19153
19240
  function I(b) {
19154
19241
  for (var C = b.length, w = new ArrayBuffer(C), A = new Uint8Array(w), M = 0; M < C; M++)
19155
19242
  A[M] = b.charCodeAt(M);
@@ -19173,7 +19260,7 @@ function Bg() {
19173
19260
  return y = C, y;
19174
19261
  });
19175
19262
  }
19176
- function q(b) {
19263
+ function U(b) {
19177
19264
  var C = v[b.name], w = {};
19178
19265
  w.promise = new d(function(A, M) {
19179
19266
  w.resolve = A, w.reject = M;
@@ -19195,7 +19282,7 @@ function Bg() {
19195
19282
  return new d(function(w, A) {
19196
19283
  if (v[b.name] = v[b.name] || le(), b.db)
19197
19284
  if (C)
19198
- q(b), b.db.close();
19285
+ U(b), b.db.close();
19199
19286
  else
19200
19287
  return w(b.db);
19201
19288
  var M = [b.name];
@@ -19221,7 +19308,7 @@ function Bg() {
19221
19308
  };
19222
19309
  });
19223
19310
  }
19224
- function Q(b) {
19311
+ function te(b) {
19225
19312
  return Z(b, !1);
19226
19313
  }
19227
19314
  function se(b) {
@@ -19269,12 +19356,12 @@ function Bg() {
19269
19356
  return m(w, b, b), w;
19270
19357
  }
19271
19358
  function Qt(b) {
19272
- q(b);
19359
+ U(b);
19273
19360
  for (var C = v[b.name], w = C.forages, A = 0; A < w.length; A++) {
19274
19361
  var M = w[A];
19275
19362
  M._dbInfo.db && (M._dbInfo.db.close(), M._dbInfo.db = null);
19276
19363
  }
19277
- return b.db = null, Q(b).then(function(k) {
19364
+ return b.db = null, te(b).then(function(k) {
19278
19365
  return b.db = k, oe(b) ? se(b) : k;
19279
19366
  }).then(function(k) {
19280
19367
  b.db = C.db = k;
@@ -19284,7 +19371,7 @@ function Bg() {
19284
19371
  throw W(b, k), k;
19285
19372
  });
19286
19373
  }
19287
- function J(b, C, w, A) {
19374
+ function Q(b, C, w, A) {
19288
19375
  A === void 0 && (A = 1);
19289
19376
  try {
19290
19377
  var M = b.db.transaction(b.storeName, C);
@@ -19296,7 +19383,7 @@ function Bg() {
19296
19383
  return b.db && (b.version = b.db.version + 1), se(b);
19297
19384
  }).then(function() {
19298
19385
  return Qt(b).then(function() {
19299
- J(b, C, w, A - 1);
19386
+ Q(b, C, w, A - 1);
19300
19387
  });
19301
19388
  }).catch(w);
19302
19389
  w(k);
@@ -19333,14 +19420,14 @@ function Bg() {
19333
19420
  }
19334
19421
  var N = M.forages.slice(0);
19335
19422
  return d.all(k).then(function() {
19336
- return w.db = M.db, Q(w);
19423
+ return w.db = M.db, te(w);
19337
19424
  }).then(function($) {
19338
19425
  return w.db = $, oe(w, C._defaultConfig.version) ? se(w) : $;
19339
19426
  }).then(function($) {
19340
19427
  w.db = M.db = $, C._dbInfo = w;
19341
19428
  for (var V = 0; V < N.length; V++) {
19342
- var te = N[V];
19343
- 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);
19344
19431
  }
19345
19432
  });
19346
19433
  }
@@ -19349,7 +19436,7 @@ function Bg() {
19349
19436
  b = f(b);
19350
19437
  var A = new d(function(M, k) {
19351
19438
  w.ready().then(function() {
19352
- J(w._dbInfo, T, function(x, P) {
19439
+ Q(w._dbInfo, _, function(x, P) {
19353
19440
  if (x)
19354
19441
  return k(x);
19355
19442
  try {
@@ -19371,7 +19458,7 @@ function Bg() {
19371
19458
  function _a(b, C) {
19372
19459
  var w = this, A = new d(function(M, k) {
19373
19460
  w.ready().then(function() {
19374
- J(w._dbInfo, T, function(x, P) {
19461
+ Q(w._dbInfo, _, function(x, P) {
19375
19462
  if (x)
19376
19463
  return k(x);
19377
19464
  try {
@@ -19379,9 +19466,9 @@ function Bg() {
19379
19466
  N.onsuccess = function() {
19380
19467
  var V = N.result;
19381
19468
  if (V) {
19382
- var te = V.value;
19383
- fe(te) && (te = X(te));
19384
- var ie = b(te, V.key, $++);
19469
+ var ee = V.value;
19470
+ fe(ee) && (ee = X(ee));
19471
+ var ie = b(ee, V.key, $++);
19385
19472
  ie !== void 0 ? M(ie) : V.continue();
19386
19473
  } else
19387
19474
  M();
@@ -19402,21 +19489,21 @@ function Bg() {
19402
19489
  var M = new d(function(k, x) {
19403
19490
  var P;
19404
19491
  A.ready().then(function() {
19405
- 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) {
19406
19493
  return B ? C : j(C);
19407
19494
  }) : C;
19408
19495
  }).then(function(B) {
19409
- J(A._dbInfo, S, function(N, $) {
19496
+ Q(A._dbInfo, S, function(N, $) {
19410
19497
  if (N)
19411
19498
  return x(N);
19412
19499
  try {
19413
19500
  var V = $.objectStore(A._dbInfo.storeName);
19414
19501
  B === null && (B = void 0);
19415
- var te = V.put(B, b);
19502
+ var ee = V.put(B, b);
19416
19503
  $.oncomplete = function() {
19417
19504
  B === void 0 && (B = null), k(B);
19418
19505
  }, $.onabort = $.onerror = function() {
19419
- var ie = te.error ? te.error : te.transaction.error;
19506
+ var ie = ee.error ? ee.error : ee.transaction.error;
19420
19507
  x(ie);
19421
19508
  };
19422
19509
  } catch (ie) {
@@ -19432,7 +19519,7 @@ function Bg() {
19432
19519
  b = f(b);
19433
19520
  var A = new d(function(M, k) {
19434
19521
  w.ready().then(function() {
19435
- J(w._dbInfo, S, function(x, P) {
19522
+ Q(w._dbInfo, S, function(x, P) {
19436
19523
  if (x)
19437
19524
  return k(x);
19438
19525
  try {
@@ -19456,7 +19543,7 @@ function Bg() {
19456
19543
  function _c(b) {
19457
19544
  var C = this, w = new d(function(A, M) {
19458
19545
  C.ready().then(function() {
19459
- J(C._dbInfo, S, function(k, x) {
19546
+ Q(C._dbInfo, S, function(k, x) {
19460
19547
  if (k)
19461
19548
  return M(k);
19462
19549
  try {
@@ -19478,7 +19565,7 @@ function Bg() {
19478
19565
  function Tc(b) {
19479
19566
  var C = this, w = new d(function(A, M) {
19480
19567
  C.ready().then(function() {
19481
- J(C._dbInfo, T, function(k, x) {
19568
+ Q(C._dbInfo, _, function(k, x) {
19482
19569
  if (k)
19483
19570
  return M(k);
19484
19571
  try {
@@ -19503,7 +19590,7 @@ function Bg() {
19503
19590
  return;
19504
19591
  }
19505
19592
  w.ready().then(function() {
19506
- J(w._dbInfo, T, function(x, P) {
19593
+ Q(w._dbInfo, _, function(x, P) {
19507
19594
  if (x)
19508
19595
  return k(x);
19509
19596
  try {
@@ -19529,7 +19616,7 @@ function Bg() {
19529
19616
  function kc(b) {
19530
19617
  var C = this, w = new d(function(A, M) {
19531
19618
  C.ready().then(function() {
19532
- J(C._dbInfo, T, function(k, x) {
19619
+ Q(C._dbInfo, _, function(k, x) {
19533
19620
  if (k)
19534
19621
  return M(k);
19535
19622
  try {
@@ -19560,7 +19647,7 @@ function Bg() {
19560
19647
  if (!b.name)
19561
19648
  M = d.reject("Invalid arguments");
19562
19649
  else {
19563
- 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) {
19564
19651
  var B = v[b.name], N = B.forages;
19565
19652
  B.db = P;
19566
19653
  for (var $ = 0; $ < N.length; $++)
@@ -19570,12 +19657,12 @@ function Bg() {
19570
19657
  b.storeName ? M = x.then(function(P) {
19571
19658
  if (P.objectStoreNames.contains(b.storeName)) {
19572
19659
  var B = P.version + 1;
19573
- q(b);
19660
+ U(b);
19574
19661
  var N = v[b.name], $ = N.forages;
19575
19662
  P.close();
19576
19663
  for (var V = 0; V < $.length; V++) {
19577
- var te = $[V];
19578
- te._dbInfo.db = null, te._dbInfo.version = B;
19664
+ var ee = $[V];
19665
+ ee._dbInfo.db = null, ee._dbInfo.version = B;
19579
19666
  }
19580
19667
  var ie = new d(function(ne, ve) {
19581
19668
  var pe = c.open(b.name, B);
@@ -19602,14 +19689,14 @@ function Bg() {
19602
19689
  });
19603
19690
  }
19604
19691
  }) : M = x.then(function(P) {
19605
- q(b);
19692
+ U(b);
19606
19693
  var B = v[b.name], N = B.forages;
19607
19694
  P.close();
19608
19695
  for (var $ = 0; $ < N.length; $++) {
19609
19696
  var V = N[$];
19610
19697
  V._dbInfo.db = null;
19611
19698
  }
19612
- var te = new d(function(ie, ne) {
19699
+ var ee = new d(function(ie, ne) {
19613
19700
  var ve = c.deleteDatabase(b.name);
19614
19701
  ve.onerror = function() {
19615
19702
  var pe = ve.result;
@@ -19621,7 +19708,7 @@ function Bg() {
19621
19708
  pe && pe.close(), ie(pe);
19622
19709
  };
19623
19710
  });
19624
- return te.then(function(ie) {
19711
+ return ee.then(function(ie) {
19625
19712
  B.db = ie;
19626
19713
  for (var ne = 0; ne < N.length; ne++) {
19627
19714
  var ve = N[ne];
@@ -19786,9 +19873,9 @@ function Bg() {
19786
19873
  var x = w._dbInfo;
19787
19874
  x.db.transaction(function(P) {
19788
19875
  Je(P, x, "SELECT * FROM " + x.storeName, [], function(B, N) {
19789
- for (var $ = N.rows, V = $.length, te = 0; te < V; te++) {
19790
- var ie = $.item(te), ne = ie.value;
19791
- 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) {
19792
19879
  M(ne);
19793
19880
  return;
19794
19881
  }
@@ -19810,19 +19897,19 @@ function Bg() {
19810
19897
  C === void 0 && (C = null);
19811
19898
  var B = C, N = M._dbInfo;
19812
19899
  N.serializer.serialize(C, function($, V) {
19813
- V ? P(V) : N.db.transaction(function(te) {
19814
- 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() {
19815
19902
  x(B);
19816
19903
  }, function(ie, ne) {
19817
19904
  P(ne);
19818
19905
  });
19819
- }, function(te) {
19820
- if (te.code === te.QUOTA_ERR) {
19906
+ }, function(ee) {
19907
+ if (ee.code === ee.QUOTA_ERR) {
19821
19908
  if (A > 0) {
19822
19909
  x($a.apply(M, [b, B, w, A - 1]));
19823
19910
  return;
19824
19911
  }
19825
- P(te);
19912
+ P(ee);
19826
19913
  }
19827
19914
  });
19828
19915
  });
@@ -19955,7 +20042,7 @@ function Bg() {
19955
20042
  });
19956
20043
  });
19957
20044
  }
19958
- for (var $ = [], V = 0, te = k.storeNames.length; V < te; V++)
20045
+ for (var $ = [], V = 0, ee = k.storeNames.length; V < ee; V++)
19959
20046
  $.push(N(k.storeNames[V]));
19960
20047
  d.all($).then(function() {
19961
20048
  x();
@@ -20202,7 +20289,7 @@ function Bg() {
20202
20289
  P(N);
20203
20290
  return;
20204
20291
  }
20205
- 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++) {
20206
20293
  var ie = $[V], ne = !sl(ti, ie);
20207
20294
  if ((ne || w[ie]) && typeof w[ie] != "function") {
20208
20295
  P(N);
@@ -20255,11 +20342,11 @@ function Bg() {
20255
20342
  }
20256
20343
  function N(V) {
20257
20344
  return function() {
20258
- var te = 0;
20345
+ var ee = 0;
20259
20346
  function ie() {
20260
- for (; te < V.length; ) {
20261
- var ne = V[te];
20262
- 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);
20263
20350
  }
20264
20351
  P();
20265
20352
  var ve = new Error("No available storage method found.");
@@ -20273,8 +20360,8 @@ function Bg() {
20273
20360
  }) : d.resolve();
20274
20361
  return this._driverSet = $.then(function() {
20275
20362
  var V = x[0];
20276
- return k._dbInfo = null, k._ready = null, k.getDriver(V).then(function(te) {
20277
- 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);
20278
20365
  });
20279
20366
  }).catch(function() {
20280
20367
  P();
@@ -20534,7 +20621,7 @@ class zg {
20534
20621
  }
20535
20622
  }
20536
20623
  const Ht = new zg();
20537
- function Jb(s) {
20624
+ function Xb(s) {
20538
20625
  if (!s || !s.metadata) return null;
20539
20626
  if (typeof s.metadata == "string")
20540
20627
  try {
@@ -20652,7 +20739,7 @@ function Kg(s) {
20652
20739
  }
20653
20740
  return e;
20654
20741
  }
20655
- function Qb(s, e) {
20742
+ function Jb(s, e) {
20656
20743
  const t = [], i = /* @__PURE__ */ new Date();
20657
20744
  for (const n of s.mixes || []) {
20658
20745
  if (n.conditions.length === 0) {
@@ -22797,7 +22884,7 @@ const Js = [
22797
22884
  source: "default",
22798
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."
22799
22886
  }
22800
- ], e0 = [
22887
+ ], Qb = [
22801
22888
  "physical",
22802
22889
  "exploration",
22803
22890
  "combat",
@@ -22960,10 +23047,10 @@ function lp() {
22960
23047
  function Lo() {
22961
23048
  lp() || Oo();
22962
23049
  }
22963
- function t0() {
23050
+ function e0() {
22964
23051
  Eo(), Ro(), Po(), No(), $o(), Oo(), zo(), Ho();
22965
23052
  }
22966
- function i0() {
23053
+ function t0() {
22967
23054
  xo(), Ln(), Bo(), Fo(), cp(), Lo(), Wo(), hp();
22968
23055
  }
22969
23056
  function zo() {
@@ -23358,8 +23445,8 @@ class pn {
23358
23445
  g = a;
23359
23446
  break;
23360
23447
  }
23361
- const p = f ? this.getSpicedValue(u, g, e) : g, y = f ? g : this.getSpicedValue(u, g, e), v = t.random(), _ = t.random();
23362
- 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);
23363
23450
  }
23364
23451
  return o;
23365
23452
  }
@@ -23593,17 +23680,17 @@ class pp {
23593
23680
  */
23594
23681
  static generate(e, t, i) {
23595
23682
  xo();
23596
- 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(
23597
23684
  S,
23598
23685
  I,
23599
23686
  n,
23600
- Q,
23687
+ te,
23601
23688
  D
23602
23689
  ), oe = i.color_palette, j = oe?.primary_color, X = oe?.secondary_color, fe = oe?.accent_color;
23603
23690
  let ge;
23604
23691
  return gp.includes(t) && (ge = this.generateAuraColor(t, oe?.primary_color)), {
23605
23692
  body_type: R,
23606
- skin_tone: q,
23693
+ skin_tone: U,
23607
23694
  hair_style: O,
23608
23695
  hair_color: W,
23609
23696
  eye_color: Z,
@@ -25110,19 +25197,19 @@ class ua {
25110
25197
  if (n.forceRace)
25111
25198
  l = u, d = n.forceRace;
25112
25199
  else {
25113
- const J = c.getRaceForSubrace(u);
25114
- if (!J)
25200
+ const Q = c.getRaceForSubrace(u);
25201
+ if (!Q)
25115
25202
  throw new Error(
25116
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' }`
25117
25204
  );
25118
- d = J, l = u;
25205
+ d = Q, l = u;
25119
25206
  }
25120
25207
  const h = d || mp.select(a);
25121
25208
  if (l !== void 0 && u !== "pure") {
25122
- const J = c.getAvailableSubraces(h);
25123
- if (!J.includes(l))
25209
+ const Q = c.getAvailableSubraces(h);
25210
+ if (!Q.includes(l))
25124
25211
  throw new Error(
25125
- `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"}`
25126
25213
  );
25127
25214
  } else if (l === void 0 && u === void 0) {
25128
25215
  const le = ["pure", ...c.getAvailableSubraces(h)], dt = a.randomChoice(le);
@@ -25137,14 +25224,14 @@ class ua {
25137
25224
  ), g = pn.calculateBaseScores(t, a), p = pn.applyRacialBonuses(g, h), y = pn.calculateModifiers(p), v = zr(m);
25138
25225
  if (!v)
25139
25226
  throw new Error(`Unknown class: ${m}. Cannot generate character.`);
25140
- 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 = {
25141
25228
  STR: v.saving_throws.includes("STR"),
25142
25229
  DEX: v.saving_throws.includes("DEX"),
25143
25230
  CON: v.saving_throws.includes("CON"),
25144
25231
  INT: v.saving_throws.includes("INT"),
25145
25232
  WIS: v.saving_throws.includes("WIS"),
25146
25233
  CHA: v.saving_throws.includes("CHA")
25147
- }, 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 = {
25148
25235
  name: f,
25149
25236
  race: h,
25150
25237
  subrace: l,
@@ -25157,8 +25244,8 @@ class ua {
25157
25244
  hp: { current: S, max: S, temp: 0 },
25158
25245
  armor_class: I,
25159
25246
  initiative: D,
25160
- speed: T,
25161
- skills: q,
25247
+ speed: _,
25248
+ skills: U,
25162
25249
  saving_throws: O,
25163
25250
  racial_traits: [],
25164
25251
  // Empty for now, will populate after validation
@@ -25177,14 +25264,14 @@ class ua {
25177
25264
  generated_at: (/* @__PURE__ */ new Date()).toISOString(),
25178
25265
  gameMode: o
25179
25266
  }, j = tr.initializeSpells(m, r, oe), X = [];
25180
- for (const J of Z) {
25181
- const le = c.validatePrerequisites(J, oe);
25182
- 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);
25183
25270
  }
25184
25271
  const fe = [];
25185
- for (const J of Q) {
25186
- const le = c.validatePrerequisites(J, oe);
25187
- 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);
25188
25275
  }
25189
25276
  const ge = {
25190
25277
  name: f,
@@ -25203,11 +25290,11 @@ class ua {
25203
25290
  },
25204
25291
  armor_class: I,
25205
25292
  initiative: D,
25206
- speed: T,
25207
- skills: q,
25293
+ speed: _,
25294
+ skills: U,
25208
25295
  saving_throws: O,
25209
- racial_traits: fe.map((J) => J.id),
25210
- class_features: X.map((J) => J.id),
25296
+ racial_traits: fe.map((Q) => Q.id),
25297
+ class_features: X.map((Q) => Q.id),
25211
25298
  appearance: W,
25212
25299
  spells: j,
25213
25300
  equipment: se,
@@ -25220,12 +25307,12 @@ class ua {
25220
25307
  gameMode: o
25221
25308
  };
25222
25309
  if (Bi.applyMultipleEffects(ge, fe), Bi.applyMultipleEffects(ge, X), se) {
25223
- const J = [
25310
+ const Q = [
25224
25311
  ...se.weapons.filter((le) => le.equipped),
25225
25312
  ...se.armor.filter((le) => le.equipped),
25226
25313
  ...se.items.filter((le) => le.equipped)
25227
25314
  ];
25228
- for (const le of J) {
25315
+ for (const le of Q) {
25229
25316
  const dt = Pi.getEquipmentDataStatic(le.name);
25230
25317
  if (dt) {
25231
25318
  const Gi = le.instanceId;
@@ -25349,8 +25436,8 @@ function _p(s) {
25349
25436
  for (let f = 0; f < r / 2; f++) {
25350
25437
  const g = d + f, p = d + f + r / 2, y = i[p] * h - n[p] * m, v = i[p] * m + n[p] * h;
25351
25438
  i[p] = i[g] - y, n[p] = n[g] - v, i[g] += y, n[g] += v;
25352
- const _ = h * l - m * u;
25353
- m = h * u + m * l, h = _;
25439
+ const T = h * l - m * u;
25440
+ m = h * u + m * l, h = T;
25354
25441
  }
25355
25442
  }
25356
25443
  r *= 2;
@@ -25499,22 +25586,22 @@ class Ip {
25499
25586
  */
25500
25587
  analyzeBand(e, t, i, n, a, r, o) {
25501
25588
  const c = Ap(e, t.name, i), l = Go(c, n, a, i), u = l.numFrames, d = new Float32Array(u);
25502
- for (let T = 0; T < u; T++) {
25503
- const S = l.frames[T];
25589
+ for (let _ = 0; _ < u; _++) {
25590
+ const S = l.frames[_];
25504
25591
  let I = 0;
25505
25592
  for (let D = 0; D < S.length; D++)
25506
25593
  I += S[D] * S[D];
25507
- d[T] = Math.sqrt(I / S.length);
25594
+ d[_] = Math.sqrt(I / S.length);
25508
25595
  }
25509
25596
  const h = Math.max(...d);
25510
25597
  if (h > 0)
25511
- for (let T = 0; T < d.length; T++)
25512
- d[T] /= h;
25598
+ for (let _ = 0; _ < d.length; _++)
25599
+ d[_] /= h;
25513
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);
25514
25601
  if (p > 0)
25515
- for (let T = 0; T < g.length; T++)
25516
- y[T] = g[T] / p;
25517
- 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);
25518
25605
  return {
25519
25606
  name: t.name,
25520
25607
  frequencyRange: {
@@ -25523,7 +25610,7 @@ class Ip {
25523
25610
  },
25524
25611
  envelope: y,
25525
25612
  peaks: v,
25526
- peakTimes: _,
25613
+ peakTimes: T,
25527
25614
  energy: m,
25528
25615
  energyOverTime: d
25529
25616
  };
@@ -26690,8 +26777,8 @@ class Fp {
26690
26777
  analyzeBand(e, t, i, n) {
26691
26778
  const a = e.beats, o = (a.length > 0 ? Math.max(...a.map((v) => v.beatIndex)) : 0) + 1, c = /* @__PURE__ */ new Map();
26692
26779
  for (const v of a) {
26693
- const _ = c.get(v.beatIndex);
26694
- _ ? (_.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, {
26695
26782
  count: 1,
26696
26783
  intensities: [v.intensity]
26697
26784
  });
@@ -26699,13 +26786,13 @@ class Fp {
26699
26786
  const l = [];
26700
26787
  let u = 0;
26701
26788
  for (let v = 0; v < o; v++) {
26702
- 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;
26703
26790
  l.push({
26704
26791
  beatIndex: v,
26705
- transientCount: T,
26706
- bands: T > 0 ? [t] : [],
26792
+ transientCount: _,
26793
+ bands: _ > 0 ? [t] : [],
26707
26794
  averageIntensity: S
26708
- }), u += T;
26795
+ }), u += _;
26709
26796
  }
26710
26797
  const d = l.map((v) => v.transientCount);
26711
26798
  let h;
@@ -26798,7 +26885,7 @@ class Fp {
26798
26885
  calculateSectionMetrics(e, t, i) {
26799
26886
  const n = [], a = this.config.beatsPerSection, r = e.length;
26800
26887
  for (let o = 0; o < r; o += a) {
26801
- 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);
26802
26889
  n.push({
26803
26890
  startBeat: o,
26804
26891
  endBeat: c,
@@ -26897,7 +26984,7 @@ const Yo = {
26897
26984
  densityWeight: 0.2
26898
26985
  }
26899
26986
  };
26900
- function n0(s) {
26987
+ function i0(s) {
26901
26988
  const e = Op[s];
26902
26989
  return {
26903
26990
  ...Yo,
@@ -27125,15 +27212,15 @@ class qp {
27125
27212
  generate(e, t, i, n) {
27126
27213
  const a = t.sectionWinners, r = { low: 0, mid: 0, high: 0 }, o = { low: 0, mid: 0, high: 0 }, l = a.filter((y) => {
27127
27214
  const v = ["low", "mid", "high"];
27128
- let _ = !1;
27129
- for (const T of v)
27130
- if (e.streams[T].beats.filter(
27215
+ let T = !1;
27216
+ for (const _ of v)
27217
+ if (e.streams[_].beats.filter(
27131
27218
  (D) => D.beatIndex >= y.beatRange.start && D.beatIndex <= y.beatRange.end
27132
27219
  ).length > 0) {
27133
- _ = !0;
27220
+ T = !0;
27134
27221
  break;
27135
27222
  }
27136
- return _;
27223
+ return T;
27137
27224
  }).map((y) => ({
27138
27225
  beatRange: y.beatRange,
27139
27226
  sourceBand: y.winner,
@@ -27144,12 +27231,12 @@ class qp {
27144
27231
  o[y.sourceBand]++;
27145
27232
  const u = [];
27146
27233
  for (const y of l) {
27147
- const v = e.streams[y.sourceBand], _ = this.extractSectionBeats(
27234
+ const v = e.streams[y.sourceBand], T = this.extractSectionBeats(
27148
27235
  v,
27149
27236
  y.beatRange,
27150
27237
  y.sourceBand
27151
27238
  );
27152
- u.push(..._), r[y.sourceBand] += _.length;
27239
+ u.push(...T), r[y.sourceBand] += T.length;
27153
27240
  }
27154
27241
  u.sort((y, v) => y.timestamp - v.timestamp);
27155
27242
  const d = this.deduplicateBeats(u), h = e.streams.low.quarterNoteInterval, m = 60 / h, f = this.determineNaturalDifficulty(
@@ -27255,7 +27342,7 @@ const da = {
27255
27342
  marginSeconds: 0.5
27256
27343
  }
27257
27344
  };
27258
- function a0(s) {
27345
+ function n0(s) {
27259
27346
  return { ...Gp[s] };
27260
27347
  }
27261
27348
  function Up(s) {
@@ -27500,7 +27587,7 @@ class Zp {
27500
27587
  return e.filter((r) => r.timestamp < n || r.timestamp > a ? (i.marginRemovals++, !1) : !0);
27501
27588
  }
27502
27589
  }
27503
- const s0 = [
27590
+ const a0 = [
27504
27591
  "straight_16th",
27505
27592
  "triplet_8th",
27506
27593
  "straight_8th",
@@ -27641,10 +27728,10 @@ const ny = {
27641
27728
  seed: void 0,
27642
27729
  rhythmicBalanceConfig: void 0
27643
27730
  };
27644
- function r0(s, e, t) {
27731
+ function s0(s, e, t) {
27645
27732
  return t !== void 0 ? at(e, t).includes(s) : Ge[e].allowedGridTypes.includes(s);
27646
27733
  }
27647
- function o0(s, e) {
27734
+ function r0(s, e) {
27648
27735
  return e !== void 0 ? at(s, e) : [...Ge[s].allowedGridTypes];
27649
27736
  }
27650
27737
  function Gn(s, e, t, i) {
@@ -27662,7 +27749,7 @@ function Gn(s, e, t, i) {
27662
27749
  return s;
27663
27750
  }
27664
27751
  }
27665
- function c0(s) {
27752
+ function o0(s) {
27666
27753
  return s;
27667
27754
  }
27668
27755
  function ay(s, e, t) {
@@ -27882,12 +27969,12 @@ class Un {
27882
27969
  m,
27883
27970
  c,
27884
27971
  u
27885
- ), _ = 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";
27886
27973
  return {
27887
27974
  difficulty: "custom",
27888
- beats: _,
27975
+ beats: T,
27889
27976
  isUnedited: !1,
27890
- editType: T,
27977
+ editType: _,
27891
27978
  editAmount: v.metadata.totalBeatsBefore > 0 ? (v.metadata.totalBeatsAfter - v.metadata.totalBeatsBefore) / v.metadata.totalBeatsBefore : 0,
27892
27979
  patternsInserted: v.metadata.insertedPatternIds.length > 0 ? v.metadata.insertedPatternIds : void 0,
27893
27980
  enhancementMetadata: v.metadata
@@ -27897,7 +27984,7 @@ class Un {
27897
27984
  this.config.logConversions && console.log(
27898
27985
  `[DifficultyVariantGenerator] Density approximately equal (${f.toFixed(2)} ≈ ${u.toFixed(2)}), but grid restrictions needed`
27899
27986
  );
27900
- const _ = this.simplifyBeats(
27987
+ const T = this.simplifyBeats(
27901
27988
  h,
27902
27989
  "custom",
27903
27990
  e.quarterNoteInterval,
@@ -27911,11 +27998,11 @@ class Un {
27911
27998
  );
27912
27999
  return {
27913
28000
  difficulty: "custom",
27914
- beats: this.enforceSingleGridPerBeat(_.beats),
27915
- isUnedited: _.metadata.beatsRemoved === 0 && !d,
27916
- editType: _.metadata.beatsRemoved > 0 ? "simplified" : "none",
27917
- editAmount: _.metadata.totalBeatsBefore > 0 ? (_.metadata.totalBeatsBefore - _.metadata.totalBeatsAfter) / _.metadata.totalBeatsBefore : 0,
27918
- 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,
27919
28006
  densityClamped: d
27920
28007
  };
27921
28008
  }
@@ -28094,12 +28181,12 @@ class Un {
28094
28181
  r,
28095
28182
  e.quarterNoteInterval,
28096
28183
  h
28097
- ), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28184
+ ), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28098
28185
  return {
28099
28186
  difficulty: t,
28100
28187
  beats: v.beats,
28101
28188
  isUnedited: !1,
28102
- editType: _,
28189
+ editType: T,
28103
28190
  editAmount: v.metadata.totalBeatsBefore > 0 ? (v.metadata.totalBeatsAfter - v.metadata.totalBeatsBefore) / v.metadata.totalBeatsBefore : 0,
28104
28191
  enhancementMetadata: v.metadata
28105
28192
  };
@@ -28157,12 +28244,12 @@ class Un {
28157
28244
  r,
28158
28245
  e.quarterNoteInterval,
28159
28246
  h
28160
- ), _ = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28247
+ ), T = v.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28161
28248
  return {
28162
28249
  difficulty: t,
28163
28250
  beats: v.beats,
28164
28251
  isUnedited: !1,
28165
- editType: _,
28252
+ editType: T,
28166
28253
  editAmount: 1,
28167
28254
  conversionMetadata: p.metadata,
28168
28255
  enhancementMetadata: v.metadata
@@ -28189,16 +28276,16 @@ class Un {
28189
28276
  h
28190
28277
  );
28191
28278
  let p = g.beats;
28192
- if (p.some((_) => !u.includes(_.gridType))) {
28193
- const _ = [];
28194
- for (const T of p)
28195
- if (u.includes(T.gridType))
28196
- _.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(_);
28197
28284
  else {
28198
- const S = this.convertBeatGridType(T, t, e.quarterNoteInterval, c);
28199
- S && _.push(S);
28285
+ const S = this.convertBeatGridType(_, t, e.quarterNoteInterval, c);
28286
+ S && T.push(S);
28200
28287
  }
28201
- p = this.deduplicateConvertedBeats(_);
28288
+ p = this.deduplicateConvertedBeats(T);
28202
28289
  }
28203
28290
  const v = g.metadata.patternsInserted > 0 ? "pattern_inserted" : "interpolated";
28204
28291
  return {
@@ -28253,7 +28340,7 @@ class Un {
28253
28340
  d.totalBeatsBefore = m.length;
28254
28341
  const f = l ?? at(t, r);
28255
28342
  if (m.every((R) => f.includes(R.gridType)) && !n) {
28256
- 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(
28257
28344
  m,
28258
28345
  t,
28259
28346
  d,
@@ -28262,7 +28349,7 @@ class Un {
28262
28349
  R,
28263
28350
  c
28264
28351
  );
28265
- return d.totalBeatsAfter = q.length, { beats: q, metadata: d };
28352
+ return d.totalBeatsAfter = U.length, { beats: U, metadata: d };
28266
28353
  }
28267
28354
  let p = m;
28268
28355
  n && (p = this.filterBeatsForHeavySimplification(m, d, h));
@@ -28272,7 +28359,7 @@ class Un {
28272
28359
  y.push(R);
28273
28360
  continue;
28274
28361
  }
28275
- 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);
28276
28363
  if (O)
28277
28364
  if (y.push(O), R.gridType === "straight_16th") {
28278
28365
  if (d.sixteenthToEighth++, this.config.logConversions) {
@@ -28293,10 +28380,10 @@ class Un {
28293
28380
  }
28294
28381
  const v = this.deduplicateConvertedBeats(y);
28295
28382
  d.beatsRemoved += y.length - v.length;
28296
- 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;
28297
28384
  if (v.length <= S)
28298
28385
  return this.config.logConversions && console.log(
28299
- `[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)` : "")
28300
28387
  ), d.totalBeatsAfter = v.length, { beats: v, metadata: d };
28301
28388
  const D = this.reduceDensityToTarget(
28302
28389
  v,
@@ -28563,7 +28650,7 @@ class Un {
28563
28650
  }
28564
28651
  }
28565
28652
  d.sort((m, f) => {
28566
- 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;
28567
28654
  if (S !== 0) return S;
28568
28655
  const I = ht(Tt(a, `partial:${m}`)), D = ht(Tt(a, `partial:${f}`));
28569
28656
  return I - D;
@@ -28641,21 +28728,21 @@ class Un {
28641
28728
  this.config.logConversions && console.log(
28642
28729
  `[DifficultyVariantGenerator] Reducing density from ${l.toFixed(2)} notes/sec to target max ${c.max} notes/sec for ${t}`
28643
28730
  );
28644
- const u = this.buildDownbeatCountMap(e), d = e.map((T) => ({
28645
- beat: T,
28646
- priority: this.calculateRemovalPriority(T, n, u)
28731
+ const u = this.buildDownbeatCountMap(e), d = e.map((_) => ({
28732
+ beat: _,
28733
+ priority: this.calculateRemovalPriority(_, n, u)
28647
28734
  }));
28648
- d.sort((T, S) => T.priority - S.priority);
28735
+ d.sort((_, S) => _.priority - S.priority);
28649
28736
  const h = /* @__PURE__ */ new Set();
28650
28737
  let m = e.length;
28651
28738
  const f = this.config.maxReductionPasses;
28652
28739
  let g = 0;
28653
- for (let T = 1; T <= f; T++) {
28654
- g = T;
28740
+ for (let _ = 1; _ <= f; _++) {
28741
+ g = _;
28655
28742
  let S = 0;
28656
- const I = T === f;
28657
- let D, R, q = !1;
28658
- 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);
28659
28746
  for (const { beat: O, priority: W } of d)
28660
28747
  if (!h.has(O)) {
28661
28748
  if (r !== void 0) {
@@ -28663,17 +28750,17 @@ class Un {
28663
28750
  break;
28664
28751
  } else if ((m - 1) / o <= c.max)
28665
28752
  break;
28666
- if (q) {
28753
+ if (U) {
28667
28754
  if (this.isStrongBeat(O.beatIndex))
28668
28755
  continue;
28669
28756
  } else if (W >= D || O.intensity >= R)
28670
28757
  continue;
28671
28758
  h.add(O), m--, S++, this.config.logConversions && console.log(
28672
- `[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)})`
28673
28760
  );
28674
28761
  }
28675
28762
  if (this.config.logConversions && console.log(
28676
- `[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`
28677
28764
  ), r !== void 0) {
28678
28765
  if (m <= r)
28679
28766
  break;
@@ -28682,18 +28769,18 @@ class Un {
28682
28769
  }
28683
28770
  const p = m / o;
28684
28771
  if ((r !== void 0 ? m > r : p > c.max) && this.config.logConversions) {
28685
- 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`;
28686
28773
  console.warn(
28687
- `[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)`
28688
28775
  );
28689
28776
  }
28690
- const v = e.filter((T) => !h.has(T));
28777
+ const v = e.filter((_) => !h.has(_));
28691
28778
  i.reductionPasses = g, i.beatsRemoved += h.size;
28692
- const _ = Math.ceil(c.min * o);
28693
- if (v.length < _ && e.length > 0) {
28694
- const T = d.filter(({ beat: S }) => h.has(S)).sort((S, I) => I.priority - S.priority);
28695
- for (const { beat: S } of T) {
28696
- 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;
28697
28784
  v.push(S), i.beatsRemoved--;
28698
28785
  }
28699
28786
  }
@@ -28905,8 +28992,8 @@ class Un {
28905
28992
  if (l) {
28906
28993
  if (l.includes(O)) return O;
28907
28994
  const W = ["straight_16th", "triplet_8th", "straight_8th", "quarter_triplet", "straight_4th"], Z = W.indexOf(O);
28908
- for (let Q = Z + 1; Q < W.length; Q++)
28909
- 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];
28910
28997
  return l[l.length - 1] ?? O;
28911
28998
  }
28912
28999
  return Gn(O, t, i);
@@ -28916,12 +29003,12 @@ class Un {
28916
29003
  let f = c ? e : this.enforceSingleGridPerBeat(e);
28917
29004
  if (l && f.some((W) => !l.includes(W.gridType))) {
28918
29005
  const W = [];
28919
- for (const Q of f)
28920
- if (l.includes(Q.gridType))
28921
- W.push(Q);
29006
+ for (const te of f)
29007
+ if (l.includes(te.gridType))
29008
+ W.push(te);
28922
29009
  else {
28923
29010
  const se = this.convertBeatGridType(
28924
- Q,
29011
+ te,
28925
29012
  t,
28926
29013
  o,
28927
29014
  i,
@@ -28948,7 +29035,7 @@ class Un {
28948
29035
  i,
28949
29036
  t
28950
29037
  ).beatsToAdd;
28951
- const v = this.config.seed ?? `enhance:${p}:${f.length}`, _ = this.distributeBeatsAcrossIndices(
29038
+ const v = this.config.seed ?? `enhance:${p}:${f.length}`, T = this.distributeBeatsAcrossIndices(
28952
29039
  y,
28953
29040
  g,
28954
29041
  c ?? /* @__PURE__ */ new Map(),
@@ -28956,22 +29043,22 @@ class Un {
28956
29043
  v,
28957
29044
  l
28958
29045
  // Pass through for max beats per index calculation
28959
- ), T = [], S = /* @__PURE__ */ new Map(), I = (O, W) => `${O}:${W}`;
29046
+ ), _ = [], S = /* @__PURE__ */ new Map(), I = (O, W) => `${O}:${W}`;
28960
29047
  for (const O of f) {
28961
29048
  const W = I(O.beatIndex, O.gridPosition);
28962
29049
  S.has(W) || S.set(W, O.gridType);
28963
29050
  }
28964
29051
  for (let O = 0; O <= p; O++) {
28965
- const W = g.get(O) ?? [], Z = _.get(O) ?? 0;
29052
+ const W = g.get(O) ?? [], Z = T.get(O) ?? 0;
28966
29053
  if (W.length >= Z) {
28967
- T.push(...W);
29054
+ _.push(...W);
28968
29055
  continue;
28969
29056
  }
28970
- const Q = Z - W.length;
29057
+ const te = Z - W.length;
28971
29058
  if (W.length === 0) {
28972
29059
  const X = c?.get(O), fe = X ? m(X) : void 0, ge = this.createBeatsForEmptyIndex(
28973
29060
  O,
28974
- Q,
29061
+ te,
28975
29062
  n,
28976
29063
  r,
28977
29064
  o,
@@ -28979,9 +29066,9 @@ class Un {
28979
29066
  S,
28980
29067
  fe
28981
29068
  ), Qt = fe ?? this.getGridForBeatIndex(O, ge, r);
28982
- for (const J of ge) {
28983
- const le = I(J.beatIndex, J.gridPosition);
28984
- !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++);
28985
29072
  }
28986
29073
  continue;
28987
29074
  }
@@ -28991,18 +29078,18 @@ class Un {
28991
29078
  const X = this.tryInsertPattern(
28992
29079
  W,
28993
29080
  O,
28994
- Q,
29081
+ te,
28995
29082
  a,
28996
29083
  S,
28997
29084
  oe
28998
29085
  );
28999
29086
  j = X.beatsAdded, X.patternId && (h.patternsInserted++, h.insertedPatternIds.push(X.patternId));
29000
29087
  }
29001
- if (j < Q) {
29088
+ if (j < te) {
29002
29089
  const X = this.interpolateBeats(
29003
29090
  W,
29004
29091
  O,
29005
- Q - j,
29092
+ te - j,
29006
29093
  o,
29007
29094
  S,
29008
29095
  oe,
@@ -29010,18 +29097,18 @@ class Un {
29010
29097
  );
29011
29098
  for (const fe of X) {
29012
29099
  const ge = I(fe.beatIndex, fe.gridPosition);
29013
- 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++);
29014
29101
  }
29015
29102
  }
29016
- T.push(...W);
29103
+ _.push(...W);
29017
29104
  }
29018
- 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);
29019
29106
  let R;
29020
29107
  c ? (this.validateSingleGridPerBeat(D).isValid, R = D) : R = this.enforceSingleGridPerBeat(D);
29021
- const q = this.deduplicateEnhancedBeats(R);
29022
- 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(
29023
29110
  `[DifficultyVariantGenerator] Enhanced beats for ${t}: ${h.totalBeatsBefore} → ${h.totalBeatsAfter} beats (patterns: ${h.patternsInserted}, interpolated: ${h.interpolatedBeats})`
29024
- ), { beats: q, metadata: h };
29111
+ ), { beats: U, metadata: h };
29025
29112
  }
29026
29113
  /**
29027
29114
  * Group beats by their beat index
@@ -29070,12 +29157,12 @@ class Un {
29070
29157
  if (c.length === 0)
29071
29158
  return { beatsAdded: 0 };
29072
29159
  const l = c.filter(
29073
- (v) => v.pattern.some((_) => _.gridType === r)
29160
+ (v) => v.pattern.some((T) => T.gridType === r)
29074
29161
  );
29075
29162
  if (l.length === 0)
29076
29163
  return { beatsAdded: 0 };
29077
- l.sort((v, _) => _.significance - v.significance);
29078
- 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))));
29079
29166
  if (f.length === 0)
29080
29167
  return { beatsAdded: 0 };
29081
29168
  const g = f.slice(0, i), p = u.sourceBand, y = g.map((v) => ({
@@ -29112,12 +29199,12 @@ class Un {
29112
29199
  createBeatsForEmptyIndex(e, t, i, n, a = 0.5, r, o, c) {
29113
29200
  let l = c ?? "straight_16th", u = "mid", d = "mid";
29114
29201
  if (!c && n) {
29115
- const T = n.get(e);
29116
- T && (l = T.selectedGrid);
29202
+ const _ = n.get(e);
29203
+ _ && (l = _.selectedGrid);
29117
29204
  }
29118
29205
  if (!c && !n?.has(e) && r)
29119
- for (const T of [1, -1, 2, -2, 3, -3]) {
29120
- const S = r.get(e + T);
29206
+ for (const _ of [1, -1, 2, -2, 3, -3]) {
29207
+ const S = r.get(e + _);
29121
29208
  if (S && S.length > 0) {
29122
29209
  l = S[0].gridType, u = S[0].band, d = S[0].sourceBand;
29123
29210
  break;
@@ -29125,9 +29212,9 @@ class Un {
29125
29212
  }
29126
29213
  const h = /* @__PURE__ */ new Set();
29127
29214
  if (o) {
29128
- const T = (S, I) => `${S}:${I}`;
29215
+ const _ = (S, I) => `${S}:${I}`;
29129
29216
  for (let S = 0; S < 4; S++)
29130
- o.has(T(e, S)) && h.add(S);
29217
+ o.has(_(e, S)) && h.add(S);
29131
29218
  }
29132
29219
  const f = {
29133
29220
  straight_16th: 4,
@@ -29136,23 +29223,23 @@ class Un {
29136
29223
  straight_4th: 1,
29137
29224
  quarter_triplet: 1
29138
29225
  }[l], g = [];
29139
- for (let T = 0; T < f; T++)
29140
- h.has(T) || g.push(T);
29141
- g.sort((T, S) => {
29226
+ for (let _ = 0; _ < f; _++)
29227
+ h.has(_) || g.push(_);
29228
+ g.sort((_, S) => {
29142
29229
  const I = (D) => D === 0 ? 0 : D === f - 1 ? 2 : 1;
29143
- return I(T) - I(S);
29230
+ return I(_) - I(S);
29144
29231
  });
29145
- 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 = {
29146
29233
  straight_16th: a / 4,
29147
29234
  straight_8th: a / 2,
29148
29235
  triplet_8th: a / 3,
29149
29236
  straight_4th: a,
29150
29237
  quarter_triplet: a
29151
29238
  }[l];
29152
- return p.map((T) => ({
29153
- timestamp: y + T * _,
29239
+ return p.map((_) => ({
29240
+ timestamp: y + _ * T,
29154
29241
  beatIndex: e,
29155
- gridPosition: T,
29242
+ gridPosition: _,
29156
29243
  gridType: l,
29157
29244
  intensity: this.config.interpolatedBeatIntensity * 0.8,
29158
29245
  // Slightly lower for filled gaps
@@ -29179,14 +29266,14 @@ class Un {
29179
29266
  interpolateBeats(e, t, i, n = 0.5, a, r, o) {
29180
29267
  if (i <= 0 || e.length === 0)
29181
29268
  return [];
29182
- 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));
29183
29270
  if (a)
29184
- for (let T = 0; T < u; T++)
29185
- a.has(d(t, T)) && h.add(T);
29271
+ for (let _ = 0; _ < u; _++)
29272
+ a.has(d(t, _)) && h.add(_);
29186
29273
  const m = [];
29187
- for (let T = 0; T < u; T++)
29188
- h.has(T) || m.push(T);
29189
- 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));
29190
29277
  const f = m.slice(0, i), g = e[0], p = o?.beats[t]?.timestamp ?? t * n, v = {
29191
29278
  straight_16th: n / 4,
29192
29279
  straight_8th: n / 2,
@@ -29194,10 +29281,10 @@ class Un {
29194
29281
  straight_4th: n,
29195
29282
  quarter_triplet: n
29196
29283
  }[c];
29197
- return f.map((T) => ({
29198
- timestamp: p + T * v,
29284
+ return f.map((_) => ({
29285
+ timestamp: p + _ * v,
29199
29286
  beatIndex: t,
29200
- gridPosition: T,
29287
+ gridPosition: _,
29201
29288
  gridType: c,
29202
29289
  intensity: this.config.interpolatedBeatIntensity,
29203
29290
  band: g.band,
@@ -29407,10 +29494,10 @@ const Zo = {
29407
29494
  description: "Focus on bass/low-frequency rhythms"
29408
29495
  }
29409
29496
  };
29410
- function l0(s) {
29497
+ function c0(s) {
29411
29498
  return Zo[s];
29412
29499
  }
29413
- function u0() {
29500
+ function l0() {
29414
29501
  return Object.keys(Zo);
29415
29502
  }
29416
29503
  const sy = {
@@ -29597,7 +29684,7 @@ class mt {
29597
29684
  a("Phase 3", 0.6, `Balanced composite: ${p.beats.length} beats (${y.beatsAdded} added, ${y.beatsShifted} shifted for rhythmic structure)`);
29598
29685
  const v = this.options.skipDifficultyVariants ? null : this.generateDifficultyVariants(p, d, u, t);
29599
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();
29600
- const _ = {
29687
+ const T = {
29601
29688
  difficulty: this.options.difficulty,
29602
29689
  bandsAnalyzed: ["low", "mid", "high"],
29603
29690
  transientsDetected: l.metadata.totalTransients,
@@ -29610,7 +29697,7 @@ class mt {
29610
29697
  duration: e.duration,
29611
29698
  totalBeats: t.beats.length,
29612
29699
  balanceStats: y
29613
- }, T = {
29700
+ }, _ = {
29614
29701
  difficultyVariants: v,
29615
29702
  bandStreams: u.streams,
29616
29703
  composite: p,
@@ -29621,9 +29708,9 @@ class mt {
29621
29708
  densityAnalysis: h,
29622
29709
  scoringResult: m
29623
29710
  },
29624
- metadata: _
29711
+ metadata: T
29625
29712
  };
29626
- return this.setCache(r, T), T;
29713
+ return this.setCache(r, _), _;
29627
29714
  }
29628
29715
  // ================================================================
29629
29716
  // Pipeline Step Methods (exposed for testing and advanced use)
@@ -30425,9 +30512,9 @@ class Xo {
30425
30512
  midiNote: g.frequency > 0 ? g.midiNote : null,
30426
30513
  noteName: g.frequency > 0 ? this.midiToNoteName(g.midiNote) : null
30427
30514
  };
30428
- y.length > 1 && (v.alternativeHypotheses = y.slice(0, 5).map((_) => ({
30429
- frequency: _.frequency,
30430
- probability: _.probability
30515
+ y.length > 1 && (v.alternativeHypotheses = y.slice(0, 5).map((T) => ({
30516
+ frequency: T.frequency,
30517
+ probability: T.probability
30431
30518
  }))), h.push(v);
30432
30519
  }
30433
30520
  return h;
@@ -30491,13 +30578,13 @@ class Xo {
30491
30578
  l++;
30492
30579
  const v = g[0].probability;
30493
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) {
30494
- const _ = g[0], T = Math.round(this.frequencyToMidi(_.frequency)), S = {
30581
+ const T = g[0], _ = Math.round(this.frequencyToMidi(T.frequency)), S = {
30495
30582
  timestamp: y,
30496
- frequency: _.frequency,
30497
- probability: _.probability,
30583
+ frequency: T.frequency,
30584
+ probability: T.probability,
30498
30585
  isVoiced: !0,
30499
- midiNote: T,
30500
- noteName: this.midiToNoteName(T)
30586
+ midiNote: _,
30587
+ noteName: this.midiToNoteName(_)
30501
30588
  };
30502
30589
  p.length > 1 && (S.alternativeHypotheses = p.slice(0, 5).map((I) => ({
30503
30590
  frequency: I.frequency,
@@ -30596,8 +30683,8 @@ class Xo {
30596
30683
  let g = !1;
30597
30684
  for (const p of d) {
30598
30685
  if (p.frequency <= f.frequency || p.probability < m * 0.9) continue;
30599
- const y = p.frequency / f.frequency, v = Math.round(y), _ = Math.abs(y - v);
30600
- 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) {
30601
30688
  g = !0;
30602
30689
  break;
30603
30690
  }
@@ -31127,17 +31214,17 @@ class qi {
31127
31214
  const S = Ee.tensor(m, [1, n]);
31128
31215
  return this.crepeModel.execute(S).dataSync().slice();
31129
31216
  });
31130
- let v = 0, _ = 0, T = 0;
31217
+ let v = 0, T = 0, _ = 0;
31131
31218
  for (let S = 0; S < 360; S++) {
31132
31219
  const I = y[S];
31133
- v += S * 10 * I, _ += I, I > T && (T = I);
31220
+ v += S * 10 * I, T += I, I > _ && (_ = I);
31134
31221
  }
31135
- if (_ > 0 && T > 0.3) {
31136
- 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));
31137
31224
  g = {
31138
31225
  timestamp: f,
31139
31226
  frequency: I,
31140
- probability: T,
31227
+ probability: _,
31141
31228
  isVoiced: !0,
31142
31229
  midiNote: D,
31143
31230
  noteName: this.midiToNoteName(D)
@@ -31699,7 +31786,7 @@ const yy = {
31699
31786
  includeContour: !0,
31700
31787
  onProgress: void 0
31701
31788
  }, vy = 69, by = 440, wy = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
31702
- class d0 {
31789
+ class u0 {
31703
31790
  /**
31704
31791
  * Create a new PitchAnalyzer
31705
31792
  *
@@ -31827,7 +31914,7 @@ class d0 {
31827
31914
  * Compute summary statistics from pitch results
31828
31915
  */
31829
31916
  computeSummary(e) {
31830
- 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;
31831
31918
  if (n === 0)
31832
31919
  return {
31833
31920
  voicingRatio: 0,
@@ -31842,14 +31929,14 @@ class d0 {
31842
31929
  totalFrames: t,
31843
31930
  voicedFrames: 0
31844
31931
  };
31845
- 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();
31846
- for (const _ of i)
31847
- _.noteName && y.set(_.noteName, (y.get(_.noteName) ?? 0) + 1);
31848
- const v = Array.from(y.entries()).map(([_, T]) => ({
31849
- note: _,
31850
- count: T,
31851
- percentage: T / n * 100
31852
- })).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);
31853
31940
  return {
31854
31941
  voicingRatio: n / t,
31855
31942
  averageFrequency: o,
@@ -31894,11 +31981,11 @@ class d0 {
31894
31981
  h = v;
31895
31982
  continue;
31896
31983
  }
31897
- let _;
31898
- const T = Math.abs(v - h);
31899
- v > h ? (_ = "up", c.up++) : v < h ? (_ = "down", c.down++) : (_ = "stable", c.stable++);
31900
- const S = Jo(T);
31901
- 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({
31902
31989
  startTime: d.startTime,
31903
31990
  endTime: d.endTime,
31904
31991
  startNote: d.startNote,
@@ -31910,7 +31997,7 @@ class d0 {
31910
31997
  endTime: y.timestamp,
31911
31998
  startNote: this.midiToNoteName(h),
31912
31999
  endNote: this.midiToNoteName(v),
31913
- direction: _,
32000
+ direction: T,
31914
32001
  startMidi: h,
31915
32002
  endMidi: v
31916
32003
  }) : (d.endTime = y.timestamp, d.endNote = this.midiToNoteName(v), d.endMidi = v), h = v;
@@ -33076,13 +33163,13 @@ const ec = Qo("ddr", xy), tc = Qo(
33076
33163
  "guitar_hero",
33077
33164
  Ry
33078
33165
  );
33079
- function h0(s) {
33166
+ function d0(s) {
33080
33167
  return s === "ddr" ? ec : tc;
33081
33168
  }
33082
- function m0(s, e) {
33169
+ function h0(s, e) {
33083
33170
  return s.byCategory.get(e) ?? [];
33084
33171
  }
33085
- function f0(s, e = 1, t = 10) {
33172
+ function m0(s, e = 1, t = 10) {
33086
33173
  const i = [];
33087
33174
  for (let n = e; n <= t; n++) {
33088
33175
  const a = s.byDifficulty.get(n);
@@ -33090,24 +33177,24 @@ function f0(s, e = 1, t = 10) {
33090
33177
  }
33091
33178
  return i;
33092
33179
  }
33093
- function g0(s, e) {
33180
+ function f0(s, e) {
33094
33181
  return s.patterns.filter(
33095
33182
  (t) => e.every((i) => t.tags.includes(i))
33096
33183
  );
33097
33184
  }
33098
- function p0(s, e) {
33185
+ function g0(s, e) {
33099
33186
  return s.patterns.filter((t) => t.keys.length === e);
33100
33187
  }
33101
- function y0(s, e) {
33188
+ function p0(s, e) {
33102
33189
  const t = e ? s.patterns.filter(e) : s.patterns;
33103
33190
  if (t.length === 0) return;
33104
33191
  const i = Math.floor(Math.random() * t.length);
33105
33192
  return t[i];
33106
33193
  }
33107
- function v0(s, e) {
33194
+ function y0(s, e) {
33108
33195
  return s.patterns.find((t) => t.id === e);
33109
33196
  }
33110
- function b0(s) {
33197
+ function v0(s) {
33111
33198
  const e = {
33112
33199
  basic: 0,
33113
33200
  roll: 0,
@@ -33542,8 +33629,8 @@ class bn {
33542
33629
  mapButtons(e, t, i) {
33543
33630
  const n = e.beats;
33544
33631
  if (this.config.controllerMode === "tap")
33545
- return n.map((v, _) => ({
33546
- beatIndex: _,
33632
+ return n.map((v, T) => ({
33633
+ beatIndex: T,
33547
33634
  timestamp: v.timestamp,
33548
33635
  key: "tap",
33549
33636
  source: "pattern",
@@ -33562,31 +33649,31 @@ class bn {
33562
33649
  l,
33563
33650
  this.config.pitchInfluenceWeight
33564
33651
  ), d = c.map(
33565
- (v, _) => v !== null && u[_] ? v : null
33566
- ), h = this.config.controllerMode === "ddr" ? ec.patterns : tc.patterns, m = Oy(d), f = /* @__PURE__ */ new Set(), g = m.map((v, _) => {
33567
- 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(
33568
33655
  v,
33569
33656
  h,
33570
33657
  r,
33571
33658
  f,
33572
- () => this.seededRandom(`run:${_}:pick:${o++}`)
33659
+ () => this.seededRandom(`run:${T}:pick:${o++}`)
33573
33660
  );
33574
- for (const S of T)
33661
+ for (const S of _)
33575
33662
  S.pattern.id !== "__interpolated__" && f.add(S.pattern.id);
33576
- return T;
33663
+ return _;
33577
33664
  }), { keys: p, patternIds: y } = zy(
33578
33665
  d,
33579
33666
  m,
33580
33667
  g
33581
33668
  );
33582
33669
  for (let v = 0; v < n.length; v++) {
33583
- const _ = d[v] !== null;
33670
+ const T = d[v] !== null;
33584
33671
  a.push({
33585
33672
  beatIndex: v,
33586
33673
  timestamp: n[v].timestamp,
33587
33674
  key: p[v],
33588
- source: _ ? "pitch" : "pattern",
33589
- patternId: _ ? void 0 : y[v],
33675
+ source: T ? "pitch" : "pattern",
33676
+ patternId: T ? void 0 : y[v],
33590
33677
  probability: l[v]
33591
33678
  });
33592
33679
  }
@@ -34300,8 +34387,8 @@ class fa {
34300
34387
  * ```
34301
34388
  */
34302
34389
  async generateAtDensity(e, t, i, n, a) {
34303
- const r = (y, v, _) => {
34304
- n?.({ stage: y, progress: v, message: _ });
34390
+ const r = (y, v, T) => {
34391
+ n?.({ stage: y, progress: v, message: T });
34305
34392
  };
34306
34393
  a?.throwIfAborted();
34307
34394
  const o = t.audioId;
@@ -34318,8 +34405,8 @@ class fa {
34318
34405
  c = this.getFromCache(y), c ? r("rhythm", 1, "Rhythm loaded from cache") : (c = await this.generateRhythm(
34319
34406
  e,
34320
34407
  t,
34321
- (v, _, T) => {
34322
- r("rhythm", _, `[${v}] ${T}`);
34408
+ (v, T, _) => {
34409
+ r("rhythm", T, `[${v}] ${_}`);
34323
34410
  },
34324
34411
  a,
34325
34412
  !0
@@ -34344,8 +34431,8 @@ class fa {
34344
34431
  "pitch",
34345
34432
  this.createConfigFingerprint("pitch")
34346
34433
  );
34347
- 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, _) => {
34348
- 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);
34349
34436
  }), this.setCache(y, h), r("pitch", 1, "Pitch analysis complete"));
34350
34437
  } else
34351
34438
  r("pitch", 1, "Pitch analysis skipped");
@@ -34479,8 +34566,8 @@ class fa {
34479
34566
  g,
34480
34567
  c.metadata,
34481
34568
  l?.pitchByBeat
34482
- ), v = this.convertToChart(y, t), _ = this.buildLevel(v, y, c, l, "custom");
34483
- r.set(m, _);
34569
+ ), v = this.convertToChart(y, t), T = this.buildLevel(v, y, c, l, "custom");
34570
+ r.set(m, T);
34484
34571
  }
34485
34572
  return n?.({
34486
34573
  stage: "finalizing",
@@ -34616,7 +34703,7 @@ class fa {
34616
34703
  };
34617
34704
  }
34618
34705
  }
34619
- class w0 {
34706
+ class b0 {
34620
34707
  // ============================================================================
34621
34708
  // Export: GeneratedLevel → FullBeatMapExportData
34622
34709
  // ============================================================================
@@ -35542,7 +35629,7 @@ class w0 {
35542
35629
  `);
35543
35630
  }
35544
35631
  }
35545
- function S0(s) {
35632
+ function w0(s) {
35546
35633
  return typeof s == "string" && [
35547
35634
  "humanoid",
35548
35635
  "beast",
@@ -35554,16 +35641,16 @@ function S0(s) {
35554
35641
  "monstrosity"
35555
35642
  ].includes(s);
35556
35643
  }
35557
- function _0(s) {
35644
+ function S0(s) {
35558
35645
  return typeof s == "string" && ["common", "uncommon", "elite", "boss"].includes(s);
35559
35646
  }
35560
- function T0(s) {
35647
+ function _0(s) {
35561
35648
  return typeof s == "string" && ["brute", "archer", "support"].includes(s);
35562
35649
  }
35563
- function C0(s) {
35650
+ function T0(s) {
35564
35651
  return typeof s == "string" && ["easy", "medium", "hard", "deadly"].includes(s);
35565
35652
  }
35566
- class k0 {
35653
+ class C0 {
35567
35654
  /**
35568
35655
  * Calculate average party level
35569
35656
  *
@@ -35811,7 +35898,7 @@ function jy(s, e, t) {
35811
35898
  function Ky(s, e, t) {
35812
35899
  return ur.randomUUID && !s ? ur.randomUUID() : jy(s);
35813
35900
  }
35814
- class A0 {
35901
+ class k0 {
35815
35902
  constructor(e = {}) {
35816
35903
  this.options = {
35817
35904
  validateAudioUrls: !1,
@@ -35872,10 +35959,10 @@ class A0 {
35872
35959
  * See specs/001-core-engine/SPEC.md
35873
35960
  */
35874
35961
  async parseTrack(e, t) {
35875
- const i = ee.parseMetadata(e.metadata);
35962
+ const i = J.parseMetadata(e.metadata);
35876
35963
  if (!i && this.options.strict)
35877
35964
  throw new Error(`Failed to parse metadata for track at index ${t}`);
35878
- 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 || {});
35879
35966
  if (!y) {
35880
35967
  if (this.options.strict)
35881
35968
  throw new Error(`No audio URL found for track: ${d || l}`);
@@ -35891,7 +35978,7 @@ class A0 {
35891
35978
  throw new Error(`Missing required fields for track: ${JSON.stringify({ title: d, artist: h, imageUrl: f })}`);
35892
35979
  return null;
35893
35980
  }
35894
- 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 = {
35895
35982
  id: l,
35896
35983
  uuid: u,
35897
35984
  playlist_index: t,
@@ -35899,16 +35986,16 @@ class A0 {
35899
35986
  platform: c,
35900
35987
  title: d,
35901
35988
  artist: h,
35902
- description: _,
35903
- album: T,
35989
+ description: T,
35990
+ album: _,
35904
35991
  image_url: f,
35905
35992
  audio_url: y,
35906
35993
  audio_url_lossless: v && v !== y ? v : void 0,
35907
35994
  duration: S,
35908
35995
  genre: I,
35909
- tags: Array.isArray(D) ? D.map((Q) => String(Q).toLowerCase()) : [],
35996
+ tags: D,
35910
35997
  bpm: R,
35911
- key: q,
35998
+ key: U,
35912
35999
  attributes: O || void 0,
35913
36000
  extras: W
35914
36001
  };
@@ -36061,26 +36148,26 @@ class Yy {
36061
36148
  r,
36062
36149
  i
36063
36150
  ), d = l.numFrames, h = [];
36064
- for (let _ = 0; _ < d; _++) {
36065
- 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);
36066
36153
  for (let I = 0; I < this.config.melBands; I++) {
36067
36154
  const D = u[I];
36068
36155
  let R = 0;
36069
- for (let q = 0; q < D.length && q < T.length; q++)
36070
- R += T[q] * D[q];
36156
+ for (let U = 0; U < D.length && U < _.length; U++)
36157
+ R += _[U] * D[U];
36071
36158
  S[I] = 20 * Math.log10(R + 1e-10);
36072
36159
  }
36073
36160
  h.push(S);
36074
36161
  }
36075
36162
  const m = new Float32Array(d);
36076
36163
  m[0] = 0;
36077
- for (let _ = 1; _ < d; _++) {
36078
- let T = 0;
36164
+ for (let T = 1; T < d; T++) {
36165
+ let _ = 0;
36079
36166
  for (let S = 0; S < this.config.melBands; S++) {
36080
- const I = h[_][S] - h[_ - 1][S];
36081
- I > 0 && (T += I);
36167
+ const I = h[T][S] - h[T - 1][S];
36168
+ I > 0 && (_ += I);
36082
36169
  }
36083
- m[_] = T;
36170
+ m[T] = _;
36084
36171
  }
36085
36172
  const f = 1 / c, g = wp(
36086
36173
  m,
@@ -36092,11 +36179,11 @@ class Yy {
36092
36179
  f
36093
36180
  ), y = Sp(p), v = new Float32Array(p.length);
36094
36181
  if (y > 1e-10)
36095
- for (let _ = 0; _ < p.length; _++)
36096
- v[_] = p[_] / y;
36182
+ for (let T = 0; T < p.length; T++)
36183
+ v[T] = p[T] / y;
36097
36184
  else
36098
- for (let _ = 0; _ < p.length; _++)
36099
- v[_] = p[_];
36185
+ for (let T = 0; T < p.length; T++)
36186
+ v[T] = p[T];
36100
36187
  return {
36101
36188
  envelope: v,
36102
36189
  numFrames: d,
@@ -36228,23 +36315,23 @@ class Xy {
36228
36315
  );
36229
36316
  let l = this.findPeak(c, 0, c.length);
36230
36317
  if (this.config.useOctaveResolution) {
36231
- const T = this.calculateTPS2(o.values, l), S = Math.floor(l / 2);
36232
- 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);
36233
36320
  }
36234
36321
  if (this.config.useTripleMeter) {
36235
- const T = this.calculateTPS3(o.values, l), S = Math.floor(l / 3);
36236
- 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);
36237
36324
  }
36238
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(
36239
36326
  Math.max(f, p) / (h + 1e-3),
36240
36327
  0
36241
- ), 1), _ = 60 / u;
36328
+ ), 1), T = 60 / u;
36242
36329
  return {
36243
36330
  primaryBpm: u,
36244
36331
  secondaryBpm: d,
36245
36332
  primaryWeight: y,
36246
36333
  secondaryWeight: v,
36247
- targetIntervalSeconds: _
36334
+ targetIntervalSeconds: T
36248
36335
  };
36249
36336
  }
36250
36337
  /**
@@ -36480,31 +36567,31 @@ class Qy {
36480
36567
  effectiveDpAlpha: c
36481
36568
  });
36482
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);
36483
- for (let _ = 0; _ < d.length; _++) {
36484
- const T = l + _, S = Math.log(T / a);
36485
- 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;
36486
36573
  }
36487
36574
  const h = new Int32Array(n);
36488
36575
  h.fill(-1);
36489
36576
  const m = new Float32Array(e);
36490
- for (let _ = u + 1; _ < n; _++) {
36491
- let T = -1 / 0, S = -1;
36577
+ for (let T = u + 1; T < n; T++) {
36578
+ let _ = -1 / 0, S = -1;
36492
36579
  for (let I = 0; I < d.length; I++) {
36493
- const D = _ - (l + I);
36580
+ const D = T - (l + I);
36494
36581
  if (D >= 0 && D < n) {
36495
36582
  const R = d[I] + m[D];
36496
- R > T && (T = R, S = D);
36583
+ R > _ && (_ = R, S = D);
36497
36584
  }
36498
36585
  }
36499
- m[_] = T + e[_], h[_] = S;
36586
+ m[T] = _ + e[T], h[T] = S;
36500
36587
  }
36501
36588
  Ti.debug("BeatTracker: Starting backward pass", {
36502
36589
  maxCumulativeScore: Math.max(...m),
36503
36590
  envelopeLength: n
36504
36591
  });
36505
36592
  let f = 0, g = m[0];
36506
- for (let _ = 1; _ < n; _++)
36507
- m[_] > g && (g = m[_], f = _);
36593
+ for (let T = 1; T < n; T++)
36594
+ m[T] > g && (g = m[T], f = T);
36508
36595
  const p = [];
36509
36596
  let y = f;
36510
36597
  for (; y >= 0 && h[y] >= 0; )
@@ -37598,21 +37685,21 @@ class Ni {
37598
37685
  const u = this.generateGrid(e, c, l);
37599
37686
  let d = this.mergeBeats(t, u, o);
37600
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;
37601
- let _, T;
37688
+ let T, _;
37602
37689
  if (this.options.enableMultiTempo && v) {
37603
37690
  const I = this.runMultiTempoAnalysis(
37604
37691
  t,
37605
37692
  g,
37606
37693
  n
37607
37694
  );
37608
- I && (_ = I.tempoSections, T = !0, _.length > 1 && (d = this.reinterpolateBoundaryRegions(
37695
+ I && (T = I.tempoSections, _ = !0, T.length > 1 && (d = this.reinterpolateBoundaryRegions(
37609
37696
  d,
37610
- _,
37697
+ T,
37611
37698
  t,
37612
37699
  o
37613
37700
  )), Ie.debug("Multi-tempo analysis complete", {
37614
- sectionCount: _.length,
37615
- tempos: _.map((D) => D.bpm)
37701
+ sectionCount: T.length,
37702
+ tempos: T.map((D) => D.bpm)
37616
37703
  }));
37617
37704
  }
37618
37705
  const S = {
@@ -37627,8 +37714,8 @@ class Ni {
37627
37714
  // Multi-tempo fields
37628
37715
  detectedClusterTempos: y.length > 0 ? y : void 0,
37629
37716
  hasMultipleTempos: v,
37630
- tempoSections: _,
37631
- hasMultiTempoApplied: T
37717
+ tempoSections: T,
37718
+ hasMultiTempoApplied: _
37632
37719
  };
37633
37720
  return Ie.debug("Interpolation complete", {
37634
37721
  detectedBeats: t.length,
@@ -37636,7 +37723,7 @@ class Ni {
37636
37723
  totalBeats: d.length,
37637
37724
  interpolationRatio: S.interpolationRatio.toFixed(2),
37638
37725
  hasMultipleTempos: v,
37639
- hasMultiTempoApplied: T
37726
+ hasMultiTempoApplied: _
37640
37727
  }), {
37641
37728
  audioId: i,
37642
37729
  duration: n,
@@ -38269,8 +38356,8 @@ class Ni {
38269
38356
  for (let f = 0; f < l.length; f++) {
38270
38357
  const g = l[f], p = g.timestamp - u, y = Math.round(p / o);
38271
38358
  if (y > 0) {
38272
- const v = c + y * o, T = (g.timestamp - v) / y * n;
38273
- o = o + T;
38359
+ const v = c + y * o, _ = (g.timestamp - v) / y * n;
38360
+ o = o + _;
38274
38361
  for (let S = 1; S < y; S++) {
38275
38362
  const I = u + S * o;
38276
38363
  if (a !== void 0 && I > a) break;
@@ -38309,8 +38396,8 @@ class Ni {
38309
38396
  for (let f = 0; f < l.length; f++) {
38310
38397
  const g = l[f], p = u - g.timestamp, y = Math.round(p / o);
38311
38398
  if (y > 0) {
38312
- const v = c - y * o, T = (g.timestamp - v) / y * n;
38313
- o = o + T;
38399
+ const v = c - y * o, _ = (g.timestamp - v) / y * n;
38400
+ o = o + _;
38314
38401
  for (let S = 1; S < y; S++) {
38315
38402
  const I = u - S * o;
38316
38403
  if (a !== void 0 && I < a) break;
@@ -38352,9 +38439,9 @@ class Ni {
38352
38439
  for (let f = 0; f < i.length; f++) {
38353
38440
  const g = i[f];
38354
38441
  if (c.push(this.createDetectedBeat(g)), f < i.length - 1) {
38355
- 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;
38356
38443
  if (v > 0) {
38357
- const S = T / v * o;
38444
+ const S = _ / v * o;
38358
38445
  m = m + S;
38359
38446
  }
38360
38447
  for (let S = 1; S < v; S++) {
@@ -38967,7 +39054,7 @@ const Ut = class Ut {
38967
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);
38968
39055
  for (let R = 0; R < f.length; R++)
38969
39056
  g[R] = Math.min(255, Math.round(f[R]));
38970
- 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 = [
38971
39058
  ...p.bass,
38972
39059
  ...p.mid,
38973
39060
  ...p.treble
@@ -38975,9 +39062,9 @@ const Ut = class Ut {
38975
39062
  r.push({
38976
39063
  timestamp: c,
38977
39064
  duration: u,
38978
- bass: y / T,
38979
- mid: v / T,
38980
- treble: _ / T,
39065
+ bass: y / _,
39066
+ mid: v / _,
39067
+ treble: T / _,
38981
39068
  amplitude: S,
38982
39069
  rms_energy: S,
38983
39070
  peak: I,
@@ -40358,7 +40445,7 @@ function hv(s) {
40358
40445
  function Ot(s) {
40359
40446
  return Ai(s) ? `${s.embedding} -> ${s.classifier}` : s.modelUrl;
40360
40447
  }
40361
- function mv(s) {
40448
+ function A0(s) {
40362
40449
  if (!s || s.length === 0)
40363
40450
  return [];
40364
40451
  const e = s[0].length;
@@ -40431,14 +40518,14 @@ const _n = {
40431
40518
  mood: Object.keys(oc),
40432
40519
  danceability: Object.keys(cc)
40433
40520
  };
40434
- function fv(s) {
40521
+ function mv(s) {
40435
40522
  const e = {};
40436
40523
  return s.genre && (e.genre = rc[s.genre]), s.mood && (e.mood = oc[s.mood]), s.danceability && (e.danceability = cc[s.danceability]), e;
40437
40524
  }
40438
40525
  class I0 {
40439
40526
  constructor(e = {}) {
40440
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();
40441
- const t = e.preset ? fv(e.preset) : {};
40528
+ const t = e.preset ? mv(e.preset) : {};
40442
40529
  this.options = {
40443
40530
  models: {
40444
40531
  // Start with engine defaults, layer on presets, then explicit models
@@ -40651,111 +40738,32 @@ class I0 {
40651
40738
  clearAllCaches() {
40652
40739
  this.clearEmbeddingCache(), this.clearClassifierCache(), this.resolvedUrlCache.clear();
40653
40740
  }
40654
- /**
40655
- * Computes 128-band mel-spectrogram features for Discogs-EffNet models.
40656
- *
40657
- * Unlike the standard musicnn extractor (96 bands), EffNet requires 128 mel bands.
40658
- * This method uses Essentia WASM's core MelBands algorithm directly.
40659
- *
40660
- * @param audioSignal - Mono audio signal at 16kHz sample rate
40661
- * @returns 2D array of mel-spectrogram frames, shape [frames][128]
40662
- */
40663
- /**
40664
- * Creates a wrapper object that combines EssentiaJS algorithms with WASM utility methods.
40665
- * This is needed because EssentiaJS has algorithms (Windowing, Spectrum, etc.) but lacks
40666
- * utility methods like arrayToVector/vectorToArray which are on the WASM module directly.
40667
- */
40668
- createEssentiaWrapper() {
40669
- const e = new this.essentiaWASM.EssentiaJS(!1);
40670
- return {
40671
- Windowing: e.Windowing.bind(e),
40672
- Spectrum: e.Spectrum.bind(e),
40673
- MelBands: e.MelBands.bind(e),
40674
- UnaryOperator: e.UnaryOperator.bind(e),
40675
- // Utility methods are on the WASM module directly, not on EssentiaJS
40676
- arrayToVector: this.essentiaWASM.arrayToVector,
40677
- vectorToArray: this.essentiaWASM.vectorToArray
40678
- };
40679
- }
40680
- computeEffnetFeatures(e) {
40681
- if (!this.essentiaWASM)
40682
- throw new Error("Essentia WASM not initialized. Call initializeEssentia() first.");
40683
- const t = this.createEssentiaWrapper(), i = [], n = 512, a = 256, r = 16e3, o = 128;
40684
- for (let c = 0; c <= e.length - n; c += a) {
40685
- const l = e.slice(c, c + n), u = t.Windowing(
40686
- t.arrayToVector(l),
40687
- !0,
40688
- // normalized
40689
- n,
40690
- // size (must be explicit, not inferred from frame length)
40691
- "hann",
40692
- // type
40693
- 0,
40694
- // zeroPadding
40695
- !0
40696
- // zeroPhase
40697
- ), d = t.Spectrum(
40698
- u.frame,
40699
- n
40700
- ), h = t.MelBands(
40701
- d.spectrum,
40702
- 8e3,
40703
- // highFrequencyBound (16kHz / 2)
40704
- n / 2,
40705
- // inputSize (FFT output size)
40706
- !1,
40707
- // log (apply log later)
40708
- 0,
40709
- // lowFrequencyBound
40710
- "unit_sum",
40711
- // normalize
40712
- o,
40713
- // numberBands - THE MAGIC NUMBER!
40714
- r,
40715
- // sampleRate
40716
- "power",
40717
- // type
40718
- "slaneyMel",
40719
- // warpingFormula
40720
- "linear"
40721
- // weighting
40722
- ), m = t.UnaryOperator(
40723
- h.bands,
40724
- 1e4,
40725
- // scale pre-log to avoid log(0)
40726
- 1,
40727
- // shift
40728
- "log10"
40729
- // operation
40730
- ), f = Array.from(t.vectorToArray(m.array));
40731
- i.push(f);
40732
- }
40733
- return i;
40734
- }
40735
40741
  /**
40736
40742
  * Gets the appropriate mel-spectrogram features for a given model architecture.
40737
40743
  *
40738
40744
  * Different architectures require different mel-band configurations:
40739
40745
  * - musicnn: 96 bands (default)
40740
- * - effnet: 128 bands (custom)
40746
+ * - effnet: 96 bands (same features as musicnn)
40741
40747
  * - vggish: 64 bands
40742
40748
  * - tempocnn: 40 bands
40743
40749
  *
40744
40750
  * @param audioSignal - Mono audio signal at 16kHz sample rate
40745
40751
  * @param architecture - The model architecture type
40746
- * @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
40747
40755
  */
40748
40756
  getFeaturesForArchitecture(e, t) {
40749
40757
  switch (t) {
40750
40758
  case "effnet":
40751
- return this.computeEffnetFeatures(e);
40759
+ return this.extractor.computeFrameWise(e, 256).melSpectrum;
40752
40760
  case "vggish":
40753
40761
  const i = this.extractors.get("vggish");
40754
- 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));
40755
40763
  case "tempocnn":
40756
- 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);
40757
40765
  default:
40758
- return this.extractor.computeFrameWise(e, 512);
40766
+ return this.extractor.computeFrameWise(e, 256);
40759
40767
  }
40760
40768
  }
40761
40769
  /**
@@ -40779,7 +40787,7 @@ class I0 {
40779
40787
  const i = await (await fetch(e)).arrayBuffer(), n = new (window.AudioContext || window.webkitAudioContext)(), a = await n.decodeAudioData(i), r = await this.extractor.downsampleAudioBuffer(
40780
40788
  a,
40781
40789
  n.sampleRate
40782
- ), o = this.sliceAudioSignal(r, n.sampleRate), c = this.extractor.computeFrameWise(o, 512), l = [], u = {
40790
+ ), o = this.sliceAudioSignal(r, 16e3), c = Math.max(0, Math.floor((o.length - 512) / 256) + 1), l = [], u = {
40783
40791
  genres: [],
40784
40792
  moods: [],
40785
40793
  mood_tags: [],
@@ -40841,8 +40849,8 @@ class I0 {
40841
40849
  analysis_metadata: {
40842
40850
  models_used: l,
40843
40851
  model_used: l.length > 0 ? l[0] : void 0,
40844
- frames_analyzed: c.length,
40845
- duration_analyzed: a.duration,
40852
+ frames_analyzed: c,
40853
+ duration_analyzed: o.length / 16e3,
40846
40854
  analyzed_at: (/* @__PURE__ */ new Date()).toISOString()
40847
40855
  }
40848
40856
  };
@@ -40858,22 +40866,24 @@ class I0 {
40858
40866
  * 2. Classifier model produces class predictions from embeddings
40859
40867
  *
40860
40868
  * @param classifierUrl - URL to the classifier model (GraphModel format)
40861
- * @param embeddings - 2D array of embeddings, shape [frames][embedding_dim]
40862
- * @returns Promise resolving to 1D array of averaged class predictions
40869
+ * @param embeddings - 2D array of embeddings, shape [patches][embedding_dim]
40870
+ * @returns Promise resolving to 1D array of class predictions averaged across patches
40863
40871
  */
40864
40872
  async runClassifierOnEmbeddings(e, t) {
40865
- const i = mv(t);
40866
- if (i.length === 0)
40873
+ if (t.length === 0 || t[0].length === 0)
40867
40874
  return console.warn("Empty embeddings provided to classifier"), [];
40868
- const n = await this.loadModelWithRetry(e), a = Ee.tensor2d([i], [1, i.length]);
40869
- let r = [];
40875
+ const i = await this.loadModelWithRetry(e), n = Ee.tensor2d(t);
40876
+ let a = [];
40870
40877
  try {
40871
- const o = n.predict(a);
40872
- r = await o.data().then((c) => Array.from(c)), o.dispose();
40878
+ 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);
40879
+ for (let h = 0; h < u; h++)
40880
+ for (let m = 0; m < l; m++)
40881
+ d[m] += o[h * l + m];
40882
+ a = d.map((h) => h / u), r.dispose();
40873
40883
  } finally {
40874
- a.dispose(), n.dispose();
40884
+ n.dispose(), i.dispose();
40875
40885
  }
40876
- return r;
40886
+ return a;
40877
40887
  }
40878
40888
  /**
40879
40889
  * Runs a two-step model architecture prediction.
@@ -40945,70 +40955,54 @@ class I0 {
40945
40955
  *
40946
40956
  * EffNet models are TensorFlow.js GraphModels that expect:
40947
40957
  * - Named inputs discovered dynamically from model signature
40948
- * - Mel-spectrogram shape: [batch=64, mel_bands=128, time_frames=96]
40958
+ * - Mel-spectrogram shape: [batch=64, time_frames=128, mel_bands=96]
40949
40959
  *
40950
- * The 'bs64' in model name means fixed batch size of 64.
40960
+ * The input axis order is time-major: each of the 64 patches is 128
40961
+ * consecutive TensorflowInputMusiCNN frames of 96 mel bands. The 'bs64'
40962
+ * in the model name means a fixed batch size of 64.
40951
40963
  *
40952
40964
  * @param model - TensorFlow.js GraphModel instance
40953
- * @param features - 2D array of mel-spectrogram frames, shape [frames][128]
40954
- * @returns 2D array of embeddings, shape [segments][embedding_dim]
40965
+ * @param features - 2D array of mel-spectrogram frames, shape [frames][96]
40966
+ * @returns 2D array of embeddings, one per patch, shape [patches][embedding_dim]
40955
40967
  */
40956
40968
  async runEffnetEmbedding(e, t) {
40957
- const i = t[0]?.length || 128, n = t.length, a = 64, r = 128, o = 96;
40958
- let c = [], l = t;
40959
- if (n < o) {
40960
- const m = Array(i).fill(0);
40961
- for (; l.length < o; )
40962
- l = [...l, m];
40963
- }
40964
- const u = [];
40965
- for (let m = 0; m < a; m++) {
40966
- const f = m * o % l.length, g = [];
40967
- for (let p = 0; p < o; p++) {
40968
- const y = (f + p) % l.length;
40969
- g.push(l[y] || Array(i).fill(0));
40969
+ const i = t.length, n = 64, a = 128, r = 96;
40970
+ if (i === 0)
40971
+ return [];
40972
+ (t[0]?.length ?? 0) !== r && console.warn(
40973
+ `[MusicClassifier] EffNet expects ${r}-band mel features but got ${t[0]?.length}-band frames. Results will be unreliable.`
40974
+ );
40975
+ const o = [], c = Math.max(0, i - a), l = new Array(r).fill(0), u = new Float32Array(n * a * r);
40976
+ for (let h = 0; h < n; h++) {
40977
+ const m = Math.round(h * c / (n - 1));
40978
+ for (let f = 0; f < a; f++) {
40979
+ const g = t[m + f] ?? l, p = (h * a + f) * r;
40980
+ for (let y = 0; y < r; y++)
40981
+ u[p + y] = g[y] ?? 0;
40970
40982
  }
40971
- u.push(g);
40972
40983
  }
40973
- const d = [];
40974
- for (let m = 0; m < a; m++)
40975
- for (let f = 0; f < r; f++)
40976
- for (let g = 0; g < o; g++)
40977
- d.push(u[m][g]?.[f] ?? 0);
40978
- const h = Ee.tensor3d(d, [a, r, o]);
40984
+ const d = Ee.tensor3d(u, [n, a, r]);
40979
40985
  try {
40980
- const m = this.getModelInputNames(e);
40981
- if (m.length === 0)
40986
+ const h = this.getModelInputNames(e);
40987
+ if (h.length === 0)
40982
40988
  throw new Error("Could not discover model input names");
40983
- const f = {};
40984
- for (const _ of m)
40985
- _.includes("melspectrogram") || _.includes("mel") || _.includes("spectrogram") ? f[_] = h : _.includes("saver") || _.includes("filename") ? f[_] = Ee.scalar("") : f[_] = h;
40986
- const g = e.execute(f);
40987
- let p;
40988
- 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")
40989
+ const m = {};
40990
+ for (const _ of h)
40991
+ _.includes("melspectrogram") || _.includes("mel") || _.includes("spectrogram") ? m[_] = d : _.includes("saver") || _.includes("filename") ? m[_] = Ee.scalar("") : m[_] = d;
40992
+ const f = e.execute(m);
40993
+ let g;
40994
+ 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")
40989
40995
  throw new Error("Model execution did not return a valid tensor");
40990
- const y = await p.data(), v = p.shape;
40991
- if (v.length === 2) {
40992
- const _ = v[1], T = [];
40993
- for (let D = 0; D < _; D++) {
40994
- let R = 0;
40995
- for (let q = 0; q < a; q++)
40996
- R += y[q * _ + D];
40997
- T.push(R / a);
40998
- }
40999
- const S = Math.sqrt(T.reduce((D, R) => D + R * R, 0)), I = S > 0 ? T.map((D) => D / S) : T;
41000
- c.push(I);
41001
- } else {
41002
- 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) : _;
41003
- c.push(S);
41004
- }
41005
- p.dispose();
41006
- for (const [_, T] of Object.entries(f))
41007
- T !== h && T.dispose();
40996
+ const p = await g.data(), y = g.shape, v = y[y.length - 1], T = Math.max(1, Math.floor(p.length / v));
40997
+ for (let _ = 0; _ < T; _++)
40998
+ o.push(Array.from(p.slice(_ * v, (_ + 1) * v)));
40999
+ g.dispose();
41000
+ for (const [_, S] of Object.entries(m))
41001
+ S !== d && S.dispose();
41008
41002
  } finally {
41009
- h.dispose();
41003
+ d.dispose();
41010
41004
  }
41011
- return c;
41005
+ return o;
41012
41006
  }
41013
41007
  /**
41014
41008
  * Runs Essentia embedding model inference on mel-spectrogram features.
@@ -41089,7 +41083,9 @@ class I0 {
41089
41083
  return i.terminate && i.terminate(), r;
41090
41084
  }
41091
41085
  mapPredictions(e, t) {
41092
- return e.map((i, n) => ({
41086
+ return e.length > 0 && e.length !== t.length && console.warn(
41087
+ `[MusicClassifier] Model returned ${e.length} outputs but ${t.length} labels are configured — tags may be mislabeled. Check that the label list matches the model.`
41088
+ ), e.map((i, n) => ({
41093
41089
  name: t[n] || `unknown_${n}`,
41094
41090
  confidence: i
41095
41091
  })).sort((i, n) => n.confidence - i.confidence).filter((i) => i.confidence >= this.options.threshold).slice(0, this.options.topN);
@@ -41304,7 +41300,7 @@ class D0 {
41304
41300
  };
41305
41301
  }
41306
41302
  }
41307
- const Tn = Se.for("BeatSubdivider"), gv = {
41303
+ const Tn = Se.for("BeatSubdivider"), fv = {
41308
41304
  tolerance: 0.02,
41309
41305
  // 20ms tolerance
41310
41306
  defaultIntensity: 0.5,
@@ -41320,7 +41316,7 @@ class Xt {
41320
41316
  */
41321
41317
  constructor(e) {
41322
41318
  this.options = {
41323
- ...gv,
41319
+ ...fv,
41324
41320
  ...e
41325
41321
  }, Tn.debug("BeatSubdivider initialized", { options: this.options });
41326
41322
  }
@@ -41358,19 +41354,19 @@ class Xt {
41358
41354
  t.beatSubdivisions.has(g) && r++, i.add(p);
41359
41355
  const y = Dr(p);
41360
41356
  n = Math.max(n, y);
41361
- const v = e.beats[g], _ = g < e.beats.length - 1 ? e.beats[g + 1] : null, T = e.detectedBeatIndices.includes(g);
41357
+ const v = e.beats[g], T = g < e.beats.length - 1 ? e.beats[g + 1] : null, _ = e.detectedBeatIndices.includes(g);
41362
41358
  if (p === "rest" || p === "half" && v.beatInMeasure % 2 !== 0)
41363
41359
  continue;
41364
41360
  const S = p === "dotted4" && v.beatInMeasure % 2 !== 0;
41365
41361
  if (p === "offbeat8" || p === "triplet4" && o(g) === 1 || S || c.push({
41366
41362
  ...v,
41367
- isDetected: T,
41363
+ isDetected: _,
41368
41364
  originalBeatIndex: g,
41369
41365
  subdivisionType: p
41370
- }), _) {
41366
+ }), T) {
41371
41367
  const D = this.createInterpolatedBeatsForSubdivision(
41372
41368
  v,
41373
- _,
41369
+ T,
41374
41370
  g,
41375
41371
  p,
41376
41372
  e,
@@ -42751,7 +42747,7 @@ class L0 {
42751
42747
  this.stop(), this.subscribers.clear(), this.state.scheduledBeats.clear(), we.debug("SubdivisionPlaybackController disposed");
42752
42748
  }
42753
42749
  }
42754
- const pv = [
42750
+ const gv = [
42755
42751
  0,
42756
42752
  // Level 1
42757
42753
  300,
@@ -42792,7 +42788,7 @@ const pv = [
42792
42788
  // Level 19
42793
42789
  355e3
42794
42790
  // Level 20
42795
- ], yv = {
42791
+ ], pv = {
42796
42792
  stationary: 1,
42797
42793
  walking: 1.2,
42798
42794
  running: 1.5,
@@ -42815,11 +42811,11 @@ class lc {
42815
42811
  */
42816
42812
  constructor(e) {
42817
42813
  this.config = {
42818
- level_thresholds: e?.level_thresholds || pv,
42814
+ level_thresholds: e?.level_thresholds || gv,
42819
42815
  xp_per_second: e?.xp_per_second ?? 1,
42820
42816
  xp_per_track_completion: e?.xp_per_track_completion ?? 50,
42821
42817
  activity_bonuses: {
42822
- ...yv,
42818
+ ...pv,
42823
42819
  ...e?.activity_bonuses
42824
42820
  },
42825
42821
  track_mastery_threshold: e?.track_mastery_threshold ?? 10,
@@ -43620,7 +43616,7 @@ class je {
43620
43616
  e.equipment && xe.reapplyEquipmentEffects(e);
43621
43617
  }
43622
43618
  }
43623
- class vv {
43619
+ class yv {
43624
43620
  constructor() {
43625
43621
  this.name = "D&D 5e Standard";
43626
43622
  }
@@ -43637,7 +43633,7 @@ class vv {
43637
43633
  return !e?.forcedAbilities || e.forcedAbilities.length === 0;
43638
43634
  }
43639
43635
  }
43640
- class bv {
43636
+ class vv {
43641
43637
  constructor() {
43642
43638
  this.name = "D&D 5e Smart";
43643
43639
  }
@@ -43686,7 +43682,7 @@ class bv {
43686
43682
  return n;
43687
43683
  }
43688
43684
  }
43689
- class wv {
43685
+ class bv {
43690
43686
  constructor() {
43691
43687
  this.name = "Balanced";
43692
43688
  }
@@ -43708,7 +43704,7 @@ class wv {
43708
43704
  return !1;
43709
43705
  }
43710
43706
  }
43711
- class Sv {
43707
+ class wv {
43712
43708
  constructor() {
43713
43709
  this.name = "Primary Only";
43714
43710
  }
@@ -43731,7 +43727,7 @@ class Sv {
43731
43727
  return n;
43732
43728
  }
43733
43729
  }
43734
- class _v {
43730
+ class Sv {
43735
43731
  constructor() {
43736
43732
  this.name = "Random";
43737
43733
  }
@@ -43748,7 +43744,7 @@ class _v {
43748
43744
  return !1;
43749
43745
  }
43750
43746
  }
43751
- class Tv {
43747
+ class _v {
43752
43748
  constructor() {
43753
43749
  this.name = "Manual";
43754
43750
  }
@@ -43759,7 +43755,7 @@ class Tv {
43759
43755
  return !0;
43760
43756
  }
43761
43757
  }
43762
- class Cv {
43758
+ class Tv {
43763
43759
  constructor(e, t) {
43764
43760
  this.fn = e, this.name = t || "Custom Function";
43765
43761
  }
@@ -43774,20 +43770,20 @@ function pr(s) {
43774
43770
  if (typeof s != "string" && typeof s != "function")
43775
43771
  return s;
43776
43772
  if (typeof s == "function")
43777
- return new Cv(s);
43773
+ return new Tv(s);
43778
43774
  switch (s) {
43779
43775
  case "dnD5e":
43780
- return new vv();
43776
+ return new yv();
43781
43777
  case "dnD5e_smart":
43782
- return new bv();
43778
+ return new vv();
43783
43779
  case "balanced":
43784
- return new wv();
43780
+ return new bv();
43785
43781
  case "primary_only":
43786
- return new Sv();
43782
+ return new wv();
43787
43783
  case "random":
43788
- return new _v();
43784
+ return new Sv();
43789
43785
  case "manual":
43790
- return new Tv();
43786
+ return new _v();
43791
43787
  default:
43792
43788
  const e = s;
43793
43789
  throw new Error(`Unknown strategy type: ${e}`);
@@ -43797,7 +43793,7 @@ const yr = [4, 8, 12, 16, 19], vr = {
43797
43793
  strategy: "dnD5e",
43798
43794
  autoApply: !0
43799
43795
  };
43800
- class kv {
43796
+ class Cv {
43801
43797
  constructor(e) {
43802
43798
  this.config = this.mergeWithDefaults(e), this.strategy = pr(this.config.strategy);
43803
43799
  }
@@ -44343,7 +44339,7 @@ class W0 {
44343
44339
  };
44344
44340
  if (n.xp.current += t, !this.statManager) {
44345
44341
  const d = (n.gameMode || "standard") === "standard" ? "dnD5e" : "dnD5e_smart";
44346
- this.statManager = new kv({ strategy: d }), je.setStatManager(this.statManager);
44342
+ this.statManager = new Cv({ strategy: d }), je.setStatManager(this.statManager);
44347
44343
  }
44348
44344
  let a = !1, r;
44349
44345
  const o = [], c = n.gameMode === "uncapped", l = je.calculateLevel(n.xp.current, c);
@@ -45562,7 +45558,7 @@ const jn = {
45562
45558
  tags: ["magic", "enhanced", "+2", "armor"]
45563
45559
  }
45564
45560
  };
45565
- class Av {
45561
+ class kv {
45566
45562
  /**
45567
45563
  * Open a box and generate its contents
45568
45564
  *
@@ -46149,7 +46145,7 @@ class G0 {
46149
46145
  const o = Y.getInstance().get("equipment").find((d) => d.name === t);
46150
46146
  if (!o || o.type !== "box")
46151
46147
  return null;
46152
- const c = e.equipment.items, l = Av.openBox(o, i, c);
46148
+ const c = e.equipment.items, l = kv.openBox(o, i, c);
46153
46149
  if (!l.success)
46154
46150
  return { character: e, result: l };
46155
46151
  if (l.consumedItems && l.consumedItems.length > 0)
@@ -46521,7 +46517,7 @@ class br {
46521
46517
  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;
46522
46518
  }
46523
46519
  }
46524
- class Mv {
46520
+ class Av {
46525
46521
  constructor() {
46526
46522
  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) => {
46527
46523
  if (!this.isListening || !this.motionCallback) return;
@@ -46633,9 +46629,9 @@ class Mv {
46633
46629
  }
46634
46630
  const uc = re({
46635
46631
  id: z(),
46636
- main: G(),
46637
- description: G(),
46638
- icon: G().optional()
46632
+ main: q(),
46633
+ description: q(),
46634
+ icon: q().optional()
46639
46635
  }), dc = re({
46640
46636
  temp: z(),
46641
46637
  feels_like: z().optional(),
@@ -46652,13 +46648,13 @@ const uc = re({
46652
46648
  gust: z().optional()
46653
46649
  }), mc = re({
46654
46650
  all: z().min(0).max(100)
46655
- }), Iv = re({
46651
+ }), Mv = re({
46656
46652
  type: z().optional(),
46657
46653
  id: z().optional(),
46658
- country: G().optional(),
46654
+ country: q().optional(),
46659
46655
  sunrise: z().nonnegative(),
46660
46656
  sunset: z().nonnegative(),
46661
- pod: G().optional()
46657
+ pod: q().optional()
46662
46658
  // Part of day (d/n) - forecast only
46663
46659
  }), fc = re({
46664
46660
  "1h": z().optional(),
@@ -46671,10 +46667,10 @@ const uc = re({
46671
46667
  }), pc = re({
46672
46668
  lon: z().min(-180).max(180),
46673
46669
  lat: z().min(-90).max(90)
46674
- }), Dv = re({
46670
+ }), Iv = re({
46675
46671
  coord: pc.optional(),
46676
46672
  weather: Te(uc).min(1),
46677
- base: G().optional(),
46673
+ base: q().optional(),
46678
46674
  main: dc,
46679
46675
  visibility: z().nonnegative().optional(),
46680
46676
  wind: hc.optional(),
@@ -46682,12 +46678,12 @@ const uc = re({
46682
46678
  snow: gc.optional(),
46683
46679
  clouds: mc.optional(),
46684
46680
  dt: z().nonnegative(),
46685
- sys: Iv,
46681
+ sys: Mv,
46686
46682
  timezone: z().optional(),
46687
46683
  id: z().optional(),
46688
- name: G().optional(),
46684
+ name: q().optional(),
46689
46685
  cod: z().optional()
46690
- }), Ev = re({
46686
+ }), Dv = re({
46691
46687
  dt: z().nonnegative(),
46692
46688
  main: dc,
46693
46689
  weather: Te(uc).min(1),
@@ -46699,26 +46695,26 @@ const uc = re({
46699
46695
  rain: fc.optional(),
46700
46696
  snow: gc.optional(),
46701
46697
  sys: re({
46702
- pod: G().optional()
46698
+ pod: q().optional()
46703
46699
  }).optional(),
46704
- dt_txt: G().optional()
46705
- }), xv = re({
46706
- cod: ra([G(), z()]),
46700
+ dt_txt: q().optional()
46701
+ }), Ev = re({
46702
+ cod: ra([q(), z()]),
46707
46703
  message: z().optional(),
46708
46704
  cnt: z().nonnegative().optional(),
46709
- list: Te(Ev).min(1),
46705
+ list: Te(Dv).min(1),
46710
46706
  city: re({
46711
46707
  id: z(),
46712
- name: G(),
46708
+ name: q(),
46713
46709
  coord: pc,
46714
- country: G().optional(),
46710
+ country: q().optional(),
46715
46711
  population: z().optional(),
46716
46712
  timezone: z().optional(),
46717
46713
  sunrise: z().optional(),
46718
46714
  sunset: z().optional()
46719
46715
  }).optional()
46720
46716
  }), wr = "weather_api_cache";
46721
- class Rv {
46717
+ class xv {
46722
46718
  constructor(e, t, i) {
46723
46719
  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 = {
46724
46720
  successCount: 0,
@@ -47073,8 +47069,8 @@ class Rv {
47073
47069
  const l = this.calculateJulianDate(c), u = this.calculateJulianCentury(l), d = this.calculateSolarDeclination(u), h = this.calculateHourAngle(e, d, o);
47074
47070
  if (isNaN(h))
47075
47071
  return /* @__PURE__ */ new Date(NaN);
47076
- 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);
47077
- return T.setUTCHours(y, v, _, 0), T;
47072
+ 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);
47073
+ return _.setUTCHours(y, v, T, 0), _;
47078
47074
  }
47079
47075
  /**
47080
47076
  * Calculate current sun position (altitude and azimuth)
@@ -47120,7 +47116,7 @@ class Rv {
47120
47116
  const o = `${this.baseUrl}?lat=${e}&lon=${t}&appid=${this.apiKey}&units=metric`, c = await fetch(o);
47121
47117
  if (!c.ok)
47122
47118
  throw new Error(`Weather API error: ${c.statusText}`);
47123
- const l = await c.json(), u = Dv.safeParse(l);
47119
+ const l = await c.json(), u = Iv.safeParse(l);
47124
47120
  if (!u.success)
47125
47121
  return this.logger.error("Weather API response validation failed", {
47126
47122
  errors: u.error.issues,
@@ -47239,7 +47235,7 @@ class Rv {
47239
47235
  const l = Math.ceil(n / 3), u = `${this.forecastUrl}?lat=${e}&lon=${t}&appid=${this.apiKey}&units=metric&cnt=${l}`, d = await fetch(u);
47240
47236
  if (!d.ok)
47241
47237
  throw new Error(`Weather Forecast API error: ${d.statusText}`);
47242
- const h = await d.json(), m = xv.safeParse(h);
47238
+ const h = await d.json(), m = Ev.safeParse(h);
47243
47239
  if (!m.success)
47244
47240
  return this.logger.error("Weather Forecast API response validation failed", {
47245
47241
  errors: m.error.issues,
@@ -47445,7 +47441,7 @@ function ya(s) {
47445
47441
  function H(s, e, t) {
47446
47442
  return t ? `${e}${s}${F.reset}` : s;
47447
47443
  }
47448
- function Pv(s, e) {
47444
+ function Rv(s, e) {
47449
47445
  switch (s) {
47450
47446
  case "healthy":
47451
47447
  return H("●", F.green, e);
@@ -47457,10 +47453,10 @@ function Pv(s, e) {
47457
47453
  return H("○", F.dim, e);
47458
47454
  }
47459
47455
  }
47460
- function Bv(s, e) {
47456
+ function Pv(s, e) {
47461
47457
  return s ? H("✓ Granted", F.green, e) : H("✗ Denied", F.red, e);
47462
47458
  }
47463
- function Nv(s, e) {
47459
+ function Bv(s, e) {
47464
47460
  return s ? H("Available", F.green, e) : H("Unavailable", F.red, e);
47465
47461
  }
47466
47462
  function va(s) {
@@ -47498,13 +47494,13 @@ function yc(s, e = {}) {
47498
47494
  const t = { ...pa, ...e }, i = ya(t), n = 60;
47499
47495
  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 : ""));
47500
47496
  for (const o of s.sensors) {
47501
- const c = Pv(o.status.health, i), l = H(
47497
+ const c = Rv(o.status.health, i), l = H(
47502
47498
  o.status.health.toUpperCase().padEnd(8),
47503
47499
  o.status.health === "healthy" ? F.green : o.status.health === "failed" ? F.red : F.yellow,
47504
47500
  i
47505
47501
  );
47506
47502
  if (console.log(`
47507
- ${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) {
47503
+ ${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) {
47508
47504
  const u = o.status.lastError.length > 40 ? o.status.lastError.substring(0, 37) + "..." : o.status.lastError;
47509
47505
  console.log(` Last Error: ${H(u, F.red, i)}`);
47510
47506
  }
@@ -47587,7 +47583,7 @@ ${H("┌─ API PERFORMANCE", F.cyan, i)}`), console.log(Pe(20) + (i ? F.reset :
47587
47583
  ${Pe(n)}
47588
47584
  `);
47589
47585
  }
47590
- function Fv(s, e = {}) {
47586
+ function Nv(s, e = {}) {
47591
47587
  const t = { ...pa, ...e }, i = ya(t);
47592
47588
  if (console.log(ba("SENSOR SYSTEM DASHBOARD", 70, i)), t.showTimestamp) {
47593
47589
  const a = s.environmental?.timestamp || s.gaming?.timestamp || Date.now();
@@ -47611,7 +47607,7 @@ function Fv(s, e = {}) {
47611
47607
  const bc = {
47612
47608
  displayEnvironmentalDiagnostics: yc,
47613
47609
  displayGamingDiagnostics: vc,
47614
- displaySystemDashboard: Fv
47610
+ displaySystemDashboard: Nv
47615
47611
  };
47616
47612
  class U0 {
47617
47613
  /**
@@ -47661,7 +47657,7 @@ class U0 {
47661
47657
  const a = e;
47662
47658
  i = a.weather?.apiKey ?? "", n = a.geolocation, a.retry && (this.retryConfig = { ...this.retryConfig, ...a.retry }), a.xpModifier && (this.xpConfig = { ...this.xpConfig, ...a.xpModifier });
47663
47659
  }
47664
- this.geolocation = n ? new br(n) : new br(), this.motion = new Mv(), this.weather = new Rv(i), this.initializeSensorStatuses();
47660
+ this.geolocation = n ? new br(n) : new br(), this.motion = new Av(), this.weather = new xv(i), this.initializeSensorStatuses();
47665
47661
  }
47666
47662
  /**
47667
47663
  * Initialize sensor statuses to 'unknown' state
@@ -48182,7 +48178,7 @@ class U0 {
48182
48178
  return this.weather.getSolarInfo(e, t, i);
48183
48179
  }
48184
48180
  }
48185
- class $v {
48181
+ class Fv {
48186
48182
  constructor(e = "") {
48187
48183
  this.baseUrl = "https://api.steampowered.com", this.logger = Se.for("SteamAPIClient"), this.currentGameApiMetrics = {
48188
48184
  successCount: 0,
@@ -48400,7 +48396,7 @@ class V0 {
48400
48396
  totalGamingMinutes: 0,
48401
48397
  gamesPlayedWhileListening: [],
48402
48398
  lastUpdated: Date.now()
48403
- }, 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);
48399
+ }, 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);
48404
48400
  }
48405
48401
  /**
48406
48402
  * Authenticate with Steam
@@ -48574,7 +48570,7 @@ class V0 {
48574
48570
  bc.displayGamingDiagnostics(this.getDiagnostics(), e);
48575
48571
  }
48576
48572
  }
48577
- const Ov = {
48573
+ const $v = {
48578
48574
  geolocation: {
48579
48575
  cacheTTL: 300 * 1e3,
48580
48576
  // 5 minutes
@@ -48626,7 +48622,7 @@ const Ov = {
48626
48622
  backoffMultiplier: 2
48627
48623
  }
48628
48624
  };
48629
- function Lv() {
48625
+ function Ov() {
48630
48626
  const s = {};
48631
48627
  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 = {
48632
48628
  ...s.gaming,
@@ -48641,8 +48637,8 @@ function Lv() {
48641
48637
  return s;
48642
48638
  }
48643
48639
  function j0(s = {}) {
48644
- const e = Lv();
48645
- return Kn(Ov, Kn(e, s));
48640
+ const e = Ov();
48641
+ return Kn($v, Kn(e, s));
48646
48642
  }
48647
48643
  function Kn(s, e) {
48648
48644
  const t = { ...s };
@@ -48652,7 +48648,7 @@ function Kn(s, e) {
48652
48648
  }
48653
48649
  return t;
48654
48650
  }
48655
- const zv = [
48651
+ const Lv = [
48656
48652
  0,
48657
48653
  300,
48658
48654
  900,
@@ -48675,7 +48671,7 @@ const zv = [
48675
48671
  355e3
48676
48672
  ], Lt = {
48677
48673
  xp: {
48678
- level_thresholds: zv,
48674
+ level_thresholds: Lv,
48679
48675
  xp_per_second: 1,
48680
48676
  xp_per_track_completion: 50,
48681
48677
  activity_bonuses: {
@@ -51333,7 +51329,7 @@ export {
51333
51329
  eu as AICombatRunner,
51334
51330
  vu as ALL_CLASSES,
51335
51331
  Q0 as ALL_ENCHANTMENTS,
51336
- s0 as ALL_GRID_TYPES,
51332
+ a0 as ALL_GRID_TYPES,
51337
51333
  wu as ALL_RACES,
51338
51334
  Z0 as ARMOR_ENCHANTMENTS,
51339
51335
  M0 as AVAILABLE_PRESETS,
@@ -51343,21 +51339,21 @@ export {
51343
51339
  Eg as ArweaveGatewayManager,
51344
51340
  Re as AttackResolver,
51345
51341
  hr as AudioAnalyzer,
51346
- Bb as AudioProfileSchema,
51342
+ Pb as AudioProfileSchema,
51347
51343
  zl as BASE_PLAYS_THRESHOLD,
51348
51344
  Wl as BASE_XP_THRESHOLD,
51349
- qv as BEAT_ACCURACY_THRESHOLDS,
51345
+ Hv as BEAT_ACCURACY_THRESHOLDS,
51350
51346
  Al as BEAT_DETECTION_ALGORITHM,
51351
51347
  kl as BEAT_DETECTION_VERSION,
51352
- Db as BalanceValidator,
51353
- wv as BalancedStrategy,
51348
+ Ib as BalanceValidator,
51349
+ bv as BalancedStrategy,
51354
51350
  ma as BeatConverter,
51355
51351
  Ni as BeatInterpolator,
51356
51352
  Ye as BeatMapGenerator,
51357
51353
  iv as BeatStream,
51358
51354
  Xt as BeatSubdivider,
51359
51355
  Qy as BeatTracker,
51360
- Av as BoxOpener,
51356
+ kv as BoxOpener,
51361
51357
  bn as ButtonMapper,
51362
51358
  bu as CLASS_AUDIO_PREFERENCES,
51363
51359
  tt as CLASS_DATA,
@@ -51367,7 +51363,7 @@ export {
51367
51363
  En as CR_TO_XP,
51368
51364
  J0 as CURSES,
51369
51365
  ua as CharacterGenerator,
51370
- Nb as CharacterSheetSchema,
51366
+ Bb as CharacterSheetSchema,
51371
51367
  W0 as CharacterUpdater,
51372
51368
  zn as ClassSuggester,
51373
51369
  D0 as ColorExtractor,
@@ -51376,7 +51372,7 @@ export {
51376
51372
  Ql as CombatMetricsTracker,
51377
51373
  $i as CombatSimulator,
51378
51374
  $u as CombatantAccumulator,
51379
- xb as ComparativeAnalyzer,
51375
+ Eb as ComparativeAnalyzer,
51380
51376
  qp as CompositeStreamGenerator,
51381
51377
  cc as DANCEABILITY_PRESETS,
51382
51378
  ec as DDR_PATTERN_LIBRARY,
@@ -51398,9 +51394,9 @@ export {
51398
51394
  Qs as DEFAULT_RACIAL_TRAITS,
51399
51395
  da as DEFAULT_RHYTHMIC_BALANCE_CONFIG,
51400
51396
  nt as DEFAULT_RHYTHM_XP_CONFIG,
51401
- Ov as DEFAULT_SENSOR_CONFIG,
51397
+ $v as DEFAULT_SENSOR_CONFIG,
51402
51398
  er as DEFAULT_SKILLS,
51403
- e0 as DEFAULT_SKILL_CATEGORIES,
51399
+ Qb as DEFAULT_SKILL_CATEGORIES,
51404
51400
  Ir as DEFAULT_SUBDIVISION_CONFIG,
51405
51401
  Cl as DEFAULT_SUBDIVISION_PLAYBACK_OPTIONS,
51406
51402
  Ko as DEFAULT_TEMPO_AWARE_CONFIG,
@@ -51410,8 +51406,8 @@ export {
51410
51406
  ue as DiceRoller,
51411
51407
  _s as DifficultyCalculator,
51412
51408
  Un as DifficultyVariantGenerator,
51413
- bv as DnD5eSmartStrategy,
51414
- vv as DnD5eStandardStrategy,
51409
+ vv as DnD5eSmartStrategy,
51410
+ yv as DnD5eStandardStrategy,
51415
51411
  yl as EASY_ACCURACY_THRESHOLDS,
51416
51412
  Dl as EASY_GROOVE_PENALTIES,
51417
51413
  Qp as EASY_QUARTER_NOTE_BPM,
@@ -51448,13 +51444,13 @@ export {
51448
51444
  Vs as KNOWN_GATEWAY_HOSTS,
51449
51445
  la as KNOWN_IPFS_GATEWAY_HOSTS,
51450
51446
  fa as LevelGenerator,
51451
- w0 as LevelSerializer,
51447
+ b0 as LevelSerializer,
51452
51448
  je as LevelUpProcessor,
51453
51449
  _g as LogLevel,
51454
51450
  Se as Logger,
51455
51451
  Jt as MAGIC_ITEMS,
51456
51452
  Su as MASTERY_BONUS_XP,
51457
- Cb as MASTERY_THRESHOLD,
51453
+ Tb as MASTERY_THRESHOLD,
51458
51454
  qa as MAX_BEATS_PER_MEASURE,
51459
51455
  ni as MAX_PRESTIGE_LEVEL,
51460
51456
  Ua as MAX_SUBDIVISION_DENSITY,
@@ -51464,8 +51460,8 @@ export {
51464
51460
  bl as MEL_BANDS_PRESETS,
51465
51461
  Ha as MIN_BEATS_PER_MEASURE,
51466
51462
  oc as MOOD_PRESETS,
51467
- Tv as ManualStrategy,
51468
- ee as MetadataExtractor,
51463
+ _v as ManualStrategy,
51464
+ J as MetadataExtractor,
51469
51465
  zg as ModelCache,
51470
51466
  Ip as MultiBandAnalyzer,
51471
51467
  I0 as MusicClassifier,
@@ -51474,34 +51470,34 @@ export {
51474
51470
  Ll as PRESTIGE_ROMAN_NUMERALS,
51475
51471
  ja as PRESTIGE_SCALING_FACTOR,
51476
51472
  Wr as PROFICIENCY_BONUS,
51477
- Eb as ParameterSweep,
51478
- k0 as PartyAnalyzer,
51473
+ Db as ParameterSweep,
51474
+ C0 as PartyAnalyzer,
51479
51475
  Bp as PhraseAnalyzer,
51480
- d0 as PitchAnalyzer,
51476
+ u0 as PitchAnalyzer,
51481
51477
  dy as PitchBeatLinker,
51482
51478
  Xo as PitchDetector,
51483
- A0 as PlaylistParser,
51479
+ k0 as PlaylistParser,
51484
51480
  Sg as PlaylistTrackSchema,
51485
51481
  Ce as PrestigeSystem,
51486
- Sv as PrimaryOnlyStrategy,
51487
- Ab as RACE_DATA,
51482
+ wv as PrimaryOnlyStrategy,
51483
+ kb as RACE_DATA,
51488
51484
  Nr as RARITY_CONFIGS,
51489
51485
  X0 as RESISTANCE_ENCHANTMENTS,
51490
51486
  Zo as RHYTHM_PRESETS,
51491
51487
  mp as RaceSelector,
51492
- _v as RandomStrategy,
51488
+ Sv as RandomStrategy,
51493
51489
  mt as RhythmGenerator,
51494
51490
  jo as RhythmQuantizer,
51495
51491
  H0 as RhythmXPCalculator,
51496
51492
  Zp as RhythmicBalancer,
51497
- Tb as SKILL_ABILITY_MAP,
51493
+ _b as SKILL_ABILITY_MAP,
51498
51494
  Lr as SPELL_DATABASE,
51499
51495
  ms as SPELL_SLOTS_BY_CLASS,
51500
51496
  Ge as SUBDIVISION_LIMITS,
51501
51497
  iu as SeededDiceRoller,
51502
51498
  Ve as SeededRNG,
51503
51499
  bc as SensorDashboard,
51504
- Pb as ServerlessPlaylistSchema,
51500
+ Rb as ServerlessPlaylistSchema,
51505
51501
  z0 as SessionTracker,
51506
51502
  Fu as SimulationAggregator,
51507
51503
  fp as SkillAssigner,
@@ -51512,10 +51508,10 @@ export {
51512
51508
  tr as SpellManager,
51513
51509
  it as SpellQuery,
51514
51510
  rt as SpellValidator,
51515
- kv as StatManager,
51511
+ Cv as StatManager,
51516
51512
  Lp as StreamScorer,
51517
51513
  L0 as SubdivisionPlaybackController,
51518
- Qv as TUNING_FACTORS,
51514
+ Jv as TUNING_FACTORS,
51519
51515
  Rp as TempoAwareQuantizer,
51520
51516
  Xy as TempoDetector,
51521
51517
  Ep as TransientDetector,
@@ -51526,7 +51522,7 @@ export {
51526
51522
  Yl as XP_BUDGET_PER_LEVEL,
51527
51523
  Ii as XP_THRESHOLDS,
51528
51524
  pw as applyTemplate,
51529
- eb as applyTuning,
51525
+ Qv as applyTuning,
51530
51526
  ep as areAppearanceDefaultsInitialized,
51531
51527
  lp as areClassDefaultsInitialized,
51532
51528
  sp as areEquipmentDefaultsInitialized,
@@ -51539,12 +51535,12 @@ export {
51539
51535
  fu as asClass,
51540
51536
  R0 as assignKeyToBeat,
51541
51537
  P0 as assignKeysToBeats,
51542
- mv as averageEmbeddings,
51543
- tb as calculateAdjustedXP,
51538
+ A0 as averageEmbeddings,
51539
+ eb as calculateAdjustedXP,
51544
51540
  Fl as calculateBeatInMeasure,
51545
51541
  iy as calculateMaxAchievableDensity,
51546
51542
  Sp as calculateStdDev,
51547
- jv as chartedBeatMapToBeatMap,
51543
+ Vv as chartedBeatMapToBeatMap,
51548
51544
  N0 as clearAllKeys,
51549
51545
  qe as constructGatewayUrl,
51550
51546
  Gn as convertToAllowedGridType,
@@ -51552,7 +51548,7 @@ export {
51552
51548
  ow as createConstitutionEnchantment,
51553
51549
  rw as createDexterityEnchantment,
51554
51550
  cw as createIntelligenceEnchantment,
51555
- Fb as createLogger,
51551
+ Nb as createLogger,
51556
51552
  bp as createMelFilterbank,
51557
51553
  tu as createSeededRoller,
51558
51554
  pr as createStatIncreaseStrategy,
@@ -51564,8 +51560,8 @@ export {
51564
51560
  Sn as detectModelArchitecture,
51565
51561
  yc as displayEnvironmentalDiagnostics,
51566
51562
  vc as displayGamingDiagnostics,
51567
- Fv as displaySystemDashboard,
51568
- i0 as ensureAllDefaultsInitialized,
51563
+ Nv as displaySystemDashboard,
51564
+ t0 as ensureAllDefaultsInitialized,
51569
51565
  xo as ensureAppearanceDefaultsInitialized,
51570
51566
  Lo as ensureClassDefaultsInitialized,
51571
51567
  Bo as ensureEquipmentDefaultsInitialized,
@@ -51574,45 +51570,45 @@ export {
51574
51570
  Fo as ensureRaceDefaultsInitialized,
51575
51571
  hp as ensureSkillDefaultsInitialized,
51576
51572
  Ln as ensureSpellDefaultsInitialized,
51577
- Qb as evaluateMixConditions,
51573
+ Jb as evaluateMixConditions,
51578
51574
  Rg as extractIPFSPath,
51579
51575
  B0 as extractKeyMap,
51580
51576
  Kp as findActiveSegment,
51581
51577
  Ot as formatModelForMetadata,
51582
51578
  qo as gaussianSmooth,
51583
- Xv as generateSeed,
51579
+ Zv as generateSeed,
51584
51580
  kn as getAccuracyThresholdsForPreset,
51585
51581
  nw as getAllCurses,
51586
51582
  iw as getAllEnchantments,
51587
- Yb as getAllGatewayUrls,
51583
+ Kb as getAllGatewayUrls,
51588
51584
  uu as getAllRarities,
51589
- o0 as getAllowedGridTypes,
51590
- zb as getArtists,
51591
- $b as getAudioUrls,
51585
+ r0 as getAllowedGridTypes,
51586
+ Lb as getArtists,
51587
+ Fb as getAudioUrls,
51592
51588
  Xl as getAveragePartyLevel,
51593
51589
  Br as getCRFromXP,
51594
51590
  zr as getClassData,
51595
51591
  fs as getClassSpellList,
51596
51592
  yp as getClassStartingEquipment,
51597
51593
  Pl as getConsecutiveKeyLimit,
51598
- a0 as getControllerModeBalanceDefaults,
51599
- n0 as getControllerModeScoringDefaults,
51594
+ n0 as getControllerModeBalanceDefaults,
51595
+ i0 as getControllerModeScoringDefaults,
51600
51596
  tw as getCurse,
51601
51597
  fw as getCursedItems,
51602
51598
  ew as getEnchantment,
51603
51599
  aw as getEnchantmentsByType,
51604
51600
  Mi as getEncounterMultiplier,
51605
- Ib as getFeatureQuery,
51606
- Vb as getFullTracks,
51601
+ Mb as getFeatureQuery,
51602
+ Ub as getFullTracks,
51607
51603
  Mr as getGaussianSmoothMs,
51608
51604
  hv as getGenreLabels,
51609
- Wb as getGenres,
51605
+ zb as getGenres,
51610
51606
  Rl as getGroovePenaltiesForPreset,
51611
51607
  en as getGrooveTier,
51612
51608
  Ml as getGrooveWindowMs,
51613
- ob as getHigherRarity,
51609
+ rb as getHigherRarity,
51614
51610
  kr as getHopSizeMs,
51615
- Ob as getImageUrls,
51611
+ $b as getImageUrls,
51616
51612
  gw as getItemsWithProperty,
51617
51613
  $0 as getKeyCount,
51618
51614
  dw as getMagicItem,
@@ -51620,48 +51616,48 @@ export {
51620
51616
  hw as getMagicItemsByType,
51621
51617
  Ar as getMelBands,
51622
51618
  Up as getMetricGroupSize,
51623
- Vv as getMinHotnessForTier,
51624
- v0 as getPatternById,
51625
- h0 as getPatternLibrary,
51626
- b0 as getPatternLibraryStats,
51627
- m0 as getPatternsByCategory,
51628
- f0 as getPatternsByDifficulty,
51629
- p0 as getPatternsByKeyCount,
51630
- g0 as getPatternsByTags,
51619
+ Uv as getMinHotnessForTier,
51620
+ y0 as getPatternById,
51621
+ d0 as getPatternLibrary,
51622
+ v0 as getPatternLibraryStats,
51623
+ h0 as getPatternsByCategory,
51624
+ m0 as getPatternsByDifficulty,
51625
+ g0 as getPatternsByKeyCount,
51626
+ f0 as getPatternsByTags,
51631
51627
  Xn as getRaceData,
51632
- Mb as getRaceDataAsync,
51633
- y0 as getRandomPattern,
51628
+ Ab as getRaceDataAsync,
51629
+ p0 as getRandomPattern,
51634
51630
  wt as getRarityConfig,
51635
- l0 as getRhythmPreset,
51636
- u0 as getRhythmPresetNames,
51637
- rb as getSignatureDie,
51638
- _b as getSkillQuery,
51639
- kb as getSpellQuery,
51631
+ c0 as getRhythmPreset,
51632
+ l0 as getRhythmPresetNames,
51633
+ sb as getSignatureDie,
51634
+ Sb as getSkillQuery,
51635
+ Cb as getSpellQuery,
51640
51636
  Hr as getSpellSlotsForClass,
51641
51637
  Dr as getSubdivisionDensity,
51642
- Hb as getTags,
51643
- nb as getTemplateById,
51644
- sb as getTemplatesByArchetype,
51645
- ab as getTemplatesByCategory,
51638
+ Wb as getTags,
51639
+ ib as getTemplateById,
51640
+ ab as getTemplatesByArchetype,
51641
+ nb as getTemplatesByCategory,
51646
51642
  at as getTempoAwareAllowedGridTypes,
51647
- qb as getTotalDuration,
51648
- Gb as getTrackCount,
51643
+ Hb as getTotalDuration,
51644
+ qb as getTrackCount,
51649
51645
  Wg as getTrackExtras,
51650
- Jb as getTrackMetadata,
51651
- Lb as getTrackTitles,
51652
- Ub as getTracks,
51646
+ Xb as getTrackMetadata,
51647
+ Ob as getTrackTitles,
51648
+ Gb as getTracks,
51653
51649
  O0 as getUsedKeys,
51654
- Kb as getVRMTracks,
51655
- jb as getVRMs,
51650
+ jb as getVRMTracks,
51651
+ Vb as getVRMs,
51656
51652
  Zn as getXPBudgetForParty,
51657
51653
  Zl as getXPBudgetPerLevel,
51658
51654
  Pr as getXPForCR,
51659
51655
  F0 as hasRequiredKeys,
51660
51656
  ht as hashSeedToFloat,
51661
- Jv as hashSeedToInt,
51657
+ Xv as hashSeedToInt,
51662
51658
  wp as highPassFilter,
51663
51659
  nr as hzToMel,
51664
- t0 as initializeAllDefaults,
51660
+ e0 as initializeAllDefaults,
51665
51661
  Eo as initializeAppearanceDefaults,
51666
51662
  Oo as initializeClassDefaults,
51667
51663
  Po as initializeEquipmentDefaults,
@@ -51672,24 +51668,24 @@ export {
51672
51668
  Ro as initializeSpellDefaults,
51673
51669
  Wt as isArweaveUrl,
51674
51670
  $l as isFullBeatMapExportData,
51675
- r0 as isGridTypeAllowed,
51676
- Zb as isIPFS,
51671
+ s0 as isGridTypeAllowed,
51672
+ Yb as isIPFS,
51677
51673
  Ol as isLevelPackExport,
51678
51674
  Vp as isMetricStrongBeat,
51679
51675
  jp as isMetricWeakBeat,
51680
- Yv as isPrestigeLevel,
51676
+ Kv as isPrestigeLevel,
51681
51677
  fr as isSingleStepModel,
51682
51678
  Yp as isStrongBeatForEmphasis,
51683
51679
  Ai as isTwoStepModel,
51684
- Zv as isValidAIPlayStyle,
51680
+ Yv as isValidAIPlayStyle,
51685
51681
  Xa as isValidClass,
51686
- C0 as isValidEncounterDifficulty,
51687
- ib as isValidEncounterDifficultyUtil,
51688
- T0 as isValidEnemyArchetype,
51689
- S0 as isValidEnemyCategory,
51690
- _0 as isValidEnemyRarity,
51682
+ T0 as isValidEncounterDifficulty,
51683
+ tb as isValidEncounterDifficultyUtil,
51684
+ _0 as isValidEnemyArchetype,
51685
+ w0 as isValidEnemyCategory,
51686
+ S0 as isValidEnemyRarity,
51691
51687
  Mn as isValidSubdivisionType,
51692
- Lv as loadConfigFromEnv,
51688
+ Ov as loadConfigFromEnv,
51693
51689
  Nl as mapGridToSubdivision,
51694
51690
  vp as melToHz,
51695
51691
  xr as mergeButtonMappingConfig,
@@ -51697,38 +51693,38 @@ export {
51697
51693
  K0 as mergeProgressionConfig,
51698
51694
  Pn as mergeRhythmXPConfig,
51699
51695
  Ht as modelCache,
51700
- c0 as naturalDifficultyToLevel,
51696
+ o0 as naturalDifficultyToLevel,
51701
51697
  Nt as parseArweaveUrl,
51702
51698
  _p as performBeatFFT,
51703
51699
  Go as performSTFT,
51704
- Hv as reapplyDownbeatConfig,
51700
+ Wv as reapplyDownbeatConfig,
51705
51701
  Hi as resampleAudio,
51706
- Xb as resolveIPFSLink,
51707
- Rb as shouldAccuracyBreakCombo,
51702
+ Zb as resolveIPFSLink,
51703
+ xb as shouldAccuracyBreakCombo,
51708
51704
  x0 as subdivideBeatMap,
51709
51705
  Hl as toPrestigeLevel,
51710
51706
  Vn as unifyBeatMap,
51711
51707
  Bl as validateButtonMappingConfig,
51712
- cb as validateClassFeature,
51713
- ub as validateClassFeatures,
51708
+ ob as validateClassFeature,
51709
+ lb as validateClassFeatures,
51714
51710
  _r as validateDownbeatConfig,
51715
51711
  Tr as validateDownbeatConfigAgainstBeats,
51716
- lb as validateRacialTrait,
51717
- db as validateRacialTraits,
51718
- hb as validateSkill,
51719
- pb as validateSkillListDefinition,
51720
- yb as validateSkillPrerequisites,
51721
- gb as validateSkillProficiencies,
51722
- fb as validateSkillProficiency,
51723
- mb as validateSkills,
51724
- vb as validateSpell,
51725
- Sb as validateSpellPrerequisites,
51726
- wb as validateSpellPrerequisitesSchema,
51727
- bb as validateSpells,
51712
+ cb as validateRacialTrait,
51713
+ ub as validateRacialTraits,
51714
+ db as validateSkill,
51715
+ gb as validateSkillListDefinition,
51716
+ pb as validateSkillPrerequisites,
51717
+ fb as validateSkillProficiencies,
51718
+ mb as validateSkillProficiency,
51719
+ hb as validateSkills,
51720
+ yb as validateSpell,
51721
+ wb as validateSpellPrerequisites,
51722
+ bb as validateSpellPrerequisitesSchema,
51723
+ vb as validateSpells,
51728
51724
  Er as validateSubdivisionConfig,
51729
51725
  Tl as validateSubdivisionConfigAgainstBeats,
51730
- Uv as validateSubdivisionDensity,
51726
+ Gv as validateSubdivisionDensity,
51731
51727
  ay as validateSubdivisionLimits,
51732
- Gv as validateThresholds,
51733
- Kv as validateTrackMatch
51728
+ qv as validateThresholds,
51729
+ jv as validateTrackMatch
51734
51730
  };