@pokepc/dataset 6.7.0-beta.1 → 6.7.1

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 (150) hide show
  1. package/README.md +15 -3
  2. package/build/{build-DvGzwIK8.mjs → build-D2oPkkzJ.mjs} +52 -52
  3. package/build/{build-DvGzwIK8.mjs.map → build-D2oPkkzJ.mjs.map} +1 -1
  4. package/build/{enums-DlMg7WLl.mjs → enums-u8n-nN0B.mjs} +5 -2
  5. package/build/enums-u8n-nN0B.mjs.map +1 -0
  6. package/build/lib/fs.d.mts +6 -6
  7. package/build/lib/fs.d.mts.map +1 -1
  8. package/build/lib/fs.mjs +21 -29
  9. package/build/lib/fs.mjs.map +1 -1
  10. package/build/lib/schemas.d.mts +1 -1
  11. package/build/lib/search.d.mts +2 -0
  12. package/build/lib/search.d.mts.map +1 -1
  13. package/build/lib/search.mjs +3 -3
  14. package/build/lib/search.mjs.map +1 -1
  15. package/build/lib/types.d.mts +1 -1
  16. package/build/lib/utils.d.mts +2 -0
  17. package/build/lib/utils.d.mts.map +1 -1
  18. package/build/lib/utils.mjs +3 -2
  19. package/build/lib-next/_build.mjs +1 -1
  20. package/build/lib-next/enums.d.mts.map +1 -1
  21. package/build/lib-next/enums.mjs +1 -1
  22. package/build/lib-next/schemas.d.mts +8 -8
  23. package/build/lib-next/schemas.mjs +1 -1
  24. package/build/{schemas-DZQWOWP4.d.mts → schemas-CIE3b72j.d.mts} +50 -50
  25. package/build/{schemas-DZQWOWP4.d.mts.map → schemas-CIE3b72j.d.mts.map} +1 -1
  26. package/build/{schemas-Bj1AIX0P.mjs → schemas-CWE4YPI2.mjs} +2 -2
  27. package/build/{schemas-Bj1AIX0P.mjs.map → schemas-CWE4YPI2.mjs.map} +1 -1
  28. package/build/{utils-BwovRocd.mjs → utils-BTjKkD-_.mjs} +2 -2
  29. package/build/utils-BTjKkD-_.mjs.map +1 -0
  30. package/build/utils-internal-C-UStMrZ.d.mts +7 -0
  31. package/build/utils-internal-C-UStMrZ.d.mts.map +1 -0
  32. package/build/{utils-internal-Czgdbnkv.mjs → utils-internal-DPjO9kQX.mjs} +7 -2
  33. package/build/{utils-internal-Czgdbnkv.mjs.map → utils-internal-DPjO9kQX.mjs.map} +1 -1
  34. package/data/pokedexes/champions-regular-roster-m-c.json +27 -1
  35. package/data/pokedexes/hoenn-oras.json +12 -0
  36. package/data/pokedexes/kanto-lgpe.json +11 -0
  37. package/data/pokedexes/national-oras.json +27 -0
  38. package/data/pokemon/abomasnow-mega.json +1 -1
  39. package/data/pokemon/aggron-mega.json +1 -1
  40. package/data/pokemon/ampharos-mega.json +1 -1
  41. package/data/pokemon/arboliva.json +1 -1
  42. package/data/pokemon/baxcalibur-mega.json +0 -1
  43. package/data/pokemon/blastoise-mega.json +12 -1
  44. package/data/pokemon/blaziken-mega.json +1 -1
  45. package/data/pokemon/charizard-mega-x.json +12 -2
  46. package/data/pokemon/charizard-mega-y.json +12 -2
  47. package/data/pokemon/cinderace.json +1 -1
  48. package/data/pokemon/farfetchd.json +2 -1
  49. package/data/pokemon/gengar-mega.json +1 -1
  50. package/data/pokemon/gogoat.json +2 -1
  51. package/data/pokemon/golisopod-mega.json +1 -1
  52. package/data/pokemon/grapploct.json +1 -1
  53. package/data/pokemon/heracross-mega.json +1 -1
  54. package/data/pokemon/houndoom-mega.json +1 -1
  55. package/data/pokemon/indeedee-f.json +1 -1
  56. package/data/pokemon/indeedee.json +1 -1
  57. package/data/pokemon/inteleon.json +1 -1
  58. package/data/pokemon/kangaskhan-mega.json +1 -1
  59. package/data/pokemon/lucario-mega.json +1 -1
  60. package/data/pokemon/mabosstiff.json +1 -1
  61. package/data/pokemon/manectric-mega.json +1 -1
  62. package/data/pokemon/mawile-mega.json +2 -1
  63. package/data/pokemon/mewtwo-mega-x.json +10 -1
  64. package/data/pokemon/mewtwo-mega-y.json +10 -1
  65. package/data/pokemon/mrmime.json +2 -1
  66. package/data/pokemon/pawmot.json +1 -1
  67. package/data/pokemon/perrserker.json +1 -1
  68. package/data/pokemon/persian-alola.json +2 -1
  69. package/data/pokemon/persian.json +2 -1
  70. package/data/pokemon/pincurchin.json +1 -1
  71. package/data/pokemon/pinsir-mega.json +1 -1
  72. package/data/pokemon/sableye-mega.json +1 -1
  73. package/data/pokemon/scizor-mega.json +1 -1
  74. package/data/pokemon/sirfetchd.json +1 -1
  75. package/data/pokemon/squawkabilly-blue.json +1 -1
  76. package/data/pokemon/squawkabilly-white.json +1 -1
  77. package/data/pokemon/squawkabilly-yellow.json +1 -1
  78. package/data/pokemon/squawkabilly.json +6 -2
  79. package/data/pokemon/swalot-f.json +7 -2
  80. package/data/pokemon/swalot.json +2 -1
  81. package/data/pokemon/thievul.json +1 -1
  82. package/data/pokemon/toxtricity-low-key.json +1 -1
  83. package/data/pokemon/toxtricity.json +1 -1
  84. package/data/pokemon/tyranitar-mega.json +1 -1
  85. package/data/pokemon/venusaur-mega.json +12 -1
  86. package/data/pokemon/wigglytuff.json +2 -1
  87. package/data-next/champions/abilities.json +117 -5
  88. package/data-next/champions/battle-states.json +24 -3
  89. package/data-next/champions/i18n/chs/abilities.json +104 -6
  90. package/data-next/champions/i18n/chs/battle-states.json +24 -3
  91. package/data-next/champions/i18n/chs/items.json +144 -0
  92. package/data-next/champions/i18n/chs/moves.json +25 -25
  93. package/data-next/champions/i18n/chs/pokemon.json +195 -0
  94. package/data-next/champions/i18n/cht/abilities.json +105 -7
  95. package/data-next/champions/i18n/cht/battle-states.json +24 -3
  96. package/data-next/champions/i18n/cht/items.json +144 -0
  97. package/data-next/champions/i18n/cht/moves.json +25 -25
  98. package/data-next/champions/i18n/cht/pokemon.json +195 -0
  99. package/data-next/champions/i18n/deu/abilities.json +105 -7
  100. package/data-next/champions/i18n/deu/battle-states.json +24 -3
  101. package/data-next/champions/i18n/deu/items.json +144 -0
  102. package/data-next/champions/i18n/deu/moves.json +28 -28
  103. package/data-next/champions/i18n/deu/pokemon.json +195 -0
  104. package/data-next/champions/i18n/eng/abilities.json +102 -4
  105. package/data-next/champions/i18n/eng/battle-states.json +24 -3
  106. package/data-next/champions/i18n/eng/items.json +144 -0
  107. package/data-next/champions/i18n/eng/moves.json +25 -25
  108. package/data-next/champions/i18n/eng/pokemon.json +195 -0
  109. package/data-next/champions/i18n/es-es/abilities.json +106 -8
  110. package/data-next/champions/i18n/es-es/battle-states.json +24 -3
  111. package/data-next/champions/i18n/es-es/items.json +145 -1
  112. package/data-next/champions/i18n/es-es/moves.json +25 -25
  113. package/data-next/champions/i18n/es-es/pokemon.json +195 -0
  114. package/data-next/champions/i18n/es-la/abilities.json +106 -8
  115. package/data-next/champions/i18n/es-la/battle-states.json +24 -3
  116. package/data-next/champions/i18n/es-la/items.json +145 -1
  117. package/data-next/champions/i18n/es-la/moves.json +26 -26
  118. package/data-next/champions/i18n/es-la/pokemon.json +195 -0
  119. package/data-next/champions/i18n/fra/abilities.json +105 -7
  120. package/data-next/champions/i18n/fra/battle-states.json +24 -3
  121. package/data-next/champions/i18n/fra/items.json +144 -0
  122. package/data-next/champions/i18n/fra/moves.json +25 -25
  123. package/data-next/champions/i18n/fra/pokemon.json +195 -0
  124. package/data-next/champions/i18n/ita/abilities.json +116 -18
  125. package/data-next/champions/i18n/ita/battle-states.json +24 -3
  126. package/data-next/champions/i18n/ita/items.json +145 -1
  127. package/data-next/champions/i18n/ita/moves.json +28 -28
  128. package/data-next/champions/i18n/ita/pokemon.json +195 -0
  129. package/data-next/champions/i18n/jpn/abilities.json +104 -6
  130. package/data-next/champions/i18n/jpn/battle-states.json +24 -3
  131. package/data-next/champions/i18n/jpn/items.json +144 -0
  132. package/data-next/champions/i18n/jpn/moves.json +25 -25
  133. package/data-next/champions/i18n/jpn/pokemon.json +195 -0
  134. package/data-next/champions/i18n/kor/abilities.json +104 -6
  135. package/data-next/champions/i18n/kor/battle-states.json +24 -3
  136. package/data-next/champions/i18n/kor/items.json +144 -0
  137. package/data-next/champions/i18n/kor/moves.json +25 -25
  138. package/data-next/champions/i18n/kor/pokemon.json +195 -0
  139. package/data-next/champions/i18n/pt-br/abilities.json +102 -4
  140. package/data-next/champions/i18n/pt-br/battle-states.json +24 -3
  141. package/data-next/champions/i18n/pt-br/items.json +144 -0
  142. package/data-next/champions/i18n/pt-br/moves.json +25 -25
  143. package/data-next/champions/i18n/pt-br/pokemon.json +195 -0
  144. package/data-next/champions/items.json +180 -0
  145. package/data-next/champions/moves.json +61 -61
  146. package/data-next/champions/pokemon-moves.json +1882 -173
  147. package/data-next/champions/pokemon.json +913 -21
  148. package/package.json +17 -9
  149. package/build/enums-DlMg7WLl.mjs.map +0 -1
  150. package/build/utils-BwovRocd.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokepc/dataset",
