@blockend/widget 1.0.31 → 1.0.32

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 (162) hide show
  1. package/dist/AllRoutes-CPwuTwqd.js +2209 -0
  2. package/dist/Box-CIChapvH.js +55 -0
  3. package/dist/EstGas-CEFILtyf.js +12867 -0
  4. package/dist/Grow-DJZj9zjv.js +1656 -0
  5. package/dist/InputComp-DqF1JGIu.js +106 -0
  6. package/dist/LoadRoute-r3sHTYXM.js +126 -0
  7. package/dist/QuotesProgress-BXVLxZ8U.js +28 -0
  8. package/dist/SwapAsset-07WvVwl-.js +64 -0
  9. package/dist/Tooltip-CNAsCF8n.js +572 -0
  10. package/dist/TxnButton-D2TTkFYA.js +207 -0
  11. package/dist/WidgetForm.module-QHJ0-m5f.js +9 -0
  12. package/dist/{add-B8AfyNIx.js → add-t2GqC9VA.js} +3 -3
  13. package/dist/{all-wallets-BaLLU39i.js → all-wallets-DFyf0q31.js} +3 -3
  14. package/dist/{app-store-DNpoABj1.js → app-store-aAahwmBP.js} +3 -3
  15. package/dist/{apple-DzzHtaL4.js → apple-DeRgpwlc.js} +3 -3
  16. package/dist/{arrow-bottom-D2c13c51.js → arrow-bottom-DdEOkaAj.js} +3 -3
  17. package/dist/{arrow-bottom-circle-ls9OCLx1.js → arrow-bottom-circle-BWwREWcv.js} +3 -3
  18. package/dist/{arrow-left-BI3rQkNI.js → arrow-left-CulyLmoH.js} +3 -3
  19. package/dist/{arrow-right-rnMzhVod.js → arrow-right-Dwr7TISn.js} +3 -3
  20. package/dist/{arrow-top-CfA6PVMz.js → arrow-top-pL4rM_y8.js} +3 -3
  21. package/dist/{bank-CmpAmHgg.js → bank-CPuyK_08.js} +3 -3
  22. package/dist/basic-CVc9xEvb.js +5783 -0
  23. package/dist/{browser-mEcjgS1H.js → browser-Cbq2Zbp4.js} +3 -3
  24. package/dist/{card-DkgIWcMc.js → card-B_hUtPWK.js} +3 -3
  25. package/dist/ccip-BLVGcR4A.js +228 -0
  26. package/dist/{checkmark-B_A013n2.js → checkmark-WEqTsFAc.js} +3 -3
  27. package/dist/{checkmark-bold-DestuG2T.js → checkmark-bold-Du_ZvhqM.js} +3 -3
  28. package/dist/{chevron-bottom-Di3S86dj.js → chevron-bottom-C-s-lv4L.js} +3 -3
  29. package/dist/{chevron-left-A9Wj-3tj.js → chevron-left-C7NcRElx.js} +3 -3
  30. package/dist/{chevron-right-UFxJogOZ.js → chevron-right-CSzmAmdn.js} +3 -3
  31. package/dist/{chevron-top-BbZs3eaC.js → chevron-top-Dd99Wfel.js} +3 -3
  32. package/dist/{chrome-store-B4F6hJmy.js → chrome-store-C4p77Of0.js} +3 -3
  33. package/dist/{clock-BbAQ09uV.js → clock-Cib24qjH.js} +3 -3
  34. package/dist/clockIcon-C2W5xvyt.js +76 -0
  35. package/dist/{close-CY3oZP_D.js → close-BXjEkTvS.js} +3 -3
  36. package/dist/{coinPlaceholder-DpfsobZT.js → coinPlaceholder-BFNC7cQN.js} +3 -3
  37. package/dist/{compass-CHS7RZFk.js → compass-CXPX5Ycp.js} +3 -3
  38. package/dist/{copy-CEd4nGhs.js → copy-BEawMbmF.js} +3 -3
  39. package/dist/core-Bez9Ow7F.js +14967 -0
  40. package/dist/cursor-Cxq4Q9jk.js +7 -0
  41. package/dist/{cursor-transparent-Tm6k6Ws4.js → cursor-transparent-ZjJ0P2vr.js} +3 -3
  42. package/dist/{desktop-CrSyXZkL.js → desktop-BhZVovAp.js} +3 -3
  43. package/dist/{disconnect-BooT10E1.js → disconnect-AC-bffZO.js} +3 -3
  44. package/dist/{discord-B982Qaml.js → discord-dT97h-CC.js} +3 -3
  45. package/dist/down-DP56YSKp.js +606 -0
  46. package/dist/{etherscan-CFL0IcNl.js → etherscan-rYFRhRTM.js} +3 -3
  47. package/dist/ethertousd-CC_ezooz.js +6 -0
  48. package/dist/{exclamation-triangle-BBeGXYgt.js → exclamation-triangle-C-pCuC08.js} +3 -3
  49. package/dist/{extension-C5WqJw73.js → extension-BnqauLSn.js} +3 -3
  50. package/dist/{external-link-CcSxVDcd.js → external-link-M9D6e_F3.js} +3 -3
  51. package/dist/{facebook-DF0v9ED8.js → facebook-DHezcoD-.js} +3 -3
  52. package/dist/{farcaster-Boq7M4VK.js → farcaster-D0Ky-Imv.js} +3 -3
  53. package/dist/{filters-DfeymbPx.js → filters-B02NYLWq.js} +3 -3
  54. package/dist/getChainIds-CJd2TZYT.js +1888 -0
  55. package/dist/getCosmosAddress-DTZfw04G.js +9565 -0
  56. package/dist/{github-DQ8FV4bD.js → github-BzQkIMuE.js} +3 -3
  57. package/dist/{google-Dm8FDDZR.js → google-BpwCJ4Fs.js} +3 -3
  58. package/dist/hamburger-BzqwkUjE.js +3915 -0
  59. package/dist/{help-circle-CbgiAebR.js → help-circle-C0nOySHC.js} +3 -3
  60. package/dist/{id-CzqxUksI.js → id-DFP_kFd4.js} +3 -3
  61. package/dist/{image-CsCGTIN-.js → image-QiYOAGjM.js} +3 -3
  62. package/dist/index-CDq3vNnP.js +22 -0
  63. package/dist/index-CLzkn733.js +28223 -0
  64. package/dist/index-CjtwASJt.js +252 -0
  65. package/dist/index-CrC4B7xn.js +331 -0
  66. package/dist/index-D5hLIe-N.js +9 -0
  67. package/dist/index-DDk00SOL.js +159 -0
  68. package/dist/index-DTish3yr.js +1014 -0
  69. package/dist/index-DW3W7zaF.js +473 -0
  70. package/dist/index-DXdD3L9f.js +1460 -0
  71. package/dist/index-DaJ1272l.js +18613 -0
  72. package/dist/index-DxPp2gBS.js +992 -0
  73. package/dist/index-Dy_n2MPD.js +3010 -0
  74. package/dist/index-oc8HPfOF.js +13583 -0
  75. package/dist/index.es-Bsr7zP98.js +366 -0
  76. package/dist/index.es-C-j-Ghef.js +11678 -0
  77. package/dist/index.es.js +4 -4
  78. package/dist/{info-fKCfLW0k.js → info-BTLQJ-wd.js} +3 -3
  79. package/dist/{info-circle-Bt350Yzj.js → info-circle-Dla9169_.js} +3 -3
  80. package/dist/{lightbulb-BL9YBxiA.js → lightbulb-PN8DA_Wh.js} +3 -3
  81. package/dist/{mail-_g6CHQeQ.js → mail-BGYZut_4.js} +3 -3
  82. package/dist/{mobile-B-EQ4IcH.js → mobile-BM760ZzX.js} +3 -3
  83. package/dist/{more-C3rpOdUy.js → more-rHGnl2ck.js} +3 -3
  84. package/dist/{network-placeholder-D9Ak7Xj_.js → network-placeholder-CyQl-3_2.js} +3 -3
  85. package/dist/{nftPlaceholder-CIIm2V_o.js → nftPlaceholder-nuUJ8nKY.js} +3 -3
  86. package/dist/{off-DZjgI0eE.js → off-GYlwYDrT.js} +3 -3
  87. package/dist/{play-store-DvRnagoF.js → play-store-Ck01Ez1F.js} +3 -3
  88. package/dist/{plus-C2jN2huZ.js → plus-CQfXWgLw.js} +3 -3
  89. package/dist/{qr-code-B64HnZgi.js → qr-code-CyLVwLY7.js} +3 -3
  90. package/dist/{recycle-horizontal-CovcJGa_.js → recycle-horizontal-DvnWPcEQ.js} +3 -3
  91. package/dist/{refresh-J1Vw6QMA.js → refresh-BOxj8b2n.js} +3 -3
  92. package/dist/{reown-logo-BsXoZ3KT.js → reown-logo-D1iprOTg.js} +3 -3
  93. package/dist/{search-BC86wYXR.js → search-DrPaZPnc.js} +3 -3
  94. package/dist/secp256k1-DgmH1qVg.js +1251 -0
  95. package/dist/{send-BPA1bK5G.js → send-ybBREe4b.js} +3 -3
  96. package/dist/shareicon-D3Qj5j1T.js +262 -0
  97. package/dist/{sortDown-cDA6MpOw.js → sortDown-CjBaDQTU.js} +13 -13
  98. package/dist/{swapHorizontal-47_8ePle.js → swapHorizontal-BddjZdXK.js} +3 -3
  99. package/dist/{swapHorizontalBold-CJ7TzeQP.js → swapHorizontalBold-B6AWjPZ9.js} +3 -3
  100. package/dist/{swapHorizontalMedium-CTACgUR9.js → swapHorizontalMedium-CNacWoBn.js} +3 -3
  101. package/dist/{swapHorizontalRoundedBold-Ht3_LABp.js → swapHorizontalRoundedBold-B8VcPnqt.js} +3 -3
  102. package/dist/{swapVertical-DlS0V6DD.js → swapVertical-zY2BbSyQ.js} +3 -3
  103. package/dist/{telegram-UZ00kvIE.js → telegram-DS4l-8Oc.js} +3 -3
  104. package/dist/{three-dots-D9zVXr1j.js → three-dots-RctNqamK.js} +3 -3
  105. package/dist/truncate-D9t92mVX.js +7 -0
  106. package/dist/{twitch-CP6rpz4m.js → twitch-CJ0llIIH.js} +3 -3
  107. package/dist/{twitterIcon-Cm3I3FRU.js → twitterIcon-pgvN9-bP.js} +3 -3
  108. package/dist/unsupportedProp-BJVuEW_b.js +10 -0
  109. package/dist/useRegisterError-C_YLA1dw.js +9857 -0
  110. package/dist/validError-CDlJpg_f.js +6 -0
  111. package/dist/{verify-DuUE85WT.js → verify-BeZLo1Fq.js} +3 -3
  112. package/dist/{verify-filled-CfgydKPa.js → verify-filled-meyb7E16.js} +3 -3
  113. package/dist/w3m-modal-C-Jp9NVv.js +1471 -0
  114. package/dist/{wallet-BC2LSDlF.js → wallet-CFcOgSsz.js} +3 -3
  115. package/dist/{wallet-placeholder-DugEJ7xM.js → wallet-placeholder-CeUMILZq.js} +3 -3
  116. package/dist/{walletconnect-wayCaYfk.js → walletconnect-D6LB1PyC.js} +7 -9
  117. package/dist/{warning-circle-Cy9YuvwU.js → warning-circle-BRtzofvT.js} +3 -3
  118. package/dist/{x-jggPFiy-.js → x-DKQAOOh3.js} +3 -3
  119. package/package.json +1 -1
  120. package/dist/AllRoutes-Bdi5ZW8W.js +0 -2604
  121. package/dist/Box-e4gA-y_H.js +0 -60
  122. package/dist/EstGas-C5ihS0Mw.js +0 -17108
  123. package/dist/Grow-B4K-I-E-.js +0 -2212
  124. package/dist/InputComp-C_UUZxNU.js +0 -114
  125. package/dist/LoadRoute-CnDhVKdh.js +0 -142
  126. package/dist/QuotesProgress-DxgPgPJE.js +0 -29
  127. package/dist/SwapAsset-CmmuxeQF.js +0 -65
  128. package/dist/Tooltip-D8YjOOKU.js +0 -718
  129. package/dist/TxnButton-CF-TLZrD.js +0 -302
  130. package/dist/WidgetForm.module-DhUUlwZP.js +0 -13
  131. package/dist/basic-Cx2xxgd9.js +0 -7109
  132. package/dist/ccip-BKpquA5i.js +0 -250
  133. package/dist/clockIcon-jSNFFrLy.js +0 -76
  134. package/dist/core-C-gr9X18.js +0 -17217
  135. package/dist/cursor-BTtIlTHP.js +0 -7
  136. package/dist/down-DDk8OoJG.js +0 -809
  137. package/dist/ethertousd-BOknTgU4.js +0 -7
  138. package/dist/getChainIds-6iugk2h0.js +0 -2431
  139. package/dist/getCosmosAddress-BgD5iV6f.js +0 -13998
  140. package/dist/hamburger-BYe_G11E.js +0 -4562
  141. package/dist/index-BAmjBHYR.js +0 -1087
  142. package/dist/index-BxHeZ9IF.js +0 -543
  143. package/dist/index-C7cb2O7r.js +0 -16078
  144. package/dist/index-CF9p4S_X.js +0 -11
  145. package/dist/index-C_vo1L7p.js +0 -24384
  146. package/dist/index-Ch7w83dW.js +0 -4217
  147. package/dist/index-Crhenmgw.js +0 -188
  148. package/dist/index-Cz5Dosd2.js +0 -412
  149. package/dist/index-D5OnT-__.js +0 -35858
  150. package/dist/index-DArR1lwi.js +0 -1759
  151. package/dist/index-hEJSpZe-.js +0 -308
  152. package/dist/index-m2O0cbD8.js +0 -1883
  153. package/dist/index-sLx4Edw4.js +0 -22
  154. package/dist/index.es-DIbGJsfa.js +0 -475
  155. package/dist/index.es-t6sHlseh.js +0 -12916
  156. package/dist/secp256k1-BkBK0mD5.js +0 -1681
  157. package/dist/shareicon-C88Wx-AM.js +0 -314
  158. package/dist/truncate-DSxFWEga.js +0 -7
  159. package/dist/unsupportedProp-DkeDzLfM.js +0 -14
  160. package/dist/useRegisterError-W_UfecIN.js +0 -19288
  161. package/dist/validError-rariWQ7G.js +0 -14
  162. package/dist/w3m-modal-Bl-DPlah.js +0 -1721
