@txnlab/use-wallet 3.11.1 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1197 -1183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1197 -1183
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -30,44 +30,45 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/.pnpm/@magic-sdk+types@24.
|
|
34
|
-
var p,
|
|
33
|
+
// ../../node_modules/.pnpm/@magic-sdk+types@24.18.0/node_modules/@magic-sdk/types/dist/es/index.mjs
|
|
34
|
+
var p, l, m, v, u, _, z, f, g, E, x, y, A, R, I, N, h, T, O, S, b, C, F, U, k, w, L, D, V, G, H, q, W, J, Y, B, P, j, Q;
|
|
35
35
|
var init_es = __esm({
|
|
36
|
-
"../../node_modules/.pnpm/@magic-sdk+types@24.
|
|
36
|
+
"../../node_modules/.pnpm/@magic-sdk+types@24.18.0/node_modules/@magic-sdk/types/dist/es/index.mjs"() {
|
|
37
37
|
"use strict";
|
|
38
38
|
p = ((r) => (r.MissingApiKey = "MISSING_API_KEY", r.ModalNotReady = "MODAL_NOT_READY", r.MalformedResponse = "MALFORMED_RESPONSE", r.InvalidArgument = "INVALID_ARGUMENT", r.ExtensionNotInitialized = "EXTENSION_NOT_INITIALIZED", r.IncompatibleExtensions = "INCOMPATIBLE_EXTENSIONS", r))(p || {});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
v = ((
|
|
42
|
-
u = ((t) => (t.
|
|
39
|
+
l = ((a2) => (a2.SyncWeb3Method = "SYNC_WEB3_METHOD", a2.DuplicateIframe = "DUPLICATE_IFRAME", a2.ReactNativeEndpointConfiguration = "REACT_NATIVE_ENDPOINT_CONFIGURATION", a2.DeprecationNotice = "DEPRECATION_NOTICE", a2.ProductAnnouncement = "ANNOUNCEMENT", a2))(l || {});
|
|
40
|
+
m = ((i) => (i[i.ParseError = -32700] = "ParseError", i[i.InvalidRequest = -32600] = "InvalidRequest", i[i.MethodNotFound = -32601] = "MethodNotFound", i[i.InvalidParams = -32602] = "InvalidParams", i[i.InternalError = -32603] = "InternalError", i[i.MagicLinkFailedVerification = -1e4] = "MagicLinkFailedVerification", i[i.MagicLinkExpired = -10001] = "MagicLinkExpired", i[i.MagicLinkRateLimited = -10002] = "MagicLinkRateLimited", i[i.MagicLinkInvalidRedirectURL = -10006] = "MagicLinkInvalidRedirectURL", i[i.UserAlreadyLoggedIn = -10003] = "UserAlreadyLoggedIn", i[i.UpdateEmailFailed = -10004] = "UpdateEmailFailed", i[i.UserRequestEditEmail = -10005] = "UserRequestEditEmail", i[i.InactiveRecipient = -10010] = "InactiveRecipient", i[i.AccessDeniedToUser = -10011] = "AccessDeniedToUser", i[i.RedirectLoginComplete = -10015] = "RedirectLoginComplete", i))(m || {});
|
|
41
|
+
v = ((t) => (t.PROVIDER = "magic_3pw_provider", t.ADDRESS = "magic_3pw_address", t.CHAIN_ID = "magic_3pw_chainId", t))(v || {});
|
|
42
|
+
u = ((t) => (t.WalletConnected = "wallet_connected", t.WalletRejected = "wallet_rejected", t.Web3ModalSelected = "web3modal_selected", t))(u || {});
|
|
43
43
|
_ = ((e) => (e.LoginWithSms = "magic_auth_login_with_sms", e.LoginWithEmailOTP = "magic_auth_login_with_email_otp", e.LoginWithMagicLink = "magic_auth_login_with_magic_link", e.LoginWithCredential = "magic_auth_login_with_credential", e.SetAuthorizationToken = "magic_auth_set_authorization_token", e.GetIdToken = "magic_auth_get_id_token", e.GenerateIdToken = "magic_auth_generate_id_token", e.GetMetadata = "magic_auth_get_metadata", e.IsLoggedIn = "magic_is_logged_in", e.Logout = "magic_auth_logout", e.UpdateEmail = "magic_auth_update_email", e.UserSettings = "magic_auth_settings", e.UserSettingsTestMode = "magic_auth_settings_testing_mode", e.LoginWithSmsTestMode = "magic_auth_login_with_sms_testing_mode", e.LoginWithEmailOTPTestMode = "magic_auth_login_with_email_otp_testing_mode", e.LoginWithMagicLinkTestMode = "magic_login_with_magic_link_testing_mode", e.LoginWithCredentialTestMode = "magic_auth_login_with_credential_testing_mode", e.GetIdTokenTestMode = "magic_auth_get_id_token_testing_mode", e.GenerateIdTokenTestMode = "magic_auth_generate_id_token_testing_mode", e.GetMetadataTestMode = "magic_auth_get_metadata_testing_mode", e.IsLoggedInTestMode = "magic_auth_is_logged_in_testing_mode", e.LogoutTestMode = "magic_auth_logout_testing_mode", e.UpdateEmailTestMode = "magic_auth_update_email_testing_mode", e.IntermediaryEvent = "magic_intermediary_event", e.RequestAccounts = "eth_requestAccounts", e.GetInfo = "magic_get_info", e.ShowUI = "magic_wallet", e.NFTPurchase = "magic_nft_purchase", e.NFTCheckout = "magic_nft_checkout", e.NFTTransfer = "magic_nft_transfer", e.RequestUserInfoWithUI = "mc_request_user_info", e.Disconnect = "mc_disconnect", e.RecoverAccount = "magic_auth_recover_account", e.RecoverAccountTestMode = "magic_auth_recover_account_testing_mode", e.MagicBoxHeartBeat = "magic_box_heart_beat", e.AutoConnect = "mc_auto_connect", e.Login = "mc_login", e.EncryptV1 = "magic_auth_encrypt_v1", e.DecryptV1 = "magic_auth_decrypt_v1", e.ShowNFTs = "magic_show_nfts", e.ShowOnRamp = "magic_show_fiat_onramp", e.ShowSendTokensUI = "magic_show_send_tokens_ui", e.ShowAddress = "magic_show_address", e.ShowBalances = "magic_show_balances", e.SendGaslessTransaction = "eth_sendGaslessTransaction", e.RevealPK = "magic_reveal_key", e.EnableMFA = "magic_auth_enable_mfa_flow", e.DisableMFA = "magic_auth_disable_mfa_flow", e))(_ || {});
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
z = ["magic_intermediary_event", "magic_nft_checkout", "mc_login"];
|
|
45
|
+
f = ((c2) => (c2.MAGIC_HANDLE_RESPONSE = "MAGIC_HANDLE_RESPONSE", c2.MAGIC_OVERLAY_READY = "MAGIC_OVERLAY_READY", c2.MAGIC_SHOW_OVERLAY = "MAGIC_SHOW_OVERLAY", c2.MAGIC_HIDE_OVERLAY = "MAGIC_HIDE_OVERLAY", c2.MAGIC_HANDLE_EVENT = "MAGIC_HANDLE_EVENT", c2.MAGIC_MG_BOX_SEND_RECEIPT = "MAGIC_MG_BOX_SEND_RECEIPT", c2.MAGIC_SEND_PRODUCT_ANNOUNCEMENT = "MAGIC_SEND_PRODUCT_ANNOUNCEMENT", c2.MAGIC_PONG = "MAGIC_PONG", c2.MAGIC_POPUP_RESPONSE = "MAGIC_POPUP_RESPONSE", c2.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE = "MAGIC_POPUP_OAUTH_VERIFY_RESPONSE", c2))(f || {});
|
|
46
|
+
g = ((d) => (d.MAGIC_HANDLE_REQUEST = "MAGIC_HANDLE_REQUEST", d.MAGIC_PING = "MAGIC_PING", d))(g || {});
|
|
46
47
|
E = ((t) => (t.UpdateEmail = "update-email", t.MFA = "mfa", t.Recovery = "recovery", t))(E || {});
|
|
47
48
|
x = ((o) => (o.Retry = "retry", o))(x || {});
|
|
48
|
-
y = ((
|
|
49
|
+
y = ((d) => (d.EmailSent = "email-sent", d.EmailNotDeliverable = "email-not-deliverable", d))(y || {});
|
|
49
50
|
A = ((a2) => (a2.VerifyEmailOtp = "verify-email-otp", a2.VerifyMFACode = "verify-mfa-code", a2.LostDevice = "lost-device", a2.VerifyRecoveryCode = "verify-recovery-code", a2.Cancel = "cancel", a2))(A || {});
|
|
50
51
|
R = ((t) => (t.VerifySmsOtp = "verify-sms-otp", t.Cancel = "cancel", t.Retry = "retry", t))(R || {});
|
|
51
52
|
I = ((t) => (t.SmsOTPSent = "sms-otp-sent", t.InvalidSmsOtp = "invalid-sms-otp", t.ExpiredSmsOtp = "expired-sms-otp", t))(I || {});
|
|
52
53
|
N = ((s) => (s.EmailOTPSent = "email-otp-sent", s.InvalidEmailOtp = "invalid-email-otp", s.InvalidMfaOtp = "invalid-mfa-otp", s.ExpiredEmailOtp = "expired-email-otp", s.MfaSentHandle = "mfa-sent-handle", s.RecoveryCodeSentHandle = "recovery-code-sent-handle", s.InvalidRecoveryCode = "invalid-recovery-code", s.RecoveryCodeSuccess = "recovery-code-success", s))(N || {});
|
|
53
54
|
h = ((o) => (o.Retry = "device-retry", o))(h || {});
|
|
54
55
|
T = ((n) => (n.DeviceApproved = "device-approved", n.DeviceNeedsApproval = "device-needs-approval", n.DeviceVerificationLinkExpired = "device-verification-link-expired", n.DeviceVerificationEmailSent = "device-verification-email-sent", n))(T || {});
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
O = ((n) => (n.Retry = "Recency/auth-factor-retry", n.Cancel = "Recency/auth-factor-verification-cancel", n.VerifyEmailOtp = "Recency/auth-factor-verify-email-otp", n.VerifyMFACode = "Recency/verify-mfa-code", n))(O || {});
|
|
57
|
+
S = ((r) => (r.PrimaryAuthFactorNeedsVerification = "Recency/auth-factor-needs-verification", r.PrimaryAuthFactorVerified = "Recency/auth-factor-verified", r.InvalidEmailOtp = "Recency/auth-factor-invalid-email-otp", r.EmailExpired = "Recency/auth-factor-verification-email-expired", r.EmailSent = "Recency/auth-factor-verification-email-sent", r.EmailNotDeliverable = "Recency/auth-factor-verification-email-not-deliverable", r))(S || {});
|
|
57
58
|
b = ((t) => (t.RetryWithNewEmail = "UpdateEmail/retry-with-new-email", t.Cancel = "UpdateEmail/new-email-verification-cancel", t.VerifyEmailOtp = "UpdateEmail/new-email-verify-otp", t))(b || {});
|
|
58
59
|
C = ((s) => (s.NewAuthFactorNeedsVerification = "UpdateEmail/new-email-needs-verification", s.EmailUpdated = "UpdateEmail/email-updated", s.InvalidEmailOtp = "UpdateEmail/new-email-invalid-email-otp", s.EmailExpired = "UpdateEmail/new-email-verification-email-expired", s.EmailSent = "UpdateEmail/new-email-verification-email-sent", s.EmailNotDeliverable = "UpdateEmail/new-email-verification-email-not-deliverable", s.InvalidEmail = "UpdateEmail/new-email-invalid", s.EmailAlreadyExists = "UpdateEmail/new-email-already-exists", s))(C || {});
|
|
59
60
|
F = ((o) => (o.IDTokenCreated = "Auth/id-token-created", o))(F || {});
|
|
60
|
-
U = ((o) => (o.
|
|
61
|
+
U = ((o) => (o.Cancel = "Farcaster/cancel", o))(U || {});
|
|
61
62
|
k = ((t) => (t.MFASecretGenerated = "mfa-secret-generated", t.InvalidMFAOtp = "invalid-mfa-otp", t.MFARecoveryCodes = "mfa-recovery-codes", t))(k || {});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
w = ((d) => (d.VerifyMFACode = "verify-mfa-code", d.Cancel = "cancel-mfa-setup", d))(w || {});
|
|
64
|
+
L = ((t) => (t.MFACodeRequested = "mfa-code-requested", t.InvalidMFAOtp = "invalid-mfa-otp", t.InvalidRecoveryCode = "invalid-recovery-code", t))(L || {});
|
|
65
|
+
D = ((t) => (t.VerifyMFACode = "verify-mfa-code", t.LostDevice = "lost-device", t.Cancel = "cancel-mfa-disable", t))(D || {});
|
|
65
66
|
V = ((o) => (o.Harmony = "HARMONY", o))(V || {});
|
|
66
|
-
|
|
67
|
+
G = ((o) => (o.ClosedByUser = "closed-by-user", o))(G || {});
|
|
67
68
|
H = ((o) => (o.ClosedByUser = "closed-by-user-on-received", o))(H || {});
|
|
68
69
|
q = ((a2) => (a2.EnterNewPhoneNumber = "enter-new-phone-number", a2.EnterOtpCode = "enter-otp-code", a2.RecoveryFactorAlreadyExists = "recovery-factor-already-exists", a2.MalformedPhoneNumber = "malformed-phone-number", a2.InvalidOtpCode = "invalid-otp-code", a2))(q || {});
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
W = ((n) => (n.SendNewPhoneNumber = "send-new-phone-number", n.SendOtpCode = "send-otp-code", n.Cancel = "cancel", n.StartEditPhoneNumber = "start-edit-phone-number", n))(W || {});
|
|
71
|
+
J = ((o) => (o.PhoneNumber = "phone_number", o))(J || {});
|
|
71
72
|
Y = ((r) => (r.SmsOtpSent = "sms-otp-sent", r.LoginThrottled = "login-throttled", r.InvalidSmsOtp = "invalid-sms-otp", r.SmsVerified = "sms-verified", r.AccountRecovered = "account-recovered", r.UpdateEmailRequired = "update-email-required", r))(Y || {});
|
|
72
73
|
B = ((n) => (n.Cancel = "cancel", n.VerifyOtp = "verify-otp-code", n.ResendSms = "resend-sms-otp", n.UpdateEmail = "update-email", n))(B || {});
|
|
73
74
|
P = ((n) => (n.Success = "nft-checkout-success", n.Failure = "nft-checkout-failure", n.Initiated = "nft-checkout-initiated", n.Disconnect = "disconnect", n))(P || {});
|
|
@@ -76,325 +77,325 @@ var init_es = __esm({
|
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
// ../../node_modules/.pnpm/@magic-sdk+provider@28.
|
|
80
|
-
function
|
|
81
|
-
let
|
|
82
|
-
return
|
|
80
|
+
// ../../node_modules/.pnpm/@magic-sdk+provider@28.20.0_localforage@1.10.0/node_modules/@magic-sdk/provider/dist/es/index.mjs
|
|
81
|
+
function lr(r) {
|
|
82
|
+
let e = { exports: {} };
|
|
83
|
+
return r(e, e.exports), e.exports;
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
-
return String.fromCharCode(parseInt(
|
|
85
|
+
function jr(r) {
|
|
86
|
+
return String.fromCharCode(parseInt(r.slice(1), 16));
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
-
return `%${`00${
|
|
88
|
+
function Vr(r) {
|
|
89
|
+
return `%${`00${r.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
-
return btoa(encodeURIComponent(
|
|
91
|
+
function Hr(r) {
|
|
92
|
+
return btoa(encodeURIComponent(r).replace(/%[0-9A-F]{2}/g, jr));
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
-
return decodeURIComponent(Array.from(atob(
|
|
94
|
+
function Br(r) {
|
|
95
|
+
return decodeURIComponent(Array.from(atob(r), Vr).join(""));
|
|
95
96
|
}
|
|
96
|
-
function Re(
|
|
97
|
-
return
|
|
97
|
+
function Re(r) {
|
|
98
|
+
return Hr(JSON.stringify(r));
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
-
return JSON.parse(
|
|
100
|
+
function gt(r) {
|
|
101
|
+
return JSON.parse(Br(r));
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
return typeof
|
|
103
|
+
function O2(r) {
|
|
104
|
+
return typeof r == "undefined";
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
106
|
+
function Yr(r) {
|
|
107
|
+
return r === null;
|
|
107
108
|
}
|
|
108
|
-
function ve(
|
|
109
|
-
return
|
|
109
|
+
function ve(r) {
|
|
110
|
+
return Yr(r) || O2(r);
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
-
return ve(
|
|
112
|
+
function yt(r) {
|
|
113
|
+
return ve(r) ? false : !O2(r.jsonrpc) && !O2(r.id) && (!O2(r.result) || !O2(r.error));
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
-
return ve(
|
|
115
|
+
function Rt(r) {
|
|
116
|
+
return ve(r) ? false : typeof r == "number" && Object.values(m).includes(r);
|
|
116
117
|
}
|
|
117
|
-
function ce(
|
|
118
|
-
if (!
|
|
119
|
-
for (let
|
|
118
|
+
function ce(r) {
|
|
119
|
+
if (!r) return true;
|
|
120
|
+
for (let e in r) if (Object.hasOwnProperty.call(r, e)) return false;
|
|
120
121
|
return true;
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
-
return Object.assign(
|
|
123
|
+
function Qr(r, e) {
|
|
124
|
+
return Object.assign(m2, e), r;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
-
return new
|
|
126
|
+
function It() {
|
|
127
|
+
return new C2(p.MissingApiKey, "Please provide an API key that you acquired from the Magic developer dashboard.");
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
return new
|
|
129
|
+
function Tt() {
|
|
130
|
+
return new C2(p.ModalNotReady, "Modal is not ready.");
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
-
return new
|
|
132
|
+
function bt() {
|
|
133
|
+
return new C2(p.MalformedResponse, "Response from the Magic iframe is malformed.");
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
-
return new
|
|
135
|
+
function Pt(r) {
|
|
136
|
+
return new C2(p.ExtensionNotInitialized, `Extensions must be initialized with a Magic SDK instance before \`Extension.${r}\` can be accessed. Do not invoke \`Extension.${r}\` inside an extension constructor.`);
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
-
let
|
|
139
|
-
return
|
|
140
|
-
let
|
|
141
|
-
typeof
|
|
142
|
-
- Extension \`${
|
|
143
|
-
- Extension \`${
|
|
144
|
-
}), new
|
|
138
|
+
function wt(r) {
|
|
139
|
+
let e = `Some extensions are incompatible with \`${m2.sdkName}@${m2.version}\`:`;
|
|
140
|
+
return r.filter((t) => typeof t.compat != "undefined" && t.compat !== null).forEach((t) => {
|
|
141
|
+
let n = t.compat[m2.sdkName];
|
|
142
|
+
typeof n == "string" ? e += `
|
|
143
|
+
- Extension \`${t.name}\` supports version(s) \`${n}\`` : n || (e += `
|
|
144
|
+
- Extension \`${t.name}\` does not support ${m2.platform} environments.`);
|
|
145
|
+
}), new C2(p.IncompatibleExtensions, e);
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
-
let
|
|
148
|
-
let
|
|
149
|
-
return o === 1 && s !== 11 ? `${
|
|
147
|
+
function xt(r) {
|
|
148
|
+
let e = (t) => {
|
|
149
|
+
let n = t + 1, o = n % 10, s = n % 100;
|
|
150
|
+
return o === 1 && s !== 11 ? `${n}st` : o === 2 && s !== 12 ? `${n}nd` : o === 3 && s !== 13 ? `${n}rd` : `${n}th`;
|
|
150
151
|
};
|
|
151
|
-
return new
|
|
152
|
-
Expected: \`${
|
|
153
|
-
Received: \`${
|
|
154
|
-
}
|
|
155
|
-
function Vr() {
|
|
156
|
-
return new W2(m.DuplicateIframe, "Duplicate iframes found.");
|
|
152
|
+
return new C2(p.InvalidArgument, `Invalid ${e(r.argument)} argument given to \`${r.procedure}\`.
|
|
153
|
+
Expected: \`${r.expected}\`
|
|
154
|
+
Received: \`${r.received}\``);
|
|
157
155
|
}
|
|
158
|
-
function
|
|
159
|
-
return new
|
|
156
|
+
function Xn() {
|
|
157
|
+
return new F2(l.DuplicateIframe, "Duplicate iframes found.");
|
|
160
158
|
}
|
|
161
159
|
function Mt() {
|
|
162
|
-
return new
|
|
160
|
+
return new F2(l.SyncWeb3Method, "Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");
|
|
163
161
|
}
|
|
164
|
-
function
|
|
165
|
-
|
|
166
|
-
return new W2(m.DeprecationNotice, i);
|
|
162
|
+
function St() {
|
|
163
|
+
return new F2(l.ReactNativeEndpointConfiguration, `CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${m2.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`);
|
|
167
164
|
}
|
|
168
|
-
function
|
|
169
|
-
let n =
|
|
170
|
-
|
|
165
|
+
function W2(r) {
|
|
166
|
+
let { method: e, removalVersions: t, useInstead: n } = r, o = t[m2.sdkName], s = n ? ` Use \`${n}\` instead.` : "", i = `\`${e}\` will be removed from \`${m2.sdkName}\` in version \`${o}\`.${s}`;
|
|
167
|
+
return new F2(l.DeprecationNotice, i);
|
|
171
168
|
}
|
|
172
|
-
function
|
|
173
|
-
|
|
169
|
+
function* en() {
|
|
170
|
+
let r = 0;
|
|
171
|
+
for (; ; ) r < Number.MAX_SAFE_INTEGER ? yield ++r : r = 0;
|
|
174
172
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
173
|
+
function We() {
|
|
174
|
+
return tn.next().value;
|
|
177
175
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
176
|
+
function At(r) {
|
|
177
|
+
return Object.defineProperty(r, Nt, { value: true, enumerable: false }), r;
|
|
180
178
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
return tr(n) || (n.jsonrpc = (t = n.jsonrpc) != null ? t : "2.0", n.id = qe(), n.method = (e = n.method) != null ? e : "noop", n.params = (r = n.params) != null ? r : [], Ct(n)), n;
|
|
179
|
+
function rn(r) {
|
|
180
|
+
return !!r[Nt];
|
|
184
181
|
}
|
|
185
|
-
function
|
|
186
|
-
|
|
182
|
+
function H2(r) {
|
|
183
|
+
var e, t, n;
|
|
184
|
+
return rn(r) || (r.jsonrpc = (e = r.jsonrpc) != null ? e : "2.0", r.id = We(), r.method = (t = r.method) != null ? t : "noop", r.params = (n = r.params) != null ? n : [], At(r)), r;
|
|
185
|
+
}
|
|
186
|
+
function u2(r, e = []) {
|
|
187
|
+
return At({ params: e, method: r, jsonrpc: "2.0", id: We() });
|
|
187
188
|
}
|
|
188
189
|
function be() {
|
|
189
|
-
let
|
|
190
|
-
return { emitter:
|
|
190
|
+
let r = new Ge();
|
|
191
|
+
return { emitter: r, createChainingEmitterMethod: (n, o) => (...s) => (r[n].apply(r, s), o), createBoundEmitterMethod: (n) => (...o) => r[n].apply(r, o) };
|
|
191
192
|
}
|
|
192
|
-
function
|
|
193
|
-
return !!
|
|
193
|
+
function _t(r) {
|
|
194
|
+
return !!r[Ot];
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
-
let
|
|
197
|
-
let v2 = p2[
|
|
196
|
+
function x2(r) {
|
|
197
|
+
let e = Ke(r), { createBoundEmitterMethod: t, createChainingEmitterMethod: n } = be(), o = Symbol("Promise.then"), s = Symbol("Promise.catch"), i = Symbol("Promise.finally"), a2 = (d, p2) => (...M) => {
|
|
198
|
+
let v2 = p2[d].apply(p2, M);
|
|
198
199
|
return c2(v2);
|
|
199
|
-
}, c2 = (
|
|
200
|
-
throw
|
|
200
|
+
}, c2 = (d) => Object.assign(d, { [Ot]: true, [o]: d[o] || d.then, [s]: d[s] || d.catch, [i]: d[i] || d.finally, then: a2(o, d), catch: a2(s, d), finally: a2(i, d), on: n("on", d), once: n("once", d), addListener: n("addListener", d), off: n("off", d), removeListener: n("removeListener", d), removeAllListeners: n("removeAllListeners", d), emit: t("emit"), eventNames: t("eventNames"), listeners: t("listeners"), listenerCount: t("listenerCount") }), l2 = c2(e.then((d) => (l2.emit("done", d), l2.emit("settled"), d), (d) => {
|
|
201
|
+
throw l2.emit("error", d), l2.emit("settled"), d;
|
|
201
202
|
}));
|
|
202
|
-
return
|
|
203
|
-
|
|
204
|
-
}),
|
|
203
|
+
return l2.on(H.ClosedByUser, () => {
|
|
204
|
+
l2.emit(G.ClosedByUser);
|
|
205
|
+
}), l2;
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
-
return new Promise((
|
|
208
|
-
let
|
|
209
|
-
Promise.resolve(
|
|
207
|
+
function Ke(r) {
|
|
208
|
+
return new Promise((e, t) => {
|
|
209
|
+
let n = r(e, t);
|
|
210
|
+
Promise.resolve(n).catch(t);
|
|
210
211
|
});
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
-
let [
|
|
214
|
-
return
|
|
213
|
+
function kt(r, e) {
|
|
214
|
+
let [t] = r.split(".").map(Number);
|
|
215
|
+
return t >= e;
|
|
215
216
|
}
|
|
216
|
-
function K(
|
|
217
|
-
return (...
|
|
218
|
-
return
|
|
217
|
+
function K(r) {
|
|
218
|
+
return (...e) => f2(this, null, function* () {
|
|
219
|
+
return xe || (xe = yield m2.configureStorage()), yield xe.ready(), xe[r](...e);
|
|
219
220
|
});
|
|
220
221
|
}
|
|
221
|
-
function
|
|
222
|
-
let
|
|
223
|
-
|
|
224
|
-
let
|
|
225
|
-
return
|
|
222
|
+
function qt() {
|
|
223
|
+
let r = window.crypto.getRandomValues(new Uint8Array(16));
|
|
224
|
+
r[6] = r[6] & 15 | 64, r[8] = r[8] & 191 | 128;
|
|
225
|
+
let e = "";
|
|
226
|
+
return e += r[0].toString(16), e += r[1].toString(16), e += r[2].toString(16), e += r[3].toString(16), e += "-", e += r[4].toString(16), e += r[5].toString(16), e += "-", e += r[6].toString(16), e += r[7].toString(16), e += "-", e += r[8].toString(16), e += r[9].toString(16), e += "-", e += r[10].toString(16), e += r[11].toString(16), e += r[12].toString(16), e += r[13].toString(16), e += r[14].toString(16), e += r[15].toString(16), e;
|
|
226
227
|
}
|
|
227
228
|
function pe() {
|
|
228
|
-
let
|
|
229
|
-
return
|
|
229
|
+
let r = typeof window != "undefined" && !!window.crypto, e = r && !!window.crypto.subtle;
|
|
230
|
+
return r && e;
|
|
230
231
|
}
|
|
231
|
-
function
|
|
232
|
-
return
|
|
233
|
-
let
|
|
234
|
-
if (!
|
|
232
|
+
function Wt() {
|
|
233
|
+
return f2(this, null, function* () {
|
|
234
|
+
let r = yield yn();
|
|
235
|
+
if (!r) {
|
|
235
236
|
console.info("unable to create public key or webcrypto is unsupported");
|
|
236
237
|
return;
|
|
237
238
|
}
|
|
238
|
-
let { subtle:
|
|
239
|
-
if (!
|
|
239
|
+
let { subtle: e } = window.crypto, t = yield b2(Ve);
|
|
240
|
+
if (!t || !e) {
|
|
240
241
|
console.info("unable to find private key or webcrypto unsupported");
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
|
-
let
|
|
244
|
+
let n = { iat: Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3), jti: qt() }, o = { typ: "dpop+jwt", alg: "ES256", jwk: r }, s = { protected: Ut(JSON.stringify(o)), claims: Ut(JSON.stringify(n)) }, i = vn(`${s.protected}.${s.claims}`), a2 = { name: Ft, hash: { name: "SHA-256" } }, c2 = Tn(new Uint8Array(yield e.sign(a2, t, i)));
|
|
244
245
|
return `${s.protected}.${s.claims}.${c2}`;
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
|
-
function
|
|
248
|
-
return
|
|
248
|
+
function yn() {
|
|
249
|
+
return f2(this, null, function* () {
|
|
249
250
|
if (!pe()) {
|
|
250
251
|
console.info("webcrypto is not supported");
|
|
251
252
|
return;
|
|
252
253
|
}
|
|
253
|
-
return (yield
|
|
254
|
+
return (yield b2(Me)) || (yield Rn()), b2(Me);
|
|
254
255
|
});
|
|
255
256
|
}
|
|
256
|
-
function
|
|
257
|
-
return
|
|
258
|
-
let { subtle:
|
|
259
|
-
yield
|
|
257
|
+
function Rn() {
|
|
258
|
+
return f2(this, null, function* () {
|
|
259
|
+
let { subtle: r } = window.crypto, e = yield r.generateKey(gn, false, ["sign"]), t = yield r.exportKey("jwk", e.publicKey);
|
|
260
|
+
yield S2(Ve, e.privateKey), yield S2(Me, t);
|
|
260
261
|
});
|
|
261
262
|
}
|
|
262
|
-
function
|
|
263
|
-
return
|
|
263
|
+
function Ut(r) {
|
|
264
|
+
return Jt(In(r));
|
|
264
265
|
}
|
|
265
|
-
function
|
|
266
|
-
return new TextEncoder().encode(
|
|
266
|
+
function vn(r) {
|
|
267
|
+
return new TextEncoder().encode(r);
|
|
267
268
|
}
|
|
268
|
-
function
|
|
269
|
-
return btoa(
|
|
269
|
+
function Jt(r) {
|
|
270
|
+
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+/g, "");
|
|
270
271
|
}
|
|
271
|
-
function
|
|
272
|
-
return encodeURIComponent(
|
|
272
|
+
function In(r) {
|
|
273
|
+
return encodeURIComponent(r).replace(/%([0-9A-F]{2})/g, (t, n) => String.fromCharCode(parseInt(n, 16)));
|
|
273
274
|
}
|
|
274
|
-
function
|
|
275
|
-
let
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
}),
|
|
275
|
+
function Tn(r) {
|
|
276
|
+
let e = "";
|
|
277
|
+
return r.forEach((t) => {
|
|
278
|
+
e += String.fromCharCode(t);
|
|
279
|
+
}), Jt(e);
|
|
279
280
|
}
|
|
280
281
|
function te() {
|
|
281
|
-
return
|
|
282
|
-
let
|
|
283
|
-
yield
|
|
284
|
-
|
|
282
|
+
return f2(this, null, function* () {
|
|
283
|
+
let r = [];
|
|
284
|
+
yield je((e, t, n) => {
|
|
285
|
+
t.startsWith(`${He}_`) && r.push(t);
|
|
285
286
|
});
|
|
286
|
-
for (let
|
|
287
|
+
for (let e of r) yield k2(e);
|
|
287
288
|
});
|
|
288
289
|
}
|
|
289
|
-
function
|
|
290
|
-
let
|
|
291
|
-
for (let o = 0; o <
|
|
292
|
-
return window.btoa(
|
|
290
|
+
function Gt(r) {
|
|
291
|
+
let e = "", t = new Uint8Array(r), n = t.byteLength;
|
|
292
|
+
for (let o = 0; o < n; o++) e += String.fromCharCode(t[o]);
|
|
293
|
+
return window.btoa(e);
|
|
293
294
|
}
|
|
294
|
-
function
|
|
295
|
-
let
|
|
296
|
-
for (let o = 0; o <
|
|
297
|
-
return
|
|
295
|
+
function Kt(r) {
|
|
296
|
+
let e = window.atob(r), t = e.length, n = new Uint8Array(t);
|
|
297
|
+
for (let o = 0; o < t; o++) n[o] = e.charCodeAt(o);
|
|
298
|
+
return n.buffer;
|
|
298
299
|
}
|
|
299
|
-
function
|
|
300
|
-
return
|
|
300
|
+
function Pn() {
|
|
301
|
+
return f2(this, null, function* () {
|
|
301
302
|
if (!pe()) {
|
|
302
303
|
console.info("webcrypto is not supported");
|
|
303
304
|
return;
|
|
304
305
|
}
|
|
305
|
-
let { crypto:
|
|
306
|
-
return
|
|
306
|
+
let { crypto: r } = window, e = yield b2(Xe);
|
|
307
|
+
return e || r.getRandomValues(new Uint8Array(12));
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
-
return
|
|
310
|
+
function wn() {
|
|
311
|
+
return f2(this, null, function* () {
|
|
311
312
|
if (!pe()) {
|
|
312
313
|
console.info("webcrypto is not supported");
|
|
313
314
|
return;
|
|
314
315
|
}
|
|
315
|
-
let { subtle:
|
|
316
|
-
return
|
|
316
|
+
let { subtle: r } = window.crypto, e = yield b2(Be);
|
|
317
|
+
return e || (yield r.generateKey({ name: ze, length: bn }, false, ["encrypt", "decrypt"]));
|
|
317
318
|
});
|
|
318
319
|
}
|
|
319
|
-
function
|
|
320
|
-
return
|
|
321
|
-
let
|
|
322
|
-
if (!
|
|
323
|
-
let o =
|
|
324
|
-
yield
|
|
320
|
+
function jt(r, e) {
|
|
321
|
+
return f2(this, null, function* () {
|
|
322
|
+
let t = yield Pn(), n = yield wn();
|
|
323
|
+
if (!t || !n || !r) return;
|
|
324
|
+
let o = Kt(r), { subtle: s } = window.crypto, i = yield s.encrypt({ name: ze, iv: t }, n, o), a2 = Gt(i);
|
|
325
|
+
yield S2(`${He}_${e}`, a2), yield S2(Be, n), yield S2(Xe, t);
|
|
325
326
|
});
|
|
326
327
|
}
|
|
327
|
-
function
|
|
328
|
-
return
|
|
329
|
-
let
|
|
330
|
-
if (!
|
|
331
|
-
let { subtle: o } = window.crypto, s = yield o.decrypt({ name:
|
|
332
|
-
return
|
|
328
|
+
function Vt(r) {
|
|
329
|
+
return f2(this, null, function* () {
|
|
330
|
+
let e = yield b2(`${He}_${r}`), t = yield b2(Xe), n = yield b2(Be);
|
|
331
|
+
if (!t || !e || !n || !pe()) return;
|
|
332
|
+
let { subtle: o } = window.crypto, s = yield o.decrypt({ name: ze, iv: t }, n, Kt(e));
|
|
333
|
+
return Gt(s);
|
|
333
334
|
});
|
|
334
335
|
}
|
|
335
|
-
function
|
|
336
|
-
return
|
|
336
|
+
function Ye(r, e) {
|
|
337
|
+
return e ? new URL(r, e) : new URL(r);
|
|
337
338
|
}
|
|
338
|
-
function
|
|
339
|
-
let
|
|
340
|
-
for (;
|
|
341
|
-
return
|
|
339
|
+
function Mn(r) {
|
|
340
|
+
let e = Object.getPrototypeOf(r), t = [e];
|
|
341
|
+
for (; e !== R2.prototype; ) e = Object.getPrototypeOf(e), t.push(e);
|
|
342
|
+
return t;
|
|
342
343
|
}
|
|
343
|
-
function
|
|
344
|
-
return
|
|
344
|
+
function zt(r) {
|
|
345
|
+
return r.compat && r.compat[m2.sdkName] != null ? typeof r.compat[m2.sdkName] == "string" ? ft(Et(m2.version), r.compat[m2.sdkName]) : !!r.compat[m2.sdkName] : true;
|
|
345
346
|
}
|
|
346
|
-
function
|
|
347
|
-
return !
|
|
347
|
+
function Sn(r, e, t) {
|
|
348
|
+
return !e && !t ? `${r}_eth_mainnet` : t ? `${r}_${JSON.stringify(t)}` : e ? typeof e == "string" ? `${r}_eth_${e}` : `${r}_${e.rpcUrl}_${e.chainId}_${e.chainType}` : `${r}_unknown`;
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
+
function Nn(r) {
|
|
350
351
|
var o;
|
|
351
|
-
let
|
|
352
|
-
if (Array.isArray(
|
|
353
|
-
|
|
354
|
-
}) : Object.keys(
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
let i =
|
|
358
|
-
this[s] = i, i instanceof
|
|
359
|
-
} else
|
|
360
|
-
}),
|
|
361
|
-
return
|
|
352
|
+
let e = (o = r == null ? void 0 : r.extensions) != null ? o : [], t = {}, n = [];
|
|
353
|
+
if (Array.isArray(e) ? e.forEach((s) => {
|
|
354
|
+
zt(s) ? (s.init(this), (s.name || s.name !== D2.Anonymous) && (this[s.name] = s), s instanceof D2.Internal && (ce(s.config) || (t[s.name] = s.config))) : n.push(s);
|
|
355
|
+
}) : Object.keys(e).forEach((s) => {
|
|
356
|
+
if (zt(e[s])) {
|
|
357
|
+
e[s].init(this);
|
|
358
|
+
let i = e[s];
|
|
359
|
+
this[s] = i, i instanceof D2.Internal && (ce(i.config) || (t[e[s].name] = i.config));
|
|
360
|
+
} else n.push(e[s]);
|
|
361
|
+
}), n.length) throw wt(n);
|
|
362
|
+
return t;
|
|
362
363
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
364
|
+
function Cn(r, e) {
|
|
365
|
+
return e && Array.isArray(r) ? r.find((t) => t.id === e) : r;
|
|
365
366
|
}
|
|
366
|
-
function
|
|
367
|
+
function $n(r, e) {
|
|
367
368
|
var o;
|
|
368
|
-
let
|
|
369
|
-
if (
|
|
370
|
-
let s = new J2(
|
|
371
|
-
return { id:
|
|
369
|
+
let t = (o = e.data.response) == null ? void 0 : o.id, n = Cn(r, t);
|
|
370
|
+
if (t && n) {
|
|
371
|
+
let s = new J2(n).applyResult(e.data.response.result).applyError(e.data.response.error);
|
|
372
|
+
return { id: t, response: s };
|
|
372
373
|
}
|
|
373
374
|
return {};
|
|
374
375
|
}
|
|
375
|
-
function
|
|
376
|
-
return
|
|
376
|
+
function Ln(r, e, t) {
|
|
377
|
+
return f2(this, null, function* () {
|
|
377
378
|
var a2;
|
|
378
|
-
let
|
|
379
|
-
if (
|
|
380
|
-
o = (a2 = yield
|
|
379
|
+
let n = yield b2("rt"), o;
|
|
380
|
+
if (m2.platform === "web") try {
|
|
381
|
+
o = (a2 = yield b2("jwt")) != null ? a2 : yield Wt();
|
|
381
382
|
} catch (c2) {
|
|
382
383
|
console.error("webcrypto error", c2);
|
|
383
384
|
}
|
|
384
|
-
let s = { msgType:
|
|
385
|
-
o && (s.jwt = o), o &&
|
|
386
|
-
let i = yield
|
|
385
|
+
let s = { msgType: r, payload: e };
|
|
386
|
+
o && (s.jwt = o), o && n && (s.rt = n);
|
|
387
|
+
let i = yield Vt(t);
|
|
387
388
|
return i && (s.deviceShare = i), s;
|
|
388
389
|
});
|
|
389
390
|
}
|
|
390
|
-
function
|
|
391
|
-
return
|
|
392
|
-
!
|
|
391
|
+
function On(r) {
|
|
392
|
+
return f2(this, null, function* () {
|
|
393
|
+
!r.data.rt || (yield S2("rt", r.data.rt));
|
|
393
394
|
});
|
|
394
395
|
}
|
|
395
|
-
var
|
|
396
|
+
var Qt, fe, Zt, er, tr, rr, rt, nr, st, sr, nt, q2, z2, or, ir, ar, cr, f2, $t, dr, Fe, ur, h2, ae, ot, ht, pr, mr, it, Ee, at, ct, oe, E2, hr, Y2, fr, Er, gr, yr, Rr, vr, Ir, Tr, br, Pr, wr, xr, Mr, Ue, ie, U2, lt, dt, L2, I2, y2, Sr, Nr, Ar, ut, Cr, P2, $r, Lr, Or, _r, kr, Dr, qr, Ur, Fr, Wr, ft, Jr, pt, mt, Gr, Kr, ge, ye, Et, m2, vt, C2, _2, F2, Q2, le, tn, Nt, J2, Lt, Ge, Ot, R2, B2, we, ue, xe, b2, S2, k2, pn, mn, hn, fn, je, Ve, Me, Ft, En, gn, He, Be, Xe, ze, bn, Ne, Ae, $e, Le, se, Oe, Xt, _e, Qe, D2, De, me, qe, et;
|
|
396
397
|
var init_es2 = __esm({
|
|
397
|
-
"../../node_modules/.pnpm/@magic-sdk+provider@28.
|
|
398
|
+
"../../node_modules/.pnpm/@magic-sdk+provider@28.20.0_localforage@1.10.0/node_modules/@magic-sdk/provider/dist/es/index.mjs"() {
|
|
398
399
|
"use strict";
|
|
399
400
|
init_es();
|
|
400
401
|
init_es();
|
|
@@ -406,198 +407,199 @@ var init_es2 = __esm({
|
|
|
406
407
|
init_es();
|
|
407
408
|
init_es();
|
|
408
409
|
init_es();
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
410
|
+
init_es();
|
|
411
|
+
Qt = Object.create;
|
|
412
|
+
fe = Object.defineProperty;
|
|
413
|
+
Zt = Object.defineProperties;
|
|
414
|
+
er = Object.getOwnPropertyDescriptor;
|
|
415
|
+
tr = Object.getOwnPropertyDescriptors;
|
|
416
|
+
rr = Object.getOwnPropertyNames;
|
|
417
|
+
rt = Object.getOwnPropertySymbols;
|
|
418
|
+
nr = Object.getPrototypeOf;
|
|
419
|
+
st = Object.prototype.hasOwnProperty;
|
|
420
|
+
sr = Object.prototype.propertyIsEnumerable;
|
|
421
|
+
nt = (r, e, t) => e in r ? fe(r, e, { enumerable: true, configurable: true, writable: true, value: t }) : r[e] = t;
|
|
422
|
+
q2 = (r, e) => {
|
|
423
|
+
for (var t in e || (e = {})) st.call(e, t) && nt(r, t, e[t]);
|
|
424
|
+
if (rt) for (var t of rt(e)) sr.call(e, t) && nt(r, t, e[t]);
|
|
425
|
+
return r;
|
|
424
426
|
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
for (var
|
|
427
|
+
z2 = (r, e) => Zt(r, tr(e));
|
|
428
|
+
or = (r, e) => () => (e || r((e = { exports: {} }).exports, e), e.exports);
|
|
429
|
+
ir = (r, e) => {
|
|
430
|
+
for (var t in e) fe(r, t, { get: e[t], enumerable: true });
|
|
429
431
|
};
|
|
430
|
-
|
|
431
|
-
if (
|
|
432
|
-
return
|
|
432
|
+
ar = (r, e, t, n) => {
|
|
433
|
+
if (e && typeof e == "object" || typeof e == "function") for (let o of rr(e)) !st.call(r, o) && o !== t && fe(r, o, { get: () => e[o], enumerable: !(n = er(e, o)) || n.enumerable });
|
|
434
|
+
return r;
|
|
433
435
|
};
|
|
434
|
-
|
|
435
|
-
|
|
436
|
+
cr = (r, e, t) => (t = r != null ? Qt(nr(r)) : {}, ar(e || !r || !r.__esModule ? fe(t, "default", { value: r, enumerable: true }) : t, r));
|
|
437
|
+
f2 = (r, e, t) => new Promise((n, o) => {
|
|
436
438
|
var s = (c2) => {
|
|
437
439
|
try {
|
|
438
|
-
a2(
|
|
439
|
-
} catch (
|
|
440
|
-
o(
|
|
440
|
+
a2(t.next(c2));
|
|
441
|
+
} catch (l2) {
|
|
442
|
+
o(l2);
|
|
441
443
|
}
|
|
442
444
|
}, i = (c2) => {
|
|
443
445
|
try {
|
|
444
|
-
a2(
|
|
445
|
-
} catch (
|
|
446
|
-
o(
|
|
446
|
+
a2(t.throw(c2));
|
|
447
|
+
} catch (l2) {
|
|
448
|
+
o(l2);
|
|
447
449
|
}
|
|
448
|
-
}, a2 = (c2) => c2.done ?
|
|
449
|
-
a2((
|
|
450
|
+
}, a2 = (c2) => c2.done ? n(c2.value) : Promise.resolve(c2.value).then(s, i);
|
|
451
|
+
a2((t = t.apply(r, e)).next());
|
|
450
452
|
});
|
|
451
|
-
|
|
453
|
+
$t = or((ts, Je2) => {
|
|
452
454
|
"use strict";
|
|
453
|
-
var
|
|
455
|
+
var nn = Object.prototype.hasOwnProperty, w2 = "~";
|
|
454
456
|
function de() {
|
|
455
457
|
}
|
|
456
458
|
Object.create && (de.prototype = /* @__PURE__ */ Object.create(null), new de().__proto__ || (w2 = false));
|
|
457
|
-
function
|
|
458
|
-
this.fn =
|
|
459
|
+
function sn(r, e, t) {
|
|
460
|
+
this.fn = r, this.context = e, this.once = t || false;
|
|
459
461
|
}
|
|
460
|
-
function
|
|
461
|
-
if (typeof
|
|
462
|
-
var s = new
|
|
463
|
-
return
|
|
462
|
+
function Ct(r, e, t, n, o) {
|
|
463
|
+
if (typeof t != "function") throw new TypeError("The listener must be a function");
|
|
464
|
+
var s = new sn(t, n || r, o), i = w2 ? w2 + e : e;
|
|
465
|
+
return r._events[i] ? r._events[i].fn ? r._events[i] = [r._events[i], s] : r._events[i].push(s) : (r._events[i] = s, r._eventsCount++), r;
|
|
464
466
|
}
|
|
465
|
-
function Te(
|
|
466
|
-
--
|
|
467
|
+
function Te(r, e) {
|
|
468
|
+
--r._eventsCount === 0 ? r._events = new de() : delete r._events[e];
|
|
467
469
|
}
|
|
468
470
|
function T2() {
|
|
469
471
|
this._events = new de(), this._eventsCount = 0;
|
|
470
472
|
}
|
|
471
473
|
T2.prototype.eventNames = function() {
|
|
472
|
-
var
|
|
473
|
-
if (this._eventsCount === 0) return
|
|
474
|
-
for (
|
|
475
|
-
return Object.getOwnPropertySymbols ?
|
|
474
|
+
var e = [], t, n;
|
|
475
|
+
if (this._eventsCount === 0) return e;
|
|
476
|
+
for (n in t = this._events) nn.call(t, n) && e.push(w2 ? n.slice(1) : n);
|
|
477
|
+
return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(t)) : e;
|
|
476
478
|
};
|
|
477
|
-
T2.prototype.listeners = function(
|
|
478
|
-
var
|
|
479
|
-
if (!
|
|
480
|
-
if (
|
|
481
|
-
for (var o = 0, s =
|
|
479
|
+
T2.prototype.listeners = function(e) {
|
|
480
|
+
var t = w2 ? w2 + e : e, n = this._events[t];
|
|
481
|
+
if (!n) return [];
|
|
482
|
+
if (n.fn) return [n.fn];
|
|
483
|
+
for (var o = 0, s = n.length, i = new Array(s); o < s; o++) i[o] = n[o].fn;
|
|
482
484
|
return i;
|
|
483
485
|
};
|
|
484
|
-
T2.prototype.listenerCount = function(
|
|
485
|
-
var
|
|
486
|
-
return
|
|
486
|
+
T2.prototype.listenerCount = function(e) {
|
|
487
|
+
var t = w2 ? w2 + e : e, n = this._events[t];
|
|
488
|
+
return n ? n.fn ? 1 : n.length : 0;
|
|
487
489
|
};
|
|
488
|
-
T2.prototype.emit = function(
|
|
489
|
-
var a2 = w2 ? w2 +
|
|
490
|
+
T2.prototype.emit = function(e, t, n, o, s, i) {
|
|
491
|
+
var a2 = w2 ? w2 + e : e;
|
|
490
492
|
if (!this._events[a2]) return false;
|
|
491
|
-
var c2 = this._events[a2],
|
|
493
|
+
var c2 = this._events[a2], l2 = arguments.length, d, p2;
|
|
492
494
|
if (c2.fn) {
|
|
493
|
-
switch (c2.once && this.removeListener(
|
|
495
|
+
switch (c2.once && this.removeListener(e, c2.fn, void 0, true), l2) {
|
|
494
496
|
case 1:
|
|
495
497
|
return c2.fn.call(c2.context), true;
|
|
496
498
|
case 2:
|
|
497
|
-
return c2.fn.call(c2.context,
|
|
499
|
+
return c2.fn.call(c2.context, t), true;
|
|
498
500
|
case 3:
|
|
499
|
-
return c2.fn.call(c2.context,
|
|
501
|
+
return c2.fn.call(c2.context, t, n), true;
|
|
500
502
|
case 4:
|
|
501
|
-
return c2.fn.call(c2.context,
|
|
503
|
+
return c2.fn.call(c2.context, t, n, o), true;
|
|
502
504
|
case 5:
|
|
503
|
-
return c2.fn.call(c2.context,
|
|
505
|
+
return c2.fn.call(c2.context, t, n, o, s), true;
|
|
504
506
|
case 6:
|
|
505
|
-
return c2.fn.call(c2.context,
|
|
507
|
+
return c2.fn.call(c2.context, t, n, o, s, i), true;
|
|
506
508
|
}
|
|
507
|
-
for (p2 = 1,
|
|
508
|
-
c2.fn.apply(c2.context,
|
|
509
|
+
for (p2 = 1, d = new Array(l2 - 1); p2 < l2; p2++) d[p2 - 1] = arguments[p2];
|
|
510
|
+
c2.fn.apply(c2.context, d);
|
|
509
511
|
} else {
|
|
510
|
-
var
|
|
511
|
-
for (p2 = 0; p2 <
|
|
512
|
+
var M = c2.length, v2;
|
|
513
|
+
for (p2 = 0; p2 < M; p2++) switch (c2[p2].once && this.removeListener(e, c2[p2].fn, void 0, true), l2) {
|
|
512
514
|
case 1:
|
|
513
515
|
c2[p2].fn.call(c2[p2].context);
|
|
514
516
|
break;
|
|
515
517
|
case 2:
|
|
516
|
-
c2[p2].fn.call(c2[p2].context,
|
|
518
|
+
c2[p2].fn.call(c2[p2].context, t);
|
|
517
519
|
break;
|
|
518
520
|
case 3:
|
|
519
|
-
c2[p2].fn.call(c2[p2].context,
|
|
521
|
+
c2[p2].fn.call(c2[p2].context, t, n);
|
|
520
522
|
break;
|
|
521
523
|
case 4:
|
|
522
|
-
c2[p2].fn.call(c2[p2].context,
|
|
524
|
+
c2[p2].fn.call(c2[p2].context, t, n, o);
|
|
523
525
|
break;
|
|
524
526
|
default:
|
|
525
|
-
if (!
|
|
526
|
-
c2[p2].fn.apply(c2[p2].context,
|
|
527
|
+
if (!d) for (v2 = 1, d = new Array(l2 - 1); v2 < l2; v2++) d[v2 - 1] = arguments[v2];
|
|
528
|
+
c2[p2].fn.apply(c2[p2].context, d);
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
531
|
return true;
|
|
530
532
|
};
|
|
531
|
-
T2.prototype.on = function(
|
|
532
|
-
return
|
|
533
|
+
T2.prototype.on = function(e, t, n) {
|
|
534
|
+
return Ct(this, e, t, n, false);
|
|
533
535
|
};
|
|
534
|
-
T2.prototype.once = function(
|
|
535
|
-
return
|
|
536
|
+
T2.prototype.once = function(e, t, n) {
|
|
537
|
+
return Ct(this, e, t, n, true);
|
|
536
538
|
};
|
|
537
|
-
T2.prototype.removeListener = function(
|
|
538
|
-
var s = w2 ? w2 +
|
|
539
|
+
T2.prototype.removeListener = function(e, t, n, o) {
|
|
540
|
+
var s = w2 ? w2 + e : e;
|
|
539
541
|
if (!this._events[s]) return this;
|
|
540
|
-
if (!
|
|
542
|
+
if (!t) return Te(this, s), this;
|
|
541
543
|
var i = this._events[s];
|
|
542
|
-
if (i.fn) i.fn ===
|
|
544
|
+
if (i.fn) i.fn === t && (!o || i.once) && (!n || i.context === n) && Te(this, s);
|
|
543
545
|
else {
|
|
544
|
-
for (var a2 = 0, c2 = [],
|
|
546
|
+
for (var a2 = 0, c2 = [], l2 = i.length; a2 < l2; a2++) (i[a2].fn !== t || o && !i[a2].once || n && i[a2].context !== n) && c2.push(i[a2]);
|
|
545
547
|
c2.length ? this._events[s] = c2.length === 1 ? c2[0] : c2 : Te(this, s);
|
|
546
548
|
}
|
|
547
549
|
return this;
|
|
548
550
|
};
|
|
549
|
-
T2.prototype.removeAllListeners = function(
|
|
550
|
-
var
|
|
551
|
-
return
|
|
551
|
+
T2.prototype.removeAllListeners = function(e) {
|
|
552
|
+
var t;
|
|
553
|
+
return e ? (t = w2 ? w2 + e : e, this._events[t] && Te(this, t)) : (this._events = new de(), this._eventsCount = 0), this;
|
|
552
554
|
};
|
|
553
555
|
T2.prototype.off = T2.prototype.removeListener;
|
|
554
556
|
T2.prototype.addListener = T2.prototype.on;
|
|
555
557
|
T2.prefixed = w2;
|
|
556
558
|
T2.EventEmitter = T2;
|
|
557
|
-
typeof
|
|
559
|
+
typeof Je2 < "u" && (Je2.exports = T2);
|
|
558
560
|
});
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
561
|
+
dr = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
562
|
+
Fe = { SEMVER_SPEC_VERSION: "2.0.0", MAX_LENGTH: 256, MAX_SAFE_INTEGER: dr, MAX_SAFE_COMPONENT_LENGTH: 16 };
|
|
563
|
+
ur = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...r) => console.error("SEMVER", ...r) : () => {
|
|
562
564
|
};
|
|
563
|
-
|
|
564
|
-
ae =
|
|
565
|
-
let { MAX_SAFE_COMPONENT_LENGTH:
|
|
565
|
+
h2 = ur;
|
|
566
|
+
ae = lr(function(r, e) {
|
|
567
|
+
let { MAX_SAFE_COMPONENT_LENGTH: t } = Fe, n = (e = r.exports = {}).re = [], o = e.src = [], s = e.t = {}, i = 0, a2 = (c2, l2, d) => {
|
|
566
568
|
let p2 = i++;
|
|
567
|
-
|
|
569
|
+
h2(p2, l2), s[c2] = p2, o[p2] = l2, n[p2] = new RegExp(l2, d ? "g" : void 0);
|
|
568
570
|
};
|
|
569
|
-
a2("NUMERICIDENTIFIER", "0|[1-9]\\d*"), a2("NUMERICIDENTIFIERLOOSE", "[0-9]+"), a2("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*"), a2("MAINVERSION", `(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})`), a2("MAINVERSIONLOOSE", `(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})`), a2("PRERELEASEIDENTIFIER", `(?:${o[s.NUMERICIDENTIFIER]}|${o[s.NONNUMERICIDENTIFIER]})`), a2("PRERELEASEIDENTIFIERLOOSE", `(?:${o[s.NUMERICIDENTIFIERLOOSE]}|${o[s.NONNUMERICIDENTIFIER]})`), a2("PRERELEASE", `(?:-(${o[s.PRERELEASEIDENTIFIER]}(?:\\.${o[s.PRERELEASEIDENTIFIER]})*))`), a2("PRERELEASELOOSE", `(?:-?(${o[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[s.PRERELEASEIDENTIFIERLOOSE]})*))`), a2("BUILDIDENTIFIER", "[0-9A-Za-z-]+"), a2("BUILD", `(?:\\+(${o[s.BUILDIDENTIFIER]}(?:\\.${o[s.BUILDIDENTIFIER]})*))`), a2("FULLPLAIN", `v?${o[s.MAINVERSION]}${o[s.PRERELEASE]}?${o[s.BUILD]}?`), a2("FULL", `^${o[s.FULLPLAIN]}$`), a2("LOOSEPLAIN", `[v=\\s]*${o[s.MAINVERSIONLOOSE]}${o[s.PRERELEASELOOSE]}?${o[s.BUILD]}?`), a2("LOOSE", `^${o[s.LOOSEPLAIN]}$`), a2("GTLT", "((?:<|>)?=?)"), a2("XRANGEIDENTIFIERLOOSE", `${o[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), a2("XRANGEIDENTIFIER", `${o[s.NUMERICIDENTIFIER]}|x|X|\\*`), a2("XRANGEPLAIN", `[v=\\s]*(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:${o[s.PRERELEASE]})?${o[s.BUILD]}?)?)?`), a2("XRANGEPLAINLOOSE", `[v=\\s]*(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:${o[s.PRERELEASELOOSE]})?${o[s.BUILD]}?)?)?`), a2("XRANGE", `^${o[s.GTLT]}\\s*${o[s.XRANGEPLAIN]}$`), a2("XRANGELOOSE", `^${o[s.GTLT]}\\s*${o[s.XRANGEPLAINLOOSE]}$`), a2("COERCE", `(^|[^\\d])(\\d{1,${
|
|
571
|
+
a2("NUMERICIDENTIFIER", "0|[1-9]\\d*"), a2("NUMERICIDENTIFIERLOOSE", "[0-9]+"), a2("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*"), a2("MAINVERSION", `(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})`), a2("MAINVERSIONLOOSE", `(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})`), a2("PRERELEASEIDENTIFIER", `(?:${o[s.NUMERICIDENTIFIER]}|${o[s.NONNUMERICIDENTIFIER]})`), a2("PRERELEASEIDENTIFIERLOOSE", `(?:${o[s.NUMERICIDENTIFIERLOOSE]}|${o[s.NONNUMERICIDENTIFIER]})`), a2("PRERELEASE", `(?:-(${o[s.PRERELEASEIDENTIFIER]}(?:\\.${o[s.PRERELEASEIDENTIFIER]})*))`), a2("PRERELEASELOOSE", `(?:-?(${o[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[s.PRERELEASEIDENTIFIERLOOSE]})*))`), a2("BUILDIDENTIFIER", "[0-9A-Za-z-]+"), a2("BUILD", `(?:\\+(${o[s.BUILDIDENTIFIER]}(?:\\.${o[s.BUILDIDENTIFIER]})*))`), a2("FULLPLAIN", `v?${o[s.MAINVERSION]}${o[s.PRERELEASE]}?${o[s.BUILD]}?`), a2("FULL", `^${o[s.FULLPLAIN]}$`), a2("LOOSEPLAIN", `[v=\\s]*${o[s.MAINVERSIONLOOSE]}${o[s.PRERELEASELOOSE]}?${o[s.BUILD]}?`), a2("LOOSE", `^${o[s.LOOSEPLAIN]}$`), a2("GTLT", "((?:<|>)?=?)"), a2("XRANGEIDENTIFIERLOOSE", `${o[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), a2("XRANGEIDENTIFIER", `${o[s.NUMERICIDENTIFIER]}|x|X|\\*`), a2("XRANGEPLAIN", `[v=\\s]*(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:${o[s.PRERELEASE]})?${o[s.BUILD]}?)?)?`), a2("XRANGEPLAINLOOSE", `[v=\\s]*(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:${o[s.PRERELEASELOOSE]})?${o[s.BUILD]}?)?)?`), a2("XRANGE", `^${o[s.GTLT]}\\s*${o[s.XRANGEPLAIN]}$`), a2("XRANGELOOSE", `^${o[s.GTLT]}\\s*${o[s.XRANGEPLAINLOOSE]}$`), a2("COERCE", `(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?(?:$|[^\\d])`), a2("COERCERTL", o[s.COERCE], true), a2("LONETILDE", "(?:~>?)"), a2("TILDETRIM", `(\\s*)${o[s.LONETILDE]}\\s+`, true), e.tildeTrimReplace = "$1~", a2("TILDE", `^${o[s.LONETILDE]}${o[s.XRANGEPLAIN]}$`), a2("TILDELOOSE", `^${o[s.LONETILDE]}${o[s.XRANGEPLAINLOOSE]}$`), a2("LONECARET", "(?:\\^)"), a2("CARETTRIM", `(\\s*)${o[s.LONECARET]}\\s+`, true), e.caretTrimReplace = "$1^", a2("CARET", `^${o[s.LONECARET]}${o[s.XRANGEPLAIN]}$`), a2("CARETLOOSE", `^${o[s.LONECARET]}${o[s.XRANGEPLAINLOOSE]}$`), a2("COMPARATORLOOSE", `^${o[s.GTLT]}\\s*(${o[s.LOOSEPLAIN]})$|^$`), a2("COMPARATOR", `^${o[s.GTLT]}\\s*(${o[s.FULLPLAIN]})$|^$`), a2("COMPARATORTRIM", `(\\s*)${o[s.GTLT]}\\s*(${o[s.LOOSEPLAIN]}|${o[s.XRANGEPLAIN]})`, true), e.comparatorTrimReplace = "$1$2$3", a2("HYPHENRANGE", `^\\s*(${o[s.XRANGEPLAIN]})\\s+-\\s+(${o[s.XRANGEPLAIN]})\\s*$`), a2("HYPHENRANGELOOSE", `^\\s*(${o[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[s.XRANGEPLAINLOOSE]})\\s*$`), a2("STAR", "(<|>)?=?\\s*\\*"), a2("GTE0", "^\\s*>=\\s*0.0.0\\s*$"), a2("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$");
|
|
570
572
|
});
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
let
|
|
574
|
-
return
|
|
573
|
+
ot = /^[0-9]+$/;
|
|
574
|
+
ht = (r, e) => {
|
|
575
|
+
let t = ot.test(r), n = ot.test(e);
|
|
576
|
+
return t && n && (r = +r, e = +e), r === e ? 0 : t && !n ? -1 : n && !t ? 1 : r < e ? -1 : 1;
|
|
575
577
|
};
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
({ MAX_LENGTH:
|
|
579
|
-
({ re:
|
|
580
|
-
({ compareIdentifiers: oe } =
|
|
581
|
-
|
|
582
|
-
constructor(
|
|
583
|
-
if (
|
|
584
|
-
if (
|
|
585
|
-
|
|
586
|
-
} else if (typeof
|
|
587
|
-
if (
|
|
588
|
-
|
|
589
|
-
let
|
|
590
|
-
if (!
|
|
591
|
-
if (this.raw =
|
|
592
|
-
if (this.minor >
|
|
593
|
-
if (this.patch >
|
|
594
|
-
|
|
578
|
+
pr = (r, e) => ht(e, r);
|
|
579
|
+
mr = { compareIdentifiers: ht, rcompareIdentifiers: pr };
|
|
580
|
+
({ MAX_LENGTH: it, MAX_SAFE_INTEGER: Ee } = Fe);
|
|
581
|
+
({ re: at, t: ct } = ae);
|
|
582
|
+
({ compareIdentifiers: oe } = mr);
|
|
583
|
+
E2 = class {
|
|
584
|
+
constructor(e, t) {
|
|
585
|
+
if (t && typeof t == "object" || (t = { loose: !!t, includePrerelease: false }), e instanceof E2) {
|
|
586
|
+
if (e.loose === !!t.loose && e.includePrerelease === !!t.includePrerelease) return e;
|
|
587
|
+
e = e.version;
|
|
588
|
+
} else if (typeof e != "string") throw new TypeError(`Invalid Version: ${e}`);
|
|
589
|
+
if (e.length > it) throw new TypeError(`version is longer than ${it} characters`);
|
|
590
|
+
h2("SemVer", e, t), this.options = t, this.loose = !!t.loose, this.includePrerelease = !!t.includePrerelease;
|
|
591
|
+
let n = e.trim().match(t.loose ? at[ct.LOOSE] : at[ct.FULL]);
|
|
592
|
+
if (!n) throw new TypeError(`Invalid Version: ${e}`);
|
|
593
|
+
if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major > Ee || this.major < 0) throw new TypeError("Invalid major version");
|
|
594
|
+
if (this.minor > Ee || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
595
|
+
if (this.patch > Ee || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
596
|
+
n[4] ? this.prerelease = n[4].split(".").map((o) => {
|
|
595
597
|
if (/^[0-9]+$/.test(o)) {
|
|
596
598
|
let s = +o;
|
|
597
|
-
if (s >= 0 && s <
|
|
599
|
+
if (s >= 0 && s < Ee) return s;
|
|
598
600
|
}
|
|
599
601
|
return o;
|
|
600
|
-
}) : this.prerelease = [], this.build =
|
|
602
|
+
}) : this.prerelease = [], this.build = n[5] ? n[5].split(".") : [], this.format();
|
|
601
603
|
}
|
|
602
604
|
format() {
|
|
603
605
|
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
|
|
@@ -605,53 +607,53 @@ var init_es2 = __esm({
|
|
|
605
607
|
toString() {
|
|
606
608
|
return this.version;
|
|
607
609
|
}
|
|
608
|
-
compare(
|
|
609
|
-
if (
|
|
610
|
-
if (typeof
|
|
611
|
-
|
|
610
|
+
compare(e) {
|
|
611
|
+
if (h2("SemVer.compare", this.version, this.options, e), !(e instanceof E2)) {
|
|
612
|
+
if (typeof e == "string" && e === this.version) return 0;
|
|
613
|
+
e = new E2(e, this.options);
|
|
612
614
|
}
|
|
613
|
-
return
|
|
615
|
+
return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
|
|
614
616
|
}
|
|
615
|
-
compareMain(
|
|
616
|
-
return
|
|
617
|
+
compareMain(e) {
|
|
618
|
+
return e instanceof E2 || (e = new E2(e, this.options)), oe(this.major, e.major) || oe(this.minor, e.minor) || oe(this.patch, e.patch);
|
|
617
619
|
}
|
|
618
|
-
comparePre(
|
|
619
|
-
if (
|
|
620
|
-
if (!this.prerelease.length &&
|
|
621
|
-
if (!this.prerelease.length && !
|
|
622
|
-
let
|
|
620
|
+
comparePre(e) {
|
|
621
|
+
if (e instanceof E2 || (e = new E2(e, this.options)), this.prerelease.length && !e.prerelease.length) return -1;
|
|
622
|
+
if (!this.prerelease.length && e.prerelease.length) return 1;
|
|
623
|
+
if (!this.prerelease.length && !e.prerelease.length) return 0;
|
|
624
|
+
let t = 0;
|
|
623
625
|
do {
|
|
624
|
-
let
|
|
625
|
-
if (
|
|
626
|
+
let n = this.prerelease[t], o = e.prerelease[t];
|
|
627
|
+
if (h2("prerelease compare", t, n, o), n === void 0 && o === void 0) return 0;
|
|
626
628
|
if (o === void 0) return 1;
|
|
627
|
-
if (
|
|
628
|
-
if (
|
|
629
|
-
} while (++
|
|
629
|
+
if (n === void 0) return -1;
|
|
630
|
+
if (n !== o) return oe(n, o);
|
|
631
|
+
} while (++t);
|
|
630
632
|
}
|
|
631
|
-
compareBuild(
|
|
632
|
-
|
|
633
|
-
let
|
|
633
|
+
compareBuild(e) {
|
|
634
|
+
e instanceof E2 || (e = new E2(e, this.options));
|
|
635
|
+
let t = 0;
|
|
634
636
|
do {
|
|
635
|
-
let
|
|
636
|
-
if (
|
|
637
|
+
let n = this.build[t], o = e.build[t];
|
|
638
|
+
if (h2("prerelease compare", t, n, o), n === void 0 && o === void 0) return 0;
|
|
637
639
|
if (o === void 0) return 1;
|
|
638
|
-
if (
|
|
639
|
-
if (
|
|
640
|
-
} while (++
|
|
640
|
+
if (n === void 0) return -1;
|
|
641
|
+
if (n !== o) return oe(n, o);
|
|
642
|
+
} while (++t);
|
|
641
643
|
}
|
|
642
|
-
inc(
|
|
643
|
-
switch (
|
|
644
|
+
inc(e, t) {
|
|
645
|
+
switch (e) {
|
|
644
646
|
case "premajor":
|
|
645
|
-
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre",
|
|
647
|
+
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", t);
|
|
646
648
|
break;
|
|
647
649
|
case "preminor":
|
|
648
|
-
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre",
|
|
650
|
+
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", t);
|
|
649
651
|
break;
|
|
650
652
|
case "prepatch":
|
|
651
|
-
this.prerelease.length = 0, this.inc("patch",
|
|
653
|
+
this.prerelease.length = 0, this.inc("patch", t), this.inc("pre", t);
|
|
652
654
|
break;
|
|
653
655
|
case "prerelease":
|
|
654
|
-
this.prerelease.length === 0 && this.inc("patch",
|
|
656
|
+
this.prerelease.length === 0 && this.inc("patch", t), this.inc("pre", t);
|
|
655
657
|
break;
|
|
656
658
|
case "major":
|
|
657
659
|
this.minor === 0 && this.patch === 0 && this.prerelease.length !== 0 || this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
|
|
@@ -665,245 +667,245 @@ var init_es2 = __esm({
|
|
|
665
667
|
case "pre":
|
|
666
668
|
if (this.prerelease.length === 0) this.prerelease = [0];
|
|
667
669
|
else {
|
|
668
|
-
let
|
|
669
|
-
for (; --
|
|
670
|
-
|
|
670
|
+
let n = this.prerelease.length;
|
|
671
|
+
for (; --n >= 0; ) typeof this.prerelease[n] == "number" && (this.prerelease[n]++, n = -2);
|
|
672
|
+
n === -1 && this.prerelease.push(0);
|
|
671
673
|
}
|
|
672
|
-
|
|
674
|
+
t && (this.prerelease[0] === t ? isNaN(this.prerelease[1]) && (this.prerelease = [t, 0]) : this.prerelease = [t, 0]);
|
|
673
675
|
break;
|
|
674
676
|
default:
|
|
675
|
-
throw new Error(`invalid increment argument: ${
|
|
677
|
+
throw new Error(`invalid increment argument: ${e}`);
|
|
676
678
|
}
|
|
677
679
|
return this.format(), this.raw = this.version, this;
|
|
678
680
|
}
|
|
679
681
|
};
|
|
680
|
-
|
|
681
|
-
Y2 =
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
switch (
|
|
682
|
+
hr = (r, e, t) => new E2(r, t).compare(new E2(e, t));
|
|
683
|
+
Y2 = hr;
|
|
684
|
+
fr = (r, e, t) => Y2(r, e, t) === 0;
|
|
685
|
+
Er = fr;
|
|
686
|
+
gr = (r, e, t) => Y2(r, e, t) !== 0;
|
|
687
|
+
yr = gr;
|
|
688
|
+
Rr = (r, e, t) => Y2(r, e, t) > 0;
|
|
689
|
+
vr = Rr;
|
|
690
|
+
Ir = (r, e, t) => Y2(r, e, t) >= 0;
|
|
691
|
+
Tr = Ir;
|
|
692
|
+
br = (r, e, t) => Y2(r, e, t) < 0;
|
|
693
|
+
Pr = br;
|
|
694
|
+
wr = (r, e, t) => Y2(r, e, t) <= 0;
|
|
695
|
+
xr = wr;
|
|
696
|
+
Mr = (r, e, t, n) => {
|
|
697
|
+
switch (e) {
|
|
696
698
|
case "===":
|
|
697
|
-
return typeof
|
|
699
|
+
return typeof r == "object" && (r = r.version), typeof t == "object" && (t = t.version), r === t;
|
|
698
700
|
case "!==":
|
|
699
|
-
return typeof
|
|
701
|
+
return typeof r == "object" && (r = r.version), typeof t == "object" && (t = t.version), r !== t;
|
|
700
702
|
case "":
|
|
701
703
|
case "=":
|
|
702
704
|
case "==":
|
|
703
|
-
return
|
|
705
|
+
return Er(r, t, n);
|
|
704
706
|
case "!=":
|
|
705
|
-
return
|
|
707
|
+
return yr(r, t, n);
|
|
706
708
|
case ">":
|
|
707
|
-
return
|
|
709
|
+
return vr(r, t, n);
|
|
708
710
|
case ">=":
|
|
709
|
-
return
|
|
711
|
+
return Tr(r, t, n);
|
|
710
712
|
case "<":
|
|
711
|
-
return
|
|
713
|
+
return Pr(r, t, n);
|
|
712
714
|
case "<=":
|
|
713
|
-
return
|
|
715
|
+
return xr(r, t, n);
|
|
714
716
|
default:
|
|
715
|
-
throw new TypeError(`Invalid operator: ${
|
|
717
|
+
throw new TypeError(`Invalid operator: ${e}`);
|
|
716
718
|
}
|
|
717
719
|
};
|
|
718
|
-
|
|
720
|
+
Ue = Mr;
|
|
719
721
|
ie = Symbol("SemVer ANY");
|
|
720
722
|
U2 = class {
|
|
721
723
|
static get ANY() {
|
|
722
724
|
return ie;
|
|
723
725
|
}
|
|
724
|
-
constructor(
|
|
725
|
-
if (
|
|
726
|
-
if (
|
|
727
|
-
|
|
726
|
+
constructor(e, t) {
|
|
727
|
+
if (t && typeof t == "object" || (t = { loose: !!t, includePrerelease: false }), e instanceof U2) {
|
|
728
|
+
if (e.loose === !!t.loose) return e;
|
|
729
|
+
e = e.value;
|
|
728
730
|
}
|
|
729
|
-
|
|
731
|
+
h2("comparator", e, t), this.options = t, this.loose = !!t.loose, this.parse(e), this.semver === ie ? this.value = "" : this.value = this.operator + this.semver.version, h2("comp", this);
|
|
730
732
|
}
|
|
731
|
-
parse(
|
|
732
|
-
let
|
|
733
|
-
if (!
|
|
734
|
-
this.operator =
|
|
733
|
+
parse(e) {
|
|
734
|
+
let t = this.options.loose ? lt[dt.COMPARATORLOOSE] : lt[dt.COMPARATOR], n = e.match(t);
|
|
735
|
+
if (!n) throw new TypeError(`Invalid comparator: ${e}`);
|
|
736
|
+
this.operator = n[1] !== void 0 ? n[1] : "", this.operator === "=" && (this.operator = ""), n[2] ? this.semver = new E2(n[2], this.options.loose) : this.semver = ie;
|
|
735
737
|
}
|
|
736
738
|
toString() {
|
|
737
739
|
return this.value;
|
|
738
740
|
}
|
|
739
|
-
test(
|
|
740
|
-
if (
|
|
741
|
-
if (typeof
|
|
742
|
-
|
|
743
|
-
} catch (
|
|
741
|
+
test(e) {
|
|
742
|
+
if (h2("Comparator.test", e, this.options.loose), this.semver === ie || e === ie) return true;
|
|
743
|
+
if (typeof e == "string") try {
|
|
744
|
+
e = new E2(e, this.options);
|
|
745
|
+
} catch (t) {
|
|
744
746
|
return false;
|
|
745
747
|
}
|
|
746
|
-
return
|
|
748
|
+
return Ue(e, this.operator, this.semver, this.options);
|
|
747
749
|
}
|
|
748
|
-
intersects(
|
|
749
|
-
if (!(
|
|
750
|
-
if (
|
|
751
|
-
if (
|
|
752
|
-
let
|
|
753
|
-
return
|
|
750
|
+
intersects(e, t) {
|
|
751
|
+
if (!(e instanceof U2)) throw new TypeError("a Comparator is required");
|
|
752
|
+
if (t && typeof t == "object" || (t = { loose: !!t, includePrerelease: false }), this.operator === "") return this.value === "" || new L2(e.value, t).test(this.value);
|
|
753
|
+
if (e.operator === "") return e.value === "" || new L2(this.value, t).test(e.semver);
|
|
754
|
+
let n = !(this.operator !== ">=" && this.operator !== ">" || e.operator !== ">=" && e.operator !== ">"), o = !(this.operator !== "<=" && this.operator !== "<" || e.operator !== "<=" && e.operator !== "<"), s = this.semver.version === e.semver.version, i = !(this.operator !== ">=" && this.operator !== "<=" || e.operator !== ">=" && e.operator !== "<="), a2 = Ue(this.semver, "<", e.semver, t) && (this.operator === ">=" || this.operator === ">") && (e.operator === "<=" || e.operator === "<"), c2 = Ue(this.semver, ">", e.semver, t) && (this.operator === "<=" || this.operator === "<") && (e.operator === ">=" || e.operator === ">");
|
|
755
|
+
return n || o || s && i || a2 || c2;
|
|
754
756
|
}
|
|
755
757
|
};
|
|
756
|
-
({ re:
|
|
757
|
-
|
|
758
|
-
constructor(
|
|
759
|
-
if (
|
|
760
|
-
if (
|
|
761
|
-
if (this.options =
|
|
758
|
+
({ re: lt, t: dt } = ae);
|
|
759
|
+
L2 = class {
|
|
760
|
+
constructor(e, t) {
|
|
761
|
+
if (t && typeof t == "object" || (t = { loose: !!t, includePrerelease: false }), e instanceof L2) return e.loose === !!t.loose && e.includePrerelease === !!t.includePrerelease ? e : new L2(e.raw, t);
|
|
762
|
+
if (e instanceof U2) return this.raw = e.value, this.set = [[e]], this.format(), this;
|
|
763
|
+
if (this.options = t, this.loose = !!t.loose, this.includePrerelease = !!t.includePrerelease, this.raw = e, this.set = e.split(/\s*\|\|\s*/).map((n) => this.parseRange(n.trim())).filter((n) => n.length), !this.set.length) throw new TypeError(`Invalid SemVer Range: ${e}`);
|
|
762
764
|
this.format();
|
|
763
765
|
}
|
|
764
766
|
format() {
|
|
765
|
-
return this.range = this.set.map((
|
|
767
|
+
return this.range = this.set.map((e) => e.join(" ").trim()).join("||").trim(), this.range;
|
|
766
768
|
}
|
|
767
769
|
toString() {
|
|
768
770
|
return this.range;
|
|
769
771
|
}
|
|
770
|
-
parseRange(
|
|
771
|
-
let { loose:
|
|
772
|
-
|
|
773
|
-
let
|
|
774
|
-
|
|
775
|
-
let o =
|
|
776
|
-
return
|
|
777
|
-
}
|
|
778
|
-
intersects(
|
|
779
|
-
if (!(
|
|
780
|
-
return this.set.some((
|
|
781
|
-
}
|
|
782
|
-
test(
|
|
783
|
-
if (!
|
|
784
|
-
if (typeof
|
|
785
|
-
|
|
786
|
-
} catch (
|
|
772
|
+
parseRange(e) {
|
|
773
|
+
let { loose: t } = this.options;
|
|
774
|
+
e = e.trim();
|
|
775
|
+
let n = t ? I2[y2.HYPHENRANGELOOSE] : I2[y2.HYPHENRANGE];
|
|
776
|
+
e = e.replace(n, Fr(this.options.includePrerelease)), h2("hyphen replace", e), e = e.replace(I2[y2.COMPARATORTRIM], Sr), h2("comparator trim", e, I2[y2.COMPARATORTRIM]), e = (e = (e = e.replace(I2[y2.TILDETRIM], Nr)).replace(I2[y2.CARETTRIM], Ar)).split(/\s+/).join(" ");
|
|
777
|
+
let o = t ? I2[y2.COMPARATORLOOSE] : I2[y2.COMPARATOR];
|
|
778
|
+
return e.split(" ").map((s) => Cr(s, this.options)).join(" ").split(/\s+/).map((s) => Ur(s, this.options)).filter(this.options.loose ? (s) => !!s.match(o) : () => true).map((s) => new U2(s, this.options));
|
|
779
|
+
}
|
|
780
|
+
intersects(e, t) {
|
|
781
|
+
if (!(e instanceof L2)) throw new TypeError("a Range is required");
|
|
782
|
+
return this.set.some((n) => ut(n, t) && e.set.some((o) => ut(o, t) && n.every((s) => o.every((i) => s.intersects(i, t)))));
|
|
783
|
+
}
|
|
784
|
+
test(e) {
|
|
785
|
+
if (!e) return false;
|
|
786
|
+
if (typeof e == "string") try {
|
|
787
|
+
e = new E2(e, this.options);
|
|
788
|
+
} catch (t) {
|
|
787
789
|
return false;
|
|
788
790
|
}
|
|
789
|
-
for (let
|
|
791
|
+
for (let t = 0; t < this.set.length; t++) if (Wr(this.set[t], e, this.options)) return true;
|
|
790
792
|
return false;
|
|
791
793
|
}
|
|
792
794
|
};
|
|
793
|
-
({ re: I2, t:
|
|
794
|
-
|
|
795
|
-
let
|
|
796
|
-
for (;
|
|
797
|
-
return
|
|
795
|
+
({ re: I2, t: y2, comparatorTrimReplace: Sr, tildeTrimReplace: Nr, caretTrimReplace: Ar } = ae);
|
|
796
|
+
ut = (r, e) => {
|
|
797
|
+
let t = true, n = r.slice(), o = n.pop();
|
|
798
|
+
for (; t && n.length; ) t = n.every((s) => o.intersects(s, e)), o = n.pop();
|
|
799
|
+
return t;
|
|
798
800
|
};
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
let
|
|
804
|
-
return
|
|
801
|
+
Cr = (r, e) => (h2("comp", r, e), r = Or(r, e), h2("caret", r), r = $r(r, e), h2("tildes", r), r = kr(r, e), h2("xrange", r), r = qr(r, e), h2("stars", r), r);
|
|
802
|
+
P2 = (r) => !r || r.toLowerCase() === "x" || r === "*";
|
|
803
|
+
$r = (r, e) => r.trim().split(/\s+/).map((t) => Lr(t, e)).join(" ");
|
|
804
|
+
Lr = (r, e) => {
|
|
805
|
+
let t = e.loose ? I2[y2.TILDELOOSE] : I2[y2.TILDE];
|
|
806
|
+
return r.replace(t, (n, o, s, i, a2) => {
|
|
805
807
|
let c2;
|
|
806
|
-
return
|
|
808
|
+
return h2("tilde", r, n, o, s, i, a2), P2(o) ? c2 = "" : P2(s) ? c2 = `>=${o}.0.0 <${+o + 1}.0.0-0` : P2(i) ? c2 = `>=${o}.${s}.0 <${o}.${+s + 1}.0-0` : a2 ? (h2("replaceTilde pr", a2), c2 = `>=${o}.${s}.${i}-${a2} <${o}.${+s + 1}.0-0`) : c2 = `>=${o}.${s}.${i} <${o}.${+s + 1}.0-0`, h2("tilde return", c2), c2;
|
|
807
809
|
});
|
|
808
810
|
};
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
let
|
|
813
|
-
return
|
|
814
|
-
let
|
|
815
|
-
return
|
|
811
|
+
Or = (r, e) => r.trim().split(/\s+/).map((t) => _r(t, e)).join(" ");
|
|
812
|
+
_r = (r, e) => {
|
|
813
|
+
h2("caret", r, e);
|
|
814
|
+
let t = e.loose ? I2[y2.CARETLOOSE] : I2[y2.CARET], n = e.includePrerelease ? "-0" : "";
|
|
815
|
+
return r.replace(t, (o, s, i, a2, c2) => {
|
|
816
|
+
let l2;
|
|
817
|
+
return h2("caret", r, o, s, i, a2, c2), P2(s) ? l2 = "" : P2(i) ? l2 = `>=${s}.0.0${n} <${+s + 1}.0.0-0` : P2(a2) ? l2 = s === "0" ? `>=${s}.${i}.0${n} <${s}.${+i + 1}.0-0` : `>=${s}.${i}.0${n} <${+s + 1}.0.0-0` : c2 ? (h2("replaceCaret pr", c2), l2 = s === "0" ? i === "0" ? `>=${s}.${i}.${a2}-${c2} <${s}.${i}.${+a2 + 1}-0` : `>=${s}.${i}.${a2}-${c2} <${s}.${+i + 1}.0-0` : `>=${s}.${i}.${a2}-${c2} <${+s + 1}.0.0-0`) : (h2("no pr"), l2 = s === "0" ? i === "0" ? `>=${s}.${i}.${a2}${n} <${s}.${i}.${+a2 + 1}-0` : `>=${s}.${i}.${a2}${n} <${s}.${+i + 1}.0-0` : `>=${s}.${i}.${a2} <${+s + 1}.0.0-0`), h2("caret return", l2), l2;
|
|
816
818
|
});
|
|
817
819
|
};
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
let
|
|
822
|
-
return
|
|
823
|
-
|
|
824
|
-
let
|
|
825
|
-
return o === "=" &&
|
|
820
|
+
kr = (r, e) => (h2("replaceXRanges", r, e), r.split(/\s+/).map((t) => Dr(t, e)).join(" "));
|
|
821
|
+
Dr = (r, e) => {
|
|
822
|
+
r = r.trim();
|
|
823
|
+
let t = e.loose ? I2[y2.XRANGELOOSE] : I2[y2.XRANGE];
|
|
824
|
+
return r.replace(t, (n, o, s, i, a2, c2) => {
|
|
825
|
+
h2("xRange", r, n, o, s, i, a2, c2);
|
|
826
|
+
let l2 = P2(s), d = l2 || P2(i), p2 = d || P2(a2), M = p2;
|
|
827
|
+
return o === "=" && M && (o = ""), c2 = e.includePrerelease ? "-0" : "", l2 ? n = o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && M ? (d && (i = 0), a2 = 0, o === ">" ? (o = ">=", d ? (s = +s + 1, i = 0, a2 = 0) : (i = +i + 1, a2 = 0)) : o === "<=" && (o = "<", d ? s = +s + 1 : i = +i + 1), o === "<" && (c2 = "-0"), n = `${o + s}.${i}.${a2}${c2}`) : d ? n = `>=${s}.0.0${c2} <${+s + 1}.0.0-0` : p2 && (n = `>=${s}.${i}.0${c2} <${s}.${+i + 1}.0-0`), h2("xRange return", n), n;
|
|
826
828
|
});
|
|
827
829
|
};
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
for (let
|
|
833
|
-
if (
|
|
834
|
-
for (let
|
|
835
|
-
let o = n
|
|
836
|
-
if (o.major ===
|
|
830
|
+
qr = (r, e) => (h2("replaceStars", r, e), r.trim().replace(I2[y2.STAR], ""));
|
|
831
|
+
Ur = (r, e) => (h2("replaceGTE0", r, e), r.trim().replace(I2[e.includePrerelease ? y2.GTE0PRE : y2.GTE0], ""));
|
|
832
|
+
Fr = (r) => (e, t, n, o, s, i, a2, c2, l2, d, p2, M, v2) => `${t = P2(n) ? "" : P2(o) ? `>=${n}.0.0${r ? "-0" : ""}` : P2(s) ? `>=${n}.${o}.0${r ? "-0" : ""}` : i ? `>=${t}` : `>=${t}${r ? "-0" : ""}`} ${c2 = P2(l2) ? "" : P2(d) ? `<${+l2 + 1}.0.0-0` : P2(p2) ? `<${l2}.${+d + 1}.0-0` : M ? `<=${l2}.${d}.${p2}-${M}` : r ? `<${l2}.${d}.${+p2 + 1}-0` : `<=${c2}`}`.trim();
|
|
833
|
+
Wr = (r, e, t) => {
|
|
834
|
+
for (let n = 0; n < r.length; n++) if (!r[n].test(e)) return false;
|
|
835
|
+
if (e.prerelease.length && !t.includePrerelease) {
|
|
836
|
+
for (let n = 0; n < r.length; n++) if (h2(r[n].semver), r[n].semver !== U2.ANY && r[n].semver.prerelease.length > 0) {
|
|
837
|
+
let o = r[n].semver;
|
|
838
|
+
if (o.major === e.major && o.minor === e.minor && o.patch === e.patch) return true;
|
|
837
839
|
}
|
|
838
840
|
return false;
|
|
839
841
|
}
|
|
840
842
|
return true;
|
|
841
843
|
};
|
|
842
|
-
|
|
844
|
+
ft = (r, e, t) => {
|
|
843
845
|
try {
|
|
844
|
-
|
|
845
|
-
} catch (
|
|
846
|
+
e = new L2(e, t);
|
|
847
|
+
} catch (n) {
|
|
846
848
|
return false;
|
|
847
849
|
}
|
|
848
|
-
return
|
|
850
|
+
return e.test(r);
|
|
849
851
|
};
|
|
850
|
-
({ MAX_LENGTH:
|
|
851
|
-
({ re:
|
|
852
|
-
|
|
853
|
-
if (
|
|
854
|
-
if (typeof
|
|
852
|
+
({ MAX_LENGTH: Jr } = Fe);
|
|
853
|
+
({ re: pt, t: mt } = ae);
|
|
854
|
+
Gr = (r, e) => {
|
|
855
|
+
if (e && typeof e == "object" || (e = { loose: !!e, includePrerelease: false }), r instanceof E2) return r;
|
|
856
|
+
if (typeof r != "string" || r.length > Jr || !(e.loose ? pt[mt.LOOSE] : pt[mt.FULL]).test(r)) return null;
|
|
855
857
|
try {
|
|
856
|
-
return new
|
|
857
|
-
} catch (
|
|
858
|
+
return new E2(r, e);
|
|
859
|
+
} catch (t) {
|
|
858
860
|
return null;
|
|
859
861
|
}
|
|
860
862
|
};
|
|
861
|
-
|
|
862
|
-
({ re:
|
|
863
|
-
|
|
864
|
-
if (
|
|
865
|
-
if (typeof
|
|
866
|
-
let
|
|
867
|
-
if ((
|
|
868
|
-
let
|
|
869
|
-
for (; (
|
|
870
|
-
ye
|
|
871
|
-
} else
|
|
872
|
-
return
|
|
863
|
+
Kr = Gr;
|
|
864
|
+
({ re: ge, t: ye } = ae);
|
|
865
|
+
Et = (r, e) => {
|
|
866
|
+
if (r instanceof E2) return r;
|
|
867
|
+
if (typeof r == "number" && (r = String(r)), typeof r != "string") return null;
|
|
868
|
+
let t = null;
|
|
869
|
+
if ((e = e || {}).rtl) {
|
|
870
|
+
let n;
|
|
871
|
+
for (; (n = ge[ye.COERCERTL].exec(r)) && (!t || t.index + t[0].length !== r.length); ) t && n.index + n[0].length === t.index + t[0].length || (t = n), ge[ye.COERCERTL].lastIndex = n.index + n[1].length + n[2].length;
|
|
872
|
+
ge[ye.COERCERTL].lastIndex = -1;
|
|
873
|
+
} else t = r.match(ge[ye.COERCE]);
|
|
874
|
+
return t === null ? null : Kr(`${t[2]}.${t[3] || "0"}.${t[4] || "0"}`, e);
|
|
873
875
|
};
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
constructor(
|
|
878
|
-
super(`Magic SDK Error: [${
|
|
879
|
-
this.code =
|
|
880
|
-
this.rawMessage =
|
|
876
|
+
m2 = {};
|
|
877
|
+
vt = { "magic-sdk": "magic-sdk", "@magic-sdk/react-native": "magic-sdk-rn", "@magic-sdk/react-native-bare": "magic-sdk-rn-bare", "@magic-sdk/react-native-expo": "magic-sdk-rn-expo" };
|
|
878
|
+
C2 = class extends Error {
|
|
879
|
+
constructor(t, n) {
|
|
880
|
+
super(`Magic SDK Error: [${t}] ${n}`);
|
|
881
|
+
this.code = t;
|
|
882
|
+
this.rawMessage = n;
|
|
881
883
|
this.__proto__ = Error;
|
|
882
|
-
Object.setPrototypeOf(this,
|
|
884
|
+
Object.setPrototypeOf(this, C2.prototype);
|
|
883
885
|
}
|
|
884
886
|
};
|
|
885
|
-
|
|
886
|
-
constructor(
|
|
887
|
+
_2 = class extends Error {
|
|
888
|
+
constructor(t) {
|
|
887
889
|
super();
|
|
888
890
|
this.__proto__ = Error;
|
|
889
|
-
let
|
|
890
|
-
this.rawMessage = (
|
|
891
|
+
let n = Number(t == null ? void 0 : t.code);
|
|
892
|
+
this.rawMessage = (t == null ? void 0 : t.message) || "Internal error", this.code = Rt(n) ? n : m.InternalError, this.message = `Magic RPC Error: [${this.code}] ${this.rawMessage}`, this.data = (t == null ? void 0 : t.data) || void 0, Object.setPrototypeOf(this, _2.prototype);
|
|
891
893
|
}
|
|
892
894
|
};
|
|
893
|
-
|
|
894
|
-
constructor(
|
|
895
|
-
this.code =
|
|
896
|
-
this.rawMessage =
|
|
897
|
-
this.message = `Magic SDK Warning: [${
|
|
895
|
+
F2 = class {
|
|
896
|
+
constructor(e, t) {
|
|
897
|
+
this.code = e;
|
|
898
|
+
this.rawMessage = t;
|
|
899
|
+
this.message = `Magic SDK Warning: [${e}] ${t}`;
|
|
898
900
|
}
|
|
899
901
|
log() {
|
|
900
902
|
console.warn(this.message);
|
|
901
903
|
}
|
|
902
904
|
};
|
|
903
905
|
Q2 = class extends Error {
|
|
904
|
-
constructor(
|
|
905
|
-
super(`Magic Extension Error (${
|
|
906
|
-
this.code =
|
|
906
|
+
constructor(t, n, o, s) {
|
|
907
|
+
super(`Magic Extension Error (${t.name}): [${n}] ${o}`);
|
|
908
|
+
this.code = n;
|
|
907
909
|
this.rawMessage = o;
|
|
908
910
|
this.data = s;
|
|
909
911
|
this.__proto__ = Error;
|
|
@@ -911,26 +913,26 @@ var init_es2 = __esm({
|
|
|
911
913
|
}
|
|
912
914
|
};
|
|
913
915
|
le = class {
|
|
914
|
-
constructor(
|
|
915
|
-
this.code =
|
|
916
|
-
this.rawMessage =
|
|
917
|
-
this.message = `Magic Extension Warning (${
|
|
916
|
+
constructor(e, t, n) {
|
|
917
|
+
this.code = t;
|
|
918
|
+
this.rawMessage = n;
|
|
919
|
+
this.message = `Magic Extension Warning (${e.name}): [${t}] ${n}`;
|
|
918
920
|
}
|
|
919
921
|
log() {
|
|
920
922
|
console.warn(this.message);
|
|
921
923
|
}
|
|
922
924
|
};
|
|
923
|
-
|
|
924
|
-
|
|
925
|
+
tn = en();
|
|
926
|
+
Nt = Symbol("Payload pre-processed by Magic SDK");
|
|
925
927
|
J2 = class {
|
|
926
|
-
constructor(
|
|
927
|
-
|
|
928
|
+
constructor(e) {
|
|
929
|
+
e instanceof J2 ? (this._jsonrpc = e.payload.jsonrpc, this._id = e.payload.id, this._result = e.payload.result, this._error = e.payload.error) : yt(e) ? (this._jsonrpc = e.jsonrpc, this._id = e.id, this._result = e.result, this._error = e.error) : (this._jsonrpc = e.jsonrpc, this._id = e.id, this._result = void 0, this._error = void 0);
|
|
928
930
|
}
|
|
929
|
-
applyError(
|
|
930
|
-
return this._error =
|
|
931
|
+
applyError(e) {
|
|
932
|
+
return this._error = e, this;
|
|
931
933
|
}
|
|
932
|
-
applyResult(
|
|
933
|
-
return this._result =
|
|
934
|
+
applyResult(e) {
|
|
935
|
+
return this._result = e, this;
|
|
934
936
|
}
|
|
935
937
|
get hasError() {
|
|
936
938
|
return typeof this._error != "undefined" && this._error !== null;
|
|
@@ -942,100 +944,103 @@ var init_es2 = __esm({
|
|
|
942
944
|
return { jsonrpc: this._jsonrpc, id: this._id, result: this._result, error: this._error };
|
|
943
945
|
}
|
|
944
946
|
};
|
|
945
|
-
|
|
946
|
-
|
|
947
|
+
Lt = cr($t());
|
|
948
|
+
Ge = class extends Lt.default {
|
|
947
949
|
};
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
constructor(
|
|
951
|
-
this.sdk =
|
|
950
|
+
Ot = Symbol("isPromiEvent");
|
|
951
|
+
R2 = class {
|
|
952
|
+
constructor(e) {
|
|
953
|
+
this.sdk = e;
|
|
952
954
|
}
|
|
953
955
|
get overlay() {
|
|
954
956
|
return this.sdk.overlay;
|
|
955
957
|
}
|
|
956
|
-
request(
|
|
957
|
-
|
|
958
|
-
e.then((a2)
|
|
959
|
-
|
|
958
|
+
request(e) {
|
|
959
|
+
if (this.sdk.thirdPartyWallets.isConnected && !z.includes(e.method)) return x2((i, a2) => {
|
|
960
|
+
this.sdk.thirdPartyWallets.requestOverride(e).then(i).catch(a2);
|
|
961
|
+
});
|
|
962
|
+
let t = this.overlay.post(g.MAGIC_HANDLE_REQUEST, H2(e)), n = x2((s, i) => {
|
|
963
|
+
t.then((a2) => {
|
|
964
|
+
if (o(), a2.hasError) i(new _2(a2.payload.error));
|
|
960
965
|
else if (a2.hasResult) s(a2.payload.result);
|
|
961
|
-
else throw
|
|
966
|
+
else throw bt();
|
|
962
967
|
}).catch((a2) => {
|
|
963
968
|
o(), i(a2);
|
|
964
969
|
});
|
|
965
970
|
}), o = this.overlay.on(f.MAGIC_HANDLE_EVENT, (s) => {
|
|
966
971
|
var a2;
|
|
967
972
|
let { response: i } = s.data;
|
|
968
|
-
if (i.id ===
|
|
969
|
-
let { event: c2, params:
|
|
970
|
-
|
|
973
|
+
if (i.id === e.id && ((a2 = i.result) == null ? void 0 : a2.event)) {
|
|
974
|
+
let { event: c2, params: l2 = [] } = i.result;
|
|
975
|
+
n.emit(c2, ...l2);
|
|
971
976
|
}
|
|
972
977
|
});
|
|
973
|
-
return
|
|
978
|
+
return n;
|
|
974
979
|
}
|
|
975
|
-
createIntermediaryEvent(
|
|
980
|
+
createIntermediaryEvent(e, t) {
|
|
976
981
|
return (o) => {
|
|
977
|
-
let s = u2(_.IntermediaryEvent, [{ payloadId:
|
|
982
|
+
let s = u2(_.IntermediaryEvent, [{ payloadId: t, eventType: e, args: o }]);
|
|
978
983
|
this.request(s);
|
|
979
984
|
};
|
|
980
985
|
}
|
|
981
986
|
};
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
loginWithMagicLink(
|
|
985
|
-
let
|
|
986
|
-
if (
|
|
987
|
-
|
|
988
|
-
let { email:
|
|
987
|
+
B2 = { "magic-sdk": "v18.0.0", "@magic-sdk/react-native": "v14.0.0", "@magic-sdk/react-native-bare": "v19.0.0", "@magic-sdk/react-native-expo": "v19.0.0" };
|
|
988
|
+
we = class extends R2 {
|
|
989
|
+
loginWithMagicLink(e) {
|
|
990
|
+
let t = m2.sdkName === "@magic-sdk/react-native" || m2.sdkName === "@magic-sdk/react-native-bare" || m2.sdkName === "@magic-sdk/react-native-expo";
|
|
991
|
+
if (t && kt(m2.version, 19)) throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");
|
|
992
|
+
t && W2({ method: "auth.loginWithMagicLink()", removalVersions: B2, useInstead: "auth.loginWithEmailOTP()" }).log();
|
|
993
|
+
let { email: n, showUI: o = true, redirectURI: s, overrides: i, lifespan: a2 } = e, c2 = u2(this.sdk.testMode ? _.LoginWithMagicLinkTestMode : _.LoginWithMagicLink, [{ email: n, showUI: o, redirectURI: s, overrides: i, lifespan: a2 }]);
|
|
989
994
|
return this.request(c2);
|
|
990
995
|
}
|
|
991
|
-
loginWithSMS(
|
|
992
|
-
let { phoneNumber:
|
|
993
|
-
return !
|
|
996
|
+
loginWithSMS(e) {
|
|
997
|
+
let { phoneNumber: t, showUI: n = true, lifespan: o } = e, s = u2(this.sdk.testMode ? _.LoginWithSmsTestMode : _.LoginWithSms, [{ phoneNumber: t, showUI: n, lifespan: o }]), i = this.request(s);
|
|
998
|
+
return !n && i && (i.on(R.VerifySmsOtp, (a2) => {
|
|
994
999
|
this.createIntermediaryEvent(R.VerifySmsOtp, s.id)(a2);
|
|
995
1000
|
}), i.on(R.Cancel, () => {
|
|
996
1001
|
this.createIntermediaryEvent(R.Cancel, s.id)();
|
|
997
1002
|
})), i;
|
|
998
1003
|
}
|
|
999
|
-
loginWithEmailOTP(
|
|
1000
|
-
let { email:
|
|
1004
|
+
loginWithEmailOTP(e) {
|
|
1005
|
+
let { email: t, showUI: n, deviceCheckUI: o, overrides: s, lifespan: i } = e, a2 = u2(this.sdk.testMode ? _.LoginWithEmailOTPTestMode : _.LoginWithEmailOTP, [{ email: t, showUI: n, deviceCheckUI: o, overrides: s, lifespan: i }]), c2 = this.request(a2);
|
|
1001
1006
|
return !o && c2 && c2.on(h.Retry, () => {
|
|
1002
1007
|
this.createIntermediaryEvent(h.Retry, a2.id)();
|
|
1003
|
-
}), !
|
|
1004
|
-
this.createIntermediaryEvent(A.VerifyEmailOtp, a2.id)(
|
|
1005
|
-
}), c2.on(A.VerifyMFACode, (
|
|
1006
|
-
this.createIntermediaryEvent(A.VerifyMFACode, a2.id)(
|
|
1008
|
+
}), !n && c2 && (c2.on(A.VerifyEmailOtp, (l2) => {
|
|
1009
|
+
this.createIntermediaryEvent(A.VerifyEmailOtp, a2.id)(l2);
|
|
1010
|
+
}), c2.on(A.VerifyMFACode, (l2) => {
|
|
1011
|
+
this.createIntermediaryEvent(A.VerifyMFACode, a2.id)(l2);
|
|
1007
1012
|
}), c2.on(A.LostDevice, () => {
|
|
1008
1013
|
this.createIntermediaryEvent(A.LostDevice, a2.id)();
|
|
1009
|
-
}), c2.on(A.VerifyRecoveryCode, (
|
|
1010
|
-
this.createIntermediaryEvent(A.VerifyRecoveryCode, a2.id)(
|
|
1014
|
+
}), c2.on(A.VerifyRecoveryCode, (l2) => {
|
|
1015
|
+
this.createIntermediaryEvent(A.VerifyRecoveryCode, a2.id)(l2);
|
|
1011
1016
|
}), c2.on(A.Cancel, () => {
|
|
1012
1017
|
this.createIntermediaryEvent(A.Cancel, a2.id)();
|
|
1013
1018
|
})), c2;
|
|
1014
1019
|
}
|
|
1015
|
-
loginWithCredential(
|
|
1016
|
-
let { credentialOrQueryString:
|
|
1017
|
-
if (!
|
|
1020
|
+
loginWithCredential(e) {
|
|
1021
|
+
let { credentialOrQueryString: t, lifespan: n } = e || {}, o = t != null ? t : "";
|
|
1022
|
+
if (!t && m2.platform === "web") {
|
|
1018
1023
|
o = window.location.search;
|
|
1019
1024
|
let i = window.location.origin + window.location.pathname;
|
|
1020
1025
|
window.history.replaceState(null, "", i);
|
|
1021
1026
|
}
|
|
1022
|
-
let s = u2(this.sdk.testMode ? _.LoginWithCredentialTestMode : _.LoginWithCredential, [o,
|
|
1027
|
+
let s = u2(this.sdk.testMode ? _.LoginWithCredentialTestMode : _.LoginWithCredential, [o, n]);
|
|
1023
1028
|
return this.request(s);
|
|
1024
1029
|
}
|
|
1025
|
-
setAuthorizationToken(
|
|
1026
|
-
let
|
|
1027
|
-
return this.request(
|
|
1028
|
-
}
|
|
1029
|
-
updateEmailWithUI(
|
|
1030
|
-
let { email:
|
|
1031
|
-
return
|
|
1032
|
-
this.createIntermediaryEvent(
|
|
1033
|
-
}), s.on(
|
|
1034
|
-
this.createIntermediaryEvent(
|
|
1035
|
-
}), s.on(
|
|
1036
|
-
this.createIntermediaryEvent(
|
|
1037
|
-
}), s.on(
|
|
1038
|
-
this.createIntermediaryEvent(
|
|
1030
|
+
setAuthorizationToken(e) {
|
|
1031
|
+
let t = u2(_.SetAuthorizationToken, [{ jwt: e }]);
|
|
1032
|
+
return this.request(t);
|
|
1033
|
+
}
|
|
1034
|
+
updateEmailWithUI(e) {
|
|
1035
|
+
let { email: t, showUI: n = true } = e, o = u2(this.sdk.testMode ? _.UpdateEmailTestMode : _.UpdateEmail, [{ email: t, showUI: n }]), s = this.request(o);
|
|
1036
|
+
return n || (s.on(O.Retry, () => {
|
|
1037
|
+
this.createIntermediaryEvent(O.Retry, o.id)();
|
|
1038
|
+
}), s.on(O.Cancel, () => {
|
|
1039
|
+
this.createIntermediaryEvent(O.Cancel, o.id)();
|
|
1040
|
+
}), s.on(O.VerifyEmailOtp, (i) => {
|
|
1041
|
+
this.createIntermediaryEvent(O.VerifyEmailOtp, o.id)(i);
|
|
1042
|
+
}), s.on(O.VerifyMFACode, (i) => {
|
|
1043
|
+
this.createIntermediaryEvent(O.VerifyMFACode, o.id)(i);
|
|
1039
1044
|
}), s.on(b.RetryWithNewEmail, (i) => {
|
|
1040
1045
|
this.createIntermediaryEvent(b.RetryWithNewEmail, o.id)(i);
|
|
1041
1046
|
}), s.on(b.Cancel, () => {
|
|
@@ -1046,88 +1051,85 @@ var init_es2 = __esm({
|
|
|
1046
1051
|
}
|
|
1047
1052
|
};
|
|
1048
1053
|
ue = {};
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1054
|
+
ir(ue, { clear: () => pn, getItem: () => b2, iterate: () => je, key: () => hn, keys: () => fn, length: () => mn, removeItem: () => k2, setItem: () => S2 });
|
|
1055
|
+
b2 = K("getItem");
|
|
1056
|
+
S2 = K("setItem");
|
|
1057
|
+
k2 = K("removeItem");
|
|
1058
|
+
pn = K("clear");
|
|
1059
|
+
mn = K("length");
|
|
1060
|
+
hn = K("key");
|
|
1061
|
+
fn = K("keys");
|
|
1062
|
+
je = K("iterate");
|
|
1063
|
+
Ve = "STORE_KEY_PRIVATE_KEY";
|
|
1064
|
+
Me = "STORE_KEY_PUBLIC_JWK";
|
|
1065
|
+
Ft = "ECDSA";
|
|
1066
|
+
En = "P-256";
|
|
1067
|
+
gn = { name: Ft, namedCurve: En };
|
|
1068
|
+
He = "ds";
|
|
1069
|
+
Be = "ek";
|
|
1070
|
+
Xe = "iv";
|
|
1071
|
+
ze = "AES-GCM";
|
|
1072
|
+
bn = 256;
|
|
1073
|
+
Ne = class extends R2 {
|
|
1069
1074
|
constructor() {
|
|
1070
1075
|
super(...arguments);
|
|
1071
|
-
this.localForageKey = "mc_active_wallet";
|
|
1072
1076
|
this.localForageIsLoggedInKey = "magic_auth_is_logged_in";
|
|
1073
1077
|
this.userLoggedOutCallbacks = [];
|
|
1074
1078
|
}
|
|
1075
|
-
getIdToken(
|
|
1076
|
-
let
|
|
1077
|
-
return this.request(
|
|
1079
|
+
getIdToken(t) {
|
|
1080
|
+
let n = u2(this.sdk.testMode ? _.GetIdTokenTestMode : _.GetIdToken, [t]);
|
|
1081
|
+
return this.request(n);
|
|
1078
1082
|
}
|
|
1079
|
-
generateIdToken(
|
|
1080
|
-
let
|
|
1081
|
-
return this.request(
|
|
1083
|
+
generateIdToken(t) {
|
|
1084
|
+
let n = u2(this.sdk.testMode ? _.GenerateIdTokenTestMode : _.GenerateIdToken, [t]);
|
|
1085
|
+
return this.request(n);
|
|
1082
1086
|
}
|
|
1083
1087
|
getInfo() {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
return this.request(r);
|
|
1087
|
-
});
|
|
1088
|
+
let t = u2(_.GetInfo, []);
|
|
1089
|
+
return this.request(t);
|
|
1088
1090
|
}
|
|
1089
1091
|
isLoggedIn() {
|
|
1090
|
-
return
|
|
1092
|
+
return x2((t, n) => f2(this, null, function* () {
|
|
1091
1093
|
try {
|
|
1092
1094
|
let o = false;
|
|
1093
|
-
this.sdk.useStorageCache && (o = (yield
|
|
1095
|
+
this.sdk.useStorageCache && (o = (yield b2(this.localForageIsLoggedInKey)) === "true", o && t(true));
|
|
1094
1096
|
let s = u2(this.sdk.testMode ? _.IsLoggedInTestMode : _.IsLoggedIn), i = yield this.request(s);
|
|
1095
|
-
this.sdk.useStorageCache && (i ?
|
|
1097
|
+
this.sdk.useStorageCache && (i ? S2(this.localForageIsLoggedInKey, true) : k2(this.localForageIsLoggedInKey), o && !i && this.emitUserLoggedOut(true)), t(i);
|
|
1096
1098
|
} catch (o) {
|
|
1097
|
-
|
|
1099
|
+
n(o);
|
|
1098
1100
|
}
|
|
1099
1101
|
}));
|
|
1100
1102
|
}
|
|
1101
1103
|
logout() {
|
|
1102
|
-
return
|
|
1104
|
+
return k2(this.localForageIsLoggedInKey), te(), x2((t, n) => f2(this, null, function* () {
|
|
1103
1105
|
try {
|
|
1104
1106
|
let o = u2(this.sdk.testMode ? _.LogoutTestMode : _.Logout), s = yield this.request(o);
|
|
1105
|
-
this.sdk.useStorageCache && this.emitUserLoggedOut(s),
|
|
1107
|
+
this.sdk.useStorageCache && this.emitUserLoggedOut(s), t(s);
|
|
1106
1108
|
} catch (o) {
|
|
1107
|
-
|
|
1109
|
+
n(o);
|
|
1108
1110
|
}
|
|
1109
1111
|
}));
|
|
1110
1112
|
}
|
|
1111
|
-
requestInfoWithUI(
|
|
1112
|
-
let
|
|
1113
|
-
return this.request(
|
|
1114
|
-
}
|
|
1115
|
-
showSettings(
|
|
1116
|
-
let { showUI:
|
|
1117
|
-
return !
|
|
1118
|
-
this.createIntermediaryEvent(
|
|
1119
|
-
}), s.on(
|
|
1120
|
-
this.createIntermediaryEvent(
|
|
1121
|
-
}), s.on(
|
|
1122
|
-
this.createIntermediaryEvent(
|
|
1123
|
-
}), s.on(
|
|
1124
|
-
this.createIntermediaryEvent(
|
|
1125
|
-
}), s.on(
|
|
1126
|
-
this.createIntermediaryEvent(
|
|
1113
|
+
requestInfoWithUI(t) {
|
|
1114
|
+
let n = u2(_.RequestUserInfoWithUI, t ? [t] : []);
|
|
1115
|
+
return this.request(n);
|
|
1116
|
+
}
|
|
1117
|
+
showSettings(t) {
|
|
1118
|
+
let { showUI: n = true } = t || {}, o = u2(this.sdk.testMode ? _.UserSettingsTestMode : _.UserSettings, [t]), s = this.request(o);
|
|
1119
|
+
return !n && s && (s.on(W.SendNewPhoneNumber, (i) => {
|
|
1120
|
+
this.createIntermediaryEvent(W.SendNewPhoneNumber, o.id)(i);
|
|
1121
|
+
}), s.on(W.SendOtpCode, (i) => {
|
|
1122
|
+
this.createIntermediaryEvent(W.SendOtpCode, o.id)(i);
|
|
1123
|
+
}), s.on(W.StartEditPhoneNumber, () => {
|
|
1124
|
+
this.createIntermediaryEvent(W.StartEditPhoneNumber, o.id)();
|
|
1125
|
+
}), s.on(W.Cancel, () => {
|
|
1126
|
+
this.createIntermediaryEvent(W.Cancel, o.id)();
|
|
1127
|
+
}), s.on(O.VerifyEmailOtp, (i) => {
|
|
1128
|
+
this.createIntermediaryEvent(O.VerifyEmailOtp, o.id)(i);
|
|
1127
1129
|
})), s;
|
|
1128
1130
|
}
|
|
1129
|
-
recoverAccount(
|
|
1130
|
-
let { email:
|
|
1131
|
+
recoverAccount(t) {
|
|
1132
|
+
let { email: n, showUI: o } = t, s = u2(this.sdk.testMode ? _.RecoverAccountTestMode : _.RecoverAccount, [{ email: n, showUI: o }]), i = this.request(s);
|
|
1131
1133
|
return !o && i && (i.on(B.Cancel, () => {
|
|
1132
1134
|
this.createIntermediaryEvent(B.Cancel, s.id)();
|
|
1133
1135
|
}), i.on(B.ResendSms, () => {
|
|
@@ -1145,70 +1147,58 @@ var init_es2 = __esm({
|
|
|
1145
1147
|
})), i;
|
|
1146
1148
|
}
|
|
1147
1149
|
revealPrivateKey() {
|
|
1148
|
-
let
|
|
1149
|
-
return this.request(
|
|
1150
|
+
let t = u2(_.RevealPK);
|
|
1151
|
+
return this.request(t);
|
|
1150
1152
|
}
|
|
1151
1153
|
getMetadata() {
|
|
1152
|
-
|
|
1153
|
-
let
|
|
1154
|
-
return this.request(
|
|
1155
|
-
}
|
|
1156
|
-
onUserLoggedOut(
|
|
1157
|
-
this.userLoggedOutCallbacks.push(
|
|
1158
|
-
}
|
|
1159
|
-
enableMFA(
|
|
1160
|
-
let { showUI:
|
|
1161
|
-
return !
|
|
1162
|
-
this.createIntermediaryEvent(
|
|
1163
|
-
}), s.on(
|
|
1164
|
-
this.createIntermediaryEvent(
|
|
1154
|
+
W2({ method: "user.getMetadata()", removalVersions: B2, useInstead: "user.getInfo()" }).log();
|
|
1155
|
+
let t = u2(this.sdk.testMode ? _.GetMetadataTestMode : _.GetMetadata);
|
|
1156
|
+
return this.request(t);
|
|
1157
|
+
}
|
|
1158
|
+
onUserLoggedOut(t) {
|
|
1159
|
+
this.userLoggedOutCallbacks.push(t);
|
|
1160
|
+
}
|
|
1161
|
+
enableMFA(t) {
|
|
1162
|
+
let { showUI: n = true } = t, o = u2(_.EnableMFA, [{ showUI: n }]), s = this.request(o);
|
|
1163
|
+
return !n && s && (s.on(w.VerifyMFACode, (i) => {
|
|
1164
|
+
this.createIntermediaryEvent(w.VerifyMFACode, o.id)(i);
|
|
1165
|
+
}), s.on(w.Cancel, () => {
|
|
1166
|
+
this.createIntermediaryEvent(w.Cancel, o.id)();
|
|
1165
1167
|
})), s;
|
|
1166
1168
|
}
|
|
1167
|
-
disableMFA(
|
|
1168
|
-
let { showUI:
|
|
1169
|
-
return !
|
|
1170
|
-
this.createIntermediaryEvent(
|
|
1171
|
-
}), s.on(
|
|
1172
|
-
this.createIntermediaryEvent(
|
|
1173
|
-
}), s.on(
|
|
1174
|
-
this.createIntermediaryEvent(
|
|
1169
|
+
disableMFA(t) {
|
|
1170
|
+
let { showUI: n = true } = t, o = u2(_.DisableMFA, [{ showUI: n }]), s = this.request(o);
|
|
1171
|
+
return !n && s && (s.on(D.VerifyMFACode, (i) => {
|
|
1172
|
+
this.createIntermediaryEvent(D.VerifyMFACode, o.id)(i);
|
|
1173
|
+
}), s.on(D.LostDevice, (i) => {
|
|
1174
|
+
this.createIntermediaryEvent(D.LostDevice, o.id)(i);
|
|
1175
|
+
}), s.on(D.Cancel, () => {
|
|
1176
|
+
this.createIntermediaryEvent(D.Cancel, o.id)();
|
|
1175
1177
|
})), s;
|
|
1176
1178
|
}
|
|
1177
|
-
emitUserLoggedOut(
|
|
1178
|
-
this.userLoggedOutCallbacks.forEach((
|
|
1179
|
-
|
|
1179
|
+
emitUserLoggedOut(t) {
|
|
1180
|
+
this.userLoggedOutCallbacks.forEach((n) => {
|
|
1181
|
+
n(t);
|
|
1180
1182
|
});
|
|
1181
1183
|
}
|
|
1182
1184
|
};
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
this.localForageKey = "mc_active_wallet";
|
|
1187
|
-
}
|
|
1188
|
-
connectWithUI() {
|
|
1189
|
-
let e = D2((r, o) => m2(this, null, function* () {
|
|
1185
|
+
Ae = class extends R2 {
|
|
1186
|
+
connectWithUI(e) {
|
|
1187
|
+
let t = x2((n, o) => f2(this, null, function* () {
|
|
1190
1188
|
try {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
if (this.isCoinbaseWalletBrowser() && (yield this.isWalletEnabled(v.CoinbaseWallet))) {
|
|
1197
|
-
let l = yield this.autoConnectIfWalletBrowser(v.CoinbaseWallet);
|
|
1198
|
-
r(l);
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
let s = this.getUserEnv(), i = u2(_.Login, [s]), a2 = this.request(i);
|
|
1202
|
-
a2.on(u.WalletSelected, (l) => this.handleWalletSelected(z(X({}, l), { payloadId: i.id }))), a2.on("id-token-created", (l) => {
|
|
1203
|
-
e.emit("id-token-created", l);
|
|
1189
|
+
let s = u2(_.Login, [q2({ enabledWallets: this.sdk.thirdPartyWallets.enabledWallets }, e)]), i = this.request(s);
|
|
1190
|
+
this.sdk.thirdPartyWallets.eventListeners.forEach(({ event: c2, callback: l2 }) => {
|
|
1191
|
+
i.on(c2, () => l2(s.id));
|
|
1192
|
+
}), i.on("id-token-created", (c2) => {
|
|
1193
|
+
t.emit("id-token-created", c2);
|
|
1204
1194
|
});
|
|
1205
|
-
let
|
|
1206
|
-
|
|
1195
|
+
let a2 = yield i;
|
|
1196
|
+
a2.error && o(a2), n(a2);
|
|
1207
1197
|
} catch (s) {
|
|
1208
1198
|
o(s);
|
|
1209
1199
|
}
|
|
1210
1200
|
}));
|
|
1211
|
-
return
|
|
1201
|
+
return t;
|
|
1212
1202
|
}
|
|
1213
1203
|
showUI(e) {
|
|
1214
1204
|
return this.request(u2(_.ShowUI, [e]));
|
|
@@ -1228,116 +1218,115 @@ var init_es2 = __esm({
|
|
|
1228
1218
|
showBalances() {
|
|
1229
1219
|
return this.request(u2(_.ShowBalances));
|
|
1230
1220
|
}
|
|
1231
|
-
sendGaslessTransaction(e,
|
|
1232
|
-
return this.request(u2(_.SendGaslessTransaction, [e,
|
|
1221
|
+
sendGaslessTransaction(e, t) {
|
|
1222
|
+
return this.request(u2(_.SendGaslessTransaction, [e, t]));
|
|
1233
1223
|
}
|
|
1234
1224
|
getInfo() {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
return this.request(r);
|
|
1239
|
-
});
|
|
1225
|
+
W2({ method: "wallet.getInfo()", removalVersions: B2, useInstead: "user.getInfo()" }).log();
|
|
1226
|
+
let e = u2(_.GetInfo, []);
|
|
1227
|
+
return this.request(e);
|
|
1240
1228
|
}
|
|
1241
1229
|
disconnect() {
|
|
1242
|
-
|
|
1230
|
+
W2({ method: "wallet.disconnect()", removalVersions: B2, useInstead: "user.logout()" }).log(), te();
|
|
1243
1231
|
let e = u2(_.Disconnect);
|
|
1244
1232
|
return this.request(e);
|
|
1245
1233
|
}
|
|
1246
1234
|
requestUserInfoWithUI(e) {
|
|
1247
|
-
|
|
1248
|
-
let
|
|
1249
|
-
return this.request(
|
|
1250
|
-
}
|
|
1251
|
-
getProvider() {
|
|
1252
|
-
return m2(this, null, function* () {
|
|
1253
|
-
switch (yield y2(this.localForageKey)) {
|
|
1254
|
-
case v.MetaMask:
|
|
1255
|
-
return this.getMetaMaskProvider();
|
|
1256
|
-
case v.CoinbaseWallet:
|
|
1257
|
-
return this.getCoinbaseProvider();
|
|
1258
|
-
default:
|
|
1259
|
-
return this.sdk.rpcProvider;
|
|
1260
|
-
}
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
isMetaMaskInstalled() {
|
|
1264
|
-
var e, r, o;
|
|
1265
|
-
return ((e = window.ethereum) == null ? void 0 : e.isMetaMask) || !!((o = (r = window.ethereum) == null ? void 0 : r.providers) != null && o.find((s) => s == null ? void 0 : s.isMetaMask));
|
|
1235
|
+
W2({ method: "wallet.requestUserInfoWithUI()", removalVersions: B2, useInstead: "user.requestUserInfoWithUI()" }).log();
|
|
1236
|
+
let t = u2(_.RequestUserInfoWithUI, e ? [e] : []);
|
|
1237
|
+
return this.request(t);
|
|
1266
1238
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1239
|
+
};
|
|
1240
|
+
$e = class extends R2 {
|
|
1241
|
+
constructor() {
|
|
1242
|
+
super(...arguments);
|
|
1243
|
+
this.eventListeners = [];
|
|
1244
|
+
this.enabledWallets = {};
|
|
1245
|
+
this.isConnected = false;
|
|
1246
|
+
}
|
|
1247
|
+
resetThirdPartyWalletState() {
|
|
1248
|
+
localStorage.removeItem(v.PROVIDER), localStorage.removeItem(v.ADDRESS), localStorage.removeItem(v.CHAIN_ID), this.isConnected = false;
|
|
1249
|
+
}
|
|
1250
|
+
requestOverride(t) {
|
|
1251
|
+
if (t.method === _.Login) return this.resetThirdPartyWalletState(), super.request(t);
|
|
1252
|
+
if (t.method === _.GetInfo) return this.getInfo(t);
|
|
1253
|
+
if (t.method === _.IsLoggedIn) return this.isLoggedIn(t);
|
|
1254
|
+
if (t.method === _.Logout) return this.logout(t);
|
|
1255
|
+
switch (localStorage.getItem(v.PROVIDER)) {
|
|
1256
|
+
case "web3modal":
|
|
1257
|
+
return this.web3modalRequest(t);
|
|
1258
|
+
default:
|
|
1259
|
+
return this.resetThirdPartyWalletState(), super.request(t);
|
|
1278
1260
|
}
|
|
1279
|
-
return this.getMetaMaskProvider().request({ method: "eth_requestAccounts" });
|
|
1280
|
-
}
|
|
1281
|
-
isCoinbaseWalletInstalled() {
|
|
1282
|
-
var e, r, o;
|
|
1283
|
-
return ((e = window.ethereum) == null ? void 0 : e.isCoinbaseWallet) || !!((o = (r = window.ethereum) == null ? void 0 : r.providers) != null && o.find((s) => s == null ? void 0 : s.isCoinbaseWallet));
|
|
1284
|
-
}
|
|
1285
|
-
isCoinbaseWalletBrowser() {
|
|
1286
|
-
var e;
|
|
1287
|
-
return !!((e = window.ethereum) != null && e.isCoinbaseBrowser);
|
|
1288
1261
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
let r = `https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;
|
|
1296
|
-
window.location.href = r;
|
|
1262
|
+
isLoggedIn(t) {
|
|
1263
|
+
switch (localStorage.getItem(v.PROVIDER)) {
|
|
1264
|
+
case "web3modal":
|
|
1265
|
+
return this.web3modalIsLoggedIn();
|
|
1266
|
+
default:
|
|
1267
|
+
return this.resetThirdPartyWalletState(), super.request(t);
|
|
1297
1268
|
}
|
|
1298
|
-
return this.getCoinbaseProvider().request({ method: "eth_requestAccounts" });
|
|
1299
|
-
}
|
|
1300
|
-
isMobile() {
|
|
1301
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent);
|
|
1302
1269
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1270
|
+
getInfo(t) {
|
|
1271
|
+
switch (localStorage.getItem(v.PROVIDER)) {
|
|
1272
|
+
case "web3modal":
|
|
1273
|
+
return this.web3modalGetInfo();
|
|
1274
|
+
default:
|
|
1275
|
+
return this.resetThirdPartyWalletState(), super.request(t);
|
|
1276
|
+
}
|
|
1305
1277
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
return this.connectToCoinbaseWallet();
|
|
1278
|
+
logout(t) {
|
|
1279
|
+
let n = localStorage.getItem(v.PROVIDER);
|
|
1280
|
+
switch (this.resetThirdPartyWalletState(), n) {
|
|
1281
|
+
case "web3modal":
|
|
1282
|
+
return this.web3modalLogout();
|
|
1312
1283
|
default:
|
|
1313
|
-
|
|
1284
|
+
return super.request(t);
|
|
1314
1285
|
}
|
|
1315
1286
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1287
|
+
web3modalRequest(t) {
|
|
1288
|
+
return x2((n, o) => {
|
|
1289
|
+
this.sdk.web3modal.modal.getWalletProvider().request(t).then(n).catch(o);
|
|
1290
|
+
});
|
|
1319
1291
|
}
|
|
1320
|
-
|
|
1321
|
-
return
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1292
|
+
web3modalIsLoggedIn() {
|
|
1293
|
+
return x2((t) => {
|
|
1294
|
+
let n = this.sdk.web3modal.modal.getStatus();
|
|
1295
|
+
if (n === "connected" && t(true), n === "disconnected" && (this.resetThirdPartyWalletState(), t(false)), n === "reconnecting") {
|
|
1296
|
+
let o = this.sdk.web3modal.modal.subscribeProvider(({ status: s }) => {
|
|
1297
|
+
s === "connected" && (o(), t(true)), s === "disconnected" && (o(), this.resetThirdPartyWalletState(), t(false));
|
|
1298
|
+
});
|
|
1327
1299
|
}
|
|
1328
1300
|
});
|
|
1329
1301
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1302
|
+
formatWeb3modalGetInfoResponse() {
|
|
1303
|
+
var o;
|
|
1304
|
+
let t = (o = this.sdk.web3modal.modal.getWalletInfo()) == null ? void 0 : o.name, n = this.sdk.web3modal.modal.getAddress();
|
|
1305
|
+
return { publicAddress: n, email: null, issuer: `did:ethr:${n}`, phoneNumber: null, isMfaEnabled: false, recoveryFactors: [], walletType: t || "web3modal" };
|
|
1306
|
+
}
|
|
1307
|
+
web3modalGetInfo() {
|
|
1308
|
+
return x2((t, n) => {
|
|
1309
|
+
let o = this.sdk.web3modal.modal.getStatus();
|
|
1310
|
+
if (o === "connected" && t(this.formatWeb3modalGetInfoResponse()), o === "disconnected" && (this.resetThirdPartyWalletState(), n("Magic RPC Error: [-32603] Internal error: User denied account access.")), o === "reconnecting") {
|
|
1311
|
+
let s = this.sdk.web3modal.modal.subscribeProvider(({ status: i }) => {
|
|
1312
|
+
i === "connected" && (s(), t(this.formatWeb3modalGetInfoResponse())), i === "disconnected" && (s(), this.resetThirdPartyWalletState(), n("Magic RPC Error: [-32603] Internal error: User denied account access."));
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1336
1315
|
});
|
|
1337
1316
|
}
|
|
1317
|
+
web3modalLogout() {
|
|
1318
|
+
return x2((t) => f2(this, null, function* () {
|
|
1319
|
+
try {
|
|
1320
|
+
yield this.sdk.web3modal.modal.disconnect();
|
|
1321
|
+
} catch (n) {
|
|
1322
|
+
console.error(n);
|
|
1323
|
+
}
|
|
1324
|
+
t(true);
|
|
1325
|
+
}));
|
|
1326
|
+
}
|
|
1338
1327
|
};
|
|
1339
|
-
({ createBoundEmitterMethod:
|
|
1340
|
-
|
|
1328
|
+
({ createBoundEmitterMethod: Le, createChainingEmitterMethod: se } = be());
|
|
1329
|
+
Oe = class extends R2 {
|
|
1341
1330
|
constructor() {
|
|
1342
1331
|
super(...arguments);
|
|
1343
1332
|
this.isMagic = true;
|
|
@@ -1347,174 +1336,183 @@ var init_es2 = __esm({
|
|
|
1347
1336
|
this.off = se("off", this);
|
|
1348
1337
|
this.removeListener = se("removeListener", this);
|
|
1349
1338
|
this.removeAllListeners = se("removeAllListeners", this);
|
|
1350
|
-
this.emit =
|
|
1351
|
-
this.eventNames =
|
|
1352
|
-
this.listeners =
|
|
1353
|
-
this.listenerCount =
|
|
1354
|
-
}
|
|
1355
|
-
sendAsync(
|
|
1356
|
-
if (!
|
|
1357
|
-
if (Array.isArray(
|
|
1358
|
-
let s =
|
|
1339
|
+
this.emit = Le("emit");
|
|
1340
|
+
this.eventNames = Le("eventNames");
|
|
1341
|
+
this.listeners = Le("listeners");
|
|
1342
|
+
this.listenerCount = Le("listenerCount");
|
|
1343
|
+
}
|
|
1344
|
+
sendAsync(t, n) {
|
|
1345
|
+
if (!n) throw xt({ procedure: "Magic.rpcProvider.sendAsync", argument: 1, expected: "function", received: n === null ? "null" : typeof n });
|
|
1346
|
+
if (Array.isArray(t)) this.overlay.post(g.MAGIC_HANDLE_REQUEST, t.map((o) => {
|
|
1347
|
+
let s = H2(o);
|
|
1359
1348
|
return this.prefixPayloadMethodForTestMode(s), s;
|
|
1360
1349
|
})).then((o) => {
|
|
1361
|
-
|
|
1350
|
+
n(null, o.map((s) => z2(q2({}, s.payload), { error: s.hasError ? new _2(s.payload.error) : null })));
|
|
1362
1351
|
});
|
|
1363
1352
|
else {
|
|
1364
|
-
let o =
|
|
1353
|
+
let o = H2(t);
|
|
1365
1354
|
this.prefixPayloadMethodForTestMode(o), this.overlay.post(g.MAGIC_HANDLE_REQUEST, o).then((s) => {
|
|
1366
|
-
|
|
1355
|
+
n(s.hasError ? new _2(s.payload.error) : null, s.payload);
|
|
1367
1356
|
});
|
|
1368
1357
|
}
|
|
1369
1358
|
}
|
|
1370
|
-
send(
|
|
1371
|
-
if (typeof
|
|
1372
|
-
let s = u2(
|
|
1359
|
+
send(t, n) {
|
|
1360
|
+
if (typeof t == "string") {
|
|
1361
|
+
let s = u2(t, Array.isArray(n) ? n : []);
|
|
1373
1362
|
return this.request(s);
|
|
1374
1363
|
}
|
|
1375
|
-
if (Array.isArray(
|
|
1376
|
-
this.sendAsync(
|
|
1364
|
+
if (Array.isArray(t) || !!n) {
|
|
1365
|
+
this.sendAsync(t, n);
|
|
1377
1366
|
return;
|
|
1378
1367
|
}
|
|
1379
|
-
let o =
|
|
1380
|
-
return o.log(), new J2(
|
|
1368
|
+
let o = Mt();
|
|
1369
|
+
return o.log(), new J2(t).applyError({ code: -32603, message: o.rawMessage }).payload;
|
|
1381
1370
|
}
|
|
1382
1371
|
enable() {
|
|
1383
|
-
let
|
|
1384
|
-
return this.request(
|
|
1372
|
+
let t = u2(_.Login);
|
|
1373
|
+
return this.request(t);
|
|
1385
1374
|
}
|
|
1386
|
-
request(
|
|
1387
|
-
return this.prefixPayloadMethodForTestMode(
|
|
1375
|
+
request(t) {
|
|
1376
|
+
return this.prefixPayloadMethodForTestMode(t), super.request(t);
|
|
1388
1377
|
}
|
|
1389
|
-
prefixPayloadMethodForTestMode(
|
|
1390
|
-
let
|
|
1391
|
-
this.sdk.testMode && (
|
|
1378
|
+
prefixPayloadMethodForTestMode(t) {
|
|
1379
|
+
let n = "testMode/eth/";
|
|
1380
|
+
this.sdk.testMode && (t.method = `${n}${t.method}`);
|
|
1392
1381
|
}
|
|
1393
1382
|
};
|
|
1394
|
-
|
|
1395
|
-
|
|
1383
|
+
Xt = ["request", "overlay", "sdk"];
|
|
1384
|
+
_e = class extends R2 {
|
|
1396
1385
|
constructor() {
|
|
1397
1386
|
super(void 0);
|
|
1398
1387
|
this.__sdk_access_field_descriptors__ = /* @__PURE__ */ new Map();
|
|
1399
1388
|
this.__is_initialized__ = false;
|
|
1400
|
-
this.utils = { createPromiEvent:
|
|
1401
|
-
let
|
|
1402
|
-
|
|
1403
|
-
let o =
|
|
1404
|
-
a2 && (this.__sdk_access_field_descriptors__.set(
|
|
1405
|
-
throw
|
|
1389
|
+
this.utils = { createPromiEvent: x2, isPromiEvent: _t, encodeJSON: Re, decodeJSON: gt, createJsonRpcRequestPayload: u2, standardizeJsonRpcRequestPayload: H2, storage: ue };
|
|
1390
|
+
let t = [this, ...Mn(this)];
|
|
1391
|
+
Xt.forEach((n) => {
|
|
1392
|
+
let o = t.map((c2) => Object.getOwnPropertyDescriptor(c2, n)), s = o.findIndex((c2) => !!c2), i = s > 0, a2 = o[s];
|
|
1393
|
+
a2 && (this.__sdk_access_field_descriptors__.set(n, { descriptor: a2, isPrototypeField: i }), Object.defineProperty(this, n, { configurable: true, get: () => {
|
|
1394
|
+
throw Pt(n);
|
|
1406
1395
|
} }));
|
|
1407
1396
|
});
|
|
1408
1397
|
}
|
|
1409
|
-
init(
|
|
1410
|
-
this.__is_initialized__ || (
|
|
1411
|
-
if (this.__sdk_access_field_descriptors__.has(
|
|
1412
|
-
let { descriptor: o, isPrototypeField: s } = this.__sdk_access_field_descriptors__.get(
|
|
1413
|
-
s ? delete this[
|
|
1398
|
+
init(t) {
|
|
1399
|
+
this.__is_initialized__ || (Xt.forEach((n) => {
|
|
1400
|
+
if (this.__sdk_access_field_descriptors__.has(n)) {
|
|
1401
|
+
let { descriptor: o, isPrototypeField: s } = this.__sdk_access_field_descriptors__.get(n);
|
|
1402
|
+
s ? delete this[n] : Object.defineProperty(this, n, o);
|
|
1414
1403
|
}
|
|
1415
|
-
}), this.sdk =
|
|
1404
|
+
}), this.sdk = t, this.__is_initialized__ = true);
|
|
1416
1405
|
}
|
|
1417
|
-
createDeprecationWarning(
|
|
1418
|
-
let { method:
|
|
1406
|
+
createDeprecationWarning(t) {
|
|
1407
|
+
let { method: n, removalVersion: o, useInstead: s } = t, i = s ? ` Use \`${s}\` instead.` : "", a2 = `\`${n}\` will be removed from this Extension in version \`${o}\`.${i}`;
|
|
1419
1408
|
return new le(this, "DEPRECATION_NOTICE", a2);
|
|
1420
1409
|
}
|
|
1421
|
-
createWarning(
|
|
1422
|
-
return new le(this,
|
|
1410
|
+
createWarning(t, n) {
|
|
1411
|
+
return new le(this, t, n);
|
|
1423
1412
|
}
|
|
1424
|
-
createError(
|
|
1425
|
-
return new Q2(this,
|
|
1413
|
+
createError(t, n, o) {
|
|
1414
|
+
return new Q2(this, t, n, o);
|
|
1426
1415
|
}
|
|
1427
1416
|
};
|
|
1428
|
-
|
|
1417
|
+
Qe = class extends _e {
|
|
1429
1418
|
};
|
|
1430
|
-
|
|
1419
|
+
D2 = class extends _e {
|
|
1431
1420
|
};
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
purchase(
|
|
1435
|
-
let
|
|
1436
|
-
return this.request(
|
|
1437
|
-
}
|
|
1438
|
-
checkout(
|
|
1439
|
-
let
|
|
1440
|
-
return
|
|
1421
|
+
D2.Internal = Qe, D2.Anonymous = "anonymous extension";
|
|
1422
|
+
De = class extends R2 {
|
|
1423
|
+
purchase(e) {
|
|
1424
|
+
let t = u2(_.NFTPurchase, [e]);
|
|
1425
|
+
return this.request(t);
|
|
1426
|
+
}
|
|
1427
|
+
checkout(e) {
|
|
1428
|
+
let t = this.sdk.thirdPartyWallets.isConnected, n = u2(_.NFTCheckout, [z2(q2({}, e), { walletProvider: t ? "web3modal" : "magic" })]), o = this.request(n);
|
|
1429
|
+
return t && (o.on(P.Initiated, (s) => f2(this, null, function* () {
|
|
1430
|
+
try {
|
|
1431
|
+
let i = yield this.request({ method: "eth_sendTransaction", params: [s] });
|
|
1432
|
+
this.createIntermediaryEvent(P.Success, n.id)(i);
|
|
1433
|
+
} catch (i) {
|
|
1434
|
+
this.createIntermediaryEvent(P.Failure, n.id)();
|
|
1435
|
+
}
|
|
1436
|
+
})), o.on(P.Disconnect, () => {
|
|
1437
|
+
this.sdk.thirdPartyWallets.resetThirdPartyWalletState(), o.emit("disconnect");
|
|
1438
|
+
})), o;
|
|
1441
1439
|
}
|
|
1442
|
-
transfer(
|
|
1443
|
-
let
|
|
1444
|
-
return this.request(
|
|
1440
|
+
transfer(e) {
|
|
1441
|
+
let t = u2(_.NFTTransfer, [e]);
|
|
1442
|
+
return this.request(t);
|
|
1445
1443
|
}
|
|
1446
1444
|
};
|
|
1447
|
-
|
|
1448
|
-
constructor(
|
|
1449
|
-
this.apiKey =
|
|
1445
|
+
me = class {
|
|
1446
|
+
constructor(e, t) {
|
|
1447
|
+
this.apiKey = e;
|
|
1450
1448
|
var i;
|
|
1451
|
-
if (!
|
|
1452
|
-
|
|
1453
|
-
let { defaultEndpoint:
|
|
1454
|
-
this.testMode = !!(
|
|
1455
|
-
let s =
|
|
1456
|
-
this.parameters = Re(
|
|
1449
|
+
if (!e) throw It();
|
|
1450
|
+
m2.platform === "react-native" && (t == null ? void 0 : t.endpoint) && St().log();
|
|
1451
|
+
let { defaultEndpoint: n, version: o } = m2;
|
|
1452
|
+
this.testMode = !!(t != null && t.testMode), this.useStorageCache = !!(t != null && t.useStorageCache), this.endpoint = Ye((i = t == null ? void 0 : t.endpoint) != null ? i : n).origin, this.auth = new we(this), this.user = new Ne(this), this.wallet = new Ae(this), this.nft = new De(this), this.thirdPartyWallets = new $e(this), this.rpcProvider = new Oe(this);
|
|
1453
|
+
let s = Nn.call(this, t);
|
|
1454
|
+
this.parameters = Re(z2(q2({ API_KEY: this.apiKey, DOMAIN_ORIGIN: window.location ? window.location.origin : "", ETH_NETWORK: t == null ? void 0 : t.network, host: Ye(this.endpoint).host, sdk: vt[m2.sdkName], version: o, ext: ce(s) ? void 0 : s, locale: (t == null ? void 0 : t.locale) || "en_US" }, m2.bundleId ? { bundleId: m2.bundleId } : {}), { meta: t == null ? void 0 : t.meta })), this.networkHash = Sn(this.apiKey, t == null ? void 0 : t.network, ce(s) ? void 0 : s), t != null && t.deferPreload || this.preload();
|
|
1457
1455
|
}
|
|
1458
1456
|
get overlay() {
|
|
1459
|
-
if (!
|
|
1460
|
-
let
|
|
1461
|
-
|
|
1457
|
+
if (!me.__overlays__.has(this.parameters)) {
|
|
1458
|
+
let e = new m2.ViewController(this.endpoint, this.parameters, this.networkHash);
|
|
1459
|
+
e.init(), me.__overlays__.set(this.parameters, e);
|
|
1462
1460
|
}
|
|
1463
|
-
return
|
|
1461
|
+
return me.__overlays__.get(this.parameters);
|
|
1464
1462
|
}
|
|
1465
1463
|
preload() {
|
|
1466
|
-
return
|
|
1464
|
+
return f2(this, null, function* () {
|
|
1467
1465
|
yield this.overlay.checkIsReadyForRequest;
|
|
1468
1466
|
});
|
|
1469
1467
|
}
|
|
1470
1468
|
};
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
constructor(
|
|
1475
|
-
this.endpoint =
|
|
1476
|
-
this.parameters =
|
|
1477
|
-
this.networkHash =
|
|
1469
|
+
qe = me;
|
|
1470
|
+
qe.__overlays__ = /* @__PURE__ */ new Map();
|
|
1471
|
+
et = class {
|
|
1472
|
+
constructor(e, t, n) {
|
|
1473
|
+
this.endpoint = e;
|
|
1474
|
+
this.parameters = t;
|
|
1475
|
+
this.networkHash = n;
|
|
1478
1476
|
this.messageHandlers = /* @__PURE__ */ new Set();
|
|
1479
1477
|
this.isConnectedToInternet = true;
|
|
1480
1478
|
this.checkIsReadyForRequest = this.waitForReady(), this.isReadyForRequest = false, this.listen();
|
|
1481
1479
|
}
|
|
1482
|
-
post(
|
|
1483
|
-
return
|
|
1484
|
-
return
|
|
1480
|
+
post(e, t) {
|
|
1481
|
+
return f2(this, null, function* () {
|
|
1482
|
+
return Ke((n, o) => f2(this, null, function* () {
|
|
1485
1483
|
if (!this.isConnectedToInternet) {
|
|
1486
|
-
let
|
|
1487
|
-
o(
|
|
1484
|
+
let d = Tt();
|
|
1485
|
+
o(d);
|
|
1488
1486
|
}
|
|
1489
1487
|
this.isReadyForRequest || (yield this.waitForReady());
|
|
1490
|
-
let s = [], i = Array.isArray(
|
|
1488
|
+
let s = [], i = Array.isArray(t) ? t.map((d) => d.id) : [], a2 = yield Ln(`${e}-${this.parameters}`, t, this.networkHash);
|
|
1491
1489
|
yield this._post(a2);
|
|
1492
|
-
let c2 = (
|
|
1493
|
-
var
|
|
1494
|
-
let { id:
|
|
1495
|
-
if (
|
|
1490
|
+
let c2 = (d) => (p2) => {
|
|
1491
|
+
var tt2;
|
|
1492
|
+
let { id: M, response: v2 } = $n(t, p2);
|
|
1493
|
+
if (On(p2), ((tt2 = v2 == null ? void 0 : v2.payload.error) == null ? void 0 : tt2.message) === "User denied account access.") te();
|
|
1496
1494
|
else if (p2.data.deviceShare) {
|
|
1497
|
-
let { deviceShare:
|
|
1498
|
-
|
|
1495
|
+
let { deviceShare: Yt } = p2.data;
|
|
1496
|
+
jt(Yt, this.networkHash);
|
|
1499
1497
|
}
|
|
1500
|
-
|
|
1501
|
-
},
|
|
1498
|
+
M && v2 && Array.isArray(t) && i.includes(M) ? (s.push(v2), s.length === t.length && (d(), n(s))) : M && v2 && !Array.isArray(t) && M === t.id && (d(), n(v2));
|
|
1499
|
+
}, l2 = this.on(f.MAGIC_HANDLE_RESPONSE, c2(() => l2()));
|
|
1502
1500
|
}));
|
|
1503
1501
|
});
|
|
1504
1502
|
}
|
|
1505
|
-
on(
|
|
1506
|
-
let
|
|
1507
|
-
s.data.msgType === `${
|
|
1503
|
+
on(e, t) {
|
|
1504
|
+
let n = t.bind(window), o = (s) => {
|
|
1505
|
+
s.data.msgType === `${e}-${this.parameters}` && n(s);
|
|
1508
1506
|
};
|
|
1509
1507
|
return this.messageHandlers.add(o), () => this.messageHandlers.delete(o);
|
|
1510
1508
|
}
|
|
1511
1509
|
waitForReady() {
|
|
1512
|
-
return new Promise((
|
|
1513
|
-
let
|
|
1514
|
-
this.isReadyForRequest = true,
|
|
1510
|
+
return new Promise((e) => {
|
|
1511
|
+
let t = this.on(f.MAGIC_OVERLAY_READY, () => {
|
|
1512
|
+
this.isReadyForRequest = true, e(), t();
|
|
1515
1513
|
});
|
|
1516
1514
|
setTimeout(() => {
|
|
1517
|
-
this.isReadyForRequest = true,
|
|
1515
|
+
this.isReadyForRequest = true, e(), t();
|
|
1518
1516
|
}, 15e3);
|
|
1519
1517
|
});
|
|
1520
1518
|
}
|
|
@@ -1523,40 +1521,40 @@ var init_es2 = __esm({
|
|
|
1523
1521
|
this.hideOverlay();
|
|
1524
1522
|
}), this.on(f.MAGIC_SHOW_OVERLAY, () => {
|
|
1525
1523
|
this.showOverlay();
|
|
1526
|
-
}), this.on(f.MAGIC_SEND_PRODUCT_ANNOUNCEMENT, (
|
|
1527
|
-
|
|
1524
|
+
}), this.on(f.MAGIC_SEND_PRODUCT_ANNOUNCEMENT, (e) => {
|
|
1525
|
+
e.data.response.result.product_announcement && new F2(l.ProductAnnouncement, e.data.response.result.product_announcement).log();
|
|
1528
1526
|
});
|
|
1529
1527
|
}
|
|
1530
1528
|
};
|
|
1531
1529
|
}
|
|
1532
1530
|
});
|
|
1533
1531
|
|
|
1534
|
-
// ../../node_modules/.pnpm/@magic-sdk+commons@24.
|
|
1532
|
+
// ../../node_modules/.pnpm/@magic-sdk+commons@24.20.0_@magic-sdk+provider@28.20.0_localforage@1.10.0__@magic-sdk+types@24.18.0/node_modules/@magic-sdk/commons/dist/es/index.mjs
|
|
1535
1533
|
var init_es3 = __esm({
|
|
1536
|
-
"../../node_modules/.pnpm/@magic-sdk+commons@24.
|
|
1534
|
+
"../../node_modules/.pnpm/@magic-sdk+commons@24.20.0_@magic-sdk+provider@28.20.0_localforage@1.10.0__@magic-sdk+types@24.18.0/node_modules/@magic-sdk/commons/dist/es/index.mjs"() {
|
|
1537
1535
|
"use strict";
|
|
1538
1536
|
init_es2();
|
|
1539
1537
|
init_es();
|
|
1540
1538
|
}
|
|
1541
1539
|
});
|
|
1542
1540
|
|
|
1543
|
-
// ../../node_modules/.pnpm/magic-sdk@28.
|
|
1541
|
+
// ../../node_modules/.pnpm/magic-sdk@28.21.0/node_modules/magic-sdk/dist/es/index.mjs
|
|
1544
1542
|
var es_exports = {};
|
|
1545
1543
|
__export(es_exports, {
|
|
1546
1544
|
AuthEventOnReceived: () => F,
|
|
1547
1545
|
DeepLinkPage: () => E,
|
|
1548
1546
|
DeviceVerificationEventEmit: () => h,
|
|
1549
1547
|
DeviceVerificationEventOnReceived: () => T,
|
|
1550
|
-
DisableMFAEventEmit: () =>
|
|
1551
|
-
DisableMFAEventOnReceived: () =>
|
|
1552
|
-
EnableMFAEventEmit: () =>
|
|
1548
|
+
DisableMFAEventEmit: () => D,
|
|
1549
|
+
DisableMFAEventOnReceived: () => L,
|
|
1550
|
+
EnableMFAEventEmit: () => w,
|
|
1553
1551
|
EnableMFAEventOnReceived: () => k,
|
|
1554
1552
|
EthChainType: () => V,
|
|
1555
|
-
|
|
1556
|
-
Extension: () => q2,
|
|
1553
|
+
Extension: () => D2,
|
|
1557
1554
|
ExtensionError: () => Q2,
|
|
1558
1555
|
ExtensionWarning: () => le,
|
|
1559
1556
|
FarcasterLoginEventEmit: () => U,
|
|
1557
|
+
LocalStorageKeys: () => v,
|
|
1560
1558
|
LoginWithEmailOTPEventEmit: () => A,
|
|
1561
1559
|
LoginWithEmailOTPEventOnReceived: () => N,
|
|
1562
1560
|
LoginWithMagicLinkEventEmit: () => x,
|
|
@@ -1568,27 +1566,28 @@ __export(es_exports, {
|
|
|
1568
1566
|
MagicOutgoingWindowMessage: () => g,
|
|
1569
1567
|
MagicPayloadMethod: () => _,
|
|
1570
1568
|
NftCheckoutIntermediaryEvents: () => P,
|
|
1571
|
-
RPCError: () =>
|
|
1572
|
-
RPCErrorCode: () =>
|
|
1573
|
-
RecencyCheckEventEmit: () =>
|
|
1574
|
-
RecencyCheckEventOnReceived: () =>
|
|
1569
|
+
RPCError: () => _2,
|
|
1570
|
+
RPCErrorCode: () => m,
|
|
1571
|
+
RecencyCheckEventEmit: () => O,
|
|
1572
|
+
RecencyCheckEventOnReceived: () => S,
|
|
1575
1573
|
RecoverAccountEventEmit: () => B,
|
|
1576
1574
|
RecoverAccountEventOnReceived: () => Y,
|
|
1577
|
-
RecoveryFactorEventEmit: () =>
|
|
1575
|
+
RecoveryFactorEventEmit: () => W,
|
|
1578
1576
|
RecoveryFactorEventOnReceived: () => q,
|
|
1579
|
-
RecoveryMethodType: () =>
|
|
1580
|
-
SDKError: () =>
|
|
1577
|
+
RecoveryMethodType: () => J,
|
|
1578
|
+
SDKError: () => C2,
|
|
1581
1579
|
SDKErrorCode: () => p,
|
|
1582
|
-
SDKWarning: () =>
|
|
1583
|
-
SDKWarningCode: () =>
|
|
1580
|
+
SDKWarning: () => F2,
|
|
1581
|
+
SDKWarningCode: () => l,
|
|
1582
|
+
ThirdPartyWalletEvents: () => u,
|
|
1584
1583
|
UiEventsEmit: () => Q,
|
|
1585
1584
|
UpdateEmailEventEmit: () => b,
|
|
1586
1585
|
UpdateEmailEventOnReceived: () => C,
|
|
1587
|
-
UserEventsEmit: () =>
|
|
1586
|
+
UserEventsEmit: () => G,
|
|
1588
1587
|
UserEventsOnReceived: () => H,
|
|
1589
1588
|
WalletEventOnReceived: () => j,
|
|
1590
|
-
|
|
1591
|
-
|
|
1589
|
+
isPromiEvent: () => _t,
|
|
1590
|
+
routeToMagicMethods: () => z
|
|
1592
1591
|
});
|
|
1593
1592
|
function lt2(b3) {
|
|
1594
1593
|
for (let [T2, _3] of Object.entries(ct2)) b3.style[T2] = _3;
|
|
@@ -1597,9 +1596,9 @@ function dt2(b3) {
|
|
|
1597
1596
|
let T2 = [].slice.call(document.querySelectorAll(".magic-iframe"));
|
|
1598
1597
|
return Boolean(T2.find((_3) => _3.src.includes(b3)));
|
|
1599
1598
|
}
|
|
1600
|
-
var et2, $e2, rt2,
|
|
1599
|
+
var et2, $e2, rt2, tt, nt2, it2, ve2, Je, ot2, Ze, re, ke, rr2, ge2, Ne2, ct2, ir2, or2, vt2, ht2, mt2, pe2, Rt2;
|
|
1601
1600
|
var init_es4 = __esm({
|
|
1602
|
-
"../../node_modules/.pnpm/magic-sdk@28.
|
|
1601
|
+
"../../node_modules/.pnpm/magic-sdk@28.21.0/node_modules/magic-sdk/dist/es/index.mjs"() {
|
|
1603
1602
|
"use strict";
|
|
1604
1603
|
init_es2();
|
|
1605
1604
|
init_es2();
|
|
@@ -1608,16 +1607,16 @@ var init_es4 = __esm({
|
|
|
1608
1607
|
et2 = Object.create;
|
|
1609
1608
|
$e2 = Object.defineProperty;
|
|
1610
1609
|
rt2 = Object.getOwnPropertyDescriptor;
|
|
1611
|
-
|
|
1610
|
+
tt = Object.getOwnPropertyNames;
|
|
1612
1611
|
nt2 = Object.getPrototypeOf;
|
|
1613
1612
|
it2 = Object.prototype.hasOwnProperty;
|
|
1614
1613
|
ve2 = ((b3) => typeof require != "undefined" ? require : typeof Proxy != "undefined" ? new Proxy(b3, { get: (T2, _3) => (typeof require != "undefined" ? require : T2)[_3] }) : b3)(function(b3) {
|
|
1615
1614
|
if (typeof require != "undefined") return require.apply(this, arguments);
|
|
1616
1615
|
throw new Error('Dynamic require of "' + b3 + '" is not supported');
|
|
1617
1616
|
});
|
|
1618
|
-
|
|
1617
|
+
Je = (b3, T2) => () => (T2 || b3((T2 = { exports: {} }).exports, T2), T2.exports);
|
|
1619
1618
|
ot2 = (b3, T2, _3, O3) => {
|
|
1620
|
-
if (T2 && typeof T2 == "object" || typeof T2 == "function") for (let R3 of
|
|
1619
|
+
if (T2 && typeof T2 == "object" || typeof T2 == "function") for (let R3 of tt(T2)) !it2.call(b3, R3) && R3 !== _3 && $e2(b3, R3, { get: () => T2[R3], enumerable: !(O3 = rt2(T2, R3)) || O3.enumerable });
|
|
1621
1620
|
return b3;
|
|
1622
1621
|
};
|
|
1623
1622
|
Ze = (b3, T2, _3) => (_3 = b3 != null ? et2(nt2(b3)) : {}, ot2(T2 || !b3 || !b3.__esModule ? $e2(_3, "default", { value: b3, enumerable: true }) : _3, b3));
|
|
@@ -1625,19 +1624,19 @@ var init_es4 = __esm({
|
|
|
1625
1624
|
var j2 = (S3) => {
|
|
1626
1625
|
try {
|
|
1627
1626
|
Y3(_3.next(S3));
|
|
1628
|
-
} catch (
|
|
1629
|
-
R3(
|
|
1627
|
+
} catch (M) {
|
|
1628
|
+
R3(M);
|
|
1630
1629
|
}
|
|
1631
1630
|
}, P3 = (S3) => {
|
|
1632
1631
|
try {
|
|
1633
1632
|
Y3(_3.throw(S3));
|
|
1634
|
-
} catch (
|
|
1635
|
-
R3(
|
|
1633
|
+
} catch (M) {
|
|
1634
|
+
R3(M);
|
|
1636
1635
|
}
|
|
1637
1636
|
}, Y3 = (S3) => S3.done ? O3(S3.value) : Promise.resolve(S3.value).then(j2, P3);
|
|
1638
1637
|
Y3((_3 = _3.apply(b3, T2)).next());
|
|
1639
1638
|
});
|
|
1640
|
-
|
|
1639
|
+
ke = Je((qe2, De2) => {
|
|
1641
1640
|
(function(b3) {
|
|
1642
1641
|
if (typeof qe2 == "object" && typeof De2 < "u") De2.exports = b3();
|
|
1643
1642
|
else if (typeof define == "function" && define.amd) define([], b3);
|
|
@@ -1665,16 +1664,16 @@ var init_es4 = __esm({
|
|
|
1665
1664
|
}
|
|
1666
1665
|
return j2[K2].exports;
|
|
1667
1666
|
}
|
|
1668
|
-
for (var S3 = typeof ve2 == "function" && ve2,
|
|
1667
|
+
for (var S3 = typeof ve2 == "function" && ve2, M = 0; M < P3.length; M++) Y3(P3[M]);
|
|
1669
1668
|
return Y3;
|
|
1670
1669
|
}({ 1: [function(O3, R3, j2) {
|
|
1671
1670
|
(function(P3) {
|
|
1672
1671
|
"use strict";
|
|
1673
1672
|
var Y3 = P3.MutationObserver || P3.WebKitMutationObserver, S3;
|
|
1674
1673
|
if (Y3) {
|
|
1675
|
-
var
|
|
1674
|
+
var M = 0, K2 = new Y3(W3), J3 = P3.document.createTextNode("");
|
|
1676
1675
|
K2.observe(J3, { characterData: true }), S3 = function() {
|
|
1677
|
-
J3.data =
|
|
1676
|
+
J3.data = M = ++M % 2;
|
|
1678
1677
|
};
|
|
1679
1678
|
} else if (!P3.setImmediate && typeof P3.MessageChannel < "u") {
|
|
1680
1679
|
var m3 = new P3.MessageChannel();
|
|
@@ -1708,7 +1707,7 @@ var init_es4 = __esm({
|
|
|
1708
1707
|
var P3 = O3(1);
|
|
1709
1708
|
function Y3() {
|
|
1710
1709
|
}
|
|
1711
|
-
var S3 = {},
|
|
1710
|
+
var S3 = {}, M = ["REJECTED"], K2 = ["FULFILLED"], J3 = ["PENDING"];
|
|
1712
1711
|
R3.exports = m3;
|
|
1713
1712
|
function m3(h3) {
|
|
1714
1713
|
if (typeof h3 != "function") throw new TypeError("resolver must be a function");
|
|
@@ -1717,7 +1716,7 @@ var init_es4 = __esm({
|
|
|
1717
1716
|
m3.prototype.catch = function(h3) {
|
|
1718
1717
|
return this.then(null, h3);
|
|
1719
1718
|
}, m3.prototype.then = function(h3, D3) {
|
|
1720
|
-
if (typeof h3 != "function" && this.state === K2 || typeof D3 != "function" && this.state ===
|
|
1719
|
+
if (typeof h3 != "function" && this.state === K2 || typeof D3 != "function" && this.state === M) return this;
|
|
1721
1720
|
var E3 = new this.constructor(Y3);
|
|
1722
1721
|
if (this.state !== J3) {
|
|
1723
1722
|
var C3 = this.state === K2 ? h3 : D3;
|
|
@@ -1755,11 +1754,11 @@ var init_es4 = __esm({
|
|
|
1755
1754
|
if (C3) Z(h3, C3);
|
|
1756
1755
|
else {
|
|
1757
1756
|
h3.state = K2, h3.outcome = D3;
|
|
1758
|
-
for (var G2 = -1,
|
|
1757
|
+
for (var G2 = -1, X = h3.queue.length; ++G2 < X; ) h3.queue[G2].callFulfilled(D3);
|
|
1759
1758
|
}
|
|
1760
1759
|
return h3;
|
|
1761
1760
|
}, S3.reject = function(h3, D3) {
|
|
1762
|
-
h3.state =
|
|
1761
|
+
h3.state = M, h3.outcome = D3;
|
|
1763
1762
|
for (var E3 = -1, C3 = h3.queue.length; ++E3 < C3; ) h3.queue[E3].callRejected(D3);
|
|
1764
1763
|
return h3;
|
|
1765
1764
|
};
|
|
@@ -1777,10 +1776,10 @@ var init_es4 = __esm({
|
|
|
1777
1776
|
function G2($) {
|
|
1778
1777
|
E3 || (E3 = true, S3.resolve(h3, $));
|
|
1779
1778
|
}
|
|
1780
|
-
function
|
|
1779
|
+
function X() {
|
|
1781
1780
|
D3(G2, C3);
|
|
1782
1781
|
}
|
|
1783
|
-
var Q3 = F3(
|
|
1782
|
+
var Q3 = F3(X);
|
|
1784
1783
|
Q3.status === "error" && C3(Q3.value);
|
|
1785
1784
|
}
|
|
1786
1785
|
function F3(h3, D3) {
|
|
@@ -1807,14 +1806,14 @@ var init_es4 = __esm({
|
|
|
1807
1806
|
if (Object.prototype.toString.call(h3) !== "[object Array]") return this.reject(new TypeError("must be an array"));
|
|
1808
1807
|
var E3 = h3.length, C3 = false;
|
|
1809
1808
|
if (!E3) return this.resolve([]);
|
|
1810
|
-
for (var G2 = new Array(E3),
|
|
1809
|
+
for (var G2 = new Array(E3), X = 0, Q3 = -1, $ = new this(Y3); ++Q3 < E3; ) ee(h3[Q3], Q3);
|
|
1811
1810
|
return $;
|
|
1812
1811
|
function ee(oe2, a2) {
|
|
1813
1812
|
D3.resolve(oe2).then(u3, function(v2) {
|
|
1814
1813
|
C3 || (C3 = true, S3.reject($, v2));
|
|
1815
1814
|
});
|
|
1816
1815
|
function u3(v2) {
|
|
1817
|
-
G2[a2] = v2, ++
|
|
1816
|
+
G2[a2] = v2, ++X === E3 && !C3 && (C3 = true, S3.resolve($, G2));
|
|
1818
1817
|
}
|
|
1819
1818
|
}
|
|
1820
1819
|
}
|
|
@@ -1824,13 +1823,13 @@ var init_es4 = __esm({
|
|
|
1824
1823
|
if (Object.prototype.toString.call(h3) !== "[object Array]") return this.reject(new TypeError("must be an array"));
|
|
1825
1824
|
var E3 = h3.length, C3 = false;
|
|
1826
1825
|
if (!E3) return this.resolve([]);
|
|
1827
|
-
for (var G2 = -1,
|
|
1828
|
-
return
|
|
1826
|
+
for (var G2 = -1, X = new this(Y3); ++G2 < E3; ) Q3(h3[G2]);
|
|
1827
|
+
return X;
|
|
1829
1828
|
function Q3($) {
|
|
1830
1829
|
D3.resolve($).then(function(ee) {
|
|
1831
|
-
C3 || (C3 = true, S3.resolve(
|
|
1830
|
+
C3 || (C3 = true, S3.resolve(X, ee));
|
|
1832
1831
|
}, function(ee) {
|
|
1833
|
-
C3 || (C3 = true, S3.reject(
|
|
1832
|
+
C3 || (C3 = true, S3.reject(X, ee));
|
|
1834
1833
|
});
|
|
1835
1834
|
}
|
|
1836
1835
|
}
|
|
@@ -1860,10 +1859,10 @@ var init_es4 = __esm({
|
|
|
1860
1859
|
return;
|
|
1861
1860
|
}
|
|
1862
1861
|
}
|
|
1863
|
-
var
|
|
1862
|
+
var M = S3();
|
|
1864
1863
|
function K2() {
|
|
1865
1864
|
try {
|
|
1866
|
-
if (!
|
|
1865
|
+
if (!M || !M.open) return false;
|
|
1867
1866
|
var e = typeof openDatabase < "u" && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform), t = typeof fetch == "function" && fetch.toString().indexOf("[native code") !== -1;
|
|
1868
1867
|
return (!e || t) && typeof indexedDB < "u" && typeof IDBKeyRange < "u";
|
|
1869
1868
|
} catch {
|
|
@@ -1929,7 +1928,7 @@ var init_es4 = __esm({
|
|
|
1929
1928
|
return r.promise;
|
|
1930
1929
|
}) : t.dbReady = r.promise;
|
|
1931
1930
|
}
|
|
1932
|
-
function
|
|
1931
|
+
function X(e) {
|
|
1933
1932
|
var t = U3[e.name], r = t.deferredOperations.pop();
|
|
1934
1933
|
if (r) return r.resolve(), r.promise;
|
|
1935
1934
|
}
|
|
@@ -1943,7 +1942,7 @@ var init_es4 = __esm({
|
|
|
1943
1942
|
else return r(e.db);
|
|
1944
1943
|
var o = [e.name];
|
|
1945
1944
|
t && o.push(e.version);
|
|
1946
|
-
var n =
|
|
1945
|
+
var n = M.open.apply(M, o);
|
|
1947
1946
|
t && (n.onupgradeneeded = function(f3) {
|
|
1948
1947
|
var s = n.result;
|
|
1949
1948
|
try {
|
|
@@ -1958,7 +1957,7 @@ var init_es4 = __esm({
|
|
|
1958
1957
|
var f3 = n.result;
|
|
1959
1958
|
f3.onversionchange = function(s) {
|
|
1960
1959
|
s.target.close();
|
|
1961
|
-
}, r(f3),
|
|
1960
|
+
}, r(f3), X(e);
|
|
1962
1961
|
};
|
|
1963
1962
|
});
|
|
1964
1963
|
}
|
|
@@ -2050,15 +2049,15 @@ var init_es4 = __esm({
|
|
|
2050
2049
|
var c2 = o.forages[s];
|
|
2051
2050
|
c2 !== t && n.push(c2._initReady().catch(f3));
|
|
2052
2051
|
}
|
|
2053
|
-
var
|
|
2052
|
+
var l2 = o.forages.slice(0);
|
|
2054
2053
|
return m3.all(n).then(function() {
|
|
2055
2054
|
return r.db = o.db, ee(r);
|
|
2056
|
-
}).then(function(
|
|
2057
|
-
return r.db =
|
|
2058
|
-
}).then(function(
|
|
2059
|
-
r.db = o.db =
|
|
2060
|
-
for (var y3 = 0; y3 <
|
|
2061
|
-
var A2 =
|
|
2055
|
+
}).then(function(d) {
|
|
2056
|
+
return r.db = d, a2(r, t._defaultConfig.version) ? oe2(r) : d;
|
|
2057
|
+
}).then(function(d) {
|
|
2058
|
+
r.db = o.db = d, t._dbInfo = r;
|
|
2059
|
+
for (var y3 = 0; y3 < l2.length; y3++) {
|
|
2060
|
+
var A2 = l2[y3];
|
|
2062
2061
|
A2 !== t && (A2._dbInfo.db = r.db, A2._dbInfo.version = r.version);
|
|
2063
2062
|
}
|
|
2064
2063
|
});
|
|
@@ -2071,15 +2070,15 @@ var init_es4 = __esm({
|
|
|
2071
2070
|
N2(r._dbInfo, te2, function(f3, s) {
|
|
2072
2071
|
if (f3) return n(f3);
|
|
2073
2072
|
try {
|
|
2074
|
-
var c2 = s.objectStore(r._dbInfo.storeName),
|
|
2075
|
-
|
|
2076
|
-
var
|
|
2077
|
-
|
|
2078
|
-
},
|
|
2079
|
-
n(
|
|
2073
|
+
var c2 = s.objectStore(r._dbInfo.storeName), l2 = c2.get(e);
|
|
2074
|
+
l2.onsuccess = function() {
|
|
2075
|
+
var d = l2.result;
|
|
2076
|
+
d === void 0 && (d = null), p2(d) && (d = v2(d)), o(d);
|
|
2077
|
+
}, l2.onerror = function() {
|
|
2078
|
+
n(l2.error);
|
|
2080
2079
|
};
|
|
2081
|
-
} catch (
|
|
2082
|
-
n(
|
|
2080
|
+
} catch (d) {
|
|
2081
|
+
n(d);
|
|
2083
2082
|
}
|
|
2084
2083
|
});
|
|
2085
2084
|
}).catch(n);
|
|
@@ -2092,17 +2091,17 @@ var init_es4 = __esm({
|
|
|
2092
2091
|
N2(r._dbInfo, te2, function(f3, s) {
|
|
2093
2092
|
if (f3) return n(f3);
|
|
2094
2093
|
try {
|
|
2095
|
-
var c2 = s.objectStore(r._dbInfo.storeName),
|
|
2096
|
-
|
|
2097
|
-
var y3 =
|
|
2094
|
+
var c2 = s.objectStore(r._dbInfo.storeName), l2 = c2.openCursor(), d = 1;
|
|
2095
|
+
l2.onsuccess = function() {
|
|
2096
|
+
var y3 = l2.result;
|
|
2098
2097
|
if (y3) {
|
|
2099
2098
|
var A2 = y3.value;
|
|
2100
2099
|
p2(A2) && (A2 = v2(A2));
|
|
2101
|
-
var
|
|
2102
|
-
|
|
2100
|
+
var x3 = e(A2, y3.key, d++);
|
|
2101
|
+
x3 !== void 0 ? o(x3) : y3.continue();
|
|
2103
2102
|
} else o();
|
|
2104
|
-
},
|
|
2105
|
-
n(
|
|
2103
|
+
}, l2.onerror = function() {
|
|
2104
|
+
n(l2.error);
|
|
2106
2105
|
};
|
|
2107
2106
|
} catch (y3) {
|
|
2108
2107
|
n(y3);
|
|
@@ -2112,7 +2111,7 @@ var init_es4 = __esm({
|
|
|
2112
2111
|
});
|
|
2113
2112
|
return w2(i, t), i;
|
|
2114
2113
|
}
|
|
2115
|
-
function
|
|
2114
|
+
function ar2(e, t, r) {
|
|
2116
2115
|
var i = this;
|
|
2117
2116
|
e = W3(e);
|
|
2118
2117
|
var o = new m3(function(n, f3) {
|
|
@@ -2122,20 +2121,20 @@ var init_es4 = __esm({
|
|
|
2122
2121
|
return c2 ? t : u3(t);
|
|
2123
2122
|
}) : t;
|
|
2124
2123
|
}).then(function(c2) {
|
|
2125
|
-
N2(i._dbInfo, h3, function(
|
|
2126
|
-
if (
|
|
2124
|
+
N2(i._dbInfo, h3, function(l2, d) {
|
|
2125
|
+
if (l2) return f3(l2);
|
|
2127
2126
|
try {
|
|
2128
|
-
var y3 =
|
|
2127
|
+
var y3 = d.objectStore(i._dbInfo.storeName);
|
|
2129
2128
|
c2 === null && (c2 = void 0);
|
|
2130
2129
|
var A2 = y3.put(c2, e);
|
|
2131
|
-
|
|
2130
|
+
d.oncomplete = function() {
|
|
2132
2131
|
c2 === void 0 && (c2 = null), n(c2);
|
|
2133
|
-
},
|
|
2134
|
-
var
|
|
2135
|
-
f3(
|
|
2132
|
+
}, d.onabort = d.onerror = function() {
|
|
2133
|
+
var x3 = A2.error ? A2.error : A2.transaction.error;
|
|
2134
|
+
f3(x3);
|
|
2136
2135
|
};
|
|
2137
|
-
} catch (
|
|
2138
|
-
f3(
|
|
2136
|
+
} catch (x3) {
|
|
2137
|
+
f3(x3);
|
|
2139
2138
|
}
|
|
2140
2139
|
});
|
|
2141
2140
|
}).catch(f3);
|
|
@@ -2150,24 +2149,24 @@ var init_es4 = __esm({
|
|
|
2150
2149
|
N2(r._dbInfo, h3, function(f3, s) {
|
|
2151
2150
|
if (f3) return n(f3);
|
|
2152
2151
|
try {
|
|
2153
|
-
var c2 = s.objectStore(r._dbInfo.storeName),
|
|
2152
|
+
var c2 = s.objectStore(r._dbInfo.storeName), l2 = c2.delete(e);
|
|
2154
2153
|
s.oncomplete = function() {
|
|
2155
2154
|
o();
|
|
2156
2155
|
}, s.onerror = function() {
|
|
2157
|
-
n(
|
|
2156
|
+
n(l2.error);
|
|
2158
2157
|
}, s.onabort = function() {
|
|
2159
|
-
var
|
|
2160
|
-
n(
|
|
2158
|
+
var d = l2.error ? l2.error : l2.transaction.error;
|
|
2159
|
+
n(d);
|
|
2161
2160
|
};
|
|
2162
|
-
} catch (
|
|
2163
|
-
n(
|
|
2161
|
+
} catch (d) {
|
|
2162
|
+
n(d);
|
|
2164
2163
|
}
|
|
2165
2164
|
});
|
|
2166
2165
|
}).catch(n);
|
|
2167
2166
|
});
|
|
2168
2167
|
return w2(i, t), i;
|
|
2169
2168
|
}
|
|
2170
|
-
function
|
|
2169
|
+
function sr2(e) {
|
|
2171
2170
|
var t = this, r = new m3(function(i, o) {
|
|
2172
2171
|
t.ready().then(function() {
|
|
2173
2172
|
N2(t._dbInfo, h3, function(n, f3) {
|
|
@@ -2177,11 +2176,11 @@ var init_es4 = __esm({
|
|
|
2177
2176
|
f3.oncomplete = function() {
|
|
2178
2177
|
i();
|
|
2179
2178
|
}, f3.onabort = f3.onerror = function() {
|
|
2180
|
-
var
|
|
2181
|
-
o(
|
|
2179
|
+
var l2 = c2.error ? c2.error : c2.transaction.error;
|
|
2180
|
+
o(l2);
|
|
2182
2181
|
};
|
|
2183
|
-
} catch (
|
|
2184
|
-
o(
|
|
2182
|
+
} catch (l2) {
|
|
2183
|
+
o(l2);
|
|
2185
2184
|
}
|
|
2186
2185
|
});
|
|
2187
2186
|
}).catch(o);
|
|
@@ -2200,15 +2199,15 @@ var init_es4 = __esm({
|
|
|
2200
2199
|
}, c2.onerror = function() {
|
|
2201
2200
|
o(c2.error);
|
|
2202
2201
|
};
|
|
2203
|
-
} catch (
|
|
2204
|
-
o(
|
|
2202
|
+
} catch (l2) {
|
|
2203
|
+
o(l2);
|
|
2205
2204
|
}
|
|
2206
2205
|
});
|
|
2207
2206
|
}).catch(o);
|
|
2208
2207
|
});
|
|
2209
2208
|
return w2(r, e), r;
|
|
2210
2209
|
}
|
|
2211
|
-
function
|
|
2210
|
+
function cr2(e, t) {
|
|
2212
2211
|
var r = this, i = new m3(function(o, n) {
|
|
2213
2212
|
if (e < 0) {
|
|
2214
2213
|
o(null);
|
|
@@ -2218,16 +2217,16 @@ var init_es4 = __esm({
|
|
|
2218
2217
|
N2(r._dbInfo, te2, function(f3, s) {
|
|
2219
2218
|
if (f3) return n(f3);
|
|
2220
2219
|
try {
|
|
2221
|
-
var c2 = s.objectStore(r._dbInfo.storeName),
|
|
2222
|
-
|
|
2223
|
-
var y3 =
|
|
2220
|
+
var c2 = s.objectStore(r._dbInfo.storeName), l2 = false, d = c2.openKeyCursor();
|
|
2221
|
+
d.onsuccess = function() {
|
|
2222
|
+
var y3 = d.result;
|
|
2224
2223
|
if (!y3) {
|
|
2225
2224
|
o(null);
|
|
2226
2225
|
return;
|
|
2227
2226
|
}
|
|
2228
|
-
e === 0 ||
|
|
2229
|
-
},
|
|
2230
|
-
n(
|
|
2227
|
+
e === 0 || l2 ? o(y3.key) : (l2 = true, y3.advance(e));
|
|
2228
|
+
}, d.onerror = function() {
|
|
2229
|
+
n(d.error);
|
|
2231
2230
|
};
|
|
2232
2231
|
} catch (y3) {
|
|
2233
2232
|
n(y3);
|
|
@@ -2243,19 +2242,19 @@ var init_es4 = __esm({
|
|
|
2243
2242
|
N2(t._dbInfo, te2, function(n, f3) {
|
|
2244
2243
|
if (n) return o(n);
|
|
2245
2244
|
try {
|
|
2246
|
-
var s = f3.objectStore(t._dbInfo.storeName), c2 = s.openKeyCursor(),
|
|
2245
|
+
var s = f3.objectStore(t._dbInfo.storeName), c2 = s.openKeyCursor(), l2 = [];
|
|
2247
2246
|
c2.onsuccess = function() {
|
|
2248
|
-
var
|
|
2249
|
-
if (!
|
|
2250
|
-
i(
|
|
2247
|
+
var d = c2.result;
|
|
2248
|
+
if (!d) {
|
|
2249
|
+
i(l2);
|
|
2251
2250
|
return;
|
|
2252
2251
|
}
|
|
2253
|
-
|
|
2252
|
+
l2.push(d.key), d.continue();
|
|
2254
2253
|
}, c2.onerror = function() {
|
|
2255
2254
|
o(c2.error);
|
|
2256
2255
|
};
|
|
2257
|
-
} catch (
|
|
2258
|
-
o(
|
|
2256
|
+
} catch (d) {
|
|
2257
|
+
o(d);
|
|
2259
2258
|
}
|
|
2260
2259
|
});
|
|
2261
2260
|
}).catch(o);
|
|
@@ -2270,90 +2269,90 @@ var init_es4 = __esm({
|
|
|
2270
2269
|
if (!e.name) o = m3.reject("Invalid arguments");
|
|
2271
2270
|
else {
|
|
2272
2271
|
var n = e.name === r.name && i._dbInfo.db, f3 = n ? m3.resolve(i._dbInfo.db) : ee(e).then(function(s) {
|
|
2273
|
-
var c2 = U3[e.name],
|
|
2272
|
+
var c2 = U3[e.name], l2 = c2.forages;
|
|
2274
2273
|
c2.db = s;
|
|
2275
|
-
for (var
|
|
2274
|
+
for (var d = 0; d < l2.length; d++) l2[d]._dbInfo.db = s;
|
|
2276
2275
|
return s;
|
|
2277
2276
|
});
|
|
2278
2277
|
e.storeName ? o = f3.then(function(s) {
|
|
2279
2278
|
if (!!s.objectStoreNames.contains(e.storeName)) {
|
|
2280
2279
|
var c2 = s.version + 1;
|
|
2281
2280
|
G2(e);
|
|
2282
|
-
var
|
|
2281
|
+
var l2 = U3[e.name], d = l2.forages;
|
|
2283
2282
|
s.close();
|
|
2284
|
-
for (var y3 = 0; y3 <
|
|
2285
|
-
var A2 =
|
|
2283
|
+
for (var y3 = 0; y3 < d.length; y3++) {
|
|
2284
|
+
var A2 = d[y3];
|
|
2286
2285
|
A2._dbInfo.db = null, A2._dbInfo.version = c2;
|
|
2287
2286
|
}
|
|
2288
|
-
var
|
|
2289
|
-
var
|
|
2290
|
-
|
|
2291
|
-
var de =
|
|
2287
|
+
var x3 = new m3(function(L3, H3) {
|
|
2288
|
+
var z3 = M.open(e.name, c2);
|
|
2289
|
+
z3.onerror = function(q3) {
|
|
2290
|
+
var de = z3.result;
|
|
2292
2291
|
de.close(), H3(q3);
|
|
2293
|
-
},
|
|
2294
|
-
var q3 =
|
|
2292
|
+
}, z3.onupgradeneeded = function() {
|
|
2293
|
+
var q3 = z3.result;
|
|
2295
2294
|
q3.deleteObjectStore(e.storeName);
|
|
2296
|
-
},
|
|
2297
|
-
var q3 =
|
|
2298
|
-
q3.close(),
|
|
2295
|
+
}, z3.onsuccess = function() {
|
|
2296
|
+
var q3 = z3.result;
|
|
2297
|
+
q3.close(), L3(q3);
|
|
2299
2298
|
};
|
|
2300
2299
|
});
|
|
2301
|
-
return
|
|
2302
|
-
|
|
2303
|
-
for (var H3 = 0; H3 <
|
|
2304
|
-
var
|
|
2305
|
-
|
|
2300
|
+
return x3.then(function(L3) {
|
|
2301
|
+
l2.db = L3;
|
|
2302
|
+
for (var H3 = 0; H3 < d.length; H3++) {
|
|
2303
|
+
var z3 = d[H3];
|
|
2304
|
+
z3._dbInfo.db = L3, X(z3._dbInfo);
|
|
2306
2305
|
}
|
|
2307
|
-
}).catch(function(
|
|
2308
|
-
throw (Q3(e,
|
|
2309
|
-
}),
|
|
2306
|
+
}).catch(function(L3) {
|
|
2307
|
+
throw (Q3(e, L3) || m3.resolve()).catch(function() {
|
|
2308
|
+
}), L3;
|
|
2310
2309
|
});
|
|
2311
2310
|
}
|
|
2312
2311
|
}) : o = f3.then(function(s) {
|
|
2313
2312
|
G2(e);
|
|
2314
|
-
var c2 = U3[e.name],
|
|
2313
|
+
var c2 = U3[e.name], l2 = c2.forages;
|
|
2315
2314
|
s.close();
|
|
2316
|
-
for (var
|
|
2317
|
-
var y3 =
|
|
2315
|
+
for (var d = 0; d < l2.length; d++) {
|
|
2316
|
+
var y3 = l2[d];
|
|
2318
2317
|
y3._dbInfo.db = null;
|
|
2319
2318
|
}
|
|
2320
|
-
var A2 = new m3(function(
|
|
2321
|
-
var H3 =
|
|
2319
|
+
var A2 = new m3(function(x3, L3) {
|
|
2320
|
+
var H3 = M.deleteDatabase(e.name);
|
|
2322
2321
|
H3.onerror = function() {
|
|
2323
|
-
var
|
|
2324
|
-
|
|
2322
|
+
var z3 = H3.result;
|
|
2323
|
+
z3 && z3.close(), L3(H3.error);
|
|
2325
2324
|
}, H3.onblocked = function() {
|
|
2326
2325
|
console.warn('dropInstance blocked for database "' + e.name + '" until all open connections are closed');
|
|
2327
2326
|
}, H3.onsuccess = function() {
|
|
2328
|
-
var
|
|
2329
|
-
|
|
2327
|
+
var z3 = H3.result;
|
|
2328
|
+
z3 && z3.close(), x3(z3);
|
|
2330
2329
|
};
|
|
2331
2330
|
});
|
|
2332
|
-
return A2.then(function(
|
|
2333
|
-
c2.db =
|
|
2334
|
-
for (var
|
|
2335
|
-
var H3 =
|
|
2336
|
-
|
|
2331
|
+
return A2.then(function(x3) {
|
|
2332
|
+
c2.db = x3;
|
|
2333
|
+
for (var L3 = 0; L3 < l2.length; L3++) {
|
|
2334
|
+
var H3 = l2[L3];
|
|
2335
|
+
X(H3._dbInfo);
|
|
2337
2336
|
}
|
|
2338
|
-
}).catch(function(
|
|
2339
|
-
throw (Q3(e,
|
|
2340
|
-
}),
|
|
2337
|
+
}).catch(function(x3) {
|
|
2338
|
+
throw (Q3(e, x3) || m3.resolve()).catch(function() {
|
|
2339
|
+
}), x3;
|
|
2341
2340
|
});
|
|
2342
2341
|
});
|
|
2343
2342
|
}
|
|
2344
2343
|
return w2(o, t), o;
|
|
2345
2344
|
}
|
|
2346
|
-
var vr2 = { _driver: "asyncStorage", _initStorage: se2, _support: K2(), iterate: ce2, getItem: ae2, setItem:
|
|
2345
|
+
var vr2 = { _driver: "asyncStorage", _initStorage: se2, _support: K2(), iterate: ce2, getItem: ae2, setItem: ar2, removeItem: fr2, clear: sr2, length: ur2, key: cr2, keys: lr2, dropInstance: dr2 };
|
|
2347
2346
|
function hr2() {
|
|
2348
2347
|
return typeof openDatabase == "function";
|
|
2349
2348
|
}
|
|
2350
|
-
var ne = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", mr2 = "~~local_forage_type~", Be2 = /^~~local_forage_type~([^~]+)~/,
|
|
2349
|
+
var ne = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", mr2 = "~~local_forage_type~", Be2 = /^~~local_forage_type~([^~]+)~/, he = "__lfsc__:", be2 = he.length, _e2 = "arbf", we2 = "blob", xe2 = "si08", Oe2 = "ui08", Ce = "uic8", Le2 = "si16", Pe = "si32", Me2 = "ur16", Fe2 = "ui32", Ue2 = "fl32", Ye2 = "fl64", We2 = be2 + _e2.length, ze2 = Object.prototype.toString;
|
|
2351
2350
|
function He2(e) {
|
|
2352
2351
|
var t = e.length * 0.75, r = e.length, i, o = 0, n, f3, s, c2;
|
|
2353
2352
|
e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
|
|
2354
|
-
var
|
|
2355
|
-
for (i = 0; i < r; i += 4) n = ne.indexOf(e[i]), f3 = ne.indexOf(e[i + 1]), s = ne.indexOf(e[i + 2]), c2 = ne.indexOf(e[i + 3]),
|
|
2356
|
-
return
|
|
2353
|
+
var l2 = new ArrayBuffer(t), d = new Uint8Array(l2);
|
|
2354
|
+
for (i = 0; i < r; i += 4) n = ne.indexOf(e[i]), f3 = ne.indexOf(e[i + 1]), s = ne.indexOf(e[i + 2]), c2 = ne.indexOf(e[i + 3]), d[o++] = n << 2 | f3 >> 4, d[o++] = (f3 & 15) << 4 | s >> 2, d[o++] = (s & 3) << 6 | c2 & 63;
|
|
2355
|
+
return l2;
|
|
2357
2356
|
}
|
|
2358
2357
|
function Ie(e) {
|
|
2359
2358
|
var t = new Uint8Array(e), r = "", i;
|
|
@@ -2363,13 +2362,13 @@ var init_es4 = __esm({
|
|
|
2363
2362
|
function yr2(e, t) {
|
|
2364
2363
|
var r = "";
|
|
2365
2364
|
if (e && (r = ze2.call(e)), e && (r === "[object ArrayBuffer]" || e.buffer && ze2.call(e.buffer) === "[object ArrayBuffer]")) {
|
|
2366
|
-
var i, o =
|
|
2367
|
-
e instanceof ArrayBuffer ? (i = e, o += _e2) : (i = e.buffer, r === "[object Int8Array]" ? o += xe2 : r === "[object Uint8Array]" ? o += Oe2 : r === "[object Uint8ClampedArray]" ? o += Ce : r === "[object Int16Array]" ? o += Le2 : r === "[object Uint16Array]" ? o += Me2 : r === "[object Int32Array]" ? o +=
|
|
2365
|
+
var i, o = he;
|
|
2366
|
+
e instanceof ArrayBuffer ? (i = e, o += _e2) : (i = e.buffer, r === "[object Int8Array]" ? o += xe2 : r === "[object Uint8Array]" ? o += Oe2 : r === "[object Uint8ClampedArray]" ? o += Ce : r === "[object Int16Array]" ? o += Le2 : r === "[object Uint16Array]" ? o += Me2 : r === "[object Int32Array]" ? o += Pe : r === "[object Uint32Array]" ? o += Fe2 : r === "[object Float32Array]" ? o += Ue2 : r === "[object Float64Array]" ? o += Ye2 : t(new Error("Failed to get type for BinaryArray"))), t(o + Ie(i));
|
|
2368
2367
|
} else if (r === "[object Blob]") {
|
|
2369
2368
|
var n = new FileReader();
|
|
2370
2369
|
n.onload = function() {
|
|
2371
2370
|
var f3 = mr2 + e.type + "~" + Ie(this.result);
|
|
2372
|
-
t(
|
|
2371
|
+
t(he + we2 + f3);
|
|
2373
2372
|
}, n.readAsArrayBuffer(e);
|
|
2374
2373
|
} else try {
|
|
2375
2374
|
t(JSON.stringify(e));
|
|
@@ -2378,9 +2377,9 @@ var init_es4 = __esm({
|
|
|
2378
2377
|
}
|
|
2379
2378
|
}
|
|
2380
2379
|
function pr2(e) {
|
|
2381
|
-
if (e.substring(0, be2) !==
|
|
2380
|
+
if (e.substring(0, be2) !== he) return JSON.parse(e);
|
|
2382
2381
|
var t = e.substring(We2), r = e.substring(be2, We2), i;
|
|
2383
|
-
if (r ===
|
|
2382
|
+
if (r === we2 && Be2.test(t)) {
|
|
2384
2383
|
var o = t.match(Be2);
|
|
2385
2384
|
i = o[1], t = t.substring(o[0].length);
|
|
2386
2385
|
}
|
|
@@ -2388,7 +2387,7 @@ var init_es4 = __esm({
|
|
|
2388
2387
|
switch (r) {
|
|
2389
2388
|
case _e2:
|
|
2390
2389
|
return n;
|
|
2391
|
-
case
|
|
2390
|
+
case we2:
|
|
2392
2391
|
return J3([n], { type: i });
|
|
2393
2392
|
case xe2:
|
|
2394
2393
|
return new Int8Array(n);
|
|
@@ -2400,13 +2399,13 @@ var init_es4 = __esm({
|
|
|
2400
2399
|
return new Int16Array(n);
|
|
2401
2400
|
case Me2:
|
|
2402
2401
|
return new Uint16Array(n);
|
|
2403
|
-
case
|
|
2402
|
+
case Pe:
|
|
2404
2403
|
return new Int32Array(n);
|
|
2405
2404
|
case Fe2:
|
|
2406
2405
|
return new Uint32Array(n);
|
|
2407
|
-
case
|
|
2406
|
+
case Ue2:
|
|
2408
2407
|
return new Float32Array(n);
|
|
2409
|
-
case
|
|
2408
|
+
case Ye2:
|
|
2410
2409
|
return new Float64Array(n);
|
|
2411
2410
|
default:
|
|
2412
2411
|
throw new Error("Unkown type: " + r);
|
|
@@ -2428,8 +2427,8 @@ var init_es4 = __esm({
|
|
|
2428
2427
|
r.db.transaction(function(s) {
|
|
2429
2428
|
Ke2(s, r, function() {
|
|
2430
2429
|
t._dbInfo = r, n();
|
|
2431
|
-
}, function(c2,
|
|
2432
|
-
f3(
|
|
2430
|
+
}, function(c2, l2) {
|
|
2431
|
+
f3(l2);
|
|
2433
2432
|
});
|
|
2434
2433
|
}, f3);
|
|
2435
2434
|
});
|
|
@@ -2437,47 +2436,47 @@ var init_es4 = __esm({
|
|
|
2437
2436
|
}
|
|
2438
2437
|
function ie2(e, t, r, i, o, n) {
|
|
2439
2438
|
e.executeSql(r, i, o, function(f3, s) {
|
|
2440
|
-
s.code === s.SYNTAX_ERR ? f3.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?", [t.storeName], function(c2,
|
|
2441
|
-
|
|
2439
|
+
s.code === s.SYNTAX_ERR ? f3.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?", [t.storeName], function(c2, l2) {
|
|
2440
|
+
l2.rows.length ? n(c2, s) : Ke2(c2, t, function() {
|
|
2442
2441
|
c2.executeSql(r, i, o, n);
|
|
2443
2442
|
}, n);
|
|
2444
2443
|
}, n) : n(f3, s);
|
|
2445
2444
|
}, n);
|
|
2446
2445
|
}
|
|
2447
|
-
function
|
|
2446
|
+
function br2(e, t) {
|
|
2448
2447
|
var r = this;
|
|
2449
2448
|
e = W3(e);
|
|
2450
2449
|
var i = new m3(function(o, n) {
|
|
2451
2450
|
r.ready().then(function() {
|
|
2452
2451
|
var f3 = r._dbInfo;
|
|
2453
2452
|
f3.db.transaction(function(s) {
|
|
2454
|
-
ie2(s, f3, "SELECT * FROM " + f3.storeName + " WHERE key = ? LIMIT 1", [e], function(c2,
|
|
2455
|
-
var
|
|
2456
|
-
|
|
2457
|
-
}, function(c2,
|
|
2458
|
-
n(
|
|
2453
|
+
ie2(s, f3, "SELECT * FROM " + f3.storeName + " WHERE key = ? LIMIT 1", [e], function(c2, l2) {
|
|
2454
|
+
var d = l2.rows.length ? l2.rows.item(0).value : null;
|
|
2455
|
+
d && (d = f3.serializer.deserialize(d)), o(d);
|
|
2456
|
+
}, function(c2, l2) {
|
|
2457
|
+
n(l2);
|
|
2459
2458
|
});
|
|
2460
2459
|
});
|
|
2461
2460
|
}).catch(n);
|
|
2462
2461
|
});
|
|
2463
2462
|
return w2(i, t), i;
|
|
2464
2463
|
}
|
|
2465
|
-
function
|
|
2464
|
+
function _r2(e, t) {
|
|
2466
2465
|
var r = this, i = new m3(function(o, n) {
|
|
2467
2466
|
r.ready().then(function() {
|
|
2468
2467
|
var f3 = r._dbInfo;
|
|
2469
2468
|
f3.db.transaction(function(s) {
|
|
2470
|
-
ie2(s, f3, "SELECT * FROM " + f3.storeName, [], function(c2,
|
|
2471
|
-
for (var
|
|
2472
|
-
var
|
|
2473
|
-
if (
|
|
2474
|
-
o(
|
|
2469
|
+
ie2(s, f3, "SELECT * FROM " + f3.storeName, [], function(c2, l2) {
|
|
2470
|
+
for (var d = l2.rows, y3 = d.length, A2 = 0; A2 < y3; A2++) {
|
|
2471
|
+
var x3 = d.item(A2), L3 = x3.value;
|
|
2472
|
+
if (L3 && (L3 = f3.serializer.deserialize(L3)), L3 = e(L3, x3.key, A2 + 1), L3 !== void 0) {
|
|
2473
|
+
o(L3);
|
|
2475
2474
|
return;
|
|
2476
2475
|
}
|
|
2477
2476
|
}
|
|
2478
2477
|
o();
|
|
2479
|
-
}, function(c2,
|
|
2480
|
-
n(
|
|
2478
|
+
}, function(c2, l2) {
|
|
2479
|
+
n(l2);
|
|
2481
2480
|
});
|
|
2482
2481
|
});
|
|
2483
2482
|
}).catch(n);
|
|
@@ -2490,13 +2489,13 @@ var init_es4 = __esm({
|
|
|
2490
2489
|
var n = new m3(function(f3, s) {
|
|
2491
2490
|
o.ready().then(function() {
|
|
2492
2491
|
t === void 0 && (t = null);
|
|
2493
|
-
var c2 = t,
|
|
2494
|
-
|
|
2495
|
-
y3 ? s(y3) :
|
|
2496
|
-
ie2(A2,
|
|
2492
|
+
var c2 = t, l2 = o._dbInfo;
|
|
2493
|
+
l2.serializer.serialize(t, function(d, y3) {
|
|
2494
|
+
y3 ? s(y3) : l2.db.transaction(function(A2) {
|
|
2495
|
+
ie2(A2, l2, "INSERT OR REPLACE INTO " + l2.storeName + " (key, value) VALUES (?, ?)", [e, d], function() {
|
|
2497
2496
|
f3(c2);
|
|
2498
|
-
}, function(
|
|
2499
|
-
s(
|
|
2497
|
+
}, function(x3, L3) {
|
|
2498
|
+
s(L3);
|
|
2500
2499
|
});
|
|
2501
2500
|
}, function(A2) {
|
|
2502
2501
|
if (A2.code === A2.QUOTA_ERR) {
|
|
@@ -2524,8 +2523,8 @@ var init_es4 = __esm({
|
|
|
2524
2523
|
f3.db.transaction(function(s) {
|
|
2525
2524
|
ie2(s, f3, "DELETE FROM " + f3.storeName + " WHERE key = ?", [e], function() {
|
|
2526
2525
|
o();
|
|
2527
|
-
}, function(c2,
|
|
2528
|
-
n(
|
|
2526
|
+
}, function(c2, l2) {
|
|
2527
|
+
n(l2);
|
|
2529
2528
|
});
|
|
2530
2529
|
});
|
|
2531
2530
|
}).catch(n);
|
|
@@ -2553,8 +2552,8 @@ var init_es4 = __esm({
|
|
|
2553
2552
|
var n = t._dbInfo;
|
|
2554
2553
|
n.db.transaction(function(f3) {
|
|
2555
2554
|
ie2(f3, n, "SELECT COUNT(key) as c FROM " + n.storeName, [], function(s, c2) {
|
|
2556
|
-
var
|
|
2557
|
-
i(
|
|
2555
|
+
var l2 = c2.rows.item(0).c;
|
|
2556
|
+
i(l2);
|
|
2558
2557
|
}, function(s, c2) {
|
|
2559
2558
|
o(c2);
|
|
2560
2559
|
});
|
|
@@ -2568,11 +2567,11 @@ var init_es4 = __esm({
|
|
|
2568
2567
|
r.ready().then(function() {
|
|
2569
2568
|
var f3 = r._dbInfo;
|
|
2570
2569
|
f3.db.transaction(function(s) {
|
|
2571
|
-
ie2(s, f3, "SELECT key FROM " + f3.storeName + " WHERE id = ? LIMIT 1", [e + 1], function(c2,
|
|
2572
|
-
var
|
|
2573
|
-
o(
|
|
2574
|
-
}, function(c2,
|
|
2575
|
-
n(
|
|
2570
|
+
ie2(s, f3, "SELECT key FROM " + f3.storeName + " WHERE id = ? LIMIT 1", [e + 1], function(c2, l2) {
|
|
2571
|
+
var d = l2.rows.length ? l2.rows.item(0).key : null;
|
|
2572
|
+
o(d);
|
|
2573
|
+
}, function(c2, l2) {
|
|
2574
|
+
n(l2);
|
|
2576
2575
|
});
|
|
2577
2576
|
});
|
|
2578
2577
|
}).catch(n);
|
|
@@ -2585,8 +2584,8 @@ var init_es4 = __esm({
|
|
|
2585
2584
|
var n = t._dbInfo;
|
|
2586
2585
|
n.db.transaction(function(f3) {
|
|
2587
2586
|
ie2(f3, n, "SELECT key FROM " + n.storeName, [], function(s, c2) {
|
|
2588
|
-
for (var
|
|
2589
|
-
i(
|
|
2587
|
+
for (var l2 = [], d = 0; d < c2.rows.length; d++) l2.push(c2.rows.item(d).key);
|
|
2588
|
+
i(l2);
|
|
2590
2589
|
}, function(s, c2) {
|
|
2591
2590
|
o(c2);
|
|
2592
2591
|
});
|
|
@@ -2609,7 +2608,7 @@ var init_es4 = __esm({
|
|
|
2609
2608
|
});
|
|
2610
2609
|
});
|
|
2611
2610
|
}
|
|
2612
|
-
function
|
|
2611
|
+
function Dr2(e, t) {
|
|
2613
2612
|
t = Z.apply(this, arguments);
|
|
2614
2613
|
var r = this.config();
|
|
2615
2614
|
e = typeof e != "function" && e || {}, e.name || (e.name = e.name || r.name, e.storeName = e.storeName || r.storeName);
|
|
@@ -2620,20 +2619,20 @@ var init_es4 = __esm({
|
|
|
2620
2619
|
}).then(function(n) {
|
|
2621
2620
|
return new m3(function(f3, s) {
|
|
2622
2621
|
n.db.transaction(function(c2) {
|
|
2623
|
-
function
|
|
2624
|
-
return new m3(function(
|
|
2625
|
-
c2.executeSql("DROP TABLE IF EXISTS " +
|
|
2626
|
-
|
|
2627
|
-
}, function(
|
|
2622
|
+
function l2(x3) {
|
|
2623
|
+
return new m3(function(L3, H3) {
|
|
2624
|
+
c2.executeSql("DROP TABLE IF EXISTS " + x3, [], function() {
|
|
2625
|
+
L3();
|
|
2626
|
+
}, function(z3, q3) {
|
|
2628
2627
|
H3(q3);
|
|
2629
2628
|
});
|
|
2630
2629
|
});
|
|
2631
2630
|
}
|
|
2632
|
-
for (var
|
|
2633
|
-
m3.all(
|
|
2631
|
+
for (var d = [], y3 = 0, A2 = n.storeNames.length; y3 < A2; y3++) d.push(l2(n.storeNames[y3]));
|
|
2632
|
+
m3.all(d).then(function() {
|
|
2634
2633
|
f3();
|
|
2635
|
-
}).catch(function(
|
|
2636
|
-
s(
|
|
2634
|
+
}).catch(function(x3) {
|
|
2635
|
+
s(x3);
|
|
2637
2636
|
});
|
|
2638
2637
|
}, function(c2) {
|
|
2639
2638
|
s(c2);
|
|
@@ -2641,8 +2640,8 @@ var init_es4 = __esm({
|
|
|
2641
2640
|
});
|
|
2642
2641
|
}) : o = m3.reject("Invalid arguments"), w2(o, t), o;
|
|
2643
2642
|
}
|
|
2644
|
-
var Nr2 = { _driver: "webSQLStorage", _initStorage: gr2, _support: hr2(), iterate:
|
|
2645
|
-
function
|
|
2643
|
+
var Nr2 = { _driver: "webSQLStorage", _initStorage: gr2, _support: hr2(), iterate: _r2, getItem: br2, setItem: wr2, removeItem: Ir2, clear: Er2, length: Sr2, key: Ar2, keys: Tr2, dropInstance: Dr2 };
|
|
2644
|
+
function Br2() {
|
|
2646
2645
|
try {
|
|
2647
2646
|
return typeof localStorage < "u" && "setItem" in localStorage && !!localStorage.setItem;
|
|
2648
2647
|
} catch {
|
|
@@ -2653,7 +2652,7 @@ var init_es4 = __esm({
|
|
|
2653
2652
|
var r = e.name + "/";
|
|
2654
2653
|
return e.storeName !== t.storeName && (r += e.storeName + "/"), r;
|
|
2655
2654
|
}
|
|
2656
|
-
function
|
|
2655
|
+
function xr2() {
|
|
2657
2656
|
var e = "_localforage_support_test";
|
|
2658
2657
|
try {
|
|
2659
2658
|
return localStorage.setItem(e, true), localStorage.removeItem(e), false;
|
|
@@ -2661,15 +2660,15 @@ var init_es4 = __esm({
|
|
|
2661
2660
|
return true;
|
|
2662
2661
|
}
|
|
2663
2662
|
}
|
|
2664
|
-
function
|
|
2665
|
-
return !
|
|
2663
|
+
function Or2() {
|
|
2664
|
+
return !xr2() || localStorage.length > 0;
|
|
2666
2665
|
}
|
|
2667
2666
|
function Cr2(e) {
|
|
2668
2667
|
var t = this, r = {};
|
|
2669
2668
|
if (e) for (var i in e) r[i] = e[i];
|
|
2670
|
-
return r.keyPrefix = Ve2(e, t._defaultConfig),
|
|
2669
|
+
return r.keyPrefix = Ve2(e, t._defaultConfig), Or2() ? (t._dbInfo = r, r.serializer = Ee2, m3.resolve()) : m3.reject();
|
|
2671
2670
|
}
|
|
2672
|
-
function
|
|
2671
|
+
function Lr2(e) {
|
|
2673
2672
|
var t = this, r = t.ready().then(function() {
|
|
2674
2673
|
for (var i = t._dbInfo.keyPrefix, o = localStorage.length - 1; o >= 0; o--) {
|
|
2675
2674
|
var n = localStorage.key(o);
|
|
@@ -2689,17 +2688,17 @@ var init_es4 = __esm({
|
|
|
2689
2688
|
}
|
|
2690
2689
|
function Mr2(e, t) {
|
|
2691
2690
|
var r = this, i = r.ready().then(function() {
|
|
2692
|
-
for (var o = r._dbInfo, n = o.keyPrefix, f3 = n.length, s = localStorage.length, c2 = 1,
|
|
2693
|
-
var
|
|
2694
|
-
if (
|
|
2695
|
-
var y3 = localStorage.getItem(
|
|
2696
|
-
if (y3 && (y3 = o.serializer.deserialize(y3)), y3 = e(y3,
|
|
2691
|
+
for (var o = r._dbInfo, n = o.keyPrefix, f3 = n.length, s = localStorage.length, c2 = 1, l2 = 0; l2 < s; l2++) {
|
|
2692
|
+
var d = localStorage.key(l2);
|
|
2693
|
+
if (d.indexOf(n) === 0) {
|
|
2694
|
+
var y3 = localStorage.getItem(d);
|
|
2695
|
+
if (y3 && (y3 = o.serializer.deserialize(y3)), y3 = e(y3, d.substring(f3), c2++), y3 !== void 0) return y3;
|
|
2697
2696
|
}
|
|
2698
2697
|
}
|
|
2699
2698
|
});
|
|
2700
2699
|
return w2(i, t), i;
|
|
2701
2700
|
}
|
|
2702
|
-
function
|
|
2701
|
+
function Fr2(e, t) {
|
|
2703
2702
|
var r = this, i = r.ready().then(function() {
|
|
2704
2703
|
var o = r._dbInfo, n;
|
|
2705
2704
|
try {
|
|
@@ -2711,7 +2710,7 @@ var init_es4 = __esm({
|
|
|
2711
2710
|
});
|
|
2712
2711
|
return w2(i, t), i;
|
|
2713
2712
|
}
|
|
2714
|
-
function
|
|
2713
|
+
function Ur2(e) {
|
|
2715
2714
|
var t = this, r = t.ready().then(function() {
|
|
2716
2715
|
for (var i = t._dbInfo, o = localStorage.length, n = [], f3 = 0; f3 < o; f3++) {
|
|
2717
2716
|
var s = localStorage.key(f3);
|
|
@@ -2721,13 +2720,13 @@ var init_es4 = __esm({
|
|
|
2721
2720
|
});
|
|
2722
2721
|
return w2(r, e), r;
|
|
2723
2722
|
}
|
|
2724
|
-
function
|
|
2723
|
+
function Yr2(e) {
|
|
2725
2724
|
var t = this, r = t.keys().then(function(i) {
|
|
2726
2725
|
return i.length;
|
|
2727
2726
|
});
|
|
2728
2727
|
return w2(r, e), r;
|
|
2729
2728
|
}
|
|
2730
|
-
function
|
|
2729
|
+
function Wr2(e, t) {
|
|
2731
2730
|
var r = this;
|
|
2732
2731
|
e = W3(e);
|
|
2733
2732
|
var i = r.ready().then(function() {
|
|
@@ -2744,10 +2743,10 @@ var init_es4 = __esm({
|
|
|
2744
2743
|
var n = t;
|
|
2745
2744
|
return new m3(function(f3, s) {
|
|
2746
2745
|
var c2 = i._dbInfo;
|
|
2747
|
-
c2.serializer.serialize(t, function(
|
|
2748
|
-
if (
|
|
2746
|
+
c2.serializer.serialize(t, function(l2, d) {
|
|
2747
|
+
if (d) s(d);
|
|
2749
2748
|
else try {
|
|
2750
|
-
localStorage.setItem(c2.keyPrefix + e,
|
|
2749
|
+
localStorage.setItem(c2.keyPrefix + e, l2), f3(n);
|
|
2751
2750
|
} catch (y3) {
|
|
2752
2751
|
(y3.name === "QuotaExceededError" || y3.name === "NS_ERROR_DOM_QUOTA_REACHED") && s(y3), s(y3);
|
|
2753
2752
|
}
|
|
@@ -2756,7 +2755,7 @@ var init_es4 = __esm({
|
|
|
2756
2755
|
});
|
|
2757
2756
|
return w2(o, r), o;
|
|
2758
2757
|
}
|
|
2759
|
-
function
|
|
2758
|
+
function Hr2(e, t) {
|
|
2760
2759
|
if (t = Z.apply(this, arguments), e = typeof e != "function" && e || {}, !e.name) {
|
|
2761
2760
|
var r = this.config();
|
|
2762
2761
|
e.name = e.name || r.name, e.storeName = e.storeName || r.storeName;
|
|
@@ -2771,18 +2770,18 @@ var init_es4 = __esm({
|
|
|
2771
2770
|
}
|
|
2772
2771
|
}) : o = m3.reject("Invalid arguments"), w2(o, t), o;
|
|
2773
2772
|
}
|
|
2774
|
-
var
|
|
2773
|
+
var Kr2 = { _driver: "localStorageWrapper", _initStorage: Cr2, _support: Br2(), iterate: Mr2, getItem: Pr2, setItem: zr, removeItem: Wr2, clear: Lr2, length: Yr2, key: Fr2, keys: Ur2, dropInstance: Hr2 }, Gr2 = function(t, r) {
|
|
2775
2774
|
return t === r || typeof t == "number" && typeof r == "number" && isNaN(t) && isNaN(r);
|
|
2776
2775
|
}, Vr2 = function(t, r) {
|
|
2777
2776
|
for (var i = t.length, o = 0; o < i; ) {
|
|
2778
|
-
if (
|
|
2777
|
+
if (Gr2(t[o], r)) return true;
|
|
2779
2778
|
o++;
|
|
2780
2779
|
}
|
|
2781
2780
|
return false;
|
|
2782
2781
|
}, je2 = Array.isArray || function(e) {
|
|
2783
2782
|
return Object.prototype.toString.call(e) === "[object Array]";
|
|
2784
|
-
}, le2 = {},
|
|
2785
|
-
function
|
|
2783
|
+
}, le2 = {}, Xe2 = {}, ue2 = { INDEXEDDB: vr2, WEBSQL: Nr2, LOCALSTORAGE: Kr2 }, jr2 = [ue2.INDEXEDDB._driver, ue2.WEBSQL._driver, ue2.LOCALSTORAGE._driver], me2 = ["dropInstance"], Se = ["clear", "getItem", "iterate", "key", "keys", "length", "removeItem", "setItem"].concat(me2), Xr = { description: "", driver: jr2.slice(), name: "localforage", size: 4980736, storeName: "keyvaluepairs", version: 1 };
|
|
2784
|
+
function Qr2(e, t) {
|
|
2786
2785
|
e[t] = function() {
|
|
2787
2786
|
var r = arguments;
|
|
2788
2787
|
return e.ready().then(function() {
|
|
@@ -2797,7 +2796,7 @@ var init_es4 = __esm({
|
|
|
2797
2796
|
}
|
|
2798
2797
|
return arguments[0];
|
|
2799
2798
|
}
|
|
2800
|
-
var $
|
|
2799
|
+
var $r2 = function() {
|
|
2801
2800
|
function e(t) {
|
|
2802
2801
|
Y3(this, e);
|
|
2803
2802
|
for (var r in ue2) if (ue2.hasOwnProperty(r)) {
|
|
@@ -2819,34 +2818,34 @@ var init_es4 = __esm({
|
|
|
2819
2818
|
}, e.prototype.defineDriver = function(r, i, o) {
|
|
2820
2819
|
var n = new m3(function(f3, s) {
|
|
2821
2820
|
try {
|
|
2822
|
-
var c2 = r._driver,
|
|
2821
|
+
var c2 = r._driver, l2 = new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");
|
|
2823
2822
|
if (!r._driver) {
|
|
2824
|
-
s(
|
|
2823
|
+
s(l2);
|
|
2825
2824
|
return;
|
|
2826
2825
|
}
|
|
2827
|
-
for (var
|
|
2828
|
-
var
|
|
2829
|
-
if ((
|
|
2830
|
-
s(
|
|
2826
|
+
for (var d = Se.concat("_initStorage"), y3 = 0, A2 = d.length; y3 < A2; y3++) {
|
|
2827
|
+
var x3 = d[y3], L3 = !Vr2(me2, x3);
|
|
2828
|
+
if ((L3 || r[x3]) && typeof r[x3] != "function") {
|
|
2829
|
+
s(l2);
|
|
2831
2830
|
return;
|
|
2832
2831
|
}
|
|
2833
2832
|
}
|
|
2834
2833
|
var H3 = function() {
|
|
2835
|
-
for (var de = function(
|
|
2834
|
+
for (var de = function(qr2) {
|
|
2836
2835
|
return function() {
|
|
2837
|
-
var
|
|
2836
|
+
var kr2 = new Error("Method " + qr2 + " is not implemented by the current driver"), Qe2 = m3.reject(kr2);
|
|
2838
2837
|
return w2(Qe2, arguments[arguments.length - 1]), Qe2;
|
|
2839
2838
|
};
|
|
2840
|
-
}, Te = 0, Zr =
|
|
2841
|
-
var Re2 =
|
|
2839
|
+
}, Te = 0, Zr = me2.length; Te < Zr; Te++) {
|
|
2840
|
+
var Re2 = me2[Te];
|
|
2842
2841
|
r[Re2] || (r[Re2] = de(Re2));
|
|
2843
2842
|
}
|
|
2844
2843
|
};
|
|
2845
2844
|
H3();
|
|
2846
|
-
var
|
|
2847
|
-
le2[c2] && console.info("Redefining LocalForage driver: " + c2), le2[c2] = r,
|
|
2845
|
+
var z3 = function(de) {
|
|
2846
|
+
le2[c2] && console.info("Redefining LocalForage driver: " + c2), le2[c2] = r, Xe2[c2] = de, f3();
|
|
2848
2847
|
};
|
|
2849
|
-
"_support" in r ? r._support && typeof r._support == "function" ? r._support().then(
|
|
2848
|
+
"_support" in r ? r._support && typeof r._support == "function" ? r._support().then(z3, s) : z3(!!r._support) : z3(true);
|
|
2850
2849
|
} catch (q3) {
|
|
2851
2850
|
s(q3);
|
|
2852
2851
|
}
|
|
@@ -2875,28 +2874,28 @@ var init_es4 = __esm({
|
|
|
2875
2874
|
function c2(y3) {
|
|
2876
2875
|
return n._extend(y3), s(), n._ready = n._initStorage(n._config), n._ready;
|
|
2877
2876
|
}
|
|
2878
|
-
function
|
|
2877
|
+
function l2(y3) {
|
|
2879
2878
|
return function() {
|
|
2880
2879
|
var A2 = 0;
|
|
2881
|
-
function
|
|
2880
|
+
function x3() {
|
|
2882
2881
|
for (; A2 < y3.length; ) {
|
|
2883
|
-
var
|
|
2884
|
-
return A2++, n._dbInfo = null, n._ready = null, n.getDriver(
|
|
2882
|
+
var L3 = y3[A2];
|
|
2883
|
+
return A2++, n._dbInfo = null, n._ready = null, n.getDriver(L3).then(c2).catch(x3);
|
|
2885
2884
|
}
|
|
2886
2885
|
s();
|
|
2887
2886
|
var H3 = new Error("No available storage method found.");
|
|
2888
2887
|
return n._driverSet = m3.reject(H3), n._driverSet;
|
|
2889
2888
|
}
|
|
2890
|
-
return
|
|
2889
|
+
return x3();
|
|
2891
2890
|
};
|
|
2892
2891
|
}
|
|
2893
|
-
var
|
|
2892
|
+
var d = this._driverSet !== null ? this._driverSet.catch(function() {
|
|
2894
2893
|
return m3.resolve();
|
|
2895
2894
|
}) : m3.resolve();
|
|
2896
|
-
return this._driverSet =
|
|
2895
|
+
return this._driverSet = d.then(function() {
|
|
2897
2896
|
var y3 = f3[0];
|
|
2898
2897
|
return n._dbInfo = null, n._ready = null, n.getDriver(y3).then(function(A2) {
|
|
2899
|
-
n._driver = A2._driver, s(), n._wrapLibraryMethodsWithReady(), n._initDriver =
|
|
2898
|
+
n._driver = A2._driver, s(), n._wrapLibraryMethodsWithReady(), n._initDriver = l2(f3);
|
|
2900
2899
|
});
|
|
2901
2900
|
}).catch(function() {
|
|
2902
2901
|
s();
|
|
@@ -2904,7 +2903,7 @@ var init_es4 = __esm({
|
|
|
2904
2903
|
return n._driverSet = m3.reject(y3), n._driverSet;
|
|
2905
2904
|
}), B3(this._driverSet, i, o), this._driverSet;
|
|
2906
2905
|
}, e.prototype.supports = function(r) {
|
|
2907
|
-
return !!
|
|
2906
|
+
return !!Xe2[r];
|
|
2908
2907
|
}, e.prototype._extend = function(r) {
|
|
2909
2908
|
Ae2(this, r);
|
|
2910
2909
|
}, e.prototype._getSupportedDrivers = function(r) {
|
|
@@ -2914,16 +2913,16 @@ var init_es4 = __esm({
|
|
|
2914
2913
|
}
|
|
2915
2914
|
return i;
|
|
2916
2915
|
}, e.prototype._wrapLibraryMethodsWithReady = function() {
|
|
2917
|
-
for (var r = 0, i =
|
|
2916
|
+
for (var r = 0, i = Se.length; r < i; r++) Qr2(this, Se[r]);
|
|
2918
2917
|
}, e.prototype.createInstance = function(r) {
|
|
2919
2918
|
return new e(r);
|
|
2920
2919
|
}, e;
|
|
2921
|
-
}(),
|
|
2922
|
-
R3.exports =
|
|
2920
|
+
}(), Jr2 = new $r2();
|
|
2921
|
+
R3.exports = Jr2;
|
|
2923
2922
|
}, { 3: 3 }] }, {}, [4])(4);
|
|
2924
2923
|
});
|
|
2925
2924
|
});
|
|
2926
|
-
|
|
2925
|
+
rr2 = Je((ye2, er2) => {
|
|
2927
2926
|
(function(b3, T2) {
|
|
2928
2927
|
typeof ye2 == "object" && typeof er2 < "u" ? T2(ye2) : typeof define == "function" && define.amd ? define("localforage-driver-memory", ["exports"], T2) : T2(b3.LocalforageDriverMemory = {});
|
|
2929
2928
|
})(typeof self < "u" ? self : ye2, function(b3) {
|
|
@@ -2955,7 +2954,7 @@ var init_es4 = __esm({
|
|
|
2955
2954
|
}
|
|
2956
2955
|
return p2;
|
|
2957
2956
|
}
|
|
2958
|
-
function
|
|
2957
|
+
function M(a2) {
|
|
2959
2958
|
for (var u3 = new Uint8Array(a2), v2 = "", p2 = 0; p2 < u3.length; p2 += 3) v2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u3[p2] >> 2], v2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u3[p2] & 3) << 4 | u3[p2 + 1] >> 4], v2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u3[p2 + 1] & 15) << 2 | u3[p2 + 2] >> 6], v2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u3[p2 + 2] & 63];
|
|
2960
2959
|
return u3.length % 3 === 2 ? v2 = v2.substring(0, v2.length - 1) + "=" : u3.length % 3 === 1 && (v2 = v2.substring(0, v2.length - 2) + "=="), v2;
|
|
2961
2960
|
}
|
|
@@ -2963,11 +2962,11 @@ var init_es4 = __esm({
|
|
|
2963
2962
|
var v2 = "";
|
|
2964
2963
|
if (a2 && (v2 = Y3.call(a2)), a2 && (v2 === "[object ArrayBuffer]" || a2.buffer && Y3.call(a2.buffer) === "[object ArrayBuffer]")) {
|
|
2965
2964
|
var p2 = void 0, g2 = "__lfsc__:";
|
|
2966
|
-
a2 instanceof ArrayBuffer ? (p2 = a2, g2 += "arbf") : (p2 = a2.buffer, v2 === "[object Int8Array]" ? g2 += "si08" : v2 === "[object Uint8Array]" ? g2 += "ui08" : v2 === "[object Uint8ClampedArray]" ? g2 += "uic8" : v2 === "[object Int16Array]" ? g2 += "si16" : v2 === "[object Uint16Array]" ? g2 += "ur16" : v2 === "[object Int32Array]" ? g2 += "si32" : v2 === "[object Uint32Array]" ? g2 += "ui32" : v2 === "[object Float32Array]" ? g2 += "fl32" : v2 === "[object Float64Array]" ? g2 += "fl64" : u3(new Error("Failed to get type for BinaryArray"))), u3(g2 +
|
|
2965
|
+
a2 instanceof ArrayBuffer ? (p2 = a2, g2 += "arbf") : (p2 = a2.buffer, v2 === "[object Int8Array]" ? g2 += "si08" : v2 === "[object Uint8Array]" ? g2 += "ui08" : v2 === "[object Uint8ClampedArray]" ? g2 += "uic8" : v2 === "[object Int16Array]" ? g2 += "si16" : v2 === "[object Uint16Array]" ? g2 += "ur16" : v2 === "[object Int32Array]" ? g2 += "si32" : v2 === "[object Uint32Array]" ? g2 += "ui32" : v2 === "[object Float32Array]" ? g2 += "fl32" : v2 === "[object Float64Array]" ? g2 += "fl64" : u3(new Error("Failed to get type for BinaryArray"))), u3(g2 + M(p2));
|
|
2967
2966
|
} else if (v2 === "[object Blob]") {
|
|
2968
2967
|
var I3 = new FileReader();
|
|
2969
2968
|
I3.onload = function() {
|
|
2970
|
-
var N2 = "~~local_forage_type~" + a2.type + "~" +
|
|
2969
|
+
var N2 = "~~local_forage_type~" + a2.type + "~" + M(this.result);
|
|
2971
2970
|
u3("__lfsc__:blob" + N2);
|
|
2972
2971
|
}, I3.readAsArrayBuffer(a2);
|
|
2973
2972
|
} else try {
|
|
@@ -3059,7 +3058,7 @@ var init_es4 = __esm({
|
|
|
3059
3058
|
function F3(a2) {
|
|
3060
3059
|
return typeof a2 != "string" && (console.warn(a2 + " used as a key, but it is not a string."), a2 = String(a2)), a2;
|
|
3061
3060
|
}
|
|
3062
|
-
var k3 = { bufferToString:
|
|
3061
|
+
var k3 = { bufferToString: M, deserialize: J3, serialize: K2, stringToBuffer: S3 }, U3 = {}, fe2 = function() {
|
|
3063
3062
|
function a2(u3) {
|
|
3064
3063
|
this.kp = u3, this.data = {};
|
|
3065
3064
|
}
|
|
@@ -3127,7 +3126,7 @@ var init_es4 = __esm({
|
|
|
3127
3126
|
});
|
|
3128
3127
|
return B3(p2, u3), p2;
|
|
3129
3128
|
}
|
|
3130
|
-
function
|
|
3129
|
+
function X(a2) {
|
|
3131
3130
|
var u3 = this, v2 = this.ready().then(function() {
|
|
3132
3131
|
return u3._dbInfo.mStore.keys();
|
|
3133
3132
|
});
|
|
@@ -3167,18 +3166,18 @@ var init_es4 = __esm({
|
|
|
3167
3166
|
return B3(g2, v2), g2;
|
|
3168
3167
|
}
|
|
3169
3168
|
var oe2 = true;
|
|
3170
|
-
b3._support = oe2, b3._driver = T2, b3._initStorage = te2, b3.clear = h3, b3.dropInstance = D3, b3.getItem = E3, b3.iterate = C3, b3.key = G2, b3.keys =
|
|
3169
|
+
b3._support = oe2, b3._driver = T2, b3._initStorage = te2, b3.clear = h3, b3.dropInstance = D3, b3.getItem = E3, b3.iterate = C3, b3.key = G2, b3.keys = X, b3.length = Q3, b3.removeItem = $, b3.setItem = ee, Object.defineProperty(b3, "__esModule", { value: true });
|
|
3171
3170
|
});
|
|
3172
3171
|
});
|
|
3173
|
-
ge2 = Ze(
|
|
3174
|
-
Ne2 = Ze(
|
|
3172
|
+
ge2 = Ze(ke());
|
|
3173
|
+
Ne2 = Ze(rr2());
|
|
3175
3174
|
ct2 = { display: "block", visibility: "hidden", position: "fixed", top: "0", right: "0", width: "100%", height: "100%", borderRadius: "0", border: "none", zIndex: "2147483647", opacity: "0" };
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
vt2 = 15 *
|
|
3179
|
-
ht2 = 2 *
|
|
3180
|
-
mt2 = 60 *
|
|
3181
|
-
pe2 = class extends
|
|
3175
|
+
ir2 = 1e3;
|
|
3176
|
+
or2 = 60 * ir2;
|
|
3177
|
+
vt2 = 15 * ir2;
|
|
3178
|
+
ht2 = 2 * or2;
|
|
3179
|
+
mt2 = 60 * or2;
|
|
3180
|
+
pe2 = class extends et {
|
|
3182
3181
|
constructor() {
|
|
3183
3182
|
super(...arguments);
|
|
3184
3183
|
this.activeElement = null;
|
|
@@ -3187,15 +3186,15 @@ var init_es4 = __esm({
|
|
|
3187
3186
|
this.timeoutTimer = null;
|
|
3188
3187
|
}
|
|
3189
3188
|
getIframeSrc() {
|
|
3190
|
-
return
|
|
3189
|
+
return Ye(`/send?params=${encodeURIComponent(this.parameters)}`, this.endpoint).href;
|
|
3191
3190
|
}
|
|
3192
3191
|
init() {
|
|
3193
3192
|
this.test = "hello", this.iframe = new Promise((_3) => {
|
|
3194
3193
|
let O3 = () => {
|
|
3195
|
-
if (dt2(encodeURIComponent(this.parameters)))
|
|
3194
|
+
if (dt2(encodeURIComponent(this.parameters))) Xn().log();
|
|
3196
3195
|
else {
|
|
3197
3196
|
let R3 = document.createElement("iframe");
|
|
3198
|
-
R3.classList.add("magic-iframe"), R3.dataset.magicIframeLabel =
|
|
3197
|
+
R3.classList.add("magic-iframe"), R3.dataset.magicIframeLabel = Ye(this.endpoint).host, R3.title = "Secure Modal", R3.src = this.getIframeSrc(), R3.allow = "clipboard-read; clipboard-write", lt2(R3), document.body.appendChild(R3), _3(R3);
|
|
3199
3198
|
}
|
|
3200
3199
|
};
|
|
3201
3200
|
["loaded", "interactive", "complete"].includes(document.readyState) ? O3() : window.addEventListener("load", O3, false);
|
|
@@ -3230,7 +3229,7 @@ var init_es4 = __esm({
|
|
|
3230
3229
|
return re(this, null, function* () {
|
|
3231
3230
|
let O3 = yield this.iframe;
|
|
3232
3231
|
if (O3 && O3.contentWindow) O3.contentWindow.postMessage(_3, this.endpoint);
|
|
3233
|
-
else throw
|
|
3232
|
+
else throw Tt();
|
|
3234
3233
|
});
|
|
3235
3234
|
}
|
|
3236
3235
|
heartBeatCheck() {
|
|
@@ -3251,29 +3250,29 @@ var init_es4 = __esm({
|
|
|
3251
3250
|
return re(this, null, function* () {
|
|
3252
3251
|
let _3 = yield this.iframe;
|
|
3253
3252
|
if (_3) _3.src = this.getIframeSrc();
|
|
3254
|
-
else throw
|
|
3253
|
+
else throw Tt();
|
|
3255
3254
|
});
|
|
3256
3255
|
}
|
|
3257
3256
|
};
|
|
3258
|
-
Rt2 =
|
|
3257
|
+
Rt2 = Qr(qe, { platform: "web", sdkName: "magic-sdk", version: "28.21.0", defaultEndpoint: "https://auth.magic.link/", ViewController: pe2, configureStorage: () => re(void 0, null, function* () {
|
|
3259
3258
|
let b3 = ge2.default.createInstance({ name: "MagicAuthLocalStorageDB", storeName: "MagicAuthLocalStorage" });
|
|
3260
3259
|
return yield b3.defineDriver(Ne2), yield b3.setDriver([ge2.default.INDEXEDDB, ge2.default.LOCALSTORAGE, Ne2._driver]), b3;
|
|
3261
3260
|
}) });
|
|
3262
3261
|
}
|
|
3263
3262
|
});
|
|
3264
3263
|
|
|
3265
|
-
// ../../node_modules/.pnpm/@magic-ext+algorand@23.
|
|
3264
|
+
// ../../node_modules/.pnpm/@magic-ext+algorand@23.20.0/node_modules/@magic-ext/algorand/dist/es/index.mjs
|
|
3266
3265
|
var es_exports2 = {};
|
|
3267
3266
|
__export(es_exports2, {
|
|
3268
3267
|
AlgorandExtension: () => c
|
|
3269
3268
|
});
|
|
3270
3269
|
var a, c;
|
|
3271
3270
|
var init_es5 = __esm({
|
|
3272
|
-
"../../node_modules/.pnpm/@magic-ext+algorand@23.
|
|
3271
|
+
"../../node_modules/.pnpm/@magic-ext+algorand@23.20.0/node_modules/@magic-ext/algorand/dist/es/index.mjs"() {
|
|
3273
3272
|
"use strict";
|
|
3274
3273
|
init_es3();
|
|
3275
3274
|
a = (s, e, n) => new Promise((g2, o) => {
|
|
3276
|
-
var
|
|
3275
|
+
var l2 = (r) => {
|
|
3277
3276
|
try {
|
|
3278
3277
|
i(n.next(r));
|
|
3279
3278
|
} catch (t) {
|
|
@@ -3285,10 +3284,10 @@ var init_es5 = __esm({
|
|
|
3285
3284
|
} catch (t) {
|
|
3286
3285
|
o(t);
|
|
3287
3286
|
}
|
|
3288
|
-
}, i = (r) => r.done ? g2(r.value) : Promise.resolve(r.value).then(
|
|
3287
|
+
}, i = (r) => r.done ? g2(r.value) : Promise.resolve(r.value).then(l2, u3);
|
|
3289
3288
|
i((n = n.apply(s, e)).next());
|
|
3290
3289
|
});
|
|
3291
|
-
c = class extends
|
|
3290
|
+
c = class extends D2.Internal {
|
|
3292
3291
|
constructor(n) {
|
|
3293
3292
|
super();
|
|
3294
3293
|
this.algorandConfig = n;
|
|
@@ -3326,8 +3325,8 @@ var init_es5 = __esm({
|
|
|
3326
3325
|
});
|
|
3327
3326
|
|
|
3328
3327
|
// src/index.ts
|
|
3329
|
-
var
|
|
3330
|
-
__export(
|
|
3328
|
+
var index_exports = {};
|
|
3329
|
+
__export(index_exports, {
|
|
3331
3330
|
BaseWallet: () => BaseWallet,
|
|
3332
3331
|
CustomWallet: () => CustomWallet,
|
|
3333
3332
|
DeflyWallet: () => DeflyWallet,
|
|
@@ -3353,7 +3352,7 @@ __export(src_exports, {
|
|
|
3353
3352
|
isAVMWebProviderSDKError: () => isAVMWebProviderSDKError,
|
|
3354
3353
|
webpackFallback: () => webpackFallback
|
|
3355
3354
|
});
|
|
3356
|
-
module.exports = __toCommonJS(
|
|
3355
|
+
module.exports = __toCommonJS(index_exports);
|
|
3357
3356
|
|
|
3358
3357
|
// src/logger.ts
|
|
3359
3358
|
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
@@ -3540,7 +3539,8 @@ var defaultState = {
|
|
|
3540
3539
|
wallets: {},
|
|
3541
3540
|
activeWallet: null,
|
|
3542
3541
|
activeNetwork: "testnet" /* TESTNET */,
|
|
3543
|
-
algodClient: new import_algosdk.default.Algodv2("", "https://testnet-api.4160.nodely.dev/")
|
|
3542
|
+
algodClient: new import_algosdk.default.Algodv2("", "https://testnet-api.4160.nodely.dev/"),
|
|
3543
|
+
managerStatus: "initializing"
|
|
3544
3544
|
};
|
|
3545
3545
|
var LOCAL_STORAGE_KEY = "@txnlab/use-wallet:v3";
|
|
3546
3546
|
function addWallet(store, { walletId, wallet }) {
|
|
@@ -3646,7 +3646,7 @@ function isValidWalletAccount(account) {
|
|
|
3646
3646
|
function isValidWalletState(wallet) {
|
|
3647
3647
|
return typeof wallet === "object" && wallet !== null && Array.isArray(wallet.accounts) && wallet.accounts.every(isValidWalletAccount) && (wallet.activeAccount === null || isValidWalletAccount(wallet.activeAccount));
|
|
3648
3648
|
}
|
|
3649
|
-
function
|
|
3649
|
+
function isValidPersistedState(state) {
|
|
3650
3650
|
if (!state || typeof state !== "object") return false;
|
|
3651
3651
|
if (typeof state.wallets !== "object") return false;
|
|
3652
3652
|
for (const [walletId, wallet] of Object.entries(state.wallets)) {
|
|
@@ -6485,7 +6485,7 @@ var WalletManager = class {
|
|
|
6485
6485
|
return null;
|
|
6486
6486
|
}
|
|
6487
6487
|
const parsedState = JSON.parse(serializedState);
|
|
6488
|
-
if (!
|
|
6488
|
+
if (!isValidPersistedState(parsedState)) {
|
|
6489
6489
|
this.logger.warn("Parsed state:", parsedState);
|
|
6490
6490
|
throw new Error("Persisted state is invalid");
|
|
6491
6491
|
}
|
|
@@ -6505,6 +6505,13 @@ var WalletManager = class {
|
|
|
6505
6505
|
this.logger.error("Could not save state to local storage:", error);
|
|
6506
6506
|
}
|
|
6507
6507
|
}
|
|
6508
|
+
// ---------- Status ------------------------------------------------ //
|
|
6509
|
+
get status() {
|
|
6510
|
+
return this.store.state.managerStatus;
|
|
6511
|
+
}
|
|
6512
|
+
get isReady() {
|
|
6513
|
+
return this.store.state.managerStatus === "ready";
|
|
6514
|
+
}
|
|
6508
6515
|
// ---------- Wallets ----------------------------------------------- //
|
|
6509
6516
|
initializeWallets(walletsConfig) {
|
|
6510
6517
|
this.logger.info("Initializing wallets...");
|
|
@@ -6557,8 +6564,15 @@ var WalletManager = class {
|
|
|
6557
6564
|
return this._clients.get(walletId);
|
|
6558
6565
|
}
|
|
6559
6566
|
async resumeSessions() {
|
|
6560
|
-
|
|
6561
|
-
|
|
6567
|
+
try {
|
|
6568
|
+
const promises = this.wallets.map((wallet) => wallet?.resumeSession());
|
|
6569
|
+
await Promise.all(promises);
|
|
6570
|
+
} finally {
|
|
6571
|
+
this.store.setState((state) => ({
|
|
6572
|
+
...state,
|
|
6573
|
+
managerStatus: "ready"
|
|
6574
|
+
}));
|
|
6575
|
+
}
|
|
6562
6576
|
}
|
|
6563
6577
|
async disconnect() {
|
|
6564
6578
|
const promises = this.wallets.filter((wallet) => wallet.isConnected).map((wallet) => wallet?.disconnect());
|