@forgecharts/sdk 1.5.71 → 1.5.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/internal.js CHANGED
@@ -20,8 +20,14 @@ function timeframeToMs(tf) {
20
20
  const secs = parseTfSeconds(tf);
21
21
  return secs !== null ? secs * 1e3 : null;
22
22
  }
23
+ function normalizeTimeframe(tf) {
24
+ const m = /^(\d+)([a-zA-Z])$/.exec(tf.trim());
25
+ if (!m) return tf.trim();
26
+ const unit = m[2];
27
+ return m[1] + (unit === "M" ? unit : unit.toLowerCase());
28
+ }
23
29
  function parseTfSeconds(tf) {
24
- const m = /^(\d+)(s|m|h|d|w|M)$/.exec(tf);
30
+ const m = /^(\d+)(s|m|h|d|w|M)$/.exec(normalizeTimeframe(tf));
25
31
  if (!m) return null;
26
32
  const n = parseInt(m[1], 10);
27
33
  const unit = m[2];
@@ -37,6 +43,7 @@ function parseTfSeconds(tf) {
37
43
  return unitSec !== void 0 ? n * unitSec : null;
38
44
  }
39
45
  function getBucketStart(timeMs, timeframe) {
46
+ timeframe = normalizeTimeframe(timeframe);
40
47
  if (timeframe === "1w") return getWeekBucketStart(timeMs);
41
48
  if (timeframe === "1M") return getMonthBucketStart(timeMs);
42
49
  if (timeframe === "3M") return getQuarterBucketStart(timeMs);
@@ -7707,32 +7714,7 @@ function formatCountdown(secs) {
7707
7714
  return `${m}:${String(s).padStart(2, "0")}`;
7708
7715
  }
7709
7716
  function tfToSeconds(tf) {
7710
- const map = {
7711
- "1s": 1,
7712
- "5s": 5,
7713
- "10s": 10,
7714
- "15s": 15,
7715
- "30s": 30,
7716
- "1m": 60,
7717
- "3m": 180,
7718
- "5m": 300,
7719
- "15m": 900,
7720
- "30m": 1800,
7721
- "1h": 3600,
7722
- "2h": 7200,
7723
- "4h": 14400,
7724
- "6h": 21600,
7725
- "8h": 28800,
7726
- "12h": 43200,
7727
- "1D": 86400,
7728
- "3D": 259200,
7729
- "1W": 604800,
7730
- "1M": 2592e3,
7731
- "3M": 7776e3,
7732
- "6M": 15552e3,
7733
- "12M": 31536e3
7734
- };
7735
- return map[tf] ?? 3600;
7717
+ return parseTfSeconds(tf) ?? 3600;
7736
7718
  }
7737
7719
  var PixiLastPriceRenderer = class {
7738
7720
  _lineGfx;
@@ -9717,34 +9699,16 @@ var PixiChart = class {
9717
9699
  }
9718
9700
  return { time: bestBar.time, price: snappedPrice };
9719
9701
  }
9720
- /** Convert a Timeframe string to seconds (internal helper). */
9702
+ /**
9703
+ * Convert a Timeframe string to seconds (internal helper).
9704
+ *
9705
+ * Delegates to the shared parser — this was one of three private maps, and
9706
+ * the only one still keyed '1D'/'1W' uppercase, so canonical '1d' fell to
9707
+ * the 3600 fallback here while '1D' fell to the 1m fallback everywhere
9708
+ * else. One derivation, one dialect.
9709
+ */
9721
9710
  _tfToSeconds(tf) {
9722
- const map = {
9723
- "1s": 1,
9724
- "5s": 5,
9725
- "10s": 10,
9726
- "15s": 15,
9727
- "30s": 30,
9728
- "1m": 60,
9729
- "3m": 180,
9730
- "5m": 300,
9731
- "15m": 900,
9732
- "30m": 1800,
9733
- "1h": 3600,
9734
- "2h": 7200,
9735
- "4h": 14400,
9736
- "6h": 21600,
9737
- "8h": 28800,
9738
- "12h": 43200,
9739
- "1D": 86400,
9740
- "3D": 259200,
9741
- "1W": 604800,
9742
- "1M": 2592e3,
9743
- "3M": 7776e3,
9744
- "6M": 15552e3,
9745
- "12M": 31536e3
9746
- };
9747
- return map[tf] ?? 3600;
9711
+ return parseTfSeconds(tf) ?? 3600;
9748
9712
  }
9749
9713
  // ─── Option resolvers ────────────────────────────────────────────────────────
9750
9714
  _resolveOptions(opts) {
@@ -25622,7 +25586,7 @@ var demonstrationTool = {
25622
25586
  };
25623
25587
 
25624
25588
  // src/version.ts
25625
- var FORGECHARTS_VERSION = "1.5.71" ;
25589
+ var FORGECHARTS_VERSION = "1.5.73" ;
25626
25590
 
25627
25591
  // src/compatibility.ts
25628
25592
  var MIN_KIT_API = 1;