@flesh-and-blood/search 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,9 +11,10 @@ export declare const FilterCategory: {
11
11
  readonly Artist: "artist";
12
12
  readonly Banned: "banned";
13
13
  readonly Bond: "bond";
14
- readonly Chain: "chain";
15
14
  readonly Class: "class";
16
15
  readonly Cost: "cost";
16
+ readonly CreatedBy: "createdby";
17
+ readonly Creates: "creates";
17
18
  readonly Defense: "defense";
18
19
  readonly Flow: "flow";
19
20
  readonly Foiling: "foiling";
@@ -168,8 +169,9 @@ export interface FilterToPropertyMapping extends CardPropertyMapping {
168
169
  * It is not the set of spellings the parse accepts, which is wider, since
169
170
  * the foiling, treatment, rarity, legality and meta resolvers each take
170
171
  * abbreviations of their own. A filter reading free text (`artist`, `name`,
171
- * `text`, `typetext`), a card name (`chain`, `references`, `referencedby`),
172
- * a set identifier (`print`), a date (`year`) or a number carries none.
172
+ * `text`, `typetext`), a card name or group (`creates`, `createdby`,
173
+ * `references`, `referencedby`), a set identifier (`print`), a date
174
+ * (`year`) or a number carries none.
173
175
  */
174
176
  vocabulary?: readonly string[];
175
177
  }
@@ -274,12 +276,6 @@ export declare const filtersToCardPropertyMappings: {
274
276
  isArray: true;
275
277
  partialMatch: true;
276
278
  };
