kaabalah 5.5.0 → 5.6.0

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.
Files changed (54) hide show
  1. package/README.md +25 -0
  2. package/dist/{chunk-T67M2WBD.js → chunk-3HYK4Q4B.js} +263 -50
  3. package/dist/chunk-3HYK4Q4B.js.map +1 -0
  4. package/dist/{chunk-5ID55YUP.mjs → chunk-3SFBJHP2.mjs} +3 -3
  5. package/dist/{chunk-5ID55YUP.mjs.map → chunk-3SFBJHP2.mjs.map} +1 -1
  6. package/dist/chunk-4NMXTZX4.mjs +525 -0
  7. package/dist/chunk-4NMXTZX4.mjs.map +1 -0
  8. package/dist/{chunk-ZZ3YMT2R.js → chunk-EVQ432JA.js} +23 -23
  9. package/dist/{chunk-ZZ3YMT2R.js.map → chunk-EVQ432JA.js.map} +1 -1
  10. package/dist/{chunk-2J6CVLH2.mjs → chunk-IHQPXEB7.mjs} +263 -51
  11. package/dist/chunk-IHQPXEB7.mjs.map +1 -0
  12. package/dist/{chunk-M7XQFDS4.mjs → chunk-OGWTKRJK.js} +236 -43
  13. package/dist/chunk-OGWTKRJK.js.map +1 -0
  14. package/dist/{chunk-XSAXO3D2.mjs → chunk-S6BFRUJQ.mjs} +3 -3
  15. package/dist/{chunk-XSAXO3D2.mjs.map → chunk-S6BFRUJQ.mjs.map} +1 -1
  16. package/dist/{chunk-G5BG73Y5.js → chunk-U3JFWP24.mjs} +225 -46
  17. package/dist/chunk-U3JFWP24.mjs.map +1 -0
  18. package/dist/chunk-XB6PXEKO.js +529 -0
  19. package/dist/chunk-XB6PXEKO.js.map +1 -0
  20. package/dist/{chunk-2WENLHIP.js → chunk-XTVGQXCL.js} +4 -4
  21. package/dist/{chunk-2WENLHIP.js.map → chunk-XTVGQXCL.js.map} +1 -1
  22. package/dist/cli.js +1061 -126
  23. package/dist/cli.js.map +1 -1
  24. package/dist/{registry-DOiHyH-r.d.mts → constants-DbFwuCjR.d.mts} +1 -177
  25. package/dist/{registry-DOiHyH-r.d.ts → constants-DbFwuCjR.d.ts} +1 -177
  26. package/dist/core/index.d.mts +66 -3
  27. package/dist/core/index.d.ts +66 -3
  28. package/dist/core/index.js +55 -39
  29. package/dist/core/index.mjs +2 -2
  30. package/dist/correspondence-model-D8c42J4c.d.mts +281 -0
  31. package/dist/correspondence-model-DhmBYoMf.d.ts +281 -0
  32. package/dist/gematria/index.d.mts +2 -1
  33. package/dist/gematria/index.d.ts +2 -1
  34. package/dist/gematria/index.js +5 -5
  35. package/dist/gematria/index.mjs +2 -2
  36. package/dist/index.d.mts +4 -3
  37. package/dist/index.d.ts +4 -3
  38. package/dist/index.js +111 -71
  39. package/dist/index.mjs +5 -5
  40. package/dist/numerology/index.js +18 -18
  41. package/dist/numerology/index.mjs +3 -3
  42. package/dist/tarot/index.d.mts +64 -2
  43. package/dist/tarot/index.d.ts +64 -2
  44. package/dist/tarot/index.js +30 -4
  45. package/dist/tarot/index.mjs +3 -1
  46. package/package.json +1 -1
  47. package/dist/chunk-2J6CVLH2.mjs.map +0 -1
  48. package/dist/chunk-AD7T42HJ.js +0 -4
  49. package/dist/chunk-AD7T42HJ.js.map +0 -1
  50. package/dist/chunk-G5BG73Y5.js.map +0 -1
  51. package/dist/chunk-M7XQFDS4.mjs.map +0 -1
  52. package/dist/chunk-RFSO3JRG.mjs +0 -3
  53. package/dist/chunk-RFSO3JRG.mjs.map +0 -1
  54. package/dist/chunk-T67M2WBD.js.map +0 -1
package/dist/cli.js CHANGED
@@ -8735,7 +8735,7 @@ var import_config3 = require("dotenv/config");
8735
8735
  // package.json
8736
8736
  var package_default = {
8737
8737
  name: "kaabalah",
8738
- version: "5.5.0",
8738
+ version: "5.6.0",
8739
8739
  description: "The de-facto library for any esoteric calculations and tooling",
8740
8740
  engines: {
8741
8741
  node: ">=18.18.0"
@@ -8961,7 +8961,7 @@ var COMMANDS = [
8961
8961
  },
8962
8962
  {
8963
8963
  name: "tree",
8964
- description: "Show Tree of Life structure with all nodes, data, and edges",
8964
+ description: "Show Tree of Life structure with nodes and first-class correspondence edges",
8965
8965
  args: [],
8966
8966
  flags: [],
8967
8967
  examples: ["kaabalah tree --json --compact", "kaabalah tree --json --fields=nodes"]
@@ -8981,6 +8981,20 @@ var COMMANDS = [
8981
8981
  "kaabalah tree:node path:1 --depth=2 --json"
8982
8982
  ]
8983
8983
  },
8984
+ {
8985
+ name: "tree:find",
8986
+ description: "Find tree nodes by ID, name, or type",
8987
+ args: [{ name: "query", type: "string", required: false, description: "Search string matched against node IDs and names" }],
8988
+ flags: [
8989
+ { name: "type", type: "string", description: "Filter matches by node type (e.g. sphere, tarotArkAnnu, planet)" },
8990
+ { name: "limit", type: "number", default: 20, description: "Maximum matches to return (default: 20)" }
8991
+ ],
8992
+ examples: [
8993
+ "kaabalah tree:find magician --json",
8994
+ "kaabalah tree:find --type=planet --json",
8995
+ "kaabalah tree:find kether --type=sphere --json --compact"
8996
+ ]
8997
+ },
8984
8998
  {
8985
8999
  name: "tree:types",
8986
9000
  description: "List all node types and their counts",
@@ -12128,7 +12142,7 @@ var TAROT_ARKANNUS_DATA = {
12128
12142
  meaning: "Commencement of an enterprise."
12129
12143
  },
12130
12144
  KIER_EGYPTIAN: {
12131
- name: "The Unexpected"
12145
+ name: "Initiation"
12132
12146
  }
12133
12147
  }
12134
12148
  },
@@ -12145,7 +12159,7 @@ var TAROT_ARKANNUS_DATA = {
12145
12159
  meaning: "Opposition to the commencement of the enterprise. The enterprise is commenced when an unexpected obstacle suddenly prevents its execution."
12146
12160
  },
12147
12161
  KIER_EGYPTIAN: {
12148
- name: "Uncertainty"
12162
+ name: "Desolation"
12149
12163
  }
12150
12164
  }
12151
12165
  },
@@ -12162,7 +12176,7 @@ var TAROT_ARKANNUS_DATA = {
12162
12176
  meaning: "Realization of the commencement of the enterprise. The basis of the work is now definitely established, and the undertaking can be fearlessly continued."
12163
12177
  },
12164
12178
  KIER_EGYPTIAN: {
12165
- name: "Domesticity"
12179
+ name: "Innovation"
12166
12180
  }
12167
12181
  }
12168
12182
  },
@@ -12179,7 +12193,7 @@ var TAROT_ARKANNUS_DATA = {
12179
12193
  meaning: "Obstacles to the enterprise."
12180
12194
  },
12181
12195
  KIER_EGYPTIAN: {
12182
- name: "Exchange"
12196
+ name: "Alliance"
12183
12197
  }
12184
12198
  }
12185
12199
  },
@@ -12196,7 +12210,7 @@ var TAROT_ARKANNUS_DATA = {
12196
12210
  meaning: "Opposition to the obstacles. Victory after surmounting them."
12197
12211
  },
12198
12212
  KIER_EGYPTIAN: {
12199
- name: "Impediment"
12213
+ name: "Magnificence"
12200
12214
  }
12201
12215
  }
12202
12216
  },
@@ -12213,7 +12227,7 @@ var TAROT_ARKANNUS_DATA = {
12213
12227
  meaning: "Realization of the opposition. At last the obstacles succeed. Failure of the enterprise in the midst of its execution."
12214
12228
  },
12215
12229
  KIER_EGYPTIAN: {
12216
- name: "Magnificence"
12230
+ name: "Impediment"
12217
12231
  }
12218
12232
  }
12219
12233
  },
@@ -12230,7 +12244,7 @@ var TAROT_ARKANNUS_DATA = {
12230
12244
  meaning: "Certain success to the enterprise."
12231
12245
  },
12232
12246
  KIER_EGYPTIAN: {
12233
- name: "Alliance"
12247
+ name: "Exchange"
12234
12248
  }
12235
12249
  }
12236
12250
  },
@@ -12247,7 +12261,7 @@ var TAROT_ARKANNUS_DATA = {
12247
12261
  meaning: "Opposition to its success. The enterprise will only partially succeed."
12248
12262
  },
12249
12263
  KIER_EGYPTIAN: {
12250
- name: "Innovation"
12264
+ name: "Domesticity"
12251
12265
  }
12252
12266
  }
12253
12267
  },
@@ -12264,7 +12278,7 @@ var TAROT_ARKANNUS_DATA = {
12264
12278
  meaning: "Realization of success. Success is continued."
12265
12279
  },
12266
12280
  KIER_EGYPTIAN: {
12267
- name: "Desolation"
12281
+ name: "Uncertainty"
12268
12282
  }
12269
12283
  }
12270
12284
  },
@@ -12281,7 +12295,7 @@ var TAROT_ARKANNUS_DATA = {
12281
12295
  meaning: "Uncertainty in the management of the enterprise."
12282
12296
  },
12283
12297
  KIER_EGYPTIAN: {
12284
- name: "Initiation"
12298
+ name: "The Unexpected"
12285
12299
  }
12286
12300
  }
12287
12301
  },
@@ -12366,7 +12380,7 @@ var TAROT_ARKANNUS_DATA = {
12366
12380
  meaning: "Commencement of a love affair."
12367
12381
  },
12368
12382
  KIER_EGYPTIAN: {
12369
- name: "Dissension"
12383
+ name: "Attraction"
12370
12384
  }
12371
12385
  }
12372
12386
  },
@@ -12383,7 +12397,7 @@ var TAROT_ARKANNUS_DATA = {
12383
12397
  meaning: "Opposition to this commencement. Unimportant obstacles raised by one of the lovers."
12384
12398
  },
12385
12399
  KIER_EGYPTIAN: {
12386
- name: "Preeminence"
12400
+ name: "Versatility"
12387
12401
  }
12388
12402
  }
12389
12403
  },
@@ -12400,7 +12414,7 @@ var TAROT_ARKANNUS_DATA = {
12400
12414
  meaning: "Realization of this commencement. The love is mutual."
12401
12415
  },
12402
12416
  KIER_EGYPTIAN: {
12403
- name: "Premonition"
12417
+ name: "Consummation"
12404
12418
  }
12405
12419
  }
12406
12420
  },
@@ -12417,7 +12431,7 @@ var TAROT_ARKANNUS_DATA = {
12417
12431
  meaning: "Serious obstacles to the love. They arise from other persons, not from the lovers."
12418
12432
  },
