@arcblock/ux 3.0.8 → 3.0.10

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 (66) hide show
  1. package/lib/Address/did-address.js +47 -49
  2. package/lib/Address/responsive-did-address.js +53 -57
  3. package/lib/Avatar/index.js +16 -16
  4. package/lib/BlockletV2/blocklet.js +64 -64
  5. package/lib/BlockletV2/components/tooltip-icon.js +26 -27
  6. package/lib/CardSelector/index.js +1 -2
  7. package/lib/ClickToCopy/hook.js +10 -11
  8. package/lib/ClickToCopy/index.js +16 -16
  9. package/lib/Config/theme-mode-toggle.js +7 -8
  10. package/lib/DID/index.js +131 -133
  11. package/lib/DIDConnect/app-info-item.js +18 -18
  12. package/lib/DIDConnect/auth-apps/index.js +83 -84
  13. package/lib/DIDConnect/did-connect-container.js +89 -90
  14. package/lib/DIDConnect/did-connect-footer.js +25 -25
  15. package/lib/DIDConnect/landing-page.js +17 -17
  16. package/lib/DIDConnect/powered-by.js +11 -11
  17. package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
  18. package/lib/DIDConnect/with-container.js +66 -68
  19. package/lib/Dialog/use-confirm.js +40 -43
  20. package/lib/Earth/index.js +21 -22
  21. package/lib/Footer/index.js +15 -16
  22. package/lib/Header/responsive-header.js +23 -24
  23. package/lib/Layout/dashboard/index.js +63 -72
  24. package/lib/Layout/dashboard/sidebar.js +20 -21
  25. package/lib/Layout/dashboard-legacy/index.js +52 -52
  26. package/lib/Locale/context.js +36 -37
  27. package/lib/Locale/selector.js +40 -42
  28. package/lib/NFTDisplay/index.js +114 -118
  29. package/lib/NFTDisplay/render-svg.js +12 -12
  30. package/lib/NavMenu/nav-menu.js +159 -161
  31. package/lib/NavMenu/sub-container.js +25 -26
  32. package/lib/PageScroller/index.js +28 -32
  33. package/lib/Passport/passport.js +11 -11
  34. package/lib/PhoneInput/country-select.js +38 -38
  35. package/lib/PhoneInput/index.js +65 -66
  36. package/lib/Screenshot/index.js +26 -27
  37. package/lib/SessionBlocklet/index.js +87 -93
  38. package/lib/SessionPermission/index.js +5 -9
  39. package/lib/SessionUser/components/did-space.js +24 -25
  40. package/lib/SessionUser/components/logged-in.js +122 -127
  41. package/lib/SessionUser/components/quick-login-item.js +41 -42
  42. package/lib/SessionUser/components/session-user-item.js +35 -36
  43. package/lib/SessionUser/components/session-user-switch.js +81 -85
  44. package/lib/SessionUser/components/un-login.js +41 -41
  45. package/lib/SessionUser/components/user-info.js +43 -47
  46. package/lib/SessionUser/index.js +1 -1
  47. package/lib/SessionUser/libs/utils.js +24 -30
  48. package/lib/SharedBridge/index.js +35 -35
  49. package/lib/Theme/index.js +16 -16
  50. package/lib/Theme/theme.js +42 -43
  51. package/lib/Toast/index.js +24 -25
  52. package/lib/Typography/index.js +42 -42
  53. package/lib/UserCard/Content/basic.js +91 -93
  54. package/lib/UserCard/Content/shorten-label.js +9 -9
  55. package/lib/UserCard/components.js +15 -15
  56. package/lib/Util/deprecate.js +1 -1
  57. package/lib/Util/federated.js +28 -32
  58. package/lib/Util/iframe.js +9 -10
  59. package/lib/Util/index.js +134 -135
  60. package/lib/Util/security.js +9 -10
  61. package/lib/Util/wallet.js +6 -9
  62. package/lib/VerificationCode/index.js +26 -28
  63. package/lib/hooks/use-blocklet-logo.js +11 -14
  64. package/lib/ux.css +1 -1
  65. package/lib/withTracker/index.js +13 -14
  66. package/package.json +9 -10