3
- "version": "6.7.0-beta.1",
3
+ "version": "6.7.1",
4
4
  "homepage": "https://pokepc.github.io/dataset",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,13 +34,14 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "yolodb": "^1.2.0",
37
- "zod": "^4.5.4"
37
+ "zod": "^4.6.2"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/bun": "^1.4.1",
41
- "@types/node": "^26.4.1",
42
- "openai": "^7.10.0",
43
- "oxfmt": "^0.66.0",
40
+ "@types/bun": "^1.4.2",
41
+ "@types/node": "^26.5.1",
42
+ "concurrently": "^10.0.5",
43
+ "openai": "^7.15.0",
44
+ "oxfmt": "^0.67.0",
44
45
  "publint": "^0.3.24",
45
46
  "transliteration": "^2.6.1",
46
47
  "tsdown": "^0.23.0",
@@ -49,8 +50,8 @@
49
50
  "zod-openapi": "^6.0.2"
50
51
  },
51
52
  "scripts": {
52
- "dev": "node src/openapi/dev.ts",
53
- "build": "pnpm build:next && tsdown && pnpm format",
53
+ "dev": "concurrently --kill-others --names editor,openapi \"pnpm dev:editor\" \"pnpm dev:openapi\"",
54
+ "build": "pnpm build:next && pnpm build:lib && pnpm format",
54
55
  "build:openapi": "node src/openapi/build.ts",
55
56
  "build:pages": "pnpm build:next && node src/openapi/build.ts",
56
57
  "build:next": "bun src/lib-next/_build.ts",
@@ -60,6 +61,13 @@
60
61
  "lint": "publint && pnpm typecheck",
61
62
  "test": "vitest --run --bail 20",
62
63
  "test:e2e": "node tests/smoke-tests/pkg-smoke-test-run.ts",
63
- "typecheck": "tsc --noEmit"
64
+ "typecheck": "tsc --noEmit",
65
+ "dev:openapi": "node src/openapi/dev.ts",
66
+ "dev:editor": "pnpm --filter @pokepc/editor dev",
67
+ "build:lib": "tsdown",
68
+ "build:editor": "pnpm --filter @pokepc/editor build",
69
+ "typecheck:editor": "pnpm --filter @pokepc/editor typecheck",
70
+ "test:editor": "pnpm --filter @pokepc/editor test",
71
+ "test:e2e:editor": "pnpm --filter @pokepc/editor test:e2e"
64
72
  }
