kaabalah 6.4.2 → 6.4.4

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/cli.js CHANGED
@@ -8932,7 +8932,7 @@ var import_config3 = require("dotenv/config");
8932
8932
  // package.json
8933
8933
  var package_default = {
8934
8934
  name: "kaabalah",
8935
- version: "6.4.2",
8935
+ version: "6.4.4",
8936
8936
  description: "The de-facto library for any esoteric calculations and tooling",
8937
8937
  engines: {
8938
8938
  node: ">=18.18.0"
@@ -19931,34 +19931,58 @@ kaabalah v${VERSION}
19931
19931
  }
19932
19932
 
19933
19933
  // src/ifa/index.ts
19934
+ function isMidnight(date, mode) {
19935
+ if (mode === "utc") {
19936
+ return date.getUTCHours() === 0 && date.getUTCMinutes() === 0 && date.getUTCSeconds() === 0 && date.getUTCMilliseconds() === 0;
19937
+ }
19938
+ return date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0 && date.getMilliseconds() === 0;
19939
+ }
19940
+ function extractDateParts(date) {
19941
+ if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
19942
+ throw new Error("Date must be a valid Date object");
19943
+ }
19944
+ const useLocalDate = isMidnight(date, "local") && !isMidnight(date, "utc");
19945
+ if (useLocalDate) {
19946
+ return {
19947
+ day: date.getDate().toString().padStart(2, "0"),
19948
+ month: (date.getMonth() + 1).toString().padStart(2, "0"),
19949
+ year: date.getFullYear().toString().padStart(4, "0")
19950
+ };
19951
+ }
19952
+ const formattedDate = date.toISOString().split("T")[0];
19953
+ const [year, month, day] = formattedDate.split("-");
19954
+ return { day, month, year };
19955
+ }
19956
+ function reduceNumber(num) {
19957
+ if (num <= 16) {
19958
+ return num;
19959
+ }
19960
+ return reduceNumber(
19961
+ num.toString().split("").reduce((sum, digit) => sum + Number.parseInt(digit, 10), 0)
19962
+ );
19963
+ }
19934
19964
  function calculateOdu(date) {
19935
- const day = date.getDate().toString().padStart(2, "0");
19936
- const month = (date.getMonth() + 1).toString().padStart(2, "0");
19937
- const year = date.getFullYear().toString();
19965
+ const { day, month, year } = extractDateParts(date);
19938
19966
  const leftNumbers = [
19939
- parseInt(day[0]),
19967
+ Number.parseInt(day[0], 10),
19940
19968
  // First digit of day
19941
- parseInt(month[0]),
19969
+ Number.parseInt(month[0], 10),
19942
19970
  // First digit of month
19943
- parseInt(year[0]),
19971
+ Number.parseInt(year[0], 10),
19944
19972
  // First digit of year
19945
- parseInt(year[2])
19973
+ Number.parseInt(year[2], 10)
19946
19974
  // Third digit of year
19947
19975
  ];
19948
19976
  const rightNumbers = [
19949
- parseInt(day[1]),
19977
+ Number.parseInt(day[1], 10),
19950
19978
  // Second digit of day
19951
- parseInt(month[1]),
19979
+ Number.parseInt(month[1], 10),
19952
19980
  // Second digit of month
19953
- parseInt(year[1]),
19981
+ Number.parseInt(year[1], 10),
19954
19982
  // Second digit of year
19955
- parseInt(year[3])
19983
+ Number.parseInt(year[3], 10)
19956
19984
  // Fourth digit of year
19957
19985
  ];
19958
- function reduceNumber(num) {
19959
- if (num <= 16) return num;
19960
- return reduceNumber(num.toString().split("").reduce((a, b) => a + parseInt(b), 0));
19961
- }
19962
19986
  const rawLeftSum = leftNumbers.reduce((a, b) => a + b, 0);
19963
19987
  const rawRightSum = rightNumbers.reduce((a, b) => a + b, 0);
19964
19988
  const north = reduceNumber(rawLeftSum);
@@ -23071,8 +23095,9 @@ function renderSphere(push, params) {
23071
23095
  });
23072
23096
  const highlightFill = params.highlights.sphereFills[currentSphereId];
23073
23097
  const activeFill = highlightFill ?? sphereFill;
23098
+ const preserveSpecialRenderer = params.palette.specialSphereMode === "preserve" && (highlightFill === void 0 || params.highlights.specialSphereMode === "preserve");
23074
23099
  push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
23075
- if (params.palette.specialSphereMode === "preserve") {
23100
+ if (preserveSpecialRenderer) {
23076
23101
  if (params.sphereName === "Kether") {
23077
23102
  renderKether(
23078
23103
  push,
@@ -23107,7 +23132,7 @@ function renderSphere(push, params) {
23107
23132
  push(
23108
23133
  `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#spec-${slug})"/>`
23109
23134
  );
23110
- if (params.palette.specialSphereMode !== "preserve" || params.sphereName !== "Kether" && params.sphereName !== "Chokhmah") {
23135
+ if (!preserveSpecialRenderer || params.sphereName !== "Kether" && params.sphereName !== "Chokhmah") {
23111
23136
  push(
23112
23137
  `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#shad-${slug})"/>`
23113
23138
  );
@@ -23223,7 +23248,8 @@ function resolvePalette(palette) {
23223
23248
  function resolveHighlights(highlights) {
23224
23249
  return {
23225
23250
  pathColors: highlights?.paths ?? {},
23226
- sphereFills: highlights?.spheres ?? {}
23251
+ sphereFills: highlights?.spheres ?? {},
23252
+ specialSphereMode: highlights?.specialSphereMode ?? "preserve"
23227
23253
  };
23228
23254
  }
23229
23255
  function resolvePathColor(params) {