12419
12433
  KIER_EGYPTIAN: {
12420
- name: "Expressiveness"
12434
+ name: "Conjecture"
12421
12435
  }
12422
12436
  }
12423
12437
  },
@@ -12434,7 +12448,7 @@ var TAROT_ARKANNUS_DATA = {
12434
12448
  meaning: "Opposition to the obstacles. Victory over the obstacles after a struggle."
12435
12449
  },
12436
12450
  KIER_EGYPTIAN: {
12437
- name: "Regeneration"
12451
+ name: "Patrimony"
12438
12452
  }
12439
12453
  }
12440
12454
  },
@@ -12451,7 +12465,7 @@ var TAROT_ARKANNUS_DATA = {
12451
12465
  meaning: "The obstacles triumph. Love destroyed in the midst of happiness. Widowhood."
12452
12466
  },
12453
12467
  KIER_EGYPTIAN: {
12454
- name: "Patrimony"
12468
+ name: "Regeneration"
12455
12469
  }
12456
12470
  }
12457
12471
  },
@@ -12468,7 +12482,7 @@ var TAROT_ARKANNUS_DATA = {
12468
12482
  meaning: "Success assured to the lovers."
12469
12483
  },
12470
12484
  KIER_EGYPTIAN: {
12471
- name: "Conjecture"
12485
+ name: "Expressiveness"
12472
12486
  }
12473
12487
  }
12474
12488
  },
@@ -12485,7 +12499,7 @@ var TAROT_ARKANNUS_DATA = {
12485
12499
  meaning: "Partial failure of love. Love only partially succeeds."
12486
12500
  },
12487
12501
  KIER_EGYPTIAN: {
12488
- name: "Consummation"
12502
+ name: "Delusion"
12489
12503
  }
12490
12504
  }
12491
12505
  },
@@ -12502,7 +12516,7 @@ var TAROT_ARKANNUS_DATA = {
12502
12516
  meaning: "Motherhood."
12503
12517
  },
12504
12518
  KIER_EGYPTIAN: {
12505
- name: "Versatility"
12519
+ name: "Preeminence"
12506
12520
  }
12507
12521
  }
12508
12522
  },
@@ -12519,7 +12533,7 @@ var TAROT_ARKANNUS_DATA = {
12519
12533
  meaning: "Uncertainty in the management of the love affair."
12520
12534
  },
12521
12535
  KIER_EGYPTIAN: {
12522
- name: "Attraction"
12536
+ name: "Dissension"
12523
12537
  }
12524
12538
  }
12525
12539
  },
@@ -12604,7 +12618,7 @@ var TAROT_ARKANNUS_DATA = {
12604
12618
  meaning: "Commencement of enmity."
12605
12619
  },
12606
12620
  KIER_EGYPTIAN: {
12607
- name: "Contrition"
12621
+ name: "Vehemence"
12608
12622
  }
12609
12623
  }
12610
12624
  },
@@ -12621,7 +12635,7 @@ var TAROT_ARKANNUS_DATA = {
12621
12635
  meaning: "Opposition to this commencement. The enmity does not last."
12622
12636
  },
12623
12637
  KIER_EGYPTIAN: {
12624
- name: "Pilgrimage"
12638
+ name: "Communion"
12625
12639
  }
12626
12640
  }
12627
12641
  },
@@ -12638,7 +12652,7 @@ var TAROT_ARKANNUS_DATA = {
12638
12652
  meaning: "Realization of the enmity. Hatred."
12639
12653
  },
12640
12654
  KIER_EGYPTIAN: {
12641
- name: "Rivalry"
12655
+ name: "Proscription"
12642
12656
  }
12643
12657
  }
12644
12658
  },
@@ -12655,7 +12669,7 @@ var TAROT_ARKANNUS_DATA = {
12655
12669
  meaning: "Opposition to the hatred. Success against the enemy."
12656
12670
  },
12657
12671
  KIER_EGYPTIAN: {
12658
- name: "Meditation"
12672
+ name: "Solitude"
12659
12673
  }
12660
12674
  }
12661
12675
  },
@@ -12672,7 +12686,7 @@ var TAROT_ARKANNUS_DATA = {
12672
12686
  meaning: "Opposition to this opposition. The enemy triumphs at the moment one fancies the victory is secured."
12673
12687
  },
12674
12688
  KIER_EGYPTIAN: {
12675
- name: "Revelation"
12689
+ name: "Evolution"
12676
12690
  }
12677
12691
  }
12678
12692
  },
@@ -12689,7 +12703,7 @@ var TAROT_ARKANNUS_DATA = {
12689
12703
  meaning: "Equilibrium of the opposition. The enemy is rendered powerless at last."
12690
12704
  },
12691
12705
  KIER_EGYPTIAN: {
12692
- name: "Evolution"
12706
+ name: "Revelation"
12693
12707
  }
12694
12708
  }
12695
12709
  },
@@ -12706,7 +12720,7 @@ var TAROT_ARKANNUS_DATA = {
12706
12720
  meaning: "Success assured to the enemy."
12707
12721
  },
12708
12722
  KIER_EGYPTIAN: {
12709
- name: "Solitude"
12723
+ name: "Meditation"
12710
12724
  }
12711
12725
  }
12712
12726
  },
@@ -12723,7 +12737,7 @@ var TAROT_ARKANNUS_DATA = {
12723
12737
  meaning: "Partial opposition to this success. The enemy only partially triumphs."
12724
12738
  },
12725
12739
  KIER_EGYPTIAN: {
12726
- name: "Proscription"
12740
+ name: "Rivalry"
12727
12741
  }
12728
12742
  }
12729
12743
  },
@@ -12740,7 +12754,7 @@ var TAROT_ARKANNUS_DATA = {
12740
12754
  meaning: "Certain duration of the hatred."
12741
12755
  },
12742
12756
  KIER_EGYPTIAN: {
12743
- name: "Communion"
12757
+ name: "Pilgrimage"
12744
12758
  }
12745
12759
  }
12746
12760
  },
@@ -12757,7 +12771,7 @@ var TAROT_ARKANNUS_DATA = {
12757
12771
  meaning: "Uncertainty in the enmity."
12758
12772
  },
12759
12773
  KIER_EGYPTIAN: {
12760
- name: "Vehemence"
12774
+ name: "Contrition"
12761
12775
  }
12762
12776
  }
12763
12777
  },
@@ -12842,7 +12856,7 @@ var TAROT_ARKANNUS_DATA = {
12842
12856
  meaning: "Commencement of fortune. Inheritance. Gifts. Economy."
12843
12857
  },
12844
12858
  KIER_EGYPTIAN: {
12845
- name: "The Unforeseen"
12859
+ name: "Rebirth"
12846
12860
  }
12847
12861
  }
12848
12862
  },
@@ -12859,7 +12873,7 @@ var TAROT_ARKANNUS_DATA = {
12859
12873
  meaning: "Opposition to this commencement. Difficulty in well establishing the first landmarks of good fortune."
12860
12874
  },
12861
12875
  KIER_EGYPTIAN: {
12862
- name: "Cooperation"
12876
+ name: "Confusion"
12863
12877
  }
12864
12878
  }
12865
12879
  },
@@ -12876,7 +12890,7 @@ var TAROT_ARKANNUS_DATA = {
12876
12890
  meaning: "Realization of this commencement of fortune. A small sum."
12877
12891
  },
12878
12892
  KIER_EGYPTIAN: {
12879
- name: "Avarice"
12893
+ name: "The Provider"
12880
12894
  }
12881
12895
  }
12882
12896
  },
@@ -12893,7 +12907,7 @@ var TAROT_ARKANNUS_DATA = {
12893
12907
  meaning: "Opposition of fortune. Loss of money."
12894
12908
  },
12895
12909
  KIER_EGYPTIAN: {
12896
- name: "Purification"
12910
+ name: "Generosity"
12897
12911
  }
12898
12912
  }
12899
12913
  },
@@ -12910,7 +12924,7 @@ var TAROT_ARKANNUS_DATA = {
12910
12924
  meaning: "Opposition to this opposition. A success coming which will balance the low."
12911
12925
  },
12912
12926
  KIER_EGYPTIAN: {
12913
- name: "Love and Desire"
12927
+ name: "Offering"
12914
12928
  }
12915
12929
  }
12916
12930
  },
@@ -12927,7 +12941,7 @@ var TAROT_ARKANNUS_DATA = {
12927
12941
  meaning: "Realization of the opposition. Ruin."
12928
12942
  },
12929
12943
  KIER_EGYPTIAN: {
12930
- name: "Offering"
12944
+ name: "Love and Desire"
12931
12945
  }
12932
12946
  }
12933
12947
  },
@@ -12944,7 +12958,7 @@ var TAROT_ARKANNUS_DATA = {
12944
12958
  meaning: "Success assured. A large fortune."
12945
12959
  },
12946
12960
  KIER_EGYPTIAN: {
12947
- name: "Generosity"
12961
+ name: "Purification"
12948
12962
  }
12949
12963
  }
12950
12964
  },
@@ -12961,7 +12975,7 @@ var TAROT_ARKANNUS_DATA = {
12961
12975
  meaning: "Partial success. Great loss of money at the moment apparently of definitely securing the fortune."
12962
12976
  },
12963
12977
  KIER_EGYPTIAN: {
12964
- name: "The Provider"
12978
+ name: "Avarice"
12965
12979
  }
12966
12980
  }
12967
12981
  },
@@ -12978,7 +12992,7 @@ var TAROT_ARKANNUS_DATA = {
12978
12992
  meaning: "Equilibrium of equilibrium. A durable fortune."
12979
12993
  },
12980
12994
  KIER_EGYPTIAN: {
12981
- name: "Confusion"
12995
+ name: "Cooperation"
12982
12996
  }
12983
12997
  }
12984
12998
  },
@@ -12995,7 +13009,7 @@ var TAROT_ARKANNUS_DATA = {
12995
13009
  meaning: "Uncertainty in the fortune. Great success and great reverses."
12996
13010
  },
12997
13011
  KIER_EGYPTIAN: {
12998
- name: "Rebirth"
13012
+ name: "The Unforeseen"
12999
13013
  }
13000
13014
  }
13001
13015
  }
@@ -13273,6 +13287,11 @@ var COLORS_DATA = {
13273
13287
  }
13274
13288
  };
13275
13289
 
13290
+ // src/core/correspondence-model.ts
13291
+ function makeCorrespondenceId(left, right) {
13292
+ return [left, right].sort().join("<->");
13293
+ }
13294
+
13276
13295
  // src/core/systems/hermetic-qabalah.ts
13277
13296
  var hermetic_qabalah_exports = {};