@@ -1,4217 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { useState, useEffect } from "react";
4
- import { useConnect, useAccount as useAccount$1, useDisconnect, useSwitchAccount, useConfig, useConnectors, useConnections } from "wagmi";
5
- import { useDynamicContext, useIsLoggedIn, useWalletItemActions, useUserWallets, useWalletOptions, useSwitchWallet } from "@dynamic-labs/sdk-react-core";
6
- import { p as process$1, g as generateUtilityClass, b as _extends, _ as _objectWithoutPropertiesLoose, d as capitalize, P as PropTypes, u as useStore, l as lodashExports, s as deepmerge, a as useWallet } from "./index-D5OnT-__.js";
7
- import { useAccount, useSuggestChain, useSuggestChainAndConnect, useConnect as useConnect$1, WalletType, useActiveChainIds, useDisconnect as useDisconnect$1, useActiveWalletType } from "graz";
8
- import { g as generateUtilityClasses, d as useDefaultProps, Q as extendSxProp, s as styled, c as clsx, a as composeClasses, i as images, u as useWalletDetails, C as CircularProgress, _ as _inheritsLoose, R as getDisplayName, K as exactProp, S as circularProgressClasses, k as useRegisterError, B as BackButton, W as WalletIcon } from "./useRegisterError-W_UfecIN.js";
9
- import { _ as _assertThisInitialized, C as CloseButton, g as getChainIds } from "./getChainIds-6iugk2h0.js";
10
- import { B as Box } from "./Box-e4gA-y_H.js";
11
- import { v as validError } from "./validError-rariWQ7G.js";
12
- const ThemeContext = /* @__PURE__ */ React.createContext(null);
13
- if (process$1.env.NODE_ENV !== "production") {
14
- ThemeContext.displayName = "ThemeContext";
15
- }
16
- function useTheme$1() {
17
- const theme = React.useContext(ThemeContext);
18
- if (process$1.env.NODE_ENV !== "production") {
19
- React.useDebugValue(theme);
20
- }
21
- return theme;
22
- }
23
- const hasSymbol = typeof Symbol === "function" && Symbol.for;
24
- const nested = hasSymbol ? Symbol.for("mui.nested") : "__THEME_NESTED__";
25
- function _typeof$1(o) {
26
- "@babel/helpers - typeof";
27
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
28
- return typeof o2;
29
- } : function(o2) {
30
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
31
- }, _typeof$1(o);
32
- }
33
- function toPrimitive(t, r) {
34
- if ("object" != _typeof$1(t) || !t) return t;
35
- var e = t[Symbol.toPrimitive];
36
- if (void 0 !== e) {
37
- var i = e.call(t, r);
38
- if ("object" != _typeof$1(i)) return i;
39
- throw new TypeError("@@toPrimitive must return a primitive value.");
40
- }
41
- return String(t);
42
- }
43
- function toPropertyKey(t) {
44
- var i = toPrimitive(t, "string");
45
- return "symbol" == _typeof$1(i) ? i : i + "";
46
- }
47
- function getTypographyUtilityClass(slot) {
48
- return generateUtilityClass("MuiTypography", slot);
49
- }
50
- generateUtilityClasses("MuiTypography", ["root", "h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "inherit", "button", "caption", "overline", "alignLeft", "alignRight", "alignCenter", "alignJustify", "noWrap", "gutterBottom", "paragraph"]);
51
- const _excluded$3 = ["align", "className", "component", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"];
52
- const useUtilityClasses = (ownerState) => {
53
- const {
54
- align,
55
- gutterBottom,
56
- noWrap,
57
- paragraph,
58
- variant,
59
- classes
60
- } = ownerState;
61
- const slots = {
62
- root: ["root", variant, ownerState.align !== "inherit" && `align${capitalize(align)}`, gutterBottom && "gutterBottom", noWrap && "noWrap", paragraph && "paragraph"]
63
- };
64
- return composeClasses(slots, getTypographyUtilityClass, classes);
65
- };
66
- const TypographyRoot = styled("span", {
67
- name: "MuiTypography",
68
- slot: "Root",
69
- overridesResolver: (props, styles2) => {
70
- const {
71
- ownerState
72
- } = props;
73
- return [styles2.root, ownerState.variant && styles2[ownerState.variant], ownerState.align !== "inherit" && styles2[`align${capitalize(ownerState.align)}`], ownerState.noWrap && styles2.noWrap, ownerState.gutterBottom && styles2.gutterBottom, ownerState.paragraph && styles2.paragraph];
74
- }
75
- })(({
76
- theme,
77
- ownerState
78
- }) => _extends({
79
- margin: 0
80
- }, ownerState.variant === "inherit" && {
81
- // Some elements, like <button> on Chrome have default font that doesn't inherit, reset this.
82
- font: "inherit"
83
- }, ownerState.variant !== "inherit" && theme.typography[ownerState.variant], ownerState.align !== "inherit" && {
84
- textAlign: ownerState.align
85
- }, ownerState.noWrap && {
86
- overflow: "hidden",
87
- textOverflow: "ellipsis",
88
- whiteSpace: "nowrap"
89
- }, ownerState.gutterBottom && {
90
- marginBottom: "0.35em"
91
- }, ownerState.paragraph && {
92
- marginBottom: 16
93
- }));
94
- const defaultVariantMapping = {
95
- h1: "h1",
96
- h2: "h2",
97
- h3: "h3",
98
- h4: "h4",
99
- h5: "h5",
100
- h6: "h6",
101
- subtitle1: "h6",
102
- subtitle2: "h6",
103
- body1: "p",
104
- body2: "p",
105
- inherit: "p"
106
- };
107
- const colorTransformations = {
108
- primary: "primary.main",
109
- textPrimary: "text.primary",
110
- secondary: "secondary.main",
111
- textSecondary: "text.secondary",
112
- error: "error.main"
113
- };
114
- const transformDeprecatedColors = (color) => {
115
- return colorTransformations[color] || color;
116
- };
117
- const Typography = /* @__PURE__ */ React.forwardRef(function Typography2(inProps, ref) {
118
- const themeProps = useDefaultProps({
119
- props: inProps,
120
- name: "MuiTypography"
121
- });
122
- const color = transformDeprecatedColors(themeProps.color);
123
- const props = extendSxProp(_extends({}, themeProps, {
124
- color
125
- }));
126
- const {
127
- align = "inherit",
128
- className,
129
- component,
130
- gutterBottom = false,
131
- noWrap = false,
132
- paragraph = false,
133
- variant = "body1",
134
- variantMapping = defaultVariantMapping
135
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$3);
136
- const ownerState = _extends({}, props, {
137
- align,
138
- color,
139
- className,
140
- component,
141
- gutterBottom,
142
- noWrap,
143
- paragraph,
144
- variant,
145
- variantMapping
146
- });
147
- const Component = component || (paragraph ? "p" : variantMapping[variant] || defaultVariantMapping[variant]) || "span";
148
- const classes = useUtilityClasses(ownerState);
149
- return /* @__PURE__ */ jsx(TypographyRoot, _extends({
150
- as: Component,
151
- ref,
152
- ownerState,
153
- className: clsx(classes.root, className)
154
- }, other));
155
- });
156
- process$1.env.NODE_ENV !== "production" ? Typography.propTypes = {
157
- // ┌────────────────────────────── Warning ──────────────────────────────┐
158
- // │ These PropTypes are generated from the TypeScript type definitions. │
159
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
160
- // └─────────────────────────────────────────────────────────────────────┘
161
- /**
162
- * Set the text-align on the component.
163
- * @default 'inherit'
164
- */
165
- align: PropTypes.oneOf(["center", "inherit", "justify", "left", "right"]),
166
- /**
167
- * The content of the component.
168
- */
169
- children: PropTypes.node,
170
- /**
171
- * Override or extend the styles applied to the component.
172
- */
173
- classes: PropTypes.object,
174
- /**
175
- * @ignore
176
- */
177
- className: PropTypes.string,
178
- /**
179
- * The component used for the root node.
180
- * Either a string to use a HTML element or a component.
181
- */
182
- component: PropTypes.elementType,
183
- /**
184
- * If `true`, the text will have a bottom margin.
185
- * @default false
186
- */
187
- gutterBottom: PropTypes.bool,
188
- /**
189
- * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.
190
- *
191
- * Note that text overflow can only happen with block or inline-block level elements
192
- * (the element needs to have a width in order to overflow).
193
- * @default false
194
- */
195
- noWrap: PropTypes.bool,
196
- /**
197
- * If `true`, the element will be a paragraph element.
198
- * @default false
199
- */
200
- paragraph: PropTypes.bool,
201
- /**
202
- * The system prop that allows defining system overrides as well as additional CSS styles.
203
- */
204
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
205
- /**
206
- * Applies the theme typography styles.
207
- * @default 'body1'
208
- */
209
- variant: PropTypes.oneOfType([PropTypes.oneOf(["body1", "body2", "button", "caption", "h1", "h2", "h3", "h4", "h5", "h6", "inherit", "overline", "subtitle1", "subtitle2"]), PropTypes.string]),
210
- /**
211
- * The component maps the variant prop to a range of different HTML element types.
212
- * For instance, subtitle1 to `<h6>`.
213
- * If you wish to change that mapping, you can provide your own.
214
- * Alternatively, you can use the `component` prop.
215
- * @default {
216
- * h1: 'h1',
217
- * h2: 'h2',
218
- * h3: 'h3',
219
- * h4: 'h4',
220
- * h5: 'h5',
221
- * h6: 'h6',
222
- * subtitle1: 'h6',
223
- * subtitle2: 'h6',
224
- * body1: 'p',
225
- * body2: 'p',
226
- * inherit: 'p',
227
- * }
228
- */
229
- variantMapping: PropTypes.object
230
- } : void 0;
231
- const gradientbutton$1 = "_gradientbutton_dz9ed_1";
232
- const styles$1 = {
233
- gradientbutton: gradientbutton$1
234
- };
235
- function getSolWalletInstalled(wallet) {
236
- var _a, _b, _c, _d, _e, _f;
237
- switch (wallet) {
238
- case "phantom":
239
- if ((_b = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.solana) == null ? void 0 : _b.isPhantom) {
240
- return true;
241
- } else {
242
- return false;
243
- }
244
- case "backpack":
245
- if ((_c = window == null ? void 0 : window.backpack) == null ? void 0 : _c.isBackpack) {
246
- return true;
247
- } else {
248
- return false;
249
- }
250
- case "brave browser (solana)":
251
- if (window.braveSolana.isBraveWallet) {
252
- return true;
253
- } else {
254
- return false;
255
- }
256
- case "solflare":
257
- if ((_d = window == null ? void 0 : window.solflare) == null ? void 0 : _d.isSolflare) {
258
- return true;
259
- } else {
260
- return false;
261
- }
262
- case "magic eden (solana)":
263
- if ((_f = (_e = window == null ? void 0 : window.magicEden) == null ? void 0 : _e.solana) == null ? void 0 : _f.isMagicEden) {
264
- return true;
265
- } else {
266
- return false;
267
- }
268
- default:
269
- return false;
270
- }
271
- }
272
- function DisconnectWallet({ fill }) {
273
- return /* @__PURE__ */ jsxs("svg", { width: "100%", height: "100%", viewBox: "0 0 25 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
274
- /* @__PURE__ */ jsx("rect", { x: "11.7148", y: "4.08594", width: "1.60573", height: "9.09916", rx: "0.802867", fill }),
275
- /* @__PURE__ */ jsx(
276
- "path",
277
- {
278
- "fill-rule": "evenodd",
279
- "clip-rule": "evenodd",
280
- d: "M16.3146 5.80529C16.5295 5.92348 16.738 6.05125 16.9396 6.18801C18.1562 7.01313 19.1223 8.16579 19.7212 9.51974C20.4268 11.1151 20.5828 12.8995 20.1647 14.5931C19.7465 16.2867 18.7778 17.7934 17.4107 18.8769C16.0435 19.9605 14.3554 20.5594 12.611 20.5797C10.8667 20.6 9.16506 20.0405 7.77309 18.9891C6.38111 17.9377 5.37764 16.4539 4.92016 14.7705C4.46268 13.0871 4.57709 11.2995 5.24543 9.68821C5.81266 8.32069 6.75162 7.14586 7.94869 6.29265C8.16209 6.14055 8.3837 5.99866 8.61287 5.86773L8.61451 5.8706C8.71383 5.81424 8.82868 5.78206 8.95105 5.78206C9.3282 5.78206 9.63394 6.0878 9.63394 6.46495C9.63394 6.74011 9.47121 6.97726 9.23674 7.0854C8.01077 7.8015 7.05203 8.89924 6.50763 10.2117C5.95526 11.5435 5.8607 13.0209 6.2388 14.4122C6.6169 15.8034 7.44624 17.0298 8.59668 17.8987C9.74711 18.7677 11.1535 19.2301 12.5951 19.2133C14.0368 19.1965 15.432 18.7015 16.5619 17.806C17.6918 16.9105 18.4924 15.6652 18.838 14.2655C19.1836 12.8658 19.0547 11.391 18.4715 10.0725C17.8885 8.75448 16.8845 7.66724 15.617 6.98132L15.6157 6.9806L15.6163 6.97936C15.4179 6.8599 15.2851 6.64237 15.2851 6.39384C15.2851 6.01668 15.5908 5.71094 15.968 5.71094C16.0747 5.71094 16.1756 5.7354 16.2656 5.77901L16.2658 5.77867C16.2688 5.78032 16.2719 5.78197 16.2749 5.78363C16.2884 5.79042 16.3016 5.79765 16.3146 5.80529Z",
281
- fill
282
- }
283
- ),
284
- /* @__PURE__ */ jsxs("g", { filter: "url(#filter0_f_5308_21436)", children: [
285
- /* @__PURE__ */ jsx("rect", { x: "11.7148", y: "4.08594", width: "1.60573", height: "9.09916", rx: "0.802867", fill }),
286
- /* @__PURE__ */ jsx(
287
- "path",
288
- {
289
- "fill-rule": "evenodd",
290
- "clip-rule": "evenodd",
291
- d: "M16.3146 5.80529C16.5295 5.92348 16.738 6.05125 16.9396 6.18801C18.1562 7.01313 19.1223 8.16579 19.7212 9.51974C20.4268 11.1151 20.5828 12.8995 20.1647 14.5931C19.7465 16.2867 18.7778 17.7934 17.4107 18.8769C16.0435 19.9605 14.3554 20.5594 12.611 20.5797C10.8667 20.6 9.16506 20.0405 7.77309 18.9891C6.38111 17.9377 5.37764 16.4539 4.92016 14.7705C4.46268 13.0871 4.57709 11.2995 5.24543 9.68821C5.81266 8.32069 6.75162 7.14586 7.94869 6.29265C8.16209 6.14055 8.3837 5.99866 8.61287 5.86773L8.61451 5.8706C8.71383 5.81424 8.82868 5.78206 8.95105 5.78206C9.3282 5.78206 9.63394 6.0878 9.63394 6.46495C9.63394 6.74011 9.47121 6.97726 9.23674 7.0854C8.01077 7.8015 7.05203 8.89924 6.50763 10.2117C5.95526 11.5435 5.8607 13.0209 6.2388 14.4122C6.6169 15.8034 7.44624 17.0298 8.59668 17.8987C9.74711 18.7677 11.1535 19.2301 12.5951 19.2133C14.0368 19.1965 15.432 18.7015 16.5619 17.806C17.6918 16.9105 18.4924 15.6652 18.838 14.2655C19.1836 12.8658 19.0547 11.391 18.4715 10.0725C17.8885 8.75448 16.8845 7.66724 15.617 6.98132L15.6157 6.9806L15.6163 6.97936C15.4179 6.8599 15.2851 6.64237 15.2851 6.39384C15.2851 6.01668 15.5908 5.71094 15.968 5.71094C16.0747 5.71094 16.1756 5.7354 16.2656 5.77901L16.2658 5.77867C16.2688 5.78032 16.2719 5.78197 16.2749 5.78363C16.2884 5.79042 16.3016 5.79765 16.3146 5.80529Z",
292
- fill
293
- }
294
- )
295
- ] }),
296
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { id: "filter0_f_5308_21436", x: "0.644531", y: "0.0859375", width: "23.75", height: "24.4941", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [
297
- /* @__PURE__ */ jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }),
298
- /* @__PURE__ */ jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }),
299
- /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "2", result: "effect1_foregroundBlur_5308_21436" })
300
- ] }) })
301
- ] });
302
- }
303
- function ShareIcon({ fill }) {
304
- return /* @__PURE__ */ jsxs(
305
- "svg",
306
- {
307
- width: "18",
308
- height: "18",
309
- viewBox: "0 0 13 13",
310
- fill: "none",
311
- xmlns: "http://www.w3.org/2000/svg",
312
- children: [
313
- /* @__PURE__ */ jsx(
314
- "path",
315
- {
316
- d: "M6 2H2C1.44772 2 1 2.44772 1 3V11C1 11.5523 1.44772 12 2 12H10C10.5523 12 11 11.5523 11 11V7",
317
- stroke: fill,
318
- "stroke-linecap": "round"
319
- }
320
- ),
321
- /* @__PURE__ */ jsx(
322
- "path",
323
- {
324
- d: "M4.64645 8.14645C4.45118 8.34171 4.45118 8.65829 4.64645 8.85355C4.84171 9.04882 5.15829 9.04882 5.35355 8.85355L4.64645 8.14645ZM13 1C13 0.723858 12.7761 0.5 12.5 0.5H8C7.72386 0.5 7.5 0.723858 7.5 1C7.5 1.27614 7.72386 1.5 8 1.5H12V5.5C12 5.77614 12.2239 6 12.5 6C12.7761 6 13 5.77614 13 5.5V1ZM5.35355 8.85355L12.8536 1.35355L12.1464 0.646447L4.64645 8.14645L5.35355 8.85355Z",
325
- fill
326
- }
327
- )
328
- ]
329
- }
330
- );
331
- }
332
- function SupportedWallets({ wallet, chain }) {
333
- const { solflare, slope, magiceden, backpacksol, keplr, solanaicon, brave, cosmosicon, ethereumicon } = images;
334
- const walletIcons = {
335
- solflare,
336
- // phantom,
337
- slope,
338
- backpack: backpacksol,
339
- "magic eden (solana)": magiceden,
340
- keplr,
341
- "brave browser (solana)": brave,
342
- phantom: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAKkElEQVR4Ae2dQW8bxxmGv9ldGmikJFQBO4bdWERiA40OkQrIl+QgGkjbS4rYaN2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IDIwLjQxOTlIMjQuMDY5NEwyNS4yODUzIDIxLjYwNzlMMjAuOTYwNCAyMi42NzZMMjEuODMzIDIwLjQxODJWMjAuNDE5OVoiIGZpbGw9IiM2NjE4MDAiLz4KPHBhdGggZD0iTTE5LjQ4MTcgMzAuODM2MkwxOS45OTExIDI4Ljk3OTRMMTguOTY1OCAyNy44NDIzSDE2LjAzMjdMMTUuMDA3MyAyOC45Nzk0TDE1LjUxNjcgMzAuODM2MiIgZmlsbD0iIzY2MTgwMCIvPgo8cGF0aCBkPSJNMTkuNDgxNiAzMC44MzU5VjMzLjkwMjFIMTUuNTE2NlYzMC44MzU5SDE5LjQ4MTZaIiBmaWxsPSIjQzBDNENEIi8+CjxwYXRoIGQ9Ik05LjgyOTU5IDMwLjUxNDJMMTUuNTIgMzMuOTAwOFYzMC44MzQ2TDE1LjAxMDYgMjguOTc3OEw5LjgyOTU5IDMwLjUxNDJaIiBmaWxsPSIjRTdFQkY2Ii8+CjxwYXRoIGQ9Ik0yNS4xNzIxIDMwLjUxNDJMMTkuNDgxNyAzMy45MDA4VjMwLjgzNDZMMTkuOTkxMSAyOC45Nzc4TDI1LjE3MjEgMzAuNTE0MloiIGZpbGw9IiNFN0VCRjYiLz4KPC9zdmc+Cg=="
346
- };
347
- const walletLink = {
348
- solflare: "https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",
349
- phantom: "https://chromewebstore.google.com/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",
350
- slope: "https://chromewebstore.google.com/detail/slope-wallet/pocmplpaccanhmnllbbkpgfliimjljgo?hl=en",
351
- backpack: "https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",
352
- "magic eden (solana)": "https://chromewebstore.google.com/detail/magic-eden-wallet/mkpegjkblkkefacfnmkajcjmabijhclg",
353
- keplr: "https://chromewebstore.google.com/detail/keplr/dmkamcknogkgcdfhhbddcghachkejeap?hl=en",
354
- "brave browser (solana)": "https://brave.com/wallet/",
355
- "trust wallet": "https://chromewebstore.google.com/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph",
356
- "rabby wallet": "https://chromewebstore.google.com/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch?hl=en",
357
- metamask: "https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en"
358
- };
359
- return /* @__PURE__ */ jsx("a", { className: "bw-min-w-full", href: walletLink[wallet == null ? void 0 : wallet.toLowerCase()], target: "_blank", children: /* @__PURE__ */ jsxs("div", { className: "bw-w-full bw-flex bw-items-center bw-justify-between bw-h-max", children: [
360
- " ",
361
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-my-2 bw-items-center bw-gap-x-2", children: [
362
- /* @__PURE__ */ jsxs("div", { className: "bw-w-max bw-relative", children: [
363
- /* @__PURE__ */ jsx("img", { src: walletIcons[wallet == null ? void 0 : wallet.toLowerCase()], width: 32, height: 32, className: "bw-w-[32px] bw-h-[32px] bw-rounded-md", alt: "img" }),
364
- /* @__PURE__ */ jsx("img", { src: chain == "cosmos" ? cosmosicon : chain === "evm" ? ethereumicon : solanaicon, className: "bw-absolute bw-right-[-15%] bw-bottom-[-30%]", width: "21", height: "21", alt: "img" })
365
- ] }),
366
- /* @__PURE__ */ jsx("p", { className: "bw-text-sm bw-text-text-secondary bw-font-medium", children: wallet })
367
- ] }),
368
- /* @__PURE__ */ jsxs("button", { children: [
369
- " ",
370
- /* @__PURE__ */ jsx(ShareIcon, { fill: "var(--tw-text-placeholder)" })
371
- ] })
372
- ] }) });
373
- }
374
- const Main = ({ fromChain, toChain, connectWalletField, handleSolConnecting, selectedWalletTab, handleShowWallet, section }) => {
375
- const { primaryWallet, handleLogOut, handleUnlinkWallet } = useDynamicContext();
376
- const isFullyConnected = useIsLoggedIn();
377
- const [balance, setBalance] = useState(0);
378
- const [isLoading, setIsLoading] = useState(false);
379
- const [walletObj, setWalletObj] = useState();
380
- const { setShowAuthFlow, walletConnectorOptions } = useDynamicContext();
381
- const { openWallet } = useWalletItemActions();
382
- const configuration = useStore((state) => state.configuration);
383
- const setToDisconnect = useStore((state) => state.setToDisconnect);
384
- const { handleSOLDisable } = useWalletDetails({});
385
- handleSOLDisable(connectWalletField);
386
- const wallets = useUserWallets();
387
- const { selectWalletOption, walletOptions } = useWalletOptions();
388
- const setPrimaryWallet = useSwitchWallet();
389
- useEffect(() => {
390
- if (isFullyConnected && isLoading && primaryWallet !== null) {
391
- setIsLoading(false);
392
- }
393
- }, [isFullyConnected, primaryWallet]);
394
- const { phantom, solflare, slope, magiceden, backpacksol, keplr, solanaicon, brave } = images;
395
- const walletIcons = {
396
- solflare,
397
- phantom,
398
- slope,
399
- backpack: backpacksol,
400
- "magic eden (solana)": magiceden,
401
- keplr,
402
- "brave browser (solana)": brave
403
- };
404
- useEffect(() => {
405
- if (wallets.length) {
406
- setWalletObj(lodashExports.keyBy(wallets, (item) => item.connector.name));
407
- } else {
408
- setWalletObj();
409
- }
410
- }, [wallets.length]);
411
- const handleClick = (item) => {
412
- var _a, _b, _c, _d;
413
- if (item.name == ((_a = primaryWallet == null ? void 0 : primaryWallet.connector) == null ? void 0 : _a.name)) {
414
- if (connectWalletField == "to") {
415
- setToDisconnect(false);
416
- handleShowWallet();
417
- }
418
- } else {
419
- if (walletObj == null ? void 0 : walletObj[item.name]) {
420
- setPrimaryWallet((_b = walletObj == null ? void 0 : walletObj[item == null ? void 0 : item.name]) == null ? void 0 : _b.id);
421
- handleShowWallet();
422
- setToDisconnect(false);
423
- } else {
424
- openWallet((_c = item.key) == null ? void 0 : _c.toLowerCase());
425
- setIsLoading(true);
426
- handleSolConnecting(true, (_d = item.name) == null ? void 0 : _d.toLowerCase());
427
- }
428
- }
429
- };
430
- return (walletOptions == null ? void 0 : walletOptions.length) ? /* @__PURE__ */ jsx(Fragment, { children: walletOptions.filter((item, i) => {
431
- var _a;
432
- let connected = item.name == ((_a = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _a.name) || (walletObj == null ? void 0 : walletObj[item == null ? void 0 : item.name]);
433
- if (item.name == "Solflare" || item.name == "Slope" || item.name == "Phantom" || item.name == "Backpack" || item.name == "Magic Eden (Solana)" || item.name == "Brave Browser (Solana)") {
434
- if (section == "connected" && connected) {
435
- return true;
436
- } else if (section == "installed" && !connected && (item.isInstalledOnBrowser || item.name == "Phantom" && window.innerWidth < 768)) {
437
- return true;
438
- } else if (section == "supported" && !item.isInstalledOnBrowser) {
439
- return true;
440
- }
441
- }
442
- }).map((item, i) => {
443
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
444
- let connected = item.name == ((_a = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _a.name) || (walletObj == null ? void 0 : walletObj[item == null ? void 0 : item.name]);
445
- return item.isInstalledOnBrowser || connected && section !== "supported" || item.name == "Phantom" && section == "installed" && !connected ? /* @__PURE__ */ jsx(
446
- "div",
447
- {
448
- style: item.name == ((_b = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _b.name) ? {
449
- ...configuration == null ? void 0 : configuration.gradientStyle
450
- } : {},
451
- className: `bw-w-[47%] bw-mb-4 ${item.name == "Keplr" && selectedWalletTab === "Cosmos" ? "" : " "} bw-rounded-md bw-p-[1px] ${!configuration.gradientStyle && item.name == ((_c = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _c.name) ? styles$1.gradientbutton : "bw-bg-border-primary"} `,
452
- children: /* @__PURE__ */ jsxs(
453
- "div",
454
- {
455
- className: ` bw-relative bw-flex bw-w-full bw-bg-background-container hover:bw-shadow-sm bw-font-medium hover:bw-font-bold hover:bw-text-text-primary bw-items-center bw-gap-x-3 bw-rounded-md bw-h-[56px] bw-px-3 bw-cursor-pointer ${""}${item.name == ((_d = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _d.name) ? " bw-text-text-primary" : "bw-text-text-secondary"}`,
456
- onClick: () => {
457
- var _a2;
458
- if (getSolWalletInstalled((_a2 = item.name) == null ? void 0 : _a2.toLowerCase()) || item.name == "Phantom") handleClick(item);
459
- },
460
- children: [
461
- /* @__PURE__ */ jsx(
462
- "div",
463
- {
464
- style: item.name == ((_e = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _e.name) ? {
465
- ...configuration == null ? void 0 : configuration.gradientStyle
466
- } : {},
467
- className: ` bw-mb-4 ${item.name == "Keplr" && selectedWalletTab === "Cosmos" ? "" : " "} bw-rounded-md bw-p-[1px] bw-absolute bw-right-2 bw-bottom-[-50%] ${!configuration.gradientStyle && item.name == ((_f = primaryWallet == null ? void 0 : primaryWallet._connector) == null ? void 0 : _f.name) ? styles$1.gradientbutton : "bw-bg-border-primary"} `,
468
- children: /* @__PURE__ */ jsxs("div", { className: " bw-w-[71px] bw-h-[25px] bw-rounded-md bw-flex bw-bg-background-container bw-justify-center bw-items-center bw-gap-x-1 ", children: [
469
- /* @__PURE__ */ jsx("img", { src: solanaicon, width: "", height: "", alt: "img" }),
470
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-bold bw-text-text-primary", children: "SOL" })
471
- ] })
472
- }
473
- ),
474
- (walletObj == null ? void 0 : walletObj[item == null ? void 0 : item.name]) ? /* @__PURE__ */ jsx(
475
- "p",
476
- {
477
- onClick: async (e) => {
478
- var _a2;
479
- e.stopPropagation();
480
- if (wallets.length === 1) {
481
- handleLogOut();
482
- } else {
483
- try {
484
- let res = await handleUnlinkWallet((_a2 = walletObj == null ? void 0 : walletObj[item == null ? void 0 : item.name]) == null ? void 0 : _a2.id);
485
- } catch (Err) {
486
- }
487
- }
488
- },
489
- className: " bw-cursor-pointer bw-absolute bw-right-[5px] bw-top-1 bw-text-[10px] bw-text-text-primary bw-z-40 bw-rounded-[50%]",
490
- children: /* @__PURE__ */ jsx(
491
- "div",
492
- {
493
- style: {
494
- boxShadow: configuration && configuration.customTheme && ((_h = (_g = configuration.customTheme) == null ? void 0 : _g.shadow) == null ? void 0 : _h.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.20)"
495
- },
496
- className: "bw-w-[25px] bw-h-[25px] bw-rounded-[50%]",
497
- children: /* @__PURE__ */ jsx(DisconnectWallet, { fill: "var(--tw-text-primary)" })
498
- }
499
- )
500
- }
501
- ) : /* @__PURE__ */ jsx(Fragment, {}),
502
- /* @__PURE__ */ jsxs("div", { className: "bw-w-max bw-relative", children: [
503
- /* @__PURE__ */ jsx("img", { src: walletIcons[(_i = item.name) == null ? void 0 : _i.toLowerCase()], width: 32, height: 32, className: "bw-w-[32px] bw-h-[32px] bw-rounded-md", alt: "img" }),
504
- /* @__PURE__ */ jsx("img", { src: solanaicon, className: "bw-absolute bw-right-[-15%] bw-bottom-[-30%]", width: "", height: "", alt: "img" })
505
- ] }),
506
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-w-max ", children: item.name })
507
- ]
508
- }
509
- )
510
- }
511
- ) : item.name == "Phantom" && window.innerWidth < 768 ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(SupportedWallets, { wallet: item.name, chain: item.chain });
512
- }) }) : /* @__PURE__ */ jsx("div", { className: "bw-w-full bw-flex bw-justify-center bw-mt-2 bw-text-text-primary", children: /* @__PURE__ */ jsx(CircularProgress, { color: "inherit", size: 14 }) });
513
- };
514
- const SolanaWallet = ({
515
- connectWalletField,
516
- fromChain,
517
- toChain,
518
- handleSolConnecting,
519
- portfolio,
520
- selectedWalletTab,
521
- handleShowWallet,
522
- section
523
- }) => {
524
- return /* @__PURE__ */ jsx(
525
- Main,
526
- {
527
- fromChain,
528
- toChain,
529
- connectWalletField,
530
- handleSolConnecting,
531
- portfolio,
532
- selectedWalletTab,
533
- handleShowWallet,
534
- section
535
- }
536
- );
537
- };
538
- const stateClasses = ["checked", "disabled", "error", "focused", "focusVisible", "required", "expanded", "selected"];
539
- function createGenerateClassName(options = {}) {
540
- const {
541
- disableGlobal = false,
542
- productionPrefix = "jss",
543
- seed = ""
544
- } = options;
545
- const seedPrefix = seed === "" ? "" : `${seed}-`;
546
- let ruleCounter = 0;
547
- const getNextCounterId = () => {
548
- ruleCounter += 1;
549
- if (process$1.env.NODE_ENV !== "production") {
550
- if (ruleCounter >= 1e10) {
551
- }
552
- }
553
- return ruleCounter;
554
- };
555
- return (rule, styleSheet) => {
556
- const name = styleSheet.options.name;
557
- if (name && name.indexOf("Mui") === 0 && !styleSheet.options.link && !disableGlobal) {
558
- if (stateClasses.indexOf(rule.key) !== -1) {
559
- return `Mui-${rule.key}`;
560
- }
561
- const prefix2 = `${seedPrefix}${name}-${rule.key}`;
562
- if (!styleSheet.options.theme[nested] || seed !== "") {
563
- return prefix2;
564
- }
565
- return `${prefix2}-${getNextCounterId()}`;
566
- }
567
- if (process$1.env.NODE_ENV === "production") {
568
- return `${seedPrefix}${productionPrefix}${getNextCounterId()}`;
569
- }
570
- const suffix = `${rule.key}-${getNextCounterId()}`;
571
- if (styleSheet.options.classNamePrefix) {
572
- return `${seedPrefix}${styleSheet.options.classNamePrefix}-${suffix}`;
573
- }
574
- return `${seedPrefix}${suffix}`;
575
- };
576
- }
577
- var isProduction = process$1.env.NODE_ENV === "production";
578
- function warning(condition, message) {
579
- if (!isProduction) {
580
- var text = "Warning: " + message;
581
- if (typeof console !== "undefined") {
582
- }
583
- try {
584
- throw Error(text);
585
- } catch (x) {
586
- }
587
- }
588
- }
589
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
590
- return typeof obj;
591
- } : function(obj) {
592
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
593
- };
594
- var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === "object" && document.nodeType === 9;
595
- function _defineProperties(e, r) {
596
- for (var t = 0; t < r.length; t++) {
597
- var o = r[t];
598
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
599
- }
600
- }
601
- function _createClass(e, r, t) {
602
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
603
- writable: false
604
- }), e;
605
- }
606
- var plainObjectConstrurctor = {}.constructor;
607
- function cloneStyle(style) {
608
- if (style == null || typeof style !== "object") return style;
609
- if (Array.isArray(style)) return style.map(cloneStyle);
610
- if (style.constructor !== plainObjectConstrurctor) return style;
611
- var newStyle = {};
612
- for (var name in style) {
613
- newStyle[name] = cloneStyle(style[name]);
614
- }
615
- return newStyle;
616
- }
617
- function createRule(name, decl, options) {
618
- if (name === void 0) {
619
- name = "unnamed";
620
- }
621
- var jss = options.jss;
622
- var declCopy = cloneStyle(decl);
623
- var rule = jss.plugins.onCreateRule(name, declCopy, options);
624
- if (rule) return rule;
625
- if (name[0] === "@") {
626
- process$1.env.NODE_ENV !== "production" ? warning(false, "[JSS] Unknown rule " + name) : void 0;
627
- }
628
- return null;
629
- }
630
- var join = function join2(value, by) {
631
- var result = "";
632
- for (var i = 0; i < value.length; i++) {
633
- if (value[i] === "!important") break;
634
- if (result) result += by;
635
- result += value[i];
636
- }
637
- return result;
638
- };
639
- var toCssValue = function toCssValue2(value) {
640
- if (!Array.isArray(value)) return value;
641
- var cssValue = "";
642
- if (Array.isArray(value[0])) {
643
- for (var i = 0; i < value.length; i++) {
644
- if (value[i] === "!important") break;
645
- if (cssValue) cssValue += ", ";
646
- cssValue += join(value[i], " ");
647
- }
648
- } else cssValue = join(value, ", ");
649
- if (value[value.length - 1] === "!important") {
650
- cssValue += " !important";
651
- }
652
- return cssValue;
653
- };
654
- function getWhitespaceSymbols(options) {
655
- if (options && options.format === false) {
656
- return {
657
- linebreak: "",
658
- space: ""
659
- };
660
- }
661
- return {
662
- linebreak: "\n",
663
- space: " "
664
- };
665
- }
666
- function indentStr(str, indent) {
667
- var result = "";
668
- for (var index2 = 0; index2 < indent; index2++) {
669
- result += " ";
670
- }
671
- return result + str;
672
- }
673
- function toCss(selector, style, options) {
674
- if (options === void 0) {
675
- options = {};
676
- }
677
- var result = "";
678
- if (!style) return result;
679
- var _options = options, _options$indent = _options.indent, indent = _options$indent === void 0 ? 0 : _options$indent;
680
- var fallbacks = style.fallbacks;
681
- if (options.format === false) {
682
- indent = -Infinity;
683
- }
684
- var _getWhitespaceSymbols = getWhitespaceSymbols(options), linebreak = _getWhitespaceSymbols.linebreak, space = _getWhitespaceSymbols.space;
685
- if (selector) indent++;
686
- if (fallbacks) {
687
- if (Array.isArray(fallbacks)) {
688
- for (var index2 = 0; index2 < fallbacks.length; index2++) {
689
- var fallback = fallbacks[index2];
690
- for (var prop in fallback) {
691
- var value = fallback[prop];
692
- if (value != null) {
693
- if (result) result += linebreak;
694
- result += indentStr(prop + ":" + space + toCssValue(value) + ";", indent);
695
- }
696
- }
697
- }
698
- } else {
699
- for (var _prop in fallbacks) {
700
- var _value = fallbacks[_prop];
701
- if (_value != null) {
702
- if (result) result += linebreak;
703
- result += indentStr(_prop + ":" + space + toCssValue(_value) + ";", indent);
704
- }
705
- }
706
- }
707
- }
708
- for (var _prop2 in style) {
709
- var _value2 = style[_prop2];
710
- if (_value2 != null && _prop2 !== "fallbacks") {
711
- if (result) result += linebreak;
712
- result += indentStr(_prop2 + ":" + space + toCssValue(_value2) + ";", indent);
713
- }
714
- }
715
- if (!result && !options.allowEmpty) return result;
716
- if (!selector) return result;
717
- indent--;
718
- if (result) result = "" + linebreak + result + linebreak;
719
- return indentStr("" + selector + space + "{" + result, indent) + indentStr("}", indent);
720
- }
721
- var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;
722
- var nativeEscape = typeof CSS !== "undefined" && CSS.escape;
723
- var escape = function(str) {
724
- return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, "\\$1");
725
- };
726
- var BaseStyleRule = /* @__PURE__ */ function() {
727
- function BaseStyleRule2(key, style, options) {
728
- this.type = "style";
729
- this.isProcessed = false;
730
- var sheet = options.sheet, Renderer = options.Renderer;
731
- this.key = key;
732
- this.options = options;
733
- this.style = style;
734
- if (sheet) this.renderer = sheet.renderer;
735
- else if (Renderer) this.renderer = new Renderer();
736
- }
737
- var _proto = BaseStyleRule2.prototype;
738
- _proto.prop = function prop(name, value, options) {
739
- if (value === void 0) return this.style[name];
740
- var force = options ? options.force : false;
741
- if (!force && this.style[name] === value) return this;
742
- var newValue = value;
743
- if (!options || options.process !== false) {
744
- newValue = this.options.jss.plugins.onChangeValue(value, name, this);
745
- }
746
- var isEmpty2 = newValue == null || newValue === false;
747
- var isDefined = name in this.style;
748
- if (isEmpty2 && !isDefined && !force) return this;
749
- var remove = isEmpty2 && isDefined;
750
- if (remove) delete this.style[name];
751
- else this.style[name] = newValue;
752
- if (this.renderable && this.renderer) {
753
- if (remove) this.renderer.removeProperty(this.renderable, name);
754
- else this.renderer.setProperty(this.renderable, name, newValue);
755
- return this;
756
- }
757
- var sheet = this.options.sheet;
758
- if (sheet && sheet.attached) {
759
- process$1.env.NODE_ENV !== "production" ? warning(false, '[JSS] Rule is not linked. Missing sheet option "link: true".') : void 0;
760
- }
761
- return this;
762
- };
763
- return BaseStyleRule2;
764
- }();
765
- var StyleRule = /* @__PURE__ */ function(_BaseStyleRule) {
766
- _inheritsLoose(StyleRule2, _BaseStyleRule);
767
- function StyleRule2(key, style, options) {
768
- var _this;
769
- _this = _BaseStyleRule.call(this, key, style, options) || this;
770
- var selector = options.selector, scoped = options.scoped, sheet = options.sheet, generateId = options.generateId;
771
- if (selector) {
772
- _this.selectorText = selector;
773
- } else if (scoped !== false) {
774
- _this.id = generateId(_assertThisInitialized(_assertThisInitialized(_this)), sheet);
775
- _this.selectorText = "." + escape(_this.id);
776
- }
777
- return _this;
778
- }
779
- var _proto2 = StyleRule2.prototype;
780
- _proto2.applyTo = function applyTo(renderable) {
781
- var renderer = this.renderer;
782
- if (renderer) {
783
- var json = this.toJSON();
784
- for (var prop in json) {
785
- renderer.setProperty(renderable, prop, json[prop]);
786
- }
787
- }
788
- return this;
789
- };
790
- _proto2.toJSON = function toJSON() {
791
- var json = {};
792
- for (var prop in this.style) {
793
- var value = this.style[prop];
794
- if (typeof value !== "object") json[prop] = value;
795
- else if (Array.isArray(value)) json[prop] = toCssValue(value);
796
- }
797
- return json;
798
- };
799
- _proto2.toString = function toString(options) {
800
- var sheet = this.options.sheet;
801
- var link = sheet ? sheet.options.link : false;
802
- var opts = link ? _extends({}, options, {
803
- allowEmpty: true
804
- }) : options;
805
- return toCss(this.selectorText, this.style, opts);
806
- };
807
- _createClass(StyleRule2, [{
808
- key: "selector",
809
- set: function set(selector) {
810
- if (selector === this.selectorText) return;
811
- this.selectorText = selector;
812
- var renderer = this.renderer, renderable = this.renderable;
813
- if (!renderable || !renderer) return;
814
- var hasChanged = renderer.setSelector(renderable, selector);
815
- if (!hasChanged) {
816
- renderer.replaceRule(renderable, this);
817
- }
818
- },
819
- get: function get() {
820
- return this.selectorText;
821
- }
822
- }]);
823
- return StyleRule2;
824
- }(BaseStyleRule);
825
- var pluginStyleRule = {
826
- onCreateRule: function onCreateRule(key, style, options) {
827
- if (key[0] === "@" || options.parent && options.parent.type === "keyframes") {
828
- return null;
829
- }
830
- return new StyleRule(key, style, options);
831
- }
832
- };
833
- var defaultToStringOptions = {
834
- indent: 1,
835
- children: true
836
- };
837
- var atRegExp = /@([\w-]+)/;
838
- var ConditionalRule = /* @__PURE__ */ function() {
839
- function ConditionalRule2(key, styles2, options) {
840
- this.type = "conditional";
841
- this.isProcessed = false;
842
- this.key = key;
843
- var atMatch = key.match(atRegExp);
844
- this.at = atMatch ? atMatch[1] : "unknown";
845
- this.query = options.name || "@" + this.at;
846
- this.options = options;
847
- this.rules = new RuleList(_extends({}, options, {
848
- parent: this
849
- }));
850
- for (var name in styles2) {
851
- this.rules.add(name, styles2[name]);
852
- }
853
- this.rules.process();
854
- }
855
- var _proto = ConditionalRule2.prototype;
856
- _proto.getRule = function getRule(name) {
857
- return this.rules.get(name);
858
- };
859
- _proto.indexOf = function indexOf(rule) {
860
- return this.rules.indexOf(rule);
861
- };
862
- _proto.addRule = function addRule(name, style, options) {
863
- var rule = this.rules.add(name, style, options);
864
- if (!rule) return null;
865
- this.options.jss.plugins.onProcessRule(rule);
866
- return rule;
867
- };
868
- _proto.replaceRule = function replaceRule(name, style, options) {
869
- var newRule = this.rules.replace(name, style, options);
870
- if (newRule) this.options.jss.plugins.onProcessRule(newRule);
871
- return newRule;
872
- };
873
- _proto.toString = function toString(options) {
874
- if (options === void 0) {
875
- options = defaultToStringOptions;
876
- }
877
- var _getWhitespaceSymbols = getWhitespaceSymbols(options), linebreak = _getWhitespaceSymbols.linebreak;
878
- if (options.indent == null) options.indent = defaultToStringOptions.indent;
879
- if (options.children == null) options.children = defaultToStringOptions.children;
880
- if (options.children === false) {
881
- return this.query + " {}";
882
- }
883
- var children = this.rules.toString(options);
884
- return children ? this.query + " {" + linebreak + children + linebreak + "}" : "";
885
- };
886
- return ConditionalRule2;
887
- }();
888
- var keyRegExp = /@container|@media|@supports\s+/;
889
- var pluginConditionalRule = {
890
- onCreateRule: function onCreateRule2(key, styles2, options) {
891
- return keyRegExp.test(key) ? new ConditionalRule(key, styles2, options) : null;
892
- }
893
- };
894
- var defaultToStringOptions$1 = {
895
- indent: 1,
896
- children: true
897
- };
898
- var nameRegExp = /@keyframes\s+([\w-]+)/;
899
- var KeyframesRule = /* @__PURE__ */ function() {
900
- function KeyframesRule2(key, frames, options) {
901
- this.type = "keyframes";
902
- this.at = "@keyframes";
903
- this.isProcessed = false;
904
- var nameMatch = key.match(nameRegExp);
905
- if (nameMatch && nameMatch[1]) {
906
- this.name = nameMatch[1];
907
- } else {
908
- this.name = "noname";
909
- process$1.env.NODE_ENV !== "production" ? warning(false, "[JSS] Bad keyframes name " + key) : void 0;
910
- }
911
- this.key = this.type + "-" + this.name;
912
- this.options = options;
913
- var scoped = options.scoped, sheet = options.sheet, generateId = options.generateId;
914
- this.id = scoped === false ? this.name : escape(generateId(this, sheet));
915
- this.rules = new RuleList(_extends({}, options, {
916
- parent: this
917
- }));
918
- for (var name in frames) {
919
- this.rules.add(name, frames[name], _extends({}, options, {
920
- parent: this
921
- }));
922
- }
923
- this.rules.process();
924
- }
925
- var _proto = KeyframesRule2.prototype;
926
- _proto.toString = function toString(options) {
927
- if (options === void 0) {
928
- options = defaultToStringOptions$1;
929
- }
930
- var _getWhitespaceSymbols = getWhitespaceSymbols(options), linebreak = _getWhitespaceSymbols.linebreak;
931
- if (options.indent == null) options.indent = defaultToStringOptions$1.indent;
932
- if (options.children == null) options.children = defaultToStringOptions$1.children;
933
- if (options.children === false) {
934
- return this.at + " " + this.id + " {}";
935
- }
936
- var children = this.rules.toString(options);
937
- if (children) children = "" + linebreak + children + linebreak;
938
- return this.at + " " + this.id + " {" + children + "}";
939
- };
940
- return KeyframesRule2;
941
- }();
942
- var keyRegExp$1 = /@keyframes\s+/;
943
- var refRegExp$1 = /\$([\w-]+)/g;
944
- var findReferencedKeyframe = function findReferencedKeyframe2(val, keyframes) {
945
- if (typeof val === "string") {
946
- return val.replace(refRegExp$1, function(match, name) {
947
- if (name in keyframes) {
948
- return keyframes[name];
949
- }
950
- process$1.env.NODE_ENV !== "production" ? warning(false, '[JSS] Referenced keyframes rule "' + name + '" is not defined.') : void 0;
951
- return match;
952
- });
953
- }
954
- return val;
955
- };
956
- var replaceRef = function replaceRef2(style, prop, keyframes) {
957
- var value = style[prop];
958
- var refKeyframe = findReferencedKeyframe(value, keyframes);
959
- if (refKeyframe !== value) {
960
- style[prop] = refKeyframe;
961
- }
962
- };
963
- var pluginKeyframesRule = {
964
- onCreateRule: function onCreateRule3(key, frames, options) {
965
- return typeof key === "string" && keyRegExp$1.test(key) ? new KeyframesRule(key, frames, options) : null;
966
- },
967
- // Animation name ref replacer.
968
- onProcessStyle: function onProcessStyle(style, rule, sheet) {
969
- if (rule.type !== "style" || !sheet) return style;
970
- if ("animation-name" in style) replaceRef(style, "animation-name", sheet.keyframes);
971
- if ("animation" in style) replaceRef(style, "animation", sheet.keyframes);
972
- return style;
973
- },
974
- onChangeValue: function onChangeValue(val, prop, rule) {
975
- var sheet = rule.options.sheet;
976
- if (!sheet) {
977
- return val;
978
- }
979
- switch (prop) {
980
- case "animation":
981
- return findReferencedKeyframe(val, sheet.keyframes);
982
- case "animation-name":
983
- return findReferencedKeyframe(val, sheet.keyframes);
984
- default:
985
- return val;
986
- }
987
- }
988
- };
989
- var KeyframeRule = /* @__PURE__ */ function(_BaseStyleRule) {
990
- _inheritsLoose(KeyframeRule2, _BaseStyleRule);
991
- function KeyframeRule2() {
992
- return _BaseStyleRule.apply(this, arguments) || this;
993
- }
994
- var _proto = KeyframeRule2.prototype;
995
- _proto.toString = function toString(options) {
996
- var sheet = this.options.sheet;
997
- var link = sheet ? sheet.options.link : false;
998
- var opts = link ? _extends({}, options, {
999
- allowEmpty: true
1000
- }) : options;
1001
- return toCss(this.key, this.style, opts);
1002
- };
1003
- return KeyframeRule2;
1004
- }(BaseStyleRule);
1005
- var pluginKeyframeRule = {
1006
- onCreateRule: function onCreateRule4(key, style, options) {
1007
- if (options.parent && options.parent.type === "keyframes") {
1008
- return new KeyframeRule(key, style, options);
1009
- }
1010
- return null;
1011
- }
1012
- };
1013
- var FontFaceRule = /* @__PURE__ */ function() {
1014
- function FontFaceRule2(key, style, options) {
1015
- this.type = "font-face";
1016
- this.at = "@font-face";
1017
- this.isProcessed = false;
1018
- this.key = key;
1019
- this.style = style;
1020
- this.options = options;
1021
- }
1022
- var _proto = FontFaceRule2.prototype;
1023
- _proto.toString = function toString(options) {
1024
- var _getWhitespaceSymbols = getWhitespaceSymbols(options), linebreak = _getWhitespaceSymbols.linebreak;
1025
- if (Array.isArray(this.style)) {
1026
- var str = "";
1027
- for (var index2 = 0; index2 < this.style.length; index2++) {
1028
- str += toCss(this.at, this.style[index2]);
1029
- if (this.style[index2 + 1]) str += linebreak;
1030
- }
1031
- return str;
1032
- }
1033
- return toCss(this.at, this.style, options);
1034
- };
1035
- return FontFaceRule2;
1036
- }();
1037
- var keyRegExp$2 = /@font-face/;
1038
- var pluginFontFaceRule = {
1039
- onCreateRule: function onCreateRule5(key, style, options) {
1040
- return keyRegExp$2.test(key) ? new FontFaceRule(key, style, options) : null;
1041
- }
1042
- };
1043
- var ViewportRule = /* @__PURE__ */ function() {
1044
- function ViewportRule2(key, style, options) {
1045
- this.type = "viewport";
1046
- this.at = "@viewport";
1047
- this.isProcessed = false;
1048
- this.key = key;
1049
- this.style = style;
1050
- this.options = options;
1051
- }
1052
- var _proto = ViewportRule2.prototype;
1053
- _proto.toString = function toString(options) {
1054
- return toCss(this.key, this.style, options);
1055
- };
1056
- return ViewportRule2;
1057
- }();
1058
- var pluginViewportRule = {
1059
- onCreateRule: function onCreateRule6(key, style, options) {
1060
- return key === "@viewport" || key === "@-ms-viewport" ? new ViewportRule(key, style, options) : null;
1061
- }
1062
- };
1063
- var SimpleRule = /* @__PURE__ */ function() {
1064
- function SimpleRule2(key, value, options) {
1065
- this.type = "simple";
1066
- this.isProcessed = false;
1067
- this.key = key;
1068
- this.value = value;
1069
- this.options = options;
1070
- }
1071
- var _proto = SimpleRule2.prototype;
1072
- _proto.toString = function toString(options) {
1073
- if (Array.isArray(this.value)) {
1074
- var str = "";
1075
- for (var index2 = 0; index2 < this.value.length; index2++) {
1076
- str += this.key + " " + this.value[index2] + ";";
1077
- if (this.value[index2 + 1]) str += "\n";
1078
- }
1079
- return str;
1080
- }
1081
- return this.key + " " + this.value + ";";
1082
- };
1083
- return SimpleRule2;
1084
- }();
1085
- var keysMap = {
1086
- "@charset": true,
1087
- "@import": true,
1088
- "@namespace": true
1089
- };
1090
- var pluginSimpleRule = {
1091
- onCreateRule: function onCreateRule7(key, value, options) {
1092
- return key in keysMap ? new SimpleRule(key, value, options) : null;
1093
- }
1094
- };
1095
- var plugins$1 = [pluginStyleRule, pluginConditionalRule, pluginKeyframesRule, pluginKeyframeRule, pluginFontFaceRule, pluginViewportRule, pluginSimpleRule];
1096
- var defaultUpdateOptions = {
1097
- process: true
1098
- };
1099
- var forceUpdateOptions = {
1100
- force: true,
1101
- process: true
1102
- /**
1103
- * Contains rules objects and allows adding/removing etc.
1104
- * Is used for e.g. by `StyleSheet` or `ConditionalRule`.
1105
- */
1106
- };
1107
- var RuleList = /* @__PURE__ */ function() {
1108
- function RuleList2(options) {
1109
- this.map = {};
1110
- this.raw = {};
1111
- this.index = [];
1112
- this.counter = 0;
1113
- this.options = options;
1114
- this.classes = options.classes;
1115
- this.keyframes = options.keyframes;
1116
- }
1117
- var _proto = RuleList2.prototype;
1118
- _proto.add = function add(name, decl, ruleOptions) {
1119
- var _this$options = this.options, parent = _this$options.parent, sheet = _this$options.sheet, jss = _this$options.jss, Renderer = _this$options.Renderer, generateId = _this$options.generateId, scoped = _this$options.scoped;
1120
- var options = _extends({
1121
- classes: this.classes,
1122
- parent,
1123
- sheet,
1124
- jss,
1125
- Renderer,
1126
- generateId,
1127
- scoped,
1128
- name,
1129
- keyframes: this.keyframes,
1130
- selector: void 0
1131
- }, ruleOptions);
1132
- var key = name;
1133
- if (name in this.raw) {
1134
- key = name + "-d" + this.counter++;
1135
- }
1136
- this.raw[key] = decl;
1137
- if (key in this.classes) {
1138
- options.selector = "." + escape(this.classes[key]);
1139
- }
1140
- var rule = createRule(key, decl, options);
1141
- if (!rule) return null;
1142
- this.register(rule);
1143
- var index2 = options.index === void 0 ? this.index.length : options.index;
1144
- this.index.splice(index2, 0, rule);
1145
- return rule;
1146
- };
1147
- _proto.replace = function replace(name, decl, ruleOptions) {
1148
- var oldRule = this.get(name);
1149
- var oldIndex = this.index.indexOf(oldRule);
1150
- if (oldRule) {
1151
- this.remove(oldRule);
1152
- }
1153
- var options = ruleOptions;
1154
- if (oldIndex !== -1) options = _extends({}, ruleOptions, {
1155
- index: oldIndex
1156
- });
1157
- return this.add(name, decl, options);
1158
- };
1159
- _proto.get = function get(nameOrSelector) {
1160
- return this.map[nameOrSelector];
1161
- };
1162
- _proto.remove = function remove(rule) {
1163
- this.unregister(rule);
1164
- delete this.raw[rule.key];
1165
- this.index.splice(this.index.indexOf(rule), 1);
1166
- };
1167
- _proto.indexOf = function indexOf(rule) {
1168
- return this.index.indexOf(rule);
1169
- };
1170
- _proto.process = function process() {
1171
- var plugins2 = this.options.jss.plugins;
1172
- this.index.slice(0).forEach(plugins2.onProcessRule, plugins2);
1173
- };
1174
- _proto.register = function register(rule) {
1175
- this.map[rule.key] = rule;
1176
- if (rule instanceof StyleRule) {
1177
- this.map[rule.selector] = rule;
1178
- if (rule.id) this.classes[rule.key] = rule.id;
1179
- } else if (rule instanceof KeyframesRule && this.keyframes) {
1180
- this.keyframes[rule.name] = rule.id;
1181
- }
1182
- };
1183
- _proto.unregister = function unregister(rule) {
1184
- delete this.map[rule.key];
1185
- if (rule instanceof StyleRule) {
1186
- delete this.map[rule.selector];
1187
- delete this.classes[rule.key];
1188
- } else if (rule instanceof KeyframesRule) {
1189
- delete this.keyframes[rule.name];
1190
- }
1191
- };
1192
- _proto.update = function update2() {
1193
- var name;
1194
- var data;
1195
- var options;
1196
- if (typeof (arguments.length <= 0 ? void 0 : arguments[0]) === "string") {
1197
- name = arguments.length <= 0 ? void 0 : arguments[0];
1198
- data = arguments.length <= 1 ? void 0 : arguments[1];
1199
- options = arguments.length <= 2 ? void 0 : arguments[2];
1200
- } else {
1201
- data = arguments.length <= 0 ? void 0 : arguments[0];
1202
- options = arguments.length <= 1 ? void 0 : arguments[1];
1203
- name = null;
1204
- }
1205
- if (name) {
1206
- this.updateOne(this.get(name), data, options);
1207
- } else {
1208
- for (var index2 = 0; index2 < this.index.length; index2++) {
1209
- this.updateOne(this.index[index2], data, options);
1210
- }
1211
- }
1212
- };
1213
- _proto.updateOne = function updateOne(rule, data, options) {
1214
- if (options === void 0) {
1215
- options = defaultUpdateOptions;
1216
- }
1217
- var _this$options2 = this.options, plugins2 = _this$options2.jss.plugins, sheet = _this$options2.sheet;
1218
- if (rule.rules instanceof RuleList2) {
1219
- rule.rules.update(data, options);
1220
- return;
1221
- }
1222
- var style = rule.style;
1223
- plugins2.onUpdate(data, rule, sheet, options);
1224
- if (options.process && style && style !== rule.style) {
1225
- plugins2.onProcessStyle(rule.style, rule, sheet);
1226
- for (var prop in rule.style) {
1227
- var nextValue = rule.style[prop];
1228
- var prevValue = style[prop];
1229
- if (nextValue !== prevValue) {
1230
- rule.prop(prop, nextValue, forceUpdateOptions);
1231
- }
1232
- }
1233
- for (var _prop in style) {
1234
- var _nextValue = rule.style[_prop];
1235
- var _prevValue = style[_prop];
1236
- if (_nextValue == null && _nextValue !== _prevValue) {
1237
- rule.prop(_prop, null, forceUpdateOptions);
1238
- }
1239
- }
1240
- }
1241
- };
1242
- _proto.toString = function toString(options) {
1243
- var str = "";
1244
- var sheet = this.options.sheet;
1245
- var link = sheet ? sheet.options.link : false;
1246
- var _getWhitespaceSymbols = getWhitespaceSymbols(options), linebreak = _getWhitespaceSymbols.linebreak;
1247
- for (var index2 = 0; index2 < this.index.length; index2++) {
1248
- var rule = this.index[index2];
1249
- var css2 = rule.toString(options);
1250
- if (!css2 && !link) continue;
1251
- if (str) str += linebreak;
1252
- str += css2;
1253
- }
1254
- return str;
1255
- };
1256
- return RuleList2;
1257
- }();
1258
- var StyleSheet = /* @__PURE__ */ function() {
1259
- function StyleSheet2(styles2, options) {
1260
- this.attached = false;
1261
- this.deployed = false;
1262
- this.classes = {};
1263
- this.keyframes = {};
1264
- this.options = _extends({}, options, {
1265
- sheet: this,
1266
- parent: this,
1267
- classes: this.classes,
1268
- keyframes: this.keyframes
1269
- });
1270
- if (options.Renderer) {
1271
- this.renderer = new options.Renderer(this);
1272
- }
1273
- this.rules = new RuleList(this.options);
1274
- for (var name in styles2) {
1275
- this.rules.add(name, styles2[name]);
1276
- }
1277
- this.rules.process();
1278
- }
1279
- var _proto = StyleSheet2.prototype;
1280
- _proto.attach = function attach2() {
1281
- if (this.attached) return this;
1282
- if (this.renderer) this.renderer.attach();
1283
- this.attached = true;
1284
- if (!this.deployed) this.deploy();
1285
- return this;
1286
- };
1287
- _proto.detach = function detach2() {
1288
- if (!this.attached) return this;
1289
- if (this.renderer) this.renderer.detach();
1290
- this.attached = false;
1291
- return this;
1292
- };
1293
- _proto.addRule = function addRule(name, decl, options) {
1294
- var queue = this.queue;
1295
- if (this.attached && !queue) this.queue = [];
1296
- var rule = this.rules.add(name, decl, options);
1297
- if (!rule) return null;
1298
- this.options.jss.plugins.onProcessRule(rule);
1299
- if (this.attached) {
1300
- if (!this.deployed) return rule;
1301
- if (queue) queue.push(rule);
1302
- else {
1303
- this.insertRule(rule);
1304
- if (this.queue) {
1305
- this.queue.forEach(this.insertRule, this);
1306
- this.queue = void 0;
1307
- }
1308
- }
1309
- return rule;
1310
- }
1311
- this.deployed = false;
1312
- return rule;
1313
- };
1314
- _proto.replaceRule = function replaceRule(nameOrSelector, decl, options) {
1315
- var oldRule = this.rules.get(nameOrSelector);
1316
- if (!oldRule) return this.addRule(nameOrSelector, decl, options);
1317
- var newRule = this.rules.replace(nameOrSelector, decl, options);
1318
- if (newRule) {
1319
- this.options.jss.plugins.onProcessRule(newRule);
1320
- }
1321
- if (this.attached) {
1322
- if (!this.deployed) return newRule;
1323
- if (this.renderer) {
1324
- if (!newRule) {
1325
- this.renderer.deleteRule(oldRule);
1326
- } else if (oldRule.renderable) {
1327
- this.renderer.replaceRule(oldRule.renderable, newRule);
1328
- }
1329
- }
1330
- return newRule;
1331
- }
1332
- this.deployed = false;
1333
- return newRule;
1334
- };
1335
- _proto.insertRule = function insertRule2(rule) {
1336
- if (this.renderer) {
1337
- this.renderer.insertRule(rule);
1338
- }
1339
- };
1340
- _proto.addRules = function addRules(styles2, options) {
1341
- var added = [];
1342
- for (var name in styles2) {
1343
- var rule = this.addRule(name, styles2[name], options);
1344
- if (rule) added.push(rule);
1345
- }
1346
- return added;
1347
- };
1348
- _proto.getRule = function getRule(nameOrSelector) {
1349
- return this.rules.get(nameOrSelector);
1350
- };
1351
- _proto.deleteRule = function deleteRule(name) {
1352
- var rule = typeof name === "object" ? name : this.rules.get(name);
1353
- if (!rule || // Style sheet was created without link: true and attached, in this case we
1354
- // won't be able to remove the CSS rule from the DOM.
1355
- this.attached && !rule.renderable) {
1356
- return false;
1357
- }
1358
- this.rules.remove(rule);
1359
- if (this.attached && rule.renderable && this.renderer) {
1360
- return this.renderer.deleteRule(rule.renderable);
1361
- }
1362
- return true;
1363
- };
1364
- _proto.indexOf = function indexOf(rule) {
1365
- return this.rules.indexOf(rule);
1366
- };
1367
- _proto.deploy = function deploy() {
1368
- if (this.renderer) this.renderer.deploy();
1369
- this.deployed = true;
1370
- return this;
1371
- };
1372
- _proto.update = function update2() {
1373
- var _this$rules;
1374
- (_this$rules = this.rules).update.apply(_this$rules, arguments);
1375
- return this;
1376
- };
1377
- _proto.updateOne = function updateOne(rule, data, options) {
1378
- this.rules.updateOne(rule, data, options);
1379
- return this;
1380
- };
1381
- _proto.toString = function toString(options) {
1382
- return this.rules.toString(options);
1383
- };
1384
- return StyleSheet2;
1385
- }();
1386
- var PluginsRegistry = /* @__PURE__ */ function() {
1387
- function PluginsRegistry2() {
1388
- this.plugins = {
1389
- internal: [],
1390
- external: []
1391
- };
1392
- this.registry = {};
1393
- }
1394
- var _proto = PluginsRegistry2.prototype;
1395
- _proto.onCreateRule = function onCreateRule8(name, decl, options) {
1396
- for (var i = 0; i < this.registry.onCreateRule.length; i++) {
1397
- var rule = this.registry.onCreateRule[i](name, decl, options);
1398
- if (rule) return rule;
1399
- }
1400
- return null;
1401
- };
1402
- _proto.onProcessRule = function onProcessRule(rule) {
1403
- if (rule.isProcessed) return;
1404
- var sheet = rule.options.sheet;
1405
- for (var i = 0; i < this.registry.onProcessRule.length; i++) {
1406
- this.registry.onProcessRule[i](rule, sheet);
1407
- }
1408
- if (rule.style) this.onProcessStyle(rule.style, rule, sheet);
1409
- rule.isProcessed = true;
1410
- };
1411
- _proto.onProcessStyle = function onProcessStyle2(style, rule, sheet) {
1412
- for (var i = 0; i < this.registry.onProcessStyle.length; i++) {
1413
- rule.style = this.registry.onProcessStyle[i](rule.style, rule, sheet);
1414
- }
1415
- };
1416
- _proto.onProcessSheet = function onProcessSheet(sheet) {
1417
- for (var i = 0; i < this.registry.onProcessSheet.length; i++) {
1418
- this.registry.onProcessSheet[i](sheet);
1419
- }
1420
- };
1421
- _proto.onUpdate = function onUpdate(data, rule, sheet, options) {
1422
- for (var i = 0; i < this.registry.onUpdate.length; i++) {
1423
- this.registry.onUpdate[i](data, rule, sheet, options);
1424
- }
1425
- };
1426
- _proto.onChangeValue = function onChangeValue2(value, prop, rule) {
1427
- var processedValue = value;
1428
- for (var i = 0; i < this.registry.onChangeValue.length; i++) {
1429
- processedValue = this.registry.onChangeValue[i](processedValue, prop, rule);
1430
- }
1431
- return processedValue;
1432
- };
1433
- _proto.use = function use(newPlugin, options) {
1434
- if (options === void 0) {
1435
- options = {
1436
- queue: "external"
1437
- };
1438
- }
1439
- var plugins2 = this.plugins[options.queue];
1440
- if (plugins2.indexOf(newPlugin) !== -1) {
1441
- return;
1442
- }
1443
- plugins2.push(newPlugin);
1444
- this.registry = [].concat(this.plugins.external, this.plugins.internal).reduce(function(registry, plugin) {
1445
- for (var name in plugin) {
1446
- if (name in registry) {
1447
- registry[name].push(plugin[name]);
1448
- } else {
1449
- process$1.env.NODE_ENV !== "production" ? warning(false, '[JSS] Unknown hook "' + name + '".') : void 0;
1450
- }
1451
- }
1452
- return registry;
1453
- }, {
1454
- onCreateRule: [],
1455
- onProcessRule: [],
1456
- onProcessStyle: [],
1457
- onProcessSheet: [],
1458
- onChangeValue: [],
1459
- onUpdate: []
1460
- });
1461
- };
1462
- return PluginsRegistry2;
1463
- }();
1464
- var SheetsRegistry = /* @__PURE__ */ function() {
1465
- function SheetsRegistry2() {
1466
- this.registry = [];
1467
- }
1468
- var _proto = SheetsRegistry2.prototype;
1469
- _proto.add = function add(sheet) {
1470
- var registry = this.registry;
1471
- var index2 = sheet.options.index;
1472
- if (registry.indexOf(sheet) !== -1) return;
1473
- if (registry.length === 0 || index2 >= this.index) {
1474
- registry.push(sheet);
1475
- return;
1476
- }
1477
- for (var i = 0; i < registry.length; i++) {
1478
- if (registry[i].options.index > index2) {
1479
- registry.splice(i, 0, sheet);
1480
- return;
1481
- }
1482
- }
1483
- };
1484
- _proto.reset = function reset() {
1485
- this.registry = [];
1486
- };
1487
- _proto.remove = function remove(sheet) {
1488
- var index2 = this.registry.indexOf(sheet);
1489
- this.registry.splice(index2, 1);
1490
- };
1491
- _proto.toString = function toString(_temp) {
1492
- var _ref = _temp === void 0 ? {} : _temp, attached = _ref.attached, options = _objectWithoutPropertiesLoose(_ref, ["attached"]);
1493
- var _getWhitespaceSymbols = getWhitespaceSymbols(options), linebreak = _getWhitespaceSymbols.linebreak;
1494
- var css2 = "";
1495
- for (var i = 0; i < this.registry.length; i++) {
1496
- var sheet = this.registry[i];
1497
- if (attached != null && sheet.attached !== attached) {
1498
- continue;
1499
- }
1500
- if (css2) css2 += linebreak;
1501
- css2 += sheet.toString(options);
1502
- }
1503
- return css2;
1504
- };
1505
- _createClass(SheetsRegistry2, [{
1506
- key: "index",
1507
- /**
1508
- * Current highest index number.
1509
- */
1510
- get: function get() {
1511
- return this.registry.length === 0 ? 0 : this.registry[this.registry.length - 1].options.index;
1512
- }
1513
- }]);
1514
- return SheetsRegistry2;
1515
- }();
1516
- var sheets = new SheetsRegistry();
1517
- var globalThis$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")();
1518
- var ns = "2f1acc6c3a606b082e5eef5e54414ffb";
1519
- if (globalThis$1[ns] == null) globalThis$1[ns] = 0;
1520
- var moduleId = globalThis$1[ns]++;
1521
- var maxRules = 1e10;
1522
- var createGenerateId = function createGenerateId2(options) {
1523
- if (options === void 0) {
1524
- options = {};
1525
- }
1526
- var ruleCounter = 0;
1527
- var generateId = function generateId2(rule, sheet) {
1528
- ruleCounter += 1;
1529
- if (ruleCounter > maxRules) {
1530
- process$1.env.NODE_ENV !== "production" ? warning(false, "[JSS] You might have a memory leak. Rule counter is at " + ruleCounter + ".") : void 0;
1531
- }
1532
- var jssId = "";
1533
- var prefix2 = "";
1534
- if (sheet) {
1535
- if (sheet.options.classNamePrefix) {
1536
- prefix2 = sheet.options.classNamePrefix;
1537
- }
1538
- if (sheet.options.jss.id != null) {
1539
- jssId = String(sheet.options.jss.id);
1540
- }
1541
- }
1542
- if (options.minify) {
1543
- return "" + (prefix2 || "c") + moduleId + jssId + ruleCounter;
1544
- }
1545
- return prefix2 + rule.key + "-" + moduleId + (jssId ? "-" + jssId : "") + "-" + ruleCounter;
1546
- };
1547
- return generateId;
1548
- };
1549
- var memoize = function memoize2(fn) {
1550
- var value;
1551
- return function() {
1552
- if (!value) value = fn();
1553
- return value;
1554
- };
1555
- };
1556
- var getPropertyValue = function getPropertyValue2(cssRule, prop) {
1557
- try {
1558
- if (cssRule.attributeStyleMap) {
1559
- return cssRule.attributeStyleMap.get(prop);
1560
- }
1561
- return cssRule.style.getPropertyValue(prop);
1562
- } catch (err) {
1563
- return "";
1564
- }
1565
- };
1566
- var setProperty = function setProperty2(cssRule, prop, value) {
1567
- try {
1568
- var cssValue = value;
1569
- if (Array.isArray(value)) {
1570
- cssValue = toCssValue(value);
1571
- }
1572
- if (cssRule.attributeStyleMap) {
1573
- cssRule.attributeStyleMap.set(prop, cssValue);
1574
- } else {
1575
- var indexOfImportantFlag = cssValue ? cssValue.indexOf("!important") : -1;
1576
- var cssValueWithoutImportantFlag = indexOfImportantFlag > -1 ? cssValue.substr(0, indexOfImportantFlag - 1) : cssValue;
1577
- cssRule.style.setProperty(prop, cssValueWithoutImportantFlag, indexOfImportantFlag > -1 ? "important" : "");
1578
- }
1579
- } catch (err) {
1580
- return false;
1581
- }
1582
- return true;
1583
- };
1584
- var removeProperty = function removeProperty2(cssRule, prop) {
1585
- try {
1586
- if (cssRule.attributeStyleMap) {
1587
- cssRule.attributeStyleMap.delete(prop);
1588
- } else {
1589
- cssRule.style.removeProperty(prop);
1590
- }
1591
- } catch (err) {
1592
- process$1.env.NODE_ENV !== "production" ? warning(false, '[JSS] DOMException "' + err.message + '" was thrown. Tried to remove property "' + prop + '".') : void 0;
1593
- }
1594
- };
1595
- var setSelector = function setSelector2(cssRule, selectorText) {
1596
- cssRule.selectorText = selectorText;
1597
- return cssRule.selectorText === selectorText;
1598
- };
1599
- var getHead = memoize(function() {
1600
- return document.querySelector("head");
1601
- });
1602
- function findHigherSheet(registry, options) {
1603
- for (var i = 0; i < registry.length; i++) {
1604
- var sheet = registry[i];
1605
- if (sheet.attached && sheet.options.index > options.index && sheet.options.insertionPoint === options.insertionPoint) {
1606
- return sheet;
1607
- }
1608
- }
1609
- return null;
1610
- }
1611
- function findHighestSheet(registry, options) {
1612
- for (var i = registry.length - 1; i >= 0; i--) {
1613
- var sheet = registry[i];
1614
- if (sheet.attached && sheet.options.insertionPoint === options.insertionPoint) {
1615
- return sheet;
1616
- }
1617
- }
1618
- return null;
1619
- }
1620
- function findCommentNode(text) {
1621
- var head = getHead();
1622
- for (var i = 0; i < head.childNodes.length; i++) {
1623
- var node = head.childNodes[i];
1624
- if (node.nodeType === 8 && node.nodeValue.trim() === text) {
1625
- return node;
1626
- }
1627
- }
1628
- return null;
1629
- }
1630
- function findPrevNode(options) {
1631
- var registry = sheets.registry;
1632
- if (registry.length > 0) {
1633
- var sheet = findHigherSheet(registry, options);
1634
- if (sheet && sheet.renderer) {
1635
- return {
1636
- parent: sheet.renderer.element.parentNode,
1637
- node: sheet.renderer.element
1638
- };
1639
- }
1640
- sheet = findHighestSheet(registry, options);
1641
- if (sheet && sheet.renderer) {
1642
- return {
1643
- parent: sheet.renderer.element.parentNode,
1644
- node: sheet.renderer.element.nextSibling
1645
- };
1646
- }
1647
- }
1648
- var insertionPoint = options.insertionPoint;
1649
- if (insertionPoint && typeof insertionPoint === "string") {
1650
- var comment = findCommentNode(insertionPoint);
1651
- if (comment) {
1652
- return {
1653
- parent: comment.parentNode,
1654
- node: comment.nextSibling
1655
- };
1656
- }
1657
- process$1.env.NODE_ENV !== "production" ? warning(false, '[JSS] Insertion point "' + insertionPoint + '" not found.') : void 0;
1658
- }
1659
- return false;
1660
- }
1661
- function insertStyle(style, options) {
1662
- var insertionPoint = options.insertionPoint;
1663
- var nextNode = findPrevNode(options);
1664
- if (nextNode !== false && nextNode.parent) {
1665
- nextNode.parent.insertBefore(style, nextNode.node);
1666
- return;
1667
- }
1668
- if (insertionPoint && typeof insertionPoint.nodeType === "number") {
1669
- var insertionPointElement = insertionPoint;
1670
- var parentNode = insertionPointElement.parentNode;
1671
- if (parentNode) parentNode.insertBefore(style, insertionPointElement.nextSibling);
1672
- else process$1.env.NODE_ENV !== "production" ? warning(false, "[JSS] Insertion point is not in the DOM.") : void 0;
1673
- return;
1674
- }
1675
- getHead().appendChild(style);
1676
- }
1677
- var getNonce = memoize(function() {
1678
- var node = document.querySelector('meta[property="csp-nonce"]');
1679
- return node ? node.getAttribute("content") : null;
1680
- });
1681
- var _insertRule = function insertRule(container, rule, index2) {
1682
- try {
1683
- if ("insertRule" in container) {
1684
- container.insertRule(rule, index2);
1685
- } else if ("appendRule" in container) {
1686
- container.appendRule(rule);
1687
- }
1688
- } catch (err) {
1689
- process$1.env.NODE_ENV !== "production" ? warning(false, "[JSS] " + err.message) : void 0;
1690
- return false;
1691
- }
1692
- return container.cssRules[index2];
1693
- };
1694
- var getValidRuleInsertionIndex = function getValidRuleInsertionIndex2(container, index2) {
1695
- var maxIndex = container.cssRules.length;
1696
- if (index2 === void 0 || index2 > maxIndex) {
1697
- return maxIndex;
1698
- }
1699
- return index2;
1700
- };
1701
- var createStyle = function createStyle2() {
1702
- var el2 = document.createElement("style");
1703
- el2.textContent = "\n";
1704
- return el2;
1705
- };
1706
- var DomRenderer = /* @__PURE__ */ function() {
1707
- function DomRenderer2(sheet) {
1708
- this.getPropertyValue = getPropertyValue;
1709
- this.setProperty = setProperty;
1710
- this.removeProperty = removeProperty;
1711
- this.setSelector = setSelector;
1712
- this.hasInsertedRules = false;
1713
- this.cssRules = [];
1714
- if (sheet) sheets.add(sheet);
1715
- this.sheet = sheet;
1716
- var _ref = this.sheet ? this.sheet.options : {}, media = _ref.media, meta = _ref.meta, element = _ref.element;
1717
- this.element = element || createStyle();
1718
- this.element.setAttribute("data-jss", "");
1719
- if (media) this.element.setAttribute("media", media);
1720
- if (meta) this.element.setAttribute("data-meta", meta);
1721
- var nonce = getNonce();
1722
- if (nonce) this.element.setAttribute("nonce", nonce);
1723
- }
1724
- var _proto = DomRenderer2.prototype;
1725
- _proto.attach = function attach2() {
1726
- if (this.element.parentNode || !this.sheet) return;
1727
- insertStyle(this.element, this.sheet.options);
1728
- var deployed = Boolean(this.sheet && this.sheet.deployed);
1729
- if (this.hasInsertedRules && deployed) {
1730
- this.hasInsertedRules = false;
1731
- this.deploy();
1732
- }
1733
- };
1734
- _proto.detach = function detach2() {
1735
- if (!this.sheet) return;
1736
- var parentNode = this.element.parentNode;
1737
- if (parentNode) parentNode.removeChild(this.element);
1738
- if (this.sheet.options.link) {
1739
- this.cssRules = [];
1740
- this.element.textContent = "\n";
1741
- }
1742
- };
1743
- _proto.deploy = function deploy() {
1744
- var sheet = this.sheet;
1745
- if (!sheet) return;
1746
- if (sheet.options.link) {
1747
- this.insertRules(sheet.rules);
1748
- return;
1749
- }
1750
- this.element.textContent = "\n" + sheet.toString() + "\n";
1751
- };
1752
- _proto.insertRules = function insertRules(rules, nativeParent) {
1753
- for (var i = 0; i < rules.index.length; i++) {
1754
- this.insertRule(rules.index[i], i, nativeParent);
1755
- }
1756
- };
1757
- _proto.insertRule = function insertRule2(rule, index2, nativeParent) {
1758
- if (nativeParent === void 0) {
1759
- nativeParent = this.element.sheet;
1760
- }
1761
- if (rule.rules) {
1762
- var parent = rule;
1763
- var latestNativeParent = nativeParent;
1764
- if (rule.type === "conditional" || rule.type === "keyframes") {
1765
- var _insertionIndex = getValidRuleInsertionIndex(nativeParent, index2);
1766
- latestNativeParent = _insertRule(nativeParent, parent.toString({
1767
- children: false
1768
- }), _insertionIndex);
1769
- if (latestNativeParent === false) {
1770
- return false;
1771
- }
1772
- this.refCssRule(rule, _insertionIndex, latestNativeParent);
1773
- }
1774
- this.insertRules(parent.rules, latestNativeParent);
1775
- return latestNativeParent;
1776
- }
1777
- var ruleStr = rule.toString();
1778
- if (!ruleStr) return false;
1779
- var insertionIndex = getValidRuleInsertionIndex(nativeParent, index2);
1780
- var nativeRule = _insertRule(nativeParent, ruleStr, insertionIndex);
1781
- if (nativeRule === false) {
1782
- return false;
1783
- }
1784
- this.hasInsertedRules = true;
1785
- this.refCssRule(rule, insertionIndex, nativeRule);
1786
- return nativeRule;
1787
- };
1788
- _proto.refCssRule = function refCssRule(rule, index2, cssRule) {
1789
- rule.renderable = cssRule;
1790
- if (rule.options.parent instanceof StyleSheet) {
1791
- this.cssRules.splice(index2, 0, cssRule);
1792
- }
1793
- };
1794
- _proto.deleteRule = function deleteRule(cssRule) {
1795
- var sheet = this.element.sheet;
1796
- var index2 = this.indexOf(cssRule);
1797
- if (index2 === -1) return false;
1798
- sheet.deleteRule(index2);
1799
- this.cssRules.splice(index2, 1);
1800
- return true;
1801
- };
1802
- _proto.indexOf = function indexOf(cssRule) {
1803
- return this.cssRules.indexOf(cssRule);
1804
- };
1805
- _proto.replaceRule = function replaceRule(cssRule, rule) {
1806
- var index2 = this.indexOf(cssRule);
1807
- if (index2 === -1) return false;
1808
- this.element.sheet.deleteRule(index2);
1809
- this.cssRules.splice(index2, 1);
1810
- return this.insertRule(rule, index2);
1811
- };
1812
- _proto.getRules = function getRules() {
1813
- return this.element.sheet.cssRules;
1814
- };
1815
- return DomRenderer2;
1816
- }();
1817
- var instanceCounter = 0;
1818
- var Jss = /* @__PURE__ */ function() {
1819
- function Jss2(options) {
1820
- this.id = instanceCounter++;
1821
- this.version = "10.10.0";
1822
- this.plugins = new PluginsRegistry();
1823
- this.options = {
1824
- id: {
1825
- minify: false
1826
- },
1827
- createGenerateId,
1828
- Renderer: isBrowser ? DomRenderer : null,
1829
- plugins: []
1830
- };
1831
- this.generateId = createGenerateId({
1832
- minify: false
1833
- });
1834
- for (var i = 0; i < plugins$1.length; i++) {
1835
- this.plugins.use(plugins$1[i], {
1836
- queue: "internal"
1837
- });
1838
- }
1839
- this.setup(options);
1840
- }
1841
- var _proto = Jss2.prototype;
1842
- _proto.setup = function setup(options) {
1843
- if (options === void 0) {
1844
- options = {};
1845
- }
1846
- if (options.createGenerateId) {
1847
- this.options.createGenerateId = options.createGenerateId;
1848
- }
1849
- if (options.id) {
1850
- this.options.id = _extends({}, this.options.id, options.id);
1851
- }
1852
- if (options.createGenerateId || options.id) {
1853
- this.generateId = this.options.createGenerateId(this.options.id);
1854
- }
1855
- if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint;
1856
- if ("Renderer" in options) {
1857
- this.options.Renderer = options.Renderer;
1858
- }
1859
- if (options.plugins) this.use.apply(this, options.plugins);
1860
- return this;
1861
- };
1862
- _proto.createStyleSheet = function createStyleSheet(styles2, options) {
1863
- if (options === void 0) {
1864
- options = {};
1865
- }
1866
- var _options = options, index2 = _options.index;
1867
- if (typeof index2 !== "number") {
1868
- index2 = sheets.index === 0 ? 0 : sheets.index + 1;
1869
- }
1870
- var sheet = new StyleSheet(styles2, _extends({}, options, {
1871
- jss: this,
1872
- generateId: options.generateId || this.generateId,
1873
- insertionPoint: this.options.insertionPoint,
1874
- Renderer: this.options.Renderer,
1875
- index: index2
1876
- }));
1877
- this.plugins.onProcessSheet(sheet);
1878
- return sheet;
1879
- };
1880
- _proto.removeStyleSheet = function removeStyleSheet(sheet) {
1881
- sheet.detach();
1882
- sheets.remove(sheet);
1883
- return this;
1884
- };
1885
- _proto.createRule = function createRule$1(name, style, options) {
1886
- if (style === void 0) {
1887
- style = {};
1888
- }
1889
- if (options === void 0) {
1890
- options = {};
1891
- }
1892
- if (typeof name === "object") {
1893
- return this.createRule(void 0, name, style);
1894
- }
1895
- var ruleOptions = _extends({}, options, {
1896
- name,
1897
- jss: this,
1898
- Renderer: this.options.Renderer
1899
- });
1900
- if (!ruleOptions.generateId) ruleOptions.generateId = this.generateId;
1901
- if (!ruleOptions.classes) ruleOptions.classes = {};
1902
- if (!ruleOptions.keyframes) ruleOptions.keyframes = {};
1903
- var rule = createRule(name, style, ruleOptions);
1904
- if (rule) this.plugins.onProcessRule(rule);
1905
- return rule;
1906
- };
1907
- _proto.use = function use() {
1908
- var _this = this;
1909
- for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) {
1910
- plugins2[_key] = arguments[_key];
1911
- }
1912
- plugins2.forEach(function(plugin) {
1913
- _this.plugins.use(plugin);
1914
- });
1915
- return this;
1916
- };
1917
- return Jss2;
1918
- }();
1919
- var createJss = function createJss2(options) {
1920
- return new Jss(options);
1921
- };
1922
- var hasCSSTOMSupport = typeof CSS === "object" && CSS != null && "number" in CSS;
1923
- function getDynamicStyles(styles2) {
1924
- var to = null;
1925
- for (var key in styles2) {
1926
- var value = styles2[key];
1927
- var type = typeof value;
1928
- if (type === "function") {
1929
- if (!to) to = {};
1930
- to[key] = value;
1931
- } else if (type === "object" && value !== null && !Array.isArray(value)) {
1932
- var extracted = getDynamicStyles(value);
1933
- if (extracted) {
1934
- if (!to) to = {};
1935
- to[key] = extracted;
1936
- }
1937
- }
1938
- }
1939
- return to;
1940
- }
1941
- createJss();
1942
- var now = Date.now();
1943
- var fnValuesNs = "fnValues" + now;
1944
- var fnRuleNs = "fnStyle" + ++now;
1945
- var functionPlugin = function functionPlugin2() {
1946
- return {
1947
- onCreateRule: function onCreateRule8(name, decl, options) {
1948
- if (typeof decl !== "function") return null;
1949
- var rule = createRule(name, {}, options);
1950
- rule[fnRuleNs] = decl;
1951
- return rule;
1952
- },
1953
- onProcessStyle: function onProcessStyle2(style, rule) {
1954
- if (fnValuesNs in rule || fnRuleNs in rule) return style;
1955
- var fnValues = {};
1956
- for (var prop in style) {
1957
- var value = style[prop];
1958
- if (typeof value !== "function") continue;
1959
- delete style[prop];
1960
- fnValues[prop] = value;
1961
- }
1962
- rule[fnValuesNs] = fnValues;
1963
- return style;
1964
- },
1965
- onUpdate: function onUpdate(data, rule, sheet, options) {
1966
- var styleRule = rule;
1967
- var fnRule = styleRule[fnRuleNs];
1968
- if (fnRule) {
1969
- styleRule.style = fnRule(data) || {};
1970
- if (process$1.env.NODE_ENV === "development") {
1971
- for (var prop in styleRule.style) {
1972
- if (typeof styleRule.style[prop] === "function") {
1973
- process$1.env.NODE_ENV !== "production" ? warning(false, "[JSS] Function values inside function rules are not supported.") : void 0;
1974
- break;
1975
- }
1976
- }
1977
- }
1978
- }
1979
- var fnValues = styleRule[fnValuesNs];
1980
- if (fnValues) {
1981
- for (var _prop in fnValues) {
1982
- styleRule.prop(_prop, fnValues[_prop](data), options);
1983
- }
1984
- }
1985
- }
1986
- };
1987
- };
1988
- var at = "@global";
1989
- var atPrefix = "@global ";
1990
- var GlobalContainerRule = /* @__PURE__ */ function() {
1991
- function GlobalContainerRule2(key, styles2, options) {
1992
- this.type = "global";
1993
- this.at = at;
1994
- this.isProcessed = false;
1995
- this.key = key;
1996
- this.options = options;
1997
- this.rules = new RuleList(_extends({}, options, {
1998
- parent: this
1999
- }));
2000
- for (var selector in styles2) {
2001
- this.rules.add(selector, styles2[selector]);
2002
- }
2003
- this.rules.process();
2004
- }
2005
- var _proto = GlobalContainerRule2.prototype;
2006
- _proto.getRule = function getRule(name) {
2007
- return this.rules.get(name);
2008
- };
2009
- _proto.addRule = function addRule(name, style, options) {
2010
- var rule = this.rules.add(name, style, options);
2011
- if (rule) this.options.jss.plugins.onProcessRule(rule);
2012
- return rule;
2013
- };
2014
- _proto.replaceRule = function replaceRule(name, style, options) {
2015
- var newRule = this.rules.replace(name, style, options);
2016
- if (newRule) this.options.jss.plugins.onProcessRule(newRule);
2017
- return newRule;
2018
- };
2019
- _proto.indexOf = function indexOf(rule) {
2020
- return this.rules.indexOf(rule);
2021
- };
2022
- _proto.toString = function toString(options) {
2023
- return this.rules.toString(options);
2024
- };
2025
- return GlobalContainerRule2;
2026
- }();
2027
- var GlobalPrefixedRule = /* @__PURE__ */ function() {
2028
- function GlobalPrefixedRule2(key, style, options) {
2029
- this.type = "global";
2030
- this.at = at;
2031
- this.isProcessed = false;
2032
- this.key = key;
2033
- this.options = options;
2034
- var selector = key.substr(atPrefix.length);
2035
- this.rule = options.jss.createRule(selector, style, _extends({}, options, {
2036
- parent: this
2037
- }));
2038
- }
2039
- var _proto2 = GlobalPrefixedRule2.prototype;
2040
- _proto2.toString = function toString(options) {
2041
- return this.rule ? this.rule.toString(options) : "";
2042
- };
2043
- return GlobalPrefixedRule2;
2044
- }();
2045
- var separatorRegExp$1 = /\s*,\s*/g;
2046
- function addScope(selector, scope) {
2047
- var parts = selector.split(separatorRegExp$1);
2048
- var scoped = "";
2049
- for (var i = 0; i < parts.length; i++) {
2050
- scoped += scope + " " + parts[i].trim();
2051
- if (parts[i + 1]) scoped += ", ";
2052
- }
2053
- return scoped;
2054
- }
2055
- function handleNestedGlobalContainerRule(rule, sheet) {
2056
- var options = rule.options, style = rule.style;
2057
- var rules = style ? style[at] : null;
2058
- if (!rules) return;
2059
- for (var name in rules) {
2060
- sheet.addRule(name, rules[name], _extends({}, options, {
2061
- selector: addScope(name, rule.selector)
2062
- }));
2063
- }
2064
- delete style[at];
2065
- }
2066
- function handlePrefixedGlobalRule(rule, sheet) {
2067
- var options = rule.options, style = rule.style;
2068
- for (var prop in style) {
2069
- if (prop[0] !== "@" || prop.substr(0, at.length) !== at) continue;
2070
- var selector = addScope(prop.substr(at.length), rule.selector);
2071
- sheet.addRule(selector, style[prop], _extends({}, options, {
2072
- selector
2073
- }));
2074
- delete style[prop];
2075
- }
2076
- }
2077
- function jssGlobal() {
2078
- function onCreateRule8(name, styles2, options) {
2079
- if (!name) return null;
2080
- if (name === at) {
2081
- return new GlobalContainerRule(name, styles2, options);
2082
- }
2083
- if (name[0] === "@" && name.substr(0, atPrefix.length) === atPrefix) {
2084
- return new GlobalPrefixedRule(name, styles2, options);
2085
- }
2086
- var parent = options.parent;
2087
- if (parent) {
2088
- if (parent.type === "global" || parent.options.parent && parent.options.parent.type === "global") {
2089
- options.scoped = false;
2090
- }
2091
- }
2092
- if (!options.selector && options.scoped === false) {
2093
- options.selector = name;
2094
- }
2095
- return null;
2096
- }
2097
- function onProcessRule(rule, sheet) {
2098
- if (rule.type !== "style" || !sheet) return;
2099
- handleNestedGlobalContainerRule(rule, sheet);
2100
- handlePrefixedGlobalRule(rule, sheet);
2101
- }
2102
- return {
2103
- onCreateRule: onCreateRule8,
2104
- onProcessRule
2105
- };
2106
- }
2107
- var separatorRegExp = /\s*,\s*/g;
2108
- var parentRegExp = /&/g;
2109
- var refRegExp = /\$([\w-]+)/g;
2110
- function jssNested() {
2111
- function getReplaceRef(container, sheet) {
2112
- return function(match, key) {
2113
- var rule = container.getRule(key) || sheet && sheet.getRule(key);
2114
- if (rule) {
2115
- return rule.selector;
2116
- }
2117
- process$1.env.NODE_ENV !== "production" ? warning(false, '[JSS] Could not find the referenced rule "' + key + '" in "' + (container.options.meta || container.toString()) + '".') : void 0;
2118
- return key;
2119
- };
2120
- }
2121
- function replaceParentRefs(nestedProp, parentProp) {
2122
- var parentSelectors = parentProp.split(separatorRegExp);
2123
- var nestedSelectors = nestedProp.split(separatorRegExp);
2124
- var result = "";
2125
- for (var i = 0; i < parentSelectors.length; i++) {
2126
- var parent = parentSelectors[i];
2127
- for (var j = 0; j < nestedSelectors.length; j++) {
2128
- var nested2 = nestedSelectors[j];
2129
- if (result) result += ", ";
2130
- result += nested2.indexOf("&") !== -1 ? nested2.replace(parentRegExp, parent) : parent + " " + nested2;
2131
- }
2132
- }
2133
- return result;
2134
- }
2135
- function getOptions(rule, container, prevOptions) {
2136
- if (prevOptions) return _extends({}, prevOptions, {
2137
- index: prevOptions.index + 1
2138
- });
2139
- var nestingLevel = rule.options.nestingLevel;
2140
- nestingLevel = nestingLevel === void 0 ? 1 : nestingLevel + 1;
2141
- var options = _extends({}, rule.options, {
2142
- nestingLevel,
2143
- index: container.indexOf(rule) + 1
2144
- // We don't need the parent name to be set options for chlid.
2145
- });
2146
- delete options.name;
2147
- return options;
2148
- }
2149
- function onProcessStyle2(style, rule, sheet) {
2150
- if (rule.type !== "style") return style;
2151
- var styleRule = rule;
2152
- var container = styleRule.options.parent;
2153
- var options;
2154
- var replaceRef3;
2155
- for (var prop in style) {
2156
- var isNested = prop.indexOf("&") !== -1;
2157
- var isNestedConditional = prop[0] === "@";
2158
- if (!isNested && !isNestedConditional) continue;
2159
- options = getOptions(styleRule, container, options);
2160
- if (isNested) {
2161
- var selector = replaceParentRefs(prop, styleRule.selector);
2162
- if (!replaceRef3) replaceRef3 = getReplaceRef(container, sheet);
2163
- selector = selector.replace(refRegExp, replaceRef3);
2164
- var name = styleRule.key + "-" + prop;
2165
- if ("replaceRule" in container) {
2166
- container.replaceRule(name, style[prop], _extends({}, options, {
2167
- selector
2168
- }));
2169
- } else {
2170
- container.addRule(name, style[prop], _extends({}, options, {
2171
- selector
2172
- }));
2173
- }
2174
- } else if (isNestedConditional) {
2175
- container.addRule(prop, {}, options).addRule(styleRule.key, style[prop], {
2176
- selector: styleRule.selector
2177
- });
2178
- }
2179
- delete style[prop];
2180
- }
2181
- return style;
2182
- }
2183
- return {
2184
- onProcessStyle: onProcessStyle2
2185
- };
2186
- }
2187
- var uppercasePattern = /[A-Z]/g;
2188
- var msPattern = /^ms-/;
2189
- var cache$2 = {};
2190
- function toHyphenLower(match) {
2191
- return "-" + match.toLowerCase();
2192
- }
2193
- function hyphenateStyleName(name) {
2194
- if (cache$2.hasOwnProperty(name)) {
2195
- return cache$2[name];
2196
- }
2197
- var hName = name.replace(uppercasePattern, toHyphenLower);
2198
- return cache$2[name] = msPattern.test(hName) ? "-" + hName : hName;
2199
- }
2200
- function convertCase(style) {
2201
- var converted = {};
2202
- for (var prop in style) {
2203
- var key = prop.indexOf("--") === 0 ? prop : hyphenateStyleName(prop);
2204
- converted[key] = style[prop];
2205
- }
2206
- if (style.fallbacks) {
2207
- if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);
2208
- else converted.fallbacks = convertCase(style.fallbacks);
2209
- }
2210
- return converted;
2211
- }
2212
- function camelCase() {
2213
- function onProcessStyle2(style) {
2214
- if (Array.isArray(style)) {
2215
- for (var index2 = 0; index2 < style.length; index2++) {
2216
- style[index2] = convertCase(style[index2]);
2217
- }
2218
- return style;
2219
- }
2220
- return convertCase(style);
2221
- }
2222
- function onChangeValue2(value, prop, rule) {
2223
- if (prop.indexOf("--") === 0) {
2224
- return value;
2225
- }
2226
- var hyphenatedProp = hyphenateStyleName(prop);
2227
- if (prop === hyphenatedProp) return value;
2228
- rule.prop(hyphenatedProp, value);
2229
- return null;
2230
- }
2231
- return {
2232
- onProcessStyle: onProcessStyle2,
2233
- onChangeValue: onChangeValue2
2234
- };
2235
- }
2236
- var px = hasCSSTOMSupport && CSS ? CSS.px : "px";
2237
- var ms = hasCSSTOMSupport && CSS ? CSS.ms : "ms";
2238
- var percent = hasCSSTOMSupport && CSS ? CSS.percent : "%";
2239
- var defaultUnits = {
2240
- // Animation properties
2241
- "animation-delay": ms,
2242
- "animation-duration": ms,
2243
- // Background properties
2244
- "background-position": px,
2245
- "background-position-x": px,
2246
- "background-position-y": px,
2247
- "background-size": px,
2248
- // Border Properties
2249
- border: px,
2250
- "border-bottom": px,
2251
- "border-bottom-left-radius": px,
2252
- "border-bottom-right-radius": px,
2253
- "border-bottom-width": px,
2254
- "border-left": px,
2255
- "border-left-width": px,
2256
- "border-radius": px,
2257
- "border-right": px,
2258
- "border-right-width": px,
2259
- "border-top": px,
2260
- "border-top-left-radius": px,
2261
- "border-top-right-radius": px,
2262
- "border-top-width": px,
2263
- "border-width": px,
2264
- "border-block": px,
2265
- "border-block-end": px,
2266
- "border-block-end-width": px,
2267
- "border-block-start": px,
2268
- "border-block-start-width": px,
2269
- "border-block-width": px,
2270
- "border-inline": px,
2271
- "border-inline-end": px,
2272
- "border-inline-end-width": px,
2273
- "border-inline-start": px,
2274
- "border-inline-start-width": px,
2275
- "border-inline-width": px,
2276
- "border-start-start-radius": px,
2277
- "border-start-end-radius": px,
2278
- "border-end-start-radius": px,
2279
- "border-end-end-radius": px,
2280
- // Margin properties
2281
- margin: px,
2282
- "margin-bottom": px,
2283
- "margin-left": px,
2284
- "margin-right": px,
2285
- "margin-top": px,
2286
- "margin-block": px,
2287
- "margin-block-end": px,
2288
- "margin-block-start": px,
2289
- "margin-inline": px,
2290
- "margin-inline-end": px,
2291
- "margin-inline-start": px,
2292
- // Padding properties
2293
- padding: px,
2294
- "padding-bottom": px,
2295
- "padding-left": px,
2296
- "padding-right": px,
2297
- "padding-top": px,
2298
- "padding-block": px,
2299
- "padding-block-end": px,
2300
- "padding-block-start": px,
2301
- "padding-inline": px,
2302
- "padding-inline-end": px,
2303
- "padding-inline-start": px,
2304
- // Mask properties
2305
- "mask-position-x": px,
2306
- "mask-position-y": px,
2307
- "mask-size": px,
2308
- // Width and height properties
2309
- height: px,
2310
- width: px,
2311
- "min-height": px,
2312
- "max-height": px,
2313
- "min-width": px,
2314
- "max-width": px,
2315
- // Position properties
2316
- bottom: px,
2317
- left: px,
2318
- top: px,
2319
- right: px,
2320
- inset: px,
2321
- "inset-block": px,
2322
- "inset-block-end": px,
2323
- "inset-block-start": px,
2324
- "inset-inline": px,
2325
- "inset-inline-end": px,
2326
- "inset-inline-start": px,
2327
- // Shadow properties
2328
- "box-shadow": px,
2329
- "text-shadow": px,
2330
- // Column properties
2331
- "column-gap": px,
2332
- "column-rule": px,
2333
- "column-rule-width": px,
2334
- "column-width": px,
2335
- // Font and text properties
2336
- "font-size": px,
2337
- "font-size-delta": px,
2338
- "letter-spacing": px,
2339
- "text-decoration-thickness": px,
2340
- "text-indent": px,
2341
- "text-stroke": px,
2342
- "text-stroke-width": px,
2343
- "word-spacing": px,
2344
- // Motion properties
2345
- motion: px,
2346
- "motion-offset": px,
2347
- // Outline properties
2348
- outline: px,
2349
- "outline-offset": px,
2350
- "outline-width": px,
2351
- // Perspective properties
2352
- perspective: px,
2353
- "perspective-origin-x": percent,
2354
- "perspective-origin-y": percent,
2355
- // Transform properties
2356
- "transform-origin": percent,
2357
- "transform-origin-x": percent,
2358
- "transform-origin-y": percent,
2359
- "transform-origin-z": percent,
2360
- // Transition properties
2361
- "transition-delay": ms,
2362
- "transition-duration": ms,
2363
- // Alignment properties
2364
- "vertical-align": px,
2365
- "flex-basis": px,
2366
- // Some random properties
2367
- "shape-margin": px,
2368
- size: px,
2369
- gap: px,
2370
- // Grid properties
2371
- grid: px,
2372
- "grid-gap": px,
2373
- "row-gap": px,
2374
- "grid-row-gap": px,
2375
- "grid-column-gap": px,
2376
- "grid-template-rows": px,
2377
- "grid-template-columns": px,
2378
- "grid-auto-rows": px,
2379
- "grid-auto-columns": px,
2380
- // Not existing properties.
2381
- // Used to avoid issues with jss-plugin-expand integration.
2382
- "box-shadow-x": px,
2383
- "box-shadow-y": px,
2384
- "box-shadow-blur": px,
2385
- "box-shadow-spread": px,
2386
- "font-line-height": px,
2387
- "text-shadow-x": px,
2388
- "text-shadow-y": px,
2389
- "text-shadow-blur": px
2390
- };
2391
- function addCamelCasedVersion(obj) {
2392
- var regExp2 = /(-[a-z])/g;
2393
- var replace = function replace2(str) {
2394
- return str[1].toUpperCase();
2395
- };
2396
- var newObj = {};
2397
- for (var key in obj) {
2398
- newObj[key] = obj[key];
2399
- newObj[key.replace(regExp2, replace)] = obj[key];
2400
- }
2401
- return newObj;
2402
- }
2403
- var units = addCamelCasedVersion(defaultUnits);
2404
- function iterate(prop, value, options) {
2405
- if (value == null) return value;
2406
- if (Array.isArray(value)) {
2407
- for (var i = 0; i < value.length; i++) {
2408
- value[i] = iterate(prop, value[i], options);
2409
- }
2410
- } else if (typeof value === "object") {
2411
- if (prop === "fallbacks") {
2412
- for (var innerProp in value) {
2413
- value[innerProp] = iterate(innerProp, value[innerProp], options);
2414
- }
2415
- } else {
2416
- for (var _innerProp in value) {
2417
- value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
2418
- }
2419
- }
2420
- } else if (typeof value === "number" && isNaN(value) === false) {
2421
- var unit = options[prop] || units[prop];
2422
- if (unit && !(value === 0 && unit === px)) {
2423
- return typeof unit === "function" ? unit(value).toString() : "" + value + unit;
2424
- }
2425
- return value.toString();
2426
- }
2427
- return value;
2428
- }
2429
- function defaultUnit(options) {
2430
- if (options === void 0) {
2431
- options = {};
2432
- }
2433
- var camelCasedOptions = addCamelCasedVersion(options);
2434
- function onProcessStyle2(style, rule) {
2435
- if (rule.type !== "style") return style;
2436
- for (var prop in style) {
2437
- style[prop] = iterate(prop, style[prop], camelCasedOptions);
2438
- }
2439
- return style;
2440
- }
2441
- function onChangeValue2(value, prop) {
2442
- return iterate(prop, value, camelCasedOptions);
2443
- }
2444
- return {
2445
- onProcessStyle: onProcessStyle2,
2446
- onChangeValue: onChangeValue2
2447
- };
2448
- }
2449
- function _arrayLikeToArray(r, a) {
2450
- (null == a || a > r.length) && (a = r.length);
2451
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2452
- return n;
2453
- }
2454
- function _arrayWithoutHoles(r) {
2455
- if (Array.isArray(r)) return _arrayLikeToArray(r);
2456
- }
2457
- function _iterableToArray(r) {
2458
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2459
- }
2460
- function _unsupportedIterableToArray(r, a) {
2461
- if (r) {
2462
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
2463
- var t = {}.toString.call(r).slice(8, -1);
2464
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
2465
- }
2466
- }
2467
- function _nonIterableSpread() {
2468
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2469
- }
2470
- function _toConsumableArray(r) {
2471
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
2472
- }
2473
- var js = "";
2474
- var css = "";
2475
- var vendor = "";
2476
- var browser = "";
2477
- var isTouch = isBrowser && "ontouchstart" in document.documentElement;
2478
- if (isBrowser) {
2479
- var jsCssMap = {
2480
- Moz: "-moz-",
2481
- ms: "-ms-",
2482
- O: "-o-",
2483
- Webkit: "-webkit-"
2484
- };
2485
- var _document$createEleme = document.createElement("p"), style = _document$createEleme.style;
2486
- var testProp = "Transform";
2487
- for (var key in jsCssMap) {
2488
- if (key + testProp in style) {
2489
- js = key;
2490
- css = jsCssMap[key];
2491
- break;
2492
- }
2493
- }
2494
- if (js === "Webkit" && "msHyphens" in style) {
2495
- js = "ms";
2496
- css = jsCssMap.ms;
2497
- browser = "edge";
2498
- }
2499
- if (js === "Webkit" && "-apple-trailing-word" in style) {
2500
- vendor = "apple";
2501
- }
2502
- }
2503
- var prefix = {
2504
- js,
2505
- css,
2506
- vendor,
2507
- browser,
2508
- isTouch
2509
- };
2510
- function supportedKeyframes(key) {
2511
- if (key[1] === "-") return key;
2512
- if (prefix.js === "ms") return key;
2513
- return "@" + prefix.css + "keyframes" + key.substr(10);
2514
- }
2515
- var appearence = {
2516
- noPrefill: ["appearance"],
2517
- supportedProperty: function supportedProperty(prop) {
2518
- if (prop !== "appearance") return false;
2519
- if (prefix.js === "ms") return "-webkit-" + prop;
2520
- return prefix.css + prop;
2521
- }
2522
- };
2523
- var colorAdjust = {
2524
- noPrefill: ["color-adjust"],
2525
- supportedProperty: function supportedProperty2(prop) {
2526
- if (prop !== "color-adjust") return false;
2527
- if (prefix.js === "Webkit") return prefix.css + "print-" + prop;
2528
- return prop;
2529
- }
2530
- };
2531
- var regExp = /[-\s]+(.)?/g;
2532
- function toUpper(match, c) {
2533
- return c ? c.toUpperCase() : "";
2534
- }
2535
- function camelize(str) {
2536
- return str.replace(regExp, toUpper);
2537
- }
2538
- function pascalize(str) {
2539
- return camelize("-" + str);
2540
- }
2541
- var mask = {
2542
- noPrefill: ["mask"],
2543
- supportedProperty: function supportedProperty3(prop, style) {
2544
- if (!/^mask/.test(prop)) return false;
2545
- if (prefix.js === "Webkit") {
2546
- var longhand = "mask-image";
2547
- if (camelize(longhand) in style) {
2548
- return prop;
2549
- }
2550
- if (prefix.js + pascalize(longhand) in style) {
2551
- return prefix.css + prop;
2552
- }
2553
- }
2554
- return prop;
2555
- }
2556
- };
2557
- var textOrientation = {
2558
- noPrefill: ["text-orientation"],
2559
- supportedProperty: function supportedProperty4(prop) {
2560
- if (prop !== "text-orientation") return false;
2561
- if (prefix.vendor === "apple" && !prefix.isTouch) {
2562
- return prefix.css + prop;
2563
- }
2564
- return prop;
2565
- }
2566
- };
2567
- var transform = {
2568
- noPrefill: ["transform"],
2569
- supportedProperty: function supportedProperty5(prop, style, options) {
2570
- if (prop !== "transform") return false;
2571
- if (options.transform) {
2572
- return prop;
2573
- }
2574
- return prefix.css + prop;
2575
- }
2576
- };
2577
- var transition = {
2578
- noPrefill: ["transition"],
2579
- supportedProperty: function supportedProperty6(prop, style, options) {
2580
- if (prop !== "transition") return false;
2581
- if (options.transition) {
2582
- return prop;
2583
- }
2584
- return prefix.css + prop;
2585
- }
2586
- };
2587
- var writingMode = {
2588
- noPrefill: ["writing-mode"],
2589
- supportedProperty: function supportedProperty7(prop) {
2590
- if (prop !== "writing-mode") return false;
2591
- if (prefix.js === "Webkit" || prefix.js === "ms" && prefix.browser !== "edge") {
2592
- return prefix.css + prop;
2593
- }
2594
- return prop;
2595
- }
2596
- };
2597
- var userSelect = {
2598
- noPrefill: ["user-select"],
2599
- supportedProperty: function supportedProperty8(prop) {
2600
- if (prop !== "user-select") return false;
2601
- if (prefix.js === "Moz" || prefix.js === "ms" || prefix.vendor === "apple") {
2602
- return prefix.css + prop;
2603
- }
2604
- return prop;
2605
- }
2606
- };
2607
- var breakPropsOld = {
2608
- supportedProperty: function supportedProperty9(prop, style) {
2609
- if (!/^break-/.test(prop)) return false;
2610
- if (prefix.js === "Webkit") {
2611
- var jsProp = "WebkitColumn" + pascalize(prop);
2612
- return jsProp in style ? prefix.css + "column-" + prop : false;
2613
- }
2614
- if (prefix.js === "Moz") {
2615
- var _jsProp = "page" + pascalize(prop);
2616
- return _jsProp in style ? "page-" + prop : false;
2617
- }
2618
- return false;
2619
- }
2620
- };
2621
- var inlineLogicalOld = {
2622
- supportedProperty: function supportedProperty10(prop, style) {
2623
- if (!/^(border|margin|padding)-inline/.test(prop)) return false;
2624
- if (prefix.js === "Moz") return prop;
2625
- var newProp = prop.replace("-inline", "");
2626
- return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
2627
- }
2628
- };
2629
- var unprefixed = {
2630
- supportedProperty: function supportedProperty11(prop, style) {
2631
- return camelize(prop) in style ? prop : false;
2632
- }
2633
- };
2634
- var prefixed = {
2635
- supportedProperty: function supportedProperty12(prop, style) {
2636
- var pascalized = pascalize(prop);
2637
- if (prop[0] === "-") return prop;
2638
- if (prop[0] === "-" && prop[1] === "-") return prop;
2639
- if (prefix.js + pascalized in style) return prefix.css + prop;
2640
- if (prefix.js !== "Webkit" && "Webkit" + pascalized in style) return "-webkit-" + prop;
2641
- return false;
2642
- }
2643
- };
2644
- var scrollSnap = {
2645
- supportedProperty: function supportedProperty13(prop) {
2646
- if (prop.substring(0, 11) !== "scroll-snap") return false;
2647
- if (prefix.js === "ms") {
2648
- return "" + prefix.css + prop;
2649
- }
2650
- return prop;
2651
- }
2652
- };
2653
- var overscrollBehavior = {
2654
- supportedProperty: function supportedProperty14(prop) {
2655
- if (prop !== "overscroll-behavior") return false;
2656
- if (prefix.js === "ms") {
2657
- return prefix.css + "scroll-chaining";
2658
- }
2659
- return prop;
2660
- }
2661
- };
2662
- var propMap = {
2663
- "flex-grow": "flex-positive",
2664
- "flex-shrink": "flex-negative",
2665
- "flex-basis": "flex-preferred-size",
2666
- "justify-content": "flex-pack",
2667
- order: "flex-order",
2668
- "align-items": "flex-align",
2669
- "align-content": "flex-line-pack"
2670
- // 'align-self' is handled by 'align-self' plugin.
2671
- };
2672
- var flex2012 = {
2673
- supportedProperty: function supportedProperty15(prop, style) {
2674
- var newProp = propMap[prop];
2675
- if (!newProp) return false;
2676
- return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
2677
- }
2678
- };
2679
- var propMap$1 = {
2680
- flex: "box-flex",
2681
- "flex-grow": "box-flex",
2682
- "flex-direction": ["box-orient", "box-direction"],
2683
- order: "box-ordinal-group",
2684
- "align-items": "box-align",
2685
- "flex-flow": ["box-orient", "box-direction"],
2686
- "justify-content": "box-pack"
2687
- };
2688
- var propKeys = Object.keys(propMap$1);
2689
- var prefixCss = function prefixCss2(p) {
2690
- return prefix.css + p;
2691
- };
2692
- var flex2009 = {
2693
- supportedProperty: function supportedProperty16(prop, style, _ref) {
2694
- var multiple = _ref.multiple;
2695
- if (propKeys.indexOf(prop) > -1) {
2696
- var newProp = propMap$1[prop];
2697
- if (!Array.isArray(newProp)) {
2698
- return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
2699
- }
2700
- if (!multiple) return false;
2701
- for (var i = 0; i < newProp.length; i++) {
2702
- if (!(prefix.js + pascalize(newProp[0]) in style)) {
2703
- return false;
2704
- }
2705
- }
2706
- return newProp.map(prefixCss);
2707
- }
2708
- return false;
2709
- }
2710
- };
2711
- var plugins = [appearence, colorAdjust, mask, textOrientation, transform, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];
2712
- var propertyDetectors = plugins.filter(function(p) {
2713
- return p.supportedProperty;
2714
- }).map(function(p) {
2715
- return p.supportedProperty;
2716
- });
2717
- var noPrefill = plugins.filter(function(p) {
2718
- return p.noPrefill;
2719
- }).reduce(function(a, p) {
2720
- a.push.apply(a, _toConsumableArray(p.noPrefill));
2721
- return a;
2722
- }, []);
2723
- var el;
2724
- var cache = {};
2725
- if (isBrowser) {
2726
- el = document.createElement("p");
2727
- var computed = window.getComputedStyle(document.documentElement, "");
2728
- for (var key$1 in computed) {
2729
- if (!isNaN(key$1)) cache[computed[key$1]] = computed[key$1];
2730
- }
2731
- noPrefill.forEach(function(x) {
2732
- return delete cache[x];
2733
- });
2734
- }
2735
- function supportedProperty17(prop, options) {
2736
- if (options === void 0) {
2737
- options = {};
2738
- }
2739
- if (!el) return prop;
2740
- if (process$1.env.NODE_ENV !== "benchmark" && cache[prop] != null) {
2741
- return cache[prop];
2742
- }
2743
- if (prop === "transition" || prop === "transform") {
2744
- options[prop] = prop in el.style;
2745
- }
2746
- for (var i = 0; i < propertyDetectors.length; i++) {
2747
- cache[prop] = propertyDetectors[i](prop, el.style, options);
2748
- if (cache[prop]) break;
2749
- }
2750
- try {
2751
- el.style[prop] = "";
2752
- } catch (err) {
2753
- return false;
2754
- }
2755
- return cache[prop];
2756
- }
2757
- var cache$1 = {};
2758
- var transitionProperties = {
2759
- transition: 1,
2760
- "transition-property": 1,
2761
- "-webkit-transition": 1,
2762
- "-webkit-transition-property": 1
2763
- };
2764
- var transPropsRegExp = /(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;
2765
- var el$1;
2766
- function prefixTransitionCallback(match, p1, p2) {
2767
- if (p1 === "var") return "var";
2768
- if (p1 === "all") return "all";
2769
- if (p2 === "all") return ", all";
2770
- var prefixedValue = p1 ? supportedProperty17(p1) : ", " + supportedProperty17(p2);
2771
- if (!prefixedValue) return p1 || p2;
2772
- return prefixedValue;
2773
- }
2774
- if (isBrowser) el$1 = document.createElement("p");
2775
- function supportedValue(property, value) {
2776
- var prefixedValue = value;
2777
- if (!el$1 || property === "content") return value;
2778
- if (typeof prefixedValue !== "string" || !isNaN(parseInt(prefixedValue, 10))) {
2779
- return prefixedValue;
2780
- }
2781
- var cacheKey = property + prefixedValue;
2782
- if (process$1.env.NODE_ENV !== "benchmark" && cache$1[cacheKey] != null) {
2783
- return cache$1[cacheKey];
2784
- }
2785
- try {
2786
- el$1.style[property] = prefixedValue;
2787
- } catch (err) {
2788
- cache$1[cacheKey] = false;
2789
- return false;
2790
- }
2791
- if (transitionProperties[property]) {
2792
- prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);
2793
- } else if (el$1.style[property] === "") {
2794
- prefixedValue = prefix.css + prefixedValue;
2795
- if (prefixedValue === "-ms-flex") el$1.style[property] = "-ms-flexbox";
2796
- el$1.style[property] = prefixedValue;
2797
- if (el$1.style[property] === "") {
2798
- cache$1[cacheKey] = false;
2799
- return false;
2800
- }
2801
- }
2802
- el$1.style[property] = "";
2803
- cache$1[cacheKey] = prefixedValue;
2804
- return cache$1[cacheKey];
2805
- }
2806
- function jssVendorPrefixer() {
2807
- function onProcessRule(rule) {
2808
- if (rule.type === "keyframes") {
2809
- var atRule = rule;
2810
- atRule.at = supportedKeyframes(atRule.at);
2811
- }
2812
- }
2813
- function prefixStyle(style) {
2814
- for (var prop in style) {
2815
- var value = style[prop];
2816
- if (prop === "fallbacks" && Array.isArray(value)) {
2817
- style[prop] = value.map(prefixStyle);
2818
- continue;
2819
- }
2820
- var changeProp = false;
2821
- var supportedProp = supportedProperty17(prop);
2822
- if (supportedProp && supportedProp !== prop) changeProp = true;
2823
- var changeValue = false;
2824
- var supportedValue$1 = supportedValue(supportedProp, toCssValue(value));
2825
- if (supportedValue$1 && supportedValue$1 !== value) changeValue = true;
2826
- if (changeProp || changeValue) {
2827
- if (changeProp) delete style[prop];
2828
- style[supportedProp || prop] = supportedValue$1 || value;
2829
- }
2830
- }
2831
- return style;
2832
- }
2833
- function onProcessStyle2(style, rule) {
2834
- if (rule.type !== "style") return style;
2835
- return prefixStyle(style);
2836
- }
2837
- function onChangeValue2(value, prop) {
2838
- return supportedValue(prop, toCssValue(value)) || value;
2839
- }
2840
- return {
2841
- onProcessRule,
2842
- onProcessStyle: onProcessStyle2,
2843
- onChangeValue: onChangeValue2
2844
- };
2845
- }
2846
- function jssPropsSort() {
2847
- var sort = function sort2(prop0, prop1) {
2848
- if (prop0.length === prop1.length) {
2849
- return prop0 > prop1 ? 1 : -1;
2850
- }
2851
- return prop0.length - prop1.length;
2852
- };
2853
- return {
2854
- onProcessStyle: function onProcessStyle2(style, rule) {
2855
- if (rule.type !== "style") return style;
2856
- var newStyle = {};
2857
- var props = Object.keys(style).sort(sort);
2858
- for (var i = 0; i < props.length; i++) {
2859
- newStyle[props[i]] = style[props[i]];
2860
- }
2861
- return newStyle;
2862
- }
2863
- };
2864
- }
2865
- function jssPreset() {
2866
- return {
2867
- plugins: [
2868
- functionPlugin(),
2869
- jssGlobal(),
2870
- jssNested(),
2871
- camelCase(),
2872
- defaultUnit(),
2873
- // Disable the vendor prefixer server-side, it does nothing.
2874
- // This way, we can get a performance boost.
2875
- // In the documentation, we are using `autoprefixer` to solve this problem.
2876
- typeof window === "undefined" ? null : jssVendorPrefixer(),
2877
- jssPropsSort()
2878
- ]
2879
- };
2880
- }
2881
- function mergeClasses(options = {}) {
2882
- const {
2883
- baseClasses,
2884
- newClasses,
2885
- Component
2886
- } = options;
2887
- if (!newClasses) {
2888
- return baseClasses;
2889
- }
2890
- const nextClasses = _extends({}, baseClasses);
2891
- if (process$1.env.NODE_ENV !== "production") {
2892
- if (typeof newClasses === "string") {
2893
- return baseClasses;
2894
- }
2895
- }
2896
- Object.keys(newClasses).forEach((key) => {
2897
- if (process$1.env.NODE_ENV !== "production") {
2898
- if (!baseClasses[key] && newClasses[key]) {
2899
- }
2900
- if (newClasses[key] && typeof newClasses[key] !== "string") {
2901
- }
2902
- }
2903
- if (newClasses[key]) {
2904
- nextClasses[key] = `${baseClasses[key]} ${newClasses[key]}`;
2905
- }
2906
- });
2907
- return nextClasses;
2908
- }
2909
- const multiKeyStore = {
2910
- set: (cache2, key1, key2, value) => {
2911
- let subCache = cache2.get(key1);
2912
- if (!subCache) {
2913
- subCache = /* @__PURE__ */ new Map();
2914
- cache2.set(key1, subCache);
2915
- }
2916
- subCache.set(key2, value);
2917
- },
2918
- get: (cache2, key1, key2) => {
2919
- const subCache = cache2.get(key1);
2920
- return subCache ? subCache.get(key2) : void 0;
2921
- },
2922
- delete: (cache2, key1, key2) => {
2923
- const subCache = cache2.get(key1);
2924
- subCache.delete(key2);
2925
- }
2926
- };
2927
- function useTheme() {
2928
- var _privateTheme$$$mater;
2929
- const privateTheme = useTheme$1();
2930
- return (_privateTheme$$$mater = privateTheme == null ? void 0 : privateTheme.$$material) != null ? _privateTheme$$$mater : privateTheme;
2931
- }
2932
- const _excluded$2 = ["children", "injectFirst", "disableGeneration"];
2933
- const defaultJSS = createJss(jssPreset());
2934
- const defaultGenerateClassName = createGenerateClassName();
2935
- const defaultSheetsManager = /* @__PURE__ */ new Map();
2936
- const defaultOptions = {
2937
- disableGeneration: false,
2938
- generateClassName: defaultGenerateClassName,
2939
- jss: defaultJSS,
2940
- sheetsCache: null,
2941
- sheetsManager: defaultSheetsManager,
2942
- sheetsRegistry: null
2943
- };
2944
- const StylesContext = /* @__PURE__ */ React.createContext(defaultOptions);
2945
- if (process$1.env.NODE_ENV !== "production") {
2946
- StylesContext.displayName = "StylesContext";
2947
- }
2948
- let injectFirstNode;
2949
- function StylesProvider(props) {
2950
- const {
2951
- children,
2952
- injectFirst = false,
2953
- disableGeneration = false
2954
- } = props, localOptions = _objectWithoutPropertiesLoose(props, _excluded$2);
2955
- const outerOptions = React.useContext(StylesContext);
2956
- const {
2957
- generateClassName,
2958
- jss,
2959
- serverGenerateClassName,
2960
- sheetsCache,
2961
- sheetsManager,
2962
- sheetsRegistry
2963
- } = _extends({}, outerOptions, localOptions);
2964
- if (process$1.env.NODE_ENV !== "production") {
2965
- if (injectFirst && localOptions.jss) {
2966
- }
2967
- }
2968
- const value = React.useMemo(() => {
2969
- const context = {
2970
- disableGeneration,
2971
- generateClassName,
2972
- jss,
2973
- serverGenerateClassName,
2974
- sheetsCache,
2975
- sheetsManager,
2976
- sheetsRegistry
2977
- };
2978
- if (process$1.env.NODE_ENV !== "production") {
2979
- if (typeof window === "undefined" && !context.sheetsManager) {
2980
- }
2981
- }
2982
- if (process$1.env.NODE_ENV !== "production") {
2983
- if (context.jss.options.insertionPoint && injectFirst) {
2984
- }
2985
- }
2986
- if (!context.jss.options.insertionPoint && injectFirst && typeof window !== "undefined") {
2987
- if (!injectFirstNode) {
2988
- const head = document.head;
2989
- injectFirstNode = document.createComment("mui-inject-first");
2990
- head.insertBefore(injectFirstNode, head.firstChild);
2991
- }
2992
- context.jss = createJss({
2993
- plugins: jssPreset().plugins,
2994
- insertionPoint: injectFirstNode
2995
- });
2996
- }
2997
- return context;
2998
- }, [injectFirst, disableGeneration, generateClassName, jss, serverGenerateClassName, sheetsCache, sheetsManager, sheetsRegistry]);
2999
- return /* @__PURE__ */ jsx(StylesContext.Provider, {
3000
- value,
3001
- children
3002
- });
3003
- }
3004
- process$1.env.NODE_ENV !== "production" ? StylesProvider.propTypes = {
3005
- /**
3006
- * Your component tree.
3007
- */
3008
- children: PropTypes.node,
3009
- /**
3010
- * You can disable the generation of the styles with this option.
3011
- * It can be useful when traversing the React tree outside of the HTML
3012
- * rendering step on the server.
3013
- * Let's say you are using react-apollo to extract all
3014
- * the queries made by the interface server-side - you can significantly speed up the traversal with this prop.
3015
- */
3016
- disableGeneration: PropTypes.bool,
3017
- /**
3018
- * JSS's class name generator.
3019
- */
3020
- generateClassName: PropTypes.func,
3021
- /**
3022
- * By default, the styles are injected last in the <head> element of the page.
3023
- * As a result, they gain more specificity than any other style sheet.
3024
- * If you want to override MUI's styles, set this prop.
3025
- */
3026
- injectFirst: PropTypes.bool,
3027
- /**
3028
- * JSS's instance.
3029
- */
3030
- jss: PropTypes.object,
3031
- /**
3032
- * @ignore
3033
- */
3034
- serverGenerateClassName: PropTypes.func,
3035
- /**
3036
- * @ignore
3037
- *
3038
- * Beta feature.
3039
- *
3040
- * Cache for the sheets.
3041
- */
3042
- sheetsCache: PropTypes.object,
3043
- /**
3044
- * @ignore
3045
- *
3046
- * The sheetsManager is used to deduplicate style sheet injection in the page.
3047
- * It's deduplicating using the (theme, styles) couple.
3048
- * On the server, you should provide a new instance for each request.
3049
- */
3050
- sheetsManager: PropTypes.object,
3051
- /**
3052
- * @ignore
3053
- *
3054
- * Collect the sheets.
3055
- */
3056
- sheetsRegistry: PropTypes.object
3057
- } : void 0;
3058
- if (process$1.env.NODE_ENV !== "production") {
3059
- process$1.env.NODE_ENV !== "production" ? StylesProvider.propTypes = exactProp(StylesProvider.propTypes) : void 0;
3060
- }
3061
- let indexCounter = -1e9;
3062
- function increment() {
3063
- indexCounter += 1;
3064
- if (process$1.env.NODE_ENV !== "production") {
3065
- if (indexCounter >= 0) {
3066
- }
3067
- }
3068
- return indexCounter;
3069
- }
3070
- const _excluded$1 = ["variant"];
3071
- function isEmpty(string) {
3072
- return string.length === 0;
3073
- }
3074
- function propsToClassKey(props) {
3075
- const {
3076
- variant
3077
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$1);
3078
- let classKey = variant || "";
3079
- Object.keys(other).sort().forEach((key) => {
3080
- if (key === "color") {
3081
- classKey += isEmpty(classKey) ? props[key] : capitalize(props[key]);
3082
- } else {
3083
- classKey += `${isEmpty(classKey) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
3084
- }
3085
- });
3086
- return classKey;
3087
- }
3088
- const noopTheme = {};
3089
- function getStylesCreator(stylesOrCreator) {
3090
- const themingEnabled = typeof stylesOrCreator === "function";
3091
- if (process$1.env.NODE_ENV !== "production") {
3092
- if (typeof stylesOrCreator !== "object" && !themingEnabled) {
3093
- }
3094
- }
3095
- return {
3096
- create: (theme, name) => {
3097
- let styles2;
3098
- try {
3099
- styles2 = themingEnabled ? stylesOrCreator(theme) : stylesOrCreator;
3100
- } catch (err) {
3101
- if (process$1.env.NODE_ENV !== "production") {
3102
- if (themingEnabled === true && theme === noopTheme) {
3103
- }
3104
- }
3105
- throw err;
3106
- }
3107
- if (!name || !theme.components || !theme.components[name] || !theme.components[name].styleOverrides && !theme.components[name].variants) {
3108
- return styles2;
3109
- }
3110
- const overrides = theme.components[name].styleOverrides || {};
3111
- const variants = theme.components[name].variants || [];
3112
- const stylesWithOverrides = _extends({}, styles2);
3113
- Object.keys(overrides).forEach((key) => {
3114
- if (process$1.env.NODE_ENV !== "production") {
3115
- if (!stylesWithOverrides[key]) {
3116
- }
3117
- }
3118
- stylesWithOverrides[key] = deepmerge(stylesWithOverrides[key] || {}, overrides[key]);
3119
- });
3120
- variants.forEach((definition) => {
3121
- const classKey = propsToClassKey(definition.props);
3122
- stylesWithOverrides[classKey] = deepmerge(stylesWithOverrides[classKey] || {}, definition.style);
3123
- });
3124
- return stylesWithOverrides;
3125
- },
3126
- options: {}
3127
- };
3128
- }
3129
- const _excluded = ["name", "classNamePrefix", "Component", "defaultTheme"];
3130
- function getClasses({
3131
- state,
3132
- stylesOptions
3133
- }, classes, Component) {
3134
- if (stylesOptions.disableGeneration) {
3135
- return classes || {};
3136
- }
3137
- if (!state.cacheClasses) {
3138
- state.cacheClasses = {
3139
- // Cache for the finalized classes value.
3140
- value: null,
3141
- // Cache for the last used classes prop pointer.
3142
- lastProp: null,
3143
- // Cache for the last used rendered classes pointer.
3144
- lastJSS: {}
3145
- };
3146
- }
3147
- let generate = false;
3148
- if (state.classes !== state.cacheClasses.lastJSS) {
3149
- state.cacheClasses.lastJSS = state.classes;
3150
- generate = true;
3151
- }
3152
- if (classes !== state.cacheClasses.lastProp) {
3153
- state.cacheClasses.lastProp = classes;
3154
- generate = true;
3155
- }
3156
- if (generate) {
3157
- state.cacheClasses.value = mergeClasses({
3158
- baseClasses: state.cacheClasses.lastJSS,
3159
- newClasses: classes,
3160
- Component
3161
- });
3162
- }
3163
- return state.cacheClasses.value;
3164
- }
3165
- function attach({
3166
- state,
3167
- theme,
3168
- stylesOptions,
3169
- stylesCreator,
3170
- name
3171
- }, props) {
3172
- if (stylesOptions.disableGeneration) {
3173
- return;
3174
- }
3175
- let sheetManager = multiKeyStore.get(stylesOptions.sheetsManager, stylesCreator, theme);
3176
- if (!sheetManager) {
3177
- sheetManager = {
3178
- refs: 0,
3179
- staticSheet: null,
3180
- dynamicStyles: null
3181
- };
3182
- multiKeyStore.set(stylesOptions.sheetsManager, stylesCreator, theme, sheetManager);
3183
- }
3184
- const options = _extends({}, stylesCreator.options, stylesOptions, {
3185
- theme,
3186
- flip: typeof stylesOptions.flip === "boolean" ? stylesOptions.flip : theme.direction === "rtl"
3187
- });
3188
- options.generateId = options.serverGenerateClassName || options.generateClassName;
3189
- const sheetsRegistry = stylesOptions.sheetsRegistry;
3190
- if (sheetManager.refs === 0) {
3191
- let staticSheet;
3192
- if (stylesOptions.sheetsCache) {
3193
- staticSheet = multiKeyStore.get(stylesOptions.sheetsCache, stylesCreator, theme);
3194
- }
3195
- const styles2 = stylesCreator.create(theme, name);
3196
- if (!staticSheet) {
3197
- staticSheet = stylesOptions.jss.createStyleSheet(styles2, _extends({
3198
- link: false
3199
- }, options));
3200
- staticSheet.attach();
3201
- if (stylesOptions.sheetsCache) {
3202
- multiKeyStore.set(stylesOptions.sheetsCache, stylesCreator, theme, staticSheet);
3203
- }
3204
- }
3205
- if (sheetsRegistry) {
3206
- sheetsRegistry.add(staticSheet);
3207
- }
3208
- sheetManager.staticSheet = staticSheet;
3209
- sheetManager.dynamicStyles = getDynamicStyles(styles2);
3210
- }
3211
- if (sheetManager.dynamicStyles) {
3212
- const dynamicSheet = stylesOptions.jss.createStyleSheet(sheetManager.dynamicStyles, _extends({
3213
- link: true
3214
- }, options));
3215
- dynamicSheet.update(props);
3216
- dynamicSheet.attach();
3217
- state.dynamicSheet = dynamicSheet;
3218
- state.classes = mergeClasses({
3219
- baseClasses: sheetManager.staticSheet.classes,
3220
- newClasses: dynamicSheet.classes
3221
- });
3222
- if (sheetsRegistry) {
3223
- sheetsRegistry.add(dynamicSheet);
3224
- }
3225
- } else {
3226
- state.classes = sheetManager.staticSheet.classes;
3227
- }
3228
- sheetManager.refs += 1;
3229
- }
3230
- function update({
3231
- state
3232
- }, props) {
3233
- if (state.dynamicSheet) {
3234
- state.dynamicSheet.update(props);
3235
- }
3236
- }
3237
- function detach({
3238
- state,
3239
- theme,
3240
- stylesOptions,
3241
- stylesCreator
3242
- }) {
3243
- if (stylesOptions.disableGeneration) {
3244
- return;
3245
- }
3246
- const sheetManager = multiKeyStore.get(stylesOptions.sheetsManager, stylesCreator, theme);
3247
- sheetManager.refs -= 1;
3248
- const sheetsRegistry = stylesOptions.sheetsRegistry;
3249
- if (sheetManager.refs === 0) {
3250
- multiKeyStore.delete(stylesOptions.sheetsManager, stylesCreator, theme);
3251
- stylesOptions.jss.removeStyleSheet(sheetManager.staticSheet);
3252
- if (sheetsRegistry) {
3253
- sheetsRegistry.remove(sheetManager.staticSheet);
3254
- }
3255
- }
3256
- if (state.dynamicSheet) {
3257
- stylesOptions.jss.removeStyleSheet(state.dynamicSheet);
3258
- if (sheetsRegistry) {
3259
- sheetsRegistry.remove(state.dynamicSheet);
3260
- }
3261
- }
3262
- }
3263
- function useSynchronousEffect(func, values) {
3264
- const key = React.useRef([]);
3265
- let output;
3266
- const currentKey = React.useMemo(() => ({}), values);
3267
- if (key.current !== currentKey) {
3268
- key.current = currentKey;
3269
- output = func();
3270
- }
3271
- React.useEffect(
3272
- () => () => {
3273
- if (output) {
3274
- output();
3275
- }
3276
- },
3277
- [currentKey]
3278
- // eslint-disable-line react-hooks/exhaustive-deps
3279
- );
3280
- }
3281
- function makeStyles(stylesOrCreator, options = {}) {
3282
- const {
3283
- // alias for classNamePrefix, if provided will listen to theme (required for theme.components[name].styleOverrides)
3284
- name,
3285
- // Help with debuggability.
3286
- classNamePrefix: classNamePrefixOption,
3287
- Component,
3288
- defaultTheme = noopTheme
3289
- } = options, stylesOptions2 = _objectWithoutPropertiesLoose(options, _excluded);
3290
- const stylesCreator = getStylesCreator(stylesOrCreator);
3291
- const classNamePrefix = name || classNamePrefixOption || "makeStyles";
3292
- stylesCreator.options = {
3293
- index: increment(),
3294
- name,
3295
- meta: classNamePrefix,
3296
- classNamePrefix
3297
- };
3298
- const useStyles2 = (props = {}) => {
3299
- const theme = useTheme() || defaultTheme;
3300
- const stylesOptions = _extends({}, React.useContext(StylesContext), stylesOptions2);
3301
- const instance = React.useRef();
3302
- const shouldUpdate = React.useRef();
3303
- useSynchronousEffect(() => {
3304
- const current = {
3305
- name,
3306
- state: {},
3307
- stylesCreator,
3308
- stylesOptions,
3309
- theme
3310
- };
3311
- attach(current, props);
3312
- shouldUpdate.current = false;
3313
- instance.current = current;
3314
- return () => {
3315
- detach(current);
3316
- };
3317
- }, [theme, stylesCreator]);
3318
- React.useEffect(() => {
3319
- if (shouldUpdate.current) {
3320
- update(instance.current, props);
3321
- }
3322
- shouldUpdate.current = true;
3323
- });
3324
- const classes = getClasses(instance.current, props.classes, Component);
3325
- if (process$1.env.NODE_ENV !== "production") {
3326
- React.useDebugValue(classes);
3327
- }
3328
- if (process$1.env.NODE_ENV !== "production") {
3329
- const supportedComponents = ["MuiAvatar", "MuiBadge", "MuiButton", "MuiButtonGroup", "MuiChip", "MuiDivider", "MuiFab", "MuiPaper", "MuiToolbar", "MuiTypography", "MuiAlert", "MuiPagination", "MuiPaginationItem", "MuiSkeleton", "MuiTimelineDot"];
3330
- if (name && supportedComponents.indexOf(name) >= 0 && props.variant && !classes[props.variant]) {
3331
- }
3332
- }
3333
- return classes;
3334
- };
3335
- return useStyles2;
3336
- }
3337
- const useStyles = makeStyles(() => ({
3338
- circle: {
3339
- stroke: "url(#linearColors)"
3340
- },
3341
- MuiCircularProgress: { circle: { color: "green" } }
3342
- }));
3343
- function CircularProgressWithLabel(props) {
3344
- var _a, _b, _c, _d, _e;
3345
- useStyles();
3346
- const {
3347
- injectedicon,
3348
- metamaskicon,
3349
- walletconnecticon,
3350
- coinbaseicon,
3351
- phantom,
3352
- solflare,
3353
- slope,
3354
- magiceden,
3355
- backpacksol,
3356
- tronLink,
3357
- keplr,
3358
- brave
3359
- } = images;
3360
- const walletIcons = {
3361
- Injected: injectedicon,
3362
- metaMask: metamaskicon,
3363
- coinbaseWallet: coinbaseicon,
3364
- WalletConnect: walletconnecticon,
3365
- solflare,
3366
- phantom,
3367
- slope,
3368
- backpack: backpacksol,
3369
- keplr,
3370
- "magic eden (solana)": magiceden,
3371
- "brave browser (solana)": brave,
3372
- TronLink: tronLink
3373
- };
3374
- const configuration = useStore((state) => state.configuration);
3375
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3376
- /* @__PURE__ */ jsx("svg", { className: "bw-absolute", children: /* @__PURE__ */ jsxs("linearGradient", { id: "linearColors", x1: "0", y1: "0", x2: "1", y2: "1", children: [
3377
- /* @__PURE__ */ jsx(
3378
- "stop",
3379
- {
3380
- offset: "1%",
3381
- stopColor: ((_a = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _a.spinnerColor) ? (_b = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _b.spinnerColor : "#A45EFF"
3382
- }
3383
- ),
3384
- /* @__PURE__ */ jsx(
3385
- "stop",
3386
- {
3387
- offset: "90%",
3388
- stopColor: ((_c = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _c.spinnerColor) ? (_d = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _d.stopColor : "#2CFFE4"
3389
- }
3390
- )
3391
- ] }) }),
3392
- /* @__PURE__ */ jsxs(
3393
- Box,
3394
- {
3395
- sx: {
3396
- position: "relative",
3397
- display: "inline-flex"
3398
- },
3399
- children: [
3400
- /* @__PURE__ */ jsx(
3401
- CircularProgress,
3402
- {
3403
- variant: "determinate",
3404
- sx: {
3405
- color: (theme) => theme.palette.grey[theme.palette.mode === "light" ? 200 : 800]
3406
- },
3407
- size: 250,
3408
- thickness: 1,
3409
- value: 100
3410
- }
3411
- ),
3412
- /* @__PURE__ */ jsx(
3413
- CircularProgress,
3414
- {
3415
- variant: "determinate",
3416
- size: 250,
3417
- thickness: 1,
3418
- value: props.value,
3419
- sx: {
3420
- "svg circle": { stroke: "url(#linearColors)" },
3421
- position: "absolute",
3422
- left: 0,
3423
- [`& .${circularProgressClasses.circle}`]: {
3424
- strokeLinecap: "round"
3425
- }
3426
- }
3427
- }
3428
- ),
3429
- /* @__PURE__ */ jsx(
3430
- Box,
3431
- {
3432
- sx: {
3433
- top: 0,
3434
- left: 0,
3435
- bottom: 0,
3436
- right: 0,
3437
- position: "absolute",
3438
- display: "flex",
3439
- alignItems: "center",
3440
- justifyContent: "center"
3441
- },
3442
- children: /* @__PURE__ */ jsxs(
3443
- Typography,
3444
- {
3445
- variant: "caption",
3446
- className: "bw-flex bw-flex-col bw-justify-center bw-items-center bw-text-2xl bw-font-medium bw-text-text-primary",
3447
- component: "div",
3448
- color: "text.secondary",
3449
- children: [
3450
- /* @__PURE__ */ jsx(
3451
- "img",
3452
- {
3453
- src: walletIcons[props == null ? void 0 : props.selectedWallet] || ((_e = props.selectedConnector) == null ? void 0 : _e.icon) || "",
3454
- width: 90,
3455
- height: 83,
3456
- alt: "img"
3457
- }
3458
- ),
3459
- /* @__PURE__ */ jsx("p", { className: "bw-text-2xl bw-px-3 bw-mt-1 bw-text-center bw-font-medium bw-text-text-primary", children: props.selectedWallet })
3460
- ]
3461
- }
3462
- )
3463
- }
3464
- )
3465
- ]
3466
- }
3467
- )
3468
- ] });
3469
- }
3470
- CircularProgressWithLabel.propTypes = {
3471
- value: PropTypes.number.isRequired
3472
- };
3473
- function ConnectWalletProgress({
3474
- selectedWallet,
3475
- isSuccess,
3476
- data,
3477
- isSolConnecting,
3478
- isCosmosonnecting,
3479
- isTronConnecting,
3480
- selectedConnector
3481
- }) {
3482
- const { primaryWallet } = useDynamicContext();
3483
- const isFullyConnected = useIsLoggedIn();
3484
- const [progress, setProgress] = React.useState(25);
3485
- const { address, connected } = useWallet();
3486
- const { data: accounts } = useAccount();
3487
- React.useEffect(() => {
3488
- (isSuccess && data || primaryWallet !== null && isFullyConnected && isSolConnecting || address && connected && isTronConnecting || (accounts == null ? void 0 : accounts.bech32Address) && isCosmosonnecting) && setProgress(100);
3489
- }, [
3490
- isSuccess,
3491
- data,
3492
- isSolConnecting,
3493
- primaryWallet,
3494
- isFullyConnected,
3495
- isTronConnecting,
3496
- isCosmosonnecting,
3497
- accounts == null ? void 0 : accounts.bech32Address,
3498
- address,
3499
- connected
3500
- ]);
3501
- return /* @__PURE__ */ jsx(
3502
- CircularProgressWithLabel,
3503
- {
3504
- value: progress,
3505
- selectedWallet,
3506
- selectedConnector
3507
- }
3508
- );
3509
- }
3510
- function ConnectorLoader({ selectedWallet, selectedConnector, handleConnect, isSolConnecting, isCosmosonnecting, handleOtherWalletConnecting, data, isTronConnecting, isSuccess, evmError }) {
3511
- var _a, _b, _c;
3512
- const configuration = useStore((state) => state.configuration);
3513
- const setCosmosChainIds = useStore((state) => state.setCosmosChainIds);
3514
- const fromChain = useStore((state) => state.fromChain);
3515
- const gradient = useStore((state) => state.gradient);
3516
- const { select, connect, wallet } = useWallet();
3517
- const { openWallet } = useWalletItemActions();
3518
- const { setPrimaryWallet } = useDynamicContext();
3519
- const switchWallet = useSwitchWallet();
3520
- const { error } = useConnect();
3521
- const { registerError } = useRegisterError();
3522
- const { suggestAsync } = useSuggestChain();
3523
- const { suggestAndConnectAsync } = useSuggestChainAndConnect();
3524
- const { refetch } = useWalletDetails({});
3525
- const { connectAsync: cosmosConnect } = useConnect$1({
3526
- onError: (err) => {
3527
- setErrorMessage(err.message);
3528
- }
3529
- });
3530
- const [errorMessage, setErrorMessage] = useState("");
3531
- let errorText = (evmError == null ? void 0 : evmError.length) ? evmError : errorMessage;
3532
- async function handleSolConnect() {
3533
- setErrorMessage("");
3534
- try {
3535
- openWallet(selectedWallet);
3536
- } catch (girish) {
3537
- setErrorMessage(girish.message);
3538
- }
3539
- }
3540
- async function handleTronConnect() {
3541
- setErrorMessage("");
3542
- try {
3543
- if (wallet) await connect(selectedWallet);
3544
- else await select(selectedWallet);
3545
- } catch (er) {
3546
- setErrorMessage(er.message);
3547
- }
3548
- }
3549
- useEffect(() => {
3550
- let isValid = validError(errorText || "");
3551
- if (errorText.length && isValid) {
3552
- registerError({
3553
- mode: "wallet connection",
3554
- error: errorText
3555
- });
3556
- }
3557
- }, [errorText]);
3558
- const wallets = useUserWallets();
3559
- useEffect(() => {
3560
- var _a2;
3561
- if (wallets && selectedWallet) {
3562
- let wallet2 = lodashExports.keyBy(wallets, (item) => item.connector.name.toLowerCase());
3563
- ((_a2 = wallet2 == null ? void 0 : wallet2[selectedWallet]) == null ? void 0 : _a2.id) && switchWallet(wallet2[selectedWallet].id);
3564
- }
3565
- }, [wallets, selectedWallet]);
3566
- async function handleCosmosConnect() {
3567
- setErrorMessage("");
3568
- try {
3569
- let chainIds = await getChainIds();
3570
- if (!chainIds.includes(fromChain == null ? void 0 : fromChain.chainId) && (fromChain == null ? void 0 : fromChain.networkType) == "cosmos") {
3571
- let chainInfo = {
3572
- ...fromChain == null ? void 0 : fromChain.chainInfo
3573
- };
3574
- await suggestAndConnectAsync({
3575
- chainInfo,
3576
- walletType: WalletType.KEPLR
3577
- });
3578
- let chainIds1 = await getChainIds();
3579
- setCosmosChainIds(chainIds1);
3580
- await cosmosConnect({
3581
- chainId: chainIds1,
3582
- walletType: WalletType.KEPLR
3583
- });
3584
- await refetch();
3585
- } else {
3586
- cosmosConnect({
3587
- chainId: chainIds,
3588
- walletType: WalletType.KEPLR
3589
- });
3590
- }
3591
- } catch (err) {
3592
- setErrorMessage(err.message);
3593
- }
3594
- }
3595
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-w-full bw-flex-col bw-justify-center bw-items-center", children: [
3596
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-w-full bw-relative bw-justify-center bw-mb-2", children: [
3597
- /* @__PURE__ */ jsx(
3598
- "button",
3599
- {
3600
- onClick: () => {
3601
- handleOtherWalletConnecting();
3602
- },
3603
- className: "bw-absolute bw-left-0 bw-top-[25%]",
3604
- children: /* @__PURE__ */ jsx(BackButton, { fill: "var(--tw-text-secondary)" })
3605
- }
3606
- ),
3607
- /* @__PURE__ */ jsx("div", { className: "bw-text-lg bw-font-normal bw-text-text-secondary", children: "Connect Wallet" }),
3608
- /* @__PURE__ */ jsx(
3609
- "button",
3610
- {
3611
- onClick: () => {
3612
- handleOtherWalletConnecting();
3613
- },
3614
- className: "bw-absolute bw-right-0 bw-top-[25%]",
3615
- children: /* @__PURE__ */ jsx(CloseButton, { fill: "var(--tw-text-secondary)" })
3616
- }
3617
- )
3618
- ] }),
3619
- /* @__PURE__ */ jsx(ConnectWalletProgress, { selectedWallet, isSuccess, data, isSolConnecting, isCosmosonnecting, isTronConnecting, selectedConnector }),
3620
- /* @__PURE__ */ jsxs("p", { className: "bw-text-lg bw-mt-2 bw-font-medium bw-text-text-primary", children: [
3621
- "Continue in ",
3622
- selectedWallet || ""
3623
- ] }),
3624
- /* @__PURE__ */ jsx("p", { className: "bw-text-lg bw-font-normal bw-mt-2 bw-text-text-secondary", children: "Accept connection request in the wallet" }),
3625
- /* @__PURE__ */ jsx("p", { className: "bw-text-text-redtext bw-text-xs bw-relative bw-top-1", children: errorText }),
3626
- /* @__PURE__ */ jsx(
3627
- "div",
3628
- {
3629
- style: {
3630
- ...configuration.gradientStyle,
3631
- boxShadow: configuration && configuration.customTheme && ((_b = (_a = configuration.customTheme) == null ? void 0 : _a.shadow) == null ? void 0 : _b.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
3632
- },
3633
- className: `bw-w-full bw-mt-3 bw-rounded-sm bw-h-full bw-p-[3px] ${gradient ? gradient : `${!((_c = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _c.background) ? "bw-bg-gradient-to-r bw-from-[#2CFFE4] bw-to-[#A45EFF]" : ""}`}`,
3634
- children: /* @__PURE__ */ jsx(
3635
- "button",
3636
- {
3637
- onClick: () => {
3638
- errorText = "";
3639
- if (isSolConnecting) {
3640
- handleSolConnect();
3641
- } else if (isTronConnecting) {
3642
- handleTronConnect();
3643
- } else if (isCosmosonnecting) {
3644
- handleCosmosConnect();
3645
- } else {
3646
- setErrorMessage("");
3647
- handleConnect(selectedConnector);
3648
- }
3649
- },
3650
- className: "bw-w-full bw-flex bw-bg-background-container bw-justify-center bw-items-center bw-h-[50px] bw-rounded-sm ",
3651
- children: /* @__PURE__ */ jsx("span", { style: { ...configuration.gradientStyle, backgroundClip: "text" }, className: ` bw-text-text-primary bw-text-2xl bw-font-bold `, children: "Try Again" })
3652
- }
3653
- )
3654
- }
3655
- )
3656
- ] });
3657
- }
3658
- function WalletTab({ selectedWalletTab, handleWalletTab }) {
3659
- const walletArray = ["All", "EVM", "SVM", "Cosmos", "Other"];
3660
- const configuration = useStore((state) => state.configuration);
3661
- const { cosmos, evmwal, solwal, walleticon } = images;
3662
- const walletIcon = {
3663
- EVM: evmwal,
3664
- SVM: solwal,
3665
- Cosmos: cosmos,
3666
- Other: walleticon
3667
- };
3668
- return /* @__PURE__ */ jsx("div", { className: "bw-flex bw-px-3 bw-justify-between bw-gap-x-2 bw-items-center", children: walletArray.map((wallet, index2) => /* @__PURE__ */ jsx(
3669
- "div",
3670
- {
3671
- style: selectedWalletTab == wallet ? {
3672
- ...configuration == null ? void 0 : configuration.gradientStyle
3673
- } : {},
3674
- className: `${!configuration.gradientStyle && selectedWalletTab == wallet && styles$1.gradientbutton} bw-min-h-[2px] bw-rounded-md bw-p-[1px] bw-mt-[2px] bw-min-w-[40px]`,
3675
- children: /* @__PURE__ */ jsxs(
3676
- "div",
3677
- {
3678
- onClick: () => {
3679
- handleWalletTab(wallet);
3680
- },
3681
- className: `bw-w-[57px] bw-cursor-pointer bw-h-[44px] bw-flex ${selectedWalletTab === wallet ? "bw-bg-background-container" : ""} bw-rounded-md bw-relative bw-flex-col bw-justify-center bw-items-center`,
3682
- children: [
3683
- /* @__PURE__ */ jsx(
3684
- "div",
3685
- {
3686
- className: `${selectedWalletTab === wallet ? "" : "bw-bg-background-secondary bw-opacity-[20%]"} bw-h-full bw-absolute bw-top-0 bw-right-0 bw-rounded-md bw-w-full`
3687
- }
3688
- ),
3689
- walletIcon[wallet] ? /* @__PURE__ */ jsx("img", { src: walletIcon[wallet], alt: "img" }) : /* @__PURE__ */ jsx(Fragment, {}),
3690
- /* @__PURE__ */ jsx(
3691
- "p",
3692
- {
3693
- className: `${selectedWalletTab === wallet ? " bw-text-text-primary bw-font-bold" : " bw-text-text-secondary bw-font-normal"} bw-text-xs bw-mt-[2px] `,
3694
- children: wallet
3695
- }
3696
- )
3697
- ]
3698
- },
3699
- index2
3700
- )
3701
- }
3702
- )) });
3703
- }
3704
- function CustomWallet({ portfolio, handleShowWallet }) {
3705
- var _a, _b, _c, _d;
3706
- const configuration = useStore((state) => state.configuration);
3707
- const customWallet = useStore((state) => state.customWallet);
3708
- const setCustomWallet = useStore((state) => state.setCustomWallet);
3709
- useStore((state) => state.toDisconnect);
3710
- const setToDisconnect = useStore((state) => state.setToDisconnect);
3711
- const isCustomWalletSet = useStore((state) => state.isCustomWalletSet);
3712
- const setIsCustomWalletSet = useStore((state) => state.setIsCustomWalletSet);
3713
- const [val, setVal] = useState("");
3714
- const [errorText, setErrorText] = useState("");
3715
- function handleSubmit() {
3716
- if ((val == null ? void 0 : val.length) > 30) {
3717
- handleShowWallet();
3718
- setIsCustomWalletSet(true);
3719
- setToDisconnect(false);
3720
- setCustomWallet(val);
3721
- } else {
3722
- setErrorText("Please enter a valid address");
3723
- }
3724
- }
3725
- useEffect(() => {
3726
- if ((customWallet == null ? void 0 : customWallet.length) > 30) {
3727
- setVal(customWallet);
3728
- setIsCustomWalletSet(true);
3729
- } else {
3730
- setIsCustomWalletSet(false);
3731
- }
3732
- }, [customWallet]);
3733
- return /* @__PURE__ */ jsxs("div", { className: `bw-sticky bw-border-t bw-pt-3 bw-border-border-primary ${portfolio ? "bw-w-[calc(100%]" : "bw-w-[calc(100%+20px)]"} bw-ml-[-10px] bw-bottom-0`, children: [
3734
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-mx-4 bw-items-center bw-mb-2 bw-gap-x-1", children: [
3735
- /* @__PURE__ */ jsx(WalletIcon, { fill: "var(--tw-text-secondary)" }),
3736
- /* @__PURE__ */ jsx("p", { className: "bw-text-sm bw-font-semibold bw-text-text-secondary", children: "Send to a different wallet address" })
3737
- ] }),
3738
- /* @__PURE__ */ jsxs(
3739
- "form",
3740
- {
3741
- className: "bw-w-full bw-px-4 bw-flex bw-gap-x-2 bw-justify-between bw-items-center",
3742
- onSubmit: (e) => {
3743
- e.preventDefault();
3744
- handleSubmit();
3745
- },
3746
- children: [
3747
- /* @__PURE__ */ jsx("div", { className: `bw-rounded-md ${isCustomWalletSet && (customWallet == null ? void 0 : customWallet.length) > 30 ? "bw-w-[87%]" : "bw-w-[72%]"} bw-p-[1px] bw-bg-border-primary `, children: /* @__PURE__ */ jsx(
3748
- "input",
3749
- {
3750
- type: "text",
3751
- value: val,
3752
- onChange: (e) => {
3753
- setVal(e.target.value);
3754
- setErrorText("");
3755
- setIsCustomWalletSet(false);
3756
- },
3757
- placeholder: "Enter receiving wallet address",
3758
- className: `bw-w-full bw-h-[38px] bw-rounded-md bw-text-sm bw-text-text-primary bw-bg-background-container bw-px-2 placeholder:bw-text-text-secondary `
3759
- }
3760
- ) }),
3761
- isCustomWalletSet && (val == null ? void 0 : val.length) > 30 ? /* @__PURE__ */ jsx(
3762
- "button",
3763
- {
3764
- type: "button",
3765
- onClick: (e) => {
3766
- e.stopPropagation();
3767
- setIsCustomWalletSet(false);
3768
- setToDisconnect(true);
3769
- setCustomWallet("");
3770
- setVal("");
3771
- },
3772
- className: "bw-w-[40px] bw-h-[40px] bw-flex bw-items-center bw-justify-center bw-rounded-md bw-border bw-border-bg-button",
3773
- children: /* @__PURE__ */ jsx("div", { className: "bw-w-[25px] bw-h-[25px]", children: /* @__PURE__ */ jsx(DisconnectWallet, { fill: "var(--tw-text-primary)" }) })
3774
- }
3775
- ) : /* @__PURE__ */ jsx(
3776
- "div",
3777
- {
3778
- style: (val == null ? void 0 : val.length) > 30 ? {
3779
- ...configuration == null ? void 0 : configuration.gradientStyle,
3780
- boxShadow: configuration && configuration.customTheme && ((_b = (_a = configuration.customTheme) == null ? void 0 : _a.shadow) == null ? void 0 : _b.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
3781
- } : {
3782
- boxShadow: configuration && configuration.customTheme && ((_d = (_c = configuration.customTheme) == null ? void 0 : _c.shadow) == null ? void 0 : _d.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
3783
- },
3784
- className: `bw-w-[28%] bw-flex bw-justify-center bw-items-center bw-rounded-md ${!(configuration == null ? void 0 : configuration.gradientStyle) && (val == null ? void 0 : val.length) > 30 && styles$1.gradientbutton} `,
3785
- children: /* @__PURE__ */ jsx(
3786
- "button",
3787
- {
3788
- onClick: () => {
3789
- handleSubmit();
3790
- },
3791
- type: "submit",
3792
- className: `bw-cursor-pointer bw-bg-background-container bw-w-full bw-rounded-[4px] ${(val == null ? void 0 : val.length) > 30 ? " bw-font-bold bw-text-text-primary bw-h-[36px] bw-m-[2px]" : "bw-border bw-font-medium bw-text-text-secondary bw-border-border-primary bw-h-[40px]"} bw-text-lg `,
3793
- children: "Confirm"
3794
- }
3795
- )
3796
- }
3797
- )
3798
- ]
3799
- }
3800
- ),
3801
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-pl-4 bw-mt-1 bw-font-normal bw-text-text-redtext", children: errorText })
3802
- ] });
3803
- }
3804
- function EvmWallet({ selectedWalletTab, styles: styles2, connectWalletField, handleShowWallet, setSelectedConnector, setSelectedWallet, handleConnect, setShowLoading, section }) {
3805
- const configuration = useStore((state) => state.configuration);
3806
- const setToDisconnect = useStore((state) => state.setToDisconnect);
3807
- const { connector } = useAccount$1();
3808
- const { disconnect } = useDisconnect();
3809
- const [connectorObj, setConnectorObj] = useState();
3810
- const [evmSupports, setEvmSupports] = useState([]);
3811
- const { connectors: switchC, switchAccountAsync } = useSwitchAccount();
3812
- const { injectedicon, metamaskicon, coinbaseicon, walletconnecticon, ethereumicon } = images;
3813
- const walletIcons = {
3814
- injected: injectedicon,
3815
- metaMaskSDK: metamaskicon,
3816
- coinbaseWalletSDK: coinbaseicon,
3817
- walletConnect: walletconnecticon
3818
- };
3819
- const config = useConfig();
3820
- const connectors = useConnectors({
3821
- config
3822
- });
3823
- const connections = useConnections({ config });
3824
- const setIsEvmSupportAvailable = useStore((state) => state.setIsEvmSupportAvailable);
3825
- let supportArray = ["MetaMask", "Trust Wallet", "Rabby Wallet", "Phantom"];
3826
- useEffect(() => {
3827
- let connectorObj2 = lodashExports.keyBy(connectors, "name");
3828
- let evmSupports2 = supportArray.filter((item) => !connectorObj2[item]);
3829
- setEvmSupports(evmSupports2);
3830
- setIsEvmSupportAvailable(evmSupports2.length > 0);
3831
- }, [connectors]);
3832
- useEffect(() => {
3833
- setConnectorObj(lodashExports.keyBy(connections, (item) => item.connector.uid));
3834
- }, [connections]);
3835
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3836
- selectedWalletTab == "All" || selectedWalletTab == "EVM" ? connectors.filter((item) => {
3837
- let isConnected = (connector == null ? void 0 : connector.uid) == item.uid || (connectorObj == null ? void 0 : connectorObj[item.uid]);
3838
- return section == "connected" && isConnected || section == "installed" && !isConnected || section == "supported" ? true : false;
3839
- }).map((item, i) => {
3840
- var _a, _b;
3841
- return /* @__PURE__ */ jsx(Fragment, { children: section !== "supported" ? /* @__PURE__ */ jsxs(
3842
- "div",
3843
- {
3844
- style: (connector == null ? void 0 : connector.id) == (item == null ? void 0 : item.id) ? {
3845
- ...configuration == null ? void 0 : configuration.gradientStyle
3846
- } : {},
3847
- className: `bw-w-[47%] bw-mb-4 bw-relative bw-rounded-md bw-p-[1px] ${!configuration.gradientStyle && (connector == null ? void 0 : connector.id) == (item == null ? void 0 : item.id) ? styles2.gradientbutton : "bw-bg-border-primary"} `,
3848
- children: [
3849
- /* @__PURE__ */ jsxs(
3850
- "div",
3851
- {
3852
- onClick: () => {
3853
- if ((connector == null ? void 0 : connector.id) == (item == null ? void 0 : item.id)) {
3854
- if (connectWalletField == "to") {
3855
- setToDisconnect(false);
3856
- handleShowWallet();
3857
- } else {
3858
- disconnect({ connector });
3859
- }
3860
- } else {
3861
- setSelectedWallet(item.name || item.type);
3862
- setSelectedConnector(item);
3863
- handleConnect(item, (connectorObj == null ? void 0 : connectorObj[item.uid]) ? true : false);
3864
- setShowLoading(false);
3865
- setToDisconnect(false);
3866
- }
3867
- },
3868
- style: { cursor: "pointer" },
3869
- className: `bw-w-full bw-bg-background-container hover:bw-shadow-sm bw-font-medium hover:bw-font-bold hover:bw-text-text-primary bw-flex bw-gap-x-3 bw-px-3 bw-justify-start bw-items-center bw-h-[56px] ${(connector == null ? void 0 : connector.uid) == (item == null ? void 0 : item.uid) ? " bw-text-text-primary" : "bw-text-text-secondary"} bw-relative bw-rounded-md
3870
- ${""}
3871
- `,
3872
- children: [
3873
- /* @__PURE__ */ jsxs("div", { className: "bw-w-max bw-relative", children: [
3874
- " ",
3875
- /* @__PURE__ */ jsx("img", { className: "bw-rounded-md", src: walletIcons[item.id] || item.icon, width: 32, height: 32, alt: "img" })
3876
- ] }),
3877
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-w-max ", children: item.name })
3878
- ]
3879
- },
3880
- i
3881
- ),
3882
- /* @__PURE__ */ jsx(
3883
- "div",
3884
- {
3885
- style: (connector == null ? void 0 : connector.id) == (item == null ? void 0 : item.id) ? {
3886
- ...configuration == null ? void 0 : configuration.gradientStyle
3887
- } : {},
3888
- className: `bw-mb-4 bw-bottom-[-50%] bw-absolute bw-right-2 bw-rounded-md bw-p-[1px] ${!configuration.gradientStyle && (connector == null ? void 0 : connector.id) == (item == null ? void 0 : item.id) ? styles2.gradientbutton : "bw-bg-border-primary"} `,
3889
- children: /* @__PURE__ */ jsxs("div", { className: " bw-w-[71px] bw-h-[25px] bw-rounded-md bw-flex bw-bg-background-container bw-justify-center bw-items-center bw-gap-x-1 ", children: [
3890
- /* @__PURE__ */ jsx("img", { src: ethereumicon, width: "", height: "", alt: "img" }),
3891
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-bold bw-text-text-primary", children: "EVM" })
3892
- ] })
3893
- }
3894
- ),
3895
- (connectorObj == null ? void 0 : connectorObj[item.uid]) ? /* @__PURE__ */ jsx(
3896
- "div",
3897
- {
3898
- onClick: (e) => {
3899
- var _a2;
3900
- disconnect({
3901
- connector: (_a2 = connectorObj == null ? void 0 : connectorObj[item.uid]) == null ? void 0 : _a2.connector,
3902
- config
3903
- });
3904
- e.stopPropagation();
3905
- },
3906
- className: " bw-cursor-pointer bw-absolute bw-right-[5px] bw-top-1 bw-text-[10px] bw-text-text-primary bw-z-40 bw-rounded-[50%]",
3907
- children: /* @__PURE__ */ jsx(
3908
- "div",
3909
- {
3910
- style: {
3911
- boxShadow: configuration && configuration.customTheme && ((_b = (_a = configuration.customTheme) == null ? void 0 : _a.shadow) == null ? void 0 : _b.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.20)"
3912
- },
3913
- className: "bw-w-[25px] bw-h-[25px] bw-rounded-[50%]",
3914
- children: /* @__PURE__ */ jsx(DisconnectWallet, { fill: "var(--tw-text-primary)" })
3915
- }
3916
- )
3917
- }
3918
- ) : /* @__PURE__ */ jsx(Fragment, {})
3919
- ]
3920
- }
3921
- ) : /* @__PURE__ */ jsx(Fragment, {}) });
3922
- }) : /* @__PURE__ */ jsx(Fragment, {}),
3923
- section === "supported" && (selectedWalletTab == "All" || selectedWalletTab == "EVM") ? evmSupports.map((item) => /* @__PURE__ */ jsx(SupportedWallets, { wallet: item, chain: "evm" })) : /* @__PURE__ */ jsx(Fragment, {})
3924
- ] });
3925
- }
3926
- const gradientbutton = "_gradientbutton_dz9ed_1";
3927
- const styles = {
3928
- gradientbutton
3929
- };
3930
- function CosmosWallet({ selectedWalletTab, handleCosmosConnection, setErrorMsg, connectWalletField, handleShowWallet, section }) {
3931
- var _a, _b, _c, _d;
3932
- const configuration = useStore((state) => state.configuration);
3933
- const fromChain = useStore((state) => state.fromChain);
3934
- useStore((state) => state.toChain);
3935
- const setCosmosChainIds = useStore((state) => state.setCosmosChainIds);
3936
- useActiveChainIds();
3937
- const { refetch } = useWalletDetails({});
3938
- const { connect, connectAsync } = useConnect$1({
3939
- onError: (err) => setErrorMsg(err.message)
3940
- });
3941
- const { disconnect } = useDisconnect$1();
3942
- const { data: accounts, isConnected, reconnect } = useAccount();
3943
- const setToDisconnect = useStore((state) => state.setToDisconnect);
3944
- const { keplr, cosmosicon } = images;
3945
- useActiveWalletType();
3946
- const { suggestAsync } = useSuggestChain();
3947
- const { suggestAndConnectAsync } = useSuggestChainAndConnect();
3948
- const walletIcons = {
3949
- keplr
3950
- };
3951
- async function connectWallet() {
3952
- try {
3953
- let chainIds2 = await getChainIds();
3954
- if (!chainIds2.includes(fromChain == null ? void 0 : fromChain.chainId) && (fromChain == null ? void 0 : fromChain.networkType) == "cosmos") {
3955
- let chainInfo = {
3956
- ...fromChain == null ? void 0 : fromChain.chainInfo
3957
- };
3958
- await suggestAndConnectAsync({
3959
- chainInfo,
3960
- walletType: WalletType.KEPLR
3961
- });
3962
- let chainIds1 = await getChainIds();
3963
- setCosmosChainIds(chainIds1);
3964
- await connectAsync({
3965
- chainId: chainIds1,
3966
- walletType: WalletType.KEPLR
3967
- });
3968
- await refetch();
3969
- } else {
3970
- connect({
3971
- chainId: chainIds2,
3972
- walletType: WalletType.KEPLR
3973
- });
3974
- }
3975
- handleCosmosConnection(true, "keplr");
3976
- } catch (error) {
3977
- }
3978
- }
3979
- let isConnectedCosmos = ((_a = accounts == null ? void 0 : accounts.bech32Address) == null ? void 0 : _a.length) && isConnected;
3980
- return section == "connected" && isConnectedCosmos || section == "installed" && !isConnectedCosmos && window.keplr ? /* @__PURE__ */ jsxs(
3981
- "div",
3982
- {
3983
- style: {
3984
- ...configuration == null ? void 0 : configuration.gradientStyle
3985
- },
3986
- className: `bw-w-[47%] bw-relative bw-mb-4 ${selectedWalletTab === "Cosmos" ? "" : " "} bw-rounded-md bw-p-[1px] ${!configuration.gradientStyle && isConnected ? styles.gradientbutton : "bw-bg-border-primary"} `,
3987
- onClick: () => {
3988
- if (connectWalletField == "to" && isConnected) {
3989
- setToDisconnect(false);
3990
- handleShowWallet();
3991
- } else if (isConnected) disconnect();
3992
- else {
3993
- connectWallet();
3994
- }
3995
- },
3996
- children: [
3997
- /* @__PURE__ */ jsxs(
3998
- "div",
3999
- {
4000
- className: ` bw-relative bw-flex bw-w-full bw-bg-background-container hover:bw-shadow-sm bw-font-medium hover:bw-font-bold hover:bw-text-text-primary bw-items-center bw-gap-x-3 bw-rounded-md bw-h-[56px] bw-px-3 bw-cursor-pointer ${""}${((_b = accounts == null ? void 0 : accounts.bech32Address) == null ? void 0 : _b.length) && isConnected ? " bw-text-text-primary" : "bw-text-text-secondary"}`,
4001
- children: [
4002
- /* @__PURE__ */ jsx("img", { src: walletIcons["keplr"], width: 32, height: 32, className: "", alt: "img" }),
4003
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-w-max ", children: "Keplr" })
4004
- ]
4005
- }
4006
- ),
4007
- /* @__PURE__ */ jsx(
4008
- "div",
4009
- {
4010
- style: {
4011
- ...configuration == null ? void 0 : configuration.gradientStyle
4012
- },
4013
- className: ` bw-absolute bw-right-2 bw-bottom-[-50%] bw-mb-4 ${selectedWalletTab === "Cosmos" ? "" : " "} bw-rounded-md bw-p-[1px] ${!configuration.gradientStyle && isConnected ? styles.gradientbutton : "bw-bg-border-primary"} `,
4014
- children: /* @__PURE__ */ jsxs("div", { className: " bw-w-[81px] bw-h-[25px] bw-rounded-md bw-flex bw-bg-background-container bw-justify-center bw-items-center bw-gap-x-1 ", children: [
4015
- /* @__PURE__ */ jsx("img", { src: cosmosicon, width: "21", height: "21", alt: "img" }),
4016
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-bold bw-text-text-primary", children: "COSMOS" })
4017
- ] })
4018
- }
4019
- ),
4020
- isConnected ? /* @__PURE__ */ jsx("p", { onClick: () => disconnect(), className: " bw-cursor-pointer bw-absolute bw-right-[5px] bw-top-1 bw-text-[10px] bw-text-text-primary bw-z-40 bw-rounded-[50%]", children: /* @__PURE__ */ jsx(
4021
- "div",
4022
- {
4023
- style: {
4024
- boxShadow: configuration && configuration.customTheme && ((_d = (_c = configuration.customTheme) == null ? void 0 : _c.shadow) == null ? void 0 : _d.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.20)"
4025
- },
4026
- className: "bw-w-[25px] bw-h-[25px] bw-rounded-[50%] ",
4027
- children: /* @__PURE__ */ jsx(DisconnectWallet, { fill: "var(--tw-text-primary)" })
4028
- }
4029
- ) }) : /* @__PURE__ */ jsx(Fragment, {})
4030
- ]
4031
- }
4032
- ) : !window.keplr && section == "supported" ? /* @__PURE__ */ jsx(SupportedWallets, { wallet: "keplr", chain: "cosmos" }) : /* @__PURE__ */ jsx(Fragment, {});
4033
- }
4034
- function WalletList({ selectedWalletTab, connectWalletField, handleShowWallet, handleConnect, setSelectedConnector, setSelectedWallet, setShowLoading, portfolio, fromChain, toChain, handleSolConnecting, handleCosmosConnection, setErrorMsg, section }) {
4035
- const isExternalProvider = useStore((state) => state.isExternalProvider);
4036
- return /* @__PURE__ */ jsxs("div", { className: ` bw-mx-auto bw-px-2 bw-w-full bw-flex bw-justify-between bw-flex-wrap `, children: [
4037
- isExternalProvider.evm ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(EvmWallet, { section, selectedWalletTab, styles: styles$1, connectWalletField, handleShowWallet, setSelectedConnector, setSelectedWallet, handleConnect, setShowLoading }),
4038
- isExternalProvider.solana ? /* @__PURE__ */ jsx(Fragment, {}) : selectedWalletTab == "All" || selectedWalletTab == "SVM" ? /* @__PURE__ */ jsx(SolanaWallet, { section, handleShowWallet, fromChain, toChain, connectWalletField, handleSolConnecting, portfolio, selectedWalletTab }) : /* @__PURE__ */ jsx(Fragment, {}),
4039
- selectedWalletTab == "All" || selectedWalletTab == "Cosmos" ? /* @__PURE__ */ jsx(CosmosWallet, { selectedWalletTab, handleCosmosConnection, setErrorMsg, connectWalletField, handleShowWallet, section }) : /* @__PURE__ */ jsx(Fragment, {})
4040
- ] });
4041
- }
4042
- function SelectWallet({ handleShowWallet, connectWalletField, portfolio, classNames, handleRecentSelectedWallet }) {
4043
- const config = useConfig();
4044
- const { connectAsync, data, isSuccess } = useConnect({
4045
- config
4046
- });
4047
- const { isConnected, connector } = useAccount$1();
4048
- const fromChain = useStore((state) => state.fromChain);
4049
- const toChain = useStore((state) => state.toChain);
4050
- const { primaryWallet } = useDynamicContext();
4051
- const isFullyConnected = useIsLoggedIn();
4052
- const [selectedWallet, setSelectedWallet] = useState("");
4053
- const [showLoading, setShowLoading] = useState(true);
4054
- const [selectedConnector, setSelectedConnector] = useState();
4055
- const [isSolConnecting, setIsSolanaConnecting] = useState(false);
4056
- const [isTronConnecting, setIsTronConnecting] = useState(false);
4057
- const [isCosmosonnecting, setIsCosmosConnecting] = useState(false);
4058
- const [errorMsg, setErrorMsg] = useState("");
4059
- const { connected, address } = useWallet();
4060
- const [selectedWalletTab, setSelectedWalletTab] = useState("All");
4061
- const { data: accounts, isConnected: isCosmosConnected } = useAccount();
4062
- const { switchAccountAsync } = useSwitchAccount();
4063
- const configuration = useStore((state) => state.configuration);
4064
- const isExternalProvider = useStore.getState().isExternalProvider;
4065
- const wallets = useUserWallets();
4066
- const [solCount, setSolCount] = useState(0);
4067
- const { walletOptions } = useWalletOptions();
4068
- const isEvmSupportAvailable = useStore((state) => state.isEvmSupportAvailable);
4069
- useEffect(() => {
4070
- let solCount2 = walletOptions.reduce((acc, item) => {
4071
- if (item.isInstalledOnBrowser) {
4072
- acc++;
4073
- }
4074
- return acc;
4075
- }, 0);
4076
- setSolCount(solCount2);
4077
- }, [wallets]);
4078
- async function handleConnect(connector2, isWalletConnected) {
4079
- setErrorMsg("");
4080
- let action = isWalletConnected ? switchAccountAsync : connectAsync;
4081
- try {
4082
- let result = await action({ connector: connector2 });
4083
- if (isWalletConnected) {
4084
- handleShowWallet();
4085
- }
4086
- setErrorMsg((prev) => {
4087
- if ((prev == null ? void 0 : prev.length) && result) {
4088
- handleShowWallet();
4089
- }
4090
- return "";
4091
- });
4092
- } catch (err) {
4093
- setErrorMsg(err.details || err.message || "");
4094
- }
4095
- }
4096
- useEffect(() => {
4097
- let timeout;
4098
- if (data && isSuccess) {
4099
- timeout = setTimeout(() => {
4100
- handleShowWallet();
4101
- }, 1e3);
4102
- !portfolio && handleRecentSelectedWallet("evm");
4103
- }
4104
- return () => {
4105
- clearTimeout(timeout);
4106
- };
4107
- }, [isSuccess, data]);
4108
- function handleSolConnecting(val, wallet) {
4109
- setErrorMsg("");
4110
- if (wallet) {
4111
- setSelectedWallet(wallet);
4112
- }
4113
- setIsSolanaConnecting(val);
4114
- setShowLoading(false);
4115
- }
4116
- function handleOtherWalletConnecting() {
4117
- setShowLoading(true);
4118
- setIsSolanaConnecting(false);
4119
- setIsTronConnecting(false);
4120
- }
4121
- function handleTronConnection(val, wallet) {
4122
- setErrorMsg("");
4123
- setIsTronConnecting(val);
4124
- setShowLoading(false);
4125
- }
4126
- function handleCosmosConnection(val, wallet) {
4127
- setErrorMsg("");
4128
- if (wallet) setSelectedWallet(wallet);
4129
- setIsCosmosConnecting(val);
4130
- setShowLoading(false);
4131
- }
4132
- useEffect(() => {
4133
- let timeout;
4134
- if (isFullyConnected && primaryWallet !== null && isSolConnecting) {
4135
- timeout = setTimeout(() => {
4136
- handleShowWallet();
4137
- handleSolConnecting(false);
4138
- }, 1e3);
4139
- !portfolio && handleRecentSelectedWallet("sol");
4140
- }
4141
- return () => {
4142
- clearTimeout(timeout);
4143
- };
4144
- }, [isFullyConnected, primaryWallet, isSolConnecting]);
4145
- useEffect(() => {
4146
- let timeout;
4147
- if (connected && address && isTronConnecting) {
4148
- timeout = setTimeout(() => {
4149
- handleShowWallet();
4150
- handleTronConnection(false);
4151
- }, 1e3);
4152
- }
4153
- return () => {
4154
- clearTimeout(timeout);
4155
- };
4156
- }, [connected, address, isTronConnecting]);
4157
- useEffect(() => {
4158
- let timeout;
4159
- if (isCosmosConnected && (accounts == null ? void 0 : accounts.bech32Address) && isCosmosonnecting) {
4160
- timeout = setTimeout(() => {
4161
- handleShowWallet();
4162
- handleCosmosConnection(false);
4163
- }, 1e3);
4164
- !portfolio && handleRecentSelectedWallet("cosmos");
4165
- }
4166
- return () => {
4167
- clearTimeout(timeout);
4168
- };
4169
- }, [isCosmosConnected, accounts == null ? void 0 : accounts.bech32Address, isCosmosonnecting]);
4170
- function handleWalletTab(wallet) {
4171
- setSelectedWalletTab(wallet);
4172
- }
4173
- return showLoading ? /* @__PURE__ */ jsxs("div", { className: "", children: [
4174
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-relative bw-justify-center bw-mb-2", children: [
4175
- /* @__PURE__ */ jsx("button", { onClick: handleShowWallet, className: "bw-absolute bw-left-0 bw-top-[25%]", children: /* @__PURE__ */ jsx(BackButton, { fill: "var(--tw-text-secondary)" }) }),
4176
- /* @__PURE__ */ jsx("div", { className: "bw-text-lg bw-font-medium bw-text-text-secondary", children: "Connect Wallet" }),
4177
- /* @__PURE__ */ jsx("button", { onClick: handleShowWallet, className: "bw-absolute bw-right-0 bw-top-[25%]", children: /* @__PURE__ */ jsx(CloseButton, { fill: "var(--tw-text-secondary)" }) })
4178
- ] }),
4179
- /* @__PURE__ */ jsx(WalletTab, { selectedWalletTab, handleWalletTab }),
4180
- /* @__PURE__ */ jsxs("div", { className: `${classNames ? classNames : "bw-h-[400px] "} bw-w-full bw-relative bw-overflow-y-auto`, children: [
4181
- /* @__PURE__ */ jsxs("div", { children: [
4182
- (connector && !isExternalProvider.evm || (primaryWallet == null ? void 0 : primaryWallet.address) && !isExternalProvider.solana || isCosmosConnected) && selectedWalletTab === "All" || selectedWalletTab === "EVM" && connector && !isExternalProvider.evm || selectedWalletTab === "Cosmos" && isCosmosConnected || selectedWalletTab === "SVM" && (wallets == null ? void 0 : wallets.length) && !isExternalProvider.solana ? /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2 bw-justify-between bw-w-full bw-my-3", children: [
4183
- /* @__PURE__ */ jsxs("p", { style: { ...configuration == null ? void 0 : configuration.gradientStyle }, className: ` bw-bg-clip-text bw-flex bw-items-center bw-gap-x-1 bw-text-sm bw-font-medium bw-text-transparent ${!(configuration == null ? void 0 : configuration.gradientStyle) ? styles$1.gradientbutton : ""} `, children: [
4184
- /* @__PURE__ */ jsx("div", { style: { ...configuration == null ? void 0 : configuration.gradientStyle }, className: `bw-w-[10px] bw-rounded-[50%] ${!(configuration == null ? void 0 : configuration.gradientStyle) ? styles$1.gradientbutton : ""} bw-bg-text-greentext bw-h-[10px]` }),
4185
- " Connected"
4186
- ] }),
4187
- /* @__PURE__ */ jsx("div", { className: "bw-h-[1px] bw-mr-2 bw-w-full bw-bg-border-primary" })
4188
- ] }) : /* @__PURE__ */ jsx(Fragment, {}),
4189
- /* @__PURE__ */ jsx(WalletList, { selectedWalletTab, connectWalletField, handleShowWallet, handleConnect, setSelectedConnector, setErrorMsg, setSelectedWallet, setShowLoading, portfolio, fromChain, toChain, handleSolConnecting, handleCosmosConnection, section: "connected" })
4190
- ] }),
4191
- /* @__PURE__ */ jsxs("div", { children: [
4192
- selectedWalletTab == "EVM" && !isExternalProvider.evm || selectedWalletTab === "All" && (!isExternalProvider.evm || !(isExternalProvider == null ? void 0 : isExternalProvider.solana) || window.keplr) || selectedWalletTab === "Cosmos" && window.keplr && !isCosmosConnected || selectedWalletTab === "SVM" && (wallets == null ? void 0 : wallets.length) < solCount && !isExternalProvider.solana ? /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2 bw-justify-between bw-w-full bw-my-3", children: [
4193
- /* @__PURE__ */ jsx("p", { className: "bw-text-sm bw-font-medium bw-w-max bw-text-text-secondary ", children: "Installed" }),
4194
- /* @__PURE__ */ jsx("div", { className: "bw-h-[1px] bw-mr-2 bw-w-full bw-bg-border-primary" })
4195
- ] }) : /* @__PURE__ */ jsx(Fragment, {}),
4196
- /* @__PURE__ */ jsx(WalletList, { selectedWalletTab, connectWalletField, handleShowWallet, handleConnect, setSelectedConnector, setErrorMsg, setSelectedWallet, setShowLoading, portfolio, fromChain, toChain, handleSolConnecting, handleCosmosConnection, section: "installed" })
4197
- ] }),
4198
- /* @__PURE__ */ jsxs("div", { children: [
4199
- (selectedWalletTab === "Cosmos" || selectedWalletTab == "All") & !window.keplr || (selectedWalletTab === "EVM" || selectedWalletTab == "All") && isEvmSupportAvailable && !isExternalProvider.evm || (selectedWalletTab === "SVM" || selectedWalletTab == "All") && solCount < 7 && !isExternalProvider.solana ? /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2 bw-justify-between bw-w-full bw-my-3", children: [
4200
- /* @__PURE__ */ jsx("p", { className: "bw-text-sm bw-font-medium bw-w-max bw-text-text-secondary ", children: "Supported" }),
4201
- /* @__PURE__ */ jsx("div", { className: "bw-h-[1px] bw-mr-2 bw-w-full bw-bg-border-primary" })
4202
- ] }) : /* @__PURE__ */ jsx(Fragment, {}),
4203
- /* @__PURE__ */ jsx(WalletList, { selectedWalletTab, connectWalletField, handleShowWallet, handleConnect, setSelectedConnector, setErrorMsg, setSelectedWallet, setShowLoading, portfolio, fromChain, toChain, handleSolConnecting, handleCosmosConnection, section: "supported" })
4204
- ] })
4205
- ] }),
4206
- connectWalletField == "to" ? /* @__PURE__ */ jsx(CustomWallet, { portfolio, handleShowWallet, section: "connected" }) : /* @__PURE__ */ jsx(Fragment, {})
4207
- ] }) : /* @__PURE__ */ jsx(ConnectorLoader, { selectedWallet, selectedConnector, handleConnect, handleOtherWalletConnecting, isSolConnecting, isTronConnecting, isCosmosonnecting, isSuccess, data, evmError: errorMsg });
4208
- }
4209
- const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4210
- __proto__: null,
4211
- default: SelectWallet
4212
- }, Symbol.toStringTag, { value: "Module" }));
4213
- export {
4214
- SelectWallet as S,
4215
- Typography as T,
4216
- index as i
4217
- };