@cfxjs/sirius-next-common 0.1.29 → 0.1.30

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.
Files changed (199) hide show
  1. package/dist/chunk-3A4LE5OK.js +49 -0
  2. package/dist/chunk-3A4LE5OK.js.map +1 -0
  3. package/dist/chunk-3D63CPYB.js +2324 -0
  4. package/dist/chunk-3D63CPYB.js.map +1 -0
  5. package/dist/chunk-477HNUQM.js +63 -0
  6. package/dist/chunk-477HNUQM.js.map +1 -0
  7. package/dist/chunk-47CQDRI6.js +63 -0
  8. package/dist/chunk-47CQDRI6.js.map +1 -0
  9. package/dist/chunk-4QV2QZUP.js +212 -0
  10. package/dist/chunk-4QV2QZUP.js.map +1 -0
  11. package/dist/chunk-562J5LFF.js +246 -0
  12. package/dist/chunk-562J5LFF.js.map +1 -0
  13. package/dist/chunk-5ET2WT43.js +108 -0
  14. package/dist/chunk-5ET2WT43.js.map +1 -0
  15. package/dist/chunk-5FMESSK6.js +745 -0
  16. package/dist/chunk-5FMESSK6.js.map +1 -0
  17. package/dist/chunk-5IJQNIWM.js +2324 -0
  18. package/dist/chunk-5IJQNIWM.js.map +1 -0
  19. package/dist/chunk-5KR5M3LI.js +212 -0
  20. package/dist/chunk-5KR5M3LI.js.map +1 -0
  21. package/dist/chunk-5PC6ZUSP.js +49 -0
  22. package/dist/chunk-5PC6ZUSP.js.map +1 -0
  23. package/dist/chunk-5TBPQWGO.js +63 -0
  24. package/dist/chunk-5TBPQWGO.js.map +1 -0
  25. package/dist/chunk-62QRMHTS.js +244 -0
  26. package/dist/chunk-62QRMHTS.js.map +1 -0
  27. package/dist/chunk-7BBDDNFI.js +3629 -0
  28. package/dist/chunk-7BBDDNFI.js.map +1 -0
  29. package/dist/chunk-7WYVSPSJ.js +745 -0
  30. package/dist/chunk-7WYVSPSJ.js.map +1 -0
  31. package/dist/chunk-AS7RCHEU.js +212 -0
  32. package/dist/chunk-AS7RCHEU.js.map +1 -0
  33. package/dist/chunk-AYFDTOKM.js +127 -0
  34. package/dist/chunk-AYFDTOKM.js.map +1 -0
  35. package/dist/chunk-B2BIAMGC.js +2324 -0
  36. package/dist/chunk-B2BIAMGC.js.map +1 -0
  37. package/dist/chunk-BAXJ65FV.js +141 -0
  38. package/dist/chunk-BAXJ65FV.js.map +1 -0
  39. package/dist/chunk-BIXKB2BM.js +127 -0
  40. package/dist/chunk-BIXKB2BM.js.map +1 -0
  41. package/dist/chunk-BMC7K6XL.js +108 -0
  42. package/dist/chunk-BMC7K6XL.js.map +1 -0
  43. package/dist/chunk-BTGKYV55.js +244 -0
  44. package/dist/chunk-BTGKYV55.js.map +1 -0
  45. package/dist/chunk-CAZ6T2TX.js +745 -0
  46. package/dist/chunk-CAZ6T2TX.js.map +1 -0
  47. package/dist/chunk-D2WT6AUU.js +2324 -0
  48. package/dist/chunk-D2WT6AUU.js.map +1 -0
  49. package/dist/chunk-DDAGQ2JK.js +150 -0
  50. package/dist/chunk-DDAGQ2JK.js.map +1 -0
  51. package/dist/chunk-DSMBYGOR.js +141 -0
  52. package/dist/chunk-DSMBYGOR.js.map +1 -0
  53. package/dist/chunk-DVJSOTHM.js +141 -0
  54. package/dist/chunk-DVJSOTHM.js.map +1 -0
  55. package/dist/chunk-FJE2PVRA.js +745 -0
  56. package/dist/chunk-FJE2PVRA.js.map +1 -0
  57. package/dist/chunk-GG35SV7M.js +2324 -0
  58. package/dist/chunk-GG35SV7M.js.map +1 -0
  59. package/dist/chunk-GJCF27KI.js +105 -0
  60. package/dist/chunk-GJCF27KI.js.map +1 -0
  61. package/dist/chunk-GSS7YAQU.js +3629 -0
  62. package/dist/chunk-GSS7YAQU.js.map +1 -0
  63. package/dist/chunk-GTOQ3FIN.js +49 -0
  64. package/dist/chunk-GTOQ3FIN.js.map +1 -0
  65. package/dist/chunk-HFSZYAU2.js +141 -0
  66. package/dist/chunk-HFSZYAU2.js.map +1 -0
  67. package/dist/chunk-HZ4M5LY2.js +3629 -0
  68. package/dist/chunk-HZ4M5LY2.js.map +1 -0
  69. package/dist/chunk-INIJGBG4.js +212 -0
  70. package/dist/chunk-INIJGBG4.js.map +1 -0
  71. package/dist/chunk-ISMLXDGF.js +150 -0
  72. package/dist/chunk-ISMLXDGF.js.map +1 -0
  73. package/dist/chunk-JEDBRDNZ.js +150 -0
  74. package/dist/chunk-JEDBRDNZ.js.map +1 -0
  75. package/dist/chunk-JVUY3R5I.js +244 -0
  76. package/dist/chunk-JVUY3R5I.js.map +1 -0
  77. package/dist/chunk-L65TAZGA.js +2324 -0
  78. package/dist/chunk-L65TAZGA.js.map +1 -0
  79. package/dist/chunk-LEGITSAD.js +105 -0
  80. package/dist/chunk-LEGITSAD.js.map +1 -0
  81. package/dist/chunk-LLTRCE44.js +127 -0
  82. package/dist/chunk-LLTRCE44.js.map +1 -0
  83. package/dist/chunk-MDJJ2N7B.js +49 -0
  84. package/dist/chunk-MDJJ2N7B.js.map +1 -0
  85. package/dist/chunk-MO6EWADQ.js +63 -0
  86. package/dist/chunk-MO6EWADQ.js.map +1 -0
  87. package/dist/chunk-MT5ZPVBD.js +212 -0
  88. package/dist/chunk-MT5ZPVBD.js.map +1 -0
  89. package/dist/chunk-NCKPYRTE.js +105 -0
  90. package/dist/chunk-NCKPYRTE.js.map +1 -0
  91. package/dist/chunk-NHXG5FKK.js +108 -0
  92. package/dist/chunk-NHXG5FKK.js.map +1 -0
  93. package/dist/chunk-NQ5QNBNM.js +105 -0
  94. package/dist/chunk-NQ5QNBNM.js.map +1 -0
  95. package/dist/chunk-NVSEXPAT.js +3629 -0
  96. package/dist/chunk-NVSEXPAT.js.map +1 -0
  97. package/dist/chunk-NXGS5QEO.js +141 -0
  98. package/dist/chunk-NXGS5QEO.js.map +1 -0
  99. package/dist/chunk-NXXSUIXY.js +150 -0
  100. package/dist/chunk-NXXSUIXY.js.map +1 -0
  101. package/dist/chunk-PXXEFNOE.js +3629 -0
  102. package/dist/chunk-PXXEFNOE.js.map +1 -0
  103. package/dist/chunk-Q3MMY6EU.js +244 -0
  104. package/dist/chunk-Q3MMY6EU.js.map +1 -0
  105. package/dist/chunk-Q5D5FHO7.js +212 -0
  106. package/dist/chunk-Q5D5FHO7.js.map +1 -0
  107. package/dist/chunk-QCVM6HOF.js +3629 -0
  108. package/dist/chunk-QCVM6HOF.js.map +1 -0
  109. package/dist/chunk-QFAWAODA.js +150 -0
  110. package/dist/chunk-QFAWAODA.js.map +1 -0
  111. package/dist/chunk-QUOMAXP4.js +2324 -0
  112. package/dist/chunk-QUOMAXP4.js.map +1 -0
  113. package/dist/chunk-QY5G7QYB.js +150 -0
  114. package/dist/chunk-QY5G7QYB.js.map +1 -0
  115. package/dist/chunk-RLQ7WP5W.js +127 -0
  116. package/dist/chunk-RLQ7WP5W.js.map +1 -0
  117. package/dist/chunk-RP27EARH.js +49 -0
  118. package/dist/chunk-RP27EARH.js.map +1 -0
  119. package/dist/chunk-RVL3W5DP.js +105 -0
  120. package/dist/chunk-RVL3W5DP.js.map +1 -0
  121. package/dist/chunk-S335KQ5D.js +49 -0
  122. package/dist/chunk-S335KQ5D.js.map +1 -0
  123. package/dist/chunk-SN6AMUVZ.js +108 -0
  124. package/dist/chunk-SN6AMUVZ.js.map +1 -0
  125. package/dist/chunk-SOL2SFT2.js +246 -0
  126. package/dist/chunk-SOL2SFT2.js.map +1 -0
  127. package/dist/chunk-T54ODLMI.js +49 -0
  128. package/dist/chunk-T54ODLMI.js.map +1 -0
  129. package/dist/chunk-T7FNENEU.js +150 -0
  130. package/dist/chunk-T7FNENEU.js.map +1 -0
  131. package/dist/chunk-TGW2NDL5.js +108 -0
  132. package/dist/chunk-TGW2NDL5.js.map +1 -0
  133. package/dist/chunk-TIAC33MC.js +745 -0
  134. package/dist/chunk-TIAC33MC.js.map +1 -0
  135. package/dist/chunk-TLIOHXCZ.js +63 -0
  136. package/dist/chunk-TLIOHXCZ.js.map +1 -0
  137. package/dist/chunk-UCDEIGII.js +141 -0
  138. package/dist/chunk-UCDEIGII.js.map +1 -0
  139. package/dist/chunk-UGV7LSWR.js +745 -0
  140. package/dist/chunk-UGV7LSWR.js.map +1 -0
  141. package/dist/chunk-UVTOU2ZP.js +127 -0
  142. package/dist/chunk-UVTOU2ZP.js.map +1 -0
  143. package/dist/chunk-V7FEY5O4.js +127 -0
  144. package/dist/chunk-V7FEY5O4.js.map +1 -0
  145. package/dist/chunk-VMQBNQNS.js +141 -0
  146. package/dist/chunk-VMQBNQNS.js.map +1 -0
  147. package/dist/chunk-W5TV463S.js +127 -0
  148. package/dist/chunk-W5TV463S.js.map +1 -0
  149. package/dist/chunk-WEOKDVJD.js +108 -0
  150. package/dist/chunk-WEOKDVJD.js.map +1 -0
  151. package/dist/chunk-XC53X56K.js +108 -0
  152. package/dist/chunk-XC53X56K.js.map +1 -0
  153. package/dist/chunk-XCPB27SN.js +745 -0
  154. package/dist/chunk-XCPB27SN.js.map +1 -0
  155. package/dist/chunk-XYR4GKBH.js +63 -0
  156. package/dist/chunk-XYR4GKBH.js.map +1 -0
  157. package/dist/chunk-Y7TGANWP.js +212 -0
  158. package/dist/chunk-Y7TGANWP.js.map +1 -0
  159. package/dist/chunk-YKN5WWYP.js +63 -0
  160. package/dist/chunk-YKN5WWYP.js.map +1 -0
  161. package/dist/chunk-YVVEURB7.js +3629 -0
  162. package/dist/chunk-YVVEURB7.js.map +1 -0
  163. package/dist/chunk-YXISQECP.js +244 -0
  164. package/dist/chunk-YXISQECP.js.map +1 -0
  165. package/dist/chunk-Z2WEOQ72.js +105 -0
  166. package/dist/chunk-Z2WEOQ72.js.map +1 -0
  167. package/dist/chunk-ZKPSSERO.js +105 -0
  168. package/dist/chunk-ZKPSSERO.js.map +1 -0
  169. package/dist/components/AddressContainer/CoreAddressContainer.js +9 -9
  170. package/dist/components/AddressContainer/EVMAddressContainer.js +8 -8
  171. package/dist/components/AddressContainer/addressSwitcher.js +6 -6
  172. package/dist/components/AddressContainer/addressView.js +5 -5
  173. package/dist/components/AddressContainer/label.js +4 -4
  174. package/dist/components/Age/index.js +4 -4
  175. package/dist/components/Charts/PreviewChartTemplate.js +1 -1
  176. package/dist/components/Charts/StockChartTemplate.js +1 -1
  177. package/dist/components/CopyButton/index.js +3 -3
  178. package/dist/components/DownloadCSV/index.js +5 -9
  179. package/dist/components/DownloadCSV/index.js.map +1 -1
  180. package/dist/components/Dropdown/index.js +7 -13
  181. package/dist/components/Dropdown/index.js.map +1 -1
  182. package/dist/components/GasPriceDropdown/index.js +2 -2
  183. package/dist/components/IncreasePercent/index.js +2 -2
  184. package/dist/components/InfoIconWithTooltip/index.js +3 -3
  185. package/dist/components/Modal/index.js +3 -3
  186. package/dist/components/PhishingAddressContainer/index.js +3 -3
  187. package/dist/components/Price/index.js +3 -3
  188. package/dist/components/Radio/index.js +2 -2
  189. package/dist/components/Select/index.js +3 -3
  190. package/dist/components/Select/select.js +3 -3
  191. package/dist/components/Text/index.js +4 -4
  192. package/dist/components/Tooltip/index.js +3 -3
  193. package/dist/components/TransactionAction/coreTransactionAction.js +9 -9
  194. package/dist/components/TransactionAction/evmTransactionAction.js +8 -8
  195. package/dist/utils/hooks/useENS.js +2 -2
  196. package/dist/utils/index.js +2 -2
  197. package/dist/utils/request.d.ts +2 -2
  198. package/dist/utils/request.js +3 -3
  199. package/package.json +4 -4