277
- chain: {
278
- category: "chain";
279
- canonicalAlias: string;
280
- kind: "partialMatch";
281
- property: "n/a";
282
- };
283
279
  co: {
284
280
  category: "cost";
285
281
  canonicalAlias: string;
@@ -298,6 +294,18 @@ export declare const filtersToCardPropertyMappings: {
298
294
  isNumber: true;
299
295
  partialMatch: true;
300
296
  };
297
+ createdby: {
298
+ category: "createdby";
299
+ canonicalAlias: string;
300
+ kind: "partialMatch";
301
+ property: "n/a";
302
+ };
303
+ creates: {
304
+ category: "creates";
305
+ canonicalAlias: string;
306
+ kind: "partialMatch";
307
+ property: "n/a";
308
+ };
301
309
  color: {
302
310
  category: "pitch";
303
311
  canonicalAlias: string;
@@ -457,6 +465,18 @@ export declare const filtersToCardPropertyMappings: {
457
465
  specialProperty: "specialLife";
458
466
  isNumber: true;
459
467
  };
468
+ madeby: {
469
+ category: "createdby";
470
+ canonicalAlias: string;
471
+ kind: "partialMatch";
472
+ property: "n/a";
473
+ };
474
+ makes: {
475
+ category: "creates";
476
+ canonicalAlias: string;
477
+ kind: "partialMatch";
478
+ property: "n/a";
479
+ };
460
480
  meta: {
461
481
  category: "is";
462
482
  canonicalAlias: string;
@@ -23,9 +23,10 @@ const FilterCategory = {
23
23
  Artist: "artist",
24
24
  Banned: "banned",
25
25
  Bond: "bond",
26
- Chain: "chain",
27
26
  Class: "class",
28
27
  Cost: "cost",
28
+ CreatedBy: "createdby",
29
+ Creates: "creates",
29
30
  Defense: "defense",
30
31
  Flow: "flow",
31
32
  Foiling: "foiling",
@@ -102,12 +103,6 @@ const bondFilter = {
102
103
  property: "bonds",
103
104
  isArray: true
104
105
  };
105
- const chainFilter = {
106
- category: FilterCategory.Chain,
107
- canonicalAlias: "chain",
108
- kind: FilterKind.PartialMatch,
109
- property: NO_CARD_PROPERTY
110
- };
111
106
  const classFilter = {
112
107
  category: FilterCategory.Class,
113
108
  canonicalAlias: "c",
@@ -126,6 +121,18 @@ const costFilter = {
126
121
  isNumber: true,
127
122
  partialMatch: true
128
123
  };
124
+ const createdByFilter = {
125
+ category: FilterCategory.CreatedBy,
126
+ canonicalAlias: "createdby",
127
+ kind: FilterKind.PartialMatch,
128
+ property: NO_CARD_PROPERTY
129
+ };
130
+ const createsFilter = {
131
+ category: FilterCategory.Creates,
132
+ canonicalAlias: "creates",
133
+ kind: FilterKind.PartialMatch,
134
+ property: NO_CARD_PROPERTY
135
+ };
129
136
  const defenseFilter = {
130
137
  category: FilterCategory.Defense,
131
138
  canonicalAlias: "d",
@@ -358,9 +365,10 @@ const filtersToCardPropertyMappings = {
358
365
  bonds: bondFilter,
359
366
  c: classFilter,
360
367
  class: classFilter,
361
- chain: chainFilter,
362
368
  co: costFilter,
363
369
  cost: costFilter,
370
+ createdby: createdByFilter,
371
+ creates: createsFilter,
364
372
  color: pitchFilter,
365
373
  d: defenseFilter,
366
374
  def: defenseFilter,
@@ -381,6 +389,8 @@ const filtersToCardPropertyMappings = {
381
389
  hero: legalFilter,
382
390
  li: lifeFilter,
383
391
  life: lifeFilter,
392
+ madeby: createdByFilter,
393
+ makes: createsFilter,
384
394
  meta: metaFilter,
385
395
  n: nameFilter,
386
396
  name: nameFilter,
@@ -4,8 +4,7 @@ import {
4
4
  Rarity,
5
5
  Release,
6
6
  setIdentifierToSetMappings,
7
- Treatment,
8
- Type
7
+ Treatment
9
8
  } from "@flesh-and-blood/types";
10
9
  import {
11
10
  FilterCategory,
@@ -15,11 +14,6 @@ import {
15
14
  } from "./filterMappings.js";
16
15
  import { getNormalizedFilterValue, getTextWithoutMarkup } from "./helpers.js";
17
16
  import { getMetaFilterResolution } from "./metaFilters.js";
18
- import {
19
- getCardsByName,
20
- getCardsReferencedBy,
21
- getCardsReferencing
22
- } from "./searchIndex.js";
23
17
  const getSharedModifier = (filterValues) => {
24
18
  const [firstValue] = filterValues;
25
19
  const firstModifier = firstValue?.modifier;
@@ -401,55 +395,28 @@ const cardIdentifierFilter = {
401
395
  isString: true,
402
396
  isNormalized: true
403
397
  };
404
- const CHAIN_EXPANSION_LIMIT = 20;
405
- const getChainedCardIdentifiers = (index, names) => {
406
- const cardIdentifiers = /* @__PURE__ */ new Set();
407
- const cardsToExpand = [];
408
- const namesToExpand = /* @__PURE__ */ new Set();
409
- const unresolvedValues = [];
410
- const addToChain = (card) => {
411
- cardIdentifiers.add(card.cardIdentifier);
412
- if (!namesToExpand.has(card.name)) {
413
- namesToExpand.add(card.name);
414
- cardsToExpand.push(card);
415
- }
416
- };
417
- const addRelatedCardToChain = (card) => {
418
- if (!card.types.includes(Type.Hero)) {
419
- addToChain(card);
420
- }
421
- };
422
- for (const name of names) {
423
- const seedCards = getCardsByName(index, name);
424
- for (const seedCard of seedCards) {
425
- addToChain(seedCard);
426
- }
427
- if (seedCards.length === 0) {
428
- unresolvedValues.push(name);
429
- }
398
+ const getCardsByNameOrGroup = (index, value) => {
399
+ let cards = index.getCardsByExactName(value);
400
+ if (cards.length === 0) {
401
+ cards = index.getCardsByGroup(value);
430
402
  }
431
- let expansions = 0;
432
- while (expansions < cardsToExpand.length && expansions <= CHAIN_EXPANSION_LIMIT) {
433
- const cardToExpand = cardsToExpand[expansions];
434
- for (const referencedCard of getCardsReferencedBy(index, cardToExpand)) {
435
- addRelatedCardToChain(referencedCard);
436
- }
437
- const isSeed = expansions === 0;
438
- if (isSeed) {
439
- for (const referencingCard of getCardsReferencing(index, cardToExpand)) {
440
- addRelatedCardToChain(referencingCard);
441
- }
442
- }
443
- expansions++;
403
+ if (cards.length === 0) {
404
+ cards = index.getCardsByName(value);
444
405
  }
445
- return { cardIdentifiers, unresolvedValues };
406
+ return cards;
446
407
  };
447
- const getRelatedCardIdentifiers = (index, name, isNamedByFilter) => {
408
+ const getRelatedCardIdentifiers = (index, value, readRelation) => {
448
409
  const relatedCardIdentifiers = /* @__PURE__ */ new Set();
449
- for (const namedCard of getCardsByName(index, name)) {
450
- const cardsInRelation = isNamedByFilter ? getCardsReferencedBy(index, namedCard) : getCardsReferencing(index, namedCard);
451
- for (const relatedCard of cardsInRelation) {
452
- relatedCardIdentifiers.add(relatedCard.cardIdentifier);
410
+ for (const card of getCardsByNameOrGroup(index, value)) {
411
+ for (const relatedCard of readRelation(index, card.cardIdentifier)) {
412
+ const isCycleAdded = relatedCardIdentifiers.has(
413
+ relatedCard.cardIdentifier
414
+ );
415
+ if (!isCycleAdded) {
416
+ for (const pitch of index.getPitchCycle(relatedCard.cardIdentifier)) {
417
+ relatedCardIdentifiers.add(pitch.cardIdentifier);
418
+ }
419
+ }
453
420
  }
454
421
  }
455
422
  return relatedCardIdentifiers;
@@ -482,11 +449,15 @@ const getCardIdentifiersFilter = (cardIdentifiers, isExcluded) => ({
482
449
  isExcluded,
483
450
  isOr: true
484
451
  });
485
- const getRelationResolution = ({ filterValues, isAnd, isExcluded }, getCardIdentifiersFromValue) => {
452
+ const getRelationResolver = (readRelation) => ({ filterValues, isAnd, isExcluded }, { index }) => {
486
453
  const cardIdentifiersByValue = [];
487
454
  const unresolvedValues = [];
488
455
  for (const { value } of filterValues) {
489
- const cardIdentifiers = getCardIdentifiersFromValue(value);
456
+ const cardIdentifiers = getRelatedCardIdentifiers(
457
+ index,
458
+ value,
459
+ readRelation
460
+ );
490
461
  cardIdentifiersByValue.push(cardIdentifiers);
491
462
  if (cardIdentifiers.size === 0) {
492
463
  unresolvedValues.push(value);
@@ -502,38 +473,39 @@ const getRelationResolution = ({ filterValues, isAnd, isExcluded }, getCardIdent
502
473
  unresolvedValues
503
474
  };
504
475
  };
505
- const getChainResolution = (term, { index }) => {
506
- const { cardIdentifiers, unresolvedValues } = getChainedCardIdentifiers(
507
- index,
508
- term.filterValues.map(({ value }) => value)
509
- );
510
- return {
511
- appliedFilters: [
512
- getCardIdentifiersFilter(cardIdentifiers, term.isExcluded)
513
- ],
514
- unresolvedValues
515
- };
516
- };
517
- const getReferencedByResolution = (term, { index }) => getRelationResolution(
518
- term,
519
- (value) => getRelatedCardIdentifiers(index, value, true)
520
- );
521
- const getReferencesResolution = (term, { index }) => getRelationResolution(
522
- term,
523
- (value) => getRelatedCardIdentifiers(index, value, false)
524
- );
525
476
  const resolverByFilterCategory = /* @__PURE__ */ new Map([
526
477
  [FilterCategory.Artist, getArtistResolution],
527
478
  [FilterCategory.Banned, getLegalityResolution],
528
- [FilterCategory.Chain, getChainResolution],
479
+ [
480
+ FilterCategory.CreatedBy,
481
+ getRelationResolver(
482
+ (index, cardIdentifier) => index.getCreates(cardIdentifier)
483
+ )
484
+ ],
485
+ [
486
+ FilterCategory.Creates,
487
+ getRelationResolver(
488
+ (index, cardIdentifier) => index.getCreatedBy(cardIdentifier)
489
+ )
490
+ ],
529
491
  [FilterCategory.Foiling, getFoilingResolution],
530
492
  [FilterCategory.Is, getMetaResolution],
531
493
  [FilterCategory.Legal, getLegalityResolution],
532
494
  [FilterCategory.Pitch, getPitchResolution],
533
495
  [FilterCategory.Print, getPrintResolution],
534
496
  [FilterCategory.Rarity, getRarityResolution],
535
- [FilterCategory.ReferencedBy, getReferencedByResolution],
536
- [FilterCategory.References, getReferencesResolution],
497
+ [
498
+ FilterCategory.ReferencedBy,
499
+ getRelationResolver(
500
+ (index, cardIdentifier) => index.getReferences(cardIdentifier)
501
+ )
502
+ ],
503
+ [
504
+ FilterCategory.References,
505
+ getRelationResolver(
506
+ (index, cardIdentifier) => index.getReferencedBy(cardIdentifier)
507
+ )
508
+ ],
537
509
  [FilterCategory.Set, getSetResolution],
538
510
  [FilterCategory.Treatment, getTreatmentResolution]
539
511
  ]);
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Ht=Object.create;var ie=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var Gt=(e,t)=>{for(var r in t)ie(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jt(t))!Ut.call(e,i)&&i!==r&&ie(e,i,{get:()=>t[i],enumerable:!(a=Qt(t,i))||a.enumerable});return e};var Wt=(e,t,r)=>(r=e!=null?Ht(Kt(e)):{},$e(t||!e||!e.__esModule?ie(r,"default",{value:e,enumerable:!0}):r,e)),_t=e=>$e(ie({},"__esModule",{value:!0}),e);var Ea={};Gt(Ea,{FilterCategory:()=>l,FilterKind:()=>C,FilterProperty:()=>j,MARKUP:()=>be,NO_CARD_PROPERTY:()=>D,PUNCTUATION:()=>P,RARITY_VALUES_MAPPING:()=>Le,abbreviations:()=>Re,aliasesByFilterCategory:()=>z,availableExclusions:()=>H,availableModifiers:()=>Ae,default:()=>Nt,filterCard:()=>Lt,filtersToCardPropertyMappings:()=>$,getAbbreviation:()=>ce,getAbbreviationByCard:()=>ir,getCardsByName:()=>ue,getCardsReferencedBy:()=>fe,getCardsReferencing:()=>ge,getCatalogueIndex:()=>we,getCleanText:()=>G,getEscapedForRegExp:()=>_,getExcludedMetaFilters:()=>ke,getFilterCategory:()=>J,getFilterMapping:()=>de,getFilterTokenSpansForKey:()=>na,getFilterValue:()=>He,getIncompleteFilterToken:()=>De,getIsExcludedToken:()=>oa,getIsValueInFilterVocabulary:()=>Pe,getKeywordsAndAppliedFiltersFromText:()=>wa,getMetaFilterResolution:()=>Z,getMetaFilters:()=>pr,getNormalizedFilterValue:()=>w,getNormalizedText:()=>q,getParsedQuery:()=>te,getQueryFilterToken:()=>he,getQueryTokenSpans:()=>ye,getQuotedValue:()=>da,getResolvedFilterKey:()=>Oe,getSuggestedFilterKey:()=>Se,getTextWithoutMarkup:()=>W,getTokensReferencedByCards:()=>Va,getUnquotedValue:()=>me,getValuePartsFromFilterValue:()=>Vt,getValuesFromFilterValue:()=>Qe,multiWordShorthands:()=>Ke,shorthands:()=>je,singleWordShorthands:()=>Ue});module.exports=_t(Ea);var Ce=require("@flesh-and-blood/types"),_e=Wt(require("fuse.js"),1);var P=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g,be=/\*/g;var b=require("@flesh-and-blood/types");var G=e=>q(e.toLowerCase().trim().replace(P,"")),q=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),w=e=>e.toLowerCase().replace(P,""),W=e=>e.replace(be,""),_=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&");var l={Arcane:"arcane",Artist:"artist",Banned:"banned",Bond:"bond",Chain:"chain",Class:"class",Cost:"cost",Defense:"defense",Flow:"flow",Foiling:"foiling",Fusion:"fusion",Intellect:"intellect",Is:"is",Keyword:"keyword",Legal:"legal",Life:"life",Name:"name",Pitch:"pitch",Power:"power",Print:"print",Rarity:"rarity",ReferencedBy:"referencedby",References:"references",Set:"set",Shorthand:"shorthand",Specialization:"specialization",Subtype:"subtype",Talent:"talent",Text:"text",Trait:"trait",Treatment:"treatment",Type:"type",TypeText:"typetext",Year:"year"},C={Comparator:"comparator",ExactMatch:"exactMatch",PartialMatch:"partialMatch"},Ae=[">=",">","<=","<"],H=["!","-"],D="n/a",pt=[...Object.values(b.Format),...Object.values(b.Hero)],$t={category:l.Arcane,canonicalAlias:"arcane",kind:C.Comparator,property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},Fe={category:l.Artist,canonicalAlias:"art",kind:C.PartialMatch,property:"artists",isArray:!0,partialMatch:!0},ze={category:l.Banned,canonicalAlias:"banned",kind:C.ExactMatch,vocabulary:pt,property:D,isMeta:!0},Ye={category:l.Bond,canonicalAlias:"bond",kind:C.ExactMatch,vocabulary:Object.values(b.Bond),property:"bonds",isArray:!0},zt={category:l.Chain,canonicalAlias:"chain",kind:C.PartialMatch,property:D},qe={category:l.Class,canonicalAlias:"c",kind:C.PartialMatch,vocabulary:Object.values(b.Class),property:"classes",isArray:!0,partialMatch:!0},Xe={category:l.Cost,canonicalAlias:"co",kind:C.Comparator,property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},X={category:l.Defense,canonicalAlias:"d",kind:C.Comparator,property:"defense",specialProperty:"specialDefense",isNumber:!0},Je={category:l.Flow,canonicalAlias:"flow",kind:C.ExactMatch,vocabulary:Object.values(b.Flow),property:"flows",isArray:!0},Ze={category:l.Foiling,canonicalAlias:"foil",kind:C.ExactMatch,vocabulary:Object.values(b.Foiling),nestedProperty:"foiling",property:"printings",isArray:!0},et={category:l.Fusion,canonicalAlias:"f",kind:C.ExactMatch,vocabulary:Object.values(b.Fusion),property:"fusions",isArray:!0},tt={category:l.Intellect,canonicalAlias:"i",kind:C.Comparator,property:"intellect",isNumber:!0},rt={category:l.Keyword,canonicalAlias:"k",kind:C.ExactMatch,vocabulary:Object.values(b.Keyword),property:"keywords",isArray:!0},ve={category:l.Legal,canonicalAlias:"l",kind:C.ExactMatch,vocabulary:pt,property:D,isMeta:!0},at={category:l.Life,canonicalAlias:"li",kind:C.Comparator,property:"life",specialProperty:"specialLife",isNumber:!0},it={category:l.Is,canonicalAlias:"is",kind:C.ExactMatch,vocabulary:Object.values(b.Meta),property:"meta",isArray:!0},st={category:l.Name,canonicalAlias:"name",kind:C.PartialMatch,property:"name",isString:!0,partialMatch:!0},Te={category:l.Pitch,canonicalAlias:"p",kind:C.Comparator,property:"pitch",isNumber:!0},se={category:l.Power,canonicalAlias:"pwr",kind:C.Comparator,property:"power",specialProperty:"specialPower",isNumber:!0},oe={category:l.Print,canonicalAlias:"print",kind:C.PartialMatch,property:"setIdentifiers",isArray:!0,partialMatch:!0},ot={category:l.Rarity,canonicalAlias:"r",kind:C.ExactMatch,vocabulary:Object.values(b.Rarity),property:D,isMeta:!0},Yt={category:l.ReferencedBy,canonicalAlias:"referencedby",kind:C.PartialMatch,property:D},qt={category:l.References,canonicalAlias:"references",kind:C.PartialMatch,property:D},nt={category:l.Set,canonicalAlias:"s",kind:C.PartialMatch,vocabulary:Object.values(b.Release),property:"sets",isArray:!0,partialMatch:!0},Me={category:l.Shorthand,canonicalAlias:"short",kind:C.PartialMatch,vocabulary:Object.values(b.Shorthand),property:"shorthands",isArray:!0,partialMatch:!0},ne={category:l.Specialization,canonicalAlias:"sp",kind:C.PartialMatch,vocabulary:Object.values(b.Hero),property:"specializations",isArray:!0,partialMatch:!0},lt={category:l.Subtype,canonicalAlias:"st",kind:C.ExactMatch,vocabulary:Object.values(b.Subtype),property:"subtypes",isArray:!0},dt={category:l.Type,canonicalAlias:"t",kind:C.ExactMatch,vocabulary:Object.values(b.Type),property:"types",isArray:!0},xe={category:l.Talent,canonicalAlias:"tal",kind:C.ExactMatch,vocabulary:Object.values(b.Talent),property:"talents",isArray:!0},Xt={category:l.Text,canonicalAlias:"text",kind:C.PartialMatch,property:"functionalText",hasMarkup:!0,isString:!0,partialMatch:!0},Jt={category:l.Trait,canonicalAlias:"trait",kind:C.PartialMatch,vocabulary:Object.values(b.Trait),property:"traits",isArray:!0,partialMatch:!0},ct={category:l.TypeText,canonicalAlias:"x",kind:C.PartialMatch,property:"typeText",isString:!0,partialMatch:!0},le={category:l.Treatment,canonicalAlias:"treatment",kind:C.ExactMatch,vocabulary:Object.values(b.Treatment),nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},Zt={category:l.Year,canonicalAlias:"year",kind:C.PartialMatch,property:"firstReleaseDate",isString:!0,partialMatch:!0},$={arcane:$t,a:Fe,artist:Fe,art:Fe,attack:se,b:X,block:X,banned:ze,bond:Ye,bonds:Ye,c:qe,class:qe,chain:zt,co:Xe,cost:Xe,color:Te,d:X,def:X,defense:X,flow:Je,flows:Je,f:et,fusion:et,foil:Ze,foiling:Ze,i:tt,intellect:tt,is:it,k:rt,keyword:rt,l:ve,legal:ve,hero:ve,li:at,life:at,meta:it,n:st,name:st,p:Te,pitch:Te,pwr:se,pow:se,power:se,print:oe,printing:oe,printings:oe,prints:oe,r:ot,rarity:ot,referencedby:Yt,references:qt,rf:ze,s:nt,set:nt,short:Me,shorthand:Me,shorthands:Me,sp:ne,spec:ne,specialization:ne,specializations:ne,st:lt,subtype:lt,t:dt,type:dt,tal:xe,talent:xe,talents:xe,text:Xt,trait:Jt,treat:le,treatment:le,var:le,variation:le,x:ct,typetext:ct,year:Zt},er=new Map(Object.entries($)),de=e=>er.get(e.toLowerCase()),J=e=>de(e)?.category,tr=()=>{let e=Object.create(null);for(let[t,{category:r}]of Object.entries($)){let a=e[r];a?a.push(t):e[r]=[t]}return e},z=tr(),rr=()=>{let e=new Map,t=new Set,r=Object.values($);for(let a of r){let{vocabulary:i}=a;if(i&&!t.has(a)){t.add(a);for(let s of i){let o=w(s),n=e.get(o);n?n.push(a):e.set(o,[a])}}}return e},ut=rr(),Pe=(e,t)=>!!ut.get(w(t))?.some(r=>r.category===e),ar=(e,t)=>{let r=[],a=!0;for(let i of t){let s=(ut.get(w(i))||[]).filter(o=>o.category!==e);r=a?s:r.filter(o=>s.includes(o)),a=!1}return r},Se=(e,t)=>{let r=ar(e,t),[a]=r;return r.length===1?a.canonicalAlias:void 0};var ee=require("@flesh-and-blood/types");var ce=e=>Re.find(({abbreviations:t})=>t.find(r=>r.toLowerCase()===e)),ir=e=>Re.find(({card:t})=>t.toLowerCase()===e.name.toLowerCase()),Re=[{abbreviations:["10k"],card:"10,000 Year Reunion"},{abbreviations:["Pajamas","PJs"],card:"Alluvion Constellas"},{abbreviations:["Slippy","Arakni Slipped Through the Cracks","Arakni, Slipped Through the Cracks"],card:"Arakni, 5L!p3d 7hRu 7h3 cR4X"},{abbreviations:["Dullcap"],card:"Arcanite Skullcap"},{abbreviations:["ALS"],card:"Arc Light Sentinel"},{abbreviations:["AoW"],card:"Art of War"},{abbreviations:["BBD"],card:"Barraging Beatdown"},{abbreviations:["BBS"],card:"Big Blue Sky"},{abbreviations:["Starvo"],card:"Bravo, Star of the Show"},{abbreviations:["BEB"],card:"Bull's Eye Bracers"},{abbreviations:["BLW"],card:"Be Like Water"},{abbreviations:["BoJ"],card:"Balance of Justice"},{abbreviations:["BOHH"],card:"Blood on Her Hands"},{abbreviations:["BRB"],card:"Bloodrush Bellow"},{abbreviations:["Breezies"],card:"Breeze Rider Boots"},{abbreviations:["BTA"],card:"Burn Them All"},{abbreviations:["CStrike","C-Strike","C Strike"],card:"Celestial Cataclysm"},{abbreviations:["CBelly"],card:"Cerebellum Processor"},{abbreviations:["CLF"],card:"Channel Lake Frigid"},{abbreviations:["CLV"],card:"Channel Lightning Valley"},{abbreviations:["CMH"],card:"Channel Mount Heroic"},{abbreviations:["CMI"],card:"Channel Mount Isen"},{abbreviations:["CMT"],card:"Channel the Millennium Tree"},{abbreviations:["CnC","C&C"],card:"Command and Conquer"},{abbreviations:["Sea and Sea"],card:"Conqueror of the High Seas"},{abbreviations:["CYB"],card:"Count Your Blessings"},{abbreviations:["Cat","Kitty"],card:"Crouching Tiger"},{abbreviations:["CoD"],card:"Crown of Dominion"},{abbreviations:["CoP"],card:"Crown of Providence"},{abbreviations:["CtW"],card:"Crush the Weak"},{abbreviations:["DD"],card:"Death Dealer"},{abbreviations:["DnD"],card:"Devotion Never Dies"},{abbreviations:["DIO"],card:"Dash I/O"},{abbreviations:["EBTT"],card:"Even Bigger Than That!"},{abbreviations:["NewNigma"],card:"Enigma, New Moon"},{abbreviations:["EPot","E Pot"],card:"Energy Potion"},{abbreviations:["EStrike","E-Strike","E Strike"],card:"Enlightened Strike"},{abbreviations:["FFS"],card:"Fyendal's Fighting Spirit"},{abbreviations:["FoN"],card:"Force of Nature"},{abbreviations:["Frosty","\u{1F976}","\u{1F9CA}","\u2744\uFE0F"],card:"Frostbite"},{abbreviations:["Yum yum"],card:"Fruits of the Forest"},{abbreviations:["GnT"],card:"Give and Take"},{abbreviations:["Habibi"],card:"Hanabi Blaster"},{abbreviations:["HMH"],card:"Hope Merchant's Hood"},{abbreviations:["HoI"],card:"Heart of Ice"},{abbreviations:["Pumpkin"],card:"Jack-o'-lantern"},{abbreviations:["RKO","Cheato"],card:"Kayo, Underhanded Cheat"},{abbreviations:["KKBB"],card:"Knick Knack Bric-a-brac"},{abbreviations:["BStrike"],card:"Levels of Enlightenment"},{abbreviations:["LAG","Twominaris"],card:"Luminaris, Angel's Glow"},{abbreviations:["LCF","Newminaris"],card:"Luminaris, Celestial Fury"},{abbreviations:["LDE"],card:"Last Ditch Effort"},{abbreviations:["LtC"],card:"Lead the Charge"},{abbreviations:["LNW"],card:"Leave No Witnesses"},{abbreviations:["LFaL","L4aL"],card:"Life for a Life"},{abbreviations:["LiT"],card:"Lost in Thought"},{abbreviations:["MMB"],card:"Mage Master Boots"},{abbreviations:["MaxV"],card:"Maximum Velocity"},{abbreviations:["MoM"],card:"Mask of Momentum"},{abbreviations:["MoPL"],card:"Mask of the Pouncing Lynx"},{abbreviations:["MnG"],card:"Meat and Greet"},{abbreviations:["Cake","\u{1F382}"],card:"Ninth Blade of the Blood Oath"},{abbreviations:["PoM"],card:"Peace of Mind"},{abbreviations:["P-Bone"],card:"Performance Bonus"},{abbreviations:["PF","\u{1F525}"],card:"Phoenix Flame"},{abbreviations:["PtW"],card:"Poison the Well"},{abbreviations:["Thanos","Infinity Gauntlet"],card:"Polarity Reversal Script"},{abbreviations:["DPot","D Pot"],card:"Potion of D\xE9j\xE0 Vu"},{abbreviations:["Ponder Run"],card:"Premeditate"},{abbreviations:["Qi Unbound"],card:"Qi Unleashed"},{abbreviations:["RitL"],card:"Red in the Ledger"},{abbreviations:["Cats","Ghost cat","Ghost cats"],card:"Restless Coalescence"},{abbreviations:["Eugene"],card:"Rhinar, Reckless Rampage",isHidden:!0},{abbreviations:["SSGB"],card:"Sandscour Greatbow"},{abbreviations:["SSP"],card:"Sand Sketched Plan"},{abbreviations:["SFaS","S4aS"],card:"Scar for a Scar"},{abbreviations:["Tyler"],card:"Scurv, Stowaway",isHidden:!0},{abbreviations:["SWOMB"],card:"Shifting Winds of the Mystic Beast"},{abbreviations:["Snaps"],card:"Snapdragon Scalers"},{abbreviations:["SWK"],card:"Spinning Wheel Kick"},{abbreviations:["SFTL"],card:"Swing Fist, Think Later"},{abbreviations:["TTT"],card:"Take the Tempo"},{abbreviations:["Ultron"],card:"Teklovossen, the Mechropotent"},{abbreviations:["ToS"],card:"Test of Strength"},{abbreviations:["TAYG"],card:"That All You Got?"},{abbreviations:["TROM"],card:"This Round's on Me"},{abbreviations:["3oak"],card:"Three of a Kind"},{abbreviations:["Pox Malone","Post Malone"],card:"Virulent Touch"},{abbreviations:["Cast Homes"],card:"Visit Goldmane Estate"},{abbreviations:["Frosty Hammer"],card:"Winter's Wail"},{abbreviations:["Wreckless Wing"],card:"War Cry of Bellona"},{abbreviations:["ZTS"],card:"Zero to Sixty"}];var c=require("@flesh-and-blood/types");var S=require("@flesh-and-blood/types");var j={BannedFormats:"bannedFormats",LegalFormats:"legalFormats",LegalHeroes:"legalHeroes"},pe=Array.from(Array(50).keys()).map(e=>`${e}`),sr=[{format:S.Format.ClassicConstructed,nicknames:["cc","classic"]},{format:S.Format.LivingLegend,nicknames:["cc ll","classic constructed ll","ll cc","ll","living legend"]},{format:S.Format.SilverAge,nicknames:["sage"]},{format:S.Format.GoldenAge,nicknames:["gage"]},{format:S.Format.UltimatePitFight,nicknames:["upf"]}],or=Object.values(S.Format).map(e=>{let t=sr.find(({format:a})=>a===e),r=e.toLowerCase().replaceAll(P,"");return t?{...t,format:r}:{format:r}}),nr=[{hero:S.Hero.DataDoll,nicknames:["data","datadoll"]},{hero:S.Hero.Dorinthea,nicknames:["dori"]},{hero:S.Hero.Genis,nicknames:["genis"]},{hero:S.Hero.GravyBones,nicknames:["gravy"]},{hero:S.Hero.Iyslander,nicknames:["islander"]}],lr=Object.values(S.Hero).map(e=>{let t=nr.find(({hero:a})=>a===e),r=e.toLowerCase().replaceAll(P,"");return t?{...t,hero:r}:{hero:r}}),gt=["common","rare","super rare","majestic","legendary","fabled"],dr=({modifier:e,value:t})=>{let r=[],a=e==="<"||e==="<=",i=e===">="||e==="<=",s=a?[...gt].reverse():gt,o=!1;for(let n of s)o?r.push(n):n===t&&(o=!0,i&&r.push(n));return r},cr=(e,t)=>{let r=[];for(let a of e)a.modifier?r.push(...dr(a)):r.push(a.value);return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOr:!0,values:r}},ft=(e,t,r,a)=>{let i=r.map(d=>({hero:d.toLowerCase().replaceAll(P,"")})),s=[],o=[],n=[],p=[];for(let{value:d}of e){let u=or.find(({format:y,nicknames:h})=>y===d||!!h&&h.includes(d));if(u)o.push(u.format);else{let y=lr.find(({hero:h,nicknames:v})=>h===d||!!v&&v.includes(d))||i.find(({hero:h})=>h===d);y?n.push(y.hero):p.push(d)}}return o.length>0&&s.push({filterToPropertyMapping:{property:a,isArray:!0},values:o,isOr:!0,isExcluded:t}),n.length>0&&s.push({filterToPropertyMapping:{property:j.LegalHeroes,isArray:!0},values:n,isOr:!0,isExcluded:t}),{appliedFilters:s,unresolvedValues:p}},Z=(e,t,{additionalHeroes:r=[],isExcluded:a=!1}={})=>{let i=J(e),s={appliedFilters:[],unresolvedValues:[]};return i===l.Legal?s=ft(t,a,r,j.LegalFormats):i===l.Banned?s=ft(t,a,r,j.BannedFormats):i===l.Rarity&&(s={appliedFilters:[cr(t,a)],unresolvedValues:[]}),s},pr=(e,t,r,a,i,s)=>Z(r,a.map(o=>({modifier:i,value:o})),{additionalHeroes:s,isExcluded:e}).appliedFilters,ur=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"specialCost",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]}],gr=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"specialDefense",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["hero","placeholder","token","weapon"]}],fr=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],yr=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"specialPower",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token"]}],hr=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(S.Talent).map(e=>e.toLowerCase())}],mr=[{filterToPropertyMapping:{property:"classes",isArray:!0},isExcluded:!0,values:Object.values(S.Class).map(e=>e.toLowerCase())}],Cr=[{category:l.Class,filters:mr},{category:l.Cost,filters:ur},{category:l.Defense,filters:gr},{category:l.Pitch,filters:fr},{category:l.Power,filters:yr},{category:l.Talent,filters:hr}],br=()=>{let e=new Map;for(let{category:t,filters:r}of Cr)for(let a of z[t])for(let i of H)e.set(`${i}${a}`,r);return e},Fr=br(),ke=e=>{let t=[],r=Fr.get(e);return r&&t.push(...r),t};var K=require("@flesh-and-blood/types");var yt=new WeakMap,Q=Object.freeze([]),vr=Number.MAX_SAFE_INTEGER,ht=(e,t)=>{let r=new Map;for(let a of e)for(let i of t(a)||[]){let s=r.get(i);s?s.push(a):r.set(i,[a])}return r},Tr=e=>{let t=new Map;for(let r of e){let a=r.types.includes(K.Type.Hero)&&!r.isCardBack,i=a?K.CardRole.Hero:(0,K.getCardRole)(r);if(a||i!==K.CardRole.Hero){let o=t.get(i);o?o.push(r):t.set(i,[r])}}return t},Mr=e=>{let t,r,a,i,s,o=()=>{if(!t){let g=new Map,f=new Map,m=[],T=new Map,M=0;for(let R of e){g.set(R.cardIdentifier,R),f.set(R.cardIdentifier,M),M++;let k=G(R.name),U=T.get(k);U?U.push(R):(T.set(k,[R]),m.push(k))}t={cardByCardIdentifier:g,corpusPositionByCardIdentifier:f,cleanedNames:m,pitchCycleByCleanedName:T}}return t},n=g=>{let{corpusPositionByCardIdentifier:f}=o(),m=({cardIdentifier:T})=>f.get(T)??vr;return[...g].sort((T,M)=>m(T)-m(M))},p=g=>o().cardByCardIdentifier.get(g),d=g=>{let{cardByCardIdentifier:f}=o(),m=[];for(let T of g||[]){let M=f.get(T);M&&m.push(M)}return n(m)},u=g=>{let f=new Map;return m=>{let T=f.get(m);if(!T){let M=p(m),R=d(M&&g(M)),k=R.length>0;T=k?R:Q,k&&f.set(m,T)}return T}},y=g=>{let{pitchCycleByCleanedName:f}=o(),m=p(g);return m?f.get(G(m.name))??Q:Q},h=g=>{let{cleanedNames:f,pitchCycleByCleanedName:m}=o(),T=G(g),M=m.get(T);if(!M&&T.length>0){let k=f.find(U=>U.includes(T));k&&(M=m.get(k))}return M??Q},v=g=>{let{pitchCycleByCleanedName:f}=o();return f.get(G(g))??Q},I=()=>{if(!s){let g=new Set;for(let f of e)for(let m of f.artists)g.add(m);s=[...g].sort((f,m)=>f.localeCompare(m,"en",{sensitivity:"base"}))}return s},V=u(({oppositeSideCardIdentifiers:g})=>g),A=u(({referencedCards:g})=>g),E=g=>(r||(r=ht(e,({referencedCards:f})=>f)),r.get(g)??Q),L=u(({createdExtras:g})=>g);return{cards:e,getCard:p,getPitchCycle:y,getCardsByName:h,getCardsByExactName:v,getArtists:I,getOppositeSide:V,getReferences:A,getReferencedBy:E,getCreates:L,getCreatedBy:g=>(a||(a=ht(e,({createdExtras:f})=>f)),a.get(g)??Q),getCreatedClosure:g=>{let f=new Map,m=new Set,T=[...g];for(let M of T)if(!m.has(M)){m.add(M);for(let k of L(M))f.set(k.cardIdentifier,k),T.push(k.cardIdentifier)}return n([...f.values()])},getByRole:g=>(i||(i=Tr(e)),i.get(g)??Q),getCardsInCorpusOrder:n}},we=e=>{let t=yt.get(e);return t||(t=Mr(e),yt.set(e,t)),t},Ve=(e,t)=>e.getPitchCycle(t.cardIdentifier),ue=(e,t)=>e.getCardsByName(t),mt=(e,t)=>{let r=new Map;for(let a of t)for(let i of Ve(e,a))r.set(i.cardIdentifier,i);return e.getCardsInCorpusOrder([...r.values()])},ge=(e,t)=>{let r=[];for(let a of Ve(e,t))r.push(...e.getReferencedBy(a.cardIdentifier));return mt(e,r)},fe=(e,t)=>{let r=[];for(let a of Ve(e,t))r.push(...e.getReferences(a.cardIdentifier));return mt(e,r)};var xr=e=>{let[t]=e,r=t?.modifier;return e.every(({modifier:i})=>i===r)?r:void 0},Ie=({filterValues:e,isAnd:t,isExcluded:r,mapping:a})=>{let i=[];for(let{value:s}of e)i.push(a.hasMarkup?W(s):s);return{filterToPropertyMapping:a,filterValues:e,isAnd:t,isExcluded:r,isOr:!t&&i.length>1,modifier:xr(e),values:i}},vt=({isAnd:e,isExcluded:t,mapping:r},a)=>({filterToPropertyMapping:r,isAnd:e,isExcluded:t,isOr:!e&&a.length>1,values:a}),Ar=({category:e,filterValues:t,mapping:r})=>{let a=[];if(r.kind===C.ExactMatch&&!!r.vocabulary)for(let{value:s}of t)Pe(e,s)||a.push(s);return a},Pr=e=>({appliedFilters:[Ie(e)],unresolvedValues:Ar(e)}),Be=({isExcluded:e},t,r)=>e?void 0:{[t]:r},Tt=(e,t)=>({appliedFilters:[Ie(e)],attributes:Be(e,t,e.filterValues.map(({value:r})=>r)),unresolvedValues:[]}),Sr=e=>Tt(e,"artists"),Rr=e=>Tt(e,"prints"),Ne=(e,t,r)=>{let a=[],i=[],s=[];for(let{value:o}of e.filterValues){let n=r(o);if(n.length>0)for(let p of n)a.push(p),i.push(w(p));else s.push(o)}return{appliedFilters:[vt(e,i)],attributes:Be(e,t,a),canonicalValues:i,unresolvedValues:s}},kr=new Map(Object.entries({purple:4,blue:3,yellow:2,red:1,white:0})),wr=e=>{let t=[],r=[];for(let{modifier:a,value:i}of e.filterValues){let s=kr.get(i),o=s===void 0?i:`${s}`;t.push({modifier:a,value:o}),r.push(o)}return{appliedFilters:[Ie({...e,filterValues:t})],canonicalValues:r,unresolvedValues:[]}},Ee=new Map;for(let e of Object.values(c.Release)){let t=w(e),r=Ee.get(t);if(r===void 0)Ee.set(t,e);else throw new Error(`${r} and ${e} are one name as a filter reads it, so a set filter naming it could reach either`)}var Ct=(e,t)=>{let r=e.get(t);return r?[r]:[]},Vr=(e,t)=>{let r=[()=>Ct(Ee,e),()=>Ct(c.setIdentifierToSetMappings,e),()=>Object.values(c.Release).filter(i=>i.toLowerCase().includes(e)),()=>{let i=t.find(s=>w(s)===e);return i?[i]:[]}],a=[];for(let i of r)a.length===0&&a.push(...i());return a},Er=(e,{additionalSets:t})=>Ne(e,"releases",r=>Vr(r,t)),Ir=new Map(Object.entries({r:c.Foiling.Rainbow,rf:c.Foiling.Rainbow,rainbow:c.Foiling.Rainbow,c:c.Foiling.Cold,cf:c.Foiling.Cold,cold:c.Foiling.Cold,g:c.Foiling.Gold,gf:c.Foiling.Gold,gold:c.Foiling.Gold})),Br=e=>{let t=Ir.get(e);return t?[t]:[]},Nr=e=>Ne(e,"foilings",Br),Mt=new Map(Object.entries({aa:c.Treatment.AA,alt:c.Treatment.AA,"alt art":c.Treatment.AA,ab:c.Treatment.AB,"alt border":c.Treatment.AB,at:c.Treatment.AT,"alt text":c.Treatment.AT,ea:c.Treatment.EA,extended:c.Treatment.EA,"extended art":c.Treatment.EA,fa:c.Treatment.FA,full:c.Treatment.FA,"full art":c.Treatment.FA}));for(let e of Object.values(c.Treatment))Mt.set(e.toLowerCase(),e);var Lr=new Map(Object.entries(c.Treatment)),Or=e=>{let t=Mt.get(e)||Lr.get(e.toUpperCase());return t?[t]:[]},Dr=e=>Ne(e,"treatments",Or),Le=new Map(Object.entries({b:c.Rarity.Basic,c:c.Rarity.Common,f:c.Rarity.Fabled,l:c.Rarity.Legendary,m:c.Rarity.Majestic,p:c.Rarity.Promo,r:c.Rarity.Rare,s:c.Rarity.SuperRare,t:c.Rarity.Token,v:c.Rarity.Marvel})),Hr=e=>Le.get(e)||Object.values(c.Rarity).find(t=>t.toLowerCase()===e),Qr=(e,{additionalHeroes:t})=>{let r=[],a=[],i=[],s=[];for(let{modifier:n,value:p}of e.filterValues){let d=Hr(p);d?(r.push(d),a.push(d.toLowerCase()),i.push({modifier:n,value:d.toLowerCase()})):(s.push(p),i.push({modifier:n,value:p}))}let{appliedFilters:o}=Z(e.key,i,{additionalHeroes:t,isExcluded:e.isExcluded});return{appliedFilters:o,attributes:Be(e,"rarities",r),canonicalValues:a,unresolvedValues:s}},bt=({filterValues:e,isExcluded:t,key:r},{additionalHeroes:a})=>{let{appliedFilters:i,unresolvedValues:s}=Z(r,e,{additionalHeroes:a,isExcluded:t}),o=[];for(let{values:n}of i)o.push(...n);return{appliedFilters:i,canonicalValues:o,unresolvedValues:s}},jr=["unique"],Kr=["preview","spoiler","unreleased"],Ur=["released"],Ft={property:"firstReleaseDate",isDate:!0},Gr=new Map(Object.entries({dual:c.Meta.DualClass,exp:c.Meta.Expansion,expansion:c.Meta.Expansion,rainbow:c.Meta.Rainbow,reprint:c.Meta.Reprint,reprints:c.Meta.Reprint})),Wr=e=>{let t=[],r=[];for(let i of e){let s=Gr.get(i);s?t.push(s):r.push(i)}let a=[];if(t.length===0){let i=new Set;for(let s of Object.values(c.Meta)){let o=!1;for(let n of r)s.toLowerCase().includes(n)&&(o=!0,i.add(n));o&&t.push(s)}for(let s of r)i.has(s)||a.push(s)}else a.push(...r);return{unresolvedValues:a,values:t}},_r=(e,{today:t})=>{let{filterValues:r,isAnd:a,isExcluded:i}=e,s=[],o=[],n=[],p=[],d=[];for(let{value:A}of r)jr.includes(A)?o.push(A):Kr.includes(A)?n.push(A):Ur.includes(A)?p.push(A):d.push(A);let u=!a&&r.length>1;o.length>0&&s.push({filterToPropertyMapping:$.is,values:[w(c.Meta.Reprint)],isAnd:a,isOr:u,isExcluded:!i}),n.length>0&&s.push({filterToPropertyMapping:Ft,values:[t],isAnd:a,isOr:u,isExcluded:i}),p.length>0&&s.push({filterToPropertyMapping:Ft,values:[t],isAnd:a,isOr:u,isExcluded:!i});let{unresolvedValues:y,values:h}=Wr(d),v=[...o,...n,...p,...h.map(w)];(d.length>0||s.length===0)&&s.push(vt(e,h.map(w)));let V=h.includes(c.Meta.Expansion)&&!i;return{appliedFilters:s,attributes:V?{isExpansionSlot:V}:void 0,canonicalValues:v,unresolvedValues:y}},$r={property:"cardIdentifier",isString:!0,isNormalized:!0},zr=20,Yr=(e,t)=>{let r=new Set,a=[],i=new Set,s=[],o=d=>{r.add(d.cardIdentifier),i.has(d.name)||(i.add(d.name),a.push(d))},n=d=>{d.types.includes(c.Type.Hero)||o(d)};for(let d of t){let u=ue(e,d);for(let y of u)o(y);u.length===0&&s.push(d)}let p=0;for(;p<a.length&&p<=zr;){let d=a[p];for(let y of fe(e,d))n(y);if(p===0)for(let y of ge(e,d))n(y);p++}return{cardIdentifiers:r,unresolvedValues:s}},xt=(e,t,r)=>{let a=new Set;for(let i of ue(e,t)){let s=r?fe(e,i):ge(e,i);for(let o of s)a.add(o.cardIdentifier)}return a},qr=(e,t)=>{let r=new Set,[a=new Set,...i]=e;if(t)for(let s of a)i.every(n=>n.has(s))&&r.add(s);else for(let s of e)for(let o of s)r.add(o);return r},At=(e,t)=>({filterToPropertyMapping:$r,values:[...e],valuesSet:e,isExcluded:t,isOr:!0}),Pt=({filterValues:e,isAnd:t,isExcluded:r},a)=>{let i=[],s=[];for(let{value:o}of e){let n=a(o);i.push(n),n.size===0&&s.push(o)}return{appliedFilters:[At(qr(i,t),r)],unresolvedValues:s}},Xr=(e,{index:t})=>{let{cardIdentifiers:r,unresolvedValues:a}=Yr(t,e.filterValues.map(({value:i})=>i));return{appliedFilters:[At(r,e.isExcluded)],unresolvedValues:a}},Jr=(e,{index:t})=>Pt(e,r=>xt(t,r,!0)),Zr=(e,{index:t})=>Pt(e,r=>xt(t,r,!1)),ea=new Map([[l.Artist,Sr],[l.Banned,bt],[l.Chain,Xr],[l.Foiling,Nr],[l.Is,_r],[l.Legal,bt],[l.Pitch,wr],[l.Print,Rr],[l.Rarity,Qr],[l.ReferencedBy,Jr],[l.References,Zr],[l.Set,Er],[l.Treatment,Dr]]),St=(e,t)=>(ea.get(e.category)||Pr)(e,t);var kt=H.map(_).join(""),ta=/(?:[^\s"]+|"[^"]*(?:"|$))+/g,ra=new RegExp(`^([${kt}])?([A-Za-z]+):(.+)$`),aa=new RegExp(`^([${kt}])?([A-Za-z]+):$`),ia=",",Rt="+",sa='"',wt=e=>{let t=[],r=!1,a="",i=!1;for(let s of e)s===sa?(i=!i,a+=s):!i&&(s===ia||s===Rt)?(r=r||s===Rt,a&&t.push(a),a=""):a+=s;return a&&t.push(a),{isAndList:r,parts:t}},ye=e=>{let t=[];for(let r of e.matchAll(ta))t.push({end:r.index+r[0].length,start:r.index,token:r[0]});return t},oa=e=>H.some(t=>e.startsWith(t)),he=e=>{let t=e.match(ra),r;if(t){let[,a,i,s]=t;r={isAndList:wt(s).isAndList,isExcluded:!!a,key:i,valueText:s}}return r},De=e=>{let t=e.match(aa),r;return t&&(r={isAndList:!1,isExcluded:!!t[1],key:t[2],valueText:""}),r},He=e=>{let t=e.trim(),r=Ae.find(a=>t.startsWith(a));return{modifier:r,value:r?t.slice(r.length).trim():t}},Oe=e=>J(e)??e.toLowerCase(),na=(e,t)=>{let r=Oe(t),a=[];for(let{end:i,start:s,token:o}of ye(e)){let n=he(o);n&&Oe(n.key)===r&&a.push({...n,end:i,start:s,token:o})}return a},Vt=e=>wt(e).parts,me=e=>e.replace(/^"|"$/g,""),Qe=e=>{let t=[];for(let r of Vt(e)){let a=me(r);a&&t.push(a)}return t},la=/[\s,:+"]/,da=e=>{let t=e.replaceAll('"',"");return la.test(e)?`"${t}"`:t};var N=require("@flesh-and-blood/types"),je=[{description:"Attack actions",expanded:["st:attack"],filters:{subtypes:[N.Subtype.Attack]},isCardProperty:!1,shorthands:["AA"]},{description:"Arcane barrier",expanded:['k:"arcane barrier"'],filters:{keywords:[N.Keyword.ArcaneBarrier]},isCardProperty:!1,shorthands:["AB"]},{description:"Attack reactions",expanded:['t:"attack reaction"'],filters:{types:[N.Type.AttackReaction]},isCardProperty:!1,shorthands:["AR"]},{description:"Defense reactions",expanded:['t:"defense reaction"'],filters:{types:[N.Type.DefenseReaction]},isCardProperty:!1,shorthands:["DR"]},{description:"Gain life",expanded:["gain {h}"],filters:{functionalText:"gain {h}"},isCardProperty:!1,shorthands:["Gain life","Gains life"]},{description:"Go again",expanded:['k:"go again"'],filters:{keywords:[N.Keyword.GoAgain]},isCardProperty:!1,shorthands:["GA"]},{description:"Non-attack actions",expanded:["t:action","st:non-attack"],filters:{subtypes:[N.Subtype.NonAttack],types:[N.Type.Action]},isCardProperty:!1,shorthands:["NAA"]},{description:"Plus defense",expanded:["+ {d}"],filters:{functionalText:"+ {d}"},isCardProperty:!1,shorthands:["Pump defense","Pumps defense","Buff defense","Buffs defense"]},{description:"Spellvoid",expanded:['k:"spellvoid"'],filters:{keywords:[N.Keyword.Spellvoid]},isCardProperty:!1,shorthands:["SV"]}],Ke=je.filter(({shorthands:e})=>e.some(t=>t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)})),Ue=je.filter(({shorthands:e})=>e.some(t=>!t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>!t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)}));var ca=["\u201C","\u201D"],pa=[{text:ee.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:ee.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(P,"")}],Ge=new Map([...ee.setToSetIdentifierMappings].map(([e,t])=>[e.toLowerCase(),t])),ua=[...z[l.Set],...z[l.Print]],ga=H.map(_).join(""),fa=[...Ge.keys()].sort((e,t)=>t.length-e.length).map(_).join("|"),ya=new RegExp(`(?<=^|\\s)([${ga}]?(?:${ua.join("|")}):(?:[^\\s]*[,+])?"?)(${fa})(?="?(?:[,+]|\\s|$))`,"g"),ha=(e,t)=>{let r=e.trim().toLowerCase();for(let s of ca)r=r.replaceAll(s,'"');for(let{expanded:s,shorthands:o}of Ke)for(let n of o)if(r.includes(n)){r=r.replace(n,s.join(" "));break}r=r.replace(ya,(s,o,n)=>{let p=Ge.get(n);return p?`${o}${p[0]}`:s});let a=Ge.get(r),i=t.getCardsByExactName(r).length>0;a&&!i&&(r=`set:${a[0]}`);for(let{override:s,text:o}of pa)r.includes(o)&&(r=r.replace(o,s));return{isWholeQueryAbbreviation:!!ce(r)?.card,text:r}},ma=e=>{let t=Ue.find(({shorthands:a})=>a.includes(e)),r=!!t&&!t.isCardProperty;return{isExpanded:r,tokens:r?t.expanded:[e]}},Ca=({isWholeQueryAbbreviation:e,text:t})=>{let r=[],a=e?[{end:t.length,start:0,token:t}]:ye(t);for(let{end:i,start:s,token:o}of a){let{isExpanded:n,tokens:p}=ma(o);for(let d of p)r.push({end:i,isExpanded:n,start:s,token:d})}return r},ba=e=>{let t=[];for(let r of e){let{modifier:a,value:i}=He(r),s=w(i);s&&t.push({modifier:a,value:s})}return t},Fa=(e,t,r)=>{let a={key:e,reason:"value",values:r},i=Se(t,r);return i&&(a.suggestedKey=i),a},va=()=>{let e=new Date,t=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${t}-${r}`},te=(e,t,{additionalHeroes:r=[],additionalSets:a=[],today:i=va()}={})=>{let s=ha(e,t),o={additionalHeroes:r,additionalSets:a,index:t,today:i},n=[],p={artists:[],foilings:[],isExpansionSlot:!1,prints:[],rarities:[],releases:[],treatments:[]},d=[],u=[],y=[];for(let h of Ca(s)){let v=he(h.token)||De(h.token);if(v){let{isAndList:I,isExcluded:V,key:A,valueText:E}=v,L=de(A),O=L?.category,F=Qe(E),B=ba(F),g={...h,canonicalValues:B.map(({value:f})=>f),category:O,filterValues:B,isAnd:I,isExcluded:V,isFilter:!0,isResolved:!0,key:A};if(F.length>0)if(L&&O){let f=F;if(B.length>0){let m=St({category:O,filterValues:B,isAnd:g.isAnd,isExcluded:V,key:A,mapping:L},o);n.push(...m.appliedFilters),m.canonicalValues&&(g.canonicalValues=m.canonicalValues),m.attributes&&Object.assign(p,m.attributes),f=m.unresolvedValues}f.length>0&&(g.isResolved=!1,y.push(Fa(A,O,f)))}else g.isResolved=!1,y.push({key:A,reason:"key",values:[]});u.push(g)}else{let{end:I,start:V,token:A}=h;u.push({end:I,isFilter:!1,start:V,token:A});let E=me(h.token),L=ce(E)?.card,O=ke(E);L?d.push(`"${L.toLowerCase().replace(P,"")}"`):O.length>0?n.push(...O):E&&d.push(E.replace(P,""))}}return{appliedFilters:n,attributes:p,keywords:d,nodes:u,text:s.text,unresolvedFilters:y}};var x=require("@flesh-and-blood/types"),Et={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[x.Class.Generic],defaultImage:"FNG000",firstReleaseDate:"2022-06-02",functionalText:"If Fangs A Lot is put into your banished zone from your graveyard, instead put it into your hand.",legalFormats:[],legalHeroes:[x.Hero.Kayo,x.Hero.Levia,x.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:x.Rarity.Rare,set:x.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${x.Treatment.FA}`,rarity:x.Rarity.Marvel,set:x.Release.Promos,treatments:[x.Treatment.FA]}],name:"Fangs A Lot",rarities:[x.Rarity.Rare,x.Rarity.Marvel],rarity:x.Rarity.Rare,sets:[x.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[x.Subtype.Attack],types:[x.Type.Action],typeText:"Generic Action - Attack"},It=[{keyword:Et.name.toLowerCase(),card:Et}];var Ta={getFn:(e,t)=>{let r=_e.default.config.getFn(e,t),a=r;if(Array.isArray(r))a=r.map(i=>{let s=typeof i=="string"?i:i.v;return q(s.replace(P,""))});else if(r){let i=q(r).replace(P,"");a=t.includes("functionalText")?W(i):i}return a},ignoreLocation:!0,includeScore:!0,keys:[{name:"name",weight:10},{name:"functionalText",weight:6},{name:"shorthands",weight:4},{name:"setIdentifiers",weight:2},{name:"traits",weight:4},{name:"typeText",weight:6}],threshold:.15,useExtendedSearch:!0},We=class{constructor(t,r=[],a=[]){this.getFuse=()=>(this.fuse||(this.fuse=new _e.default(this.cards,Ta)),this.fuse);this.search=(t,r)=>{let a,{appliedFilters:i,attributes:s,keywords:o,unresolvedFilters:n}=te(t,this.index,{additionalHeroes:this.additionalHeroes,additionalSets:this.additionalSets}),p=o.join(" "),d=r?It.filter(F=>F.keyword===p):[];if(d.length>0?a=d.map(({card:F})=>F):o.length?a=this.getFuse().search(p).map(F=>F.item):a=[...this.cards],i.length&&(a=a.filter(F=>F&&Lt(F,i))),o.length===0){let F="";if(s.releases.length===1){let f=Ce.setToSetIdentifierMappings.get(s.releases[0]);f?.length&&(F=f[0].toUpperCase())}if(!F&&s.prints.length===1){let f=s.prints[0];Ce.setIdentifierToSetMappings.has(f)&&(F=f.toUpperCase())}F?a.sort((f,m)=>{let T=f.setIdentifiers.find(R=>R.includes(F))?.replace(F,""),M=m.setIdentifiers.find(R=>R.includes(F))?.replace(F,"");return T&&M?T.localeCompare(M):-1}):a.sort((f,m)=>f.name===m.name?`${f.pitch}`.localeCompare(`${m.pitch}`):f.name.localeCompare(m.name))}else{let F=[],B=[],g=o.map(f=>f.toLowerCase().replace(P,"")).join(" ");for(let f of a)f.name.toLowerCase().replace(P,"")===g?F.push(f):B.push(f);a=[...F,...B]}let u=[],{artists:y,isExpansionSlot:h,foilings:v,prints:I,rarities:V,releases:A,treatments:E}=s;(y.length>0||h||v.length>0||I.length>0||V.length>0||A.length>0||E.length>0)&&(u=a.map(F=>{let B=F.printings.filter(g=>{let f=!!g.image,m=y.length===0||y.some(Y=>g.artists.find(Dt=>Dt.replace(P,"").toLowerCase().includes(Y))),T=!h||h===g.isExpansionSlot,M=v.length===0||!!g.foiling&&v.includes(g.foiling),R=I.length===0||I.some(Y=>g.identifier.includes(Y.toUpperCase())),k=V.length===0||V.includes(g.rarity),U=A.length===0||A.includes(g.set),Ot=E.length===0||g.treatments?.some(Y=>E.includes(Y));return f&&m&&T&&M&&R&&k&&U&&Ot});return{...F,matchingPrintings:B}}));let O=u.length>0?u:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:O,unresolvedFilters:n}};let i=Array.isArray(r)?{additionalHeroes:r,additionalSets:a}:r;this.additionalHeroes=i.additionalHeroes||[],this.additionalSets=i.additionalSets||[],this.cards=[...t],this.index=i.index||we(t)}},Nt=We,Lt=(e,t)=>{let r=!0;for(let a of t){let{isNumber:i,isString:s,isArray:o,isBoolean:n,isDate:p}=a.filterToPropertyMapping;a.isOptional||(i?r=r&&Ma(e,a):s?r=r&&xa(e,a):o?r=r&&Aa(e,a,t):n?r=r&&Pa(e,a):p&&(r=r&&Sa(e,a)))}return r},Bt=(e,t,r)=>{let a=parseInt(t),i;switch(r){case">=":i=e>=a;break;case">":i=e>a;break;case"<=":i=e<=a;break;case"<":i=e<a;break;default:i=e===a}return i},Ma=(e,t)=>{let{filterValues:r,values:a,modifier:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=t,n=!0;if(ae(t,e)){let p=re(e,t),d;if(p!=null&&!isNaN(p)){let u=parseInt(p);d=r?r.some(({modifier:y,value:h})=>Bt(u,h,y)):a.some(y=>Bt(u,y,i))}else{let u=ka(e,t)?.toLowerCase();d=o?a.some(y=>!!u?.includes(y)):a.some(y=>u===y)}n=s?!d:d}return n},xa=(e,t)=>{if(ae(t,e)){let{values:r,valuesSet:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{hasMarkup:o,isNormalized:n,partialMatch:p}}=t,d=re(e,t),u=n?d:d?.replaceAll(P,"").toLowerCase(),y=o&&u?W(u):u;if(p){let h=i?r?.every(v=>y?.includes(v)):r?.some(v=>y?.includes(v));return s?!h:h}else{let h;return i?h=r?.every(v=>y===v):a?h=a.has(y):h=r?.some(v=>y===v),s?!h:h}}else return!0},Aa=(e,t,r)=>{if(ae(t,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=t,n=Ra(e,t,r).map(p=>p?.replaceAll(P,""));if(o){let p=i?a.every(u=>n?.some(y=>y?.toLowerCase().includes(u))):a.some(u=>n?.some(y=>y?.toLowerCase().includes(u))),d=n.length===0;return s?!p||d:p}else{let p=i?a.every(d=>n?.some(u=>u?.toLowerCase()===d)):a.some(d=>n?.some(u=>u?.toLowerCase()===d));return s?!p:p}}else return!0},Pa=(e,t)=>{if(ae(t,e)){let{isExcluded:r}=t,a=re(e,t);return r?!a:a}else return!0},Sa=(e,t)=>{if(ae(t,e)){let{values:r,isExcluded:a}=t,i=re(e,t),s=r?.some(o=>i>o);return a?!s:s}else return!0},re=(e,t)=>{let{filterToPropertyMapping:{property:r}}=t,a;return r!==D&&(a=e[r]),a},Ra=(e,t,r)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i}}=t,s=[],o=Object.keys(e.legalOverrides||{}).length>0,n=t.filterToPropertyMapping.property===j.LegalHeroes,p=r.find(({filterToPropertyMapping:u})=>u.property===j.LegalFormats);if(o&&n&&!!p){let u=new Set;for(let{format:y,heroes:h}of e.legalOverrides||[])if(p.values.includes(y.toLowerCase()))for(let v of h)u.add(v);s=Array.from(u)}if(s.length===0)if(i){let u=new Set;for(let y of e.printings){let h=y[i];if(a){if(Array.isArray(h))for(let v of h)u.add(v)}else h&&typeof h=="string"&&u.add(h)}s=Array.from(u)}else{let u=re(e,t);if(Array.isArray(u))for(let y of u)typeof y=="string"&&s.push(y)}return s},ka=(e,t)=>{let{filterToPropertyMapping:{specialProperty:r}}=t,a;return r&&(a=e[r]),a},ae=({cardTypes:e},{types:t,subtypes:r})=>!e||e?.some(a=>t.map(i=>i.toLowerCase()).includes(a.toLowerCase())||r.map(i=>i.toLowerCase()).includes(a.toLowerCase()));var wa=(e,t,r=[],a=[],i)=>{let{appliedFilters:s,attributes:o,keywords:n}=te(e,t,{additionalHeroes:r,additionalSets:a,today:i});return{appliedFilters:s,attributes:o,keywords:n}};var Va=(e,t)=>{let r=new Set;for(let i of e)for(let s of i.createdExtras||[])r.add(s);let a=[];for(let i of t)r.has(i.cardIdentifier)&&a.push(i);return a};0&&(module.exports={FilterCategory,FilterKind,FilterProperty,MARKUP,NO_CARD_PROPERTY,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,aliasesByFilterCategory,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getAbbreviation,getAbbreviationByCard,getCardsByName,getCardsReferencedBy,getCardsReferencing,getCatalogueIndex,getCleanText,getEscapedForRegExp,getExcludedMetaFilters,getFilterCategory,getFilterMapping,getFilterTokenSpansForKey,getFilterValue,getIncompleteFilterToken,getIsExcludedToken,getIsValueInFilterVocabulary,getKeywordsAndAppliedFiltersFromText,getMetaFilterResolution,getMetaFilters,getNormalizedFilterValue,getNormalizedText,getParsedQuery,getQueryFilterToken,getQueryTokenSpans,getQuotedValue,getResolvedFilterKey,getSuggestedFilterKey,getTextWithoutMarkup,getTokensReferencedByCards,getUnquotedValue,getValuePartsFromFilterValue,getValuesFromFilterValue,multiWordShorthands,shorthands,singleWordShorthands});
1
+ "use strict";var Qt=Object.create;var de=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var _t=(e,t)=>{for(var r in t)de(e,r,{get:t[r],enumerable:!0})},Ye=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of jt(t))!Kt.call(e,s)&&s!==r&&de(e,s,{get:()=>t[s],enumerable:!(a=Ht(t,s))||a.enumerable});return e};var Gt=(e,t,r)=>(r=e!=null?Qt(Ut(e)):{},Ye(t||!e||!e.__esModule?de(r,"default",{value:e,enumerable:!0}):r,e)),$t=e=>Ye(de({},"__esModule",{value:!0}),e);var wa={};_t(wa,{FilterCategory:()=>l,FilterKind:()=>m,FilterProperty:()=>q,MARKUP:()=>Me,NO_CARD_PROPERTY:()=>K,PUNCTUATION:()=>S,RARITY_VALUES_MAPPING:()=>Oe,aliasesByFilterCategory:()=>te,availableExclusions:()=>z,availableModifiers:()=>ke,default:()=>Ot,filterCard:()=>Lt,filtersToCardPropertyMappings:()=>ee,getCardsByName:()=>Ta,getCatalogueIndex:()=>$e,getCleanText:()=>O,getEscapedForRegExp:()=>J,getExcludedMetaFilters:()=>we,getFilterCategory:()=>ae,getFilterMapping:()=>ye,getFilterTokenSpansForKey:()=>ea,getFilterValue:()=>Qe,getIncompleteFilterToken:()=>De,getIsExcludedToken:()=>Jr,getIsValueInFilterVocabulary:()=>Se,getKeywordsAndAppliedFiltersFromText:()=>Sa,getMetaFilterResolution:()=>se,getMetaFilters:()=>dr,getNormalizedFilterValue:()=>w,getNormalizedText:()=>Y,getParsedQuery:()=>ne,getQueryFilterToken:()=>he,getQueryTokenSpans:()=>Ce,getQuotedValue:()=>ra,getResolvedFilterKey:()=>Le,getSuggestedFilterKey:()=>Ve,getTextWithoutMarkup:()=>Z,getTokensReferencedByCards:()=>Va,getUnquotedValue:()=>Fe,getValuePartsFromFilterValue:()=>Vt,getValuesFromFilterValue:()=>He,multiWordShorthands:()=>Ue,shorthands:()=>je,singleWordShorthands:()=>Ke});module.exports=$t(wa);var xe=require("@flesh-and-blood/types"),We=Gt(require("fuse.js"),1);var S=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g,Me=/\*/g;var h=require("@flesh-and-blood/types");var O=e=>Y(e.toLowerCase().trim().replace(S,"")),Y=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),w=e=>e.toLowerCase().replace(S,""),Z=e=>e.replace(Me,""),J=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&");var l={Arcane:"arcane",Artist:"artist",Banned:"banned",Bond:"bond",Class:"class",Cost:"cost",CreatedBy:"createdby",Creates:"creates",Defense:"defense",Flow:"flow",Foiling:"foiling",Fusion:"fusion",Intellect:"intellect",Is:"is",Keyword:"keyword",Legal:"legal",Life:"life",Name:"name",Pitch:"pitch",Power:"power",Print:"print",Rarity:"rarity",ReferencedBy:"referencedby",References:"references",Set:"set",Shorthand:"shorthand",Specialization:"specialization",Subtype:"subtype",Talent:"talent",Text:"text",Trait:"trait",Treatment:"treatment",Type:"type",TypeText:"typetext",Year:"year"},m={Comparator:"comparator",ExactMatch:"exactMatch",PartialMatch:"partialMatch"},ke=[">=",">","<=","<"],z=["!","-"],K="n/a",ft=[...Object.values(h.Format),...Object.values(h.Hero)],zt={category:l.Arcane,canonicalAlias:"arcane",kind:m.Comparator,property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},Ae={category:l.Artist,canonicalAlias:"art",kind:m.PartialMatch,property:"artists",isArray:!0,partialMatch:!0},qe={category:l.Banned,canonicalAlias:"banned",kind:m.ExactMatch,vocabulary:ft,property:K,isMeta:!0},Xe={category:l.Bond,canonicalAlias:"bond",kind:m.ExactMatch,vocabulary:Object.values(h.Bond),property:"bonds",isArray:!0},Ze={category:l.Class,canonicalAlias:"c",kind:m.PartialMatch,vocabulary:Object.values(h.Class),property:"classes",isArray:!0,partialMatch:!0},Je={category:l.Cost,canonicalAlias:"co",kind:m.Comparator,property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},et={category:l.CreatedBy,canonicalAlias:"createdby",kind:m.PartialMatch,property:K},tt={category:l.Creates,canonicalAlias:"creates",kind:m.PartialMatch,property:K},re={category:l.Defense,canonicalAlias:"d",kind:m.Comparator,property:"defense",specialProperty:"specialDefense",isNumber:!0},rt={category:l.Flow,canonicalAlias:"flow",kind:m.ExactMatch,vocabulary:Object.values(h.Flow),property:"flows",isArray:!0},at={category:l.Foiling,canonicalAlias:"foil",kind:m.ExactMatch,vocabulary:Object.values(h.Foiling),nestedProperty:"foiling",property:"printings",isArray:!0},st={category:l.Fusion,canonicalAlias:"f",kind:m.ExactMatch,vocabulary:Object.values(h.Fusion),property:"fusions",isArray:!0},it={category:l.Intellect,canonicalAlias:"i",kind:m.Comparator,property:"intellect",isNumber:!0},nt={category:l.Keyword,canonicalAlias:"k",kind:m.ExactMatch,vocabulary:Object.values(h.Keyword),property:"keywords",isArray:!0},be={category:l.Legal,canonicalAlias:"l",kind:m.ExactMatch,vocabulary:ft,property:K,isMeta:!0},ot={category:l.Life,canonicalAlias:"li",kind:m.Comparator,property:"life",specialProperty:"specialLife",isNumber:!0},lt={category:l.Is,canonicalAlias:"is",kind:m.ExactMatch,vocabulary:Object.values(h.Meta),property:"meta",isArray:!0},dt={category:l.Name,canonicalAlias:"name",kind:m.PartialMatch,property:"name",isString:!0,partialMatch:!0},Pe={category:l.Pitch,canonicalAlias:"p",kind:m.Comparator,property:"pitch",isNumber:!0},ce={category:l.Power,canonicalAlias:"pwr",kind:m.Comparator,property:"power",specialProperty:"specialPower",isNumber:!0},pe={category:l.Print,canonicalAlias:"print",kind:m.PartialMatch,property:"setIdentifiers",isArray:!0,partialMatch:!0},ct={category:l.Rarity,canonicalAlias:"r",kind:m.ExactMatch,vocabulary:Object.values(h.Rarity),property:K,isMeta:!0},Wt={category:l.ReferencedBy,canonicalAlias:"referencedby",kind:m.PartialMatch,property:K},Yt={category:l.References,canonicalAlias:"references",kind:m.PartialMatch,property:K},pt={category:l.Set,canonicalAlias:"s",kind:m.PartialMatch,vocabulary:Object.values(h.Release),property:"sets",isArray:!0,partialMatch:!0},ve={category:l.Shorthand,canonicalAlias:"short",kind:m.PartialMatch,vocabulary:Object.values(h.Shorthand),property:"shorthands",isArray:!0,partialMatch:!0},ue={category:l.Specialization,canonicalAlias:"sp",kind:m.PartialMatch,vocabulary:Object.values(h.Hero),property:"specializations",isArray:!0,partialMatch:!0},ut={category:l.Subtype,canonicalAlias:"st",kind:m.ExactMatch,vocabulary:Object.values(h.Subtype),property:"subtypes",isArray:!0},gt={category:l.Type,canonicalAlias:"t",kind:m.ExactMatch,vocabulary:Object.values(h.Type),property:"types",isArray:!0},Re={category:l.Talent,canonicalAlias:"tal",kind:m.ExactMatch,vocabulary:Object.values(h.Talent),property:"talents",isArray:!0},qt={category:l.Text,canonicalAlias:"text",kind:m.PartialMatch,property:"functionalText",hasMarkup:!0,isString:!0,partialMatch:!0},Xt={category:l.Trait,canonicalAlias:"trait",kind:m.PartialMatch,vocabulary:Object.values(h.Trait),property:"traits",isArray:!0,partialMatch:!0},yt={category:l.TypeText,canonicalAlias:"x",kind:m.PartialMatch,property:"typeText",isString:!0,partialMatch:!0},ge={category:l.Treatment,canonicalAlias:"treatment",kind:m.ExactMatch,vocabulary:Object.values(h.Treatment),nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},Zt={category:l.Year,canonicalAlias:"year",kind:m.PartialMatch,property:"firstReleaseDate",isString:!0,partialMatch:!0},ee={arcane:zt,a:Ae,artist:Ae,art:Ae,attack:ce,b:re,block:re,banned:qe,bond:Xe,bonds:Xe,c:Ze,class:Ze,co:Je,cost:Je,createdby:et,creates:tt,color:Pe,d:re,def:re,defense:re,flow:rt,flows:rt,f:st,fusion:st,foil:at,foiling:at,i:it,intellect:it,is:lt,k:nt,keyword:nt,l:be,legal:be,hero:be,li:ot,life:ot,madeby:et,makes:tt,meta:lt,n:dt,name:dt,p:Pe,pitch:Pe,pwr:ce,pow:ce,power:ce,print:pe,printing:pe,printings:pe,prints:pe,r:ct,rarity:ct,referencedby:Wt,references:Yt,rf:qe,s:pt,set:pt,short:ve,shorthand:ve,shorthands:ve,sp:ue,spec:ue,specialization:ue,specializations:ue,st:ut,subtype:ut,t:gt,type:gt,tal:Re,talent:Re,talents:Re,text:qt,trait:Xt,treat:ge,treatment:ge,var:ge,variation:ge,x:yt,typetext:yt,year:Zt},Jt=new Map(Object.entries(ee)),ye=e=>Jt.get(e.toLowerCase()),ae=e=>ye(e)?.category,er=()=>{let e=Object.create(null);for(let[t,{category:r}]of Object.entries(ee)){let a=e[r];a?a.push(t):e[r]=[t]}return e},te=er(),tr=()=>{let e=new Map,t=new Set,r=Object.values(ee);for(let a of r){let{vocabulary:s}=a;if(s&&!t.has(a)){t.add(a);for(let i of s){let n=w(i),o=e.get(n);o?o.push(a):e.set(n,[a])}}}return e},mt=tr(),Se=(e,t)=>!!mt.get(w(t))?.some(r=>r.category===e),rr=(e,t)=>{let r=[],a=!0;for(let s of t){let i=(mt.get(w(s))||[]).filter(n=>n.category!==e);r=a?i:r.filter(n=>i.includes(n)),a=!1}return r},Ve=(e,t)=>{let r=rr(e,t),[a]=r;return r.length===1?a.canonicalAlias:void 0};var ie=require("@flesh-and-blood/types");var d=require("@flesh-and-blood/types");var N=require("@flesh-and-blood/types");var q={BannedFormats:"bannedFormats",LegalFormats:"legalFormats",LegalHeroes:"legalHeroes"},fe=Array.from(Array(50).keys()).map(e=>`${e}`),ar=[{format:N.Format.ClassicConstructed,nicknames:["cc","classic"]},{format:N.Format.LivingLegend,nicknames:["cc ll","classic constructed ll","ll cc","ll","living legend"]},{format:N.Format.SilverAge,nicknames:["sage"]},{format:N.Format.GoldenAge,nicknames:["gage"]},{format:N.Format.UltimatePitFight,nicknames:["upf"]}],sr=Object.values(N.Format).map(e=>{let t=ar.find(({format:a})=>a===e),r=e.toLowerCase().replaceAll(S,"");return t?{...t,format:r}:{format:r}}),ir=Object.values(N.Hero).map(O),Ct=e=>e.replaceAll(" ",""),nr=(e,t)=>{let r=Ct(e),a,s=[];for(let n of t){let o=Ct(n);o===r?a=n:o.startsWith(r)&&s.push(n)}let i=s.length===1;return a??(i?s[0]:void 0)},ht=["common","rare","super rare","majestic","legendary","fabled"],or=({modifier:e,value:t})=>{let r=[],a=e==="<"||e==="<=",s=e===">="||e==="<=",i=a?[...ht].reverse():ht,n=!1;for(let o of i)n?r.push(o):o===t&&(n=!0,s&&r.push(o));return r},lr=(e,t)=>{let r=[];for(let a of e)a.modifier?r.push(...or(a)):r.push(a.value);return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOr:!0,values:r}},Ft=(e,t,r,a)=>{let s=new Set([...ir,...r.map(O)]),i=[],n=[],o=[],p=[];for(let{value:f}of e){let u=sr.find(({format:y,nicknames:F})=>y===f||!!F&&F.includes(f));if(u)n.push(u.format);else{let y=nr(f,s);y?o.push(y):p.push(f)}}return n.length>0&&i.push({filterToPropertyMapping:{property:a,isArray:!0},values:n,isOr:!0,isExcluded:t}),o.length>0&&i.push({filterToPropertyMapping:{property:q.LegalHeroes,isArray:!0},values:o,isOr:!0,isExcluded:t}),{appliedFilters:i,unresolvedValues:p}},se=(e,t,{additionalHeroes:r=[],isExcluded:a=!1}={})=>{let s=ae(e),i={appliedFilters:[],unresolvedValues:[]};return s===l.Legal?i=Ft(t,a,r,q.LegalFormats):s===l.Banned?i=Ft(t,a,r,q.BannedFormats):s===l.Rarity&&(i={appliedFilters:[lr(t,a)],unresolvedValues:[]}),i},dr=(e,t,r,a,s,i)=>se(r,a.map(n=>({modifier:s,value:n})),{additionalHeroes:i,isExcluded:e}).appliedFilters,cr=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"specialCost",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]}],pr=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"specialDefense",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["hero","placeholder","token","weapon"]}],ur=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],gr=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"specialPower",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token"]}],yr=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(N.Talent).map(e=>e.toLowerCase())}],fr=[{filterToPropertyMapping:{property:"classes",isArray:!0},isExcluded:!0,values:Object.values(N.Class).map(e=>e.toLowerCase())}],mr=[{category:l.Class,filters:fr},{category:l.Cost,filters:cr},{category:l.Defense,filters:pr},{category:l.Pitch,filters:ur},{category:l.Power,filters:gr},{category:l.Talent,filters:yr}],Cr=()=>{let e=new Map;for(let{category:t,filters:r}of mr)for(let a of te[t])for(let s of z)e.set(`${s}${a}`,r);return e},hr=Cr(),we=e=>{let t=[],r=hr.get(e);return r&&t.push(...r),t};var Fr=e=>{let[t]=e,r=t?.modifier;return e.every(({modifier:s})=>s===r)?r:void 0},Ee=({filterValues:e,isAnd:t,isExcluded:r,mapping:a})=>{let s=[];for(let{value:i}of e)s.push(a.hasMarkup?Z(i):i);return{filterToPropertyMapping:a,filterValues:e,isAnd:t,isExcluded:r,isOr:!t&&s.length>1,modifier:Fr(e),values:s}},At=({isAnd:e,isExcluded:t,mapping:r},a)=>({filterToPropertyMapping:r,isAnd:e,isExcluded:t,isOr:!e&&a.length>1,values:a}),Tr=({category:e,filterValues:t,mapping:r})=>{let a=[];if(r.kind===m.ExactMatch&&!!r.vocabulary)for(let{value:i}of t)Se(e,i)||a.push(i);return a},xr=e=>({appliedFilters:[Ee(e)],unresolvedValues:Tr(e)}),Ne=({isExcluded:e},t,r)=>e?void 0:{[t]:r},bt=(e,t)=>({appliedFilters:[Ee(e)],attributes:Ne(e,t,e.filterValues.map(({value:r})=>r)),unresolvedValues:[]}),Mr=e=>bt(e,"artists"),Ar=e=>bt(e,"prints"),Be=(e,t,r)=>{let a=[],s=[],i=[];for(let{value:n}of e.filterValues){let o=r(n);if(o.length>0)for(let p of o)a.push(p),s.push(w(p));else i.push(n)}return{appliedFilters:[At(e,s)],attributes:Ne(e,t,a),canonicalValues:s,unresolvedValues:i}},br=new Map(Object.entries({purple:4,blue:3,yellow:2,red:1,white:0})),Pr=e=>{let t=[],r=[];for(let{modifier:a,value:s}of e.filterValues){let i=br.get(s),n=i===void 0?s:`${i}`;t.push({modifier:a,value:n}),r.push(n)}return{appliedFilters:[Ee({...e,filterValues:t})],canonicalValues:r,unresolvedValues:[]}},Ie=new Map;for(let e of Object.values(d.Release)){let t=w(e),r=Ie.get(t);if(r===void 0)Ie.set(t,e);else throw new Error(`${r} and ${e} are one name as a filter reads it, so a set filter naming it could reach either`)}var Tt=(e,t)=>{let r=e.get(t);return r?[r]:[]},vr=(e,t)=>{let r=[()=>Tt(Ie,e),()=>Tt(d.setIdentifierToSetMappings,e),()=>Object.values(d.Release).filter(s=>s.toLowerCase().includes(e)),()=>{let s=t.find(i=>w(i)===e);return s?[s]:[]}],a=[];for(let s of r)a.length===0&&a.push(...s());return a},Rr=(e,{additionalSets:t})=>Be(e,"releases",r=>vr(r,t)),kr=new Map(Object.entries({r:d.Foiling.Rainbow,rf:d.Foiling.Rainbow,rainbow:d.Foiling.Rainbow,c:d.Foiling.Cold,cf:d.Foiling.Cold,cold:d.Foiling.Cold,g:d.Foiling.Gold,gf:d.Foiling.Gold,gold:d.Foiling.Gold})),Sr=e=>{let t=kr.get(e);return t?[t]:[]},Vr=e=>Be(e,"foilings",Sr),Pt=new Map(Object.entries({aa:d.Treatment.AA,alt:d.Treatment.AA,"alt art":d.Treatment.AA,ab:d.Treatment.AB,"alt border":d.Treatment.AB,at:d.Treatment.AT,"alt text":d.Treatment.AT,ea:d.Treatment.EA,extended:d.Treatment.EA,"extended art":d.Treatment.EA,fa:d.Treatment.FA,full:d.Treatment.FA,"full art":d.Treatment.FA}));for(let e of Object.values(d.Treatment))Pt.set(e.toLowerCase(),e);var wr=new Map(Object.entries(d.Treatment)),Ir=e=>{let t=Pt.get(e)||wr.get(e.toUpperCase());return t?[t]:[]},Er=e=>Be(e,"treatments",Ir),Oe=new Map(Object.entries({b:d.Rarity.Basic,c:d.Rarity.Common,f:d.Rarity.Fabled,l:d.Rarity.Legendary,m:d.Rarity.Majestic,p:d.Rarity.Promo,r:d.Rarity.Rare,s:d.Rarity.SuperRare,t:d.Rarity.Token,v:d.Rarity.Marvel})),Nr=e=>Oe.get(e)||Object.values(d.Rarity).find(t=>t.toLowerCase()===e),Br=(e,{additionalHeroes:t})=>{let r=[],a=[],s=[],i=[];for(let{modifier:o,value:p}of e.filterValues){let f=Nr(p);f?(r.push(f),a.push(f.toLowerCase()),s.push({modifier:o,value:f.toLowerCase()})):(i.push(p),s.push({modifier:o,value:p}))}let{appliedFilters:n}=se(e.key,s,{additionalHeroes:t,isExcluded:e.isExcluded});return{appliedFilters:n,attributes:Ne(e,"rarities",r),canonicalValues:a,unresolvedValues:i}},xt=({filterValues:e,isExcluded:t,key:r},{additionalHeroes:a})=>{let{appliedFilters:s,unresolvedValues:i}=se(r,e,{additionalHeroes:a,isExcluded:t}),n=[];for(let{values:o}of s)n.push(...o);return{appliedFilters:s,canonicalValues:n,unresolvedValues:i}},Or=["unique"],Lr=["preview","spoiler","unreleased"],Dr=["released"],Mt={property:"firstReleaseDate",isDate:!0},Qr=new Map(Object.entries({dual:d.Meta.DualClass,exp:d.Meta.Expansion,expansion:d.Meta.Expansion,rainbow:d.Meta.Rainbow,reprint:d.Meta.Reprint,reprints:d.Meta.Reprint})),Hr=e=>{let t=[],r=[];for(let s of e){let i=Qr.get(s);i?t.push(i):r.push(s)}let a=[];if(t.length===0){let s=new Set;for(let i of Object.values(d.Meta)){let n=!1;for(let o of r)i.toLowerCase().includes(o)&&(n=!0,s.add(o));n&&t.push(i)}for(let i of r)s.has(i)||a.push(i)}else a.push(...r);return{unresolvedValues:a,values:t}},jr=(e,{today:t})=>{let{filterValues:r,isAnd:a,isExcluded:s}=e,i=[],n=[],o=[],p=[],f=[];for(let{value:b}of r)Or.includes(b)?n.push(b):Lr.includes(b)?o.push(b):Dr.includes(b)?p.push(b):f.push(b);let u=!a&&r.length>1;n.length>0&&i.push({filterToPropertyMapping:ee.is,values:[w(d.Meta.Reprint)],isAnd:a,isOr:u,isExcluded:!s}),o.length>0&&i.push({filterToPropertyMapping:Mt,values:[t],isAnd:a,isOr:u,isExcluded:s}),p.length>0&&i.push({filterToPropertyMapping:Mt,values:[t],isAnd:a,isOr:u,isExcluded:!s});let{unresolvedValues:y,values:F}=Hr(f),x=[...n,...o,...p,...F.map(w)];(f.length>0||i.length===0)&&i.push(At(e,F.map(w)));let I=F.includes(d.Meta.Expansion)&&!s;return{appliedFilters:i,attributes:I?{isExpansionSlot:I}:void 0,canonicalValues:x,unresolvedValues:y}},Ur={property:"cardIdentifier",isString:!0,isNormalized:!0},Kr=(e,t)=>{let r=e.getCardsByExactName(t);return r.length===0&&(r=e.getCardsByGroup(t)),r.length===0&&(r=e.getCardsByName(t)),r},_r=(e,t,r)=>{let a=new Set;for(let s of Kr(e,t))for(let i of r(e,s.cardIdentifier))if(!a.has(i.cardIdentifier))for(let o of e.getPitchCycle(i.cardIdentifier))a.add(o.cardIdentifier);return a},Gr=(e,t)=>{let r=new Set,[a=new Set,...s]=e;if(t)for(let i of a)s.every(o=>o.has(i))&&r.add(i);else for(let i of e)for(let n of i)r.add(n);return r},$r=(e,t)=>({filterToPropertyMapping:Ur,values:[...e],valuesSet:e,isExcluded:t,isOr:!0}),me=e=>({filterValues:t,isAnd:r,isExcluded:a},{index:s})=>{let i=[],n=[];for(let{value:o}of t){let p=_r(s,o,e);i.push(p),p.size===0&&n.push(o)}return{appliedFilters:[$r(Gr(i,r),a)],unresolvedValues:n}},zr=new Map([[l.Artist,Mr],[l.Banned,xt],[l.CreatedBy,me((e,t)=>e.getCreates(t))],[l.Creates,me((e,t)=>e.getCreatedBy(t))],[l.Foiling,Vr],[l.Is,jr],[l.Legal,xt],[l.Pitch,Pr],[l.Print,Ar],[l.Rarity,Br],[l.ReferencedBy,me((e,t)=>e.getReferences(t))],[l.References,me((e,t)=>e.getReferencedBy(t))],[l.Set,Rr],[l.Treatment,Er]]),vt=(e,t)=>(zr.get(e.category)||xr)(e,t);var kt=z.map(J).join(""),Wr=/(?:[^\s"]+|"[^"]*(?:"|$))+/g,Yr=new RegExp(`^([${kt}])?([A-Za-z]+):(.+)$`),qr=new RegExp(`^([${kt}])?([A-Za-z]+):$`),Xr=",",Rt="+",Zr='"',St=e=>{let t=[],r=!1,a="",s=!1;for(let i of e)i===Zr?(s=!s,a+=i):!s&&(i===Xr||i===Rt)?(r=r||i===Rt,a&&t.push(a),a=""):a+=i;return a&&t.push(a),{isAndList:r,parts:t}},Ce=e=>{let t=[];for(let r of e.matchAll(Wr))t.push({end:r.index+r[0].length,start:r.index,token:r[0]});return t},Jr=e=>z.some(t=>e.startsWith(t)),he=e=>{let t=e.match(Yr),r;if(t){let[,a,s,i]=t;r={isAndList:St(i).isAndList,isExcluded:!!a,key:s,valueText:i}}return r},De=e=>{let t=e.match(qr),r;return t&&(r={isAndList:!1,isExcluded:!!t[1],key:t[2],valueText:""}),r},Qe=e=>{let t=e.trim(),r=ke.find(a=>t.startsWith(a));return{modifier:r,value:r?t.slice(r.length).trim():t}},Le=e=>ae(e)??e.toLowerCase(),ea=(e,t)=>{let r=Le(t),a=[];for(let{end:s,start:i,token:n}of Ce(e)){let o=he(n);o&&Le(o.key)===r&&a.push({...o,end:s,start:i,token:n})}return a},Vt=e=>St(e).parts,Fe=e=>e.replace(/^"|"$/g,""),He=e=>{let t=[];for(let r of Vt(e)){let a=Fe(r);a&&t.push(a)}return t},ta=/[\s,:+"]/,ra=e=>{let t=e.replaceAll('"',"");return ta.test(e)?`"${t}"`:t};var D=require("@flesh-and-blood/types"),je=[{description:"Attack actions",expanded:["st:attack"],filters:{subtypes:[D.Subtype.Attack]},isCardProperty:!1,shorthands:["AA"]},{description:"Arcane barrier",expanded:['k:"arcane barrier"'],filters:{keywords:[D.Keyword.ArcaneBarrier]},isCardProperty:!1,shorthands:["AB"]},{description:"Attack reactions",expanded:['t:"attack reaction"'],filters:{types:[D.Type.AttackReaction]},isCardProperty:!1,shorthands:["AR"]},{description:"Defense reactions",expanded:['t:"defense reaction"'],filters:{types:[D.Type.DefenseReaction]},isCardProperty:!1,shorthands:["DR"]},{description:"Gain life",expanded:["gain {h}"],filters:{functionalText:"gain {h}"},isCardProperty:!1,shorthands:["Gain life","Gains life"]},{description:"Go again",expanded:['k:"go again"'],filters:{keywords:[D.Keyword.GoAgain]},isCardProperty:!1,shorthands:["GA"]},{description:"Non-attack actions",expanded:["t:action","st:non-attack"],filters:{subtypes:[D.Subtype.NonAttack],types:[D.Type.Action]},isCardProperty:!1,shorthands:["NAA"]},{description:"Plus defense",expanded:["+ {d}"],filters:{functionalText:"+ {d}"},isCardProperty:!1,shorthands:["Pump defense","Pumps defense","Buff defense","Buffs defense"]},{description:"Spellvoid",expanded:['k:"spellvoid"'],filters:{keywords:[D.Keyword.Spellvoid]},isCardProperty:!1,shorthands:["SV"]}],Ue=je.filter(({shorthands:e})=>e.some(t=>t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)})),Ke=je.filter(({shorthands:e})=>e.some(t=>!t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>!t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)}));var aa=["\u201C","\u201D"],sa=[{text:ie.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:ie.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(S,"")}],_e=new Map([...ie.setToSetIdentifierMappings].map(([e,t])=>[e.toLowerCase(),t])),ia=[...te[l.Set],...te[l.Print]],na=z.map(J).join(""),oa=[..._e.keys()].sort((e,t)=>t.length-e.length).map(J).join("|"),la=new RegExp(`(?<=^|\\s)([${na}]?(?:${ia.join("|")}):(?:[^\\s]*[,+])?"?)(${oa})(?="?(?:[,+]|\\s|$))`,"g"),da=(e,t)=>{let r=e.trim().toLowerCase();for(let i of aa)r=r.replaceAll(i,'"');for(let{expanded:i,shorthands:n}of Ue)for(let o of n)if(r.includes(o)){r=r.replace(o,i.join(" "));break}r=r.replace(la,(i,n,o)=>{let p=_e.get(o);return p?`${n}${p[0]}`:i});let a=_e.get(r),s=t.getCardsByExactName(r).length>0;a&&!s&&(r=`set:${a[0]}`);for(let{override:i,text:n}of sa)r.includes(n)&&(r=r.replace(n,i));return r},ca=e=>{let t=Ke.find(({shorthands:a})=>a.includes(e)),r=!!t&&!t.isCardProperty;return{isExpanded:r,tokens:r?t.expanded:[e]}},pa=e=>{let t=[];for(let{end:r,start:a,token:s}of Ce(e)){let{isExpanded:i,tokens:n}=ca(s);for(let o of n)t.push({end:r,isExpanded:i,start:a,token:o})}return t},ua=e=>{let t=[];for(let r of e){let{modifier:a,value:s}=Qe(r),i=w(s);i&&t.push({modifier:a,value:i})}return t},ga=(e,t,r)=>{let a={key:e,reason:"value",values:r},s=Ve(t,r);return s&&(a.suggestedKey=s),a},ya=()=>{let e=new Date,t=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${t}-${r}`},ne=(e,t,{additionalHeroes:r=[],additionalSets:a=[],today:s=ya()}={})=>{let i=da(e,t),n={additionalHeroes:r,additionalSets:a,index:t,today:s},o=[],p={artists:[],foilings:[],isExpansionSlot:!1,prints:[],rarities:[],releases:[],treatments:[]},f=[],u=[],y=[];for(let F of pa(i)){let x=he(F.token)||De(F.token);if(x){let{isAndList:H,isExcluded:I,key:b,valueText:L}=x,B=ye(b),j=B?.category,_=He(L),W=ua(_),G={...F,canonicalValues:W.map(({value:T})=>T),category:j,filterValues:W,isAnd:H,isExcluded:I,isFilter:!0,isResolved:!0,key:b};if(_.length>0)if(B&&j){let T=_;if(W.length>0){let v=vt({category:j,filterValues:W,isAnd:G.isAnd,isExcluded:I,key:b,mapping:B},n);o.push(...v.appliedFilters),v.canonicalValues&&(G.canonicalValues=v.canonicalValues),v.attributes&&Object.assign(p,v.attributes),T=v.unresolvedValues}T.length>0&&(G.isResolved=!1,y.push(ga(b,j,T)))}else G.isResolved=!1,y.push({key:b,reason:"key",values:[]});u.push(G)}else{let{end:H,start:I,token:b}=F;u.push({end:H,isFilter:!1,start:I,token:b});let L=Fe(F.token),B=we(L);B.length>0?o.push(...B):L&&f.push(L.replace(S,""))}}return{appliedFilters:o,attributes:p,keywords:f,nodes:u,text:i,unresolvedFilters:y}};var A=require("@flesh-and-blood/types"),wt={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[A.Class.Generic],defaultImage:"FNG000",firstReleaseDate:"2022-06-02",functionalText:"If Fangs A Lot is put into your banished zone from your graveyard, instead put it into your hand.",legalFormats:[],legalHeroes:[A.Hero.Kayo,A.Hero.Levia,A.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:A.Rarity.Rare,set:A.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${A.Treatment.FA}`,rarity:A.Rarity.Marvel,set:A.Release.Promos,treatments:[A.Treatment.FA]}],name:"Fangs A Lot",rarities:[A.Rarity.Rare,A.Rarity.Marvel],rarity:A.Rarity.Rare,sets:[A.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[A.Subtype.Attack],types:[A.Type.Action],typeText:"Generic Action - Attack"},It=[{keyword:wt.name.toLowerCase(),card:wt}];var X=require("@flesh-and-blood/types");var fa=3,ma=e=>{let t=Y(e.toLowerCase()).replace(/[^a-z\s-]/g,""),r=new Set;for(let a of[/[\s-]+/,/\s+/]){let s="";for(let i of t.split(a)){let n=i.replaceAll("-","");n&&(s+=n[0])}s.length>=fa&&r.add(s)}return[...r]},Te=e=>O(e).replaceAll("-",""),Ge=(e,t,r)=>{let a=e.get(t);a?a.push(r):e.set(t,[r])},Et=new WeakMap,Q=Object.freeze([]),Ca=Number.MAX_SAFE_INTEGER,Nt=(e,t)=>{let r=new Map;for(let a of e)for(let s of t(a)||[]){let i=r.get(s);i?i.push(a):r.set(s,[a])}return r},ha=e=>{let t=new Map;for(let r of e){let a=r.types.includes(X.Type.Hero)&&!r.isCardBack,s=a?X.CardRole.Hero:(0,X.getCardRole)(r);if(a||s!==X.CardRole.Hero){let n=t.get(s);n?n.push(r):t.set(s,[r])}}return t},Fa=e=>{let t,r,a,s,i,n,o,p,f=()=>{if(!t){let g=new Map,c=new Map,C=[],M=new Map,P=0;for(let E of e){g.set(E.cardIdentifier,E),c.set(E.cardIdentifier,P),P++;let V=O(E.name),U=M.get(V);U?U.push(E):(M.set(V,[E]),C.push(V))}t={cardByCardIdentifier:g,corpusPositionByCardIdentifier:c,cleanedNames:C,pitchCycleByCleanedName:M}}return t},u=g=>{let{corpusPositionByCardIdentifier:c}=f(),C=({cardIdentifier:M})=>c.get(M)??Ca;return[...g].sort((M,P)=>C(M)-C(P))},y=g=>f().cardByCardIdentifier.get(g),F=g=>{let{cardByCardIdentifier:c}=f(),C=[];for(let M of g||[]){let P=c.get(M);P&&C.push(P)}return u(C)},x=g=>{let c=new Map;return C=>{let M=c.get(C);if(!M){let P=y(C),E=F(P&&g(P)),V=E.length>0;M=V?E:Q,V&&c.set(C,M)}return M}},H=g=>{let{pitchCycleByCleanedName:c}=f(),C=y(g);return C?c.get(O(C.name))??Q:Q},I=g=>{let{cleanedNames:c,pitchCycleByCleanedName:C}=f(),M=O(g),P=C.get(M);if(!P&&M.length>0){let V=c.find(U=>U.includes(M));V&&(P=C.get(V))}return P??Q},b=g=>{let{pitchCycleByCleanedName:c}=f();return c.get(O(g))??Q},L=g=>{if(!n){n=new Map;for(let c of e)for(let C of c.nicknames??[])Ge(n,Te(C),c)}return n.get(Te(g))??Q},B=g=>{if(!o){o=new Map;for(let c of e)for(let C of[...c.types,...c.subtypes,...c.traits??[]])Ge(o,Te(C),c)}return o.get(Te(g))??Q},j=g=>{if(!p){p=new Map;for(let c of e)for(let C of ma(c.name))Ge(p,C,c)}return p.get(g)??Q},_=()=>{if(!i){let g=new Set;for(let c of e)for(let C of c.artists)g.add(C);i=[...g].sort((c,C)=>c.localeCompare(C,"en",{sensitivity:"base"}))}return i},W=x(({oppositeSideCardIdentifiers:g})=>g),G=x(({referencedCards:g})=>g),T=g=>(r||(r=Nt(e,({referencedCards:c})=>c)),r.get(g)??Q),v=x(({createdExtras:g})=>g);return{cards:e,getCard:y,getPitchCycle:H,getCardsByName:I,getCardsByExactName:b,getCardsByNickname:L,getCardsByGroup:B,getCardsByInitials:j,getArtists:_,getOppositeSide:W,getReferences:G,getReferencedBy:T,getCreates:v,getCreatedBy:g=>(a||(a=Nt(e,({createdExtras:c})=>c)),a.get(g)??Q),getCreatedClosure:g=>{let c=new Map,C=new Set,M=[...g];for(let P of M)if(!C.has(P)){C.add(P);for(let V of v(P))c.set(V.cardIdentifier,V),M.push(V.cardIdentifier)}return u([...c.values()])},getByRole:g=>(s||(s=ha(e)),s.get(g)??Q),getCardsInCorpusOrder:u}},$e=e=>{let t=Et.get(e);return t||(t=Fa(e),Et.set(e,t)),t},Ta=(e,t)=>e.getCardsByName(t);var xa={getFn:(e,t)=>{let r=We.default.config.getFn(e,t),a=r;if(Array.isArray(r))a=r.map(s=>{let i=typeof s=="string"?s:s.v;return Y(i.replace(S,""))});else if(r){let s=Y(r).replace(S,"");a=t.includes("functionalText")?Z(s):s}return a},ignoreLocation:!0,includeScore:!0,keys:[{name:"name",weight:10},{name:"functionalText",weight:6},{name:"shorthands",weight:4},{name:"setIdentifiers",weight:2},{name:"traits",weight:4},{name:"typeText",weight:6}],threshold:.15,useExtendedSearch:!0},ze=class{constructor(t,r=[],a=[]){this.getFuse=()=>(this.fuse||(this.fuse=new We.default(this.cards,xa)),this.fuse);this.getPoolCards=t=>{this.poolCardByCardIdentifier||(this.poolCardByCardIdentifier=new Map(this.cards.map(a=>[a.cardIdentifier,a])));let r=[];for(let{cardIdentifier:a}of t){let s=this.poolCardByCardIdentifier.get(a);s&&r.push(s)}return r};this.search=(t,r)=>{let a,s,{appliedFilters:i,attributes:n,keywords:o,unresolvedFilters:p}=ne(t,this.index,{additionalHeroes:this.additionalHeroes,additionalSets:this.additionalSets}),f=o.join(" "),u=r?It.filter(T=>T.keyword===f):[],y=T=>i.length>0?T.filter(v=>v&&Lt(v,i)):T;if(u.length>0)a=y(u.map(({card:T})=>T));else if(o.length){let T=O(f),v=this.getPoolCards(this.index.getCardsByNickname(T)),k=new Map;for(let c of[...this.getPoolCards(this.index.getCardsByExactName(T)),...v])k.set(c.cardIdentifier,c);let R=this.getFuse().search(f).map(c=>c.item).filter(({cardIdentifier:c})=>!k.has(c));a=y([...k.values(),...R]),a.some(c=>v.includes(c))&&(s={kind:"nickname",text:T}),a.length===0&&o.length===1&&(a=y(this.getPoolCards(this.index.getCardsByInitials(T))),a.length>0&&(s={kind:"initials",text:T}))}else a=y([...this.cards]);if(!(o.length>0&&s?.kind!=="initials")){let T="";if(n.releases.length===1){let R=xe.setToSetIdentifierMappings.get(n.releases[0]);R?.length&&(T=R[0].toUpperCase())}if(!T&&n.prints.length===1){let R=n.prints[0];xe.setIdentifierToSetMappings.has(R)&&(T=R.toUpperCase())}T?a.sort((R,$)=>{let g=R.setIdentifiers.find(C=>C.includes(T))?.replace(T,""),c=$.setIdentifiers.find(C=>C.includes(T))?.replace(T,"");return g&&c?g.localeCompare(c):-1}):a.sort((R,$)=>R.name===$.name?`${R.pitch}`.localeCompare(`${$.pitch}`):R.name.localeCompare($.name))}let x=[],{artists:H,isExpansionSlot:I,foilings:b,prints:L,rarities:B,releases:j,treatments:_}=n;(H.length>0||I||b.length>0||L.length>0||B.length>0||j.length>0||_.length>0)&&(x=a.map(T=>{let v=T.printings.filter(k=>{let R=!!k.image,$=H.length===0||H.some(U=>k.artists.find(Dt=>Dt.replace(S,"").toLowerCase().includes(U))),g=!I||I===k.isExpansionSlot,c=b.length===0||!!k.foiling&&b.includes(k.foiling),C=L.length===0||L.some(U=>k.identifier.includes(U.toUpperCase())),M=B.length===0||B.includes(k.rarity),P=j.length===0||j.includes(k.set),E=_.length===0||k.treatments?.some(U=>_.includes(U));return R&&$&&g&&c&&C&&M&&P&&E});return{...T,matchingPrintings:v}}));let G=x.length>0?x:a;return{alias:s,appliedFilters:i,attributes:n,keywords:o,searchResults:G,unresolvedFilters:p}};let s=Array.isArray(r)?{additionalHeroes:r,additionalSets:a}:r;this.additionalHeroes=s.additionalHeroes||[],this.additionalSets=s.additionalSets||[],this.cards=[...t],this.index=s.index||$e(t)}},Ot=ze,Lt=(e,t)=>{let r=!0;for(let a of t){let{isNumber:s,isString:i,isArray:n,isBoolean:o,isDate:p}=a.filterToPropertyMapping;a.isOptional||(s?r=r&&Ma(e,a):i?r=r&&Aa(e,a):n?r=r&&ba(e,a,t):o?r=r&&Pa(e,a):p&&(r=r&&va(e,a)))}return r},Bt=(e,t,r)=>{let a=parseInt(t),s;switch(r){case">=":s=e>=a;break;case">":s=e>a;break;case"<=":s=e<=a;break;case"<":s=e<a;break;default:s=e===a}return s},Ma=(e,t)=>{let{filterValues:r,values:a,modifier:s,isExcluded:i,filterToPropertyMapping:{partialMatch:n}}=t,o=!0;if(le(t,e)){let p=oe(e,t),f;if(p!=null&&!isNaN(p)){let u=parseInt(p);f=r?r.some(({modifier:y,value:F})=>Bt(u,F,y)):a.some(y=>Bt(u,y,s))}else{let u=ka(e,t)?.toLowerCase();f=n?a.some(y=>!!u?.includes(y)):a.some(y=>u===y)}o=i?!f:f}return o},Aa=(e,t)=>{if(le(t,e)){let{values:r,valuesSet:a,isAnd:s,isExcluded:i,filterToPropertyMapping:{hasMarkup:n,isNormalized:o,partialMatch:p}}=t,f=oe(e,t),u=o?f:f?.replaceAll(S,"").toLowerCase(),y=n&&u?Z(u):u;if(p){let F=s?r?.every(x=>y?.includes(x)):r?.some(x=>y?.includes(x));return i?!F:F}else{let F;return s?F=r?.every(x=>y===x):a?F=a.has(y):F=r?.some(x=>y===x),i?!F:F}}else return!0},ba=(e,t,r)=>{if(le(t,e)){let{values:a,isAnd:s,isExcluded:i,filterToPropertyMapping:{partialMatch:n}}=t,o=Ra(e,t,r).map(p=>p?.replaceAll(S,""));if(n){let p=s?a.every(u=>o?.some(y=>y?.toLowerCase().includes(u))):a.some(u=>o?.some(y=>y?.toLowerCase().includes(u))),f=o.length===0;return i?!p||f:p}else{let p=s?a.every(f=>o?.some(u=>u?.toLowerCase()===f)):a.some(f=>o?.some(u=>u?.toLowerCase()===f));return i?!p:p}}else return!0},Pa=(e,t)=>{if(le(t,e)){let{isExcluded:r}=t,a=oe(e,t);return r?!a:a}else return!0},va=(e,t)=>{if(le(t,e)){let{values:r,isExcluded:a}=t,s=oe(e,t),i=r?.some(n=>s>n);return a?!i:i}else return!0},oe=(e,t)=>{let{filterToPropertyMapping:{property:r}}=t,a;return r!==K&&(a=e[r]),a},Ra=(e,t,r)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:s}}=t,i=[],n=Object.keys(e.legalOverrides||{}).length>0,o=t.filterToPropertyMapping.property===q.LegalHeroes,p=r.find(({filterToPropertyMapping:u})=>u.property===q.LegalFormats);if(n&&o&&!!p){let u=new Set;for(let{format:y,heroes:F}of e.legalOverrides||[])if(p.values.includes(y.toLowerCase()))for(let x of F)u.add(x);i=Array.from(u)}if(i.length===0)if(s){let u=new Set;for(let y of e.printings){let F=y[s];if(a){if(Array.isArray(F))for(let x of F)u.add(x)}else F&&typeof F=="string"&&u.add(F)}i=Array.from(u)}else{let u=oe(e,t);if(Array.isArray(u))for(let y of u)typeof y=="string"&&i.push(y)}return i},ka=(e,t)=>{let{filterToPropertyMapping:{specialProperty:r}}=t,a;return r&&(a=e[r]),a},le=({cardTypes:e},{types:t,subtypes:r})=>!e||e?.some(a=>t.map(s=>s.toLowerCase()).includes(a.toLowerCase())||r.map(s=>s.toLowerCase()).includes(a.toLowerCase()));var Sa=(e,t,r=[],a=[],s)=>{let{appliedFilters:i,attributes:n,keywords:o}=ne(e,t,{additionalHeroes:r,additionalSets:a,today:s});return{appliedFilters:i,attributes:n,keywords:o}};var Va=(e,t)=>{let r=new Set;for(let s of e)for(let i of s.createdExtras||[])r.add(i);let a=[];for(let s of t)r.has(s.cardIdentifier)&&a.push(s);return a};0&&(module.exports={FilterCategory,FilterKind,FilterProperty,MARKUP,NO_CARD_PROPERTY,PUNCTUATION,RARITY_VALUES_MAPPING,aliasesByFilterCategory,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getCardsByName,getCatalogueIndex,getCleanText,getEscapedForRegExp,getExcludedMetaFilters,getFilterCategory,getFilterMapping,getFilterTokenSpansForKey,getFilterValue,getIncompleteFilterToken,getIsExcludedToken,getIsValueInFilterVocabulary,getKeywordsAndAppliedFiltersFromText,getMetaFilterResolution,getMetaFilters,getNormalizedFilterValue,getNormalizedText,getParsedQuery,getQueryFilterToken,getQueryTokenSpans,getQuotedValue,getResolvedFilterKey,getSuggestedFilterKey,getTextWithoutMarkup,getTokensReferencedByCards,getUnquotedValue,getValuePartsFromFilterValue,getValuesFromFilterValue,multiWordShorthands,shorthands,singleWordShorthands});
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { default } from "./search.js";
2
- export * from "./abbreviations.js";
3
2
  export * from "./constants.js";
4
3
  export * from "./filterMappings.js";
5
4
  export * from "./filters.js";
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { default as default2 } from "./search.js";
2
- export * from "./abbreviations.js";
3
2
  export * from "./constants.js";
4
3
  export * from "./filterMappings.js";
5
4
  export * from "./filters.js";
@@ -1,5 +1,6 @@
1
1
  import { Class, Format, Hero, Talent } from "@flesh-and-blood/types";
2
2
  import { PUNCTUATION } from "./constants.js";
3
+ import { getCleanText } from "./helpers.js";
3
4
  import {
4
5
  aliasesByFilterCategory,
5
6
  availableExclusions,
@@ -47,37 +48,23 @@ const formatMappings = Object.values(Format).map((format) => {
47
48
  const cleanFormat = format.toLowerCase().replaceAll(PUNCTUATION, "");
48
49
  return withNicknames ? { ...withNicknames, format: cleanFormat } : { format: cleanFormat };
49
50
  });
50
- const nicknameHeroMappings = [
51
- {
52
- hero: Hero.DataDoll,
53
- nicknames: ["data", "datadoll"]
54
- },
55
- {
56
- hero: Hero.Dorinthea,
57
- nicknames: ["dori"]
58
- },
59
- {
60
- hero: Hero.Genis,
61
- nicknames: ["genis"]
62
- },
63
- {
64
- hero: Hero.GravyBones,
65
- nicknames: ["gravy"]
66
- },
67
- {
68
- hero: Hero.Iyslander,
69
- nicknames: ["islander"]
51
+ const cleanHeroes = Object.values(Hero).map(getCleanText);
52
+ const getTextWithoutSpaces = (text) => text.replaceAll(" ", "");
53
+ const getMatchingHero = (value, heroes) => {
54
+ const valueWithoutSpaces = getTextWithoutSpaces(value);
55
+ let wholeNameMatch;
56
+ const heroesStartingWithValue = [];
57
+ for (const hero of heroes) {
58
+ const heroWithoutSpaces = getTextWithoutSpaces(hero);
59
+ if (heroWithoutSpaces === valueWithoutSpaces) {
60
+ wholeNameMatch = hero;
61
+ } else if (heroWithoutSpaces.startsWith(valueWithoutSpaces)) {
62
+ heroesStartingWithValue.push(hero);
63
+ }
70
64
  }
71
- ];
72
- const heroMappings = Object.values(
73
- Hero
74
- ).map((hero) => {
75
- const withNicknames = nicknameHeroMappings.find(
76
- ({ hero: nicknameHero }) => nicknameHero === hero
77
- );
78
- const cleanHero = hero.toLowerCase().replaceAll(PUNCTUATION, "");
79
- return withNicknames ? { ...withNicknames, hero: cleanHero } : { hero: cleanHero };
80
- });
65
+ const hasOneHeroStartingWithValue = heroesStartingWithValue.length === 1;
66
+ return wholeNameMatch ?? (hasOneHeroStartingWithValue ? heroesStartingWithValue[0] : void 0);
67
+ };
81
68
  const rankedRarity = [
82
69
  "common",
83
70
  "rare",
@@ -128,9 +115,10 @@ const getRarityFilter = (values, isExcluded) => {
128
115
  };
129
116
  };
130
117
  const getLegalityFilters = (values, isExcluded, additionalHeroes, formatProperty) => {
131
- const cleanAdditionalHeroes = additionalHeroes.map((hero) => ({
132
- hero: hero.toLowerCase().replaceAll(PUNCTUATION, "")
133
- }));
118
+ const knownHeroes = /* @__PURE__ */ new Set([
119
+ ...cleanHeroes,
120
+ ...additionalHeroes.map(getCleanText)
121
+ ]);
134
122
  const appliedFilters = [];
135
123
  const formats = [];
136
124
  const heroes = [];
@@ -143,12 +131,9 @@ const getLegalityFilters = (values, isExcluded, additionalHeroes, formatProperty
143
131
  if (matchingFormat) {
144
132
  formats.push(matchingFormat.format);
145
133
  } else {
146
- const matchingHero = heroMappings.find(({ hero, nicknames }) => {
147
- const isAMatch = hero === value || !!nicknames && nicknames.includes(value);
148
- return isAMatch;
149
- }) || cleanAdditionalHeroes.find(({ hero }) => hero === value);
134
+ const matchingHero = getMatchingHero(value, knownHeroes);
150
135
  if (matchingHero) {
151
- heroes.push(matchingHero.hero);
136
+ heroes.push(matchingHero);
152
137
  } else {
153
138
  unresolvedValues.push(value);
154
139
  }