{"version":3,"file":"badge2.js","sources":["../../../../../../packages/components/badge/src/badge.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <slot />\n <transition :name=\"`${ns.namespace.value}-zoom-in-center`\">\n <sup\n v-show=\"!hidden && (content || isDot)\"\n :class=\"[\n ns.e('content'),\n ns.em('content', type),\n ns.is('fixed', !!$slots.default),\n ns.is('dot', isDot),\n badgeClass,\n ]\"\n :style=\"style\"\n v-text=\"content\"\n />\n </transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { addUnit, isNumber } from '@element-plus/utils'\nimport { badgeProps } from './badge'\nimport type { StyleValue } from 'vue'\n\ndefineOptions({\n name: 'ElBadge',\n})\n\nconst props = defineProps(badgeProps)\n\nconst ns = useNamespace('badge')\n\nconst content = computed<string>(() => {\n if (props.isDot) return ''\n if (isNumber(props.value) && isNumber(props.max)) {\n if (props.max < props.value) {\n return `${props.max}+`\n }\n return props.value === 0 && !props.showZero ? '' : `${props.value}`\n }\n return `${props.value}`\n})\nconst style = computed<StyleValue>(() => {\n return [\n {\n backgroundColor: props.color,\n marginRight: addUnit(-(props.offset?.[0] ?? 0)),\n marginTop: addUnit(props.offset?.[1] ?? 0),\n },\n props.badgeStyle ?? {},\n ]\n})\n\ndefineExpose({\n /** @description badge content */\n content,\n})\n</script>\n"],"names":["useNamespace","computed","isNumber","style","addUnit"],"mappings":";;;;;;;;;;;;;uCA2Bc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAIA,IAAM,MAAA,EAAA,GAAKA,mBAAa,OAAO,CAAA,CAAA;AAE/B,IAAM,MAAA,OAAA,GAAUC,aAAiB,MAAM;AACrC,MAAA,IAAI,KAAM,CAAA,KAAA;AAAO,QAAO,OAAA,EAAA,CAAA;AACxB,MAAA,IAAIC,eAAS,KAAM,CAAA,KAAK,KAAKA,cAAS,CAAA,KAAA,CAAM,G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