13278
13297
  __export(hermetic_qabalah_exports, {
@@ -15948,6 +15967,101 @@ var linkColorsAndWesternAstrology = (tree) => {
15948
15967
  }
15949
15968
  return tree;
15950
15969
  };
15970
+ var linkTarotAndWesternAstrology = (tree) => {
15971
+ if (!tree.loadedParts.includes("tarot") || !tree.loadedParts.includes("westernAstrology")) {
15972
+ throw new Error("Both parts must be loaded for a bridge to happen");
15973
+ }
15974
+ const courtCardsSigns = [
15975
+ {
15976
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KING_OF_WANDS),
15977
+ sign: id(
15978
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
15979
+ WESTERN_ZODIAC_SIGNS.ARIES
15980
+ )
15981
+ },
15982
+ {
15983
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.QUEEN_OF_WANDS),
15984
+ sign: id(
15985
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
15986
+ WESTERN_ZODIAC_SIGNS.LEO
15987
+ )
15988
+ },
15989
+ {
15990
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KNIGHT_OF_WANDS),
15991
+ sign: id(
15992
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
15993
+ WESTERN_ZODIAC_SIGNS.SAGITTARIUS
15994
+ )
15995
+ },
15996
+ {
15997
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KING_OF_CUPS),
15998
+ sign: id(
15999
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16000
+ WESTERN_ZODIAC_SIGNS.CANCER
16001
+ )
16002
+ },
16003
+ {
16004
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.QUEEN_OF_CUPS),
16005
+ sign: id(
16006
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16007
+ WESTERN_ZODIAC_SIGNS.SCORPIO
16008
+ )
16009
+ },
16010
+ {
16011
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KNIGHT_OF_CUPS),
16012
+ sign: id(
16013
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16014
+ WESTERN_ZODIAC_SIGNS.PISCES
16015
+ )
16016
+ },
16017
+ {
16018
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KING_OF_SWORDS),
16019
+ sign: id(
16020
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16021
+ WESTERN_ZODIAC_SIGNS.LIBRA
16022
+ )
16023
+ },
16024
+ {
16025
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.QUEEN_OF_SWORDS),
16026
+ sign: id(
16027
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16028
+ WESTERN_ZODIAC_SIGNS.AQUARIUS
16029
+ )
16030
+ },
16031
+ {
16032
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KNIGHT_OF_SWORDS),
16033
+ sign: id(
16034
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16035
+ WESTERN_ZODIAC_SIGNS.GEMINI
16036
+ )
16037
+ },
16038
+ {
16039
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KING_OF_PENTACLES),
16040
+ sign: id(
16041
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16042
+ WESTERN_ZODIAC_SIGNS.CAPRICORN
16043
+ )
16044
+ },
16045
+ {
16046
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.QUEEN_OF_PENTACLES),
16047
+ sign: id(
16048
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16049
+ WESTERN_ZODIAC_SIGNS.TAURUS
16050
+ )
16051
+ },
16052
+ {
16053
+ courtCard: id("tarotArkAnnu" /* TAROT_ARK_ANNU */, TAROT_ARKANNUS.KNIGHT_OF_PENTACLES),
16054
+ sign: id(
16055
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */,
16056
+ WESTERN_ZODIAC_SIGNS.VIRGO
16057
+ )
16058
+ }
16059
+ ];
16060
+ for (const { courtCard, sign } of courtCardsSigns) {
16061
+ tree.link(courtCard, sign);
16062
+ }
16063
+ return tree;
16064
+ };
15951
16065
  var loadWesternAstrology2 = (tree) => {
15952
16066
  const planets = Object.values(PLANETS);
15953
16067
  const planetsIds = {};
@@ -16948,6 +17062,11 @@ var BRIDGES2 = [
16948
17062
  id: "kaabalah-music-westernAstrology",
16949
17063
  needs: ["music", "westernAstrology"],
16950
17064
  run: (t) => linkSoundsAndWesternAstrology(t)
17065
+ },
17066
+ {
17067
+ id: "kaabalah-tarot-westernAstrology",
17068
+ needs: ["tarot", "westernAstrology"],
17069
+ run: (t) => linkTarotAndWesternAstrology(t)
16951
17070
  }
16952
17071
  ];
16953
17072
 
@@ -17519,7 +17638,13 @@ var ModuleManager = class {
17519
17638
  if (!loadedSystem) {
17520
17639
  throw new Error(`System ${systemKey} not found`);
17521
17640
  }
17522
- loadedSystem.LOADERS.base(this.t);
17641
+ this.t.runWithMutationSource(
17642
+ {
17643
+ kind: "system",
17644
+ system: systemKey
17645
+ },
17646
+ () => loadedSystem.LOADERS.base(this.t)
17647
+ );
17523
17648
  this.activeSystem = systemKey;
17524
17649
  this.loadedParts.clear();
17525
17650
  this.loadedParts.add("base");
@@ -17539,13 +17664,28 @@ var ModuleManager = class {
17539
17664
  if (this.loadedParts.has(partKey)) {
17540
17665
  return;
17541
17666
  }
17542
- system.LOADERS[partKey](this.t);
17667
+ this.t.runWithMutationSource(
17668
+ {
17669
+ kind: "part",
17670
+ system: this.activeSystem,
17671
+ part: partKey
17672
+ },
17673
+ () => system.LOADERS[partKey](this.t)
17674
+ );
17543
17675
  this.loadedParts.add(partKey);
17544
17676
  const possiblePartBridges = system.BRIDGES.filter(
17545
17677
  (b) => b.needs.includes(partKey) && !this.bridgedParts.has(b.id) && b.needs.every((n) => this.loadedParts.has(n))
17546
17678
  );
17547
17679
  for (const bridge of possiblePartBridges) {
17548
- bridge.run(this.t);
17680
+ this.t.runWithMutationSource(
17681
+ {
17682
+ kind: "bridge",
17683
+ system: this.activeSystem,
17684
+ bridgeId: bridge.id,
17685
+ parts: [...bridge.needs]
17686
+ },
17687
+ () => bridge.run(this.t)
17688
+ );
17549
17689
  this.bridgedParts.add(bridge.id);
17550
17690
  }
17551
17691
  }
@@ -17582,7 +17722,15 @@ var ModuleManager = class {
17582
17722
  throw new Error(`Bridge ${bridgeKey} not found`);
17583
17723
  }
17584
17724
  if (!this.bridgedParts.has(bridge.id) && bridge.needs.every((n) => this.loadedParts.has(n))) {
17585
- bridge.run(this.t);
17725
+ this.t.runWithMutationSource(
17726
+ {
17727
+ kind: "bridge",
17728
+ system: this.activeSystem,
17729
+ bridgeId: bridge.id,
17730
+ parts: [...bridge.needs]
17731
+ },
17732
+ () => bridge.run(this.t)
17733
+ );
17586
17734
  this.bridgedParts.add(bridge.id);
17587
17735
  }
17588
17736
  }
@@ -17618,12 +17766,60 @@ var ModuleManager = class {
17618
17766
  };
17619
17767
 
17620
17768
  // src/core/tree-of-life.ts
