@flesh-and-blood/search 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -10
- package/dist/filters.d.ts +1 -0
- package/dist/filters.js +13 -6
- package/dist/helpers.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/memes.js +1 -0
- package/dist/metaFilters.js +1 -1
- package/dist/related.js +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/search.js +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @flesh-and-blood/search
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A [fuse.js](https://www.fusejs.io/)-based search engine for **Flesh and Blood** cards.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
npm install @flesh-and-blood/search @flesh-and-blood/types
|
|
7
|
+
```bash
|
|
8
|
+
npm i @flesh-and-blood/search @flesh-and-blood/types
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
tree-shake. Use a bundler (Vite, webpack, esbuild, Rollup) or a modern ESM-capable Node runtime.
|
|
11
|
+
`@flesh-and-blood/types` is a **peer dependency** — install it alongside this package
|
|
16
12
|
|
|
17
13
|
## Usage
|
|
18
14
|
|
|
19
15
|
```ts
|
|
20
16
|
import Searcher from "@flesh-and-blood/search";
|
|
17
|
+
import { cards } from "@flesh-and-blood/cards";
|
|
18
|
+
|
|
19
|
+
const searcher = new Searcher(cards);
|
|
20
|
+
const { searchResults } = searcher.search("rhinar go again");
|
|
21
|
+
```
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
- `new Searcher(cards, additionalHeroes?, additionalSets?, debug?)`
|
|
24
|
+
- `.search(text)` → `SearchResults` — `{ searchResults: SearchCard[], appliedFilters, keywords, attributes }`
|
|
25
|
+
|
|
26
|
+
Data-only modules are available as subpath imports (handy for lazy-loaded UI like a search-bar dropdown):
|
|
27
|
+
|
|
28
|
+
```ts
|
|
23
29
|
import { abbreviations } from "@flesh-and-blood/search/abbreviations";
|
|
24
30
|
import { shorthands } from "@flesh-and-blood/search/shorthands";
|
|
25
31
|
```
|
|
32
|
+
|
|
33
|
+
## What's included
|
|
34
|
+
|
|
35
|
+
- Default export: **`Searcher`** — the search engine
|
|
36
|
+
- Types: `SearchResults`, `SearchCard`
|
|
37
|
+
- Data modules (subpath imports): `abbreviations`, `shorthands`, `memes`
|
|
38
|
+
- Filter / meta-filter / helper utilities (`filters`, `metaFilters`, `helpers`, `constants`, `related`)
|
|
39
|
+
|
|
40
|
+
## Working with this project
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run build # build:esm (per-file ESM) + build:cjs (bundled) + tsc declarations + jest
|
|
44
|
+
npm test # jest
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Uses `@flesh-and-blood/cards` (`file:../cards`) as a dev dependency for tests.
|
package/dist/filters.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export declare const filtersToCardPropertyMappings: {
|
|
|
100
100
|
var: FilterToPropertyMapping;
|
|
101
101
|
variation: FilterToPropertyMapping;
|
|
102
102
|
x: FilterToPropertyMapping;
|
|
103
|
+
year: FilterToPropertyMapping;
|
|
103
104
|
};
|
|
104
105
|
export declare const getKeywordsAndAppliedFiltersFromText: (text: string, cards: Card[], additionalHeroes?: Hero[], additionalSets?: Release[]) => {
|
|
105
106
|
appliedFilters: AppliedFilter[];
|
package/dist/filters.js
CHANGED
|
@@ -8,11 +8,12 @@ import {
|
|
|
8
8
|
setIdentifierToSetMappings,
|
|
9
9
|
setToSetIdentifierMappings
|
|
10
10
|
} from "@flesh-and-blood/types";
|
|
11
|
-
import { getAbbreviation } from "./abbreviations";
|
|
12
|
-
import { getExcludedMetaFilters, getMetaFilters } from "./metaFilters";
|
|
13
|
-
import { multiWordShorthands, singleWordShorthands } from "./shorthands";
|
|
14
|
-
import { PUNCTUATION } from "./constants";
|
|
15
|
-
import { getCardByName
|
|
11
|
+
import { getAbbreviation } from "./abbreviations.js";
|
|
12
|
+
import { getExcludedMetaFilters, getMetaFilters } from "./metaFilters.js";
|
|
13
|
+
import { multiWordShorthands, singleWordShorthands } from "./shorthands.js";
|
|
14
|
+
import { PUNCTUATION } from "./constants.js";
|
|
15
|
+
import { getCardByName } from "./helpers.js";
|
|
16
|
+
import { getRelatedCardsByName } from "./related.js";
|
|
16
17
|
const availableModifiers = [">=", ">", "<=", "<"];
|
|
17
18
|
const availableExclusions = ["!", "-"];
|
|
18
19
|
const arcaneFilter = {
|
|
@@ -165,6 +166,11 @@ const treatmentFilter = {
|
|
|
165
166
|
isArray: true,
|
|
166
167
|
isNestedPropertyArray: true
|
|
167
168
|
};
|
|
169
|
+
const yearFilter = {
|
|
170
|
+
property: "firstReleaseDate",
|
|
171
|
+
isString: true,
|
|
172
|
+
partialMatch: true
|
|
173
|
+
};
|
|
168
174
|
const filtersToCardPropertyMappings = {
|
|
169
175
|
arcane: arcaneFilter,
|
|
170
176
|
a: artistFilter,
|
|
@@ -236,7 +242,8 @@ const filtersToCardPropertyMappings = {
|
|
|
236
242
|
treatment: treatmentFilter,
|
|
237
243
|
var: treatmentFilter,
|
|
238
244
|
variation: treatmentFilter,
|
|
239
|
-
x: typeTextFilter
|
|
245
|
+
x: typeTextFilter,
|
|
246
|
+
year: yearFilter
|
|
240
247
|
};
|
|
241
248
|
const punctuationOverrides = [
|
|
242
249
|
{
|
package/dist/helpers.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var pr=Object.create;var _=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var ur=Object.getOwnPropertyNames;var fr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var hr=(e,r)=>{for(var t in r)_(e,t,{get:r[t],enumerable:!0})},we=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of ur(r))!gr.call(e,i)&&i!==t&&_(e,i,{get:()=>r[i],enumerable:!(a=dr(r,i))||a.enumerable});return e};var mr=(e,r,t)=>(t=e!=null?pr(fr(e)):{},we(r||!e||!e.__esModule?_(t,"default",{value:e,enumerable:!0}):t,e)),br=e=>we(_({},"__esModule",{value:!0}),e);var ct={};hr(ct,{FilterProperty:()=>ke,PUNCTUATION:()=>f,RARITY_VALUES_MAPPING:()=>Ce,abbreviations:()=>le,availableExclusions:()=>er,availableModifiers:()=>Xe,default:()=>ir,filterCard:()=>ar,filtersToCardPropertyMappings:()=>te,getAbbreviation:()=>Y,getAbbreviationByCard:()=>yr,getCardByName:()=>Me,getCleanText:()=>ve,getExcludedMetaFilters:()=>pe,getKeywordsAndAppliedFiltersFromText:()=>Fe,getMetaFilters:()=>ce,getNormalizedText:()=>z,getRelatedCards:()=>Pe,getRelatedCardsByName:()=>ie,getTokensReferencedByCards:()=>lt,multiWordShorthands:()=>ue,shorthands:()=>de,singleWordShorthands:()=>fe});module.exports=br(ct);var ae=require("@flesh-and-blood/types"),Te=mr(require("fuse.js"),1);var f=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g;var l=require("@flesh-and-blood/types");var Y=e=>le.find(({abbreviations:r})=>r.find(t=>t.toLowerCase()===e)),yr=e=>le.find(({card:r})=>r.toLowerCase()===e.name.toLowerCase()),le=[{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 A=require("@flesh-and-blood/types");var ke=(a=>(a.BannedFormats="bannedFormats",a.LegalFormats="legalFormats",a.LegalHeroes="legalHeroes",a))(ke||{}),Z=Array.from(Array(50).keys()).map(e=>`${e}`),Cr=[{format:A.Format.ClassicConstructed,nicknames:["cc","classic"]},{format:A.Format.LivingLegend,nicknames:["cc ll","classic constructed ll","ll cc","ll","living legend"]},{format:A.Format.SilverAge,nicknames:["sage"]},{format:A.Format.GoldenAge,nicknames:["gage"]},{format:A.Format.UltimatePitFight,nicknames:["upf"]}],Fr=Object.values(A.Format).map(e=>{let r=Cr.find(({format:a})=>a===e),t=e.toLowerCase().replaceAll(f,"");return r?{...r,format:t}:{format:t}}),Mr=[{hero:A.Hero.DataDoll,nicknames:["data","datadoll"]},{hero:A.Hero.Dorinthea,nicknames:["dori"]},{hero:A.Hero.Genis,nicknames:["genis"]},{hero:A.Hero.GravyBones,nicknames:["gravy"]},{hero:A.Hero.Iyslander,nicknames:["islander"]}],vr=Object.values(A.Hero).map(e=>{let r=Mr.find(({hero:a})=>a===e),t=e.toLowerCase().replaceAll(f,"");return r?{...r,hero:t}:{hero:t}}),$=["common","rare","super rare","majestic","legendary","fabled"],Tr=(e,r,t,a)=>{let i=[];if(!r)i.push(...e);else for(let s of e)switch(r){case">=":let o=!1;for(let n of $)o?i.push(n):n===s&&(o=!0,i.push(n));break;case">":let c=!1;for(let n of $)c?i.push(n):n===s&&(c=!0);break;case"<=":let p=!1;for(let n of $.slice().reverse())p?i.push(n):n===s&&(p=!0,i.push(n));break;case"<":let u=!1;for(let n of $.slice().reverse())u?i.push(n):n===s&&(u=!0);break;default:break}return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOptional:a,isOr:!0,values:i}},Se=(e,r,t,a,i)=>{let s=a.map(n=>({hero:n.toLowerCase().replaceAll(f,"")})),o=[],c=[],p=[];for(let n of e){let d=Fr.find(({format:h,nicknames:C})=>h===n||!!C&&C.includes(n));if(d)c.push(d.format);else{let h=vr.find(({hero:C,nicknames:F})=>C===n||!!F&&F.includes(n))||s.find(({hero:C})=>C===n);h&&p.push(h.hero)}}let u=i||"legalFormats";return c.length>0&&o.push({filterToPropertyMapping:{property:u,isArray:!0},values:c,isOr:!0,isExcluded:r,isOptional:t}),p.length>0&&o.push({filterToPropertyMapping:{property:"legalHeroes",isArray:!0},values:p,isOr:!0,isExcluded:r,isOptional:t}),o},Ar=(e,r,t,a)=>Se(e,r,t,a,"bannedFormats"),ce=(e,r,t,a,i,s)=>{let o=[];return wr(t)?o.push(...Se(a,e,r,s)):Sr(t)?o.push(...Ar(a,e,r,s)):Rr(t)&&o.push(Tr(a,i,e,r)),o},U=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:Z},{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"]}],I=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:Z},{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"]}],J=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:Z},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],G=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:Z},{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"]}],Q=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(A.Talent).map(e=>e.toLowerCase())}],xr={"!co":U,"-co":U,"!cost":U,"-cost":U,"!color":U,"-color":U,"!b":I,"-b":I,"!block":I,"-block":I,"!d":I,"-d":I,"!def":I,"-def":I,"!defense":I,"-defense":I,"!pitch":J,"-pitch":J,"!p":J,"-p":J,"!attack":G,"-attack":G,"!power":G,"-power":G,"!pwr":G,"-pwr":G,"!pow":G,"-pow":G,"!talents":Q,"-talents":Q,"!tal":Q,"-tal":Q},pe=e=>{let r=[],t=xr[e];return t&&r.push(...t),r},Pr=["l","legal","hero"],wr=e=>Pr.includes(e),kr=["banned"],Sr=e=>kr.includes(e),Lr=["r","rarity"],Rr=e=>Lr.includes(e);var N=require("@flesh-and-blood/types"),de=[{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"]}],ue=de.filter(({shorthands:e})=>e.some(r=>r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)})),fe=de.filter(({shorthands:e})=>e.some(r=>!r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>!r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)}));var Xe=[">=",">","<=","<"],er=["!","-"],Br={property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},ge={property:"artists",isArray:!0,partialMatch:!0},Le={property:"n/a",isMeta:!0},Re={property:"bonds",isArray:!0},Nr={property:"n/a"},Be={property:"classes",isArray:!0,partialMatch:!0},Ne={property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},j={property:"defense",specialProperty:"specialDefense",isNumber:!0},Ee={property:"flows",isArray:!0},Oe={nestedProperty:"foiling",property:"printings",isArray:!0},Ie={property:"fusions",isArray:!0},He={property:"intellect",isNumber:!0},De={property:"keywords",isArray:!0},he={property:"n/a",isMeta:!0},Ge={property:"life",specialProperty:"specialLife",isNumber:!0},Ve={property:"meta",isArray:!0},We={property:"name",isString:!0,partialMatch:!0},me={property:"pitch",isNumber:!0},X={property:"power",specialProperty:"specialPower",isNumber:!0},Er={property:"setIdentifiers",isArray:!0,partialMatch:!0},Ue={property:"n/a",isMeta:!0},Or={property:"n/a"},Ir={property:"n/a"},Ke={property:"sets",isArray:!0,partialMatch:!0},be={property:"shorthands",isArray:!0,partialMatch:!0},ee={property:"specializations",isArray:!0,partialMatch:!0},je={property:"subtypes",isArray:!0},ze={property:"types",isArray:!0},qe={property:"talents",isArray:!0},Hr={property:"functionalText",isString:!0,partialMatch:!0},Dr={property:"traits",isArray:!0,partialMatch:!0},Gr={property:"typeText",isString:!0,partialMatch:!0},re={nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},te={arcane:Br,a:ge,artist:ge,art:ge,attack:X,b:j,block:j,banned:Le,bond:Re,bonds:Re,c:Be,class:Be,chain:Nr,co:Ne,cost:Ne,color:me,d:j,def:j,defense:j,flow:Ee,flows:Ee,f:Ie,fusion:Ie,foil:Oe,foiling:Oe,i:He,intellect:He,is:Ve,k:De,keyword:De,l:he,legal:he,hero:he,li:Ge,life:Ge,meta:Ve,n:We,name:We,p:me,pitch:me,pwr:X,pow:X,power:X,print:Er,r:Ue,rarity:Ue,referencedby:Or,references:Ir,rf:Le,s:Ke,set:Ke,short:be,shorthand:be,shorthands:be,sp:ee,spec:ee,specialization:ee,specializations:ee,st:je,subtype:je,t:ze,type:ze,tal:qe,talent:qe,text:Hr,trait:Dr,treat:re,treatment:re,var:re,variation:re,x:Gr},Vr=[{text:l.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:l.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(f,"")}],Wr=e=>{let r=[],t=e.replaceAll("\u201D",'"');for(let{text:i,override:s}of Vr)t.includes(i)&&(t=t.replace(i,s));if(Y(t)?.card)r.push(t);else{let i=t.split(/[ ]+/),s="",o=0;for(let c of i)o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0),o<2&&c.split('"').length===2?(s+=" "+c,o++):o===0&&s===""?r.push(c):o===1&&(s+=" "+c);o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0)}return r},Fe=(e,r,t=[],a=[])=>{let i=e.trim().toLowerCase();for(let{expanded:T,shorthands:x}of ue)for(let k of x)if(i.includes(k)){i=i.replace(k,T.join(" "));break}for(let[T,x]of Object.entries(l.setToSetIdentifierMappings))i.includes(T.toLowerCase())&&(i=i.replace(T.toLowerCase(),x[0]));let s=Wr(i),o=[];for(let T of s){let x=fe.find(({shorthands:k})=>k.includes(T));x&&!x.isCardProperty?o.push(...x.expanded):o.push(T)}let c=[],p=[],u=[],n=[],d=!1,h=[],C=[],F=[],w=[];for(let T of o)if(Qr(T)){let[x,k]=T.split(":"),{modifier:y,values:g,isAnd:P,isOr:m}=$r(k),{filterKey:b,isExcluded:S,isOptional:H,isMeta:D}=Jr(x);if(D){if(["rarity","r"].includes(b)){let v=Yr(g);S||(C=[...v]),g=v.map(L=>L.toLowerCase())}["legal","l","hero"].includes(b),c.push(...ce(S,H,b,g,y,t))}else{if(["chain"].includes(b)){let v=B=>B.name.toLowerCase().replaceAll(f,""),L=g.map(B=>Me(B,r)).filter(B=>!!B).map(v),E=new Set(L);b="name",m=!0;let W=20,R=0,O=B=>{if(!B.types.includes(l.Type.Hero)){let V=v(B);E.add(V),L.includes(V)||L.push(V)}};for(let B of L){if(R>W)break;let{referencedBy:V,references:oe}=ie(B,r);oe.forEach(O),R===0&&V.forEach(O),R++}g=Array.from(E)}else if(["referencedby","references"].includes(b)){let v=b,L=[...g].filter(E=>!!E);g=[],b="name",m=!0;for(let E of L){let{referencedBy:W,references:R}=ie(E,r);["referencedby"].includes(v)?g.push(...R.map(({name:O})=>O.toLowerCase().replaceAll(f,""))):["references"].includes(v)&&g.push(...W.map(({name:O})=>O.toLowerCase().replaceAll(f,"")))}}else if(["art","artist"].includes(b))p=g;else if(["print","prints","printing","printings"].includes(b))h=g;else if(["is","meta"].includes(b)){let v=zr(g);g=v.map(L=>L.toLowerCase().replaceAll(f,"")),v.includes(l.Meta.Expansion)&&!S&&(d=!0)}else["foiling","foil"].includes(b)?(n=qr(g),g=n.map(v=>v.toLowerCase())):["treat","treatment","var","variation"].includes(b)?(w=_r(g),g=w.map(v=>v.toLowerCase())):["set","s"].includes(b)?(F=Ur(g,a),g=F.map(v=>v.toLowerCase().replaceAll(f,""))):["pitch","p","color"].includes(b)&&(g=jr(g));te[b]&&c.push({filterToPropertyMapping:te[b],values:g,isAnd:P,isOr:m,modifier:y,isExcluded:S,isOptional:H})}}else if(T){let x=Y(T)?.card,k=pe(T);x?u.push(`"${x.toLowerCase().replace(f,"")}"`):k&&k.length>0?c.push(...k):u.push(T.replace(f,""))}return{appliedFilters:c,attributes:{artists:p,foilings:n,isExpansionSlot:d,prints:h,rarities:C,releases:F,treatments:w},keywords:u}},Ur=(e,r=[])=>{let t=[];for(let a of e)t.push(...Kr(a,r));return t},Kr=(e,r=[])=>{let t=[],a=Object.values(l.Release).find(i=>i.toLowerCase().replaceAll(f,"")===e);if(a&&t.push(a),t.length===0){let i=l.setIdentifierToSetMappings[e];i&&t.push(i)}if(t.length===0){let i=Object.values(l.Release).filter(s=>s.toLowerCase().includes(e));i.length>0&&t.push(...i)}if(t.length===0){let i=r.find(s=>s.toLowerCase().replaceAll(f,"")===e);i&&t.push(i)}return t},ye={blue:3,yellow:2,red:1,white:0},jr=e=>{let r=[];for(let t of e)ye[t]||ye[t]===0?r.push(ye[t].toString()):r.push(t);return r},_e={exp:l.Meta.Expansion,expansion:l.Meta.Expansion,expansionSlot:l.Meta.Expansion,rainbow:l.Meta.Rainbow},zr=e=>{let r=[];for(let t of e)_e[t]&&r.push(_e[t]);return r},Ye={r:l.Foiling.Rainbow,rf:l.Foiling.Rainbow,rainbow:l.Foiling.Rainbow,c:l.Foiling.Cold,cf:l.Foiling.Cold,cold:l.Foiling.Cold,g:l.Foiling.Gold,gf:l.Foiling.Gold,gold:l.Foiling.Gold},qr=e=>{let r=[];for(let t of e)Ye[t]&&r.push(Ye[t]);return r},$e={...Object.values(l.Treatment).reduce((e,r)=>(e[r.toLowerCase()]=r,e),{}),aa:l.Treatment.AA,alt:l.Treatment.AA,"alt art":l.Treatment.AA,ab:l.Treatment.AB,"alt border":l.Treatment.AB,at:l.Treatment.AT,"alt text":l.Treatment.AT,ea:l.Treatment.EA,extended:l.Treatment.EA,"extended art":l.Treatment.EA,fa:l.Treatment.FA,full:l.Treatment.FA,"full art":l.Treatment.FA},_r=e=>{let r=[];for(let t of e)$e[t]?r.push($e[t]):l.Treatment[t.toUpperCase()]&&r.push(l.Treatment[t.toUpperCase()]);return r},Ce={b:l.Rarity.Basic,c:l.Rarity.Common,f:l.Rarity.Fabled,l:l.Rarity.Legendary,m:l.Rarity.Majestic,p:l.Rarity.Promo,r:l.Rarity.Rare,s:l.Rarity.SuperRare,t:l.Rarity.Token,v:l.Rarity.Marvel},Yr=e=>{let r=[];for(let t of e)Ce[t]?r.push(Ce[t]):r.push(t);return r},$r=e=>{let r=[],t,a,i=Xe.find(s=>e.includes(s));if(i){let[,s]=e.split(i);Je(s)?(t=!0,r.push(...s.trim().split("+").map(o=>o.replace(f,"")))):Qe(s)?(a=!0,r.push(...s.trim().split(",").map(o=>o.replace(f,"")))):r.push(s.trim().replace(f,""))}else Je(e)?(t=!0,r.push(...e.trim().split("+").map(s=>s.replace(f,"")))):Qe(e)?(a=!0,r.push(...e.trim().split(",").map(s=>s.replace(f,"")))):e.startsWith('"')&&e.endsWith('"')?r.push(e.trim().replaceAll('"',"").replace(f,"")):r.push(e.trim().replace(f,""));return{modifier:i,values:r,isAnd:t,isOr:a}},Jr=e=>{let r=Zr(e);if(r){let[,t]=e.split(r);return{filterKey:t,isExcluded:!0,isOptional:!1,isMeta:Ze(t)}}else return{filterKey:e,isExcluded:!1,isOptional:!1,isMeta:Ze(e)}},Qr=e=>e.indexOf(":")>=0,Je=e=>e.indexOf("+")>=0,Qe=e=>e.indexOf(",")>=0,Ze=e=>!!te[e]?.isMeta,Zr=e=>er.find(r=>e.includes(r))?.slice(0,1);var M=require("@flesh-and-blood/types"),rr={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[M.Class.Generic],defaultImage:"FNG000",functionalText:"If Fangs A Lot is put into your banished zone from your graveyard, instead put it into your hand.",legalFormats:[],legalHeroes:[M.Hero.Kayo,M.Hero.Levia,M.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:M.Rarity.Rare,set:M.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${M.Treatment.FA}`,rarity:M.Rarity.Marvel,set:M.Release.Promos,treatment:M.Treatment.FA}],name:"Fangs A Lot",rarities:[M.Rarity.Rare,M.Rarity.Marvel],rarity:M.Rarity.Rare,sets:[M.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[M.Subtype.Attack],types:[M.Type.Action],typeText:"Generic Action - Attack"},tr=[{keyword:rr.name.toLowerCase(),card:rr}];var Me=(e,r)=>{let t=r.find(a=>ve(a.name)===e);return t||(t=r.find(a=>ve(a.name).includes(e))),t},ve=e=>z(e.toLowerCase().trim().replace(f,"")),z=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"");var Ae=class{constructor(r,t=[],a=[],i=!1){this.log=(r,...t)=>{this.debug&&console.log(r,...t)};this.search=(r,t)=>{let a,{appliedFilters:i,attributes:s,keywords:o}=Fe(r,this.cards,this.additionalHeroes,this.additionalSets),c=o.join(" "),p=t?tr.filter(y=>y.keyword===c):[];if(p.length>0?a=p.map(({card:y})=>y):o.length?a=this.fuse.search(c).map(y=>y.item):a=[...this.cards],i.length&&(a=a.filter(y=>y&&ar(y,i))),o.length===0){let y="";if(s.releases.length===1)try{let m=s.releases[0];y=ae.setToSetIdentifierMappings[m][0].toUpperCase()}catch(m){console.error("Error getting set identifier from search",m)}if(!y&&s.prints.length===1)try{let m=s.prints[0];ae.setIdentifierToSetMappings[m]&&(y=m.toUpperCase())}catch(m){console.error("Error getting set identifier from search",m)}y?a.sort((m,b)=>{let S=m.setIdentifiers.find(D=>D.includes(y))?.replace(y,""),H=b.setIdentifiers.find(D=>D.includes(y))?.replace(y,"");return S&&H?S.localeCompare(H):-1}):a.sort((m,b)=>m.name===b.name?`${m.pitch}`.localeCompare(`${b.pitch}`):m.name.localeCompare(b.name))}else{let y=[],g=[],P=o.map(m=>m.toLowerCase().replace(f,"")).join(" ");for(let m of a)m.name.toLowerCase().replace(f,"")===P?y.push(m):g.push(m);a=[...y,...g]}let u,{artists:n,isExpansionSlot:d,foilings:h,prints:C,rarities:F,releases:w,treatments:T}=s;(n.length>0||d||h.length>0||C.length>0||F.length>0||w.length>0||T.length>0)&&(u=a.map(y=>{let g=y.printings.filter(P=>{let m=!!P.image,b=n.length===0||n.some(R=>P.artists.find(O=>O.replace(f,"").toLowerCase().includes(R))),S=!d||d===P.isExpansionSlot,H=h.length===0||h.includes(P.foiling),D=C.length===0||C.some(R=>P.identifier.includes(R.toUpperCase())),v=F.length===0||F.includes(P.rarity),L=w.length===0||w.includes(P.set),E=T.length===0||P.treatments?.some(R=>T.includes(R));return m&&b&&S&&H&&D&&v&&L&&E});return{...y,matchingPrintings:g}}));let k=u?.length>0?u:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:k}};let s={getFn:(o,c)=>{let p=Te.default.config.getFn(o,c);return p&&(Array.isArray(p)?p.map(u=>z(u.replace(f,""))):z(p).replace(f,""))},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};this.additionalHeroes=t,this.additionalSets=a,this.cards=[...r],this.debug=i,this.fuse=new Te.default([...r],s)}},ir=Ae,ar=(e,r)=>{let t=!0,a=!1;for(let i of r){let s=i.isOptional,{isNumber:o,isString:c,isArray:p,isBoolean:u}=i.filterToPropertyMapping;if(o){let n=Xr(e,i);s?n&&(a=!0):t=t&&n}else if(c){let n=et(e,i);s?n&&(a=!0):t=t&&n}else if(p){let n=rt(e,i,r);s?n&&(a=!0):t=t&&n}else if(u){let n=tt(e,i);s?n&&(a=!0):t=t&&n}}return t},Xr=(e,r)=>{if(se(r,e)){let{values:t,modifier:a,isExcluded:i,filterToPropertyMapping:{partialMatch:s}}=r,o=xe(e,r);if(o!=null&&!isNaN(o))if(o=parseInt(o),a)switch(a){case">=":let c=t?.some(d=>o>=parseInt(d));return i?!c:c;case">":let p=t?.some(d=>o>parseInt(d));return i?!p:p;case"<=":let u=t?.some(d=>o<=parseInt(d));return i?!u:u;case"<":let n=t?.some(d=>o<parseInt(d));return i?!n:n;default:return!1}else{let c=t?.some(p=>o===parseInt(p));return i?!c:c}else{let c=at(e,r)?.toLowerCase(),p=s?t?.some(u=>c?.includes(u)):t?.some(u=>c===u);return i?!p:p}}else return!0},et=(e,r)=>{if(se(r,e)){let{values:t,isAnd:a,isExcluded:i,filterToPropertyMapping:{partialMatch:s}}=r,o=xe(e,r)?.replaceAll(f,"");if(s){let c=a?t?.every(p=>o?.toLowerCase().includes(p)):t?.some(p=>o?.toLowerCase().includes(p));return i?!c:c}else{let c=a?t?.every(p=>o?.toLowerCase()===p):t?.some(p=>o?.toLowerCase()===p);return i?!c:c}}else return!0},rt=(e,r,t)=>{if(se(r,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=r,c=it(e,r,t).map(p=>p?.replaceAll(f,""));if(o){let p=i?a.every(n=>c?.some(d=>d?.toLowerCase().includes(n))):a.some(n=>c?.some(d=>d?.toLowerCase().includes(n))),u=c.length===0;return s?!p||u:p}else{let p=i?a.every(u=>c?.some(n=>n?.toLowerCase()===u)):a.some(u=>c?.some(n=>n?.toLowerCase()===u));return s?!p:p}}else return!0},tt=(e,r)=>{if(se(r,e)){let{isExcluded:t}=r,a=xe(e,r);return t?!a:a}else return!0},xe=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.property]},it=(e,r,t)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i,property:s}}=r,o=e[s]||[],c=[],p=Object.keys(e.legalOverrides||{}).length>0,u=r.filterToPropertyMapping.property==="legalHeroes",n=t.find(({filterToPropertyMapping:h})=>h.property==="legalFormats");if(p&&u&&!!n){let h=new Set;for(let{format:C,heroes:F}of e.legalOverrides||[])if(n.values.includes(C.toLowerCase()))for(let w of F)h.add(w);c=Array.from(h)}if(c.length===0)if(i){let h=new Set;for(let C of o)if(a){let F=C[i]||[];for(let w of F)h.add(w)}else{let F=C[i];F&&h.add(F)}c=Array.from(h)}else c=o;return c},at=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.specialProperty]},se=({cardTypes:e},{types:r,subtypes:t})=>!e||e?.some(a=>r.map(i=>i.toLowerCase()).includes(a.toLowerCase())||t.map(i=>i.toLowerCase()).includes(a.toLowerCase()));var K=require("@flesh-and-blood/types");var q=require("@flesh-and-blood/types"),st={"Dawnblade, Resplendent":"Dawnblade"},sr=e=>st[e.name]||e.name,or=e=>e.functionalText?.replaceAll(e.name,""),ie=(e,r)=>{let t=r.find(a=>a.name.toLowerCase().replace(f,"")===e);return t||(t=r.find(a=>a.name.toLowerCase().replace(f,"").includes(e))),Pe(t,r)},Pe=(e,r)=>{let t={},a={},i={};if(e){let p=[],u=[],n=sr(e);for(let d of r){let h=sr(d),C=n===h,F=e.cardIdentifier!==d.cardIdentifier,w=e.pitch!==d.pitch;if(C&&F&&w)t[d.cardIdentifier]=d;else if(!C){let T=e.name==="Seismic Surge",x=d.keywords?.includes(q.Keyword.Heave),k=T&&x,y=e.name==="Marked",g=d.keywords?.includes(q.Keyword.Mark),P=y&&g,m=or(d),b=m?.includes(n)||e.traits?.some(ne=>m?.includes(ne)),S=or(e);(b||k||P)&&p.push(d);let H=new RegExp(h,"g"),D=new RegExp(`\\*\\*${h}\\*\\*`,"g"),v=S?.match(H)||[],L=S?.match(D)||[],E=v.length===L.length,W=S?.includes(h)&&!E,O=(d.traits||[]).some(ne=>S?.includes(ne)),B=W||O,V=d.name==="Seismic Surge",oe=e.keywords?.includes(q.Keyword.Heave),nr=V&&oe,lr=d.name==="Marked",cr=e.keywords?.includes(q.Keyword.Mark);(B||nr||lr&&cr)&&u.push(d)}}for(let d of p)a[d.cardIdentifier]=d;for(let d of u){let h=d.name;n!==h&&!u.some(C=>{let F=C.name;return F!==h&&F?.includes(h)})&&(i[d.cardIdentifier]=d)}}let s=Object.values(t),o=Object.values(a),c=Object.values(i);return{otherPitches:s,referencedBy:o,references:c}},ot=["cash-in-yellow"],nt={[K.Hero.Crackni]:{traits:[K.Trait.AgentOfChaos]},[K.Hero.Maxx]:{tokens:["hyper-driver"]}},lt=(e,r,t)=>{let a=new Set;for(let i of e.filter(({cardIdentifier:s})=>!ot.includes(s))){let{references:s}=Pe(i,r);for(let o of s.filter(c=>{let p=c.name==="Hyper Driver",u=t===K.Hero.Maxx;return!p||u}))a.add(o)}if(t){let i=nt[t];if(i){if(i.cards)for(let s of e)i.cards?.includes(s.cardIdentifier)&&a.add(s);if(i.tokens)for(let s of r)i.tokens?.includes(s.cardIdentifier)&&a.add(s)}}return Array.from(a)};0&&(module.exports={FilterProperty,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getAbbreviation,getAbbreviationByCard,getCardByName,getCleanText,getExcludedMetaFilters,getKeywordsAndAppliedFiltersFromText,getMetaFilters,getNormalizedText,getRelatedCards,getRelatedCardsByName,getTokensReferencedByCards,multiWordShorthands,shorthands,singleWordShorthands});
|
|
1
|
+
var pr=Object.create;var _=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var ur=Object.getOwnPropertyNames;var fr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var hr=(e,r)=>{for(var t in r)_(e,t,{get:r[t],enumerable:!0})},we=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of ur(r))!gr.call(e,i)&&i!==t&&_(e,i,{get:()=>r[i],enumerable:!(a=dr(r,i))||a.enumerable});return e};var mr=(e,r,t)=>(t=e!=null?pr(fr(e)):{},we(r||!e||!e.__esModule?_(t,"default",{value:e,enumerable:!0}):t,e)),br=e=>we(_({},"__esModule",{value:!0}),e);var pt={};hr(pt,{FilterProperty:()=>Se,PUNCTUATION:()=>f,RARITY_VALUES_MAPPING:()=>ve,abbreviations:()=>le,availableExclusions:()=>tr,availableModifiers:()=>rr,default:()=>sr,filterCard:()=>or,filtersToCardPropertyMappings:()=>ie,getAbbreviation:()=>Y,getAbbreviationByCard:()=>yr,getCardByName:()=>he,getCleanText:()=>ge,getExcludedMetaFilters:()=>pe,getKeywordsAndAppliedFiltersFromText:()=>Te,getMetaFilters:()=>ce,getNormalizedText:()=>j,getRelatedCards:()=>me,getRelatedCardsByName:()=>X,getTokensReferencedByCards:()=>Or,multiWordShorthands:()=>ue,shorthands:()=>de,singleWordShorthands:()=>fe});module.exports=br(pt);var ae=require("@flesh-and-blood/types"),Ae=mr(require("fuse.js"),1);var f=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g;var l=require("@flesh-and-blood/types");var Y=e=>le.find(({abbreviations:r})=>r.find(t=>t.toLowerCase()===e)),yr=e=>le.find(({card:r})=>r.toLowerCase()===e.name.toLowerCase()),le=[{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 A=require("@flesh-and-blood/types");var Se=(a=>(a.BannedFormats="bannedFormats",a.LegalFormats="legalFormats",a.LegalHeroes="legalHeroes",a))(Se||{}),Z=Array.from(Array(50).keys()).map(e=>`${e}`),Cr=[{format:A.Format.ClassicConstructed,nicknames:["cc","classic"]},{format:A.Format.LivingLegend,nicknames:["cc ll","classic constructed ll","ll cc","ll","living legend"]},{format:A.Format.SilverAge,nicknames:["sage"]},{format:A.Format.GoldenAge,nicknames:["gage"]},{format:A.Format.UltimatePitFight,nicknames:["upf"]}],Fr=Object.values(A.Format).map(e=>{let r=Cr.find(({format:a})=>a===e),t=e.toLowerCase().replaceAll(f,"");return r?{...r,format:t}:{format:t}}),Mr=[{hero:A.Hero.DataDoll,nicknames:["data","datadoll"]},{hero:A.Hero.Dorinthea,nicknames:["dori"]},{hero:A.Hero.Genis,nicknames:["genis"]},{hero:A.Hero.GravyBones,nicknames:["gravy"]},{hero:A.Hero.Iyslander,nicknames:["islander"]}],vr=Object.values(A.Hero).map(e=>{let r=Mr.find(({hero:a})=>a===e),t=e.toLowerCase().replaceAll(f,"");return r?{...r,hero:t}:{hero:t}}),$=["common","rare","super rare","majestic","legendary","fabled"],Tr=(e,r,t,a)=>{let i=[];if(!r)i.push(...e);else for(let s of e)switch(r){case">=":let o=!1;for(let n of $)o?i.push(n):n===s&&(o=!0,i.push(n));break;case">":let c=!1;for(let n of $)c?i.push(n):n===s&&(c=!0);break;case"<=":let p=!1;for(let n of $.slice().reverse())p?i.push(n):n===s&&(p=!0,i.push(n));break;case"<":let u=!1;for(let n of $.slice().reverse())u?i.push(n):n===s&&(u=!0);break;default:break}return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOptional:a,isOr:!0,values:i}},ke=(e,r,t,a,i)=>{let s=a.map(n=>({hero:n.toLowerCase().replaceAll(f,"")})),o=[],c=[],p=[];for(let n of e){let d=Fr.find(({format:h,nicknames:C})=>h===n||!!C&&C.includes(n));if(d)c.push(d.format);else{let h=vr.find(({hero:C,nicknames:F})=>C===n||!!F&&F.includes(n))||s.find(({hero:C})=>C===n);h&&p.push(h.hero)}}let u=i||"legalFormats";return c.length>0&&o.push({filterToPropertyMapping:{property:u,isArray:!0},values:c,isOr:!0,isExcluded:r,isOptional:t}),p.length>0&&o.push({filterToPropertyMapping:{property:"legalHeroes",isArray:!0},values:p,isOr:!0,isExcluded:r,isOptional:t}),o},Ar=(e,r,t,a)=>ke(e,r,t,a,"bannedFormats"),ce=(e,r,t,a,i,s)=>{let o=[];return wr(t)?o.push(...ke(a,e,r,s)):kr(t)?o.push(...Ar(a,e,r,s)):Rr(t)&&o.push(Tr(a,i,e,r)),o},U=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:Z},{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"]}],I=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:Z},{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"]}],J=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:Z},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],G=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:Z},{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"]}],Q=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(A.Talent).map(e=>e.toLowerCase())}],xr={"!co":U,"-co":U,"!cost":U,"-cost":U,"!color":U,"-color":U,"!b":I,"-b":I,"!block":I,"-block":I,"!d":I,"-d":I,"!def":I,"-def":I,"!defense":I,"-defense":I,"!pitch":J,"-pitch":J,"!p":J,"-p":J,"!attack":G,"-attack":G,"!power":G,"-power":G,"!pwr":G,"-pwr":G,"!pow":G,"-pow":G,"!talents":Q,"-talents":Q,"!tal":Q,"-tal":Q},pe=e=>{let r=[],t=xr[e];return t&&r.push(...t),r},Pr=["l","legal","hero"],wr=e=>Pr.includes(e),Sr=["banned"],kr=e=>Sr.includes(e),Lr=["r","rarity"],Rr=e=>Lr.includes(e);var N=require("@flesh-and-blood/types"),de=[{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"]}],ue=de.filter(({shorthands:e})=>e.some(r=>r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)})),fe=de.filter(({shorthands:e})=>e.some(r=>!r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>!r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)}));var he=(e,r)=>{let t=r.find(a=>ge(a.name)===e);return t||(t=r.find(a=>ge(a.name).includes(e))),t},ge=e=>j(e.toLowerCase().trim().replace(f,"")),j=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"");var K=require("@flesh-and-blood/types");var z=require("@flesh-and-blood/types"),Br={"Dawnblade, Resplendent":"Dawnblade"},Le=e=>Br[e.name]||e.name,Re=e=>e.functionalText?.replaceAll(e.name,""),X=(e,r)=>{let t=r.find(a=>a.name.toLowerCase().replace(f,"")===e);return t||(t=r.find(a=>a.name.toLowerCase().replace(f,"").includes(e))),me(t,r)},me=(e,r)=>{let t={},a={},i={};if(e){let p=[],u=[],n=Le(e);for(let d of r){let h=Le(d),C=n===h,F=e.cardIdentifier!==d.cardIdentifier,w=e.pitch!==d.pitch;if(C&&F&&w)t[d.cardIdentifier]=d;else if(!C){let T=e.name==="Seismic Surge",x=d.keywords?.includes(z.Keyword.Heave),S=T&&x,y=e.name==="Marked",g=d.keywords?.includes(z.Keyword.Mark),P=y&&g,m=Re(d),b=m?.includes(n)||e.traits?.some(ne=>m?.includes(ne)),k=Re(e);(b||S||P)&&p.push(d);let H=new RegExp(h,"g"),D=new RegExp(`\\*\\*${h}\\*\\*`,"g"),v=k?.match(H)||[],L=k?.match(D)||[],E=v.length===L.length,W=k?.includes(h)&&!E,O=(d.traits||[]).some(ne=>k?.includes(ne)),B=W||O,V=d.name==="Seismic Surge",oe=e.keywords?.includes(z.Keyword.Heave),nr=V&&oe,lr=d.name==="Marked",cr=e.keywords?.includes(z.Keyword.Mark);(B||nr||lr&&cr)&&u.push(d)}}for(let d of p)a[d.cardIdentifier]=d;for(let d of u){let h=d.name;n!==h&&!u.some(C=>{let F=C.name;return F!==h&&F?.includes(h)})&&(i[d.cardIdentifier]=d)}}let s=Object.values(t),o=Object.values(a),c=Object.values(i);return{otherPitches:s,referencedBy:o,references:c}},Nr=["cash-in-yellow"],Er={[K.Hero.Crackni]:{traits:[K.Trait.AgentOfChaos]},[K.Hero.Maxx]:{tokens:["hyper-driver"]}},Or=(e,r,t)=>{let a=new Set;for(let i of e.filter(({cardIdentifier:s})=>!Nr.includes(s))){let{references:s}=me(i,r);for(let o of s.filter(c=>{let p=c.name==="Hyper Driver",u=t===K.Hero.Maxx;return!p||u}))a.add(o)}if(t){let i=Er[t];if(i){if(i.cards)for(let s of e)i.cards?.includes(s.cardIdentifier)&&a.add(s);if(i.tokens)for(let s of r)i.tokens?.includes(s.cardIdentifier)&&a.add(s)}}return Array.from(a)};var rr=[">=",">","<=","<"],tr=["!","-"],Ir={property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},be={property:"artists",isArray:!0,partialMatch:!0},Be={property:"n/a",isMeta:!0},Ne={property:"bonds",isArray:!0},Hr={property:"n/a"},Ee={property:"classes",isArray:!0,partialMatch:!0},Oe={property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},q={property:"defense",specialProperty:"specialDefense",isNumber:!0},Ie={property:"flows",isArray:!0},He={nestedProperty:"foiling",property:"printings",isArray:!0},De={property:"fusions",isArray:!0},Ge={property:"intellect",isNumber:!0},Ve={property:"keywords",isArray:!0},ye={property:"n/a",isMeta:!0},We={property:"life",specialProperty:"specialLife",isNumber:!0},Ue={property:"meta",isArray:!0},Ke={property:"name",isString:!0,partialMatch:!0},Ce={property:"pitch",isNumber:!0},ee={property:"power",specialProperty:"specialPower",isNumber:!0},Dr={property:"setIdentifiers",isArray:!0,partialMatch:!0},je={property:"n/a",isMeta:!0},Gr={property:"n/a"},Vr={property:"n/a"},ze={property:"sets",isArray:!0,partialMatch:!0},Fe={property:"shorthands",isArray:!0,partialMatch:!0},re={property:"specializations",isArray:!0,partialMatch:!0},qe={property:"subtypes",isArray:!0},_e={property:"types",isArray:!0},Ye={property:"talents",isArray:!0},Wr={property:"functionalText",isString:!0,partialMatch:!0},Ur={property:"traits",isArray:!0,partialMatch:!0},Kr={property:"typeText",isString:!0,partialMatch:!0},te={nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},jr={property:"firstReleaseDate",isString:!0,partialMatch:!0},ie={arcane:Ir,a:be,artist:be,art:be,attack:ee,b:q,block:q,banned:Be,bond:Ne,bonds:Ne,c:Ee,class:Ee,chain:Hr,co:Oe,cost:Oe,color:Ce,d:q,def:q,defense:q,flow:Ie,flows:Ie,f:De,fusion:De,foil:He,foiling:He,i:Ge,intellect:Ge,is:Ue,k:Ve,keyword:Ve,l:ye,legal:ye,hero:ye,li:We,life:We,meta:Ue,n:Ke,name:Ke,p:Ce,pitch:Ce,pwr:ee,pow:ee,power:ee,print:Dr,r:je,rarity:je,referencedby:Gr,references:Vr,rf:Be,s:ze,set:ze,short:Fe,shorthand:Fe,shorthands:Fe,sp:re,spec:re,specialization:re,specializations:re,st:qe,subtype:qe,t:_e,type:_e,tal:Ye,talent:Ye,text:Wr,trait:Ur,treat:te,treatment:te,var:te,variation:te,x:Kr,year:jr},zr=[{text:l.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:l.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(f,"")}],qr=e=>{let r=[],t=e.replaceAll("\u201D",'"');for(let{text:i,override:s}of zr)t.includes(i)&&(t=t.replace(i,s));if(Y(t)?.card)r.push(t);else{let i=t.split(/[ ]+/),s="",o=0;for(let c of i)o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0),o<2&&c.split('"').length===2?(s+=" "+c,o++):o===0&&s===""?r.push(c):o===1&&(s+=" "+c);o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0)}return r},Te=(e,r,t=[],a=[])=>{let i=e.trim().toLowerCase();for(let{expanded:T,shorthands:x}of ue)for(let S of x)if(i.includes(S)){i=i.replace(S,T.join(" "));break}for(let[T,x]of Object.entries(l.setToSetIdentifierMappings))i.includes(T.toLowerCase())&&(i=i.replace(T.toLowerCase(),x[0]));let s=qr(i),o=[];for(let T of s){let x=fe.find(({shorthands:S})=>S.includes(T));x&&!x.isCardProperty?o.push(...x.expanded):o.push(T)}let c=[],p=[],u=[],n=[],d=!1,h=[],C=[],F=[],w=[];for(let T of o)if(tt(T)){let[x,S]=T.split(":"),{modifier:y,values:g,isAnd:P,isOr:m}=et(S),{filterKey:b,isExcluded:k,isOptional:H,isMeta:D}=rt(x);if(D){if(["rarity","r"].includes(b)){let v=Xr(g);k||(C=[...v]),g=v.map(L=>L.toLowerCase())}["legal","l","hero"].includes(b),c.push(...ce(k,H,b,g,y,t))}else{if(["chain"].includes(b)){let v=B=>B.name.toLowerCase().replaceAll(f,""),L=g.map(B=>he(B,r)).filter(B=>!!B).map(v),E=new Set(L);b="name",m=!0;let W=20,R=0,O=B=>{if(!B.types.includes(l.Type.Hero)){let V=v(B);E.add(V),L.includes(V)||L.push(V)}};for(let B of L){if(R>W)break;let{referencedBy:V,references:oe}=X(B,r);oe.forEach(O),R===0&&V.forEach(O),R++}g=Array.from(E)}else if(["referencedby","references"].includes(b)){let v=b,L=[...g].filter(E=>!!E);g=[],b="name",m=!0;for(let E of L){let{referencedBy:W,references:R}=X(E,r);["referencedby"].includes(v)?g.push(...R.map(({name:O})=>O.toLowerCase().replaceAll(f,""))):["references"].includes(v)&&g.push(...W.map(({name:O})=>O.toLowerCase().replaceAll(f,"")))}}else if(["art","artist"].includes(b))p=g;else if(["print","prints","printing","printings"].includes(b))h=g;else if(["is","meta"].includes(b)){let v=Jr(g);g=v.map(L=>L.toLowerCase().replaceAll(f,"")),v.includes(l.Meta.Expansion)&&!k&&(d=!0)}else["foiling","foil"].includes(b)?(n=Qr(g),g=n.map(v=>v.toLowerCase())):["treat","treatment","var","variation"].includes(b)?(w=Zr(g),g=w.map(v=>v.toLowerCase())):["set","s"].includes(b)?(F=_r(g,a),g=F.map(v=>v.toLowerCase().replaceAll(f,""))):["pitch","p","color"].includes(b)&&(g=$r(g));ie[b]&&c.push({filterToPropertyMapping:ie[b],values:g,isAnd:P,isOr:m,modifier:y,isExcluded:k,isOptional:H})}}else if(T){let x=Y(T)?.card,S=pe(T);x?u.push(`"${x.toLowerCase().replace(f,"")}"`):S&&S.length>0?c.push(...S):u.push(T.replace(f,""))}return{appliedFilters:c,attributes:{artists:p,foilings:n,isExpansionSlot:d,prints:h,rarities:C,releases:F,treatments:w},keywords:u}},_r=(e,r=[])=>{let t=[];for(let a of e)t.push(...Yr(a,r));return t},Yr=(e,r=[])=>{let t=[],a=Object.values(l.Release).find(i=>i.toLowerCase().replaceAll(f,"")===e);if(a&&t.push(a),t.length===0){let i=l.setIdentifierToSetMappings[e];i&&t.push(i)}if(t.length===0){let i=Object.values(l.Release).filter(s=>s.toLowerCase().includes(e));i.length>0&&t.push(...i)}if(t.length===0){let i=r.find(s=>s.toLowerCase().replaceAll(f,"")===e);i&&t.push(i)}return t},Me={blue:3,yellow:2,red:1,white:0},$r=e=>{let r=[];for(let t of e)Me[t]||Me[t]===0?r.push(Me[t].toString()):r.push(t);return r},$e={exp:l.Meta.Expansion,expansion:l.Meta.Expansion,expansionSlot:l.Meta.Expansion,rainbow:l.Meta.Rainbow},Jr=e=>{let r=[];for(let t of e)$e[t]&&r.push($e[t]);return r},Je={r:l.Foiling.Rainbow,rf:l.Foiling.Rainbow,rainbow:l.Foiling.Rainbow,c:l.Foiling.Cold,cf:l.Foiling.Cold,cold:l.Foiling.Cold,g:l.Foiling.Gold,gf:l.Foiling.Gold,gold:l.Foiling.Gold},Qr=e=>{let r=[];for(let t of e)Je[t]&&r.push(Je[t]);return r},Qe={...Object.values(l.Treatment).reduce((e,r)=>(e[r.toLowerCase()]=r,e),{}),aa:l.Treatment.AA,alt:l.Treatment.AA,"alt art":l.Treatment.AA,ab:l.Treatment.AB,"alt border":l.Treatment.AB,at:l.Treatment.AT,"alt text":l.Treatment.AT,ea:l.Treatment.EA,extended:l.Treatment.EA,"extended art":l.Treatment.EA,fa:l.Treatment.FA,full:l.Treatment.FA,"full art":l.Treatment.FA},Zr=e=>{let r=[];for(let t of e)Qe[t]?r.push(Qe[t]):l.Treatment[t.toUpperCase()]&&r.push(l.Treatment[t.toUpperCase()]);return r},ve={b:l.Rarity.Basic,c:l.Rarity.Common,f:l.Rarity.Fabled,l:l.Rarity.Legendary,m:l.Rarity.Majestic,p:l.Rarity.Promo,r:l.Rarity.Rare,s:l.Rarity.SuperRare,t:l.Rarity.Token,v:l.Rarity.Marvel},Xr=e=>{let r=[];for(let t of e)ve[t]?r.push(ve[t]):r.push(t);return r},et=e=>{let r=[],t,a,i=rr.find(s=>e.includes(s));if(i){let[,s]=e.split(i);Ze(s)?(t=!0,r.push(...s.trim().split("+").map(o=>o.replace(f,"")))):Xe(s)?(a=!0,r.push(...s.trim().split(",").map(o=>o.replace(f,"")))):r.push(s.trim().replace(f,""))}else Ze(e)?(t=!0,r.push(...e.trim().split("+").map(s=>s.replace(f,"")))):Xe(e)?(a=!0,r.push(...e.trim().split(",").map(s=>s.replace(f,"")))):e.startsWith('"')&&e.endsWith('"')?r.push(e.trim().replaceAll('"',"").replace(f,"")):r.push(e.trim().replace(f,""));return{modifier:i,values:r,isAnd:t,isOr:a}},rt=e=>{let r=it(e);if(r){let[,t]=e.split(r);return{filterKey:t,isExcluded:!0,isOptional:!1,isMeta:er(t)}}else return{filterKey:e,isExcluded:!1,isOptional:!1,isMeta:er(e)}},tt=e=>e.indexOf(":")>=0,Ze=e=>e.indexOf("+")>=0,Xe=e=>e.indexOf(",")>=0,er=e=>!!ie[e]?.isMeta,it=e=>tr.find(r=>e.includes(r))?.slice(0,1);var M=require("@flesh-and-blood/types"),ir={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[M.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:[M.Hero.Kayo,M.Hero.Levia,M.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:M.Rarity.Rare,set:M.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${M.Treatment.FA}`,rarity:M.Rarity.Marvel,set:M.Release.Promos,treatment:M.Treatment.FA}],name:"Fangs A Lot",rarities:[M.Rarity.Rare,M.Rarity.Marvel],rarity:M.Rarity.Rare,sets:[M.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[M.Subtype.Attack],types:[M.Type.Action],typeText:"Generic Action - Attack"},ar=[{keyword:ir.name.toLowerCase(),card:ir}];var xe=class{constructor(r,t=[],a=[],i=!1){this.log=(r,...t)=>{this.debug&&console.log(r,...t)};this.search=(r,t)=>{let a,{appliedFilters:i,attributes:s,keywords:o}=Te(r,this.cards,this.additionalHeroes,this.additionalSets),c=o.join(" "),p=t?ar.filter(y=>y.keyword===c):[];if(p.length>0?a=p.map(({card:y})=>y):o.length?a=this.fuse.search(c).map(y=>y.item):a=[...this.cards],i.length&&(a=a.filter(y=>y&&or(y,i))),o.length===0){let y="";if(s.releases.length===1)try{let m=s.releases[0];y=ae.setToSetIdentifierMappings[m][0].toUpperCase()}catch(m){console.error("Error getting set identifier from search",m)}if(!y&&s.prints.length===1)try{let m=s.prints[0];ae.setIdentifierToSetMappings[m]&&(y=m.toUpperCase())}catch(m){console.error("Error getting set identifier from search",m)}y?a.sort((m,b)=>{let k=m.setIdentifiers.find(D=>D.includes(y))?.replace(y,""),H=b.setIdentifiers.find(D=>D.includes(y))?.replace(y,"");return k&&H?k.localeCompare(H):-1}):a.sort((m,b)=>m.name===b.name?`${m.pitch}`.localeCompare(`${b.pitch}`):m.name.localeCompare(b.name))}else{let y=[],g=[],P=o.map(m=>m.toLowerCase().replace(f,"")).join(" ");for(let m of a)m.name.toLowerCase().replace(f,"")===P?y.push(m):g.push(m);a=[...y,...g]}let u,{artists:n,isExpansionSlot:d,foilings:h,prints:C,rarities:F,releases:w,treatments:T}=s;(n.length>0||d||h.length>0||C.length>0||F.length>0||w.length>0||T.length>0)&&(u=a.map(y=>{let g=y.printings.filter(P=>{let m=!!P.image,b=n.length===0||n.some(R=>P.artists.find(O=>O.replace(f,"").toLowerCase().includes(R))),k=!d||d===P.isExpansionSlot,H=h.length===0||h.includes(P.foiling),D=C.length===0||C.some(R=>P.identifier.includes(R.toUpperCase())),v=F.length===0||F.includes(P.rarity),L=w.length===0||w.includes(P.set),E=T.length===0||P.treatments?.some(R=>T.includes(R));return m&&b&&k&&H&&D&&v&&L&&E});return{...y,matchingPrintings:g}}));let S=u?.length>0?u:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:S}};let s={getFn:(o,c)=>{let p=Ae.default.config.getFn(o,c);return p&&(Array.isArray(p)?p.map(u=>j(u.replace(f,""))):j(p).replace(f,""))},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};this.additionalHeroes=t,this.additionalSets=a,this.cards=[...r],this.debug=i,this.fuse=new Ae.default([...r],s)}},sr=xe,or=(e,r)=>{let t=!0,a=!1;for(let i of r){let s=i.isOptional,{isNumber:o,isString:c,isArray:p,isBoolean:u}=i.filterToPropertyMapping;if(o){let n=at(e,i);s?n&&(a=!0):t=t&&n}else if(c){let n=st(e,i);s?n&&(a=!0):t=t&&n}else if(p){let n=ot(e,i,r);s?n&&(a=!0):t=t&&n}else if(u){let n=nt(e,i);s?n&&(a=!0):t=t&&n}}return t},at=(e,r)=>{if(se(r,e)){let{values:t,modifier:a,isExcluded:i,filterToPropertyMapping:{partialMatch:s}}=r,o=Pe(e,r);if(o!=null&&!isNaN(o))if(o=parseInt(o),a)switch(a){case">=":let c=t?.some(d=>o>=parseInt(d));return i?!c:c;case">":let p=t?.some(d=>o>parseInt(d));return i?!p:p;case"<=":let u=t?.some(d=>o<=parseInt(d));return i?!u:u;case"<":let n=t?.some(d=>o<parseInt(d));return i?!n:n;default:return!1}else{let c=t?.some(p=>o===parseInt(p));return i?!c:c}else{let c=ct(e,r)?.toLowerCase(),p=s?t?.some(u=>c?.includes(u)):t?.some(u=>c===u);return i?!p:p}}else return!0},st=(e,r)=>{if(se(r,e)){let{values:t,isAnd:a,isExcluded:i,filterToPropertyMapping:{partialMatch:s}}=r,o=Pe(e,r)?.replaceAll(f,"");if(s){let c=a?t?.every(p=>o?.toLowerCase().includes(p)):t?.some(p=>o?.toLowerCase().includes(p));return i?!c:c}else{let c=a?t?.every(p=>o?.toLowerCase()===p):t?.some(p=>o?.toLowerCase()===p);return i?!c:c}}else return!0},ot=(e,r,t)=>{if(se(r,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=r,c=lt(e,r,t).map(p=>p?.replaceAll(f,""));if(o){let p=i?a.every(n=>c?.some(d=>d?.toLowerCase().includes(n))):a.some(n=>c?.some(d=>d?.toLowerCase().includes(n))),u=c.length===0;return s?!p||u:p}else{let p=i?a.every(u=>c?.some(n=>n?.toLowerCase()===u)):a.some(u=>c?.some(n=>n?.toLowerCase()===u));return s?!p:p}}else return!0},nt=(e,r)=>{if(se(r,e)){let{isExcluded:t}=r,a=Pe(e,r);return t?!a:a}else return!0},Pe=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.property]},lt=(e,r,t)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i,property:s}}=r,o=e[s]||[],c=[],p=Object.keys(e.legalOverrides||{}).length>0,u=r.filterToPropertyMapping.property==="legalHeroes",n=t.find(({filterToPropertyMapping:h})=>h.property==="legalFormats");if(p&&u&&!!n){let h=new Set;for(let{format:C,heroes:F}of e.legalOverrides||[])if(n.values.includes(C.toLowerCase()))for(let w of F)h.add(w);c=Array.from(h)}if(c.length===0)if(i){let h=new Set;for(let C of o)if(a){let F=C[i]||[];for(let w of F)h.add(w)}else{let F=C[i];F&&h.add(F)}c=Array.from(h)}else c=o;return c},ct=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.specialProperty]},se=({cardTypes:e},{types:r,subtypes:t})=>!e||e?.some(a=>r.map(i=>i.toLowerCase()).includes(a.toLowerCase())||t.map(i=>i.toLowerCase()).includes(a.toLowerCase()));0&&(module.exports={FilterProperty,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getAbbreviation,getAbbreviationByCard,getCardByName,getCleanText,getExcludedMetaFilters,getKeywordsAndAppliedFiltersFromText,getMetaFilters,getNormalizedText,getRelatedCards,getRelatedCardsByName,getTokensReferencedByCards,multiWordShorthands,shorthands,singleWordShorthands});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { default } from "./search";
|
|
2
|
-
export * from "./abbreviations";
|
|
3
|
-
export * from "./constants";
|
|
4
|
-
export * from "./filters";
|
|
5
|
-
export * from "./helpers";
|
|
6
|
-
export * from "./metaFilters";
|
|
7
|
-
export * from "./related";
|
|
8
|
-
export * from "./search";
|
|
9
|
-
export * from "./shorthands";
|
|
1
|
+
export { default } from "./search.js";
|
|
2
|
+
export * from "./abbreviations.js";
|
|
3
|
+
export * from "./constants.js";
|
|
4
|
+
export * from "./filters.js";
|
|
5
|
+
export * from "./helpers.js";
|
|
6
|
+
export * from "./metaFilters.js";
|
|
7
|
+
export * from "./related.js";
|
|
8
|
+
export * from "./search.js";
|
|
9
|
+
export * from "./shorthands.js";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { default as default2 } from "./search";
|
|
2
|
-
export * from "./abbreviations";
|
|
3
|
-
export * from "./constants";
|
|
4
|
-
export * from "./filters";
|
|
5
|
-
export * from "./helpers";
|
|
6
|
-
export * from "./metaFilters";
|
|
7
|
-
export * from "./related";
|
|
8
|
-
export * from "./search";
|
|
9
|
-
export * from "./shorthands";
|
|
1
|
+
import { default as default2 } from "./search.js";
|
|
2
|
+
export * from "./abbreviations.js";
|
|
3
|
+
export * from "./constants.js";
|
|
4
|
+
export * from "./filters.js";
|
|
5
|
+
export * from "./helpers.js";
|
|
6
|
+
export * from "./metaFilters.js";
|
|
7
|
+
export * from "./related.js";
|
|
8
|
+
export * from "./search.js";
|
|
9
|
+
export * from "./shorthands.js";
|
|
10
10
|
export {
|
|
11
11
|
default2 as default
|
|
12
12
|
};
|
package/dist/memes.js
CHANGED
|
@@ -12,6 +12,7 @@ const fangsALot = {
|
|
|
12
12
|
cardIdentifier: "fangs-a-lot-blue",
|
|
13
13
|
classes: [Class.Generic],
|
|
14
14
|
defaultImage: "FNG000",
|
|
15
|
+
firstReleaseDate: "2022-06-02",
|
|
15
16
|
functionalText: `If Fangs A Lot is put into your banished zone from your graveyard, instead put it into your hand.`,
|
|
16
17
|
legalFormats: [],
|
|
17
18
|
legalHeroes: [Hero.Kayo, Hero.Levia, Hero.Rhinar],
|
package/dist/metaFilters.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Format, Hero, Talent } from "@flesh-and-blood/types";
|
|
2
|
-
import { PUNCTUATION } from "./constants";
|
|
2
|
+
import { PUNCTUATION } from "./constants.js";
|
|
3
3
|
var FilterProperty = /* @__PURE__ */ ((FilterProperty2) => {
|
|
4
4
|
FilterProperty2["BannedFormats"] = "bannedFormats";
|
|
5
5
|
FilterProperty2["LegalFormats"] = "legalFormats";
|
package/dist/related.js
CHANGED
package/dist/search.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Card, DoubleSidedCard, Foiling, Hero, Printing, Release, Treatment } from "@flesh-and-blood/types";
|
|
2
|
-
import { AppliedFilter } from "./filters";
|
|
2
|
+
import { AppliedFilter } from "./filters.js";
|
|
3
3
|
export interface SearchCard extends DoubleSidedCard {
|
|
4
4
|
matchingPrintings?: Printing[];
|
|
5
5
|
}
|
package/dist/search.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
setToSetIdentifierMappings
|
|
4
4
|
} from "@flesh-and-blood/types";
|
|
5
5
|
import Fuse from "fuse.js";
|
|
6
|
-
import { PUNCTUATION } from "./constants";
|
|
7
|
-
import { getKeywordsAndAppliedFiltersFromText } from "./filters";
|
|
8
|
-
import { memes } from "./memes";
|
|
9
|
-
import { getNormalizedText } from "./helpers";
|
|
10
|
-
import { FilterProperty } from "./metaFilters";
|
|
6
|
+
import { PUNCTUATION } from "./constants.js";
|
|
7
|
+
import { getKeywordsAndAppliedFiltersFromText } from "./filters.js";
|
|
8
|
+
import { memes } from "./memes.js";
|
|
9
|
+
import { getNormalizedText } from "./helpers.js";
|
|
10
|
+
import { FilterProperty } from "./metaFilters.js";
|
|
11
11
|
class Search {
|
|
12
12
|
constructor(cards, additionalHeroes = [], additionalSets = [], debug = false) {
|
|
13
13
|
this.log = (message, ...optionalParams) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesh-and-blood/search",
|
|
3
3
|
"description": "TypeScript search engine for Flesh and Blood cards",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@flesh-and-blood/types": "^4.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@flesh-and-blood/cards": "^4.0.
|
|
47
|
-
"@flesh-and-blood/types": "^4.0.
|
|
46
|
+
"@flesh-and-blood/cards": "^4.0.4",
|
|
47
|
+
"@flesh-and-blood/types": "^4.0.4",
|
|
48
48
|
"@types/jest": "^29.5.11",
|
|
49
49
|
"@types/node": "^20.10.5",
|
|
50
50
|
"esbuild": "^0.19.10",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"FAB",
|
|
75
75
|
"FABTCG"
|
|
76
76
|
],
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "341ad7b281233911841c004cc8109203375867ec"
|
|
78
78
|
}
|