package/lib/Util/index.js CHANGED
@@ -17,20 +17,20 @@ import L from "dayjs/plugin/localizedFormat";
17
17
  import { DID_PREFIX as P, BLOCKLET_SERVICE_PATH_PREFIX as v } from "./constant.js";
18
18
  import { getFederatedEnabled as C } from "./federated.js";
19
19
  let f = null;
20
- const V = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, _ = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), M = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
21
- function z(e) {
22
- if (!e)
20
+ const M = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, V = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), _ = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
21
+ function z(t) {
22
+ if (!t)
23
23
  return !1;
24
- const t = e.split(".");
25
- if (t.length < 2) return !1;
26
- const r = t[t.length - 2], n = t[t.length - 1];
27
- return _.has(r) && M.has(n);
24
+ const e = t.split(".");
25
+ if (e.length < 2) return !1;
26
+ const r = e[e.length - 2], n = e[e.length - 1];
27
+ return V.has(r) && _.has(n);
28
28
  }
29
- function me() {
30
- const { host: e } = window.location;
31
- if (!e || V.test(e))
29
+ function mt() {
30
+ const { host: t } = window.location;
31
+ if (!t || M.test(t))
32
32
  return "";
33
- const r = e.split(":")[0].split(".");
33
+ const r = t.split(":")[0].split(".");
34
34
  if (r.length === 1)
35
35
  return "";
36
36
  if (r.length > 2) {
@@ -40,31 +40,31 @@ function me() {
40
40
  }
41
41
  return `.${r.slice(-2).join(".")}`;
42
42
  }
43
- function de(e) {
44
- return e.replace(/^\?/, "").split("&").map((t) => t.split("=")).filter(([t]) => !!t).reduce((t, r) => {
43
+ function dt(t) {
44
+ return t.replace(/^\?/, "").split("&").map((e) => e.split("=")).filter(([e]) => !!e).reduce((e, r) => {
45
45
  const n = r[0], i = decodeURIComponent(r[1]) || !0;
46
- return t[n] = i, t;
46
+ return e[n] = i, e;
47
47
  }, {});
48
48
  }
49
- function pe(e = {}) {
50
- return new URLSearchParams(e).toString();
49
+ function pt(t = {}) {
50
+ return new URLSearchParams(t).toString();
51
51
  }
52
- function he(e = 1) {
53
- let t = e;
54
- typeof t == "number" && (t = { expireInDays: t }), t.path === void 0 && (t.path = "/"), t.expireInDays || (t.expireInDays = 1);
52
+ function ht(t = 1) {
53
+ let e = t;
54
+ typeof e == "number" && (e = { expireInDays: e }), e.path === void 0 && (e.path = "/"), e.expireInDays || (e.expireInDays = 1);
55
55
  const r = {
56
- expires: t.expireInDays,
57
- path: t.path,
58
- domain: t.domain || "",
59
- sameSite: t.sameSite || "Lax",
56
+ expires: e.expireInDays,
57
+ path: e.path,
58
+ domain: e.domain || "",
59
+ sameSite: e.sameSite || "Lax",
60
60
  // 允许自定义设置为 false,默认是 true
61
- secure: t.secure !== !1
61
+ secure: e.secure !== !1
62
62
  };
63
- return (typeof window > "u" || t.domain || t.returnDomain === !1) && t.returnDomain === !1 && delete r.domain, r;
63
+ return (typeof window > "u" || e.domain || e.returnDomain === !1) && e.returnDomain === !1 && delete r.domain, r;
64
64
  }
65
- const ge = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary, we = (e) => e.background ? e.background : e.dark ? e.theme.palette.common.black : e.theme.palette.common.white;
66
- function ye(e, t, r = []) {
67
- const n = Object.assign({}, e), i = t.defaultProps || {};
65
+ const gt = (t) => t.color ? t.color : t.dark ? t.theme.palette.common.white : t.theme.palette.text.primary, wt = (t) => t.background ? t.background : t.dark ? t.theme.palette.common.black : t.theme.palette.common.white;
66
+ function yt(t, e, r = []) {
67
+ const n = Object.assign({}, t), i = e.defaultProps || {};
68
68
  return Object.keys(i).forEach((o) => {
69
69
  typeof n[o] == "string" && n[o].indexOf("::prop::") === 0 && (n[o] = i[o]);
70
70
  }), Array.isArray(r) && r.forEach((o) => {
@@ -77,31 +77,31 @@ function ye(e, t, r = []) {
77
77
  typeof n[o] == "string" && n[o].indexOf("::prop::") === 0 && (n[o] = "");
78
78
  }), n;
79
79
  }
80
- function Ie(e = 2017) {
81
- const t = (/* @__PURE__ */ new Date()).getFullYear();
82
- return `${t}` == `${e}` ? `© ArcBlock ${t}` : `© ArcBlock ${e} - ${t}`;
80
+ function It(t = 2017) {
81
+ const e = (/* @__PURE__ */ new Date()).getFullYear();
82
+ return `${e}` == `${t}` ? `© ArcBlock ${e}` : `© ArcBlock ${t} - ${e}`;
83
83
  }
84
- const De = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", be = (e) => {
85
- let t = 0;
86
- for (let n = 0; n < e.length; n++)
87
- t = e.charCodeAt(n) + ((t << 5) - t);
84
+ const Dt = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", bt = (t) => {
85
+ let e = 0;
86
+ for (let n = 0; n < t.length; n++)
87
+ e = t.charCodeAt(n) + ((e << 5) - e);
88
88
  let r = "#";
89
89
  for (let n = 0; n < 3; n++) {
90
- const i = t >> n * 8 & 255;
90
+ const i = e >> n * 8 & 255;
91
91
  r += `00${i.toString(16)}`.substr(-2);
92
92
  }
93
93
  return r;
94
- }, $e = (e) => {
95
- const t = Math.round(e / 1e3), r = Math.floor(t / 3600), n = Math.floor((t - r * 3600) / 60), i = t % 60;
94
+ }, $t = (t) => {
95
+ const e = Math.round(t / 1e3), r = Math.floor(e / 3600), n = Math.floor((e - r * 3600) / 60), i = e % 60;
96
96
  return `${u(r, 2, "0")}:${u(n, 2, "0")}:${u(i, 2, "0")}`;
97
97
  };
98
- function B(e) {
99
- f = e;
98
+ function B(t) {
99
+ f = t;
100
100
  }
101
- function Te() {
101
+ function Tt() {
102
102
  return f;
103
103
  }
104
- const I = (e) => (t, { locale: r, tz: n, isUtc: i } = {}) => {
104
+ const I = (t) => (e, { locale: r, tz: n, isUtc: i } = {}) => {
105
105
  if (f === null && (a.extend(L), a.extend(j), a.extend(O), a.extend(W), a.extend(R), a.updateLocale("zh-cn", {
106
106
  // copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
107
107
  relativeTime: {
@@ -119,29 +119,29 @@ const I = (e) => (t, { locale: r, tz: n, isUtc: i } = {}) => {
119
119
  y: "1 年",
120
120
  yy: "%d 年"
121
121
  }
122
- }), B(a)), y(t) || t === "")
122
+ }), B(a)), y(e) || e === "")
123
123
  return "-";
124
- let o = f(t);
125
- return n && (o = o.tz(n)), i && (o = o.utc()), typeof r < "u" && (o = o.locale(r)), o.format(e);
124
+ let o = f(e);
125
+ return n && (o = o.tz(n)), i && (o = o.utc()), typeof r < "u" && (o = o.locale(r)), o.format(t);
126
126
  };
127
- function Se(e, { locale: t = "en", tz: r } = {}) {
128
- return I("ll")(e, { locale: t, tz: r });
127
+ function St(t, { locale: e = "en", tz: r } = {}) {
128
+ return I("ll")(t, { locale: e, tz: r });
129
129
  }
130
- function Ee(e, {
131
- locale: t = "en",
130
+ function Et(t, {
131
+ locale: e = "en",
132
132
  tz: r,
133
133
  isUtc: n = !1,
134
134
  format: i = "lll"
135
135
  } = {}) {
136
- return I(i)(e, { locale: t, tz: r, isUtc: n });
136
+ return I(i)(t, { locale: e, tz: r, isUtc: n });
137
137
  }
138
138
  function N() {
139
- const e = (window == null ? void 0 : window.ABT_DEV) || window.ABT;
140
- return e && typeof e.open == "function" ? e : null;
139
+ const t = window?.ABT_DEV || window.ABT;
140
+ return t && typeof t.open == "function" ? t : null;
141
141
  }
142
- function xe({
143
- webWalletUrl: e,
144
- action: t = "login",
142
+ function xt({
143
+ webWalletUrl: t,
144
+ action: e = "login",
145
145
  locale: r = "en",
146
146
  url: n,
147
147
  windowFeatures: i,
@@ -151,7 +151,7 @@ function xe({
151
151
  const h = N();
152
152
  if (h)
153
153
  return h.open({
154
- action: t,
154
+ action: e,
155
155
  locale: r,
156
156
  url: encodeURIComponent(n),
157
157
  appInfo: {
@@ -171,7 +171,7 @@ function xe({
171
171
  // iphone 8plus size
172
172
  width: 414,
173
173
  height: 736
174
- }, b = `${e}?action=${t}&locale=${r}&url=${encodeURIComponent(n)}`, c = Object.assign({}, D, i), $ = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
174
+ }, b = `${t}?action=${e}&locale=${r}&url=${encodeURIComponent(n)}`, c = Object.assign({}, D, i), $ = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
175
175
  if (!("left" in c)) {
176
176
  const s = $(window.top || window), S = window.screenLeft || window.screenX;
177
177
  c.left = s + S - c.width;
@@ -183,53 +183,53 @@ function xe({
183
183
  const T = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
184
184
  return window.open(b, "targetWindow", T), { type: "web" };
185
185
  }
186
- const ke = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", X = (e) => {
187
- const t = e.replace(P, "");
188
- return !!/^(0x)?[0-9a-f]{40}$/i.test(t);
189
- }, K = (e, t) => {
190
- if (!t)
191
- return e;
186
+ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) => {
187
+ const e = t.replace(P, "");
188
+ return !!/^(0x)?[0-9a-f]{40}$/i.test(e);
189
+ }, K = (t, e) => {
190
+ if (!e)
191
+ return t;
192
192
  try {
193
- const r = new URL(e, window.location.origin);
194
- return Object.keys(t).forEach((n) => {
195
- r.searchParams.set(n, String(t[n]));
193
+ const r = new URL(t, window.location.origin);
194
+ return Object.keys(e).forEach((n) => {
195
+ r.searchParams.set(n, String(e[n]));
196
196
  }), r.origin === window.location.origin ? r.pathname + r.search : r.href;
197
197
  } catch {
198
- return e;
198
+ return t;
199
199
  }
200
- }, Ae = (e, t = 48) => e && (e.indexOf(v) >= 0 ? K(e, {
200
+ }, At = (t, e = 48) => t && (t.indexOf(v) >= 0 ? K(t, {
201
201
  imageFilter: "resize",
202
- w: t,
203
- h: t
204
- }) : e), Fe = (e = 0) => new Promise((t) => {
202
+ w: e,
203
+ h: e
204
+ }) : t), Ft = (t = 0) => new Promise((e) => {
205
205
  setTimeout(() => {
206
- t();
207
- }, e);
208
- }), Ue = (e) => /^https?:\/\//.test(e), m = "vid", d = "__visitor_id", Q = () => l.get(m) || localStorage.getItem(d), w = (e) => {
209
- e === null ? l.remove(m, {
206
+ e();
207
+ }, t);
208
+ }), Ut = (t) => /^https?:\/\//.test(t), m = "vid", d = "__visitor_id", Q = () => l.get(m) || localStorage.getItem(d), w = (t) => {
209
+ t === null ? l.remove(m, {
210
210
  sameSite: "None",
211
211
  secure: !0
212
- }) : l.set(m, e, {
212
+ }) : l.set(m, t, {
213
213
  sameSite: "None",
214
214
  secure: !0,
215
215
  expires: 365
216
216
  });
217
- }, je = () => {
218
- let e = localStorage.getItem(d);
219
- if (e && (localStorage.removeItem(d), w(e)), !Q()) {
217
+ }, jt = () => {
218
+ let t = localStorage.getItem(d);
219
+ if (t && (localStorage.removeItem(d), w(t)), !Q()) {
220
220
  if (!C())
221
221
  try {
222
222
  if (window.crypto && typeof window.crypto.randomUUID == "function")
223
- e = window.crypto.randomUUID();
223
+ t = window.crypto.randomUUID();
224
224
  else {
225
- const t = new Uint8Array(16);
225
+ const e = new Uint8Array(16);
226
226
  if (window.crypto && typeof window.crypto.getRandomValues == "function")
227
- window.crypto.getRandomValues(t);
227
+ window.crypto.getRandomValues(e);
228
228
  else
229
229
  for (let n = 0; n < 16; n++)
230
- t[n] = Math.floor(Math.random() * 256);
231
- const r = Array.from(t).map((n) => n.toString(16).padStart(2, "0"));
232
- e = [
230
+ e[n] = Math.floor(Math.random() * 256);
231
+ const r = Array.from(e).map((n) => n.toString(16).padStart(2, "0"));
232
+ t = [
233
233
  r.slice(0, 4).join(""),
234
234
  r.slice(4, 6).join(""),
235
235
  r.slice(6, 8).join(""),
@@ -238,83 +238,82 @@ const ke = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", X = (e) =
238
238
  ].join("-");
239
239
  }
240
240
  } catch {
241
- e = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
241
+ t = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
242
242
  }
243
- e && w(e);
243
+ t && w(t);
244
244
  }
245
- }, Oe = (e) => {
246
- if (X(e)) {
247
- const t = Uint8Array.from(
248
- e.slice(2).match(/.{1,2}/g).map((r) => parseInt(r, 16))
245
+ }, Ot = (t) => {
246
+ if (X(t)) {
247
+ const e = Uint8Array.from(
248
+ t.slice(2).match(/.{1,2}/g).map((r) => parseInt(r, 16))
249
249
  ).slice(0, 8).reduce((r, n) => r + n, 0) % g.length;
250
- return g[t];
250
+ return g[e];
251
251
  }
252
252
  try {
253
- const t = x(e);
254
- return t == null ? void 0 : t.color;
253
+ return x(t)?.color;
255
254
  } catch {
256
255
  return null;
257
256
  }
258
- }, Re = (e, t, r = {}) => {
257
+ }, Rt = (t, e, r = {}) => {
259
258
  const { fallbackLocale: n = "en", defaultValue: i = "unknown" } = r;
260
- if (typeof e == "string")
261
- return e;
259
+ if (typeof t == "string")
260
+ return t;
262
261
  let o;
263
- return t && (o = e[t]), (!o || typeof o != "string") && (o = e[n]), (!o || typeof o != "string") && (o = i), o;
264
- }, We = (e) => E(
262
+ return e && (o = t[e]), (!o || typeof o != "string") && (o = t[n]), (!o || typeof o != "string") && (o = i), o;
263
+ }, Wt = (t) => E(
265
264
  () => A(
266
265
  async () => {
267
266
  try {
268
- return await e();
269
- } catch (t) {
270
- throw t instanceof TypeError && !t.message.includes("Failed to fetch") ? t : t instanceof Error ? new Error(t.message) : new Error("Unknown error");
267
+ return await t();
268
+ } catch (e) {
269
+ throw e instanceof TypeError && !e.message.includes("Failed to fetch") ? e : e instanceof Error ? new Error(e.message) : new Error("Unknown error");
271
270
  }
272
271
  },
273
272
  // 只需要重试两次,加上原本的一次,总共三次
274
273
  { retries: 2 }
275
274
  )
276
- ), Le = (e) => k(e, y);
277
- function Pe(e, t = 1) {
278
- const [r, n, i] = F.hex.rgb(e);
279
- return `rgba(${r}, ${n}, ${i}, ${t})`;
275
+ ), Lt = (t) => k(t, y);
276
+ function Pt(t, e = 1) {
277
+ const [r, n, i] = F.hex.rgb(t);
278
+ return `rgba(${r}, ${n}, ${i}, ${e})`;
280
279
  }
281
- function ve(e, t) {
282
- if (!Array.isArray(e))
280
+ function vt(t, e) {
281
+ if (!Array.isArray(t))
283
282
  throw new Error("First argument should be an array");
284
- return e.length === 0 ? {} : e.length === 1 ? e[0] : e.reduce((r, n) => U(r, n, t));
283
+ return t.length === 0 ? {} : t.length === 1 ? t[0] : t.reduce((r, n) => U(r, n, e));
285
284
  }
286
285
  export {
287
286
  K as appendParams,
288
- Le as cleanedObj,
289
- ve as deepmergeAll,
287
+ Lt as cleanedObj,
288
+ vt as deepmergeAll,
290
289
  N as detectWalletExtension,
291
- je as ensureVisitorId,
292
- Se as formatToDate,
293
- Ee as formatToDatetime,
294
- $e as formatUptime,
295
- we as getBackground,
296
- ge as getColor,
297
- he as getCookieOptions,
298
- Ie as getCopyright,
299
- Oe as getDIDColor,
300
- Te as getDateTool,
301
- ke as getFontSize,
302
- De as getTimezone,
303
- Re as getTranslation,
304
- Ae as getUserAvatar,
290
+ jt as ensureVisitorId,
291
+ St as formatToDate,
292
+ Et as formatToDatetime,
293
+ $t as formatUptime,
294
+ wt as getBackground,
295
+ gt as getColor,
296
+ ht as getCookieOptions,
297
+ It as getCopyright,
298
+ Ot as getDIDColor,
299
+ Tt as getDateTool,
300
+ kt as getFontSize,
301
+ Dt as getTimezone,
302
+ Rt as getTranslation,
303
+ At as getUserAvatar,
305
304
  Q as getVisitorId,
306
- Pe as hexToRgba,
305
+ Pt as hexToRgba,
307
306
  X as isEthereumDid,
308
307
  z as isTwoSegmentTLD,
309
- Ue as isUrl,
310
- We as lazyRetry,
311
- ye as mergeProps,
312
- xe as openWebWallet,
313
- de as parseQuery,
314
- me as resolveRootDomain,
308
+ Ut as isUrl,
309
+ Wt as lazyRetry,
310
+ yt as mergeProps,
311
+ xt as openWebWallet,
312
+ dt as parseQuery,
313
+ mt as resolveRootDomain,
315
314
  B as setDateTool,
316
315
  w as setVisitorId,
317
- Fe as sleep,
318
- be as str2color,
319
- pe as stringifyQuery
316
+ Ft as sleep,
317
+ bt as str2color,
318
+ pt as stringifyQuery
320
319
  };
@@ -1,34 +1,33 @@
1
1
  class i extends Error {
2
2
  }
3
- function f(t, {
3
+ function h(t, {
4
4
  throwOnError: r = !0,
5
- returnRaw: h = !1,
5
+ returnRaw: a = !1,
6
6
  // 根据 URL 的规范,protocol 以 : 结尾
7
7
  allowProtocols: l = ["https:", "http:"],
8
8
  // host 中可能会携带端口号,需要使用 hostname 来获取干净的域名
9
9
  allowDomains: n = void 0
10
10
  } = {}) {
11
- var s;
12
- n === void 0 && (n = ((s = window.blocklet) == null ? void 0 : s.domainAliases) || [], n.push(window.location.href));
11
+ n === void 0 && (n = window.blocklet?.domainAliases || [], n.push(window.location.href));
13
12
  try {
14
13
  let o;
15
14
  t.startsWith("/") ? o = window.location.origin : t.startsWith("./") && (o = window.location.href);
16
- const e = new URL(t, o), c = n && n.map((a) => {
15
+ const e = new URL(t, o), s = n && n.map((c) => {
17
16
  try {
18
- return new URL(a).hostname;
17
+ return new URL(c).hostname;
19
18
  } catch {
20
- return new URL(`https://${a}`).hostname;
19
+ return new URL(`https://${c}`).hostname;
21
20
  }
22
21
  });
23
22
  if (l !== null && !l.includes(e.protocol)) {
24
23
  if (console.error(`Invalid protocol: ${e.protocol}`), r) throw new i(`Invalid protocol: ${e.protocol}`);
25
24
  return null;
26
25
  }
27
- if (c !== null && !c.includes(e.hostname)) {
26
+ if (s !== null && !s.includes(e.hostname)) {
28
27
  if (console.error(`Invalid host: ${e.hostname}`), r) throw new i(`Invalid host: ${e.hostname}`);
29
28
  return null;
30
29
  }
31
- return h ? t : e.href;
30
+ return a ? t : e.href;
32
31
  } catch (o) {
33
32
  if (o instanceof i) {
34
33
  if (r) throw o;
@@ -39,5 +38,5 @@ function f(t, {
39
38
  }
40
39
  }
41
40
  export {
42
- f as getSafeUrl
41
+ h as getSafeUrl
43
42
  };
@@ -1,15 +1,12 @@
1
- const l = "wallet_url", c = () => {
2
- var o, t;
3
- return window.localStorage.getItem(l) || ((o = window.env) == null ? void 0 : o.webWalletUrl) || ((t = window.blocklet) == null ? void 0 : t.webWalletUrl) || "https://web.abtwallet.io/";
4
- }, w = (o) => {
5
- const { protocol: t } = window.location;
6
- let e = "";
1
+ const l = "wallet_url", c = () => window.localStorage.getItem(l) || window.env?.webWalletUrl || window.blocklet?.webWalletUrl || "https://web.abtwallet.io/", w = (t) => {
2
+ const { protocol: e } = window.location;
3
+ let o = "";
7
4
  try {
8
- e = new URL(o).protocol;
5
+ o = new URL(t).protocol;
9
6
  } catch {
10
- e = "";
7
+ o = "";
11
8
  }
12
- return t === e;
9
+ return e === o;
13
10
  };
14
11
  export {
15
12
  w as checkSameProtocol,
@@ -1,23 +1,23 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useEffect as c } from "react";
3
- import { Box as l, TextField as y } from "@mui/material";
4
- import n from "lodash/trim";
5
- import a from "lodash/noop";
6
- import { mergeSx as b } from "../Util/style.js";
7
- const d = 6;
8
- function j({
9
- length: i = d,
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useEffect as s } from "react";
3
+ import { Box as c, TextField as l } from "@mui/material";
4
+ import p from "lodash/trim";
5
+ import m from "lodash/noop";
6
+ import { mergeSx as g } from "../Util/style.js";
7
+ const y = 6;
8
+ function B({
9
+ length: r = y,
10
10
  code: e,
11
- onChange: u = a,
12
- onComplete: p = a,
13
- sx: s = {}
11
+ onChange: u = m,
12
+ onComplete: a = m,
13
+ sx: f = {}
14
14
  }) {
15
- return c(() => {
16
- e.length === i && (p == null || p(e));
17
- }, [e, i]), /* @__PURE__ */ f(
18
- l,
15
+ return s(() => {
16
+ e.length === r && a?.(e);
17
+ }, [e, r]), /* @__PURE__ */ i(
18
+ c,
19
19
  {
20
- sx: b(
20
+ sx: g(
21
21
  {
22
22
  width: "100%",
23
23
  maxWidth: 360,
@@ -25,22 +25,20 @@ function j({
25
25
  justifyContent: "space-between",
26
26
  gap: 1.5
27
27
  },
28
- s
28
+ f
29
29
  ),
30
- children: [...Array(i)].map((w, t) => /* @__PURE__ */ f(
31
- y,
30
+ children: [...Array(r)].map((b, t) => /* @__PURE__ */ i(
31
+ l,
32
32
  {
33
33
  id: `code-input-${t}`,
34
- value: n(e[t]) || "",
34
+ value: p(e[t]) || "",
35
35
  type: "number",
36
36
  onChange: (o) => {
37
- var m;
38
- const r = e.split("");
39
- r[t] = o.target.value, u == null || u(r.join("")), o.target.value && t < 5 && ((m = document.getElementById(`code-input-${t + 1}`)) == null || m.focus());
37
+ const n = e.split("");
38
+ n[t] = o.target.value, u?.(n.join("")), o.target.value && t < 5 && document.getElementById(`code-input-${t + 1}`)?.focus();
40
39
  },
41
40
  onKeyDown: (o) => {
42
- var r;
43
- o.key === "Backspace" && !n(e[t]) && t > 0 && ((r = document.getElementById(`code-input-${t - 1}`)) == null || r.focus());
41
+ o.key === "Backspace" && !p(e[t]) && t > 0 && document.getElementById(`code-input-${t - 1}`)?.focus();
44
42
  },
45
43
  required: !0,
46
44
  autoComplete: "off",
@@ -67,6 +65,6 @@ function j({
67
65
  );
68
66
  }
69
67
  export {
70
- d as VERIFY_CODE_LENGTH,
71
- j as default
68
+ y as VERIFY_CODE_LENGTH,
69
+ B as default
72
70
  };
@@ -1,23 +1,20 @@
1
- import { useCreation as l } from "ahooks";
1
+ import { useCreation as g } from "ahooks";
2
2
  import { useTheme as u } from "@mui/material";
3
3
  import "../Theme/theme.js";
4
4
  import "../Theme/theme-provider.js";
5
5
  import f from "./use-mobile.js";
6
- function d({
7
- key: L = "sm",
8
- meta: p = {},
6
+ function M({
7
+ key: l = "sm",
8
+ meta: o = {},
9
9
  theme: t = {},
10
- square: n
10
+ square: e
11
11
  } = {}) {
12
- const c = f({ key: L }), a = u(), e = l(() => {
13
- var o;
14
- return ((o = t == null ? void 0 : t.palette) == null ? void 0 : o.mode) || a.palette.mode;
15
- }, [a, t]);
16
- return l(() => {
17
- const { appLogo: o, appLogoDark: s, appLogoRect: r, appLogoRectDark: m } = Object.assign({}, window.blocklet ?? {}, p), g = e === "dark", i = (g ? s : o) || o;
18
- return c || n ? i : (g ? m || s : r) || r || i || "";
19
- }, [e, p, c, n]);
12
+ const p = f({ key: l }), r = u(), n = g(() => t?.palette?.mode || r.palette.mode, [r, t]);
13
+ return g(() => {
14
+ const { appLogo: c, appLogoDark: s, appLogoRect: a, appLogoRectDark: L } = Object.assign({}, window.blocklet ?? {}, o), i = n === "dark", m = (i ? s : c) || c;
15
+ return p || e ? m : (i ? L || s : a) || a || m || "";
16
+ }, [n, o, p, e]);
20
17
  }
21
18
  export {
22
- d as default
19
+ M as default
23
20
  };