17769
+ function mergeCorrespondenceMetadata(current, next) {
17770
+ if (!current) {
17771
+ return next ? { ...next } : void 0;
17772
+ }
17773
+ if (!next) {
17774
+ return { ...current };
17775
+ }
17776
+ return {
17777
+ ...current,
17778
+ ...next,
17779
+ tags: [.../* @__PURE__ */ new Set([...current.tags ?? [], ...next.tags ?? []])],
17780
+ attributes: {
17781
+ ...current.attributes ?? {},
17782
+ ...next.attributes ?? {}
17783
+ }
17784
+ };
17785
+ }
17786
+ function mergeCorrespondenceSources(current, next) {
17787
+ const seen = /* @__PURE__ */ new Set();
17788
+ const merged = [];
17789
+ for (const source of [...current, next]) {
17790
+ const key = JSON.stringify(source);
17791
+ if (seen.has(key)) {
17792
+ continue;
17793
+ }
17794
+ seen.add(key);
17795
+ merged.push({
17796
+ ...source,
17797
+ ...source.kind === "bridge" ? { parts: [...source.parts] } : {}
17798
+ });
17799
+ }
17800
+ return merged;
17801
+ }
17621
17802
  var TreeOfLife = class {
17622
17803
  constructor() {
17623
17804
  this.nodes = /* @__PURE__ */ new Map();
17624
17805
  this.adjacent = /* @__PURE__ */ new Map();
17806
+ this.edges = /* @__PURE__ */ new Map();
17807
+ this.mutationSources = [{ kind: "manual" }];
17625
17808
  this.modules = new ModuleManager(this);
17626
17809
  }
17810
+ getCurrentMutationSource() {
17811
+ return this.mutationSources[this.mutationSources.length - 1] ?? {
17812
+ kind: "manual"
17813
+ };
17814
+ }
17815
+ runWithMutationSource(source, fn) {
17816
+ this.mutationSources.push(source);
17817
+ try {
17818
+ return fn();
17819
+ } finally {
17820
+ this.mutationSources.pop();
17821
+ }
17822
+ }
17627
17823
  /**
17628
17824
  * Loads the tree of life system to be used
17629
17825
  * @param systemKey - the key of the system to load
@@ -17685,28 +17881,57 @@ var TreeOfLife = class {
17685
17881
  getNodes() {
17686
17882
  return [...this.nodes.values()];
17687
17883
  }
17884
+ getEdge(left, right) {
17885
+ return this.edges.get(makeCorrespondenceId(left, right));
17886
+ }
17887
+ getEdges(nodeId) {
17888
+ if (!nodeId) {
17889
+ return [...this.edges.values()];
17890
+ }
17891
+ return [...this.adjacent.get(nodeId) ?? []].map((relatedNodeId) => this.getEdge(nodeId, relatedNodeId)).filter((edge) => Boolean(edge));
17892
+ }
17688
17893
  /**
17689
17894
  * Links two nodes bi-directionally
17690
17895
  * @param firstNode - the id of the first node
17691
17896
  * @param secondNode - the id of the second node
17692
17897
  */
17693
- link(firstNode, secondNode) {
17898
+ link(firstNode, secondNode, options = {}) {
17694
17899
  if (!this.nodes.has(firstNode) || !this.nodes.has(secondNode)) {
17695
17900
  throw new Error("unknown node id");
17696
17901
  }
17697
17902
  if (firstNode === secondNode) {
17698
17903
  return;
17699
17904
  }
17700
- if (this.adjacent.has(firstNode) && this.adjacent.get(firstNode)?.has(secondNode)) {
17701
- return;
17702
- }
17905
+ const edgeId = makeCorrespondenceId(firstNode, secondNode);
17906
+ const source = options.source ?? this.getCurrentMutationSource();
17907
+ const existingEdge = this.edges.get(edgeId);
17703
17908
  const put = (leftNode, rightNode) => {
17704
17909
  const set = this.adjacent.get(leftNode) ?? /* @__PURE__ */ new Set();
17705
17910
  set.add(rightNode);
17706
17911
  this.adjacent.set(leftNode, set);
17707
17912
  };
17913
+ if (existingEdge) {
17914
+ this.edges.set(edgeId, {
17915
+ ...existingEdge,
17916
+ metadata: mergeCorrespondenceMetadata(
17917
+ existingEdge.metadata,
17918
+ options.metadata
17919
+ ),
17920
+ sources: mergeCorrespondenceSources(existingEdge.sources, source)
17921
+ });
17922
+ put(firstNode, secondNode);
17923
+ put(secondNode, firstNode);
17924
+ return;
17925
+ }
17708
17926
  put(firstNode, secondNode);
17709
17927
  put(secondNode, firstNode);
17928
+ this.edges.set(edgeId, {
17929
+ id: edgeId,
17930
+ left: firstNode,
17931
+ right: secondNode,
17932
+ metadata: mergeCorrespondenceMetadata(void 0, options.metadata),
17933
+ sources: mergeCorrespondenceSources([], source)
17934
+ });
17710
17935
  }
17711
17936
  /**
17712
17937
  * Gets the current node and all its direct relations, or, when filtered by node type, only the direct relations of that type.
@@ -17791,6 +18016,7 @@ var TreeOfLife = class {
17791
18016
  const neighbors = this.adjacent.get(id2);
17792
18017
  if (neighbors) {
17793
18018
  for (const neighbor of neighbors) {
18019
+ this.edges.delete(makeCorrespondenceId(id2, neighbor));
17794
18020
  const set = this.adjacent.get(neighbor);
17795
18021
  if (!set) {
17796
18022
  continue;
@@ -19808,7 +20034,551 @@ Fibonacci Cycle: ${dateStr} (age ${result.currentAge})
19808
20034
  console.log();
19809
20035
  }
19810
20036
 
20037
+ // src/core/workspace.ts
20038
+ function cloneNode(node) {
20039
+ return Object.freeze({
20040
+ id: node.id,
20041
+ type: node.type,
20042
+ name: node.name,
20043
+ data: node.data && typeof node.data === "object" ? { ...node.data } : node.data
20044
+ });
20045
+ }
20046
+ function cloneMetadata(metadata) {
20047
+ if (!metadata) {
20048
+ return void 0;
20049
+ }
20050
+ return {
20051
+ ...metadata,
20052
+ tags: metadata.tags ? [...metadata.tags] : void 0,
20053
+ attributes: metadata.attributes ? { ...metadata.attributes } : void 0
20054
+ };
20055
+ }
20056
+ function cloneSource(source) {
20057
+ if (source.kind === "bridge") {
20058
+ return {
20059
+ ...source,
20060
+ parts: [...source.parts]
20061
+ };
20062
+ }
20063
+ return { ...source };
20064
+ }
20065
+ function cloneEdge(edge) {
20066
+ return Object.freeze({
20067
+ ...edge,
20068
+ metadata: cloneMetadata(edge.metadata),
20069
+ sources: edge.sources.map(cloneSource)
20070
+ });
20071
+ }
20072
+ function cloneNote(note) {
20073
+ return Object.freeze({
20074
+ ...note,
20075
+ target: { ...note.target },
20076
+ metadata: note.metadata ? { ...note.metadata } : void 0
20077
+ });
20078
+ }
20079
+ function mergeMetadata(current, next) {
20080
+ if (!current) {
20081
+ return cloneMetadata(next);
20082
+ }
20083
+ if (!next) {
20084
+ return cloneMetadata(current);
20085
+ }
20086
+ return {
20087
+ ...current,
20088
+ ...next,
20089
+ tags: [.../* @__PURE__ */ new Set([...current.tags ?? [], ...next.tags ?? []])],
20090
+ attributes: {
20091
+ ...current.attributes ?? {},
20092
+ ...next.attributes ?? {}
20093
+ }
20094
+ };
20095
+ }
20096
+ function mergeSources(current, next) {
20097
+ const seen = /* @__PURE__ */ new Set();
20098
+ const merged = [];
20099
+ for (const source of [...current, next]) {
20100
+ const key = JSON.stringify(source);
20101
+ if (seen.has(key)) {
20102
+ continue;
20103
+ }
20104
+ seen.add(key);
20105
+ merged.push(cloneSource(source));
20106
+ }
20107
+ return merged;
20108
+ }
20109
+ function normalizeTypes(type) {
20110
+ if (!type) {
20111
+ return void 0;
20112
+ }
20113
+ return new Set(Array.isArray(type) ? type : [type]);
20114
+ }
20115
+ function sortNodes(nodes) {
20116
+ return [...nodes].sort((left, right) => {
20117
+ if (left.type !== right.type) {
20118
+ return left.type.localeCompare(right.type);
20119
+ }
20120
+ const leftLabel = String(left.name ?? left.id);
20121
+ const rightLabel = String(right.name ?? right.id);
20122
+ return leftLabel.localeCompare(rightLabel);
20123
+ });
20124
+ }
20125
+ function sortMatches(matches) {
20126
+ return [...matches].sort((left, right) => {
20127
+ if (left.distance !== right.distance) {
20128
+ return left.distance - right.distance;
20129
+ }
20130
+ if (left.node.type !== right.node.type) {
20131
+ return left.node.type.localeCompare(right.node.type);
20132
+ }
20133
+ const leftLabel = String(left.node.name ?? left.node.id);
20134
+ const rightLabel = String(right.node.name ?? right.node.id);
20135
+ return leftLabel.localeCompare(rightLabel);
20136
+ });
20137
+ }
20138
+ function createGraphData(descriptor, nodes, edges, notes) {
20139
+ const nodesById = /* @__PURE__ */ new Map();
20140
+ const nodeIdsByType = /* @__PURE__ */ new Map();
20141
+ const edgesById = /* @__PURE__ */ new Map();
20142
+ const edgeIdsByNodeId = /* @__PURE__ */ new Map();
20143
+ const notesById = /* @__PURE__ */ new Map();
20144
+ const noteIdsByNodeId = /* @__PURE__ */ new Map();
20145
+ const noteIdsByCorrespondenceId = /* @__PURE__ */ new Map();
20146
+ for (const node of nodes) {
20147
+ const clonedNode = cloneNode(node);
20148
+ nodesById.set(clonedNode.id, clonedNode);
20149
+ const typedIds = nodeIdsByType.get(clonedNode.type) ?? [];
20150
+ typedIds.push(clonedNode.id);
20151
+ nodeIdsByType.set(clonedNode.type, typedIds);
20152
+ }
20153
+ for (const edge of edges) {
20154
+ const clonedEdge = cloneEdge(edge);
20155
+ edgesById.set(clonedEdge.id, clonedEdge);
20156
+ const leftEdges = edgeIdsByNodeId.get(clonedEdge.left) ?? [];
20157
+ leftEdges.push(clonedEdge.id);
20158
+ edgeIdsByNodeId.set(clonedEdge.left, leftEdges);
20159
+ const rightEdges = edgeIdsByNodeId.get(clonedEdge.right) ?? [];
20160
+ rightEdges.push(clonedEdge.id);
20161
+ edgeIdsByNodeId.set(clonedEdge.right, rightEdges);
20162
+ }
20163
+ for (const note of notes) {
20164
+ const clonedNote = cloneNote(note);
20165
+ notesById.set(clonedNote.id, clonedNote);
20166
+ if (clonedNote.target.kind === "node") {
20167
+ const nodeNoteIds = noteIdsByNodeId.get(clonedNote.target.nodeId) ?? [];
20168
+ nodeNoteIds.push(clonedNote.id);
20169
+ noteIdsByNodeId.set(clonedNote.target.nodeId, nodeNoteIds);
20170
+ continue;
20171
+ }
20172
+ const edgeId = makeCorrespondenceId(
20173
+ clonedNote.target.left,
20174
+ clonedNote.target.right
20175
+ );
20176
+ const correspondenceNoteIds = noteIdsByCorrespondenceId.get(edgeId) ?? [];
20177
+ correspondenceNoteIds.push(clonedNote.id);
20178
+ noteIdsByCorrespondenceId.set(edgeId, correspondenceNoteIds);
20179
+ }
20180
+ for (const ids of nodeIdsByType.values()) {
20181
+ ids.sort((left, right) => String(left).localeCompare(String(right)));
20182
+ }
20183
+ for (const ids of edgeIdsByNodeId.values()) {
20184
+ ids.sort((left, right) => left.localeCompare(right));
20185
+ }
20186
+ for (const ids of noteIdsByNodeId.values()) {
20187
+ ids.sort((left, right) => left.localeCompare(right));
20188
+ }
20189
+ for (const ids of noteIdsByCorrespondenceId.values()) {
20190
+ ids.sort((left, right) => left.localeCompare(right));
20191
+ }
20192
+ return {
20193
+ descriptor: Object.freeze({ ...descriptor }),
20194
+ nodesById,
20195
+ nodeIdsByType,
20196
+ edgesById,
20197
+ edgeIdsByNodeId,
20198
+ notesById,
20199
+ noteIdsByNodeId,
20200
+ noteIdsByCorrespondenceId
20201
+ };
20202
+ }
20203
+ function normalizeBase(base) {
20204
+ if (!base) {
20205
+ return {
20206
+ descriptor: {},
20207
+ nodes: [],
20208
+ edges: [],
20209
+ notes: []
20210
+ };
20211
+ }
20212
+ if (base instanceof TreeWorkspace) {
20213
+ return {
20214
+ descriptor: base.descriptor,
20215
+ nodes: base.getNodes(),
20216
+ edges: base.getEdges(),
20217
+ notes: base.getNotes()
20218
+ };
20219
+ }
20220
+ return {
20221
+ descriptor: {
20222
+ system: base.activeSystem ?? void 0,
20223
+ parts: base.loadedParts.filter((part) => part !== "base")
20224
+ },
20225
+ nodes: base.getNodes(),
20226
+ edges: base.getEdges(),
20227
+ notes: []
20228
+ };
20229
+ }
20230
+ function applyOverlays(base, overlays) {
20231
+ const nodesById = /* @__PURE__ */ new Map();
20232
+ const edgesById = /* @__PURE__ */ new Map();
20233
+ const notes = [];
20234
+ for (const node of base.nodes) {
20235
+ nodesById.set(node.id, cloneNode(node));
20236
+ }
20237
+ for (const edge of base.edges) {
20238
+ edgesById.set(edge.id, cloneEdge(edge));
20239
+ }
20240
+ for (const note of base.notes) {
20241
+ notes.push(cloneNote(note));
20242
+ }
20243
+ for (const overlay of overlays) {
20244
+ for (const node of overlay.nodes ?? []) {
20245
+ const existing = nodesById.get(node.id);
20246
+ if (existing && existing.type !== node.type) {
20247
+ throw new Error(
20248
+ `Overlay ${overlay.id} tried to upsert ${node.id} with a different type`
20249
+ );
20250
+ }
20251
+ nodesById.set(
20252
+ node.id,
20253
+ cloneNode(
20254
+ existing ? {
20255
+ ...existing,
20256
+ ...node,
20257
+ data: {
20258
+ ...existing.data ?? {},
20259
+ ...node.data ?? {}
20260
+ }
20261
+ } : node
20262
+ )
20263
+ );
20264
+ }
20265
+ for (const correspondence of overlay.correspondences ?? []) {
20266
+ if (!nodesById.has(correspondence.left) || !nodesById.has(correspondence.right)) {
20267
+ throw new Error(
20268
+ `Overlay ${overlay.id} references unknown nodes in ${correspondence.left} <-> ${correspondence.right}`
20269
+ );
20270
+ }
20271
+ const edgeId = makeCorrespondenceId(
20272
+ correspondence.left,
20273
+ correspondence.right
20274
+ );
20275
+ if (correspondence.op === "remove") {
20276
+ edgesById.delete(edgeId);
20277
+ continue;
20278
+ }
20279
+ const existingEdge = edgesById.get(edgeId);
20280
+ const overlaySource = {
20281
+ kind: "overlay",
20282
+ overlayId: overlay.id,
20283
+ label: overlay.name
20284
+ };
20285
+ if (!existingEdge) {
20286
+ if (correspondence.op !== "add") {
20287
+ throw new Error(
20288
+ `Overlay ${overlay.id} cannot annotate missing correspondence ${edgeId}`
20289
+ );
20290
+ }
20291
+ edgesById.set(
20292
+ edgeId,
20293
+ cloneEdge({
20294
+ id: edgeId,
20295
+ left: correspondence.left,
20296
+ right: correspondence.right,
20297
+ metadata: cloneMetadata(correspondence.metadata),
20298
+ sources: [overlaySource]
20299
+ })
20300
+ );
20301
+ continue;
20302
+ }
20303
+ edgesById.set(
20304
+ edgeId,
20305
+ cloneEdge({
20306
+ ...existingEdge,
20307
+ metadata: mergeMetadata(existingEdge.metadata, correspondence.metadata),
20308
+ sources: mergeSources(existingEdge.sources, overlaySource)
20309
+ })
20310
+ );
20311
+ }
20312
+ for (const note of overlay.notes ?? []) {
20313
+ notes.push(
20314
+ cloneNote({
20315
+ ...note,
20316
+ metadata: note.metadata ? { ...note.metadata } : void 0
20317
+ })
20318
+ );
20319
+ }
20320
+ }
20321
+ const filteredNotes = notes.filter((note) => {
20322
+ if (note.target.kind === "node") {
20323
+ return nodesById.has(note.target.nodeId);
20324
+ }
20325
+ return edgesById.has(
20326
+ makeCorrespondenceId(note.target.left, note.target.right)
20327
+ );
20328
+ });
20329
+ return {
20330
+ nodes: [...nodesById.values()],
20331
+ edges: [...edgesById.values()],
20332
+ notes: filteredNotes
20333
+ };
20334
+ }
20335
+ function reconstructPath(startId, targetId, previous, edgesById) {
20336
+ const steps = [];
20337
+ let current = targetId;
20338
+ while (current !== startId) {
20339
+ const link = previous.get(current);
20340
+ if (!link) {
20341
+ break;
20342
+ }
20343
+ const edge = edgesById.get(link.edgeId);
20344
+ if (!edge) {
20345
+ break;
20346
+ }
20347
+ steps.push({
20348
+ from: link.from,
20349
+ to: current,
20350
+ edge
20351
+ });
20352
+ current = link.from;
20353
+ }
20354
+ return steps.reverse();
20355
+ }
20356
+ function buildCanonicalDescriptor(opts, cacheKey) {
20357
+ return {
20358
+ id: `canonical:${cacheKey}`,
20359
+ name: "Canonical Tree",
20360
+ system: opts.system,
20361
+ parts: [...opts.parts ?? []],
20362
+ cacheKey
20363
+ };
20364
+ }
20365
+ var canonicalTreeCache = /* @__PURE__ */ new Map();
20366
+ var TreeWorkspace = class {
20367
+ constructor(graph, visualResolvers = []) {
20368
+ this.graph = graph;
20369
+ this.visualResolvers = visualResolvers;
20370
+ this.descriptor = graph.descriptor;
20371
+ }
20372
+ getNode(id2) {
20373
+ return this.graph.nodesById.get(id2);
20374
+ }
20375
+ hasNode(id2) {
20376
+ return this.graph.nodesById.has(id2);
20377
+ }
20378
+ getNodes(type) {
20379
+ if (!type) {
20380
+ return sortNodes(
20381
+ [...this.graph.nodesById.values()]
20382
+ );
20383
+ }
20384
+ const ids = this.graph.nodeIdsByType.get(type) ?? [];
20385
+ return ids.map((id2) => this.graph.nodesById.get(id2)).filter((node) => Boolean(node));
20386
+ }
20387
+ findNodes(options = {}) {
20388
+ const typeFilter = normalizeTypes(options.type);
20389
+ const search = options.search?.trim().toLowerCase();
20390
+ const candidates = options.ids ? options.ids.map((id2) => this.graph.nodesById.get(id2)).filter((node) => Boolean(node)) : typeFilter ? [...typeFilter].flatMap((type) => this.getNodes(type)) : this.getNodes();
20391
+ return sortNodes(
20392
+ candidates.filter((node) => {
20393
+ if (typeFilter && !typeFilter.has(node.type)) {
20394
+ return false;
20395
+ }
20396
+ if (search) {
20397
+ const haystacks = [
20398
+ String(node.id).toLowerCase(),
20399
+ String(node.name ?? "").toLowerCase()
20400
+ ];
20401
+ if (!haystacks.some((value) => value.includes(search))) {
20402
+ return false;
20403
+ }
20404
+ }
20405
+ return options.predicate ? options.predicate(node) : true;
20406
+ })
20407
+ );
20408
+ }
20409
+ getEdge(left, right) {
20410
+ return this.graph.edgesById.get(makeCorrespondenceId(left, right));
20411
+ }
20412
+ getEdges(nodeId) {
20413
+ if (!nodeId) {
20414
+ return [...this.graph.edgesById.values()];
20415
+ }
20416
+ return (this.graph.edgeIdsByNodeId.get(nodeId) ?? []).map((edgeId) => this.graph.edgesById.get(edgeId)).filter((edge) => Boolean(edge));
20417
+ }
20418
+ getNotes(target) {
20419
+ if (!target) {
20420
+ return [...this.graph.notesById.values()];
20421
+ }
20422
+ if (target.kind === "node") {
20423
+ return (this.graph.noteIdsByNodeId.get(target.nodeId) ?? []).map((noteId) => this.graph.notesById.get(noteId)).filter((note) => Boolean(note));
20424
+ }
20425
+ const edgeId = makeCorrespondenceId(target.left, target.right);
20426
+ return (this.graph.noteIdsByCorrespondenceId.get(edgeId) ?? []).map((noteId) => this.graph.notesById.get(noteId)).filter((note) => Boolean(note));
20427
+ }
20428
+ getCorrespondences(nodeId, options = {}) {
20429
+ if (!this.graph.nodesById.has(nodeId)) {
20430
+ return [];
20431
+ }
20432
+ const typeFilter = normalizeTypes(options.type);
20433
+ const includeSelf = options.includeSelf ?? false;
20434
+ const depth = Math.max(1, options.depth ?? 1);
20435
+ const limit = options.limit ?? Infinity;
20436
+ const previous = /* @__PURE__ */ new Map();
20437
+ const visited = /* @__PURE__ */ new Set([nodeId]);
20438
+ const queue = [
20439
+ {
20440
+ nodeId,
20441
+ distance: 0
20442
+ }
20443
+ ];
20444
+ const matches = [];
20445
+ while (queue.length > 0 && matches.length < limit) {
20446
+ const current = queue.shift();
20447
+ if (current.distance >= depth) {
20448
+ continue;
20449
+ }
20450
+ for (const edgeId of this.graph.edgeIdsByNodeId.get(current.nodeId) ?? []) {
20451
+ const edge = this.graph.edgesById.get(edgeId);
20452
+ if (!edge) {
20453
+ continue;
20454
+ }
20455
+ const nextNodeId = edge.left === current.nodeId ? edge.right : edge.left;
20456
+ if (visited.has(nextNodeId)) {
20457
+ continue;
20458
+ }
20459
+ visited.add(nextNodeId);
20460
+ previous.set(nextNodeId, {
20461
+ from: current.nodeId,
20462
+ edgeId
20463
+ });
20464
+ const distance = current.distance + 1;
20465
+ const nextNode = this.graph.nodesById.get(nextNodeId);
20466
+ if (!nextNode) {
20467
+ continue;
20468
+ }
20469
+ if ((!typeFilter || typeFilter.has(nextNode.type)) && distance > 0) {
20470
+ matches.push({
20471
+ node: nextNode,
20472
+ distance,
20473
+ path: reconstructPath(
20474
+ nodeId,
20475
+ nextNodeId,
20476
+ previous,
20477
+ this.graph.edgesById
20478
+ )
20479
+ });
20480
+ }
20481
+ queue.push({
20482
+ nodeId: nextNodeId,
20483
+ distance
20484
+ });
20485
+ }
20486
+ }
20487
+ if (includeSelf) {
20488
+ const sourceNode = this.graph.nodesById.get(nodeId);
20489
+ if (sourceNode && (!typeFilter || typeFilter.has(sourceNode.type)) && matches.length < limit) {
20490
+ matches.unshift({
20491
+ node: sourceNode,
20492
+ distance: 0,
20493
+ path: []
20494
+ });
20495
+ }
20496
+ }
20497
+ return sortMatches(matches).slice(0, limit);
20498
+ }
20499
+ getCorrespondenceMap(nodeId, options = {}) {
20500
+ const grouped = {};
20501
+ for (const match of this.getCorrespondences(nodeId, options)) {
20502
+ const typeKey = match.node.type;
20503
+ const typeMatches = grouped[typeKey] ?? [];
20504
+ typeMatches.push(match);
20505
+ grouped[typeKey] = typeMatches;
20506
+ }
20507
+ return grouped;
20508
+ }
20509
+ resolveVisual(request) {
20510
+ for (const resolver of this.visualResolvers) {
20511
+ const resolved = resolver({
20512
+ request,
20513
+ workspace: this
20514
+ });
20515
+ if (resolved) {
20516
+ return resolved;
20517
+ }
20518
+ }
20519
+ return void 0;
20520
+ }
20521
+ };
20522
+ function createTreeWorkspace(options = {}) {
20523
+ const base = normalizeBase(options.base);
20524
+ const overlays = options.overlays ?? [];
20525
+ const applied = applyOverlays(base, overlays);
20526
+ const descriptor = {
20527
+ ...base.descriptor,
20528
+ ...options.descriptor
20529
+ };
20530
+ return new TreeWorkspace(
20531
+ createGraphData(descriptor, applied.nodes, applied.edges, applied.notes),
20532
+ options.visualResolvers ?? []
20533
+ );
20534
+ }
20535
+ function getCanonicalTree(opts = {
20536
+ system: "kaabalah",
20537
+ parts: []
20538
+ }) {
20539
+ const parts = [...opts.parts ?? []];
20540
+ const cacheKey = `${opts.system}:${parts.join(",")}`;
20541
+ const cachedTree = canonicalTreeCache.get(cacheKey);
20542
+ if (cachedTree) {
20543
+ return cachedTree;
20544
+ }
20545
+ const tree = createTree({
20546
+ system: opts.system,
20547
+ parts
20548
+ });
20549
+ const canonicalTree = createTreeWorkspace({
20550
+ base: tree,
20551
+ descriptor: buildCanonicalDescriptor(opts, cacheKey)
20552
+ });
20553
+ canonicalTreeCache.set(cacheKey, canonicalTree);
20554
+ return canonicalTree;
20555
+ }
20556
+
19811
20557
  // src/tarot/index.ts
