import { strToHSL , getSecondaryColor } from "src/shared/utils/color" ; export const slugify = ( str ) : string => { const a = "àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;" ; const b = "aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnooooooooprrsssssttuuuuuuuuuwxyyzzz------" ; const p = new RegExp ( a . split ( "" ) . join ( "|" ) , "g" ) ; return str . toString ( ) . toLowerCase ( ) . replace ( /\s+/g , "-" ) . replace ( p , ( c ) => b . charAt ( a . indexOf ( c ) ) ) . replace ( /&/g , "-and-" ) . replace ( /[^\w-]+/g , "" ) . replace ( /--+/g , "-" ) . replace ( /^-+/ , "" ) . replace ( /-+$/ , "" ) ; } ; const REVIEW_IS_NEW_THRESHOLD = 15552000000 ; export const getReviewCardTags = ( tags , isDark , date ? ) => [ ... ( date && Number ( new Date ( ) ) - Number ( date ) < REVIEW_IS_NEW_THRESHOLD ? [ { label : "new" , bgColor : "goldSecondary" } ] : [ ] ) , ... ( tags ? tags . filter ( ( t ) => ! ! t ) . map ( ( tagText ) => ( { label : tagText , bgColor : getSecondaryColor ( isDark , strToHSL ( tagText ) ) , } ) ) : [ ] ) , ] ;