@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
@@ -170,7 +170,10 @@ const battleStates = [
170
170
  "minimized",
171
171
  "atk_def_swapped",
172
172
  "flash_fire",
173
- "micle_berry"
173
+ "micle_berry",
174
+ "octolocked",
175
+ "wide_open",
176
+ "jaw_locked"
174
177
  ];
175
178
  const itemCategories = [
176
179
  "power_boost",
@@ -260,4 +263,4 @@ const raidStyles = ["dynamax", "tera"];
260
263
  //#endregion
261
264
  export { raidStyles as _, gameSeries as a, statusConditions as b, itemCategories as c, moveClasses as d, moveTargets as f, pokemonTypesInternalOrder as g, pokemonTypes as h, gamePlatforms as i, ivJudgeValues as l, pokemonSizes as m, battleStates as n, gameTypes as o, pokeballCategories as p, battleStyles as r, genders as s, bagCategories as t, moveCategories as u, ribbonCategories as v, titleTypes as x, statIds as y };
262
265
 
263
- //# sourceMappingURL=enums-DlMg7WLl.mjs.map
266
+ //# sourceMappingURL=enums-u8n-nN0B.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums-u8n-nN0B.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 'octolocked',\n 'wide_open',\n 'jaw_locked',\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;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"}
@@ -9,7 +9,7 @@ export declare const itemsFs: import("yolodb").YoloDbTable<{
9
9
  gen: number;
10
10
  shortDesc: string;
11
11
  desc: string | null;
12
- category: "other" | "ball" | "medicine" | "battle" | "berry" | "machine" | "megastone" | "zcrystal" | "treasure" | "ingredient" | "material" | "key";
12
+ category: "berry" | "other" | "ball" | "medicine" | "battle" | "machine" | "treasure" | "ingredient" | "material" | "key" | "megastone" | "zcrystal";
13
13
  unholdable?: boolean | undefined;
14
14
  }>;
15
15
  export declare const pokeballsFs: import("yolodb").YoloDbTable<{
@@ -18,7 +18,7 @@ export declare const pokeballsFs: import("yolodb").YoloDbTable<{
18
18
  gen: number;
19
19
  shortDesc: string;
20
20
  desc: string | null;
21
- category: "other" | "regular" | "special" | "hisuian";
21
+ category: "special" | "other" | "regular" | "hisuian";
22
22
  unusable?: boolean | undefined;
23
23
  }>;
24
24
  export declare const abilitiesFs: import("yolodb").YoloDbTable<{
@@ -28,7 +28,7 @@ export declare const abilitiesFs: import("yolodb").YoloDbTable<{
28
28
  gen: number;
29
29
  shortDesc: string;
30
30
  desc: string | null;
31
- tags: ("alert" | "ally-helper" | "stat-boost" | "move-boost" | "bypass" | "defense" | "handicap" | "heal" | "items" | "priority-control" | "damage" | "target-weaken" | "status-trigger" | "status-immunity" | "steal" | "weather" | "terrain" | "trap" | "ability-change" | "type-change" | "species-specific" | "other")[];
31
+ tags: ("defense" | "other" | "alert" | "ally-helper" | "stat-boost" | "move-boost" | "bypass" | "handicap" | "heal" | "items" | "priority-control" | "damage" | "target-weaken" | "status-trigger" | "status-immunity" | "steal" | "weather" | "terrain" | "trap" | "ability-change" | "type-change" | "species-specific")[];
32
32
  immunities?: ("normal" | "fire" | "water" | "electric" | "grass" | "ice" | "fighting" | "poison" | "ground" | "flying" | "psychic" | "bug" | "rock" | "ghost" | "dragon" | "dark" | "steel" | "fairy" | "stellar")[] | undefined;
33
33
  weaknesses?: ("normal" | "fire" | "water" | "electric" | "grass" | "ice" | "fighting" | "poison" | "ground" | "flying" | "psychic" | "bug" | "rock" | "ghost" | "dragon" | "dark" | "steel" | "fairy" | "stellar")[] | undefined;
34
34
  }>;
@@ -43,7 +43,7 @@ export declare const movesFs: import("yolodb").YoloDbTable<{
43
43
  power: number;
44
44
  accuracy: number;
45
45
  pp: number;
46
- category: "special" | "physical" | "status";
46
+ category: "physical" | "special" | "status";
47
47
  priority: number;
48
48
  isZ: boolean;
49
49
  isGmax: boolean;
@@ -102,10 +102,10 @@ export declare const colorsFs: import("yolodb").YoloDbTable<{
102
102
  color: string;
103
103
  }>;
104
104
  export declare const languagesFs: import("yolodb").YoloDbTable<{
105
- id: "esla" | "chs" | "cht" | "en" | "es" | "fr" | "de" | "it" | "ja" | "ko" | "pt";
105
+ id: "en" | "es" | "esla" | "fr" | "de" | "it" | "ja" | "ko" | "chs" | "cht" | "pt";
106
106
  name: string;
107
107
  nameEng: string;
108
- alpha3: "eng" | "esp" | "esla" | "fra" | "deu" | "ita" | "jap" | "kor" | "chs" | "cht" | "por";
108
+ alpha3: "esla" | "chs" | "cht" | "eng" | "esp" | "fra" | "deu" | "ita" | "jap" | "kor" | "por";
109
109
  inGameCode: "ENG" | "ES-ES" | "ES-LA" | "FRA" | "DEU" | "ITA" | "JPN" | "KOR" | "CHT" | "CHS" | "PT-BR";
110
110
  locale: string;
111
111
  flag: string;
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/lib/fs.ts"],"mappings":";wBA8DgB,eAAe;wBAIf,gBAAgB,GAAG,mBAAmB;wBAMtC,iBAAiB,WAAW,kBAAkB;qBAOjD,0BAAO;;;;;;;;;;qBAIP,8BAAW;;;;;;;;;qBAIX,8BAAW;;;;;;;;;;;qBAIX,0BAAO;;;;;;;;;;;;;;;;qBAIP,+BAAY;;;;qBAIZ,4BAAS;;;;;;;;;qBAIT,0BAAO;;;;;;;;;;;qBAIP,gCAAa;;;;qBAIb,0BAAO;;;;;;qBAIP,4BAAS;;;;;;qBAIT,kCAAe;;;;qBASf,4BAAS;;;;qBAIT,2BAAQ;;;;;qBAIR,8BAAW;;;;;;;;;;qBAIX,gCAAa;;;;;wBAIV,0BAA0B,kBAAkB,KAAK;wBAejD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OvB,mBAAmB,KAAK;wBAYxB,kBACd,iCACC,MAAM,KAAK;wBAOE,gBAAgB,KAAK;wBAOrB,oBAAoB,KAAK;wBAOzB,qBAAqB,KAAK;wBAI1B,gBAAgB,KAAK;wBAIrB,oBAAoB,KAAK;wBAIzB,oBAAoB,KAAK;wBAIzB,gBAAgB,KAAK;wBAIrB,kBAAkB,KAAK;wBAIvB,gBAAgB,KAAK;wBAIrB,sBAAsB,KAAK;wBAI3B,gBAAgB,KAAK;wBAIrB,kBAAkB,KAAK;wBAIvB,wBAAwB,KAAK;wBAI7B,kBAAkB,KAAK;wBAIvB,iBAAiB,KAAK;wBAItB,oBAAoB,KAAK;wBAIzB,sBAAsB,KAAK"}
package/build/lib/fs.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { t as arrayUnique } from "../utils-internal-Czgdbnkv.mjs";
2
- import fs from "node:fs";
3
- import path from "node:path";
1
+ import { t as arrayUnique } from "../utils-internal-DPjO9kQX.mjs";
2
+ import fs, { existsSync, readFileSync } from "node:fs";
3
+ import path, { dirname, join, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { yolodb } from "yolodb";
6
6
  //#region src/utils/memory-cache.ts
@@ -53,33 +53,25 @@ var MemoryCache = class {
53
53
  }
54
54
  };
55
55
  //#endregion
56
+ //#region src/utils/dataset-directory.ts
57
+ function resolveDatasetDirectory(moduleUrl, configuredDirectory, cwd = process.cwd()) {
58
+ if (configuredDirectory) return validateDirectory(resolve(cwd, configuredDirectory));
59
+ let directory = dirname(fileURLToPath(moduleUrl));
60
+ while (true) {
61
+ const manifest = join(directory, "package.json");
62
+ if (existsSync(manifest) && JSON.parse(readFileSync(manifest, "utf8")).name === "@pokepc/dataset") return validateDirectory(join(directory, "data"));
63
+ const parent = dirname(directory);
64
+ if (parent === directory) throw new Error("Could not locate the @pokepc/dataset package. Set POKEPC_DATASET_DIR.");
65
+ directory = parent;
66
+ }
67
+ }
68
+ function validateDirectory(directory) {
69
+ if (!existsSync(join(directory, "types.json"))) throw new Error(`Dataset directory is missing types.json: ${directory}`);
70
+ return directory;
71
+ }
72
+ //#endregion
56
73
  //#region src/lib/fs.ts
57
- const DATASET_PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
58
- const MONOREPO_ROOT = path.resolve(DATASET_PACKAGE_ROOT, "..", "..");
59
- function uniquePaths(paths) {
60
- return Array.from(new Set(paths));
61
- }
62
- function resolveDatasetDirCandidates(value) {
63
- if (!value) return uniquePaths([
64
- path.join(DATASET_PACKAGE_ROOT, "data"),
65
- path.join(process.cwd(), "data"),
66
- path.join(MONOREPO_ROOT, "packages/dataset/data")
67
- ]);
68
- if (path.isAbsolute(value)) return [value];
69
- return uniquePaths([
70
- path.resolve(process.cwd(), value),
71
- path.resolve(MONOREPO_ROOT, value),
72
- path.resolve(DATASET_PACKAGE_ROOT, value)
73
- ]);
74
- }
75
- const DATASET_DIR_CANDIDATES = [...resolveDatasetDirCandidates(process.env.POKEPC_DATASET_DIR)];
76
- const RESOLVED_DATASET_DIR = DATASET_DIR_CANDIDATES.find((candidate) => fs.existsSync(path.join(candidate, "types.json")));
77
- if (!RESOLVED_DATASET_DIR) {
78
- const errMsg = "Could not find dataset directory. Set POKEPC_DATASET_DIR and try again. Tried: " + DATASET_DIR_CANDIDATES.join(", ");
79
- console.error(errMsg);
80
- throw new Error(errMsg);
81
- }
82
- const DATASET_DIR = RESOLVED_DATASET_DIR;
74
+ const DATASET_DIR = resolveDatasetDirectory(import.meta.url, process.env.POKEPC_DATASET_DIR);
83
75
  console.debug("Resolved POKEPC dataset directory:", DATASET_DIR);
84
76
  const DEFAULT_CACHE_TTL = 1e4;
85
77
  const memoryCache = new MemoryCache(DEFAULT_CACHE_TTL);
@@ -1 +1 @@
1
- {"version":3,"file":"fs.mjs","names":[],"sources":["../../src/utils/memory-cache.ts","../../src/lib/fs.ts"],"sourcesContent":["export class MemoryCache {\n defaultTTL: number = 1000 * 60\n\n constructor(defaultTTL: number = 1000 * 10) {\n this.defaultTTL = defaultTTL\n }\n\n #cache: Map<string, { exptime: number; value: any }> = new Map()\n\n get<T>(key: string): T | undefined {\n const value = this.#cache.get(key)\n if (!value) {\n return undefined\n }\n if (value.exptime > Date.now() || value.exptime === 0) {\n return value.value\n }\n this.#cache.delete(key)\n return undefined\n }\n\n set(key: string, value: any, ttl: number = this.defaultTTL) {\n this.#cache.set(key, { exptime: ttl === 0 ? 0 : Date.now() + ttl, value })\n }\n\n delete(key: string) {\n this.#cache.delete(key)\n }\n\n has(key: string) {\n const value = this.#cache.get(key)\n return Boolean(value && (value.exptime > Date.now() || value.exptime === 0))\n }\n\n clear() {\n this.#cache.clear()\n }\n\n keys() {\n return Array.from(this.#cache.keys())\n }\n\n values() {\n return Array.from(this.#cache.values()).map((value) => value.value)\n }\n\n entries() {\n return Array.from(this.#cache.entries()).map(([key, value]) => [key, value.value])\n }\n\n size() {\n return this.#cache.size\n }\n\n cached<T>(key: string, fn: () => T, ttl: number = this.defaultTTL): T {\n const value = this.get<T>(key)\n if (value) {\n return value\n }\n const result = fn()\n this.set(key, result, ttl)\n return result\n }\n}\n","import { MemoryCache } from '../utils/memory-cache'\nimport { arrayUnique } from '../utils/utils-internal'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { yolodb } from 'yolodb'\n\nconst DATASET_PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')\nconst MONOREPO_ROOT = path.resolve(DATASET_PACKAGE_ROOT, '..', '..')\n\nfunction uniquePaths(paths: string[]) {\n return Array.from(new Set(paths))\n}\n\nfunction resolveDatasetDirCandidates(value: string | undefined) {\n if (!value) {\n return uniquePaths([\n path.join(DATASET_PACKAGE_ROOT, 'data'),\n path.join(process.cwd(), 'data'),\n path.join(MONOREPO_ROOT, 'packages/dataset/data'),\n ])\n }\n\n if (path.isAbsolute(value)) {\n return [value]\n }\n\n return uniquePaths([\n path.resolve(process.cwd(), value),\n path.resolve(MONOREPO_ROOT, value),\n path.resolve(DATASET_PACKAGE_ROOT, value),\n ])\n}\n\nconst DATASET_DIR_CANDIDATES = [...resolveDatasetDirCandidates(process.env.POKEPC_DATASET_DIR)]\nconst RESOLVED_DATASET_DIR = DATASET_DIR_CANDIDATES.find((candidate) =>\n fs.existsSync(path.join(candidate, 'types.json')),\n)\n\nif (!RESOLVED_DATASET_DIR) {\n const errMsg =\n 'Could not find dataset directory. Set POKEPC_DATASET_DIR and try again. Tried: ' +\n DATASET_DIR_CANDIDATES.join(', ')\n console.error(errMsg)\n throw new Error(errMsg)\n}\n\nconst DATASET_DIR = RESOLVED_DATASET_DIR\n\nconsole.debug('Resolved POKEPC dataset directory:', DATASET_DIR)\n\nconst DEFAULT_CACHE_TTL = 1000 * 10 // 10 seconds\nconst memoryCache = new MemoryCache(DEFAULT_CACHE_TTL)\nconst MEMORY_CACHE_DISABLED = process.env.POKEPC_DISABLE_MEMORY_CACHE === '1'\n\nfunction cached<T>(key: string, fn: () => T, ttl: number = DEFAULT_CACHE_TTL): T {\n if (MEMORY_CACHE_DISABLED) {\n return fn()\n }\n return memoryCache.cached(key, fn, ttl)\n}\n\nexport function absDatasetFile(fileName: string) {\n return path.join(DATASET_DIR, fileName)\n}\n\nexport function readDatasetFile<T>(filePath: string): T {\n const absFilePath = absDatasetFile(filePath)\n const data = fs.readFileSync(absFilePath, 'utf8')\n return JSON.parse(data)\n}\n\nexport function writeDatasetFile(data: any, filePath: string, minified: boolean = false) {\n const absFilePath = absDatasetFile(filePath)\n let jsonData = typeof data === 'string' ? data : JSON.stringify(data, null, minified ? 0 : 2)\n fs.mkdirSync(path.dirname(absFilePath), { recursive: true })\n fs.writeFileSync(absFilePath, jsonData)\n}\n\nexport const itemsFs = yolodb<Pkds.Item>(absDatasetFile('items.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const pokeballsFs = yolodb<Pkds.Pokeball>(absDatasetFile('pokeballs.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const abilitiesFs = yolodb<Pkds.Ability>(absDatasetFile('abilities.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const movesFs = yolodb<Pkds.Move>(absDatasetFile('moves.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const charactersFs = yolodb<Pkds.Character>(absDatasetFile('characters.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const ribbonsFs = yolodb<Pkds.Ribbon>(absDatasetFile('ribbons.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const marksFs = yolodb<Pkds.Mark>(absDatasetFile('marks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const originMarksFs = yolodb<Pkds.OriginMark>(absDatasetFile('originmarks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const typesFs = yolodb<Pkds.Type>(absDatasetFile('types.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const naturesFs = yolodb<Pkds.Nature>(absDatasetFile('natures.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const personalitiesFs = yolodb<Pkds.Personality>(\n absDatasetFile('personalities.json'),\n 'id',\n [],\n {\n superjsonEnabled: false,\n },\n)\n\nexport const regionsFs = yolodb<Pkds.Region>(absDatasetFile('regions.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const colorsFs = yolodb<Pkds.Color>(absDatasetFile('colors.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const languagesFs = yolodb<Pkds.Language>(absDatasetFile('languages.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const generationsFs = yolodb<Pkds.Generation>(absDatasetFile('generations.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport function joinPokemonFilesFromIndex(index: string[]): Pkds.Pokemon[] {\n const pokemon: Pkds.Pokemon[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokemon/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokemon ${item} not found at ${filePath}`)\n }\n const pkm = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokemonSchema.parse(pkm)\n pokemon.push(pkm)\n }\n\n return pokemon\n}\n\nexport function joinGamesFilesFromIndex(index: string[]): Pkds.Game[] {\n const games: Pkds.Game[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`games/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Game ${item} not found at ${filePath}`)\n }\n const game = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = gameSchema.parse(game)\n games.push(game)\n }\n\n return games\n}\n\nexport function joinPokedexesFilesFromIndex(index: string[]): Pkds.Pokedex[] {\n const pokedexes: Pkds.Pokedex[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokedexes/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokedex ${item} not found at ${filePath}`)\n }\n const pokedex = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokedexSchema.parse(pokedex)\n pokedexes.push(pokedex)\n }\n\n return pokedexes\n}\n\nexport function joinBoxPresetFilesFromIndex(\n index: string[],\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n const boxPresetGroups: Array<Pkds.LegacyBoxPresetByGameset> = []\n for (const item of index) {\n const filePath = absDatasetFile(`boxpresets/${variant}/${item}.json`)\n if (!fs.existsSync(filePath)) {\n console.error(`Box preset ${item} not found at ${filePath}`)\n continue\n }\n const boxPresets = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = legacyBoxPresetSchema.parse(boxPreset)\n boxPresetGroups.push({ gameset: item, presets: Object.values(boxPresets) })\n }\n\n return boxPresetGroups\n}\n\nexport function readIndexFile(indexName: 'pokemon' | 'games' | 'pokedexes'): string[] {\n const indexFilePath = absDatasetFile(`indices/${indexName}.json`)\n if (!fs.existsSync(indexFilePath)) {\n throw new Error(`Index file ${indexName} not found at ${indexFilePath}`)\n }\n return JSON.parse(fs.readFileSync(indexFilePath, 'utf8'))\n}\n\nexport function regeneratePokemonIndexFile(): string[] {\n const allPokemon = loadAllPokemon()\n const index = allPokemon.flatMap((pkm) => [pkm.id, ...pkm.forms.map((form) => form)])\n writeDatasetFile(arrayUnique(index), 'indices/pokemon.json', false)\n return index\n}\n\nexport function loadAllPokemon(): Pkds.Pokemon[] {\n return cached('allPokemon', () => {\n const index = readIndexFile('pokemon')\n return joinPokemonFilesFromIndex(index)\n })\n}\n\nexport function loadAllGameSets(): Pkds.Game[] {\n return loadAllGames().filter((game) => {\n if (game.type === 'set') {\n return true\n }\n if (game.type === 'game' && !game.gameSet) {\n return true\n }\n return false\n })\n}\n\nexport function loadAllBoxPresets(\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n return cached(`allBoxPresets-${variant}`, () => {\n const filenames = loadAllGameSets().map((game) => game.id)\n return joinBoxPresetFilesFromIndex(filenames, variant)\n })\n}\n\nexport function loadAllGames(): Pkds.Game[] {\n return cached('allGames', () => {\n const index = readIndexFile('games')\n return joinGamesFilesFromIndex(index)\n })\n}\n\nexport function loadAllPokedexes(): Pkds.Pokedex[] {\n return cached('allPokedexes', () => {\n const index = readIndexFile('pokedexes')\n return joinPokedexesFilesFromIndex(index)\n })\n}\n\nexport function loadAllCharacters(): Pkds.Character[] {\n return charactersFs.all()\n}\n\nexport function loadAllItems(): Pkds.Item[] {\n return itemsFs.all()\n}\n\nexport function loadAllPokeballs(): Pkds.Pokeball[] {\n return pokeballsFs.all()\n}\n\nexport function loadAllAbilities(): Pkds.Ability[] {\n return abilitiesFs.all()\n}\n\nexport function loadAllMoves(): Pkds.Move[] {\n return movesFs.all()\n}\n\nexport function loadAllRibbons(): Pkds.Ribbon[] {\n return ribbonsFs.all()\n}\n\nexport function loadAllMarks(): Pkds.Mark[] {\n return marksFs.all()\n}\n\nexport function loadAllOriginMarks(): Pkds.OriginMark[] {\n return originMarksFs.all()\n}\n\nexport function loadAllTypes(): Pkds.Type[] {\n return typesFs.all()\n}\n\nexport function loadAllNatures(): Pkds.Nature[] {\n return naturesFs.all()\n}\n\nexport function loadAllPersonalities(): Pkds.Personality[] {\n return personalitiesFs.all()\n}\n\nexport function loadAllRegions(): Pkds.Region[] {\n return regionsFs.all()\n}\n\nexport function loadAllColors(): Pkds.Color[] {\n return colorsFs.all()\n}\n\nexport function loadAllLanguages(): Pkds.Language[] {\n return languagesFs.all()\n}\n\nexport function loadAllGenerations(): Pkds.Generation[] {\n return generationsFs.all()\n}\n"],"mappings":";;;;;;AAAA,IAAa,cAAb,MAAyB;CACvB,aAAqB;CAErB,YAAY,aAAqB,KAAW;EAC1C,KAAK,aAAa;CACpB;CAEA,yBAAuD,IAAI,IAAI;CAE/D,IAAO,KAA4B;EACjC,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;EACjC,IAAI,CAAC,OACH;EAEF,IAAI,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,YAAY,GAClD,OAAO,MAAM;EAEf,KAAK,OAAO,OAAO,GAAG;CAExB;CAEA,IAAI,KAAa,OAAY,MAAc,KAAK,YAAY;EAC1D,KAAK,OAAO,IAAI,KAAK;GAAE,SAAS,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI;GAAK;EAAM,CAAC;CAC3E;CAEA,OAAO,KAAa;EAClB,KAAK,OAAO,OAAO,GAAG;CACxB;CAEA,IAAI,KAAa;EACf,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;EACjC,OAAO,QAAQ,UAAU,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,YAAY,EAAE;CAC7E;CAEA,QAAQ;EACN,KAAK,OAAO,MAAM;CACpB;CAEA,OAAO;EACL,OAAO,MAAM,KAAK,KAAK,OAAO,KAAK,CAAC;CACtC;CAEA,SAAS;EACP,OAAO,MAAM,KAAK,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,MAAM,KAAK;CACpE;CAEA,UAAU;EACR,OAAO,MAAM,KAAK,KAAK,OAAO,QAA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Ac,IAAI;AAC3B;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,uBAA2C;CACzD,OAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,gBAA8B;CAC5C,OAAO,SAAS,IAAI;AACtB;AAEA,SAAgB,mBAAoC;CAClD,OAAO,YAAY,IAAI;AACzB;AAEA,SAAgB,qBAAwC;CACtD,OAAO,cAAc,IAAI;AAC3B"}
1
+ {"version":3,"file":"fs.mjs","names":[],"sources":["../../src/utils/memory-cache.ts","../../src/utils/dataset-directory.ts","../../src/lib/fs.ts"],"sourcesContent":["export class MemoryCache {\n defaultTTL: number = 1000 * 60\n\n constructor(defaultTTL: number = 1000 * 10) {\n this.defaultTTL = defaultTTL\n }\n\n #cache: Map<string, { exptime: number; value: any }> = new Map()\n\n get<T>(key: string): T | undefined {\n const value = this.#cache.get(key)\n if (!value) {\n return undefined\n }\n if (value.exptime > Date.now() || value.exptime === 0) {\n return value.value\n }\n this.#cache.delete(key)\n return undefined\n }\n\n set(key: string, value: any, ttl: number = this.defaultTTL) {\n this.#cache.set(key, { exptime: ttl === 0 ? 0 : Date.now() + ttl, value })\n }\n\n delete(key: string) {\n this.#cache.delete(key)\n }\n\n has(key: string) {\n const value = this.#cache.get(key)\n return Boolean(value && (value.exptime > Date.now() || value.exptime === 0))\n }\n\n clear() {\n this.#cache.clear()\n }\n\n keys() {\n return Array.from(this.#cache.keys())\n }\n\n values() {\n return Array.from(this.#cache.values()).map((value) => value.value)\n }\n\n entries() {\n return Array.from(this.#cache.entries()).map(([key, value]) => [key, value.value])\n }\n\n size() {\n return this.#cache.size\n }\n\n cached<T>(key: string, fn: () => T, ttl: number = this.defaultTTL): T {\n const value = this.get<T>(key)\n if (value) {\n return value\n }\n const result = fn()\n this.set(key, result, ttl)\n return result\n }\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nexport function resolveDatasetDirectory(\n moduleUrl: string,\n configuredDirectory?: string,\n cwd = process.cwd(),\n): string {\n if (configuredDirectory) {\n return validateDirectory(resolve(cwd, configuredDirectory))\n }\n\n let directory = dirname(fileURLToPath(moduleUrl))\n while (true) {\n const manifest = join(directory, 'package.json')\n if (\n existsSync(manifest) &&\n JSON.parse(readFileSync(manifest, 'utf8')).name === '@pokepc/dataset'\n ) {\n return validateDirectory(join(directory, 'data'))\n }\n const parent = dirname(directory)\n if (parent === directory) {\n throw new Error('Could not locate the @pokepc/dataset package. Set POKEPC_DATASET_DIR.')\n }\n directory = parent\n }\n}\n\nfunction validateDirectory(directory: string): string {\n if (!existsSync(join(directory, 'types.json'))) {\n throw new Error(`Dataset directory is missing types.json: ${directory}`)\n }\n return directory\n}\n","import { MemoryCache } from '../utils/memory-cache'\nimport { resolveDatasetDirectory } from '../utils/dataset-directory'\nimport { arrayUnique } from '../utils/utils-internal'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { yolodb } from 'yolodb'\n\nconst DATASET_DIR = resolveDatasetDirectory(import.meta.url, process.env.POKEPC_DATASET_DIR)\n\nconsole.debug('Resolved POKEPC dataset directory:', DATASET_DIR)\n\nconst DEFAULT_CACHE_TTL = 1000 * 10 // 10 seconds\nconst memoryCache = new MemoryCache(DEFAULT_CACHE_TTL)\nconst MEMORY_CACHE_DISABLED = process.env.POKEPC_DISABLE_MEMORY_CACHE === '1'\n\nfunction cached<T>(key: string, fn: () => T, ttl: number = DEFAULT_CACHE_TTL): T {\n if (MEMORY_CACHE_DISABLED) {\n return fn()\n }\n return memoryCache.cached(key, fn, ttl)\n}\n\nexport function absDatasetFile(fileName: string) {\n return path.join(DATASET_DIR, fileName)\n}\n\nexport function readDatasetFile<T>(filePath: string): T {\n const absFilePath = absDatasetFile(filePath)\n const data = fs.readFileSync(absFilePath, 'utf8')\n return JSON.parse(data)\n}\n\nexport function writeDatasetFile(data: any, filePath: string, minified: boolean = false) {\n const absFilePath = absDatasetFile(filePath)\n let jsonData = typeof data === 'string' ? data : JSON.stringify(data, null, minified ? 0 : 2)\n fs.mkdirSync(path.dirname(absFilePath), { recursive: true })\n fs.writeFileSync(absFilePath, jsonData)\n}\n\nexport const itemsFs = yolodb<Pkds.Item>(absDatasetFile('items.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const pokeballsFs = yolodb<Pkds.Pokeball>(absDatasetFile('pokeballs.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const abilitiesFs = yolodb<Pkds.Ability>(absDatasetFile('abilities.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const movesFs = yolodb<Pkds.Move>(absDatasetFile('moves.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const charactersFs = yolodb<Pkds.Character>(absDatasetFile('characters.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const ribbonsFs = yolodb<Pkds.Ribbon>(absDatasetFile('ribbons.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const marksFs = yolodb<Pkds.Mark>(absDatasetFile('marks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const originMarksFs = yolodb<Pkds.OriginMark>(absDatasetFile('originmarks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const typesFs = yolodb<Pkds.Type>(absDatasetFile('types.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const naturesFs = yolodb<Pkds.Nature>(absDatasetFile('natures.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const personalitiesFs = yolodb<Pkds.Personality>(\n absDatasetFile('personalities.json'),\n 'id',\n [],\n {\n superjsonEnabled: false,\n },\n)\n\nexport const regionsFs = yolodb<Pkds.Region>(absDatasetFile('regions.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const colorsFs = yolodb<Pkds.Color>(absDatasetFile('colors.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const languagesFs = yolodb<Pkds.Language>(absDatasetFile('languages.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const generationsFs = yolodb<Pkds.Generation>(absDatasetFile('generations.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport function joinPokemonFilesFromIndex(index: string[]): Pkds.Pokemon[] {\n const pokemon: Pkds.Pokemon[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokemon/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokemon ${item} not found at ${filePath}`)\n }\n const pkm = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokemonSchema.parse(pkm)\n pokemon.push(pkm)\n }\n\n return pokemon\n}\n\nexport function joinGamesFilesFromIndex(index: string[]): Pkds.Game[] {\n const games: Pkds.Game[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`games/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Game ${item} not found at ${filePath}`)\n }\n const game = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = gameSchema.parse(game)\n games.push(game)\n }\n\n return games\n}\n\nexport function joinPokedexesFilesFromIndex(index: string[]): Pkds.Pokedex[] {\n const pokedexes: Pkds.Pokedex[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokedexes/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokedex ${item} not found at ${filePath}`)\n }\n const pokedex = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokedexSchema.parse(pokedex)\n pokedexes.push(pokedex)\n }\n\n return pokedexes\n}\n\nexport function joinBoxPresetFilesFromIndex(\n index: string[],\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n const boxPresetGroups: Array<Pkds.LegacyBoxPresetByGameset> = []\n for (const item of index) {\n const filePath = absDatasetFile(`boxpresets/${variant}/${item}.json`)\n if (!fs.existsSync(filePath)) {\n console.error(`Box preset ${item} not found at ${filePath}`)\n continue\n }\n const boxPresets = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = legacyBoxPresetSchema.parse(boxPreset)\n boxPresetGroups.push({ gameset: item, presets: Object.values(boxPresets) })\n }\n\n return boxPresetGroups\n}\n\nexport function readIndexFile(indexName: 'pokemon' | 'games' | 'pokedexes'): string[] {\n const indexFilePath = absDatasetFile(`indices/${indexName}.json`)\n if (!fs.existsSync(indexFilePath)) {\n throw new Error(`Index file ${indexName} not found at ${indexFilePath}`)\n }\n return JSON.parse(fs.readFileSync(indexFilePath, 'utf8'))\n}\n\nexport function regeneratePokemonIndexFile(): string[] {\n const allPokemon = loadAllPokemon()\n const index = allPokemon.flatMap((pkm) => [pkm.id, ...pkm.forms.map((form) => form)])\n writeDatasetFile(arrayUnique(index), 'indices/pokemon.json', false)\n return index\n}\n\nexport function loadAllPokemon(): Pkds.Pokemon[] {\n return cached('allPokemon', () => {\n const index = readIndexFile('pokemon')\n return joinPokemonFilesFromIndex(index)\n })\n}\n\nexport function loadAllGameSets(): Pkds.Game[] {\n return loadAllGames().filter((game) => {\n if (game.type === 'set') {\n return true\n }\n if (game.type === 'game' && !game.gameSet) {\n return true\n }\n return false\n })\n}\n\nexport function loadAllBoxPresets(\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n return cached(`allBoxPresets-${variant}`, () => {\n const filenames = loadAllGameSets().map((game) => game.id)\n return joinBoxPresetFilesFromIndex(filenames, variant)\n })\n}\n\nexport function loadAllGames(): Pkds.Game[] {\n return cached('allGames', () => {\n const index = readIndexFile('games')\n return joinGamesFilesFromIndex(index)\n })\n}\n\nexport function loadAllPokedexes(): Pkds.Pokedex[] {\n return cached('allPokedexes', () => {\n const index = readIndexFile('pokedexes')\n return joinPokedexesFilesFromIndex(index)\n })\n}\n\nexport function loadAllCharacters(): Pkds.Character[] {\n return charactersFs.all()\n}\n\nexport function loadAllItems(): Pkds.Item[] {\n return itemsFs.all()\n}\n\nexport function loadAllPokeballs(): Pkds.Pokeball[] {\n return pokeballsFs.all()\n}\n\nexport function loadAllAbilities(): Pkds.Ability[] {\n return abilitiesFs.all()\n}\n\nexport function loadAllMoves(): Pkds.Move[] {\n return movesFs.all()\n}\n\nexport function loadAllRibbons(): Pkds.Ribbon[] {\n return ribbonsFs.all()\n}\n\nexport function loadAllMarks(): Pkds.Mark[] {\n return marksFs.all()\n}\n\nexport function loadAllOriginMarks(): Pkds.OriginMark[] {\n return originMarksFs.all()\n}\n\nexport function loadAllTypes(): Pkds.Type[] {\n return typesFs.all()\n}\n\nexport function loadAllNatures(): Pkds.Nature[] {\n return naturesFs.all()\n}\n\nexport function loadAllPersonalities(): Pkds.Personality[] {\n return personalitiesFs.all()\n}\n\nexport function loadAllRegions(): Pkds.Region[] {\n return regionsFs.all()\n}\n\nexport function loadAllColors(): Pkds.Color[] {\n return colorsFs.all()\n}\n\nexport function loadAllLanguages(): Pkds.Language[] {\n return languagesFs.all()\n}\n\nexport function loadAllGenerations(): Pkds.Generation[] {\n return generationsFs.all()\n}\n"],"mappings":";;;;;;AAAA,IAAa,cAAb,MAAyB;CACvB,aAAqB;CAErB,YAAY,aAAqB,KAAW;EAC1C,KAAK,aAAa;CACpB;CAEA,yBAAuD,IAAI,IAAI;CAE/D,IAAO,KAA4B;EACjC,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;EACjC,IAAI,CAAC,OACH;EAEF,IAAI,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,YAAY,GAClD,OAAO,MAAM;EAEf,KAAK,OAAO,OAAO,GAAG;CAExB;CAEA,IAAI,KAAa,OAAY,MAAc,KAAK,YAAY;EAC1D,KAAK,OAAO,IAAI,KAAK;GAAE,SAAS,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI;GAAK;EAAM,CAAC;CAC3E;CAEA,OAAO,KAAa;EAClB,KAAK,OAAO,OAAO,GAAG;CACxB;CAEA,IAAI,K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9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,qBAAwC;CACtD,OAAO,cAAc,IAAI;AAC3B;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,uBAA2C;CACzD,OAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,gBAA8B;CAC5C,OAAO,SAAS,IAAI;AACtB;AAEA,SAAgB,mBAAoC;CAClD,OAAO,YAAY,IAAI;AACzB;AAEA,SAAgB,qBAAwC;CACtD,OAAO,cAAc,IAAI;AAC3B"}
@@ -1,2 +1,2 @@
1
- import { A as pokemonSchema, C as onlineFeaturesSchema, D as pokedexEntrySchema, E as pokeballSchema, M as regionSchema, N as ribbonSchema, O as pokedexSchema, P as typeSchema, S as natureSchema, T as personalitySchema, _ as modernBoxPresetIndexSchema, a as boxPresetMapSchema, b as modernBoxPresetTags, c as colorSchema, d as generationSchema, f as i18nTextSchema, g as modernBoxPresetBoxSchema, h as markSchema, i as boxPresetIndexItemSchema, j as pokemonSearchFilterSchema, k as pokemonRefsSchema, l as gameFeaturesSchema, m as languageSchema, n as boxPresetBoxPokemonSchema, o as boxPresetSchema, p as itemSchema, r as boxPresetBoxSchema, s as characterSchema, t as abilitySchema, u as gameSchema, v as modernBoxPresetSchema, w as originMarkSchema, x as moveSchema, y as modernBoxPresetSlotSchema } from "../schemas-DZQWOWP4.mjs";
1
+ import { A as pokemonSchema, C as onlineFeaturesSchema, D as pokedexEntrySchema, E as pokeballSchema, M as regionSchema, N as ribbonSchema, O as pokedexSchema, P as typeSchema, S as natureSchema, T as personalitySchema, _ as modernBoxPresetIndexSchema, a as boxPresetMapSchema, b as modernBoxPresetTags, c as colorSchema, d as generationSchema, f as i18nTextSchema, g as modernBoxPresetBoxSchema, h as markSchema, i as boxPresetIndexItemSchema, j as pokemonSearchFilterSchema, k as pokemonRefsSchema, l as gameFeaturesSchema, m as languageSchema, n as boxPresetBoxPokemonSchema, o as boxPresetSchema, p as itemSchema, r as boxPresetBoxSchema, s as characterSchema, t as abilitySchema, u as gameSchema, v as modernBoxPresetSchema, w as originMarkSchema, x as moveSchema, y as modernBoxPresetSlotSchema } from "../schemas-CIE3b72j.mjs";
2
2
  export { abilitySchema, boxPresetBoxPokemonSchema, boxPresetBoxSchema, boxPresetIndexItemSchema, boxPresetMapSchema, boxPresetSchema, characterSchema, colorSchema, gameFeaturesSchema, gameSchema, generationSchema, i18nTextSchema, itemSchema, languageSchema, markSchema, modernBoxPresetBoxSchema, modernBoxPresetIndexSchema, modernBoxPresetSchema, modernBoxPresetSlotSchema, modernBoxPresetTags, moveSchema, natureSchema, onlineFeaturesSchema, originMarkSchema, personalitySchema, pokeballSchema, pokedexEntrySchema, pokedexSchema, pokemonRefsSchema, pokemonSchema, pokemonSearchFilterSchema, regionSchema, ribbonSchema, typeSchema };
@@ -1,5 +1,7 @@
1
+ import { n as sanitizeSearchQuery, t as matchesSearchQuery } from "../utils-internal-C-UStMrZ.mjs";
1
2
  //#region src/lib/search.d.ts
2
3
  export declare function searchPokemon(pokemon: Array<Pkds.TranslatedPokemon>, filters: Partial<Pkds.PokemonSearchFilter>, requiresSearchString?: boolean): Pkds.PokemonSearchResults;
3
4
  export declare function createSearchablePokemonList(pokemon: Array<Pkds.Pokemon>): Array<Pkds.TranslatedPokemon>;
4
5
  //#endregion
6
+ export { matchesSearchQuery, sanitizeSearchQuery };
5
7
  //# sourceMappingURL=search.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.mts","names":[],"sources":["../../src/lib/search.ts"],"mappings":";wBAKgB,cACd,SAAS,MAAM,KAAK,oBACpB,SAAS,QAAQ,KAAK,sBACtB,iCACC,KAAK;wBA8BQ,4BACd,SAAS,MAAM,KAAK,WACnB,MAAM,KAAK"}
1
+ {"version":3,"file":"search.d.mts","names":[],"sources":["../../src/lib/search.ts"],"mappings":";;wBAMgB,cACd,SAAS,MAAM,KAAK,oBACpB,SAAS,QAAQ,KAAK,sBACtB,iCACC,KAAK;wBA8BQ,4BACd,SAAS,MAAM,KAAK,WACnB,MAAM,KAAK"}
@@ -1,5 +1,5 @@
1
- import { i as sanitizeSearchQuery, r as matchesSearchQuery } from "../utils-internal-Czgdbnkv.mjs";
2
- import { o as generatePokemonSearchableText, r as formatDexNum, t as dexNumToGen } from "../utils-BwovRocd.mjs";
1
+ import { i as sanitizeSearchQuery, r as matchesSearchQuery } from "../utils-internal-DPjO9kQX.mjs";
2
+ import { o as generatePokemonSearchableText, r as formatDexNum, t as dexNumToGen } from "../utils-BTjKkD-_.mjs";
3
3
  //#region src/lib/search.ts
4
4
  const MIN_SEARCH_LENGTH = 2;
5
5
  function searchPokemon(pokemon, filters, requiresSearchString = true) {
@@ -40,6 +40,6 @@ function createSearchablePokemonList(pokemon) {
40
40
  }));
41
41
  }
42
42
  //#endregion
43
- export { createSearchablePokemonList, searchPokemon };
43
+ export { createSearchablePokemonList, matchesSearchQuery, sanitizeSearchQuery, searchPokemon };
44
44
 
45
45
  //# sourceMappingURL=search.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.mjs","names":[],"sources":["../../src/lib/search.ts"],"sourcesContent":["import { dexNumToGen, formatDexNum, generatePokemonSearchableText } from './utils'\nimport { matchesSearchQuery, sanitizeSearchQuery } from '../utils/utils-internal'\n\nconst MIN_SEARCH_LENGTH = 2\n\nexport function searchPokemon(\n pokemon: Array<Pkds.TranslatedPokemon>,\n filters: Partial<Pkds.PokemonSearchFilter>,\n requiresSearchString: boolean = true,\n): Pkds.PokemonSearchResults {\n const searchQuery = sanitizeSearchQuery(filters.q ?? '')\n\n if (requiresSearchString && searchQuery.length < MIN_SEARCH_LENGTH) {\n return {\n pokemon: pokemon,\n meta: { total: pokemon.length, skipped: true },\n }\n }\n\n const filteredPokes = pokemon.filter((p) => {\n // const filterGen = filter.q ? 0 : (filter.gen ?? 0)\n const filterGen = filters.gen ?? 0\n\n if (!filters.forms && p.isForm) return false\n if (filters.color && p.color.toLowerCase() !== filters.color.toLowerCase()) return false\n if (filters.type && ![p.type1, p.type2].filter(Boolean).includes(filters.type)) return false\n if (filterGen > 0 && p.speciesGen !== filters.gen) return false\n\n if (filters.q && !matchesSearchQuery(p.searchableText, filters.q)) return false\n\n return true\n })\n\n return {\n pokemon: filteredPokes,\n meta: { total: pokemon.length, skipped: false },\n }\n}\n\nexport function createSearchablePokemonList(\n pokemon: Array<Pkds.Pokemon>,\n): Array<Pkds.TranslatedPokemon> {\n return pokemon.map((pokemon: Pkds.Pokemon): Pkds.TranslatedPokemon => ({\n ...pokemon,\n speciesGen: dexNumToGen(pokemon.dexNum),\n dexNum: formatDexNum(pokemon.dexNum),\n name: pokemon.names['eng'] ?? '',\n speciesName: pokemon.speciesNames?.['eng'],\n formName: pokemon.formNames?.['eng'],\n lang: 'eng',\n searchableText: generatePokemonSearchableText(pokemon),\n }))\n}\n"],"mappings":";;;AAGA,MAAM,oBAAoB;AAE1B,SAAgB,cACd,SACA,SACA,uBAAgC,MACL;CAC3B,MAAM,cAAc,oBAAoB,QAAQ,KAAK,EAAE;CAEvD,IAAI,wBAAwB,YAAY,SAAS,mBAC/C,OAAO;EACI;EACT,MAAM;GAAE,OAAO,QAAQ;GAAQ,SAAS;EAAK;CAC/C;CAiBF,OAAO;EACL,SAfoB,QAAQ,QAAQ,MAAM;GAE1C,MAAM,YAAY,QAAQ,OAAO;GAEjC,IAAI,CAAC,QAAQ,SAAS,EAAE,QAAQ,OAAO;GACvC,IAAI,QAAQ,SAAS,EAAE,MAAM,YAAY,MAAM,QAAQ,MAAM,YAAY,GAAG,OAAO;GACnF,IAAI,QAAQ,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,SAAS,QAAQ,IAAI,GAAG,OAAO;GACvF,IAAI,YAAY,KAAK,EAAE,eAAe,QAAQ,KAAK,OAAO;GAE1D,IAAI,QAAQ,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,QAAQ,CAAC,GAAG,OAAO;GAE1E,OAAO;EACT,CAGuB;EACrB,MAAM;GAAE,OAAO,QAAQ;GAAQ,SAAS;EAAM;CAChD;AACF;AAEA,SAAgB,4BACd,SAC+B;CAC/B,OAAO,QAAQ,KAAK,aAAmD;EACrE,GAAG;EACH,YAAY,YAAY,QAAQ,MAAM;EACtC,QAAQ,aAAa,QAAQ,MAAM;EACnC,MAAM,QAAQ,MAAM,UAAU;EAC9B,aAAa,QAAQ,eAAe;EACpC,UAAU,QAAQ,YAAY;EAC9B,MAAM;EACN,gBAAgB,8BAA8B,OAAO;CACvD,EAAE;AACJ"}
1
+ {"version":3,"file":"search.mjs","names":[],"sources":["../../src/lib/search.ts"],"sourcesContent":["import { dexNumToGen, formatDexNum, generatePokemonSearchableText } from './utils'\nimport { matchesSearchQuery, sanitizeSearchQuery } from '../utils/utils-internal'\nexport { matchesSearchQuery, sanitizeSearchQuery } from '../utils/utils-internal'\n\nconst MIN_SEARCH_LENGTH = 2\n\nexport function searchPokemon(\n pokemon: Array<Pkds.TranslatedPokemon>,\n filters: Partial<Pkds.PokemonSearchFilter>,\n requiresSearchString: boolean = true,\n): Pkds.PokemonSearchResults {\n const searchQuery = sanitizeSearchQuery(filters.q ?? '')\n\n if (requiresSearchString && searchQuery.length < MIN_SEARCH_LENGTH) {\n return {\n pokemon: pokemon,\n meta: { total: pokemon.length, skipped: true },\n }\n }\n\n const filteredPokes = pokemon.filter((p) => {\n // const filterGen = filter.q ? 0 : (filter.gen ?? 0)\n const filterGen = filters.gen ?? 0\n\n if (!filters.forms && p.isForm) return false\n if (filters.color && p.color.toLowerCase() !== filters.color.toLowerCase()) return false\n if (filters.type && ![p.type1, p.type2].filter(Boolean).includes(filters.type)) return false\n if (filterGen > 0 && p.speciesGen !== filters.gen) return false\n\n if (filters.q && !matchesSearchQuery(p.searchableText, filters.q)) return false\n\n return true\n })\n\n return {\n pokemon: filteredPokes,\n meta: { total: pokemon.length, skipped: false },\n }\n}\n\nexport function createSearchablePokemonList(\n pokemon: Array<Pkds.Pokemon>,\n): Array<Pkds.TranslatedPokemon> {\n return pokemon.map((pokemon: Pkds.Pokemon): Pkds.TranslatedPokemon => ({\n ...pokemon,\n speciesGen: dexNumToGen(pokemon.dexNum),\n dexNum: formatDexNum(pokemon.dexNum),\n name: pokemon.names['eng'] ?? '',\n speciesName: pokemon.speciesNames?.['eng'],\n formName: pokemon.formNames?.['eng'],\n lang: 'eng',\n searchableText: generatePokemonSearchableText(pokemon),\n }))\n}\n"],"mappings":";;;AAIA,MAAM,oBAAoB;AAE1B,SAAgB,cACd,SACA,SACA,uBAAgC,MACL;CAC3B,MAAM,cAAc,oBAAoB,QAAQ,KAAK,EAAE;CAEvD,IAAI,wBAAwB,YAAY,SAAS,mBAC/C,OAAO;EACI;EACT,MAAM;GAAE,OAAO,QAAQ;GAAQ,SAAS;EAAK;CAC/C;CAiBF,OAAO;EACL,SAfoB,QAAQ,QAAQ,MAAM;GAE1C,MAAM,YAAY,QAAQ,OAAO;GAEjC,IAAI,CAAC,QAAQ,SAAS,EAAE,QAAQ,OAAO;GACvC,IAAI,QAAQ,SAAS,EAAE,MAAM,YAAY,MAAM,QAAQ,MAAM,YAAY,GAAG,OAAO;GACnF,IAAI,QAAQ,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,SAAS,QAAQ,IAAI,GAAG,OAAO;GACvF,IAAI,YAAY,KAAK,EAAE,eAAe,QAAQ,KAAK,OAAO;GAE1D,IAAI,QAAQ,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,QAAQ,CAAC,GAAG,OAAO;GAE1E,OAAO;EACT,CAGuB;EACrB,MAAM;GAAE,OAAO,QAAQ;GAAQ,SAAS;EAAM;CAChD;AACF;AAEA,SAAgB,4BACd,SAC+B;CAC/B,OAAO,QAAQ,KAAK,aAAmD;EACrE,GAAG;EACH,YAAY,YAAY,QAAQ,MAAM;EACtC,QAAQ,aAAa,QAAQ,MAAM;EACnC,MAAM,QAAQ,MAAM,UAAU;EAC9B,aAAa,QAAQ,eAAe;EACpC,UAAU,QAAQ,YAAY;EAC9B,MAAM;EACN,gBAAgB,8BAA8B,OAAO;CACvD,EAAE;AACJ"}
@@ -1,5 +1,5 @@
1
1
  import { _ as statIds, a as gameType, c as ivJudgeValues, d as languageInGameCodes, f as moveCategory, g as ribbonCategory, h as raidStyles, i as gameSeries, l as languageAlpha3Codes, m as pokemonSizes, n as battleStyles, o as genders, p as pokeballCategory, r as gamePlatforms, s as itemCategory, t as abilityTagIds, u as languageIds, v as titleTypes, y as typeIds } from "../enums-CCbmORM6.mjs";
2
- import { A as pokemonSchema, C as onlineFeaturesSchema, D as pokedexEntrySchema, E as pokeballSchema, M as regionSchema, N as ribbonSchema, O as pokedexSchema, P as typeSchema, S as natureSchema, T as personalitySchema, _ as modernBoxPresetIndexSchema, b as modernBoxPresetTags, c as colorSchema, d as generationSchema, f as i18nTextSchema, g as modernBoxPresetBoxSchema, h as markSchema, j as pokemonSearchFilterSchema, k as pokemonRefsSchema, l as gameFeaturesSchema, m as languageSchema, n as boxPresetBoxPokemonSchema, o as boxPresetSchema, p as itemSchema, r as boxPresetBoxSchema, s as characterSchema, t as abilitySchema, u as gameSchema, v as modernBoxPresetSchema, w as originMarkSchema, x as moveSchema, y as modernBoxPresetSlotSchema } from "../schemas-DZQWOWP4.mjs";
2
+ import { A as pokemonSchema, C as onlineFeaturesSchema, D as pokedexEntrySchema, E as pokeballSchema, M as regionSchema, N as ribbonSchema, O as pokedexSchema, P as typeSchema, S as natureSchema, T as personalitySchema, _ as modernBoxPresetIndexSchema, b as modernBoxPresetTags, c as colorSchema, d as generationSchema, f as i18nTextSchema, g as modernBoxPresetBoxSchema, h as markSchema, j as pokemonSearchFilterSchema, k as pokemonRefsSchema, l as gameFeaturesSchema, m as languageSchema, n as boxPresetBoxPokemonSchema, o as boxPresetSchema, p as itemSchema, r as boxPresetBoxSchema, s as characterSchema, t as abilitySchema, u as gameSchema, v as modernBoxPresetSchema, w as originMarkSchema, x as moveSchema, y as modernBoxPresetSlotSchema } from "../schemas-CIE3b72j.mjs";
3
3
  import z from "zod";
4
4
  //#region src/lib/types.d.ts
5
5
  declare global {
@@ -1,3 +1,4 @@
1
+ import { r as sortStringsInGivenOrder } from "../utils-internal-C-UStMrZ.mjs";
1
2
  //#region src/lib/utils.d.ts
2
3
  export declare function formatDexNum(num: number | string, positions?: number): string;
3
4
  export declare function dexNumToInt(num: number | string): number;
@@ -18,4 +19,5 @@ export declare function getGameCategoryLabel(game: Pkds.Game): string;
18
19
  export declare function generateGameDescription(game: Pkds.Game, gameCatText: string): string;
19
20
  export declare function resolvePokemonName(meta: Pkds.TranslatedPokemon, nickname?: string, lang3Char?: Pkds.LanguageAlpha3): Pkds.PokemonNameInfo;
20
21
  //#endregion
22
+ export { sortStringsInGivenOrder };
21
23
  //# sourceMappingURL=utils.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/lib/utils.ts"],"mappings":";wBAIgB,aAAa,sBAAsB;wBAInC,YAAY;wBAIZ,YAAY;wBAcZ,kBAAkB,UAAU,KAAK,aAC/C,aAAa,MAAM,IACnB,mBACA,sBACC,MAAM;wBAgBO,0BAA0B,MAAM,KAAK,UAAU,KAAK;wBAmBpD,iBACd,wCACA,MAAM,KAAK,SACX;EAAY;IACX,KAAK;wBA8BQ,qBACd,KAAK,KAAK,SACV,WAAW,KAAK,iBACf,KAAK;wBAeQ,iBACd,SAAS,KAAK,UAAU,KAAK,mBAC7B,MAAM,KAAK,gBACX,2BACC,KAAK;wBAoBQ,qBACd,aAAa,MAAM,KAAK,UAAU,KAAK,oBACvC,MAAM,KAAK,iBACV,MAAM,KAAK;wBAIE,q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3 @@
1
- import { a as generatePokemonDescription, c as getPokemonGender, d as resolvePokemonName, f as translatePokemon, g as translatePokemonText, h as translatePokemonList, i as generateGameDescription, l as getPossiblePokemonGenders, m as translatePokemonByNid, n as dexNumToInt, o as generatePokemonSearchableText, p as translatePokemonById, r as formatDexNum, s as getGameCategoryLabel, t as dexNumToGen, u as randomPokemonList } from "../utils-BwovRocd.mjs";
2
- export { dexNumToGen, dexNumToInt, formatDexNum, generateGameDescription, generatePokemonDescription, generatePokemonSearchableText, getGameCategoryLabel, getPokemonGender, getPossiblePokemonGenders, randomPokemonList, resolvePokemonName, translatePokemon, translatePokemonById, translatePokemonByNid, translatePokemonList, translatePokemonText };
1
+ import { a as sortStringsInGivenOrder } from "../utils-internal-DPjO9kQX.mjs";
2
+ import { a as generatePokemonDescription, c as getPokemonGender, d as resolvePokemonName, f as translatePokemon, g as translatePokemonText, h as translatePokemonList, i as generateGameDescription, l as getPossiblePokemonGenders, m as translatePokemonByNid, n as dexNumToInt, o as generatePokemonSearchableText, p as translatePokemonById, r as formatDexNum, s as getGameCategoryLabel, t as dexNumToGen, u as randomPokemonList } from "../utils-BTjKkD-_.mjs";
3
+ export { dexNumToGen, dexNumToInt, formatDexNum, generateGameDescription, generatePokemonDescription, generatePokemonSearchableText, getGameCategoryLabel, getPokemonGender, getPossiblePokemonGenders, randomPokemonList, resolvePokemonName, sortStringsInGivenOrder, translatePokemon, translatePokemonById, translatePokemonByNid, translatePokemonList, translatePokemonText };
@@ -1,7 +1,7 @@
1
1
  import { n as writeJsonDataFile } from "../fs-B5MIz_Bs.mjs";
2
2
  import { i as appLangs } from "../languages-CY-Q1SED.mjs";
3
3
  //#region src/lib-next/_build.ts
4
- await import("../build-DvGzwIK8.mjs");
4
+ await import("../build-D2oPkkzJ.mjs");
5
5
  await import("../build-bE_0_-0H.mjs");
6
6
  writeJsonDataFile("languages.json", appLangs);
7
7
  console.log(`Exported ${appLangs.length} app languages`);
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.mts","names":[],"sources":["../../src/lib-next/enums.ts"],"mappings":";qBAAa;YACD,mBAAmB;qBAElB;YACD,qBAAqB;qBAEpB;YAaD,uBAAuB;qBAEtB;qBAqBA,2BAA2B;YAoB5B,sBAAsB;qBAErB;YACD,uBAAuB;qBAEtB;YAcD,oBAAoB;qBAEnB;YAaD,qBAAqB;qBAEpB;YAQD,0BAA0B;qBAEzB;YAoED,sBAAsB;qBAErB;YAUD,uBAAuB;qBAEtB;YAcD,sBAAsB;qBAErB;YACD,2BAA2B;qBAE1B;YACD,yBAAyB;qBAExB;YACD,iBAAiB;qBAEhB;YACD,oBAAoB;qBAEnB;YACD,sBAAsB;qBAErB;YACD,iBAAiB;;;;;;;;;;qBAWhB;YACD,uBAAuB;qBAEtB;YACD,sBAAsB;qBAErB;YACD,oBAAoB"}
1
+ {"version":3,"file":"enums.d.mts","names":[],"sources":["../../src/lib-next/enums.ts"],"mappings":";qBAAa;YACD,mBAAmB;qBAElB;YACD,qBAAqB;qBAEpB;YAaD,uBAAuB;qBAEtB;qBAqBA,2BAA2B;YAoB5B,sBAAsB;qBAErB;YACD,uBAAuB;qBAEtB;YAcD,oBAAoB;qBAEnB;YAaD,qBAAqB;qBAEpB;YAQD,0BAA0B;qBAEzB;YAuED,sBAAsB;qBAErB;YAUD,uBAAuB;qBAEtB;YAcD,sBAAsB;qBAErB;YACD,2BAA2B;qBAE1B;YACD,yBAAyB;qBAExB;YACD,iBAAiB;qBAEhB;YACD,oBAAoB;qBAEnB;YACD,sBAAsB;qBAErB;YACD,iBAAiB;;;;;;;;;;qBAWhB;YACD,uBAAuB;qBAEtB;YACD,sBAAsB;qBAErB;YACD,oBAAoB"}
@@ -1,2 +1,2 @@
1
- import { _ as raidStyles, a as gameSeries, b as statusConditions, c as itemCategories, d as moveClasses, f as moveTargets, g as pokemonTypesInternalOrder, h as pokemonTypes, i as gamePlatforms, l as ivJudgeValues, m as pokemonSizes, n as battleStates, o as gameTypes, p as pokeballCategories, r as battleStyles, s as genders, t as bagCategories, u as moveCategories, v as ribbonCategories, x as titleTypes, y as statIds } from "../enums-DlMg7WLl.mjs";
1
+ import { _ as raidStyles, a as gameSeries, b as statusConditions, c as itemCategories, d as moveClasses, f as moveTargets, g as pokemonTypesInternalOrder, h as pokemonTypes, i as gamePlatforms, l as ivJudgeValues, m as pokemonSizes, n as battleStates, o as gameTypes, p as pokeballCategories, r as battleStyles, s as genders, t as bagCategories, u as moveCategories, v as ribbonCategories, x as titleTypes, y as statIds } from "../enums-u8n-nN0B.mjs";
2
2
  export { bagCategories, battleStates, battleStyles, gamePlatforms, gameSeries, gameTypes, genders, itemCategories, ivJudgeValues, moveCategories, moveClasses, moveTargets, pokeballCategories, pokemonSizes, pokemonTypes, pokemonTypesInternalOrder, raidStyles, ribbonCategories, statIds, statusConditions, titleTypes };
@@ -77,8 +77,8 @@ export declare const moveSchema: z$1.ZodObject<{
77
77
  fairy: "fairy";
78
78
  }>;
79
79
  category: z$1.ZodEnum<{
80
- special: "special";
81
80
  physical: "physical";
81
+ special: "special";
82
82
  status: "status";
83
83
  }>;
84
84
  power: z$1.ZodNumber;
@@ -144,8 +144,8 @@ export declare const movesSchema: z$1.ZodArray<z$1.ZodObject<{
144
144
  fairy: "fairy";
145
145
  }>;
146
146
  category: z$1.ZodEnum<{
147
- special: "special";
148
147
  physical: "physical";
148
+ special: "special";
149
149
  status: "status";
150
150
  }>;
151
151
  power: z$1.ZodNumber;
@@ -210,13 +210,13 @@ export declare const itemSchema: z$1.ZodObject<{
210
210
  description: z$1.ZodString;
211
211
  pluralName: z$1.ZodString;
212
212
  categories: z$1.ZodArray<z$1.ZodEnum<{
213
- defense: "defense";
214
- other: "other";
215
- berry: "berry";
216
213
  power_boost: "power_boost";
217
214
  recovery: "recovery";
215
+ defense: "defense";
218
216
  stat_boost: "stat_boost";
219
217
  effect_extend: "effect_extend";
218
+ berry: "berry";
219
+ other: "other";
220
220
  mega_stone: "mega_stone";
221
221
  }>>;
222
222
  }, z$1.core.$strip>;
@@ -230,13 +230,13 @@ export declare const itemsSchema: z$1.ZodArray<z$1.ZodObject<{
230
230
  description: z$1.ZodString;
231
231
  pluralName: z$1.ZodString;
232
232
  categories: z$1.ZodArray<z$1.ZodEnum<{
233
- defense: "defense";
234
- other: "other";
235
- berry: "berry";
236
233
  power_boost: "power_boost";
237
234
  recovery: "recovery";
235
+ defense: "defense";
238
236
  stat_boost: "stat_boost";
239
237
  effect_extend: "effect_extend";
238
+ berry: "berry";
239
+ other: "other";
240
240
  mega_stone: "mega_stone";
241
241
  }>>;
242
242
  }, z$1.core.$strip>>;
@@ -1,2 +1,2 @@
1
- import { _ as pokemonListSchema, a as battleStatesSchema, b as pokemonSchema, c as i18nSchema, d as itemSchema, f as itemsSchema, g as pokemonI18nSchema, h as pokemonI18nRecordsSchema, i as battleStateSchema, l as itemI18nRecordsSchema, m as movesSchema, n as abilitySchema, o as championsLinkedBaseSchema, p as moveSchema, r as baseSchema, s as i18nRecordsSchema, t as abilitiesSchema, u as itemI18nSchema, v as pokemonMovesRecordSchema, x as slugSchema, y as pokemonMovesSchema } from "../schemas-Bj1AIX0P.mjs";
1
+ import { _ as pokemonListSchema, a as battleStatesSchema, b as pokemonSchema, c as i18nSchema, d as itemSchema, f as itemsSchema, g as pokemonI18nSchema, h as pokemonI18nRecordsSchema, i as battleStateSchema, l as itemI18nRecordsSchema, m as movesSchema, n as abilitySchema, o as championsLinkedBaseSchema, p as moveSchema, r as baseSchema, s as i18nRecordsSchema, t as abilitiesSchema, u as itemI18nSchema, v as pokemonMovesRecordSchema, x as slugSchema, y as pokemonMovesSchema } from "../schemas-CWE4YPI2.mjs";
2
2
  export { abilitiesSchema, abilitySchema, baseSchema, battleStateSchema, battleStatesSchema, championsLinkedBaseSchema, i18nRecordsSchema, i18nSchema, itemI18nRecordsSchema, itemI18nSchema, itemSchema, itemsSchema, moveSchema, movesSchema, pokemonI18nRecordsSchema, pokemonI18nSchema, pokemonListSchema, pokemonMovesRecordSchema, pokemonMovesSchema, pokemonSchema, slugSchema };