65
73
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums-DlMg7WLl.mjs","names":[],"sources":["../src/lib-next/enums.ts"],"sourcesContent":["export const gameTypes = ['superset', 'set', 'game', 'dlc'] as const\nexport type GameType = (typeof gameTypes)[number]\n\nexport const gameSeries = ['main', 'spinoff', 'storage', 'legends'] as const\nexport type GameSeries = (typeof gameSeries)[number]\n\nexport const gamePlatforms = [\n 'gb',\n 'gbc',\n 'gba',\n 'nds',\n '3ds',\n 'mobile',\n 'ngc',\n 'wii',\n 'wiiu',\n 'switch',\n 'switch2',\n] as const\nexport type GamePlatform = (typeof gamePlatforms)[number]\n\nexport const pokemonTypes = [\n 'normal',\n 'fire',\n 'water',\n 'electric',\n 'grass',\n 'ice',\n 'fighting',\n 'poison',\n 'ground',\n 'flying',\n 'psychic',\n 'bug',\n 'rock',\n 'ghost',\n 'dragon',\n 'dark',\n 'steel',\n 'fairy',\n] as const\n\nexport const pokemonTypesInternalOrder: PokemonType[] = [\n 'normal',\n 'fighting',\n 'flying',\n 'poison',\n 'ground',\n 'rock',\n 'bug',\n 'ghost',\n 'steel',\n 'fire',\n 'water',\n 'grass',\n 'electric',\n 'psychic',\n 'ice',\n 'dragon',\n 'dark',\n 'fairy',\n]\nexport type PokemonType = (typeof pokemonTypes)[number]\n\nexport const moveCategories = ['physical', 'special', 'status'] as const\nexport type MoveCategory = (typeof moveCategories)[number]\n\nexport const moveClasses = [\n 'punching',\n 'sound_based',\n 'dance',\n 'slicing',\n 'wind',\n 'powder',\n 'ball_bomb',\n 'pulse',\n 'biting',\n 'explosive',\n 'mental',\n 'healing',\n] as const\nexport type MoveClass = (typeof moveClasses)[number]\n\nexport const moveTargets = [\n 'single_target',\n 'self',\n 'single_ally',\n 'all_allies',\n 'random_opponent',\n 'all_opponents',\n 'entire_field',\n 'opponents_side',\n 'users_side',\n 'all_pokemon',\n 'varies',\n] as const\nexport type MoveTarget = (typeof moveTargets)[number]\n\nexport const statusConditions = [\n 'paralyzed',\n 'frozen',\n 'poisoned',\n 'badly_poisoned',\n 'burned',\n 'asleep',\n] as const\nexport type StatusCondition = (typeof statusConditions)[number]\n\nexport const battleStates = [\n 'harsh_sunlight',\n 'rain',\n 'sandstorm',\n 'snow',\n 'electric_terrain',\n 'grassy_terrain',\n 'misty_terrain',\n 'trick_room',\n 'magic_room',\n 'wonder_room',\n 'critical_hit_ratio_boost',\n 'confused',\n 'infatuated',\n 'drowsy',\n 'encore',\n 'no_ability',\n 'unable_to_repeat',\n 'tailwind',\n 'move_disabled',\n 'cant_escape',\n 'locked_on',\n 'electric_boost',\n 'gravity',\n 'safeguard',\n 'stealth_rock',\n 'stockpiling',\n 'taunted',\n 'magnet_rise',\n 'toxic_spikes',\n 'wish',\n 'sticky_web',\n 'ingrained',\n 'cursed',\n 'trick_or_treating',\n 'light_screen',\n 'reflect',\n 'sealing_off',\n 'perishing',\n 'spikes',\n 'destiny_bound',\n 'forest_cursed',\n 'leech_seeded',\n 'bound',\n 'rampaging',\n 'badly_poisoned',\n 'future_attack',\n 'uproar',\n 'aqua_ring',\n 'landed',\n 'fairy_locked',\n 'psychic_terrain',\n 'throat_chopped',\n 'aurora_veil',\n 'salt_cured',\n 'syrupy',\n 'healing_prevented',\n 'recharging',\n 'charging',\n 'sky_high',\n 'submerged',\n 'underground',\n 'concealed',\n 'minimized',\n 'atk_def_swapped',\n 'flash_fire',\n 'micle_berry',\n]\nexport type BattleState = (typeof battleStates)[number]\n\nexport const itemCategories = [\n 'power_boost',\n 'recovery',\n 'defense',\n 'stat_boost',\n 'effect_extend',\n 'berry',\n 'other',\n 'mega_stone',\n] as const\nexport type ItemCategory = (typeof itemCategories)[number]\n\nexport const bagCategories = [\n 'ball',\n 'medicine',\n 'battle',\n 'berry',\n 'machine',\n 'mega_stone',\n 'z_crystal',\n 'treasure',\n 'ingredient',\n 'material',\n 'key',\n 'other',\n] as const\nexport type BagCategory = (typeof bagCategories)[number]\n\nexport const pokeballCategories = ['regular', 'special', 'hisuian', 'other'] as const\nexport type PokeballCategory = (typeof pokeballCategories)[number]\n\nexport const ribbonCategories = ['league', 'contest', 'tower', 'memory', 'gift'] as const\nexport type RibbonCategory = (typeof ribbonCategories)[number]\n\nexport const statIds = ['hp', 'atk', 'def', 'spa', 'spd', 'spe', 'acc', 'eva'] as const\nexport type StatId = (typeof statIds)[number]\n\nexport const titleTypes = ['ribbon', 'mark', 'custom'] as const\nexport type TitleType = (typeof titleTypes)[number]\n\nexport const pokemonSizes = ['xs', 's', 'm', 'l', 'xl'] as const\nexport type PokemonSize = (typeof pokemonSizes)[number]\n\nexport const genders = ['m', 'f'] as const // m: male, f: female, null/undefined: genderless\nexport type Gender = (typeof genders)[number]\n\n/**\n * In most core series games:\n * - IV of 0: \"No good\" (or \"Not So Good\" in Let's GO)\n * - IV range of 1-15: \"Decent\" (or \"OK\" in Let's GO)\n * - IV range of 16-25: \"Pretty good\" (or \"Good\" in Let's GO)\n * - IV range 26-29: \"Very good\"\n * - IV of 30: \"Fantastic\"\n * - IV of 31: \"Best\"\n * */\nexport const ivJudgeValues = ['nogood', 'decent', 'good', 'verygood', 'fantastic', 'best'] as const\nexport type IvJudgeValue = (typeof ivJudgeValues)[number]\n\nexport const battleStyles = ['singles', 'doubles', 'triples', 'rotation', 'royale'] as const\nexport type BattleStyle = (typeof battleStyles)[number]\n\nexport const raidStyles = ['dynamax', 'tera'] as const\nexport type RaidStyle = (typeof raidStyles)[number]\n"],"mappings":";AAAA,MAAa,YAAY;CAAC;CAAY;CAAO;CAAQ;AAAK;AAG1D,MAAa,aAAa;CAAC;CAAQ;CAAW;CAAW;AAAS;AAGlE,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,4BAA2C;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,iBAAiB;CAAC;CAAY;CAAW;AAAQ;AAG9D,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,qBAAqB;CAAC;CAAW;CAAW;CAAW;AAAO;AAG3E,MAAa,mBAAmB;CAAC;CAAU;CAAW;CAAS;CAAU;AAAM;AAG/E,MAAa,UAAU;CAAC;CAAM;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAG7E,MAAa,aAAa;CAAC;CAAU;CAAQ;AAAQ;AAGrD,MAAa,eAAe;CAAC;CAAM;CAAK;CAAK;CAAK;AAAI;AAGtD,MAAa,UAAU,CAAC,KAAK,GAAG;;;;;;;;;;AAYhC,MAAa,gBAAgB;CAAC;CAAU;CAAU;CAAQ;CAAY;CAAa;AAAM;AAGzF,MAAa,eAAe;CAAC;CAAW;CAAW;CAAW;CAAY;AAAQ;AAGlF,MAAa,aAAa,CAAC,WAAW,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-BwovRocd.mjs","names":[],"sources":["../src/lib/utils.ts"],"sourcesContent":["// ----- Dataset UTILS --------------------------------------------\n\nimport { arrayUnique, capitalizeFirstLetter } from '../utils/utils-internal'\n\nexport function formatDexNum(num: number | string, positions: number = 4): string {\n return num.toString().padStart(positions, '0')\n}\n\nexport function dexNumToInt(num: number | string): number {\n return typeof num === 'string' ? Number.parseInt(num.replace(/^0+/, '')) : num\n}\n\nexport function dexNumToGen(nationalDexNum: number | string): number {\n const num = dexNumToInt(nationalDexNum)\n\n if (num <= 151) return 1\n if (num <= 251) return 2\n if (num <= 386) return 3\n if (num <= 493) return 4\n if (num <= 649) return 5\n if (num <= 721) return 6\n if (num <= 809) return 7\n if (num <= 905) return 8\n return 9\n}\n\nexport function randomPokemonList<T extends Pkds.PokemonBase>(\n pokemonList: Array<T>,\n quantity = 16,\n withForms = true,\n): Array<T> {\n const filteredPokes = withForms ? pokemonList : pokemonList.filter((pkm) => !pkm.isForm)\n const minIndex = 1\n const maxIndex = filteredPokes.length\n const distinctPokeIndices = new Set<number>()\n\n while (distinctPokeIndices.size < quantity) {\n const newPoke = Math.floor(Math.random() * (maxIndex - minIndex + 1)) + minIndex\n distinctPokeIndices.add(newPoke)\n }\n\n return Array.from(distinctPokeIndices)\n .map((index) => filteredPokes[index])\n .filter(Boolean)\n}\n\nexport function getPossiblePokemonGenders(meta: Pkds.Pokemon): Pkds.Gender[] {\n if (meta.hasGenderDifferences && meta.isFemaleForm) {\n return ['f']\n }\n if (meta.hasGenderDifferences && !meta.isFemaleForm) {\n return ['m']\n }\n if (meta.maleRate >= 100) {\n return ['m']\n }\n if (meta.femaleRate >= 100) {\n return ['f']\n }\n if (meta.maleRate <= 0 && meta.femaleRate <= 0) {\n return []\n }\n return ['m', 'f']\n}\n\nexport function getPokemonGender(\n inputGender: string | null | undefined,\n meta: Pkds.Pokemon,\n options?: { allowEmpty?: boolean },\n): Pkds.Gender {\n const possibleGenders = getPossiblePokemonGenders(meta)\n if (possibleGenders.length === 1) {\n return possibleGenders[0]\n }\n if (possibleGenders.length === 0) {\n return null\n }\n\n if (inputGender === 'm' || inputGender === 'f') {\n return inputGender\n }\n\n if (options?.allowEmpty) {\n // if allowEmpty is true, we won't determine/guess the gender, and return null\n // at this point, inputGender is either null or undefined as well\n return null\n }\n\n // if the gender is not specified, we need to determine it based on the maleRate and femaleRate\n if (meta.maleRate >= meta.femaleRate) {\n return 'm'\n }\n\n // if the femaleRate is greater than the maleRate, then the gender is female\n return 'f'\n}\n\n// ----- Dataset Text and Translation UTILS --------------------------------------------\n\nexport function translatePokemonText(\n pkm: Pkds.Pokemon,\n lang3Char: Pkds.LanguageAlpha3,\n): Pkds.PokemonText {\n const fallback = lang3Char === 'eng' ? undefined : translatePokemon(pkm, 'eng')\n const pkmName = pkm.names[lang3Char] ?? fallback?.name ?? pkm.id\n\n const texts: Pkds.PokemonText = {\n lang: lang3Char,\n genusText: pkm.genus[lang3Char] ?? fallback?.genusText,\n name: pkmName,\n speciesName: pkm.speciesNames[lang3Char] ?? pkmName ?? fallback?.speciesName ?? pkmName,\n formName: pkm.formNames[lang3Char] ?? fallback?.formName,\n }\n\n return texts\n}\n\nexport function translatePokemon(\n pokemon: Pkds.Pokemon | Pkds.TranslatedPokemon,\n lang: Pkds.LanguageAlpha3,\n dexNumPositions?: number,\n): Pkds.TranslatedPokemon {\n if (!('name' in pokemon)) {\n return {\n ...pokemon,\n ...translatePokemonText(pokemon, lang),\n speciesGen: dexNumToGen(pokemon.dexNum),\n dexNum: formatDexNum(\n pokemon.dexNum,\n dexNumPositions ?? Math.max(3, String(pokemon.dexNum).length),\n ),\n searchableText: generatePokemonSearchableText(pokemon),\n }\n }\n\n return {\n ...pokemon,\n ...translatePokemonText(pokemon, lang),\n }\n}\n\nexport function translatePokemonList(\n pokemonList: Array<Pkds.Pokemon | Pkds.TranslatedPokemon>,\n lang: Pkds.LanguageAlpha3,\n): Array<Pkds.TranslatedPokemon> {\n return pokemonList.map((pokemon) => translatePokemon(pokemon, lang))\n}\n\nexport function translatePokemonById(\n pokemonList: Array<Pkds.Pokemon | Pkds.TranslatedPokemon>,\n lang: Pkds.LanguageAlpha3,\n): Record<string, Pkds.TranslatedPokemon> {\n return Object.fromEntries(\n pokemonList.map((pokemon) => [pokemon.id, translatePokemon(pokemon, lang)]),\n )\n}\n\nexport function translatePokemonByNid(\n pokemonList: Array<Pkds.Pokemon | Pkds.TranslatedPokemon>,\n lang: Pkds.LanguageAlpha3,\n): Record<string, Pkds.TranslatedPokemon> {\n return Object.fromEntries(\n pokemonList.map((pokemon) => [pokemon.nid, translatePokemon(pokemon, lang)]),\n )\n}\n\nexport function generatePokemonDescription(\n pokemon: Pkds.TranslatedPokemon,\n lang3Char: Pkds.LanguageAlpha3,\n) {\n const parts = []\n const features = []\n const text = translatePokemonText(pokemon, lang3Char)\n\n // Basic description\n parts.push(`${text.genusText}`)\n\n // Form information\n if (pokemon.isForm) {\n parts.push(`Form: ${pokemon.formName}`)\n }\n\n // Pokemon category\n if (pokemon.isMythical) {\n features.push('Mythical')\n }\n if (pokemon.isLegendary) {\n features.push('Legendary')\n }\n\n // Type and generation information\n const types = [pokemon.type1]\n if (pokemon.type2) types.push(pokemon.type2)\n parts.push(`${types.map(capitalizeFirstLetter).join('/')} type`)\n parts.push(`It was discovered in Generation ${pokemon.gen}`)\n\n if (features.length > 0) {\n parts.push(`Classified as a ${features.join(' and ')} Pokémon`)\n }\n\n return parts.join('. ') + '.'\n}\n\nexport function generatePokemonSearchableText(poke: Pkds.Pokemon) {\n const pokeName = arrayUnique(Object.values(poke.names ?? {})).join(' ')\n const pokeFormName = arrayUnique(Object.values(poke.formNames ?? {})).join(' ')\n const speciesGen = dexNumToGen(poke.dexNum)\n\n const fullText = [\n pokeName,\n pokeFormName,\n poke.dexNum,\n poke.id,\n `type:${poke.type1}`,\n poke.type2 ? `type:${poke.type2}` : '',\n `region:${poke.region}`,\n `color:${poke.color}${poke.color === 'brown' ? ' color:orange' : ''}`,\n `gen${speciesGen} gen:${speciesGen} gen${poke.gen} gen:${poke.gen}`,\n poke.isMythical ? 'mythical' : '',\n poke.isLegendary ? 'legendary' : '',\n poke.isFemaleForm ? 'female' : '',\n poke.isBaby ? 'baby' : '',\n poke.isUltraBeast ? 'ultrabeast ultra beast' : '',\n poke.isRegional ? 'regional' : '',\n poke.isFusion ? 'fusion' : '',\n poke.isParadox ? 'paradox' : '',\n poke.isConvergent ? 'convergent' : '',\n poke.isCosmeticForm ? 'cosmetic' : '',\n poke.isGmax ? 'gigantamax gmax' : '',\n poke.isForm ? `is-form` : ``,\n poke.isMega ? `is-mega` : ``,\n poke.isBattleOnlyForm ? `is-battle-only` : `not-battle-only`,\n poke.storableIn.length > 0 ? 'is-storable' : 'not-storable',\n ]\n .filter(Boolean)\n .join(' ')\n .toLowerCase()\n\n return fullText\n}\n\nexport function getGameCategoryLabel(game: Pkds.Game): string {\n switch (game.series) {\n case 'main':\n return 'Main-series'\n case 'legends':\n return 'Legends-series'\n case 'storage':\n return 'Storage-series'\n default:\n return 'Spin-off'\n }\n}\n\nexport function generateGameDescription(game: Pkds.Game, gameCatText: string) {\n const platforms = game.platforms.map((platform: string) => platform.toUpperCase()).join(' / ')\n const features = []\n const parts = []\n const genPart = game.gen > 0 ? ` from Generation ${game.gen} ` : ''\n const releaseText = game.isUnreleased ? 'that will be released for' : 'released for'\n\n parts.push(\n `Pokémon ${game.name} is a ${gameCatText} ${game.type} ${genPart}${releaseText} ${platforms}`,\n )\n\n // if (game.gen > 0) {\n // parts.push(`It's a Generation ${game.gen} game`)\n // }\n\n if (game.features.gmax) features.push('Gigantamax')\n if (game.features.tera) features.push('Terastallization')\n if (game.features.alpha) features.push('Alpha Pokémon')\n\n if (features.length > 0) {\n // parts.push(`It features ${features.join(', ')}`)\n }\n\n if (game.region && game.region !== 'unknown') {\n const capitalizedRegion = game.region.charAt(0).toUpperCase() + game.region.slice(1)\n parts.push(`The game takes place in the ${capitalizedRegion} region`)\n }\n\n return parts.join('. ') + '.'\n}\n\nexport function resolvePokemonName(\n meta: Pkds.TranslatedPokemon,\n nickname?: string,\n lang3Char?: Pkds.LanguageAlpha3,\n): Pkds.PokemonNameInfo {\n const txt: Pkds.PokemonText = lang3Char\n ? translatePokemonText(meta, lang3Char)\n : {\n lang: meta.lang,\n name: meta.name,\n speciesName: meta.speciesName,\n formName: meta.formName,\n genusText: meta.genusText,\n }\n\n const nameObj: Pkds.PokemonNameInfo = {\n displayName: txt.speciesName ?? txt.name,\n displayFormName: txt.formName,\n fullName: txt.name,\n speciesName: txt.speciesName ?? txt.name,\n formName: txt.formName,\n isNicknamed: !!nickname,\n lang: txt.lang,\n }\n\n if (meta.isForm) {\n if (meta.isMega || meta.isPrimal || meta.isGmax) {\n nameObj.displayName = nameObj.fullName\n } else if (txt.formName) {\n nameObj.displayName = `${nameObj.speciesName} (${txt.formName})`\n }\n }\n if (nickname) {\n nameObj.displayName = `${nickname} - ${nameObj.displayName}`\n }\n return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