{"version":3,"file":"MogulCard-C3aIvo52.js","sources":["../../src/enums/mogul.ts","../../src/types/Currency.ts","../../src/libs/helpers.ts","../../src/libs/moguls.ts","../../src/components/marineMoguls/MogulCard.vue"],"sourcesContent":["enum MogulState {\n Small = 1,\n Large,\n}\n\nenum PrizeType {\n USDT = 'USDT',\n METFI = 'METFI',\n UNSTAKED = 'UNSTAKED',\n MATCHING = 'MATCHING',\n METBOT = 'METBOT',\n}\n\n\nexport { MogulState, PrizeType}\n","\nexport interface Allowance {\n allowance: number\n allowance_raw: string\n token_address: string\n}\n\nexport interface CurrencyToken {\n address: string\n name_short: string\n name_long: string\n decimals: number\n format_decimals: number\n amount: number\n amount_raw: string\n allowances: Allowance[]\n}\n\nexport interface CurrencyPriceConversion {\n address: string\n name_short: string\n price: string\n}\n\nexport const emptyCurrencyToken = (): CurrencyToken => ({\n address: '',\n name_short: '',\n name_long: '',\n decimals: 0,\n format_decimals: 0,\n amount: 0,\n amount_raw: '',\n allowances: []\n})\n\nexport interface Currency {\n address: string\n name: string\n long_name: string\n decimals: number\n format_decimals: number\n}\n\nexport const emptyCurrency = (): Currency => ({\n address: '',\n name: '',\n long_name: '',\n decimals: 0,\n format_decimals: 0\n})","import {useI18n} from 'vue-i18n'\nimport {type Currency, emptyCurrency} from '@/types/Currency'\nimport {useChainStore} from '@/stores/chain'\n\nconst generateRandomId = (prefix: string = ''): string => {\n return `${prefix ? `${prefix}-` : ''}${(Math.random() * 1e6).toFixed(0)}`\n}\n\nconst shortAddress = (val: string): string => {\n if (!val) {\n return ''\n }\n\n return `${val.substring(0, 6)}...${val.substring(val.length - 5, val.length)}`\n}\n\nconst formatNumber = (\n val: number | string | null | undefined,\n { divisionNum = 1000, decimals = 2, NAText = '0.00' } = {}\n) => {\n if (!val) return NAText\n\n const num = Number(val)\n if (isNaN(num)) return NAText\n\n const numToDisplay = num / (divisionNum ?? 1000)\n let fractionDigits = numToDisplay < 1_000_000 ? decimals ?? 2 : 0\n\n if (numToDisplay.toString().includes('.')) {\n const numberOfDecimals = numToDisplay.toString().split('.')[1].length\n if (numberOfDecimals > fractionDigits) fractionDigits = numberOfDecimals\n }\n\n return numToDisplay.toLocaleString(undefined, {\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits\n })\n}\n\nconst padDigit = (val: number) => {\n return val < 10 ? `0${val}` : val\n}\n\nconst generateRandomString = (\n length = 5,\n characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\n): string => {\n let result = ''\n const charactersLength = characters.length\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength))\n }\n\n return result\n}\n\nconst addressValidator = (address: string): boolean => {\n if (address === undefined || address === null || address.length === 0 || address.length > 42) {\n return false\n }\n const regex = /0x[a-fA-F0-9]{40}/\n return regex.test(address)\n}\n\nconst isNumber = (value: string | number): boolean => {\n return !isNaN(Number(value))\n}\n\nconst selectRandomReferral = (): string => {\n const mainReferrals = [\n '3ec251928dd6e3c49b467cbf1811337a',\n 'a4d0569cf2ce7ab76631a19149c98c7c',\n '90eef6f5617b2895cfd9f86cf28abec3'\n ]\n return mainReferrals[Math.floor(Math.random() * 3)]\n}\n\nconst selectRandomWordForFinishedAuction = (): string => {\n const words = [\n 'auction.congratulations',\n 'auction.cheers',\n 'auction.bravo',\n 'auction.kudos',\n 'auction.well_done',\n 'auction.hooray',\n 'auction.celebrations',\n 'auction.commendations',\n 'auction.applause',\n 'auction.felicitations',\n 'auction.props',\n 'auction.salutations',\n 'auction.hurrah',\n 'auction.praise',\n 'auction.ovation',\n 'auction.plaudits',\n 'auction.tribute'\n ]\n\n return words[Math.floor(Math.random() * 3)]\n}\n\nconst formatDollar = (val: number | string, { decimals = 2 } = {}): string => {\n if (isNaN(Number(val))) return Number(0).toLocaleString(undefined, {\n maximumFractionDigits: decimals,\n minimumFractionDigits: decimals\n })\n return Number(val).toLocaleString(undefined, {\n maximumFractionDigits: decimals,\n minimumFractionDigits: decimals\n })\n}\n\nconst reflowAnimation = (elRef: any) => {\n if (!elRef || !elRef.style) return\n // setting animation to none, then force browser to reflow element by calling getClientRects\n // after that, setting animation to '' tells css to inherit animation from default element (.current-price-glow)\n elRef.style.animation = 'none'\n elRef.getClientRects()\n elRef.style.animation = ''\n}\n\nconst characterNameByLevel = (level : number) : string => {\n const t = useI18n().t\n switch (level) {\n case 0: return t('characters.plankton')\n case 1: return t('characters.shrimp')\n case 2: return t('characters.crab')\n case 3: return t('characters.octopus')\n case 4: return t('characters.fish')\n case 5: return t('characters.dolphin')\n case 6: return t('characters.shark')\n case 7: return t('characters.orca')\n case 8: return t('characters.whale')\n case 9: return t('characters.whale_shark')\n case 10: return t('characters.humpback')\n }\n return ''\n}\n\n\nconst getCurrencyIcon = (currencyAddress: string) => {\n switch (currencyAddress) {\n case '0x55d398326f99059fF775485246999027B3197955':\n return new URL('@/assets/images/currencies/usdt.png', import.meta.url).href\n case '0x3E7f1039896454B9cb27c53CC7383e1AB9D9512a':\n return new URL('@/assets/images/currencies/metfi.svg', import.meta.url).href\n default:\n return ''\n }\n}\n\nconst getCurrencyAddress = (currencyAddress: string): Currency => {\n const currencies = useChainStore().getCurrencies()\n if (currencies.length > 0) {\n const index = currencies.findIndex(x => x.address === currencyAddress)\n if (index > -1) return currencies[index]\n }\n return emptyCurrency()\n}\n\nconst getCurrencyByName = (name: string): Currency => {\n const currencies = useChainStore().getCurrencies()\n if (currencies.length > 0) {\n const index = currencies.findIndex(x => x.name === name)\n if (index > -1) return currencies[index]\n }\n return emptyCurrency()\n}\n\nconst isDevHostname = () : boolean => {\n return window.location.host.includes('localhost') || window.location.host.includes('.dev')\n}\nconst getImagePrefix = () => {\n return isDevHostname() ? '' : 'https://images.marinemoguls.com'\n}\n\n\nexport {\n generateRandomId,\n shortAddress,\n formatNumber,\n generateRandomString,\n addressValidator,\n isNumber,\n selectRandomReferral,\n selectRandomWordForFinishedAuction,\n formatDollar,\n reflowAnimation,\n characterNameByLevel,\n getCurrencyIcon,\n getCurrencyAddress,\n getCurrencyByName,\n getImagePrefix\n}\n","import type {Mogul} from '@/types/Mogul'\nimport {getImagePrefix} from \"@/libs/helpers\";\n\n\nconst getImageNameForMogul = (mogul : Mogul) => {\n return `${mogul.nft_id}`\n}\n\nconst getFullImageNameForMogul = (mogul : Mogul, size: string) => {\n if (size !== 'full' && size !== '512') return ''\n\n return `${getImagePrefix()}/api/images/v1/${size}/${getImageNameForMogul(mogul)}`\n}\n\nexport {getImageNameForMogul, getFullImageNameForMogul}\n","\n\n\n\n\n"],"names":["MogulState","MogulState2","PrizeType","emptyCurrency","formatNumber","val","divisionNum","decimals","NAText","num","numToDisplay","fractionDigits","numberOfDecimals","characterNameByLevel","level","t","useI18n","getCurrencyIcon","currencyAddress","getCurrencyAddress","currencies","useChainStore","index","x","isDevHostname","getImagePrefix","getImageNameForMogul","mogul","props","__props","imageLevel","computed","isMergable","hasPrize","isCraftable","prizeType","prizeAmount","_a","_b"],"mappings":"wcAAK,IAAAA,GAAAA,IACDA,EAAAA,EAAA,MAAQ,CAAR,EAAA,QACAA,EAAAC,EAAA,MAAA,CAAA,EAAA,QAFCD,IAAAA,GAAA,CAAA,CAAA,EAKAE,GAAAA,IACDA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,OAAS,SALRA,IAAAA,GAAA,CAAA,CAAA,ECsCE,MAAMC,EAAgB,KAAiB,CAC1C,QAAS,GACT,KAAM,GACN,UAAW,GACX,SAAU,EACV,gBAAiB,CACrB,GCjCMC,GAAe,CACnBC,EACA,CAAE,YAAAC,EAAc,IAAM,SAAAC,EAAW,EAAG,OAAAC,EAAS,MAAW,EAAA,KACrD,CACH,GAAI,CAACH,EAAY,OAAAG,EAEX,MAAAC,EAAM,OAAOJ,CAAG,EACtB,GAAI,MAAMI,CAAG,EAAU,OAAAD,EAEjB,MAAAE,EAAeD,GAAOH,GAAe,KAC3C,IAAIK,EAAi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