@@ -0,0 +1,150 @@
1
+ import {
2
+ Spin
3
+ } from "./chunk-XCKMXAL2.js";
4
+ import {
5
+ cn
6
+ } from "./chunk-CAZ6T2TX.js";
7
+
8
+ // src/components/Modal/index.tsx
9
+ import { useEffect, useCallback, useMemo } from "react";
10
+ import ReactDOM from "react-dom";
11
+ import { X } from "lucide-react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var Backdrop = ({
14
+ onClick,
15
+ children,
16
+ className
17
+ }) => /* @__PURE__ */ jsx("div", { className, onClick, children });
18
+ var ModalContent = ({
19
+ containerClassName,
20
+ closable,
21
+ onClose,
22
+ children,
23
+ loading,
24
+ modalStyles
25
+ }) => /* @__PURE__ */ jsx(
26
+ "div",
27
+ {
28
+ className: cn("relative bg-[#FFF] rounded shadow-lg", containerClassName),
29
+ tabIndex: -1,
30
+ style: modalStyles,
31
+ children: /* @__PURE__ */ jsxs(Spin, { spinning: loading, children: [
32
+ closable && /* @__PURE__ */ jsx(X, { className: "h-4 w-4 absolute right-5 top-5", onClick: onClose }),
33
+ /* @__PURE__ */ jsx("div", { className: "p-4", children })
34
+ ] })
35
+ }
36
+ );
37
+ var useEventListener = (eventName, handler, active) => {
38
+ useEffect(() => {
39
+ if (active) {
40
+ const eventListener = (event) => handler(event);
41
+ document.addEventListener(eventName, eventListener);
42
+ return () => {
43
+ document.removeEventListener(eventName, eventListener);
44
+ };
45
+ }
46
+ }, [eventName, handler, active]);
47
+ };
48
+ var Modal = ({
49
+ open,
50
+ closeOnEsc = true,
51
+ closable = true,
52
+ preventScroll = true,
53
+ backdropClassName = "",
54
+ containerClassName = "",
55
+ onOpen = () => {
56
+ },
57
+ onClose,
58
+ children,
59
+ width = "600px",
60
+ maskClosable = true,
61
+ centered = true,
62
+ loading = false
63
+ }) => {
64
+ useEffect(() => {
65
+ if (open) {
66
+ onOpen?.();
67
+ if (preventScroll) {
68
+ document.body.style.overflow = "hidden";
69
+ }
70
+ } else {
71
+ if (preventScroll) {
72
+ document.body.style.overflow = "";
73
+ }
74
+ }
75
+ return () => {
76
+ if (preventScroll) {
77
+ document.body.style.overflow = "";
78
+ }
79
+ };
80
+ }, [open, onOpen, preventScroll]);
81
+ const handleKeyDown = useCallback(
82
+ (event) => {
83
+ if (event.key === "Escape" && closeOnEsc && onClose) {
84
+ onClose?.();
85
+ }
86
+ },
87
+ [closeOnEsc, onClose]
88
+ );
89
+ const handleClickOutside = useCallback(() => {
90
+ if (onClose && maskClosable) {
91
+ onClose?.();
92
+ }
93
+ }, [onClose, maskClosable]);
94
+ const handleBackdropClick = useCallback(
95
+ (event) => {
96
+ if (maskClosable && event.target === event.currentTarget && onClose) {
97
+ onClose?.();
98
+ }
99
+ },
100
+ [maskClosable, onClose]
101
+ );
102
+ const modalStyles = useMemo(
103
+ () => ({
104
+ width: typeof width === "string" ? width : `${width}px`,
105
+ margin: centered ? "auto" : void 0
106
+ }),
107
+ [width, centered]
108
+ );
109
+ useEventListener(
110
+ "keydown",
111
+ handleKeyDown,
112
+ open && closeOnEsc
113
+ );
114
+ useEventListener(
115
+ "mousedown",
116
+ handleClickOutside,
117
+ open && maskClosable
118
+ );
119
+ if (!open)
120
+ return null;
121
+ return ReactDOM.createPortal(
122
+ /* @__PURE__ */ jsx(
123
+ Backdrop,
124
+ {
125
+ onClick: handleBackdropClick,
126
+ className: cn(
127
+ "fixed inset-0 bg-[#000] bg-opacity-25 flex items-center justify-center z-10000",
128
+ backdropClassName
129
+ ),
130
+ children: /* @__PURE__ */ jsx(
131
+ ModalContent,
132
+ {
133
+ containerClassName,
134
+ closable,
135
+ onClose,
136
+ children,
137
+ loading,
138
+ modalStyles
139
+ }
140
+ )
141
+ }
142
+ ),
143
+ document.body
144
+ );
145
+ };
146
+
147
+ export {
148
+ Modal
149
+ };
150
+ //# sourceMappingURL=chunk-DDAGQ2JK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Modal/index.tsx"],"sourcesContent":["import React, { useEffect, useCallback, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { X } from 'lucide-react';\nimport { Spin } from '../Spin';\nimport { cn } from '../../utils';\n\ninterface ModalProps {\n open: boolean;\n closeOnEsc?: boolean;\n closable?: boolean;\n preventScroll?: boolean;\n backdropClassName?: string;\n containerClassName?: string;\n onOpen?: () => void;\n onClose?: () => void;\n children?: React.ReactNode;\n width?: string | number;\n maskClosable?: boolean;\n centered?: boolean;\n loading?: boolean;\n}\n\ninterface ModalContentProps {\n containerClassName: string;\n closable: boolean;\n onClose?: VoidFunction;\n children?: React.ReactNode;\n loading?: boolean;\n modalStyles: React.CSSProperties;\n}\n\ninterface BackdropProps {\n onClick: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n className: string;\n children?: React.ReactNode;\n}\n\nconst Backdrop: React.FC<BackdropProps> = ({\n onClick,\n children,\n className,\n}) => (\n <div className={className} onClick={onClick}>\n {children}\n </div>\n);\n\nconst ModalContent = ({\n containerClassName,\n closable,\n onClose,\n children,\n loading,\n modalStyles,\n}: ModalContentProps) => (\n <div\n className={cn('relative bg-[#FFF] rounded shadow-lg', containerClassName)}\n tabIndex={-1}\n style={modalStyles}\n >\n <Spin spinning={loading}>\n {closable && (\n <X className=\"h-4 w-4 absolute right-5 top-5\" onClick={onClose} />\n )}\n <div className=\"p-4\">{children}</div>\n </Spin>\n </div>\n);\n\nconst useEventListener = (\n eventName: string,\n handler: (event: Event) => void,\n active: boolean,\n) => {\n useEffect(() => {\n if (active) {\n const eventListener = (event: Event) => handler(event);\n\n document.addEventListener(eventName, eventListener);\n return () => {\n document.removeEventListener(eventName, eventListener);\n };\n }\n }, [eventName, handler, active]);\n};\n\nconst Modal: React.FC<ModalProps> = ({\n open,\n closeOnEsc = true,\n closable = true,\n preventScroll = true,\n backdropClassName = '',\n containerClassName = '',\n onOpen = () => {},\n onClose,\n children,\n width = '600px',\n maskClosable = true,\n centered = true,\n loading = false,\n}) => {\n useEffect(() => {\n if (open) {\n onOpen?.();\n if (preventScroll) {\n document.body.style.overflow = 'hidden';\n }\n } else {\n if (preventScroll) {\n document.body.style.overflow = '';\n }\n }\n return () => {\n if (preventScroll) {\n document.body.style.overflow = '';\n }\n };\n }, [open, onOpen, preventScroll]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape' && closeOnEsc && onClose) {\n onClose?.();\n }\n },\n [closeOnEsc, onClose],\n );\n\n const handleClickOutside = useCallback(() => {\n if (onClose && maskClosable) {\n onClose?.();\n }\n }, [onClose, maskClosable]);\n\n const handleBackdropClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (maskClosable && event.target === event.currentTarget && onClose) {\n onClose?.();\n }\n },\n [maskClosable, onClose],\n );\n\n const modalStyles: React.CSSProperties = useMemo(\n () => ({\n width: typeof width === 'string' ? width : `${width}px`,\n margin: centered ? 'auto' : undefined,\n }),\n [width, centered],\n );\n\n useEventListener(\n 'keydown',\n handleKeyDown as (event: Event) => void,\n open && closeOnEsc,\n );\n useEventListener(\n 'mousedown',\n handleClickOutside as (event: Event) => void,\n open && maskClosable,\n );\n\n if (!open) return null;\n\n return ReactDOM.createPortal(\n <Backdrop\n onClick={handleBackdropClick}\n className={cn(\n 'fixed inset-0 bg-[#000] bg-opacity-25 flex items-center justify-center z-10000',\n backdropClassName,\n )}\n >\n <ModalContent\n containerClassName={containerClassName}\n closable={closable}\n onClose={onClose}\n children={children}\n loading={loading}\n modalStyles={modalStyles}\n />\n </Backdrop>,\n document.body,\n );\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;;AAAA,SAAgB,WAAW,aAAa,eAAe;AACvD,OAAO,cAAc;AACrB,SAAS,SAAS;AAwChB,cAkBE,YAlBF;AALF,IAAM,WAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACF,MACE,oBAAC,SAAI,WAAsB,SACxB,UACH;AAGF,IAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC,WAAW,GAAG,wCAAwC,kBAAkB;AAAA,IACxE,UAAU;AAAA,IACV,OAAO;AAAA,IAEP,+BAAC,QAAK,UAAU,SACb;AAAA,kBACC,oBAAC,KAAE,WAAU,kCAAiC,SAAS,SAAS;AAAA,MAElE,oBAAC,SAAI,WAAU,OAAO,UAAS;AAAA,OACjC;AAAA;AACF;AAGF,IAAM,mBAAmB,CACvB,WACA,SACA,WACG;AACH,YAAU,MAAM;AACd,QAAI,QAAQ;AACV,YAAM,gBAAgB,CAAC,UAAiB,QAAQ,KAAK;AAErD,eAAS,iBAAiB,WAAW,aAAa;AAClD,aAAO,M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OAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;AAAA,MAC9C,QAAQ,WAAW,SAAS;AAAA,IAC9B;AAAA,IACA,CAAC,OAAO,QAAQ;AAAA,EAClB;AAEA;AAAA,IACE;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV;AACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV;AAEA,MAAI,CAAC;AAAM,WAAO;AAElB,SAAO,SAAS;AAAA,IACd;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
@@ -0,0 +1,141 @@
1
+ import {
2
+ useENS
3
+ } from "./chunk-XYR4GKBH.js";
4
+ import {
5
+ ContractAddress,
6
+ ContractCreatedAddress,
7
+ CoreHexAddress,
8
+ InvalidAddress,
9
+ MyAddress,
10
+ PosAddress
11
+ } from "./chunk-INIJGBG4.js";
12
+ import {
13
+ RenderAddress
14
+ } from "./chunk-W5TV463S.js";
15
+ import {
16
+ formatAddress,
17
+ isCoreAddress,
18
+ isCoreContractAddress,
19
+ isZeroAddress
20
+ } from "./chunk-BVWWK2EL.js";
21
+ import {
22
+ getLabelInfo
23
+ } from "./chunk-RP27EARH.js";
24
+ import {
25
+ getTranslations,
26
+ useGlobalData
27
+ } from "./chunk-DQGLZCIG.js";
28
+
29
+ // src/components/AddressContainer/CoreAddressContainer.tsx
30
+ import { memo } from "react";
31
+ import { withTranslation } from "react-i18next";
32
+ import _ from "lodash";
33
+ import { Fragment, jsx } from "react/jsx-runtime";
34
+ var parseProps = (props, globalData) => {
35
+ const {
36
+ alias,
37
+ ensInfo,
38
+ t,
39
+ showAddressLabel,
40
+ showNametag,
41
+ nametagInfo,
42
+ showENSLabel
43
+ } = props;
44
+ const value = props.value || "";
45
+ const cfxAddress = formatAddress(value, "base32");
46
+ let ENSMap = ensInfo || {};
47
+ const translations = getTranslations();
48
+ let aliasLabel = alias;
49
+ if (!alias && isZeroAddress(cfxAddress)) {
50
+ aliasLabel = t(translations.general.zeroAddress);
51
+ }
52
+ let prefixIcon = null;
53
+ let officalNametag = null;
54
+ let addressLabel = null;
55
+ let ENSLabel = null;
56
+ const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;
57
+ if (cfxAddress && showAddressLabel) {
58
+ const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
59
+ const gAddressLabel = addressLabels?.[cfxAddress];
60
+ if (gAddressLabel) {
61
+ const { label } = getLabelInfo(gAddressLabel, "tag");
62
+ addressLabel = label;
63
+ }
64
+ }
65
+ if (cfxAddress && showNametag) {
66
+ const nametags = nametagInfo?.[cfxAddress];
67
+ if (nametags) {
68
+ const nametag = nametags?.nametag ?? "";
69
+ const { label } = getLabelInfo(nametag, "nametag");
70
+ officalNametag = label;
71
+ }
72
+ }
73
+ if (showENSLabel && gENSLabel) {
74
+ const { label, icon } = getLabelInfo(gENSLabel, "ens");
75
+ ENSLabel = label;
76
+ prefixIcon = icon;
77
+ }
78
+ return {
79
+ alias: aliasLabel,
80
+ prefix: prefixIcon,
81
+ nametag: officalNametag,
82
+ addressLabel,
83
+ ENSLabel,
84
+ cfxAddress
85
+ };
86
+ };
87
+ var CoreAddressContainer = withTranslation()(
88
+ memo((props) => {
89
+ const { globalData } = useGlobalData();
90
+ const unnecessaryEns = props.ensInfo || props.showENSLabel === false;
91
+ const { ens } = useENS(unnecessaryEns ? null : props.value);
92
+ if (!props.value && !props.contractCreated) {
93
+ return /* @__PURE__ */ jsx(Fragment, { children: "--" });
94
+ }
95
+ const defaultProps = {
96
+ isFull: false,
97
+ isFullNameTag: false,
98
+ link: true,
99
+ isMe: false,
100
+ showIcon: true,
101
+ verify: false,
102
+ showAddressLabel: true,
103
+ showENSLabel: true,
104
+ showNametag: true,
105
+ ensInfo: ens
106
+ };
107
+ const mergeDefaultProps = _.assign({}, defaultProps, props);
108
+ const mergeParseProps = _.merge(
109
+ {},
110
+ mergeDefaultProps,
111
+ parseProps(mergeDefaultProps, globalData)
112
+ );
113
+ if (mergeParseProps.isPosAddress) {
114
+ return PosAddress(mergeParseProps);
115
+ }
116
+ if (!mergeParseProps.value && mergeParseProps.contractCreated) {
117
+ return ContractCreatedAddress({
118
+ ...mergeParseProps,
119
+ outputType: "base32"
120
+ });
121
+ }
122
+ if (mergeParseProps.isEspaceAddress) {
123
+ return CoreHexAddress(mergeParseProps);
124
+ }
125
+ if (!isCoreAddress(mergeParseProps.value)) {
126
+ return InvalidAddress(mergeParseProps);
127
+ }
128
+ if (isCoreContractAddress(mergeParseProps.cfxAddress)) {
129
+ return ContractAddress(mergeParseProps);
130
+ }
131
+ if (mergeParseProps.isMe) {
132
+ return MyAddress(mergeParseProps);
133
+ }
134
+ return RenderAddress(mergeParseProps);
135
+ })
136
+ );
137
+
138
+ export {
139
+ CoreAddressContainer
140
+ };
141
+ //# sourceMappingURL=chunk-DSMBYGOR.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 convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { getLabelInfo } from './label';\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';\n\nconst parseProps = (\n props: CoreAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const {\n alias,\n ensInfo,\n t,\n showAddressLabel,\n showNametag,\n nametagInfo,\n showENSLabel,\n } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'base32');\n\n let ENSMap = ensInfo || {};\n\n const translations = getTranslations();\n\n let aliasLabel = alias;\n if (!alias && isZeroAddress(cfxAddress)) {\n aliasLabel = t(translations.general.zeroAddress);\n }\n\n let prefixIcon: React.ReactNode = null;\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n // ens name tag\n let ENSLabel: React.ReactNode = null;\n // global ens name tag\n const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n const gAddressLabel = addressLabels?.[cfxAddress];\n\n if (gAddressLabel) {\n const { label } = getLabelInfo(gAddressLabel, 'tag');\n addressLabel = label;\n }\n }\n\n if (cfxAddress && showNametag) {\n const nametags = nametagInfo?.[cfxAddress];\n\n if (nametags) {\n const nametag = nametags?.nametag ?? '';\n const { label } = getLabelInfo(nametag, 'nametag');\n officalNametag = label;\n }\n }\n\n if (showENSLabel && gENSLabel) {\n const { label, icon } = getLabelInfo(gENSLabel, 'ens');\n ENSLabel = label;\n prefixIcon = icon;\n }\n\n return {\n alias: aliasLabel,\n prefix: prefixIcon,\n nametag: officalNametag,\n addressLabel,\n ENSLabel,\n cfxAddress,\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.ensInfo || 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\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 ensInfo: ens,\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;AA2GD;AAlFb,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,QAAgB,MAAM,SAAS;AACrC,QAAM,aAAa,cAAc,OAAO,QAAQ;AAEhD,MAAI,SAAS,WAAW,CAAC;AAEzB,QAAM,eAAe,gBAAgB;AAErC,MAAI,aAAa;AACjB,MAAI,CAAC,SAAS,cAAc,UAAU,GAAG;AACvC,iBAAa,EAAE,aAAa,QAAQ,WAAW;AAAA,EACjD;AAEA,MAAI,aAA8B;AAElC,MAAI,iBAAkC;AAEt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AC,GAAG,cAAc,KAAK;AAE1D,UAAM,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":[]}
@@ -0,0 +1,141 @@
1
+ import {
2
+ useENS
3
+ } from "./chunk-YKN5WWYP.js";
4
+ import {
5
+ ContractAddress,
6
+ ContractCreatedAddress,
7
+ CoreHexAddress,
8
+ InvalidAddress,
9
+ MyAddress,
10
+ PosAddress
11
+ } from "./chunk-AS7RCHEU.js";
12
+ import {
13
+ RenderAddress
14
+ } from "./chunk-UVTOU2ZP.js";
15
+ import {
16
+ formatAddress,
17
+ isCoreAddress,
18
+ isCoreContractAddress,
19
+ isZeroAddress
20
+ } from "./chunk-BVWWK2EL.js";
21
+ import {
22
+ getLabelInfo
23
+ } from "./chunk-5PC6ZUSP.js";
24
+ import {
25
+ getTranslations,
26
+ useGlobalData
27
+ } from "./chunk-DQGLZCIG.js";
28
+
29
+ // src/components/AddressContainer/CoreAddressContainer.tsx
30
+ import { memo } from "react";
31
+ import { withTranslation } from "react-i18next";
32
+ import _ from "lodash";
33
+ import { Fragment, jsx } from "react/jsx-runtime";
34
+ var parseProps = (props, globalData) => {
35
+ const {
36
+ alias,
37
+ ensInfo,
38
+ t,
39
+ showAddressLabel,
40
+ showNametag,
41
+ nametagInfo,
42
+ showENSLabel
43
+ } = props;
44
+ const value = props.value || "";
45
+ const cfxAddress = formatAddress(value, "base32");
46
+ let ENSMap = ensInfo || {};
47
+ const translations = getTranslations();
48
+ let aliasLabel = alias;
49
+ if (!alias && isZeroAddress(cfxAddress)) {
50
+ aliasLabel = t(translations.general.zeroAddress);
51
+ }
52
+ let prefixIcon = null;
53
+ let officalNametag = null;
54
+ let addressLabel = null;
55
+ let ENSLabel = null;
56
+ const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;
57
+ if (cfxAddress && showAddressLabel) {
58
+ const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
59
+ const gAddressLabel = addressLabels?.[cfxAddress];
60
+ if (gAddressLabel) {
61
+ const { label } = getLabelInfo(gAddressLabel, "tag");
62
+ addressLabel = label;
63
+ }
64
+ }
65
+ if (cfxAddress && showNametag) {
66
+ const nametags = nametagInfo?.[cfxAddress];
67
+ if (nametags) {
68
+ const nametag = nametags?.nametag ?? "";
69
+ const { label } = getLabelInfo(nametag, "nametag");
70
+ officalNametag = label;
71
+ }
72
+ }
73
+ if (showENSLabel && gENSLabel) {
74
+ const { label, icon } = getLabelInfo(gENSLabel, "ens");
75
+ ENSLabel = label;
76
+ prefixIcon = icon;
77
+ }
78
+ return {
79
+ alias: aliasLabel,
80
+ prefix: prefixIcon,
81
+ nametag: officalNametag,
82
+ addressLabel,
83
+ ENSLabel,
84
+ cfxAddress
85
+ };
86
+ };
87
+ var CoreAddressContainer = withTranslation()(
88
+ memo((props) => {
89
+ const { globalData } = useGlobalData();
90
+ const unnecessaryEns = props.ensInfo || props.showENSLabel === false;
91
+ const { ens } = useENS(unnecessaryEns ? null : props.value);
92
+ if (!props.value && !props.contractCreated) {
93
+ return /* @__PURE__ */ jsx(Fragment, { children: "--" });
94
+ }
95
+ const defaultProps = {
96
+ isFull: false,
97
+ isFullNameTag: false,
98
+ link: true,
99
+ isMe: false,
100
+ showIcon: true,
101
+ verify: false,
102
+ showAddressLabel: true,
103
+ showENSLabel: true,
104
+ showNametag: true,
105
+ ensInfo: ens
106
+ };
107
+ const mergeDefaultProps = _.assign({}, defaultProps, props);
108
+ const mergeParseProps = _.merge(
109
+ {},
110
+ mergeDefaultProps,
111
+ parseProps(mergeDefaultProps, globalData)
112
+ );
113
+ if (mergeParseProps.isPosAddress) {
114
+ return PosAddress(mergeParseProps);
115
+ }
116
+ if (!mergeParseProps.value && mergeParseProps.contractCreated) {
117
+ return ContractCreatedAddress({
118
+ ...mergeParseProps,
119
+ outputType: "base32"
120
+ });
121
+ }
122
+ if (mergeParseProps.isEspaceAddress) {
123
+ return CoreHexAddress(mergeParseProps);
124
+ }
125
+ if (!isCoreAddress(mergeParseProps.value)) {
126
+ return InvalidAddress(mergeParseProps);
127
+ }
128
+ if (isCoreContractAddress(mergeParseProps.cfxAddress)) {
129
+ return ContractAddress(mergeParseProps);
130
+ }
131
+ if (mergeParseProps.isMe) {
132
+ return MyAddress(mergeParseProps);
133
+ }
134
+ return RenderAddress(mergeParseProps);
135
+ })
136
+ );
137
+
138
+ export {
139
+ CoreAddressContainer
140
+ };
141
+ //# sourceMappingURL=chunk-DVJSOTHM.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 convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { getLabelInfo } from './label';\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';\n\nconst parseProps = (\n props: CoreAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const {\n alias,\n ensInfo,\n t,\n showAddressLabel,\n showNametag,\n nametagInfo,\n showENSLabel,\n } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'base32');\n\n let ENSMap = ensInfo || {};\n\n const translations = getTranslations();\n\n let aliasLabel = alias;\n if (!alias && isZeroAddress(cfxAddress)) {\n aliasLabel = t(translations.general.zeroAddress);\n }\n\n let prefixIcon: React.ReactNode = null;\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n // ens name tag\n let ENSLabel: React.ReactNode = null;\n // global ens name tag\n const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n const gAddressLabel = addressLabels?.[cfxAddress];\n\n if (gAddressLabel) {\n const { label } = getLabelInfo(gAddressLabel, 'tag');\n addressLabel = label;\n }\n }\n\n if (cfxAddress && showNametag) {\n const nametags = nametagInfo?.[cfxAddress];\n\n if (nametags) {\n const nametag = nametags?.nametag ?? '';\n const { label } = getLabelInfo(nametag, 'nametag');\n officalNametag = label;\n }\n }\n\n if (showENSLabel && gENSLabel) {\n const { label, icon } = getLabelInfo(gENSLabel, 'ens');\n ENSLabel = label;\n prefixIcon = icon;\n }\n\n return {\n alias: aliasLabel,\n prefix: prefixIcon,\n nametag: officalNametag,\n addressLabel,\n ENSLabel,\n cfxAddress,\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.ensInfo || 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\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 ensInfo: ens,\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;AA2GD;AAlFb,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,QAAgB,MAAM,SAAS;AACrC,QAAM,aAAa,cAAc,OAAO,QAAQ;AAEhD,MAAI,SAAS,WAAW,CAAC;AAEzB,QAAM,eAAe,gBAAgB;AAErC,MAAI,aAAa;AACjB,MAAI,CAA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