20558
+ var majorArcana = [
20559
+ "01_the_magician",
20560
+ "02_the_high_priestess",
20561
+ "03_the_empress",
20562
+ "04_the_emperor",
20563
+ "05_the_hierophant",
20564
+ "06_the_lover",
20565
+ "07_the_chariot",
20566
+ "08_justice",
20567
+ "09_the_hermit",
20568
+ "10_the_wheel_of_fortune",
20569
+ "11_strength",
20570
+ "12_the_hanged_man",
20571
+ "13_death",
20572
+ "14_temperance",
20573
+ "15_the_devil",
20574
+ "16_the_house_of_god",
20575
+ "17_the_star",
20576
+ "18_the_moon",
20577
+ "19_the_sun",
20578
+ "20_judgement",
20579
+ "21_the_fool",
20580
+ "22_the_world"
20581
+ ];
19812
20582
  var ARKANNUS = [
19813
20583
  // Major Arcana (1-22)
19814
20584
  {
@@ -20059,7 +20829,7 @@ var ARKANNUS = [
20059
20829
  number: 27,
20060
20830
  tarotCard: "Ace of Wands",
20061
20831
  tarotCardFilename: "ace_wands",
20062
- egyptianCardName: "The Unexpected",
20832
+ egyptianCardName: "Initiation",
20063
20833
  meaning: "Ignite the flames of ideals, Trust in your inner divinity",
20064
20834
  papusMeaning: "Commencement of an enterprise.",
20065
20835
  type: "minor",
@@ -20070,7 +20840,7 @@ var ARKANNUS = [
20070
20840
  number: 28,
20071
20841
  tarotCard: "Two of Wands",
20072
20842
  tarotCardFilename: "2_wands",
20073
- egyptianCardName: "Uncertainty",
20843
+ egyptianCardName: "Desolation",
20074
20844
  meaning: "Formulate a strategy to use your own talents",
20075
20845
  papusMeaning: "Opposition to the commencement of the enterprise. The enterprise is commenced when an unexpected obstacle suddenly prevents its execution.",
20076
20846
  type: "minor",
@@ -20081,7 +20851,7 @@ var ARKANNUS = [
20081
20851
  number: 29,
20082
20852
  tarotCard: "Three of Wands",
20083
20853
  tarotCardFilename: "3_wands",
20084
- egyptianCardName: "Domesticity",
20854
+ egyptianCardName: "Innovation",
20085
20855
  meaning: "Keep going despite losing something apparently important",
20086
20856
  papusMeaning: "Realization of the commencement of the enterprise. The basis of the work is now definitely established, and the undertaking can be fearlessly continued.",
20087
20857
  type: "minor",
@@ -20092,7 +20862,7 @@ var ARKANNUS = [
20092
20862
  number: 30,
20093
20863
  tarotCard: "Four of Wands",
20094
20864
  tarotCardFilename: "4_wands",
20095
- egyptianCardName: "Exchange",
20865
+ egyptianCardName: "Alliance",
20096
20866
  meaning: "Work in teams",
20097
20867
  papusMeaning: "Obstacles to the enterprise.",
20098
20868
  type: "minor",
@@ -20103,7 +20873,7 @@ var ARKANNUS = [
20103
20873
  number: 31,
20104
20874
  tarotCard: "Five of Wands",
20105
20875
  tarotCardFilename: "5_wands",
20106
- egyptianCardName: "Impediment",
20876
+ egyptianCardName: "Magnificence",
20107
20877
  meaning: "Strengthen the root chakra, overcome internal fears",
20108
20878
  papusMeaning: "Opposition to the obstacles. Victory after surmounting them.",
20109
20879
  type: "minor",
@@ -20114,7 +20884,7 @@ var ARKANNUS = [
20114
20884
  number: 32,
20115
20885
  tarotCard: "Six of Wands",
20116
20886
  tarotCardFilename: "6_wands",
20117
- egyptianCardName: "Magnificence",
20887
+ egyptianCardName: "Impediment",
20118
20888
  meaning: "External victory, internal lack of internal self realization",
20119
20889
  papusMeaning: "Realization of the opposition. At last the obstacles succeed. Failure of the enterprise in the midst of its execution.",
20120
20890
  type: "minor",
@@ -20125,7 +20895,7 @@ var ARKANNUS = [
20125
20895
  number: 33,
20126
20896
  tarotCard: "Seven of Wands",
20127
20897
  tarotCardFilename: "7_wands",
20128
- egyptianCardName: "Alliance",
20898
+ egyptianCardName: "Exchange",
20129
20899
  meaning: "Face competitors in an ethical and loyal way",
20130
20900
  papusMeaning: "Certain success to the enterprise.",
20131
20901
  type: "minor",
@@ -20136,7 +20906,7 @@ var ARKANNUS = [
20136
20906
  number: 34,
20137
20907
  tarotCard: "Eight of Wands",
20138
20908
  tarotCardFilename: "8_wands",
20139
- egyptianCardName: "Innovation",
20909
+ egyptianCardName: "Domesticity",
20140
20910
  meaning: "Travel to the center of peace and intelligence",
20141
20911
  papusMeaning: "Opposition to its success. The enterprise will only partially succeed.",
20142
20912
  type: "minor",
@@ -20147,7 +20917,7 @@ var ARKANNUS = [
20147
20917
  number: 35,
20148
20918
  tarotCard: "Nine of Wands",
20149
20919
  tarotCardFilename: "9_wands",
20150
- egyptianCardName: "Desolation",
20920
+ egyptianCardName: "Uncertainty",
20151
20921
  meaning: "Obstacle that precedes total victory, gather hidden forces",
20152
20922
  papusMeaning: "Realization of success. Success is continued.",
20153
20923
  type: "minor",
@@ -20158,7 +20928,7 @@ var ARKANNUS = [
20158
20928
  number: 36,
20159
20929
  tarotCard: "Ten of Wands",
20160
20930
  tarotCardFilename: "10_wands",
20161
- egyptianCardName: "Initiation",
20931
+ egyptianCardName: "The Unexpected",
20162
20932
  meaning: "Get out of apathy, create a new tree of life using the Lightning Path",
20163
20933
  papusMeaning: "Uncertainty in the management of the enterprise.",
20164
20934
  type: "minor",
@@ -20215,7 +20985,7 @@ var ARKANNUS = [
20215
20985
  number: 41,
20216
20986
  tarotCard: "Ace of Cups",
20217
20987
  tarotCardFilename: "ace_cups",
20218
- egyptianCardName: "Dissension",
20988
+ egyptianCardName: "Attraction",
20219
20989
  meaning: "Renewal or new affection, alternative treatment for health",
20220
20990
  papusMeaning: "Commencement of a love affair.",
20221
20991
  type: "minor",
@@ -20226,7 +20996,7 @@ var ARKANNUS = [
20226
20996
  number: 42,
20227
20997
  tarotCard: "Two of Cups",
20228
20998
  tarotCardFilename: "2_cups",
20229
- egyptianCardName: "Preeminence",
20999
+ egyptianCardName: "Versatility",
20230
21000
  meaning: "Do not poison yourself or the other person",
20231
21001
  papusMeaning: "Opposition to this commencement. Unimportant obstacles raised by one of the lovers.",
20232
21002
  type: "minor",
@@ -20237,7 +21007,7 @@ var ARKANNUS = [
20237
21007
  number: 43,
20238
21008
  tarotCard: "Three of Cups",
20239
21009
  tarotCardFilename: "3_cups",
20240
- egyptianCardName: "Delusion",
21010
+ egyptianCardName: "Consummation",
20241
21011
  meaning: "Harmony between instinct and emotion, Be discreet",
20242
21012
  papusMeaning: "Realization of this commencement. The love is mutual.",
20243
21013
  type: "minor",
@@ -20248,7 +21018,7 @@ var ARKANNUS = [
20248
21018
  number: 44,
20249
21019
  tarotCard: "Four of Cups",
20250
21020
  tarotCardFilename: "4_cups",
20251
- egyptianCardName: "Expressiveness",
21021
+ egyptianCardName: "Conjecture",
20252
21022
  meaning: "Abundance in emotional life, do not listen to slander",
20253
21023
  papusMeaning: "Serious obstacles to the love. They arise from other persons, not from the lovers.",
20254
21024
  type: "minor",
@@ -20259,7 +21029,7 @@ var ARKANNUS = [
20259
21029
  number: 45,
20260
21030
  tarotCard: "Five of Cups",
20261
21031
  tarotCardFilename: "5_cups",
20262
- egyptianCardName: "Regeneration",
21032
+ egyptianCardName: "Patrimony",
20263
21033
  meaning: "Do not break your spiritual commitment (your purpose)",
20264
21034
  papusMeaning: "Opposition to the obstacles. Victory over the obstacles after a struggle.",
20265
21035
  type: "minor",
@@ -20270,7 +21040,7 @@ var ARKANNUS = [
20270
21040
  number: 46,
20271
21041
  tarotCard: "Six of Cups",
20272
21042
  tarotCardFilename: "6_cups",
20273
- egyptianCardName: "Patrimony",
21043
+ egyptianCardName: "Regeneration",
20274
21044
  meaning: "Do not have self-pity",
20275
21045
  papusMeaning: "The obstacles triumph. Love destroyed in the midst of happiness. Widowhood.",
20276
21046
  type: "minor",
@@ -20281,7 +21051,7 @@ var ARKANNUS = [
20281
21051
  number: 47,
20282
21052
  tarotCard: "Seven of Cups",
20283
21053
  tarotCardFilename: "7_cups",
20284
- egyptianCardName: "Conjecture",
21054
+ egyptianCardName: "Expressiveness",
20285
21055
  meaning: "Gestations, related to The Star",
20286
21056
  papusMeaning: "Success assured to the lovers.",
20287
21057
  type: "minor",
@@ -20292,7 +21062,7 @@ var ARKANNUS = [
20292
21062
  number: 48,
20293
21063
  tarotCard: "Eight of Cups",
20294
21064
  tarotCardFilename: "8_cups",
20295
- egyptianCardName: "Consummation",
21065
+ egyptianCardName: "Delusion",
20296
21066
  meaning: "Reflect on your emotional life after 18 hours",
20297
21067
  papusMeaning: "Partial failure of love. Love only partially succeeds.",
20298
21068
  type: "minor",
@@ -20303,7 +21073,7 @@ var ARKANNUS = [
20303
21073
  number: 49,
20304
21074
  tarotCard: "Nine of Cups",
20305
21075
  tarotCardFilename: "9_cups",
20306
- egyptianCardName: "Versatility",
21076
+ egyptianCardName: "Preeminence",
20307
21077
  meaning: "Reconciliations and forgiveness",
20308
21078
  papusMeaning: "Motherhood.",
20309
21079
  type: "minor",
@@ -20314,7 +21084,7 @@ var ARKANNUS = [
20314
21084
  number: 50,
20315
21085
  tarotCard: "Ten of Cups",
20316
21086
  tarotCardFilename: "10_cups",
20317
- egyptianCardName: "Attraction",
21087
+ egyptianCardName: "Dissension",
20318
21088
  meaning: "Marriage of the spirit with the soul, Alchemical Weddings",
20319
21089
  papusMeaning: "Uncertainty in the management of the love affair.",
20320
21090
  type: "minor",
@@ -20371,7 +21141,7 @@ var ARKANNUS = [
20371
21141
  number: 55,
20372
21142
  tarotCard: "Ace of Swords",
20373
21143
  tarotCardFilename: "ace_swords",
20374
- egyptianCardName: "Contrition",
21144
+ egyptianCardName: "Vehemence",
20375
21145
  meaning: "Conflicts before victory",
20376
21146
  papusMeaning: "Commencement of enmity.",
20377
21147
  type: "minor",
@@ -20382,7 +21152,7 @@ var ARKANNUS = [
20382
21152
  number: 56,
20383
21153
  tarotCard: "Two of Swords",
20384
21154
  tarotCardFilename: "2_swords",
20385
- egyptianCardName: "Pilgrimage",
21155
+ egyptianCardName: "Communion",
20386
21156
  meaning: "Traumas and conflicts to be overcome",
20387
21157
  papusMeaning: "Opposition to this commencement. The enmity does not last.",
20388
21158
  type: "minor",
@@ -20393,7 +21163,7 @@ var ARKANNUS = [
20393
21163
  number: 57,
20394
21164
  tarotCard: "Three of Swords",
20395
21165
  tarotCardFilename: "3_swords",
20396
- egyptianCardName: "Rivalry",
21166
+ egyptianCardName: "Proscription",
20397
21167
  meaning: "Death of yang, Fire, tendencies to depression",
20398
21168
  papusMeaning: "Realization of the enmity. Hatred.",
20399
21169
  type: "minor",
@@ -20404,7 +21174,7 @@ var ARKANNUS = [
20404
21174
  number: 58,
20405
21175
  tarotCard: "Four of Swords",
20406
21176
  tarotCardFilename: "4_swords",
20407
- egyptianCardName: "Meditation",
21177
+ egyptianCardName: "Solitude",
20408
21178
  meaning: "Reflection, related to The Hermit",
20409
21179
  papusMeaning: "Opposition to the hatred. Success against the enemy.",
20410
21180
  type: "minor",
@@ -20415,7 +21185,7 @@ var ARKANNUS = [
20415
21185
  number: 59,
20416
21186
  tarotCard: "Five of Swords",
20417
21187
  tarotCardFilename: "5_swords",
20418
- egyptianCardName: "Revelation",
21188
+ egyptianCardName: "Evolution",
20419
21189
  meaning: "Healthy self-challenge, Self-demands",
20420
21190
  papusMeaning: "Opposition to this opposition. The enemy triumphs at the moment one fancies the victory is secured.",
20421
21191
  type: "minor",
@@ -20426,7 +21196,7 @@ var ARKANNUS = [
20426
21196
  number: 60,
20427
21197
  tarotCard: "Six of Swords",
20428
21198
  tarotCardFilename: "6_swords",
20429
- egyptianCardName: "Evolution",
21199
+ egyptianCardName: "Revelation",
20430
21200
  meaning: "External daily strategies, Future perspectives",
20431
21201
  papusMeaning: "Equilibrium of the opposition. The enemy is rendered powerless at last.",
20432
21202
  type: "minor",
@@ -20437,7 +21207,7 @@ var ARKANNUS = [
20437
21207
  number: 61,
20438
21208
  tarotCard: "Seven of Swords",
20439
21209
  tarotCardFilename: "7_swords",
20440
- egyptianCardName: "Solitude",
21210
+ egyptianCardName: "Meditation",
20441
21211
  meaning: "Internal nocturnal strategies, related to The Hermit",
20442
21212
  papusMeaning: "Success assured to the enemy.",
20443
21213
  type: "minor",
@@ -20448,7 +21218,7 @@ var ARKANNUS = [
20448
21218
  number: 62,
20449
21219
  tarotCard: "Eight of Swords",
20450
21220
  tarotCardFilename: "8_swords",
20451
- egyptianCardName: "Proscription",
21221
+ egyptianCardName: "Rivalry",
20452
21222
  meaning: "Appeal to superior forces, Internal and external conflicts",
20453
21223
  papusMeaning: "Partial opposition to this success. The enemy only partially triumphs.",
20454
21224
  type: "minor",
@@ -20459,7 +21229,7 @@ var ARKANNUS = [
20459
21229
  number: 63,
20460
21230
  tarotCard: "Nine of Swords",
20461
21231
  tarotCardFilename: "9_swords",
20462
- egyptianCardName: "Communion",
21232
+ egyptianCardName: "Pilgrimage",
20463
21233
  meaning: "The problems being imagined will never happen",
20464
21234
  papusMeaning: "Certain duration of the hatred.",
20465
21235
  type: "minor",
@@ -20470,7 +21240,7 @@ var ARKANNUS = [
20470
21240
  number: 64,
20471
21241
  tarotCard: "Ten of Swords",
20472
21242
  tarotCardFilename: "10_swords",
20473
- egyptianCardName: "Vehemence",
21243
+ egyptianCardName: "Contrition",
20474
21244
  meaning: "Death and rebirth, related to Death and The Tower",
20475
21245
  papusMeaning: "Uncertainty in the enmity.",
20476
21246
  type: "minor",
@@ -20527,7 +21297,7 @@ var ARKANNUS = [
20527
21297
  number: 69,
20528
21298
  tarotCard: "Ace of Pentacles",
20529
21299
  tarotCardFilename: "ace_pentacles",
20530
- egyptianCardName: "The Unforeseen",
21300
+ egyptianCardName: "Rebirth",
20531
21301
  meaning: "Rebirth through a single material goal, Form clear material goals",
20532
21302
  papusMeaning: "Commencement of fortune. Inheritance. Gifts. Economy.",
20533
21303
  type: "minor",
@@ -20538,7 +21308,7 @@ var ARKANNUS = [
20538
21308
  number: 70,
20539
21309
  tarotCard: "Two of Pentacles",
20540
21310
  tarotCardFilename: "2_pentacles",
20541
- egyptianCardName: "Cooperation",
21311
+ egyptianCardName: "Confusion",
20542
21312
  meaning: "Light forming shadows, Duality asking for synthesis in the trinity, Don't put all the eggs in the same basket",
20543
21313
  papusMeaning: "Opposition to this commencement. Difficulty in well establishing the first landmarks of good fortune.",
20544
21314
  type: "minor",
@@ -20549,7 +21319,7 @@ var ARKANNUS = [
20549
21319
  number: 71,
20550
21320
  tarotCard: "Three of Pentacles",
20551
21321
  tarotCardFilename: "3_pentacles",
20552
- egyptianCardName: "Avarice",
21322
+ egyptianCardName: "The Provider",
20553
21323
  meaning: "Light forming sound, Establish balance through the trinity becoming a great dispenser, Verbalize what should be done, Do not settle for the first results",
20554
21324
  papusMeaning: "Realization of this commencement of fortune. A small sum.",
20555
21325
  type: "minor",
@@ -20560,7 +21330,7 @@ var ARKANNUS = [
20560
21330
  number: 72,
20561
21331
  tarotCard: "Four of Pentacles",
20562
21332
  tarotCardFilename: "4_pentacles",
20563
- egyptianCardName: "Purification",
21333
+ egyptianCardName: "Generosity",
20564
21334
  meaning: "Avoid avarice / greed",
20565
21335
  papusMeaning: "Opposition of fortune. Loss of money.",
20566
21336
  type: "minor",
@@ -20571,7 +21341,7 @@ var ARKANNUS = [
20571
21341
  number: 73,
20572
21342
  tarotCard: "Five of Pentacles",
20573
21343
  tarotCardFilename: "5_pentacles",
20574
- egyptianCardName: "Love and Desire",
21344
+ egyptianCardName: "Offering",
20575
21345
  meaning: "Only order will bring progress, Do not kick the barn without having something concrete in front of you",
20576
21346
  papusMeaning: "Opposition to this opposition. A success coming which will balance the low.",
20577
21347
  type: "minor",
@@ -20582,7 +21352,7 @@ var ARKANNUS = [
20582
21352
  number: 74,
20583
21353
  tarotCard: "Six of Pentacles",
20584
21354
  tarotCardFilename: "6_pentacles",
20585
- egyptianCardName: "Offering",
21355
+ egyptianCardName: "Love and Desire",
20586
21356
  meaning: "Act with prudence",
20587
21357
  papusMeaning: "Realization of the opposition. Ruin.",
20588
21358
  type: "minor",
@@ -20593,7 +21363,7 @@ var ARKANNUS = [
20593
21363
  number: 75,
20594
21364
  tarotCard: "Seven of Pentacles",
20595
21365
  tarotCardFilename: "7_pentacles",
20596
- egyptianCardName: "Generosity",
21366
+ egyptianCardName: "Purification",
20597
21367
  meaning: "Don't boast about your proposal or project",
20598
21368
  papusMeaning: "Success assured. A large fortune.",
20599
21369
  type: "minor",
@@ -20604,7 +21374,7 @@ var ARKANNUS = [
20604
21374
  number: 76,
20605
21375
  tarotCard: "Eight of Pentacles",
20606
21376
  tarotCardFilename: "8_pentacles",
20607
- egyptianCardName: "The Provider",
21377
+ egyptianCardName: "Avarice",
20608
21378
  meaning: "Keep doing what you always did",
20609
21379
  papusMeaning: "Partial success. Great loss of money at the moment apparently of definitely securing the fortune.",
20610
21380
  type: "minor",
@@ -20615,7 +21385,7 @@ var ARKANNUS = [
20615
21385
  number: 77,
20616
21386
  tarotCard: "Nine of Pentacles",
20617
21387
  tarotCardFilename: "9_pentacles",
20618
- egyptianCardName: "Confusion",
21388
+ egyptianCardName: "Cooperation",
20619
21389
  meaning: "Work with what you like and earn something with it",
20620
21390
  papusMeaning: "Equilibrium of equilibrium. A durable fortune.",
20621
21391
  type: "minor",
@@ -20626,7 +21396,7 @@ var ARKANNUS = [
20626
21396
  number: 78,
20627
21397
  tarotCard: "Ten of Pentacles",
20628
21398
  tarotCardFilename: "10_pentacles",
20629
- egyptianCardName: "Rebirth",
21399
+ egyptianCardName: "The Unforeseen",
20630
21400
  meaning: "Prosperity, Prosperous inheritance",
20631
21401
  papusMeaning: "Uncertainty in the fortune. Great success and great reverses.",
20632
21402
  type: "minor",
@@ -20658,6 +21428,9 @@ async function shuffleTarotDeck(cards, includeInvertedCards = false, shuffleCoun
20658
21428
  }
20659
21429
  return shuffledCards;
20660
21430
  }
21431
+ var MAJOR_ARCANA_CARDS = ARKANNUS.filter(
21432
+ (card) => card.type === "major" && majorArcana.includes(card.tarotCardFilename)
21433
+ );
20661
21434
 
20662
21435
  // src/cli/commands/tarot.ts
20663
21436
  function findCardsByQuery(query) {
@@ -20758,7 +21531,10 @@ function cmdTarotSpread(cardQueries, flags) {
20758
21531
 
20759
21532
  // src/cli/commands/tree.ts
20760
21533
  function getTree() {
20761
- return createTree({ system: SYSTEM2, parts: ["westernAstrology", "tarot"] });
21534
+ return getCanonicalTree({
21535
+ system: SYSTEM2,
21536
+ parts: ["westernAstrology", "tarot"]
21537
+ });
20762
21538
  }
20763
21539
  function serializeNode(node) {
20764
21540
  const result = { id: node.id, type: node.type };
@@ -20770,37 +21546,109 @@ function serializeNode(node) {
20770
21546
  }
20771
21547
  return result;
20772
21548
  }
21549
+ function serializeSource(source) {
21550
+ return source.kind === "bridge" ? { ...source, parts: [...source.parts] } : { ...source };
21551
+ }
21552
+ function serializeEdge(edge) {
21553
+ const serialized = {
21554
+ id: edge.id,
21555
+ from: edge.left,
21556
+ to: edge.right
21557
+ };
21558
+ if (edge.metadata) {
21559
+ serialized.metadata = edge.metadata;
21560
+ }
21561
+ if (edge.sources.length > 0) {
21562
+ serialized.sources = edge.sources.map(serializeSource);
21563
+ }
21564
+ return serialized;
21565
+ }
21566
+ function serializeMatch(match) {
21567
+ return {
21568
+ node: serializeNode(match.node),
21569
+ distance: match.distance,
21570
+ path: match.path.map((step) => ({
21571
+ from: step.from,
21572
+ to: step.to,
21573
+ edge: serializeEdge(step.edge)
21574
+ }))
21575
+ };
21576
+ }
21577
+ function getRelatedTypes(tree, nodeId) {
21578
+ return [...new Set(
21579
+ tree.getEdges(nodeId).map((edge) => {
21580
+ const relatedNodeId = edge.left === nodeId ? edge.right : edge.left;
21581
+ return tree.getNode(relatedNodeId)?.type;
21582
+ }).filter((type) => Boolean(type))
21583
+ )].sort((left, right) => left.localeCompare(right));
21584
+ }
21585
+ function groupSerializedMatches(matches) {
21586
+ const grouped = {};
21587
+ for (const match of matches) {
21588
+ const bucket = grouped[match.node.type] ?? [];
21589
+ bucket.push(serializeMatch(match));
21590
+ grouped[match.node.type] = bucket;
21591
+ }
21592
+ return grouped;
21593
+ }
21594
+ function humanLabel(node) {
21595
+ const data = node.data;
21596
+ return data?.name ?? data?.character ?? data?.englishName ?? data?.meaning ?? node.name ?? "";
21597
+ }
21598
+ function describeSources(edge) {
21599
+ const parts = /* @__PURE__ */ new Set();
21600
+ for (const source of edge.sources) {
21601
+ if (source.kind === "system") {
21602
+ parts.add(`system:${source.system}`);
21603
+ continue;
21604
+ }
21605
+ if (source.kind === "part") {
21606
+ parts.add(`part:${source.part}`);
21607
+ continue;
21608
+ }
21609
+ if (source.kind === "bridge") {
21610
+ parts.add(`bridge:${source.bridgeId}`);
21611
+ continue;
21612
+ }
21613
+ if (source.kind === "overlay") {
21614
+ parts.add(`overlay:${source.overlayId}`);
21615
+ continue;
21616
+ }
21617
+ parts.add(source.kind);
21618
+ }
21619
+ return [...parts].join(", ");
21620
+ }
20773
21621
  function cmdTree(flags) {
20774
21622
  const tree = getTree();
20775
21623
  const allNodes = tree.getNodes();
20776
21624
  if (isJsonMode(flags)) {
20777
21625
  const nodes = allNodes.map((node) => {
20778
21626
  const serialized = serializeNode(node);
20779
- const relatedTypes = tree.relatedTypes(node.id);
21627
+ const relatedTypes = getRelatedTypes(tree, node.id);
20780
21628
  if (relatedTypes.length > 0) {
20781
21629
  serialized.relatedTypes = relatedTypes;
20782
21630
  }
20783
21631
  return serialized;
20784
21632
  });
20785
- const edgeSet = /* @__PURE__ */ new Set();
20786
- const edges = [];
20787
- for (const node of allNodes) {
20788
- const related = tree.related(node.id);
20789
- for (const relation of related) {
20790
- const key = node.id < relation.id ? `${node.id}|${relation.id}` : `${relation.id}|${node.id}`;
20791
- if (!edgeSet.has(key)) {
20792
- edgeSet.add(key);
20793
- edges.push({ from: node.id, to: relation.id });
20794
- }
20795
- }
20796
- }
20797
- outputJson({ system: SYSTEM2, totalNodes: allNodes.length, totalEdges: edges.length, nodes, edges }, flags);
21633
+ const edges = tree.getEdges().map(serializeEdge);
21634
+ outputJson(
21635
+ {
21636
+ descriptor: tree.descriptor,
21637
+ system: SYSTEM2,
21638
+ totalNodes: allNodes.length,
21639
+ totalEdges: edges.length,
21640
+ nodes,
21641
+ edges
21642
+ },
21643
+ flags
21644
+ );
20798
21645
  return;
20799
21646
  }
20800
21647
  console.log(`
20801
21648
  Tree of Life (${SYSTEM2})
20802
21649
  `);
20803
21650
  console.log(` Total nodes: ${allNodes.length}`);
21651
+ console.log(` Total correspondences: ${tree.getEdges().length}`);
20804
21652
  const byType = /* @__PURE__ */ new Map();
20805
21653
  for (const node of allNodes) {
20806
21654
  if (!byType.has(node.type)) {
@@ -20812,9 +21660,8 @@ Tree of Life (${SYSTEM2})
20812
21660
  console.log(`
20813
21661
  ${type} (${nodes.length}):`);
20814
21662
  for (const node of nodes.slice(0, 15)) {
20815
- const data = node.data;
20816
- const name = data?.name ?? data?.character ?? "";
20817
- console.log(` ${node.id}${name ? ` \u2014 ${name}` : ""}`);
21663
+ const label = humanLabel(node);
21664
+ console.log(` ${node.id}${label ? ` \u2014 ${label}` : ""}`);
20818
21665
  }
20819
21666
  if (nodes.length > 15) {
20820
21667
  console.log(` ... and ${nodes.length - 15} more`);
@@ -20826,17 +21673,36 @@ function cmdTreeNode(idStr, flags) {
20826
21673
  const tree = getTree();
20827
21674
  const node = tree.getNode(idStr);
20828
21675
  if (!node) {
20829
- exitWithError("INVALID_ARGUMENT", `Node "${idStr}" not found. Use "kaabalah tree:types --json" to see valid node types, or "kaabalah tree --json --fields=nodes" to list all node IDs.`, flags);
21676
+ exitWithError(
21677
+ "INVALID_ARGUMENT",
21678
+ `Node "${idStr}" not found. Use "kaabalah tree:types --json" to see valid node types, or "kaabalah tree --json --fields=nodes" to list all node IDs.`,
21679
+ flags
21680
+ );
20830
21681
  }
20831
21682
  const typeFilter = getFlagString(flags, "type");
20832
21683
  const depth = getFlagNumber(flags, "depth") ?? 1;
20833
- const related = depth > 1 ? tree.walk(node.id, depth, typeFilter || void 0) : typeFilter ? tree.related(node.id, typeFilter) : tree.related(node.id);
21684
+ const correspondences = tree.getCorrespondences(node.id, {
21685
+ depth,
21686
+ type: typeFilter ?? void 0
21687
+ });
21688
+ const related = correspondences.map(({ node: relatedNode }) => relatedNode);
21689
+ const directEdges = tree.getEdges(node.id);
21690
+ const relatedTypes = getRelatedTypes(tree, node.id);
20834
21691
  if (isJsonMode(flags)) {
20835
- outputJson({
20836
- node: serializeNode(node),
20837
- relatedTypes: tree.relatedTypes(node.id),
20838
- related: related.map(serializeNode)
20839
- }, flags);
21692
+ outputJson(
21693
+ {
21694
+ descriptor: tree.descriptor,
21695
+ node: serializeNode(node),
21696
+ relatedTypes,
21697
+ depth,
21698
+ ...typeFilter ? { typeFilter } : {},
21699
+ related: related.map(serializeNode),
21700
+ directEdges: directEdges.map(serializeEdge),
21701
+ correspondences: correspondences.map(serializeMatch),
21702
+ correspondenceMap: groupSerializedMatches(correspondences)
21703
+ },
21704
+ flags
21705
+ );
20840
21706
  return;
20841
21707
  }
20842
21708
  console.log(`
@@ -20850,21 +21716,26 @@ function cmdTreeNode(idStr, flags) {
20850
21716
  }
20851
21717
  }
20852
21718
  console.log(`
20853
- Related types: ${tree.relatedTypes(node.id).join(", ")}`);
21719
+ Related types: ${relatedTypes.join(", ")}`);
20854
21720
  const byType = /* @__PURE__ */ new Map();
20855
- for (const relation of related) {
20856
- if (!byType.has(relation.type)) {
20857
- byType.set(relation.type, []);
21721
+ for (const relation of correspondences) {
21722
+ if (!byType.has(relation.node.type)) {
21723
+ byType.set(relation.node.type, []);
20858
21724
  }
20859
- byType.get(relation.type).push(relation);
21725
+ byType.get(relation.node.type).push(relation);
20860
21726
  }
20861
- for (const [type, nodes] of byType) {
21727
+ for (const [type, matches] of byType) {
20862
21728
  console.log(`
20863
21729
  ${type}:`);
20864
- for (const relation of nodes) {
20865
- const relationData = relation.data;
20866
- const label = relationData?.name ?? relationData?.character ?? relationData?.englishName ?? relationData?.meaning ?? "";
20867
- console.log(` ${relation.id}${label ? ` \u2014 ${label}` : ""}`);
21730
+ for (const match of matches) {
21731
+ const label = humanLabel(match.node);
21732
+ const sources = match.path.length > 0 ? describeSources(match.path[match.path.length - 1].edge) : "";
21733
+ const details = [
21734
+ label ? `\u2014 ${label}` : "",
21735
+ match.distance > 1 ? `(depth ${match.distance})` : "",
21736
+ sources ? `[${sources}]` : ""
21737
+ ].filter(Boolean).join(" ");
21738
+ console.log(` ${match.node.id}${details ? ` ${details}` : ""}`);
20868
21739
  }
20869
21740
  }
20870
21741
  console.log();
@@ -20881,7 +21752,13 @@ function cmdTreeTypes(flags) {
20881
21752
  counts[node.type].ids.push(node.id);
20882
21753
  }
20883
21754
  if (isJsonMode(flags)) {
20884
- outputJson(counts, flags);
21755
+ outputJson(
21756
+ {
21757
+ descriptor: tree.descriptor,
21758
+ types: counts
21759
+ },
21760
+ flags
21761
+ );
20885
21762
  return;
20886
21763
  }
20887
21764
  console.log(`
@@ -20892,6 +21769,58 @@ Node types (${Object.keys(counts).length}):
20892
21769
  }
20893
21770
  console.log();
20894
21771
  }
21772
+ function cmdTreeFind(query, flags) {
21773
+ const tree = getTree();
21774
+ const typeFilter = getFlagString(flags, "type");
21775
+ const limit = getFlagNumber(flags, "limit") ?? 20;
21776
+ const search = query?.trim() || void 0;
21777
+ if (!search && !typeFilter) {
21778
+ exitWithError(
21779
+ "MISSING_ARGUMENT",
21780
+ "Usage: kaabalah tree:find <query> [--type=<nodeType>] or kaabalah tree:find --type=<nodeType>",
21781
+ flags
21782
+ );
21783
+ }
21784
+ const matches = tree.findNodes({
21785
+ search,
21786
+ type: typeFilter ?? void 0
21787
+ });
21788
+ const limitedMatches = matches.slice(0, Math.max(1, limit));
21789
+ if (isJsonMode(flags)) {
21790
+ outputJson(
21791
+ {
21792
+ descriptor: tree.descriptor,
21793
+ query: search ?? null,
21794
+ ...typeFilter ? { typeFilter } : {},
21795
+ totalMatches: matches.length,
21796
+ returnedMatches: limitedMatches.length,
21797
+ matches: limitedMatches.map(serializeNode)
21798
+ },
21799
+ flags
21800
+ );
21801
+ return;
21802
+ }
21803
+ console.log(`
21804
+ Tree search
21805
+ `);
21806
+ if (search) {
21807
+ console.log(` Query: ${search}`);
21808
+ }
21809
+ if (typeFilter) {
21810
+ console.log(` Type: ${typeFilter}`);
21811
+ }
21812
+ console.log(` Matches: ${matches.length}
21813
+ `);
21814
+ for (const match of limitedMatches) {
21815
+ const label = humanLabel(match);
21816
+ console.log(` ${match.id}${label ? ` \u2014 ${label}` : ""}`);
21817
+ }
21818
+ if (matches.length > limitedMatches.length) {
21819
+ console.log(`
21820
+ ... and ${matches.length - limitedMatches.length} more`);
21821
+ }
21822
+ console.log();
21823
+ }
20895
21824
 
20896
21825
  // src/cli/app.ts
20897
21826
  function outputVersion(flags) {
@@ -21048,6 +21977,12 @@ async function runCli(argv) {
21048
21977
  }
21049
21978
  cmdTreeNode(inputPayload?.id ?? args.slice(1).join(" "), flags);
21050
21979
  return;
21980
+ case "tree:find":
21981
+ cmdTreeFind(
21982
+ inputPayload?.query ?? (args.slice(1).join(" ") || void 0),
21983
+ flags
21984
+ );
21985
+ return;
21051
21986
  case "tree:types":
21052
21987
  cmdTreeTypes(flags);
21053
21988
  return;