playlist-data-engine 1.7.0 → 1.7.2

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.
@@ -2,8 +2,8 @@ import { d as nn, h as rn, l as Hi, n as on, o as ln, p as cn, q as un, s as dn,
2
2
  import { A as Qp, C as em, E as tm, F as am, k as im, B as sm, j as nm, H as rm, I as om, J as lm, D as cm, K as um, L as dm, M as hm, N as pm, O as mm, Q as gm, T as fm, U as ym, V as vm, e as bm, W as wm, X as Sm, Y as _m, Z as km, _ as Am, $ as Tm, G as Cm, a0 as Im, a1 as Mm, a2 as Em, a3 as Dm, a4 as Rm, a5 as xm, a6 as Pm, a7 as $m, a8 as Nm, a9 as Om, aa as Bm, ab as Lm, ac as Fm, ad as Wm, ae as Hm, P as zm, af as qm, R as Um, ag as jm, ah as Gm, ai as Vm, S as Zm, aj as Ym, ak as Xm, al as Km, am as Jm, an as Qm, a as eg, ao as tg, ap as ag, aq as ig, ar as sg, as as ng, at as rg, au as og, av as lg, aw as cg, ax as ug, ay as dg, az as hg, aA as pg, aB as mg, aC as gg, aD as fg, aE as yg, aF as vg, aG as bg, aH as wg, aI as Sg, aJ as _g, aK as kg, aL as Ag, aM as Tg, aN as Cg, aO as Ig, aP as Mg, aQ as Eg, aR as Dg, aS as Rg, aT as xg, i as Pg, aU as $g, f as Ng, aV as Og, aW as Bg, aX as Lg, b as Fg, aY as Wg, m as Hg, aZ as zg, a_ as qg, a$ as Ug, b0 as jg, r as Gg, v as Vg, b1 as Zg, b2 as Yg, b3 as Xg, b4 as Kg, b5 as Jg, b6 as Qg } from "./unifyBeatMap-k6vw_JPQ.js";
3
3
  import { a as wt, L as ye } from "./arweaveGatewayManager-DDSO5sLJ.js";
4
4
  import { A as tf, D as af, K as sf, b as nf, c as rf, d as of, g as lf, i as cf, p as uf } from "./arweaveGatewayManager-DDSO5sLJ.js";
5
- import { M as ge } from "./gateway-PjLtANkX.js";
6
- import { D as hf, K as pf, e as mf, g as gf, a as ff, b as yf, c as vf, d as bf, f as wf, h as Sf, i as _f, j as kf, k as Af, l as Tf, m as Cf, n as If, r as Mf } from "./gateway-PjLtANkX.js";
5
+ import { M as ge } from "./gateway-DyR4M-uH.js";
6
+ import { D as hf, K as pf, e as mf, g as gf, a as ff, b as yf, c as vf, d as bf, f as wf, h as Sf, i as _f, j as kf, k as Af, l as Tf, m as Cf, n as If, r as Mf } from "./gateway-DyR4M-uH.js";
7
7
  const yn = {
8
8
  0: "",
9
9
  1: "I",
@@ -11694,21 +11694,21 @@ const T = class T {
11694
11694
  rarity: r,
11695
11695
  seed: `${t}-equipment`
11696
11696
  });
11697
- let B, J;
11697
+ let L, J;
11698
11698
  if (u?.attackLevel !== void 0) {
11699
11699
  const D = ft(m, u.attackLevel, r, h.archetype);
11700
- B = D.damageDie, J = D.damageModifier;
11700
+ L = D.damageDie, J = D.damageModifier;
11701
11701
  } else {
11702
11702
  const D = ft(m, g, r, h.archetype);
11703
- B = D.damageDie, J = D.damageModifier;
11703
+ L = D.damageDie, J = D.damageModifier;
11704
11704
  }
11705
11705
  const X = [];
11706
11706
  if ($.weapon) {
11707
11707
  const D = ze.getEquipmentName($.weapon.id), N = et[D];
11708
11708
  N && X.push({
11709
11709
  name: D,
11710
- damage: `${B} + ${J}`,
11711
- damage_dice: B,
11710
+ damage: `${L} + ${J}`,
11711
+ damage_dice: L,
11712
11712
  damage_type: N.damage?.damageType || h.signatureAbility.damageType,
11713
11713
  type: h.signatureAbility.attackType,
11714
11714
  range: h.signatureAbility.range,
@@ -11718,8 +11718,8 @@ const T = class T {
11718
11718
  }
11719
11719
  X.length === 0 && X.push({
11720
11720
  name: h.signatureAbility.name,
11721
- damage: `${B} + ${J}`,
11722
- damage_dice: B,
11721
+ damage: `${L} + ${J}`,
11722
+ damage_dice: L,
11723
11723
  damage_type: h.signatureAbility.damageType,
11724
11724
  type: h.signatureAbility.attackType,
11725
11725
  range: h.signatureAbility.range,
@@ -11739,7 +11739,7 @@ const T = class T {
11739
11739
  let K;
11740
11740
  if (u?.defenseLevel !== void 0 ? K = ei(m, u.defenseLevel, h.baseAC, $) : K = ei(m, g, h.baseAC, $), a !== void 0) {
11741
11741
  const D = h.archetype === "brute" ? "STR" : h.archetype === "archer" ? "DEX" : "CHA", N = T.estimateWeaponDPR(
11742
- B,
11742
+ L,
11743
11743
  J,
11744
11744
  b,
11745
11745
  f[D]
@@ -12014,7 +12014,7 @@ const T = class T {
12014
12014
  let x = qi(E);
12015
12015
  const P = T.getSeededRNG(a), $ = P.random();
12016
12016
  $ < 0.25 ? x = Math.min(x * 1.5, 30) : $ > 0.75 && (x = Math.max(x * 0.67, 0.125));
12017
- const B = o ? T.getRarityDistribution(i, x) : Array(i).fill(r), J = T.selectTemplatesForMix(
12017
+ const L = o ? T.getRarityDistribution(i, x) : Array(i).fill(r), J = T.selectTemplatesForMix(
12018
12018
  i,
12019
12019
  P,
12020
12020
  h,
@@ -12032,7 +12032,7 @@ const T = class T {
12032
12032
  templateId: oe.id,
12033
12033
  cr: x,
12034
12034
  // Pass CR for proper level scaling (Task 1.4)
12035
- rarity: B[V],
12035
+ rarity: L[V],
12036
12036
  // Use distributed rarity (Task 2.3)
12037
12037
  difficultyMultiplier: l,
12038
12038
  audioProfile: g,
@@ -12119,7 +12119,7 @@ const T = class T {
12119
12119
  const $ = E[P];
12120
12120
  if (!$)
12121
12121
  throw new Error(`No template available for enemy at index ${P}`);
12122
- const B = T.generate({
12122
+ const L = T.generate({
12123
12123
  seed: `${t}-${P}`,
12124
12124
  templateId: $.id,
12125
12125
  cr: b,
@@ -12131,7 +12131,7 @@ const T = class T {
12131
12131
  track: g,
12132
12132
  ...f ? { statLevels: f } : {}
12133
12133
  });
12134
- x.push(B);
12134
+ x.push(L);
12135
12135
  }
12136
12136
  return m && !r && T.applyLeaderPromotion(x, C, n), x;
12137
12137
  }
@@ -13288,16 +13288,16 @@ const ie = class ie {
13288
13288
  onProgress: h
13289
13289
  } = i, p = [];
13290
13290
  let g = 0;
13291
- const m = e.map((L) => L.level), f = ca(m, a), y = kt(u), b = f / y, I = qi(b);
13291
+ const m = e.map((O) => O.level), f = ca(m, a), y = kt(u), b = f / y, I = qi(b);
13292
13292
  let C = ie.CR_FLOOR, E = ie.CR_CEILING, x = Math.max(C, Math.min(E, I));
13293
13293
  const P = as[a];
13294
- let $ = !1, B = null, J = !1;
13295
- for (let L = 0; L < c; L++) {
13294
+ let $ = !1, L = null, J = !1;
13295
+ for (let O = 0; O < c; O++) {
13296
13296
  if (d?.aborted) {
13297
13297
  J = !0;
13298
13298
  break;
13299
13299
  }
13300
- h?.(L + 1, c, x);
13300
+ h?.(O + 1, c, x);
13301
13301
  const D = this.runProbe(
13302
13302
  e,
13303
13303
  t,
@@ -13307,7 +13307,7 @@ const ie = class ie {
13307
13307
  r,
13308
13308
  l,
13309
13309
  o,
13310
- L
13310
+ O
13311
13311
  );
13312
13312
  g += l;
13313
13313
  const N = {
@@ -13319,7 +13319,7 @@ const ie = class ie {
13319
13319
  };
13320
13320
  p.push(N);
13321
13321
  const be = (P.min + P.max) / 2;
13322
- if ((!B || Math.abs(N.winRate - be) < Math.abs(B.winRate - be)) && (B = N), N.winRate >= P.min && N.winRate <= P.max) {
13322
+ if ((!L || Math.abs(N.winRate - be) < Math.abs(L.winRate - be)) && (L = N), N.winRate >= P.min && N.winRate <= P.max) {
13323
13323
  $ = !0;
13324
13324
  break;
13325
13325
  }
@@ -13331,14 +13331,14 @@ const ie = class ie {
13331
13331
  } else
13332
13332
  x = de;
13333
13333
  }
13334
- const X = B?.cr ?? x, V = this.generateEnemy(t, X, o), oe = this.calculateMarginOfError(B?.totalRuns ?? l), K = this.formatConfidenceInterval(
13335
- B?.winRate ?? 0,
13334
+ const X = L?.cr ?? x, V = this.generateEnemy(t, X, o), oe = this.calculateMarginOfError(L?.totalRuns ?? l), K = this.formatConfidenceInterval(
13335
+ L?.winRate ?? 0,
13336
13336
  oe
13337
13337
  );
13338
13338
  return {
13339
13339
  targetDifficulty: a,
13340
13340
  recommendedCR: this.roundCR(X),
13341
- winRate: B?.winRate ?? 0,
13341
+ winRate: L?.winRate ?? 0,
13342
13342
  expectedWinRateRange: P,
13343
13343
  confidenceInterval: K,
13344
13344
  marginOfError: oe,
@@ -13593,7 +13593,7 @@ function fr(s, e) {
13593
13593
  return r % o / 10 ** n;
13594
13594
  }
13595
13595
  const ii = /* @__PURE__ */ Symbol("evaluating");
13596
- function O(s, e, t) {
13596
+ function B(s, e, t) {
13597
13597
  let a;
13598
13598
  Object.defineProperty(s, e, {
13599
13599
  get() {
@@ -14326,7 +14326,7 @@ const Co = {
14326
14326
  return i(l, a, o);
14327
14327
  };
14328
14328
  }
14329
- O(s, "~standard", () => ({
14329
+ B(s, "~standard", () => ({
14330
14330
  validate: (i) => {
14331
14331
  try {
14332
14332
  const n = Rr(s, i);
@@ -14664,7 +14664,7 @@ const il = /* @__PURE__ */ v("$ZodObject", (s, e) => {
14664
14664
  });
14665
14665
  }
14666
14666
  const a = ha(() => ws(e));
14667
- O(s._zod, "propValues", () => {
14667
+ B(s._zod, "propValues", () => {
14668
14668
  const o = e.shape, l = {};
14669
14669
  for (const c in o) {
14670
14670
  const u = o[c]._zod;
@@ -14778,10 +14778,10 @@ function oi(s, e, t, a) {
14778
14778
  }), e);
14779
14779
  }
14780
14780
  const nl = /* @__PURE__ */ v("$ZodUnion", (s, e) => {
14781
- U.init(s, e), O(s._zod, "optin", () => e.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), O(s._zod, "optout", () => e.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), O(s._zod, "values", () => {
14781
+ U.init(s, e), B(s._zod, "optin", () => e.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), B(s._zod, "optout", () => e.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), B(s._zod, "values", () => {
14782
14782
  if (e.options.every((i) => i._zod.values))
14783
14783
  return new Set(e.options.flatMap((i) => Array.from(i._zod.values)));
14784
- }), O(s._zod, "pattern", () => {
14784
+ }), B(s._zod, "pattern", () => {
14785
14785
  if (e.options.every((i) => i._zod.pattern)) {
14786
14786
  const i = e.options.map((n) => n._zod.pattern);
14787
14787
  return new RegExp(`^(${i.map((n) => ma(n.source)).join("|")})$`);
@@ -14965,7 +14965,7 @@ function ci(s, e) {
14965
14965
  return s.issues.length && e === void 0 ? { issues: [], value: void 0 } : s;
14966
14966
  }
14967
14967
  const _s = /* @__PURE__ */ v("$ZodOptional", (s, e) => {
14968
- U.init(s, e), s._zod.optin = "optional", s._zod.optout = "optional", O(s._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, void 0]) : void 0), O(s._zod, "pattern", () => {
14968
+ U.init(s, e), s._zod.optin = "optional", s._zod.optout = "optional", B(s._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, void 0]) : void 0), B(s._zod, "pattern", () => {
14969
14969
  const t = e.innerType._zod.pattern;
14970
14970
  return t ? new RegExp(`^(${ma(t.source)})?$`) : void 0;
14971
14971
  }), s._zod.parse = (t, a) => {
@@ -14976,14 +14976,14 @@ const _s = /* @__PURE__ */ v("$ZodOptional", (s, e) => {
14976
14976
  return t.value === void 0 ? t : e.innerType._zod.run(t, a);
14977
14977
  };
14978
14978
  }), ul = /* @__PURE__ */ v("$ZodExactOptional", (s, e) => {
14979
- _s.init(s, e), O(s._zod, "values", () => e.innerType._zod.values), O(s._zod, "pattern", () => e.innerType._zod.pattern), s._zod.parse = (t, a) => e.innerType._zod.run(t, a);
14979
+ _s.init(s, e), B(s._zod, "values", () => e.innerType._zod.values), B(s._zod, "pattern", () => e.innerType._zod.pattern), s._zod.parse = (t, a) => e.innerType._zod.run(t, a);
14980
14980
  }), dl = /* @__PURE__ */ v("$ZodNullable", (s, e) => {
14981
- U.init(s, e), O(s._zod, "optin", () => e.innerType._zod.optin), O(s._zod, "optout", () => e.innerType._zod.optout), O(s._zod, "pattern", () => {
14981
+ U.init(s, e), B(s._zod, "optin", () => e.innerType._zod.optin), B(s._zod, "optout", () => e.innerType._zod.optout), B(s._zod, "pattern", () => {
14982
14982
  const t = e.innerType._zod.pattern;
14983
14983
  return t ? new RegExp(`^(${ma(t.source)}|null)$`) : void 0;
14984
- }), O(s._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, null]) : void 0), s._zod.parse = (t, a) => t.value === null ? t : e.innerType._zod.run(t, a);
14984
+ }), B(s._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, null]) : void 0), s._zod.parse = (t, a) => t.value === null ? t : e.innerType._zod.run(t, a);
14985
14985
  }), hl = /* @__PURE__ */ v("$ZodDefault", (s, e) => {
14986
- U.init(s, e), s._zod.optin = "optional", O(s._zod, "values", () => e.innerType._zod.values), s._zod.parse = (t, a) => {
14986
+ U.init(s, e), s._zod.optin = "optional", B(s._zod, "values", () => e.innerType._zod.values), s._zod.parse = (t, a) => {
14987
14987
  if (a.direction === "backward")
14988
14988
  return e.innerType._zod.run(t, a);
14989
14989
  if (t.value === void 0)
@@ -14996,9 +14996,9 @@ function ui(s, e) {
14996
14996
  return s.value === void 0 && (s.value = e.defaultValue), s;
14997
14997
  }
14998
14998
  const pl = /* @__PURE__ */ v("$ZodPrefault", (s, e) => {
14999
- U.init(s, e), s._zod.optin = "optional", O(s._zod, "values", () => e.innerType._zod.values), s._zod.parse = (t, a) => (a.direction === "backward" || t.value === void 0 && (t.value = e.defaultValue), e.innerType._zod.run(t, a));
14999
+ U.init(s, e), s._zod.optin = "optional", B(s._zod, "values", () => e.innerType._zod.values), s._zod.parse = (t, a) => (a.direction === "backward" || t.value === void 0 && (t.value = e.defaultValue), e.innerType._zod.run(t, a));
15000
15000
  }), ml = /* @__PURE__ */ v("$ZodNonOptional", (s, e) => {
15001
- U.init(s, e), O(s._zod, "values", () => {
15001
+ U.init(s, e), B(s._zod, "values", () => {
15002
15002
  const t = e.innerType._zod.values;
15003
15003
  return t ? new Set([...t].filter((a) => a !== void 0)) : void 0;
15004
15004
  }), s._zod.parse = (t, a) => {
@@ -15015,7 +15015,7 @@ function di(s, e) {
15015
15015
  }), s;
15016
15016
  }
15017
15017
  const gl = /* @__PURE__ */ v("$ZodCatch", (s, e) => {
15018
- U.init(s, e), O(s._zod, "optin", () => e.innerType._zod.optin), O(s._zod, "optout", () => e.innerType._zod.optout), O(s._zod, "values", () => e.innerType._zod.values), s._zod.parse = (t, a) => {
15018
+ U.init(s, e), B(s._zod, "optin", () => e.innerType._zod.optin), B(s._zod, "optout", () => e.innerType._zod.optout), B(s._zod, "values", () => e.innerType._zod.values), s._zod.parse = (t, a) => {
15019
15019
  if (a.direction === "backward")
15020
15020
  return e.innerType._zod.run(t, a);
15021
15021
  const i = e.innerType._zod.run(t, a);
@@ -15034,7 +15034,7 @@ const gl = /* @__PURE__ */ v("$ZodCatch", (s, e) => {
15034
15034
  }), t.issues = []), t);
15035
15035
  };
15036
15036
  }), fl = /* @__PURE__ */ v("$ZodPipe", (s, e) => {
15037
- U.init(s, e), O(s._zod, "values", () => e.in._zod.values), O(s._zod, "optin", () => e.in._zod.optin), O(s._zod, "optout", () => e.out._zod.optout), O(s._zod, "propValues", () => e.in._zod.propValues), s._zod.parse = (t, a) => {
15037
+ U.init(s, e), B(s._zod, "values", () => e.in._zod.values), B(s._zod, "optin", () => e.in._zod.optin), B(s._zod, "optout", () => e.out._zod.optout), B(s._zod, "propValues", () => e.in._zod.propValues), s._zod.parse = (t, a) => {
15038
15038
  if (a.direction === "backward") {
15039
15039
  const n = e.out._zod.run(t, a);
15040
15040
  return n instanceof Promise ? n.then((r) => vt(r, e.in, a)) : vt(n, e.in, a);
@@ -15047,7 +15047,7 @@ function vt(s, e, t) {
15047
15047
  return s.issues.length ? (s.aborted = !0, s) : e._zod.run({ value: s.value, issues: s.issues }, t);
15048
15048
  }
15049
15049
  const yl = /* @__PURE__ */ v("$ZodReadonly", (s, e) => {
15050
- U.init(s, e), O(s._zod, "propValues", () => e.innerType._zod.propValues), O(s._zod, "values", () => e.innerType._zod.values), O(s._zod, "optin", () => e.innerType?._zod?.optin), O(s._zod, "optout", () => e.innerType?._zod?.optout), s._zod.parse = (t, a) => {
15050
+ U.init(s, e), B(s._zod, "propValues", () => e.innerType._zod.propValues), B(s._zod, "values", () => e.innerType._zod.values), B(s._zod, "optin", () => e.innerType?._zod?.optin), B(s._zod, "optout", () => e.innerType?._zod?.optout), s._zod.parse = (t, a) => {
15051
15051
  if (a.direction === "backward")
15052
15052
  return e.innerType._zod.run(t, a);
15053
15053
  const i = e.innerType._zod.run(t, a);
@@ -16157,7 +16157,7 @@ function te(s, e) {
16157
16157
  return /* @__PURE__ */ cc(Tu, s, e);
16158
16158
  }
16159
16159
  const Cu = /* @__PURE__ */ v("ZodObject", (s, e) => {
16160
- sl.init(s, e), j.init(s, e), s._zod.processJSONSchema = (t, a, i) => Ac(s, t, a, i), O(s, "shape", () => e.shape), s.keyof = () => _t(Object.keys(s._zod.def.shape)), s.catchall = (t) => s.clone({ ...s._zod.def, catchall: t }), s.passthrough = () => s.clone({ ...s._zod.def, catchall: Si() }), s.loose = () => s.clone({ ...s._zod.def, catchall: Si() }), s.strict = () => s.clone({ ...s._zod.def, catchall: Au() }), s.strip = () => s.clone({ ...s._zod.def, catchall: void 0 }), s.extend = (t) => Ar(s, t), s.safeExtend = (t) => Tr(s, t), s.merge = (t) => Cr(s, t), s.pick = (t) => _r(s, t), s.omit = (t) => kr(s, t), s.partial = (...t) => Ir(Rs, s, t[0]), s.required = (...t) => Mr(xs, s, t[0]);
16160
+ sl.init(s, e), j.init(s, e), s._zod.processJSONSchema = (t, a, i) => Ac(s, t, a, i), B(s, "shape", () => e.shape), s.keyof = () => _t(Object.keys(s._zod.def.shape)), s.catchall = (t) => s.clone({ ...s._zod.def, catchall: t }), s.passthrough = () => s.clone({ ...s._zod.def, catchall: Si() }), s.loose = () => s.clone({ ...s._zod.def, catchall: Si() }), s.strict = () => s.clone({ ...s._zod.def, catchall: Au() }), s.strip = () => s.clone({ ...s._zod.def, catchall: void 0 }), s.extend = (t) => Ar(s, t), s.safeExtend = (t) => Tr(s, t), s.merge = (t) => Cr(s, t), s.pick = (t) => _r(s, t), s.omit = (t) => kr(s, t), s.partial = (...t) => Ir(Rs, s, t[0]), s.required = (...t) => Mr(xs, s, t[0]);
16161
16161
  });
16162
16162
  function F(s, e) {
16163
16163
  const t = {
@@ -19549,17 +19549,17 @@ class Md {
19549
19549
  */
19550
19550
  static generate(e, t, a) {
19551
19551
  $s();
19552
- const i = new _e(e), n = R.getInstance(), r = n.get("appearance.bodyTypes"), o = n.getWeights("appearance.bodyTypes"), l = n.getMode("appearance.bodyTypes") || "default", c = n.get("appearance.skinTones"), u = n.getWeights("appearance.skinTones"), d = n.getMode("appearance.skinTones") || "default", h = n.get("appearance.hairStyles"), p = n.getWeights("appearance.hairStyles"), g = n.getMode("appearance.hairStyles") || "default", m = n.get("appearance.hairColors"), f = n.getWeights("appearance.hairColors"), y = n.getMode("appearance.hairColors") || "default", b = n.get("appearance.eyeColors"), I = n.getWeights("appearance.eyeColors"), C = n.getMode("appearance.eyeColors") || "default", E = n.get("appearance.facialFeatures"), x = n.getWeights("appearance.facialFeatures"), P = n.getMode("appearance.facialFeatures") || "default", $ = fe.select(r, o, i, l), B = fe.select(c, u, i, d), J = fe.select(h, p, i, g), X = fe.select(m, f, i, y), V = fe.select(b, I, i, C), oe = i.randomInt(1, 4), K = fe.selectMultiple(
19552
+ const i = new _e(e), n = R.getInstance(), r = n.get("appearance.bodyTypes"), o = n.getWeights("appearance.bodyTypes"), l = n.getMode("appearance.bodyTypes") || "default", c = n.get("appearance.skinTones"), u = n.getWeights("appearance.skinTones"), d = n.getMode("appearance.skinTones") || "default", h = n.get("appearance.hairStyles"), p = n.getWeights("appearance.hairStyles"), g = n.getMode("appearance.hairStyles") || "default", m = n.get("appearance.hairColors"), f = n.getWeights("appearance.hairColors"), y = n.getMode("appearance.hairColors") || "default", b = n.get("appearance.eyeColors"), I = n.getWeights("appearance.eyeColors"), C = n.getMode("appearance.eyeColors") || "default", E = n.get("appearance.facialFeatures"), x = n.getWeights("appearance.facialFeatures"), P = n.getMode("appearance.facialFeatures") || "default", $ = fe.select(r, o, i, l), L = fe.select(c, u, i, d), J = fe.select(h, p, i, g), X = fe.select(m, f, i, y), V = fe.select(b, I, i, C), oe = i.randomInt(1, 4), K = fe.selectMultiple(
19553
19553
  E,
19554
19554
  x,
19555
19555
  i,
19556
19556
  oe,
19557
19557
  P
19558
- ), L = a.color_palette, D = L?.primary_color, N = L?.secondary_color, be = L?.accent_color;
19558
+ ), O = a.color_palette, D = O?.primary_color, N = O?.secondary_color, be = O?.accent_color;
19559
19559
  let de;
19560
- return Id.includes(t) && (de = this.generateAuraColor(t, L?.primary_color)), {
19560
+ return Id.includes(t) && (de = this.generateAuraColor(t, O?.primary_color)), {
19561
19561
  body_type: $,
19562
- skin_tone: B,
19562
+ skin_tone: L,
19563
19563
  hair_style: J,
19564
19564
  hair_color: X,
19565
19565
  eye_color: V,
@@ -21093,14 +21093,14 @@ class wa {
21093
21093
  ), m = Ut.calculateBaseScores(t, n), f = Ut.applyRacialBonuses(m, h), y = Ut.calculateModifiers(f), b = Yi(p);
21094
21094
  if (!b)
21095
21095
  throw new Error(`Unknown class: ${p}. Cannot generate character.`);
21096
- const C = ua(h)?.speed ?? 30, E = b.hit_die + y.CON, x = 10 + y.DEX, P = y.DEX, $ = Xi[r], B = Cd.assignSkills(p, n), J = {
21096
+ const C = ua(h)?.speed ?? 30, E = b.hit_die + y.CON, x = 10 + y.DEX, P = y.DEX, $ = Xi[r], L = Cd.assignSkills(p, n), J = {
21097
21097
  STR: b.saving_throws.includes("STR"),
21098
21098
  DEX: b.saving_throws.includes("DEX"),
21099
21099
  CON: b.saving_throws.includes("CON"),
21100
21100
  INT: b.saving_throws.includes("INT"),
21101
21101
  WIS: b.saving_throws.includes("WIS"),
21102
21102
  CHA: b.saving_throws.includes("CHA")
21103
- }, X = Md.generate(e, p, t), V = l.getClassFeatures(p, r), oe = c ? l.getRacialTraitsForSubrace(h, c) : l.getBaseRacialTraits(h), K = Et.initializeEquipment(p), L = {
21103
+ }, X = Md.generate(e, p, t), V = l.getClassFeatures(p, r), oe = c ? l.getRacialTraitsForSubrace(h, c) : l.getBaseRacialTraits(h), K = Et.initializeEquipment(p), O = {
21104
21104
  name: g,
21105
21105
  race: h,
21106
21106
  subrace: c,
@@ -21114,7 +21114,7 @@ class wa {
21114
21114
  armor_class: x,
21115
21115
  initiative: P,
21116
21116
  speed: C,
21117
- skills: B,
21117
+ skills: L,
21118
21118
  saving_throws: J,
21119
21119
  racial_traits: [],
21120
21120
  // Empty for now, will populate after validation
@@ -21132,14 +21132,14 @@ class wa {
21132
21132
  seed: e,
21133
21133
  generated_at: (/* @__PURE__ */ new Date()).toISOString(),
21134
21134
  gameMode: o
21135
- }, D = Ri.initializeSpells(p, r, L), N = [];
21135
+ }, D = Ri.initializeSpells(p, r, O), N = [];
21136
21136
  for (const W of V) {
21137
- const Q = l.validatePrerequisites(W, L);
21137
+ const Q = l.validatePrerequisites(W, O);
21138
21138
  Q.valid || console.warn(`Feature "${W.name}" (${W.id}) failed prerequisite validation:`, Q.errors), N.push(W);
21139
21139
  }
21140
21140
  const be = [];
21141
21141
  for (const W of oe) {
21142
- const Q = l.validatePrerequisites(W, L);
21142
+ const Q = l.validatePrerequisites(W, O);
21143
21143
  Q.valid || console.warn(`Trait "${W.name}" (${W.id}) failed prerequisite validation:`, Q.errors), be.push(W);
21144
21144
  }
21145
21145
  const de = {
@@ -21160,7 +21160,7 @@ class wa {
21160
21160
  armor_class: x,
21161
21161
  initiative: P,
21162
21162
  speed: C,
21163
- skills: B,
21163
+ skills: L,
21164
21164
  saving_throws: J,
21165
21165
  racial_traits: be.map((W) => W.id),
21166
21166
  class_features: N.map((W) => W.id),
@@ -21541,7 +21541,7 @@ class lp {
21541
21541
  throw new Error(`Missing required fields for track: ${JSON.stringify({ title: d, artist: h, imageUrl: g })}`);
21542
21542
  return null;
21543
21543
  }
21544
- const $ = ge.extractDescription(a || {}) ?? void 0, B = typeof a?.album == "string" ? a.album : void 0, J = a?.duration ? Number(a.duration) : 0, X = ge.extractGenre(a || {}), V = ge.extractTags(a || {}), oe = a?.bpm ? Number(a.bpm) : void 0, K = typeof a?.key == "string" ? a.key : void 0, L = {
21544
+ const $ = ge.extractDescription(a || {}) ?? void 0, L = typeof a?.album == "string" ? a.album : void 0, J = a?.duration ? Number(a.duration) : 0, X = ge.extractGenre(a || {}), V = ge.extractTags(a || {}), oe = a?.bpm ? Number(a.bpm) : void 0, K = typeof a?.key == "string" ? a.key : void 0, O = {
21545
21545
  id: c,
21546
21546
  uuid: u,
21547
21547
  playlist_index: t,
@@ -21550,7 +21550,7 @@ class lp {
21550
21550
  title: d,
21551
21551
  artist: h,
21552
21552
  description: $,
21553
- album: B,
21553
+ album: L,
21554
21554
  image_url: g,
21555
21555
  audio_url: x,
21556
21556
  audio_url_lossless: P && P !== x ? P : void 0,
@@ -21563,7 +21563,7 @@ class lp {
21563
21563
  attributes: I || void 0,
21564
21564
  extras: C
21565
21565
  };
21566
- return m && (L.image_thumb_url = m), typeof a?.audio_ipfs_hash == "string" ? L.audio_ipfs_hash = e.audio_ipfs_hash || a.audio_ipfs_hash : e.audio_ipfs_hash && (L.audio_ipfs_hash = e.audio_ipfs_hash), typeof a?.artwork_ipfs_hash == "string" ? L.artwork_ipfs_hash = e.artwork_ipfs_hash || a.artwork_ipfs_hash : e.artwork_ipfs_hash && (L.artwork_ipfs_hash = e.artwork_ipfs_hash), i !== "AR" ? (L.token_address = n, L.token_id = r) : o && (L.tx_id = o), L;
21566
+ return m && (O.image_thumb_url = m), typeof a?.audio_ipfs_hash == "string" ? O.audio_ipfs_hash = e.audio_ipfs_hash || a.audio_ipfs_hash : e.audio_ipfs_hash && (O.audio_ipfs_hash = e.audio_ipfs_hash), typeof a?.artwork_ipfs_hash == "string" ? O.artwork_ipfs_hash = e.artwork_ipfs_hash || a.artwork_ipfs_hash : e.artwork_ipfs_hash && (O.artwork_ipfs_hash = e.artwork_ipfs_hash), typeof e.mint_function == "string" && (O.mint_function = e.mint_function), typeof e.mint_price == "string" && (O.mint_price = e.mint_price), typeof e.mint_snapshot_time == "number" && (O.mint_snapshot_time = e.mint_snapshot_time), typeof e.mint_token == "string" && (O.mint_token = e.mint_token), i !== "AR" ? (O.token_address = n, O.token_id = r) : o && (O.tx_id = o), O;
21567
21567
  }
21568
21568
  /**
21569
21569
  * Validate that an audio URL is accessible
@@ -20,6 +20,9 @@ export declare const DEFAULT_IPFS_GATEWAY = "ipfs.io";
20
20
  * - `ipfs://{cid}/path` — native scheme
21
21
  * - `https://gateway/ipfs/{cid}/path` — standard gateway format
22
22
  * - `https://{cid}.ipfs.dweb.link` — subdomain format
23
+ * - `https://any-cdn/…/ipfs_audio/{cid}` and `…/ipfs_image/{cid}` —
24
+ * CID embedded after an `ipfs_*` transform segment on an arbitrary
25
+ * (possibly dead) CDN host
23
26
  *
24
27
  * @param url - The URL to extract from
25
28
  * @returns The CID + path (e.g. "QmXxx/file.jpg"), or null
@@ -32,6 +35,8 @@ export declare function extractIPFSPath(url: string): string | null;
32
35
  * - `ipfs://` protocol URLs (native scheme)
33
36
  * - URLs on known IPFS gateway hosts with `/ipfs/` path segment
34
37
  * - Subdomain format: `{cid}.ipfs.dweb.link`
38
+ * - CIDs embedded after an `ipfs_*` transform segment on any host
39
+ * (CDN shapes like `/video/upload/ipfs_audio/{cid}`)
35
40
  *
36
41
  * @param url - The URL to check
37
42
  * @returns True if the URL is an IPFS URL
@@ -47,7 +52,9 @@ export declare function extractIPFSPath(url: string): string | null;
47
52
  * isIPFS('https://soundxyz.mypinata.cloud/ipfs/QmXxx'); // true
48
53
  * isIPFS('https://nftstorage.link/ipfs/QmXxx'); // true
49
54
  * isIPFS('https://QmXxx.ipfs.dweb.link'); // true
55
+ * isIPFS('https://content.spinamp.xyz/video/upload/ipfs_audio/QmfX6sKmbVDFrpatmnBDQR2j4ALZhFriJSywRTf8ue8bzY'); // true
50
56
  * isIPFS('https://example.com/image.png'); // false
57
+ * isIPFS('https://example.com/video/upload/ipfs_audio/not-a-cid'); // false
51
58
  * isIPFS(undefined); // false
52
59
  * ```
53
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ipfsUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ipfsUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,+TAc3B,CAAC;AAEX,8CAA8C;AAC9C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAI9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAwBvD;AAED,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IAC/B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,gBAAgB,GAAE,MAAM,GAAG,kBAAuB,GACnD,MAAM,GAAG,SAAS,CAsBpB"}
1
+ {"version":3,"file":"ipfsUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ipfsUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,+TAc3B,CAAC;AAEX,8CAA8C;AAC9C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AA2C9C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CA4BvD;AAED,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IAC/B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,gBAAgB,GAAE,MAAM,GAAG,kBAAuB,GACnD,MAAM,GAAG,SAAS,CAsBpB"}
@@ -9,17 +9,23 @@ export type PlaylistInput = ServerlessPlaylist | RawArweavePlaylist;
9
9
  export interface SimpleTrack {
10
10
  title: string;
11
11
  artist: string;
12
+ description?: string;
12
13
  audio_url: string;
13
14
  audio_url_lossless?: string;
14
15
  image_url: string;
15
16
  image_thumb_url?: string;
16
17
  audio_ipfs_hash?: string;
17
18
  artwork_ipfs_hash?: string;
19
+ mint_function?: string;
20
+ mint_price?: string;
21
+ mint_snapshot_time?: number;
22
+ mint_token?: string;
18
23
  }
19
24
  /** Track object with VRM data for getVRMTracks() */
20
25
  export interface VRMTrack {
21
26
  title: string;
22
27
  artist: string;
28
+ description?: string;
23
29
  audio_url: string;
24
30
  audio_url_lossless?: string;
25
31
  image_url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"playlistUtils.d.ts","sourceRoot":"","sources":["../../src/utils/playlistUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAiB,MAAM,2BAA2B,CAAC;AAOvG,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG,kBAAkB,G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C,CAqDrF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,CAWzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,QAAQ,EAAE,CAqDhE"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/jasondesante/playlist-data-engine.git"
8
8
  },
9
- "version": "1.7.0",
9
+ "version": "1.7.2",
10
10
  "type": "module",
11
11
  "main": "./dist/playlist-data-engine.js",
12
12
  "module": "./dist/playlist-data-engine.mjs",
@@ -1 +0,0 @@
1
- "use strict";require("./arweaveGatewayManager-C9SIMDTd.cjs");class n{static extractAudioUrl(t){const e=["mp3_url","mp3Url","lossy_audio","lossyAudio","audio_url","audioUrl","audio","lossless_audio","losslessAudio","animation_url","animationUrl","multimedia_url","multimediaUrl"];for(const r of e)if(t[r]&&typeof t[r]=="string")return t[r];return null}static extractAudioUrlLossless(t){const e=["lossless_audio","losslessAudio","wav_url","wavUrl","flac_url","flacUrl","audio_url","audioUrl"];for(const r of e)if(t[r]&&typeof t[r]=="string")return t[r];return null}static extractImageUrl(t){const e=["image_small","imageSmall","image","image_large","imageLarge","image_thumb","imageThumb","image_url","imageUrl","image_uri","imageUri","image_preview","imagePreview"];for(const s of e)if(t[s]&&typeof t[s]=="string")return t[s];const r=[this.extractNestedUri(t,"artwork","uri"),this.extractNestedUri(t,"project","artwork","uri"),this.extractNestedUri(t,"primaryMedia","uri")];for(const s of r)if(s)return s;return null}static extractImageThumbUrl(t){return t.image_thumb_url&&typeof t.image_thumb_url=="string"?t.image_thumb_url:t.image_thumb&&typeof t.image_thumb=="string"?t.image_thumb:null}static extractTitle(t){return t.name&&typeof t.name=="string"?t.name:t.title&&typeof t.title=="string"?t.title:null}static extractArtist(t){const e=["artist","artist_name","artistName","album_artist","albumArtist","created_by","createdBy","minter"];for(const r of e)if(t[r]&&typeof t[r]=="string")return t[r];if(Array.isArray(t.attributes)){const r=t.attributes.find(s=>s.trait_type?.toLowerCase()==="artist"&&s.value!==void 0);if(r&&typeof r.value=="string")return r.value}return null}static parseMetadata(t){if(!t)return null;if(typeof t=="object"&&!Array.isArray(t))return t;if(typeof t=="string")try{const e=JSON.parse(t);if(typeof e=="object"&&!Array.isArray(e))return e}catch(e){return console.warn("Failed to parse metadata:",e),null}return null}static extractGenre(t){if(typeof t.genre=="string")return t.genre;if(Array.isArray(t.genre)&&t.genre.length>0){const r=t.genre[0];return typeof r=="string"?r:""}if(Array.isArray(t.attributes)){const r=t.attributes.find(s=>s.trait_type?.toLowerCase()==="genre"&&s.value!==void 0);if(r){if(typeof r.value=="string")return r.value;if(Array.isArray(r.value)&&r.value.length>0){const s=r.value[0];return typeof s=="string"?s:""}}}if(t.attributes&&typeof t.attributes=="object"&&!Array.isArray(t.attributes)){const r=t.attributes;for(const s of Object.keys(r))if(s.toLowerCase()==="genre"&&typeof r[s]=="string")return r[s]}const e=t["attribute "];if(e&&typeof e=="object"&&!Array.isArray(e)){const r=e.genre;if(typeof r=="string")return r}return""}static extractTags(t){const e=[];if(Array.isArray(t.tags)?e.push(...t.tags):typeof t.tags=="string"&&e.push(...t.tags.split(",")),t.properties&&typeof t.properties=="object"&&!Array.isArray(t.properties)){const r=t.properties.tags;Array.isArray(r)?e.push(...r):typeof r=="string"&&e.push(...r.split(","))}if(Array.isArray(t.attributes))for(const r of t.attributes){if(!r||typeof r!="object")continue;const s=r.trait_type;if(typeof s=="string"&&s.toLowerCase().match(/^tags?$/)){const o=r.value;Array.isArray(o)?e.push(...o):typeof o=="string"&&e.push(...o.split(","))}}else if(t.attributes&&typeof t.attributes=="object"){const r=t.attributes;for(const s of Object.keys(r))if(s.toLowerCase().match(/^tags?$/)){const o=r[s];Array.isArray(o)?e.push(...o):typeof o=="string"&&e.push(...o.split(","))}}return n.normalizeTags(e)}static extractDescription(t){const e=["description","track_description","trackDescription","description_text","descriptionText","desc","blurb"];for(const r of e)if(t[r]&&typeof t[r]=="string")return t[r];if(Array.isArray(t.attributes)){const r=t.attributes.find(s=>s.trait_type?.toLowerCase()==="description"&&typeof s.value=="string");if(r&&typeof r.value=="string")return r.value}return n.deepFindString(t,/description/i)}static extractAlbumDescription(t){const e=["album_description","albumDescription"];for(const s of e)if(t[s]&&typeof t[s]=="string")return t[s];const r=t.album;return r&&typeof r=="object"&&!Array.isArray(r)?n.deepFindString(r,/description|liner|notes/i):null}static extractArtistDescription(t){const e=["artist_description","artistDescription","artist_bio","artistBio"];for(const s of e)if(t[s]&&typeof t[s]=="string")return t[s];const r=t.artist;return r&&typeof r=="object"&&!Array.isArray(r)?n.deepFindString(r,/description|bio|about/i):null}static deepFindString(t,e,r=5){const s=new Set,o=[{node:t,depth:0}];for(;o.length>0;){const{node:u,depth:c}=o.shift();for(const a of Object.keys(u)){const f=u[a];if(typeof f=="string"&&f&&e.test(a))return f}if(!(c>=r))for(const a of Object.keys(u)){const f=u[a];f&&typeof f=="object"&&!Array.isArray(f)&&!s.has(f)&&(s.add(f),o.push({node:f,depth:c+1}))}}return null}static normalizeTags(t){const e=new Set;for(const r of t){if(r==null)continue;const s=String(r).trim().toLowerCase();s&&e.add(s)}return Array.from(e)}static convertAttributes(t){if(!Array.isArray(t))return null;const e={};for(const r of t)r.trait_type&&r.value!==void 0&&(e[r.trait_type]=r.value);return Object.keys(e).length>0?e:null}static extractNestedUri(t,...e){let r=t;for(const s of e)if(r&&typeof r=="object"&&!Array.isArray(r))r=r[s];else return null;return typeof r=="string"?r:null}}function m(i){if("audio_url"in i&&typeof i.audio_url=="string")return i.audio_url;if("metadata"in i){const t=n.parseMetadata(i.metadata);if(t)return n.extractAudioUrl(t)}return null}function b(i){if("audio_url_lossless"in i&&typeof i.audio_url_lossless=="string")return i.audio_url_lossless;if("metadata"in i){const t=n.parseMetadata(i.metadata);if(t)return n.extractAudioUrlLossless(t)}return null}function y(i){if("image_url"in i&&typeof i.image_url=="string")return i.image_url;if("metadata"in i){if("artwork_url"in i&&typeof i.artwork_url=="string")return i.artwork_url;const t=n.parseMetadata(i.metadata);if(t)return n.extractImageUrl(t)}return null}function d(i){if("image_thumb_url"in i&&typeof i.image_thumb_url=="string")return i.image_thumb_url;if("metadata"in i){const t=n.parseMetadata(i.metadata);if(t)return n.extractImageThumbUrl(t)}return null}function _(i){if("metadata"in i){const t=n.parseMetadata(i.metadata);if(t&&typeof t.vrm=="string"&&t.vrm)return t.vrm}return"extras"in i&&i.extras&&typeof i.extras.vrm=="string"&&i.extras.vrm||null}function k(i){const t=[];for(const e of i.tracks){const r=m(e);r&&t.push(r)}return t}function w(i){const t=[];for(const e of i.tracks){const r=y(e);r&&t.push(r)}return t}function T(i){const t=[];for(const e of i.tracks){if("title"in e&&typeof e.title=="string"){t.push(e.title);continue}if("metadata"in e){const r=n.parseMetadata(e.metadata);if(r){const s=n.extractTitle(r);s&&t.push(s)}}}return t}function x(i){const t=[];for(const e of i.tracks){if("artist"in e&&typeof e.artist=="string"){t.push(e.artist);continue}if("metadata"in e){const r=n.parseMetadata(e.metadata);if(r){const s=n.extractArtist(r);s&&t.push(s)}}}return t}function v(i){const t=new Set;for(const e of i.tracks){if("genre"in e&&typeof e.genre=="string"&&e.genre){t.add(e.genre);continue}if("metadata"in e){const r=n.parseMetadata(e.metadata);r&&typeof r.genre=="string"&&r.genre&&t.add(r.genre)}}return Array.from(t).sort()}function U(i){const t=new Set;for(const e of i.tracks){if("tags"in e&&Array.isArray(e.tags)){for(const r of e.tags)r&&t.add(r.toLowerCase());continue}if("metadata"in e){const r=n.parseMetadata(e.metadata);if(r&&Array.isArray(r.tags))for(const s of r.tags)s&&t.add(String(s).toLowerCase())}}return Array.from(t).sort()}function S(i){let t=0;for(const e of i.tracks){if("duration"in e&&typeof e.duration=="number"){t+=e.duration;continue}if("metadata"in e){const r=n.parseMetadata(e.metadata);r&&typeof r.duration=="number"&&(t+=r.duration)}}return t}function F(i){return i.tracks.length}function L(i){const t=[];for(const e of i.tracks){const r=m(e),s=y(e),o=d(e);let u="",c="";if("title"in e)u=e.title||"",c=e.artist||"";else if("metadata"in e){const a=n.parseMetadata(e.metadata);a&&(u=n.extractTitle(a)||"",c=n.extractArtist(a)||"")}if(r){const a={title:u,artist:c,audio_url:r,image_url:s||""},f=b(e);f&&f!==r&&(a.audio_url_lossless=f),o&&(a.image_thumb_url=o),"audio_ipfs_hash"in e&&typeof e.audio_ipfs_hash=="string"&&(a.audio_ipfs_hash=e.audio_ipfs_hash),"artwork_ipfs_hash"in e&&typeof e.artwork_ipfs_hash=="string"&&(a.artwork_ipfs_hash=e.artwork_ipfs_hash),t.push(a)}}return t}function I(i){const t=[];for(const e of i.tracks){if("audio_url"in e){t.push({...e});continue}if("metadata"in e){const r=n.parseMetadata(e.metadata);if(r){const s=n.extractAudioUrlLossless(r),o=n.extractAudioUrl(r);t.push({id:e.chain_name==="AR"?`AR-${e.tx_id}`:`${e.chain_name}-${e.token_address}-${e.token_id}`,chain_name:e.chain_name,token_address:e.token_address,token_id:e.token_id,tx_id:e.tx_id,platform:e.platform,title:n.extractTitle(r),artist:n.extractArtist(r),audio_url:o,image_url:n.extractImageUrl(r),image_thumb_url:n.extractImageThumbUrl(r),duration:r.duration,genre:r.genre,tags:r.tags,bpm:r.bpm,key:r.key,album:r.album,description:r.description,attributes:n.convertAttributes(r.attributes),...s&&s!==o?{audio_url_lossless:s}:{},...e.audio_ipfs_hash?{audio_ipfs_hash:e.audio_ipfs_hash}:{},...e.artwork_ipfs_hash?{artwork_ipfs_hash:e.artwork_ipfs_hash}:{}})}}}return t}function M(i){const t=[];for(const e of i.tracks){const r=_(e);r&&t.push(r)}return t}function P(i){const t=[];for(const e of i.tracks){const r=_(e);if(!r)continue;const s=m(e),o=y(e),u=d(e);let c="",a="";if("title"in e)c=e.title||"",a=e.artist||"";else if("metadata"in e){const p=n.parseMetadata(e.metadata);p&&(c=n.extractTitle(p)||"",a=n.extractArtist(p)||"")}const f={title:c,artist:a,audio_url:s||"",image_url:o||"",vrm:r};u&&(f.image_thumb_url=u),t.push(f)}return t}const l=["ipfs.io","cloudflare-ipfs.com","dweb.link","gateway.pinata.cloud","ipfs.infura.io","nftstorage.link","web3-music-pipeline.mypinata.cloud","soundxyz.mypinata.cloud","gold-broad-gibbon-29.mypinata.cloud","bonfire.mypinata.cloud","spinamp.mypinata.cloud","catalogworks.b-cdn.net","www.heds.cloud"],h="ipfs.io",g="/ipfs/";function A(i){if(!i||typeof i!="string")return null;if(i.startsWith("ipfs://ipfs/"))return i.slice(12);if(i.startsWith("ipfs://"))return i.slice(7);try{const t=new URL(i),{hostname:e,pathname:r}=t,s=e.match(/^([A-Za-z0-9]+)\.ipfs\.dweb\.link$/);if(s)return`${s[1]}${r}`;if(l.some(u=>e===u||e.endsWith("."+u))&&r.startsWith(g))return r.slice(g.length)}catch{}return null}function j(i){if(!i||typeof i!="string")return!1;if(i.startsWith("ipfs://"))return!0;try{const t=new URL(i),{hostname:e,pathname:r}=t;if(/^[A-Za-z0-9]+\.ipfs\.dweb\.link$/.test(e)||l.some(o=>e===o||e.endsWith("."+o))&&r.startsWith(g))return!0}catch{}return!1}function W(i){if(!(!i||i.startsWith("ipfs://")))try{const{hostname:t}=new URL(i);return l.some(r=>t===r||t.endsWith("."+r))?t:void 0}catch{return}}function $(i,t={}){if(!i)return i;const e=typeof t=="string"?{gatewayHost:t}:t,{gatewayHost:r=h,preserveOriginalGateway:s=!1}=e,o=A(i);if(o){if(s){const u=W(i);if(u)return`https://${u}/ipfs/${o}`}return`https://${r}/ipfs/${o}`}return i}exports.DEFAULT_IPFS_GATEWAY=h;exports.KNOWN_IPFS_GATEWAY_HOSTS=l;exports.MetadataExtractor=n;exports.extractIPFSPath=A;exports.getArtists=x;exports.getAudioUrls=k;exports.getFullTracks=I;exports.getGenres=v;exports.getImageUrls=w;exports.getTags=U;exports.getTotalDuration=S;exports.getTrackCount=F;exports.getTrackTitles=T;exports.getTracks=L;exports.getVRMTracks=P;exports.getVRMs=M;exports.isIPFS=j;exports.resolveIPFSLink=$;