@cfxjs/sirius-next-common 0.2.18 → 0.2.19
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/dist/{chunk-NFPBS22O.js → chunk-C3E5EA6J.js} +2 -3
- package/dist/chunk-C3E5EA6J.js.map +1 -0
- package/dist/{chunk-K4SBN5ZT.js → chunk-GPQN2P32.js} +2 -2
- package/dist/{chunk-GG7ROFBQ.js → chunk-S7M6UTND.js} +6 -5
- package/dist/chunk-S7M6UTND.js.map +1 -0
- package/dist/{chunk-YKHDBNJD.js → chunk-TC4445WV.js} +12 -5
- package/dist/chunk-TC4445WV.js.map +1 -0
- package/dist/components/AddressContainer/CoreAddressContainer.js +3 -3
- package/dist/components/AddressContainer/EVMAddressContainer.js +3 -3
- package/dist/components/AddressContainer/addressSwitcher.js +2 -2
- package/dist/components/AddressContainer/addressView.d.ts +1 -1
- package/dist/components/AddressContainer/addressView.js +1 -1
- package/dist/components/AddressContainer/types.d.ts +0 -1
- package/dist/components/TransactionAction/coreTransactionAction.js +3 -3
- package/dist/components/TransactionAction/evmTransactionAction.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-GG7ROFBQ.js.map +0 -1
- package/dist/chunk-NFPBS22O.js.map +0 -1
- package/dist/chunk-YKHDBNJD.js.map +0 -1
- /package/dist/{chunk-K4SBN5ZT.js.map → chunk-GPQN2P32.js.map} +0 -0
|
@@ -56,7 +56,6 @@ var RenderAddress = ({
|
|
|
56
56
|
cfxAddress,
|
|
57
57
|
tokenName,
|
|
58
58
|
contractName,
|
|
59
|
-
showVerificationName = false,
|
|
60
59
|
verificationName,
|
|
61
60
|
hoverValue,
|
|
62
61
|
hrefAddress,
|
|
@@ -82,7 +81,7 @@ var RenderAddress = ({
|
|
|
82
81
|
nametag || // contract token name
|
|
83
82
|
tokenName || // contract name tag
|
|
84
83
|
contractName || // contract verification name
|
|
85
|
-
|
|
84
|
+
verificationName || // CNS/ENS
|
|
86
85
|
ENSLabel || // inner name is used for some special address, like the zero address
|
|
87
86
|
innerName
|
|
88
87
|
);
|
|
@@ -144,4 +143,4 @@ var RenderAddress = ({
|
|
|
144
143
|
export {
|
|
145
144
|
RenderAddress
|
|
146
145
|
};
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-C3E5EA6J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\n\nconst defaultPCMaxWidth = 138;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n if (link === false) {\n return false;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n tokenName,\n contractName,\n verificationName,\n hoverValue,\n hrefAddress,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n ENSIcon = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n innerName = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n // Private name tags > Official tag/name > contract token name > contract name tag > contract verification name > CNS/ENS\n const name =\n // Private name tags\n addressLabel ||\n // Official tag/name\n nametag ||\n // contract token name\n tokenName ||\n // contract name tag\n contractName ||\n // contract verification name\n verificationName ||\n // CNS/ENS\n ENSLabel ||\n // inner name is used for some special address, like the zero address\n innerName;\n const isShowEns = !!ENSLabel && name === ENSLabel;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'unset' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: tokenName || contractName || verificationName,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof checksumAddress === 'string' && !isFull\n ? type === 'pos'\n ? shortenAddress(checksumAddress!, {\n prefixLength: 10,\n suffixLength: 0,\n })\n : shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\">\n {prefix || (isShowEns ? ENSIcon : null)}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAS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;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,YAClC,GAAI,OAAO,EAAE,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC;AAAA,YAErC,kBAAQ;AAAA;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-MWAD4CIG.js";
|
|
4
4
|
import {
|
|
5
5
|
RenderAddress
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C3E5EA6J.js";
|
|
7
7
|
import {
|
|
8
8
|
formatAddress,
|
|
9
9
|
isInnerContractAddress
|
|
@@ -209,4 +209,4 @@ export {
|
|
|
209
209
|
MyAddress,
|
|
210
210
|
PosAddress
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-GPQN2P32.js.map
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
InvalidAddress,
|
|
12
12
|
MyAddress,
|
|
13
13
|
PosAddress
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GPQN2P32.js";
|
|
15
15
|
import {
|
|
16
16
|
RenderAddress
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-C3E5EA6J.js";
|
|
18
18
|
import {
|
|
19
19
|
formatAddress,
|
|
20
20
|
isCoreAddress,
|
|
@@ -41,7 +41,8 @@ var parseProps = (props, globalData) => {
|
|
|
41
41
|
showENSLabel,
|
|
42
42
|
ensName,
|
|
43
43
|
nameMap,
|
|
44
|
-
cfxAddress
|
|
44
|
+
cfxAddress,
|
|
45
|
+
showVerificationName
|
|
45
46
|
} = props;
|
|
46
47
|
const translations = getTranslations();
|
|
47
48
|
const nameInfo = getAddressNameInfo(cfxAddress, nameMap);
|
|
@@ -80,7 +81,7 @@ var parseProps = (props, globalData) => {
|
|
|
80
81
|
cfxAddress,
|
|
81
82
|
tokenName: props.tokenName || nameInfo?.tokenName,
|
|
82
83
|
contractName: props.contractName || nameInfo?.contractName,
|
|
83
|
-
verificationName: props.verificationName || nameInfo?.verificationName,
|
|
84
|
+
verificationName: showVerificationName ? props.verificationName || nameInfo?.verificationName : void 0,
|
|
84
85
|
verify: props.verify || nameInfo?.verify,
|
|
85
86
|
ensName: props.ensName || nameInfo?.ensName,
|
|
86
87
|
isEspaceAddress: props.isEspaceAddress || nameInfo?.isEspaceAddress
|
|
@@ -142,4 +143,4 @@ var CoreAddressContainer = withTranslation()(
|
|
|
142
143
|
export {
|
|
143
144
|
CoreAddressContainer
|
|
144
145
|
};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-S7M6UTND.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/CoreAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isCoreAddress,\n isCoreContractAddress,\n isZeroAddress,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { useENS } from '../../utils/hooks/useENS';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n CoreHexAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n PosAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { CoreAddressContainerProps } from './types';\nimport ICON_ENS from '../../images/logo-cns.svg';\nimport { getAddressNameInfo } from './utils';\n\nconst parseProps = (\n props: CoreAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const {\n t,\n showAddressLabel,\n showNametag,\n nametag,\n showENSLabel,\n ensName,\n nameMap,\n cfxAddress,\n showVerificationName,\n } = props;\n\n const translations = getTranslations();\n\n const nameInfo = getAddressNameInfo(cfxAddress, nameMap);\n\n let innerName = props.innerName;\n if (!innerName && isZeroAddress(cfxAddress)) {\n innerName = t(translations.general.zeroAddress);\n }\n\n // private name tag\n let addressLabel: React.ReactNode = null;\n // official name tag\n let officalNametag: React.ReactNode = null;\n // ens name tag\n let ENSLabel: React.ReactNode = null;\n let ENSIcon: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n addressLabel = addressLabels?.[cfxAddress];\n }\n\n if (cfxAddress && showNametag) {\n officalNametag = nametag || nameInfo?.nametag;\n }\n\n if (showENSLabel && ensName) {\n ENSLabel = ensName;\n ENSIcon = (\n <img\n src={ICON_ENS}\n className=\"w-[16px] h-[16px] mb-[3px] mr-[2px]\"\n alt=\"\"\n />\n );\n }\n\n return {\n innerName,\n nametag: officalNametag,\n addressLabel,\n ENSLabel,\n ENSIcon: ENSIcon,\n cfxAddress,\n tokenName: props.tokenName || nameInfo?.tokenName,\n contractName: props.contractName || nameInfo?.contractName,\n verificationName: showVerificationName\n ? props.verificationName || nameInfo?.verificationName\n : undefined,\n verify: props.verify || nameInfo?.verify,\n ensName: props.ensName || nameInfo?.ensName,\n isEspaceAddress: props.isEspaceAddress || nameInfo?.isEspaceAddress,\n };\n};\n\nexport const CoreAddressContainer = withTranslation()(\n memo((props: CoreAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If the interface returns Ens content, there is no need to obtain it separately, or disable the display of Ens content (in most cases on the list page).\n const unnecessaryEns = !!props.ensName || props.showENSLabel === false;\n const { ens } = useENS(unnecessaryEns ? null : props.value);\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n const cfxAddress = formatAddress(props.value, 'base32');\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n cfxAddress,\n ensName: ens ? ens[cfxAddress]?.name : undefined,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (mergeParseProps.isPosAddress) {\n return PosAddress(mergeParseProps);\n }\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'base32',\n });\n }\n\n if (mergeParseProps.isEspaceAddress) {\n return CoreHexAddress(mergeParseProps);\n }\n\n if (!isCoreAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (isCoreContractAddress(mergeParseProps.cfxAddress)) {\n return ContractAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isMe) {\n return MyAddress(mergeParseProps);\n }\n\n return RenderAddress(mergeParseProps);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,SAA0B,uBAAuB;AACjD,OAAO,OAAO;AAsBd,OAAO,cAAc;AAiDf,SAoCO,UApCP;AA9CN,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,eAAe,gBAAgB;AAErC,QAAM,WAAW,mBAAmB,YAAY,OAAO;AAEvD,MAAI,YAAY,MAAM;AACtB,MAAI,CAAC,aAAa,cAAc,UAAU,GAAG;AAC3C,gBAAY,EAAE,aAAa,QAAQ,WAAW;AAAA,EAChD;AAGA,MAAI,eAAgC;AAEpC,MAAI,iBAAkC;AAEtC,MAAI,WAA4B;AAChC,MAAI,UAA2B;AAE/B,MAAI,cAAc,kBAAkB;AAElC,UAAM,gBAAgB,6DAA+C;AACrE,mBAAe,gBAAgB,UAAU;AAAA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,kBAAkB,EAAE;AAAA,MACxB,CAAC;AAAA,MACD;AAAA,MACA,WAAW,mBAAmB,UAAU;AAAA,IAC1C;AAEA,QAAI,gBAAgB,cAAc;AAChC,aAAO,WAAW,eAAe;AAAA,IACnC;AAEA,QAAI,CAAC,gBAAgB,SAAS,gBAAgB,iBAAiB;AAC7D,aAAO,uBAAuB;AAAA,QAC5B,GAAG;AAAA,QACH,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,QAAI,gBAAgB,iBAAiB;AACnC,aAAO,eAAe,eAAe;AAAA,IACvC;AAEA,QAAI,CAAC,cAAc,gBAAgB,KAAK,GAAG;AACzC,aAAO,eAAe,eAAe;AAAA,IACvC;AAEA,QAAI,sBAAsB,gBAAgB,UAAU,GAAG;AACrD,aAAO,gBAAgB,eAAe;AAAA,IACxC;AAEA,QAAI,gBAAgB,MAAM;AACxB,aAAO,UAAU,eAAe;AAAA,IAClC;AAEA,WAAO,cAAc,eAAe;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
ContractCreatedAddress,
|
|
7
7
|
InvalidAddress,
|
|
8
8
|
MyAddress
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GPQN2P32.js";
|
|
10
10
|
import {
|
|
11
11
|
RenderAddress
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-C3E5EA6J.js";
|
|
13
13
|
import {
|
|
14
14
|
convertCheckSum,
|
|
15
15
|
formatAddress,
|
|
@@ -27,7 +27,14 @@ import { withTranslation } from "react-i18next";
|
|
|
27
27
|
import _ from "lodash";
|
|
28
28
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
29
29
|
var parseProps = (props, globalData) => {
|
|
30
|
-
const {
|
|
30
|
+
const {
|
|
31
|
+
t,
|
|
32
|
+
showAddressLabel,
|
|
33
|
+
showNametag,
|
|
34
|
+
nametag,
|
|
35
|
+
nameMap,
|
|
36
|
+
showVerificationName
|
|
37
|
+
} = props;
|
|
31
38
|
const value = props.value || "";
|
|
32
39
|
const cfxAddress = formatAddress(value, "hex");
|
|
33
40
|
const nameInfo = getAddressNameInfo(cfxAddress, nameMap);
|
|
@@ -52,7 +59,7 @@ var parseProps = (props, globalData) => {
|
|
|
52
59
|
cfxAddress,
|
|
53
60
|
tokenName: props.tokenName || nameInfo?.tokenName,
|
|
54
61
|
contractName: props.contractName || nameInfo?.contractName,
|
|
55
|
-
verificationName: props.verificationName || nameInfo?.verificationName,
|
|
62
|
+
verificationName: showVerificationName ? props.verificationName || nameInfo?.verificationName : void 0,
|
|
56
63
|
verify: props.verify || nameInfo?.verify,
|
|
57
64
|
isContract: props.isContract || nameInfo?.isContract
|
|
58
65
|
};
|
|
@@ -102,4 +109,4 @@ var EVMAddressContainer = withTranslation()(
|
|
|
102
109
|
export {
|
|
103
110
|
EVMAddressContainer
|
|
104
111
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-TC4445WV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/EVMAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isEvmAddress,\n isZeroAddress,\n convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { EVMAddressContainerProps } from './types';\nimport { getAddressNameInfo } from './utils';\n\nconst parseProps = (\n props: EVMAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const {\n t,\n showAddressLabel,\n showNametag,\n nametag,\n nameMap,\n showVerificationName,\n } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'hex');\n\n const nameInfo = getAddressNameInfo(cfxAddress, nameMap);\n\n const translations = getTranslations();\n\n let innerName = props.innerName;\n if (!innerName && isZeroAddress(cfxAddress)) {\n innerName = t(translations.general.zeroAddress);\n }\n\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n addressLabel =\n addressLabels?.[convertCheckSum(cfxAddress)] ||\n addressLabels?.[cfxAddress.toLowerCase()];\n }\n\n if (cfxAddress && showNametag) {\n officalNametag = nametag || nameInfo?.nametag;\n }\n\n return {\n innerName,\n nametag: officalNametag,\n addressLabel,\n cfxAddress,\n tokenName: props.tokenName || nameInfo?.tokenName,\n contractName: props.contractName || nameInfo?.contractName,\n verificationName: showVerificationName\n ? props.verificationName || nameInfo?.verificationName\n : undefined,\n verify: props.verify || nameInfo?.verify,\n isContract: props.isContract || nameInfo?.isContract,\n };\n};\n\nexport const EVMAddressContainer = withTranslation()(\n memo((props: EVMAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'hex',\n });\n }\n\n if (!isEvmAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isContract) {\n return ContractAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isMe) {\n return MyAddress(mergeParseProps);\n }\n\n return RenderAddress(mergeParseProps);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,SAA0B,uBAAuB;AACjD,OAAO,OAAO;AAmFD;AA9Db,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,QAAgB,MAAM,SAAS;AACrC,QAAM,aAAa,cAAc,OAAO,KAAK;AAE7C,QAAM,WAAW,mBAAmB,YAAY,OAAO;AAEvD,QAAM,eAAe,gBAAgB;AAErC,MAAI,YAAY,MAAM;AACtB,MAAI,CAAC,aAAa,cAAc,UAAU,GAAG;AAC3C,gBAAY,EAAE,aAAa,QAAQ,WAAW;AAAA,EAChD;AAGA,MAAI,iBAAkC;AAEtC,MAAI,eAAgC;AAEpC,MAAI,cAAc,kBAAkB;AAElC,UAAM,gBAAgB,6DAA+C;AACrE,mBACE,gBAAgB,gBAAgB,UAAU,CAAC,KAC3C,gBAAgB,WAAW,YAAY,CAAC;AAAA,EAC5C;AAEA,MAAI,cAAc,aAAa;AAC7B,qBAAiB,WAAW,UAAU;AAAA,EACxC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,WAAW,MAAM,aAAa,UAAU;AAAA,IACxC,cAAc,MAAM,gBAAgB,UAAU;AAAA,IAC9C,kBAAkB,uBACd,MAAM,oBAAoB,UAAU,mBACpC;AAAA,IACJ,QAAQ,MAAM,UAAU,UAAU;AAAA,IAClC,YAAY,MAAM,cAAc,UAAU;AAAA,EAC5C;AACF;AAEO,IAAM,sBAAsB,gBAAgB;AAAA,EACjD,KAAK,CAAC,UAAsD;AAC1D,UAAM,EAAE,WAAW,IAAI,cAAc;AAGrC,QAAI,CAAC,MAAM,SAAS,CAAC,MAAM,iBAAiB;AAC1C,aAAO,gCAAE,gBAAE;AAAA,IACb;AAEA,UAAM,eAAe;AAAA,MACnB,QAAQ;AAAA,MACR,eAAe;AAAA,MACf,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,aAAa;AAAA,IACf;AAEA,UAAM,oBAAoB,EAAE,OAAO,CAAC,GAAG,cAAc,KAAK;AAE1D,UAAM,kBAAkB,EAAE;AAAA,MACxB,CAAC;AAAA,MACD;AAAA,MACA,WAAW,mBAAmB,UAAU;AAAA,IAC1C;AAEA,QAAI,CAAC,gBAAgB,SAAS,gBAAgB,iBAAiB;AAC7D,aAAO,uBAAuB;AAAA,QAC5B,GAAG;AAAA,QACH,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,QAAI,CAAC,aAAa,gBAAgB,KAAK,GAAG;AACxC,aAAO,eAAe,eAAe;AAAA,IACvC;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO,gBAAgB,eAAe;AAAA,IACxC;AAEA,QAAI,gBAAgB,MAAM;AACxB,aAAO,UAAU,eAAe;AAAA,IAClC;AAEA,WAAO,cAAc,eAAe;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CoreAddressContainer
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-S7M6UTND.js";
|
|
4
4
|
import "../../chunk-CMOP3BKX.js";
|
|
5
5
|
import "../../chunk-WZIT54AU.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-GPQN2P32.js";
|
|
7
7
|
import "../../chunk-MWAD4CIG.js";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-C3E5EA6J.js";
|
|
9
9
|
import "../../chunk-6L4ZEJQI.js";
|
|
10
10
|
import "../../chunk-C7OIVXE3.js";
|
|
11
11
|
import "../../chunk-TOKKKTFG.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EVMAddressContainer
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-TC4445WV.js";
|
|
4
4
|
import "../../chunk-WZIT54AU.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-GPQN2P32.js";
|
|
6
6
|
import "../../chunk-MWAD4CIG.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-C3E5EA6J.js";
|
|
8
8
|
import "../../chunk-6L4ZEJQI.js";
|
|
9
9
|
import "../../chunk-C7OIVXE3.js";
|
|
10
10
|
import "../../chunk-TOKKKTFG.js";
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
InvalidAddress,
|
|
6
6
|
MyAddress,
|
|
7
7
|
PosAddress
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-GPQN2P32.js";
|
|
9
9
|
import "../../chunk-MWAD4CIG.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-C3E5EA6J.js";
|
|
11
11
|
import "../../chunk-6L4ZEJQI.js";
|
|
12
12
|
import "../../chunk-C7OIVXE3.js";
|
|
13
13
|
import "../../chunk-TOKKKTFG.js";
|
|
@@ -2,6 +2,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { RenderAddressProps } from './types.js';
|
|
3
3
|
import '../../utils/request.types.js';
|
|
4
4
|
|
|
5
|
-
declare const RenderAddress: ({ cfxAddress, tokenName, contractName,
|
|
5
|
+
declare const RenderAddress: ({ cfxAddress, tokenName, contractName, verificationName, hoverValue, hrefAddress, link, isFull, isFullNameTag, style, maxWidth, prefix, ENSIcon, suffix, type, addressLabel, ENSLabel, nametag, innerName, hideAliasPrefixInHover, }: RenderAddressProps) => react_jsx_runtime.JSX.Element;
|
|
6
6
|
|
|
7
7
|
export { RenderAddress };
|
|
@@ -68,7 +68,6 @@ interface RenderAddressProps {
|
|
|
68
68
|
type?: 'pow' | 'pos';
|
|
69
69
|
tokenName?: string | null;
|
|
70
70
|
contractName?: string | null;
|
|
71
|
-
showVerificationName?: boolean;
|
|
72
71
|
verificationName?: string | null;
|
|
73
72
|
innerName?: string | null;
|
|
74
73
|
addressLabel?: string | Iterable<React.ReactNode> | null;
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
import "../../chunk-TGK5LP2H.js";
|
|
11
11
|
import {
|
|
12
12
|
CoreAddressContainer
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-S7M6UTND.js";
|
|
14
14
|
import "../../chunk-CMOP3BKX.js";
|
|
15
15
|
import "../../chunk-WZIT54AU.js";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-GPQN2P32.js";
|
|
17
17
|
import "../../chunk-MWAD4CIG.js";
|
|
18
|
-
import "../../chunk-
|
|
18
|
+
import "../../chunk-C3E5EA6J.js";
|
|
19
19
|
import "../../chunk-6L4ZEJQI.js";
|
|
20
20
|
import "../../chunk-C7OIVXE3.js";
|
|
21
21
|
import "../../chunk-TOKKKTFG.js";
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
import "../../chunk-TGK5LP2H.js";
|
|
11
11
|
import {
|
|
12
12
|
EVMAddressContainer
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-TC4445WV.js";
|
|
14
14
|
import "../../chunk-WZIT54AU.js";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-GPQN2P32.js";
|
|
16
16
|
import "../../chunk-MWAD4CIG.js";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-C3E5EA6J.js";
|
|
18
18
|
import {
|
|
19
19
|
formatAddress
|
|
20
20
|
} from "../../chunk-6L4ZEJQI.js";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AddressContainer/CoreAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isCoreAddress,\n isCoreContractAddress,\n isZeroAddress,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { useENS } from '../../utils/hooks/useENS';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n CoreHexAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n PosAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { CoreAddressContainerProps } from './types';\nimport ICON_ENS from '../../images/logo-cns.svg';\nimport { getAddressNameInfo } from './utils';\n\nconst parseProps = (\n props: CoreAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const {\n t,\n showAddressLabel,\n showNametag,\n nametag,\n showENSLabel,\n ensName,\n nameMap,\n cfxAddress,\n } = props;\n\n const translations = getTranslations();\n\n const nameInfo = getAddressNameInfo(cfxAddress, nameMap);\n\n let innerName = props.innerName;\n if (!innerName && isZeroAddress(cfxAddress)) {\n innerName = t(translations.general.zeroAddress);\n }\n\n // private name tag\n let addressLabel: React.ReactNode = null;\n // official name tag\n let officalNametag: React.ReactNode = null;\n // ens name tag\n let ENSLabel: React.ReactNode = null;\n let ENSIcon: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n addressLabel = addressLabels?.[cfxAddress];\n }\n\n if (cfxAddress && showNametag) {\n officalNametag = nametag || nameInfo?.nametag;\n }\n\n if (showENSLabel && ensName) {\n ENSLabel = ensName;\n ENSIcon = (\n <img\n src={ICON_ENS}\n className=\"w-[16px] h-[16px] mb-[3px] mr-[2px]\"\n alt=\"\"\n />\n );\n }\n\n return {\n innerName,\n nametag: officalNametag,\n addressLabel,\n ENSLabel,\n ENSIcon: ENSIcon,\n cfxAddress,\n tokenName: props.tokenName || nameInfo?.tokenName,\n contractName: props.contractName || nameInfo?.contractName,\n verificationName: props.verificationName || nameInfo?.verificationName,\n verify: props.verify || nameInfo?.verify,\n ensName: props.ensName || nameInfo?.ensName,\n isEspaceAddress: props.isEspaceAddress || nameInfo?.isEspaceAddress,\n };\n};\n\nexport const CoreAddressContainer = withTranslation()(\n memo((props: CoreAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If the interface returns Ens content, there is no need to obtain it separately, or disable the display of Ens content (in most cases on the list page).\n const unnecessaryEns = !!props.ensName || props.showENSLabel === false;\n const { ens } = useENS(unnecessaryEns ? null : props.value);\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n const cfxAddress = formatAddress(props.value, 'base32');\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n cfxAddress,\n ensName: ens ? ens[cfxAddress]?.name : undefined,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (mergeParseProps.isPosAddress) {\n return PosAddress(mergeParseProps);\n }\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'base32',\n });\n }\n\n if (mergeParseProps.isEspaceAddress) {\n return CoreHexAddress(mergeParseProps);\n }\n\n if (!isCoreAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (isCoreContractAddress(mergeParseProps.cfxAddress)) {\n return ContractAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isMe) {\n return MyAddress(mergeParseProps);\n }\n\n return RenderAddress(mergeParseProps);\n }),\n);\n"],"m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,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\n\nconst defaultPCMaxWidth = 138;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n if (link === false) {\n return false;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n tokenName,\n contractName,\n showVerificationName = false,\n verificationName,\n hoverValue,\n hrefAddress,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n ENSIcon = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n innerName = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n // Private name tags > Official tag/name > contract token name > contract name tag > contract verification name > CNS/ENS\n const name =\n // Private name tags\n addressLabel ||\n // Official tag/name\n nametag ||\n // contract token name\n tokenName ||\n // contract name tag\n contractName ||\n // contract verification name\n (showVerificationName && verificationName) ||\n // CNS/ENS\n ENSLabel ||\n // inner name is used for some special address, like the zero address\n innerName;\n const isShowEns = !!ENSLabel && name === ENSLabel;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'unset' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: tokenName || contractName || verificationName,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof checksumAddress === 'string' && !isFull\n ? type === 'pos'\n ? shortenAddress(checksumAddress!, {\n prefixLength: 10,\n suffixLength: 0,\n })\n : shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\">\n {prefix || (isShowEns ? ENSIcon : null)}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;AAUrB,SA4IA,UAzIM,KAHN;AARV,IAAM,oBAAoB;AAG1B,IAAM,uBAAuB,CAAC,mBAAmC;AAC/D,SAAO,OAAO,QAAQ,cAAc,EACjC,IAAI,CAAC,CAAC,KA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YAErC,kBAAQ;AAAA;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AddressContainer/EVMAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isEvmAddress,\n isZeroAddress,\n convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { EVMAddressContainerProps } from './types';\nimport { getAddressNameInfo } from './utils';\n\nconst parseProps = (\n props: EVMAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const { t, showAddressLabel, showNametag, nametag, nameMap } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'hex');\n\n const nameInfo = getAddressNameInfo(cfxAddress, nameMap);\n\n const translations = getTranslations();\n\n let innerName = props.innerName;\n if (!innerName && isZeroAddress(cfxAddress)) {\n innerName = t(translations.general.zeroAddress);\n }\n\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n addressLabel =\n addressLabels?.[convertCheckSum(cfxAddress)] ||\n addressLabels?.[cfxAddress.toLowerCase()];\n }\n\n if (cfxAddress && showNametag) {\n officalNametag = nametag || nameInfo?.nametag;\n }\n\n return {\n innerName,\n nametag: officalNametag,\n addressLabel,\n cfxAddress,\n tokenName: props.tokenName || nameInfo?.tokenName,\n contractName: props.contractName || nameInfo?.contractName,\n verificationName: props.verificationName || nameInfo?.verificationName,\n verify: props.verify || nameInfo?.verify,\n isContract: props.isContract || nameInfo?.isContract,\n };\n};\n\nexport const EVMAddressContainer = withTranslation()(\n memo((props: EVMAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'hex',\n });\n }\n\n if (!isEvmAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isContract) {\n return ContractAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isMe) {\n return MyAddress(mergeParseProps);\n }\n\n return RenderAddress(mergeParseProps);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,SAA0B,uBAAuB;AACjD,OAAO,OAAO;AA0ED;AArDb,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM,EAAE,GAAG,kBAAkB,aAAa,SAAS,QAAQ,IAAI;AAC/D,QAAM,QAAgB,MAAM,SAAS;AACrC,QAAM,aAAa,cAAc,OAAO,KAAK;AAE7C,QAAM,WAAW,mBAAmB,YAAY,OAAO;AAEvD,QAAM,eAAe,gBAAgB;AAErC,MAAI,YAAY,MAAM;AACtB,MAAI,CAAC,aAAa,cAAc,UAAU,GAAG;AAC3C,gBAAY,EAAE,aAAa,QAAQ,WAAW;AAAA,EAChD;AAGA,MAAI,iBAAkC;AAEtC,MAAI,eAAgC;AAEpC,MAA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