@seams/wallet 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/.build-inputs.sha256 +1 -1
  2. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.js +2 -2
  3. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/icons.js +23 -1
  4. package/dist/esm/react/components/AccountMenuButton/AccountsSection.css +7 -1
  5. package/dist/esm/react/components/AccountMenuButton/AuthenticationMethodRow.js +2 -8
  6. package/dist/esm/react/components/AccountMenuButton/ExportKeysSection.css +7 -1
  7. package/dist/esm/react/components/AccountMenuButton/Web3AuthProfileButton.css +95 -3
  8. package/dist/esm/react/components/AccountMenuButton/icons/HoverArrowIcon.js +26 -0
  9. package/dist/esm/react/styles/styles.css +102 -4
  10. package/dist/esm/sdk/{host-DYuu07E5.js → host-z-JJRWQe.js} +1 -1
  11. package/dist/esm/sdk/runtime-auth-ZcxkQ-XF.js +1 -0
  12. package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
  13. package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
  14. package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
  15. package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
  16. package/dist/esm/sdk/wallet-ui.css +1 -1
  17. package/dist/public/headers.manifest.json +1 -1
  18. package/dist/public/sdk/{host-DYuu07E5.js → host-z-JJRWQe.js} +1 -1
  19. package/dist/public/sdk/runtime-auth-ZcxkQ-XF.js +1 -0
  20. package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
  21. package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
  22. package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
  23. package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
  24. package/dist/public/sdk/wallet-ui.css +1 -1
  25. package/dist/public/wallet-assets.manifest.json +6 -6
  26. package/dist/public/wallet-service/index.html +4 -4
  27. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/icons.d.ts +1 -0
  28. package/dist/types/wallet/src/react/components/AccountMenuButton/icons/HoverArrowIcon.d.ts +7 -0
  29. package/package.json +1 -1
  30. package/dist/esm/sdk/runtime-auth-BNR1wI8E.js +0 -1
  31. package/dist/public/sdk/runtime-auth-BNR1wI8E.js +0 -1
@@ -1 +1 @@
1
- 9f6cfefb8440e96d1b81504ee0d7e6ac3d60177f8489eb6c94686037c4861834
1
+ ddf48f42cd621dcb4ca886033691a26d6514c752cd4c1a91ef741c8b03ad1ab6
@@ -5,7 +5,7 @@ import { demoEmailOtpCodeFromDelivery } from "../../../../../core/signingEngine/
5
5
  import { isAuthMenuActionReady, isAuthMenuGoogleActionReady, isAuthMenuLoadingStatus, isAuthMenuReady, resolveAuthMenuLoginAccount } from "../../auth-menu/domain.js";
6
6
  import { PadlockIcon } from "../../../../../core/signingEngine/uiConfirm/ui/preact/PadlockIcon.js";
7
7
  import { blinkMenuItem } from "../../../../../utils/menuItemBlink.js";
8
- import { accountDropdownIcon, backIcon, chevronIcon, fingerprintIcon, googleIcon, linkDeviceIcon, linkFailedIcon, mailIcon, recoveryIcon, rerollIcon } from "./icons.js";
8
+ import { accountDropdownIcon, backIcon, chevronIcon, fingerprintIcon, googleIcon, linkDeviceIcon, linkFailedIcon, mailIcon, passkeyRingIcon, recoveryIcon, rerollIcon } from "./icons.js";
9
9
  import { AuthMenuFooter } from "./AuthMenuFooter.js";
10
10
  import { linkDeviceDotRing, linkDeviceEmailOtpPresentation } from "./linkDeviceBadge.js";
11
11
  import { Component, Fragment } from "preact";
@@ -1139,7 +1139,7 @@ var AuthMenuSurface = class extends Component {
1139
1139
  class: "seams-passkey-prompt",
1140
1140
  role: "img",
1141
1141
  "aria-label": "Passkey authentication",
1142
- children: fingerprintIcon()
1142
+ children: passkeyRingIcon()
1143
1143
  }) : null,
1144
1144
  /* @__PURE__ */ jsxs("div", {
1145
1145
  class: "seams-waiting-message",
@@ -17,6 +17,28 @@ function strokeIcon(size, strokeWidth, ...shapes) {
17
17
  function fingerprintIcon() {
18
18
  return strokeIcon("22", "1.5", /* @__PURE__ */ jsx("path", { d: "M6.405 19.048c.184-.443.353-.894.507-1.351" }), /* @__PURE__ */ jsx("path", { d: "M14.343 20.693c.266-.751.502-1.516.707-2.294.186-.706.346-1.422.478-2.147" }), /* @__PURE__ */ jsx("path", { d: "M19.448 17.058c.364-1.964.555-3.989.555-6.058 0-4.418-3.582-8-8-8-1.255 0-2.443.289-3.501.805" }), /* @__PURE__ */ jsx("path", { d: "M3.523 15.025c.314-1.29.48-2.638.48-4.025 0-1.74.556-3.351 1.499-4.664" }), /* @__PURE__ */ jsx("path", { d: "M12.003 11c0 2.76-.447 5.416-1.273 7.899-.213.639-.451 1.266-.712 1.881" }), /* @__PURE__ */ jsx("path", { d: "M7.712 14.5c.191-1.138.291-2.308.291-3.5 0-2.209 1.791-4 4-4s4 1.791 4 4c0 .617-.02 1.229-.058 1.836" }));
19
19
  }
20
+ function passkeyRingIcon() {
21
+ return /* @__PURE__ */ jsxs("svg", {
22
+ class: "seams-passkey-ring",
23
+ viewBox: "0 0 56 56",
24
+ fill: "none",
25
+ "aria-hidden": "true",
26
+ focusable: "false",
27
+ children: [/* @__PURE__ */ jsx("circle", {
28
+ class: "seams-passkey-ring-track",
29
+ cx: "28",
30
+ cy: "28",
31
+ r: "26.75"
32
+ }), /* @__PURE__ */ jsx("circle", {
33
+ class: "seams-passkey-ring-arc",
34
+ cx: "28",
35
+ cy: "28",
36
+ r: "26.75",
37
+ pathLength: "100",
38
+ transform: "rotate(-90 28 28)"
39
+ })]
40
+ });
41
+ }
20
42
  function accountDropdownIcon() {
21
43
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("svg", {
22
44
  class: "seams-account-dropdown-arrow",
@@ -131,6 +153,6 @@ function alertIcon() {
131
153
  }));
132
154
  }
133
155
  //#endregion
134
- export { accountDropdownIcon, alertIcon, backIcon, chevronIcon, fingerprintIcon, googleIcon, linkDeviceIcon, linkFailedIcon, mailIcon, recoveryIcon, rerollIcon, shieldIcon };
156
+ export { accountDropdownIcon, alertIcon, backIcon, chevronIcon, fingerprintIcon, googleIcon, linkDeviceIcon, linkFailedIcon, mailIcon, passkeyRingIcon, recoveryIcon, rerollIcon, shieldIcon };
135
157
 
136
158
  //# sourceMappingURL=icons.js.map
@@ -49,7 +49,13 @@
49
49
  }
50
50
 
51
51
  .seams-accounts-row:hover {
52
- background: var(--seams-colors-surface2);
52
+ /* a shade off the expander surface behind the rows, which is often surface2;
53
+ mixing follows a theme's surface where a fixed surface step does not */
54
+ background: color-mix(
55
+ in srgb,
56
+ var(--seams-colors-textPrimary) 7%,
57
+ var(--seams-expander-surface, var(--seams-colors-surface))
58
+ );
53
59
  }
54
60
 
55
61
  .seams-accounts-row-chain {
@@ -1,5 +1,6 @@
1
1
  import TouchIcon from "./icons/TouchIcon.js";
2
2
  import { MailIcon } from "./icons/MailIcon.js";
3
+ import { HoverArrowIcon } from "./icons/HoverArrowIcon.js";
3
4
  import "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  //#region src/react/components/AccountMenuButton/AuthenticationMethodRow.tsx
@@ -23,14 +24,7 @@ function AuthenticationMethodRow({ kind, title, description, icon, action, onSel
23
24
  }))
24
25
  }),
25
26
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: title }), /* @__PURE__ */ jsx("small", { children: description })] }),
26
- /* @__PURE__ */ jsx("svg", {
27
- viewBox: "0 0 24 24",
28
- fill: "none",
29
- stroke: "currentColor",
30
- strokeWidth: "1.5",
31
- "aria-hidden": "true",
32
- children: /* @__PURE__ */ jsx("path", { d: "m9 6 6 6-6 6" })
33
- })
27
+ /* @__PURE__ */ jsx(HoverArrowIcon, {})
34
28
  ]
35
29
  })
36
30
  });
@@ -53,7 +53,13 @@
53
53
  }
54
54
 
55
55
  .seams-export-keys-row:hover:not(:disabled) {
56
- background: var(--seams-colors-surface2);
56
+ /* a shade off the expander surface behind the rows, which is often surface2;
57
+ mixing follows a theme's surface where a fixed surface step does not */
58
+ background: color-mix(
59
+ in srgb,
60
+ var(--seams-colors-textPrimary) 7%,
61
+ var(--seams-expander-surface, var(--seams-colors-surface))
62
+ );
57
63
  }
58
64
 
59
65
  .seams-export-keys-row:disabled {
@@ -156,16 +156,44 @@
156
156
  color: inherit;
157
157
  cursor: pointer;
158
158
  margin-top: 14px;
159
+ transition:
160
+ background-color 150ms ease,
161
+ border-color 150ms ease,
162
+ transform 120ms ease;
163
+ }
164
+ .seams-account-action:hover:not(:disabled) {
165
+ background: var(--seams-colors-surface2);
166
+ border-color: color-mix(
167
+ in srgb,
168
+ var(--seams-colors-textPrimary) 16%,
169
+ var(--seams-colors-borderPrimary)
170
+ );
171
+ }
172
+ .seams-account-action:active:not(:disabled) {
173
+ transform: scale(0.98);
159
174
  }
160
175
  .seams-account-action.primary {
161
176
  background: var(--seams-colors-textPrimary);
162
177
  color: var(--seams-colors-colorBackground);
163
178
  border-color: transparent;
164
179
  }
180
+ .seams-account-action.primary:hover:not(:disabled) {
181
+ background: color-mix(
182
+ in srgb,
183
+ var(--seams-colors-textPrimary) 84%,
184
+ var(--seams-colors-colorBackground)
185
+ );
186
+ border-color: transparent;
187
+ }
165
188
  .seams-account-action:disabled {
166
189
  opacity: 0.5;
167
190
  cursor: default;
168
191
  }
192
+ @media (prefers-reduced-motion: reduce) {
193
+ .seams-account-action {
194
+ transition: none;
195
+ }
196
+ }
169
197
  .seams-account-note {
170
198
  color: var(--seams-colors-textSecondary);
171
199
  font-size: 12px;
@@ -215,6 +243,8 @@
215
243
  margin: 0;
216
244
  }
217
245
  .seams-account-method-button {
246
+ position: relative;
247
+ isolation: isolate;
218
248
  display: flex;
219
249
  width: 100%;
220
250
  align-items: center;
@@ -228,6 +258,29 @@
228
258
  cursor: pointer;
229
259
  font: inherit;
230
260
  }
261
+ /* The hover shade bleeds past the row edges so the content and the
262
+ separators stay aligned with the rest of the screen. */
263
+ .seams-account-method-button::before {
264
+ content: '';
265
+ position: absolute;
266
+ z-index: -1;
267
+ inset: 4px -10px;
268
+ border-radius: var(--seams-shape-item, 10px);
269
+ background: var(--seams-colors-surface2);
270
+ opacity: 0;
271
+ transition: opacity 150ms ease;
272
+ }
273
+ .seams-account-method-button:hover::before,
274
+ .seams-account-method-button:focus-visible::before {
275
+ opacity: 1;
276
+ }
277
+ .seams-account-method-button .seams-account-avatar {
278
+ transition: background-color 150ms ease;
279
+ }
280
+ .seams-account-method-button:hover .seams-account-avatar,
281
+ .seams-account-method-button:focus-visible .seams-account-avatar {
282
+ background: var(--seams-colors-colorBackground);
283
+ }
231
284
  .seams-account-method-button > div {
232
285
  flex: 1;
233
286
  }
@@ -241,10 +294,49 @@
241
294
  color: var(--seams-colors-textSecondary);
242
295
  font-size: 12px;
243
296
  }
244
- .seams-account-method-button > svg {
245
- width: 16px;
246
- height: 16px;
297
+ .seams-account-method-button > .seams-hover-arrow {
298
+ flex: 0 0 auto;
299
+ margin-inline-end: 2px;
300
+ fill: none;
301
+ stroke: currentColor;
302
+ stroke-width: 1.5;
247
303
  color: var(--seams-colors-textSecondary);
304
+ transition: color 140ms ease;
305
+ }
306
+ .seams-hover-arrow-line {
307
+ opacity: 0;
308
+ filter: blur(2px);
309
+ transform: scaleX(0.45);
310
+ transform-origin: right center;
311
+ transition:
312
+ opacity 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
313
+ filter 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
314
+ transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
315
+ }
316
+ .seams-hover-arrow-tip {
317
+ transition: transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
318
+ }
319
+ .seams-account-method-button:hover > .seams-hover-arrow,
320
+ .seams-account-method-button:focus-visible > .seams-hover-arrow {
321
+ color: var(--seams-colors-textPrimary);
322
+ }
323
+ .seams-account-method-button:hover .seams-hover-arrow-line,
324
+ .seams-account-method-button:focus-visible .seams-hover-arrow-line {
325
+ opacity: 1;
326
+ filter: blur(0);
327
+ transform: scaleX(1);
328
+ }
329
+ .seams-account-method-button:hover .seams-hover-arrow-tip,
330
+ .seams-account-method-button:focus-visible .seams-hover-arrow-tip {
331
+ transform: translateX(3px);
332
+ }
333
+ @media (prefers-reduced-motion: reduce) {
334
+ .seams-account-method-button::before,
335
+ .seams-account-method-button .seams-account-avatar,
336
+ .seams-hover-arrow-line,
337
+ .seams-hover-arrow-tip {
338
+ transition: none;
339
+ }
248
340
  }
249
341
  .seams-account-screen .seams-dropdown-accounts-root,
250
342
  .seams-account-screen .seams-dropdown-export-keys-root {
@@ -0,0 +1,26 @@
1
+ import "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/react/components/AccountMenuButton/icons/HoverArrowIcon.tsx
4
+ /** A chevron that grows a shaft on its parent's hover (">" to "->"). The
5
+ * parent row owns the hover selectors in Web3AuthProfileButton.css. */
6
+ function HoverArrowIcon({ size = 12 }) {
7
+ return /* @__PURE__ */ jsxs("svg", {
8
+ className: "seams-hover-arrow",
9
+ width: size,
10
+ height: size,
11
+ viewBox: "0 0 10 10",
12
+ "aria-hidden": "true",
13
+ focusable: "false",
14
+ children: [/* @__PURE__ */ jsx("path", {
15
+ className: "seams-hover-arrow-line",
16
+ d: "M0 5h7"
17
+ }), /* @__PURE__ */ jsx("path", {
18
+ className: "seams-hover-arrow-tip",
19
+ d: "M1 1l4 4-4 4"
20
+ })]
21
+ });
22
+ }
23
+ //#endregion
24
+ export { HoverArrowIcon };
25
+
26
+ //# sourceMappingURL=HoverArrowIcon.js.map
@@ -56,7 +56,13 @@
56
56
  }
57
57
 
58
58
  .seams-export-keys-row:hover:not(:disabled) {
59
- background: var(--seams-colors-surface2);
59
+ /* a shade off the expander surface behind the rows, which is often surface2;
60
+ mixing follows a theme's surface where a fixed surface step does not */
61
+ background: color-mix(
62
+ in srgb,
63
+ var(--seams-colors-textPrimary) 7%,
64
+ var(--seams-expander-surface, var(--seams-colors-surface))
65
+ );
60
66
  }
61
67
 
62
68
  .seams-export-keys-row:disabled {
@@ -867,16 +873,44 @@
867
873
  color: inherit;
868
874
  cursor: pointer;
869
875
  margin-top: 14px;
876
+ transition:
877
+ background-color 150ms ease,
878
+ border-color 150ms ease,
879
+ transform 120ms ease;
880
+ }
881
+ .seams-account-action:hover:not(:disabled) {
882
+ background: var(--seams-colors-surface2);
883
+ border-color: color-mix(
884
+ in srgb,
885
+ var(--seams-colors-textPrimary) 16%,
886
+ var(--seams-colors-borderPrimary)
887
+ );
888
+ }
889
+ .seams-account-action:active:not(:disabled) {
890
+ transform: scale(0.98);
870
891
  }
871
892
  .seams-account-action.primary {
872
893
  background: var(--seams-colors-textPrimary);
873
894
  color: var(--seams-colors-colorBackground);
874
895
  border-color: transparent;
875
896
  }
897
+ .seams-account-action.primary:hover:not(:disabled) {
898
+ background: color-mix(
899
+ in srgb,
900
+ var(--seams-colors-textPrimary) 84%,
901
+ var(--seams-colors-colorBackground)
902
+ );
903
+ border-color: transparent;
904
+ }
876
905
  .seams-account-action:disabled {
877
906
  opacity: 0.5;
878
907
  cursor: default;
879
908
  }
909
+ @media (prefers-reduced-motion: reduce) {
910
+ .seams-account-action {
911
+ transition: none;
912
+ }
913
+ }
880
914
  .seams-account-note {
881
915
  color: var(--seams-colors-textSecondary);
882
916
  font-size: 12px;
@@ -926,6 +960,8 @@
926
960
  margin: 0;
927
961
  }
928
962
  .seams-account-method-button {
963
+ position: relative;
964
+ isolation: isolate;
929
965
  display: flex;
930
966
  width: 100%;
931
967
  align-items: center;
@@ -939,6 +975,29 @@
939
975
  cursor: pointer;
940
976
  font: inherit;
941
977
  }
978
+ /* The hover shade bleeds past the row edges so the content and the
979
+ separators stay aligned with the rest of the screen. */
980
+ .seams-account-method-button::before {
981
+ content: '';
982
+ position: absolute;
983
+ z-index: -1;
984
+ inset: 4px -10px;
985
+ border-radius: var(--seams-shape-item, 10px);
986
+ background: var(--seams-colors-surface2);
987
+ opacity: 0;
988
+ transition: opacity 150ms ease;
989
+ }
990
+ .seams-account-method-button:hover::before,
991
+ .seams-account-method-button:focus-visible::before {
992
+ opacity: 1;
993
+ }
994
+ .seams-account-method-button .seams-account-avatar {
995
+ transition: background-color 150ms ease;
996
+ }
997
+ .seams-account-method-button:hover .seams-account-avatar,
998
+ .seams-account-method-button:focus-visible .seams-account-avatar {
999
+ background: var(--seams-colors-colorBackground);
1000
+ }
942
1001
  .seams-account-method-button > div {
943
1002
  flex: 1;
944
1003
  }
@@ -952,10 +1011,49 @@
952
1011
  color: var(--seams-colors-textSecondary);
953
1012
  font-size: 12px;
954
1013
  }
955
- .seams-account-method-button > svg {
956
- width: 16px;
957
- height: 16px;
1014
+ .seams-account-method-button > .seams-hover-arrow {
1015
+ flex: 0 0 auto;
1016
+ margin-inline-end: 2px;
1017
+ fill: none;
1018
+ stroke: currentColor;
1019
+ stroke-width: 1.5;
958
1020
  color: var(--seams-colors-textSecondary);
1021
+ transition: color 140ms ease;
1022
+ }
1023
+ .seams-hover-arrow-line {
1024
+ opacity: 0;
1025
+ filter: blur(2px);
1026
+ transform: scaleX(0.45);
1027
+ transform-origin: right center;
1028
+ transition:
1029
+ opacity 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
1030
+ filter 140ms cubic-bezier(0.215, 0.61, 0.355, 1),
1031
+ transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
1032
+ }
1033
+ .seams-hover-arrow-tip {
1034
+ transition: transform 140ms cubic-bezier(0.215, 0.61, 0.355, 1);
1035
+ }
1036
+ .seams-account-method-button:hover > .seams-hover-arrow,
1037
+ .seams-account-method-button:focus-visible > .seams-hover-arrow {
1038
+ color: var(--seams-colors-textPrimary);
1039
+ }
1040
+ .seams-account-method-button:hover .seams-hover-arrow-line,
1041
+ .seams-account-method-button:focus-visible .seams-hover-arrow-line {
1042
+ opacity: 1;
1043
+ filter: blur(0);
1044
+ transform: scaleX(1);
1045
+ }
1046
+ .seams-account-method-button:hover .seams-hover-arrow-tip,
1047
+ .seams-account-method-button:focus-visible .seams-hover-arrow-tip {
1048
+ transform: translateX(3px);
1049
+ }
1050
+ @media (prefers-reduced-motion: reduce) {
1051
+ .seams-account-method-button::before,
1052
+ .seams-account-method-button .seams-account-avatar,
1053
+ .seams-hover-arrow-line,
1054
+ .seams-hover-arrow-tip {
1055
+ transition: none;
1056
+ }
959
1057
  }
960
1058
  .seams-account-screen .seams-dropdown-accounts-root,
961
1059
  .seams-account-screen .seams-dropdown-export-keys-root {
@@ -1 +1 @@
1
- import{C as e,S as t}from"./chains-C_X_fNuS.js";import{n}from"./walletRegistrationSetupPrewarm-B9kpnrbK.js";import{t as r}from"./walletDbName-DtRewci9.js";import{_ as i,b as a,c as o,d as s,g as c,i as l,m as u,n as d,r as f,t as p,u as m,v as ee,y as te}from"./sessionObservationRevision-CnEOLDbl.js";import{a as h,c as g,i as _,l as ne,n as v,o as re,s as y,t as ie,u as ae}from"./transactionReviewAdmission-CIvR4W5_.js";import{t as b}from"./events-1dzC4Ocx.js";import{t as x}from"./walletIframeIdentity-Cz82I_Uh.js";import{t as S}from"./errors-DIWY1KR9.js";import{t as C}from"./signer-worker-DlK58rEA.js";function w(){let e=globalThis;e.global===void 0&&(e.global=globalThis),!e.process||typeof e.process!=`object`?e.process={env:{}}:(!e.process.env||typeof e.process.env!=`object`)&&(e.process.env={})}function T(){w(),window.location.origin===`null`&&(window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`),console.warn(`[WalletHost] iframe is running with opaque (null) origin. Check COEP/CORP headers and ensure navigation succeeded.`)),oe(),window.parent?.postMessage({type:`SERVICE_HOST_BOOTED`},`*`),window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`);let e=new URL(import.meta.url),t=e.searchParams.get(`v`);t&&c(t);let n=new URL(`.`,e).toString(),r=n.endsWith(`/`)?n:n+`/`;u()||i(r)}function oe(){let e=()=>{let e=document;e.documentElement.classList.add(`seams-transparent`),e.body?.classList.add(`seams-transparent`),e.documentElement.classList.remove(`dark`),e.body?.classList.remove(`dark`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e(),window.addEventListener(`load`,()=>e(),{once:!0})}const E={};let D=null,O=null;function se(e){return e.type===`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`?(D??=import(`./runtime-recovery-codes-GOytzExh.js`),D):k(e.kind)}function ce(){k(`auth`).catch(le)}function le(){}function k(e){let t=E[e];if(t)return t;let n=M(e);return E[e]=n,n.catch(A.bind(null,e,n)),n}function A(e,t){E[e]===t&&delete E[e]}async function j(){D??=import(`./runtime-recovery-codes-GOytzExh.js`),O??=Promise.all([D,import(`./mountRecoveryCodeBackupSurface-DlEb3uD7.js`)]).then(()=>void 0),await O}function M(e){switch(e){case`auth`:return import(`./runtime-auth-BNR1wI8E.js`);case`near`:return import(`./runtime-near-J3hKjC7G.js`);case`ecdsa`:return import(`./runtime-ecdsa-tempo-AGjT7Xpa.js`);case`email_otp`:return import(`./runtime-email-otp-BpBOuSsT.js`);case`recovery`:return import(`./runtime-recovery-BzewdcoT.js`);case`export`:return import(`./runtime-export-CBsacCPY.js`);case`device_link`:return import(`./runtime-device-link-Dq8g_UNb.js`);case`preferences`:return import(`./runtime-preferences-CVt5sLvm.js`)}return N(e)}function N(e){throw Error(`Unhandled wallet host runtime route: ${String(e)}`)}function P(e){switch(e.type){case`PM_GET_RECENT_UNLOCKS`:case`PM_GET_CONFIRMATION_CONFIG`:return!0;case`PM_GET_EXACT_WALLET_SESSION_STATE`:{let t=e.request.payload;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`authenticationRead`),r=Reflect.get(t,`wallet`);return(n===`restore`||n===`current`)&&!!r&&typeof r==`object`&&Reflect.get(r,`kind`)===`current`}default:return!1}}function F(e){switch(e.type){case`PM_GET_EXACT_WALLET_SESSION_STATE`:return{revision:p(),walletId:null,state:{kind:`wallet_locked`},session:d()};case`PM_GET_RECENT_UNLOCKS`:return{walletIds:[],accountIds:[],accounts:[],lastUsedAccount:null};case`PM_GET_CONFIRMATION_CONFIG`:return{walletId:null,confirmationConfig:C,revision:0}}}let I=null;function L(){return I??=z().finally(R),I}function R(){I=null}async function z(){try{return typeof indexedDB>`u`||typeof indexedDB.databases!=`function`?!1:(await indexedDB.databases()).some(B)?await V():!0}catch{return!1}}function B(e){return e.name===r}function V(){return new Promise(e=>{let t=indexedDB.open(r);t.onupgradeneeded=()=>t.transaction?.abort(),t.onerror=()=>e(!1),t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>n.close(),H(n).then(t=>{n.close(),e(t===0)},()=>{n.close(),e(!1)})}})}function H(e){let t=Array.from(e.objectStoreNames);return t.length===0?Promise.resolve(0):new Promise((n,r)=>{let i=e.transaction(t,`readonly`),a=0;for(let e of t){let t=i.objectStore(e).count();t.onsuccess=()=>{a+=t.result}}i.oncomplete=()=>n(a),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)})}function U(e){throw Error(`Unhandled wallet host route: ${String(e)}`)}function W(e,t){if(e===null)throw Error(`Invalid ${t} payload`);return e}function G(e){try{return x(e)}catch{throw Error(`Hosted auth-menu request requires a non-empty requestId`)}}function ue(e){switch(e.type){case`PM_ACTIVATE_TRANSACTION_REVIEW`:case`PING`:case`PM_PREPARE_WALLET_RUNTIME`:case`PM_SET_CONFIG`:case`PM_CANCEL`:case`PM_SET_TRANSACTION_VIEW`:case`PM_TRANSACTION_BROADCAST_STARTED`:return{kind:`boot`,type:e.type,request:e};case`PM_REGISTER_WALLET`:case`PM_ADD_WALLET_SIGNER`:case`PM_ADD_PASSKEY`:case`PM_ADD_EMAIL_OTP`:case`PM_REVOKE_AUTH_METHOD`:case`PM_GET_NEAR_PROVISIONING_STATE`:case`PM_SIGN_TX_WITH_ACTIONS`:case`PM_SIGN_AND_SEND_TX`:case`PM_SEND_TRANSACTION`:case`PM_SIGN_DELEGATE_ACTION`:case`PM_SIGN_NEP413`:return{kind:`near`,type:e.type,request:e};case`PM_OPEN_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(s(e.payload),`hosted auth-menu open`)}}}case`PM_CANCEL_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(o(e.payload),`hosted auth-menu cancellation`)}}}case`PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(m(e.payload),`hosted auth-menu external-auth resolution`)}}}case`PM_UNLOCK`:case`PM_LOCK`:case`PM_LOCK_EXACT_WALLET_SESSION`:case`PM_GET_LAST_WALLET_MOVE_REQUEST`:case`PM_MOVE_WALLET`:case`PM_GET_WALLET_MOVE`:case`PM_GET_WALLET_PLACEMENT`:case`PM_GET_WALLET_SESSION`:case`PM_GET_EXACT_WALLET_SESSION_STATE`:case`PM_GET_RECENT_UNLOCKS`:return{kind:`auth`,type:e.type,request:e};case`PM_SIGN_TEMPO`:case`PM_REPORT_TEMPO_BROADCAST_ACCEPTED`:case`PM_REPORT_TEMPO_BROADCAST_REJECTED`:case`PM_REPORT_TEMPO_FINALIZED`:case`PM_REPORT_TEMPO_DROPPED_OR_REPLACED`:case`PM_RECONCILE_TEMPO_NONCE_LANE`:return{kind:`ecdsa`,type:e.type,request:e};case`PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION`:case`PM_REQUEST_EMAIL_OTP_CHALLENGE`:case`PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL`:case`PM_GET_WALLET_RECOVERY_CODE_STATUS`:case`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`:case`PM_ROTATE_WALLET_RECOVERY_CODES`:case`PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE`:return{kind:`email_otp`,type:e.type,request:e};case`PM_SYNC_ACCOUNT_FLOW`:return{kind:`recovery`,type:e.type,request:e};case`PM_RESOLVE_EXACT_KEY_EXPORT_LANE`:case`PM_EXPORT_KEYPAIR_UI`:return{kind:`export`,type:e.type,request:e};case`PM_HAS_PASSKEY`:case`PM_LIST_LINKED_DEVICES`:case`PM_REVOKE_LINKED_DEVICE`:case`PM_SCAN_AND_LINK_DEVICE`:case`PM_START_DEVICE2_LINKING_FLOW`:case`PM_DEVICE_LINK_TARGET_FACTOR_ACTION`:case`PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION`:case`PM_CANCEL_DEVICE_LINKING`:return{kind:`device_link`,type:e.type,request:e};case`PM_SET_CONFIRM_BEHAVIOR`:case`PM_SET_CONFIRMATION_CONFIG`:case`PM_GET_CONFIRMATION_CONFIG`:return{kind:`preferences`,type:e.type,request:e}}return U(e)}function de(e){return e.kind!==`boot`}let K=!1;const fe=[{selector:`.seams-auth-menu-surface`,cancellationKind:`native_cancel`},{selector:`.seams-confirmation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-export-surface`,cancellationKind:`wallet_iframe_cancel`},{selector:`[data-seams-wallet-recovery-backup-dialog]`,cancellationKind:`native_cancel`}];function q(e,t){let n=new Set(t),r=Object.keys(e);return r.length===t.length&&r.every(e=>n.has(e))}function pe(t){return!e(t)||!q(t,[`type`,`payload`])||t.type!==`CONNECT`||!e(t.payload)||!q(t.payload,[`protocolVersion`])?null:typeof t.payload.protocolVersion==`string`?{type:`CONNECT`,payload:{protocolVersion:t.payload.protocolVersion}}:null}function J(e){if(e===`null`)return!0;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.origin===e}catch{return!1}}function Y(e){try{e.close()}catch{}}function me(e,t){if(t===`16.0.0`)return!1;let n={expectedProtocolVersion:l,receivedProtocolVersion:t};try{e.postMessage({type:`ERROR`,payload:{code:f,message:`Wallet iframe protocol version mismatch: expected ${l}, received ${t??`missing`}`,details:n}})}catch{}return Y(e),!0}function X(e,t){return!t||t.has(e)}function Z(e,t,n,r){e.executionGeneration===t&&n(r)}function Q(e,t,n,r){return e.executionGeneration!==t||n(r)}function $(e={}){if(K)return;K=!0,T(),(!e.supportedRuntimeRouteKinds||e.supportedRuntimeRouteKinds.has(`email_otp`))&&j().catch(()=>void 0);let r=new Set,i=new Set,o=!1,s={parentOrigin:null,port:null,configuration:{kind:`unconfigured`},executionGeneration:0,onConfigurationChanged:null},c=e=>{try{s.port?.postMessage(e)}catch{}},u=e=>{e&&r.add(e)},d=e=>!!e&&(r.has(e)||_(e)?.cancelled===!0),f=e=>{e&&r.delete(e)},p=e=>{e&&c({type:`ERROR`,requestId:e,payload:{code:`cancelled`,message:`Request cancelled`}})},m=e=>!e||!d(e)?!1:_(e)?.cancelled?!0:(p(e),f(e),!0),x=()=>{for(let e of fe){let t=document.querySelectorAll(e.selector);for(let n of t)try{e.cancellationKind===`native_cancel`?n.dispatchEvent(new Event(`cancel`,{cancelable:!0})):n.dispatchEvent(new CustomEvent(b.TX_CONFIRMER_CANCEL,{bubbles:!0,composed:!0}))}catch{}}},C=async r=>{let l=r.data;if(!l||!t(l))return;let b=l.requestId,C=s.executionGeneration,w=Z.bind(null,s,C,c),T=null;try{if(`transactionReview`in l){if(l.type!==`PM_SIGN_AND_SEND_TX`&&l.type!==`PM_SIGN_TEMPO`)throw new h(`review_invalid_input`,`Review is unsupported for this request`);let e=g(l.transactionReview);if(e.requestId!==b)throw new h(`review_invalid_input`,`Review request identity mismatch`);let t=l.payload?.options?.confirmationConfig;if(t?.uiMode!==`modal`||t.behavior!==`requireClick`)throw new h(`review_unsupported_mode`,`Review requires modal presentation and explicit approval`);T=new ie(e,l.type===`PM_SIGN_TEMPO`&&l.payload?.request.senderSignatureAlgorithm!==`secp256k1`?`credential`:`mpc`,e=>w({type:`TRANSACTION_REVIEW_STATE`,requestId:b,payload:e}),e=>w({type:`ERROR`,requestId:b,payload:{code:e instanceof h?e.code:`cancelled`,message:e.message}}))}(l.type===`PM_LOCK`||l.type===`PM_LOCK_EXACT_WALLET_SESSION`)&&v(new h(`review_identity_changed`,`The wallet session changed`));let t=ue(l);if(!de(t))switch(t.type){case`PING`:c({type:`PONG`,requestId:b});return;case`PM_PREPARE_WALLET_RUNTIME`:X(`auth`,e.supportedRuntimeRouteKinds)&&ce(),c({type:`PONG`,requestId:b});return;case`PM_SET_CONFIG`:{let e=ee(s.configuration,te(t.request.payload)),r=a(s.configuration.kind===`configured`?s.configuration.config:null)!==a(e.config);if(s.configuration=e,r){s.executionGeneration+=1;let t=e.config;t.registration.publishableKey&&t.registration.projectEnvironmentId&&n(t.network.relayer.url);for(let e of i)c({type:`ERROR`,requestId:e,payload:{code:`wallet_configuration_changed`,message:`Wallet configuration changed during request`}});i.clear()}s.onConfigurationChanged?.(),r&&(v(new h(`review_identity_changed`,`Wallet execution configuration changed`)),x()),c({type:`PONG`,requestId:b});return}case`PM_ACTIVATE_TRANSACTION_REVIEW`:{let e=y(t.request.payload);e&&_(e.requestId)?.activate(e);return}case`PM_CANCEL`:{let e=t.request.payload?.requestId,n=t.request.payload,r=n&&typeof n==`object`?Reflect.get(n,`transactionReview`):void 0;if(r!==void 0){let t=g(r),i=_(t.requestId);if(t.requestId===e&&i&&ne(t,i.metadata)){let e=new h(ae(n&&typeof n==`object`?Reflect.get(n,`reviewErrorCode`):void 0),`Reviewed request cancelled`);try{re(i.metadata.validity)}catch(t){t instanceof Error&&(e=t)}i.cancel(e)}c({type:`PONG`,requestId:b});return}let i=e?_(e):void 0;if(i){i.cancel(new h(`cancelled`,`Request cancelled`)),c({type:`PONG`,requestId:b});return}u(e),x(),e&&p(e),c({type:`PONG`,requestId:b});return}case`PM_SET_TRANSACTION_VIEW`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`requestId`):null,r=e&&typeof e==`object`?Reflect.get(e,`view`):null;typeof n==`string`&&(r===`toast`||r===`closed`)&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).setTransactionActivityView(n,r);return}case`PM_TRANSACTION_BROADCAST_STARTED`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`signedTransaction`):null;typeof n==`string`&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).transactionBroadcastStarted(n);return}}if(!X(t.kind,e.supportedRuntimeRouteKinds)){c({type:`ERROR`,requestId:b,payload:{code:`unsupported_request`,message:`Unsupported wallet iframe request type: ${t.type}`}});return}if(b&&i.add(b),!o&&P(t)&&await L()&&!o){if(C!==s.executionGeneration||m(b))return;w({type:`PM_RESULT`,requestId:b,payload:{ok:!0,result:F(t)}});return}o=!0;let r=await se(t);if(C!==s.executionGeneration)return;await r.handleWalletHostRuntimeRequest({transactionReview:T,state:s,executionGeneration:C,req:t.request,post:Z.bind(null,s,C,c),isCancelled:Q.bind(null,s,C,d),respondIfCancelled:Q.bind(null,s,C,m)})}catch(e){if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`||T?.cancelled)return;let t=await import(`./canonicalSignerErrorCode-Cz48v4oy.js`);if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`)return;let n=e&&typeof e==`object`&&`code`in e?e.code:void 0,r=S(e),i=t.resolveWalletBoundaryErrorCode({requestType:l.type,rawCode:n,message:r,defaultCode:`HOST_ERROR`}),a=t.resolveWalletBoundaryErrorMessage({requestType:l.type,rawCode:n,code:i,message:r}),o=t.resolveWalletBoundarySignerKind(l.type);c({type:`ERROR`,requestId:b,payload:{code:i,message:a,...t.isWalletSignerBoundaryRequestType(l.type)&&t.isCanonicalSignerSessionBoundaryCode(i)&&o?{signerKind:o}:{}}})}finally{b&&(i.delete(b),f(b)),T?.finish()}};window.addEventListener(`message`,e=>{let t=pe(e.data),n=e.ports[0];if(!(!t||!n||s.port)){if(e.source!==window.parent||!J(e.origin)){Y(n);return}if(!me(n,t.payload.protocolVersion)){typeof e.origin==`string`&&e.origin.length&&e.origin!==`null`&&(s.parentOrigin=e.origin),s.port=n;try{s.port.onmessage=C,s.port.start?.()}catch{}c({type:`READY`,payload:{protocolVersion:l}})}}})}try{$()}catch(e){console.error(`[WalletHost] init failed`,e)}export{$ as t};
1
+ import{C as e,S as t}from"./chains-C_X_fNuS.js";import{n}from"./walletRegistrationSetupPrewarm-B9kpnrbK.js";import{t as r}from"./walletDbName-DtRewci9.js";import{_ as i,b as a,c as o,d as s,g as c,i as l,m as u,n as d,r as f,t as p,u as m,v as ee,y as te}from"./sessionObservationRevision-CnEOLDbl.js";import{a as h,c as g,i as _,l as ne,n as v,o as re,s as y,t as ie,u as ae}from"./transactionReviewAdmission-CIvR4W5_.js";import{t as b}from"./events-1dzC4Ocx.js";import{t as x}from"./walletIframeIdentity-Cz82I_Uh.js";import{t as S}from"./errors-DIWY1KR9.js";import{t as C}from"./signer-worker-DlK58rEA.js";function w(){let e=globalThis;e.global===void 0&&(e.global=globalThis),!e.process||typeof e.process!=`object`?e.process={env:{}}:(!e.process.env||typeof e.process.env!=`object`)&&(e.process.env={})}function T(){w(),window.location.origin===`null`&&(window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`),console.warn(`[WalletHost] iframe is running with opaque (null) origin. Check COEP/CORP headers and ensure navigation succeeded.`)),oe(),window.parent?.postMessage({type:`SERVICE_HOST_BOOTED`},`*`),window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`);let e=new URL(import.meta.url),t=e.searchParams.get(`v`);t&&c(t);let n=new URL(`.`,e).toString(),r=n.endsWith(`/`)?n:n+`/`;u()||i(r)}function oe(){let e=()=>{let e=document;e.documentElement.classList.add(`seams-transparent`),e.body?.classList.add(`seams-transparent`),e.documentElement.classList.remove(`dark`),e.body?.classList.remove(`dark`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e(),window.addEventListener(`load`,()=>e(),{once:!0})}const E={};let D=null,O=null;function se(e){return e.type===`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`?(D??=import(`./runtime-recovery-codes-GOytzExh.js`),D):k(e.kind)}function ce(){k(`auth`).catch(le)}function le(){}function k(e){let t=E[e];if(t)return t;let n=M(e);return E[e]=n,n.catch(A.bind(null,e,n)),n}function A(e,t){E[e]===t&&delete E[e]}async function j(){D??=import(`./runtime-recovery-codes-GOytzExh.js`),O??=Promise.all([D,import(`./mountRecoveryCodeBackupSurface-DlEb3uD7.js`)]).then(()=>void 0),await O}function M(e){switch(e){case`auth`:return import(`./runtime-auth-ZcxkQ-XF.js`);case`near`:return import(`./runtime-near-J3hKjC7G.js`);case`ecdsa`:return import(`./runtime-ecdsa-tempo-AGjT7Xpa.js`);case`email_otp`:return import(`./runtime-email-otp-BpBOuSsT.js`);case`recovery`:return import(`./runtime-recovery-BzewdcoT.js`);case`export`:return import(`./runtime-export-CBsacCPY.js`);case`device_link`:return import(`./runtime-device-link-Dq8g_UNb.js`);case`preferences`:return import(`./runtime-preferences-CVt5sLvm.js`)}return N(e)}function N(e){throw Error(`Unhandled wallet host runtime route: ${String(e)}`)}function P(e){switch(e.type){case`PM_GET_RECENT_UNLOCKS`:case`PM_GET_CONFIRMATION_CONFIG`:return!0;case`PM_GET_EXACT_WALLET_SESSION_STATE`:{let t=e.request.payload;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`authenticationRead`),r=Reflect.get(t,`wallet`);return(n===`restore`||n===`current`)&&!!r&&typeof r==`object`&&Reflect.get(r,`kind`)===`current`}default:return!1}}function F(e){switch(e.type){case`PM_GET_EXACT_WALLET_SESSION_STATE`:return{revision:p(),walletId:null,state:{kind:`wallet_locked`},session:d()};case`PM_GET_RECENT_UNLOCKS`:return{walletIds:[],accountIds:[],accounts:[],lastUsedAccount:null};case`PM_GET_CONFIRMATION_CONFIG`:return{walletId:null,confirmationConfig:C,revision:0}}}let I=null;function L(){return I??=z().finally(R),I}function R(){I=null}async function z(){try{return typeof indexedDB>`u`||typeof indexedDB.databases!=`function`?!1:(await indexedDB.databases()).some(B)?await V():!0}catch{return!1}}function B(e){return e.name===r}function V(){return new Promise(e=>{let t=indexedDB.open(r);t.onupgradeneeded=()=>t.transaction?.abort(),t.onerror=()=>e(!1),t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>n.close(),H(n).then(t=>{n.close(),e(t===0)},()=>{n.close(),e(!1)})}})}function H(e){let t=Array.from(e.objectStoreNames);return t.length===0?Promise.resolve(0):new Promise((n,r)=>{let i=e.transaction(t,`readonly`),a=0;for(let e of t){let t=i.objectStore(e).count();t.onsuccess=()=>{a+=t.result}}i.oncomplete=()=>n(a),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)})}function U(e){throw Error(`Unhandled wallet host route: ${String(e)}`)}function W(e,t){if(e===null)throw Error(`Invalid ${t} payload`);return e}function G(e){try{return x(e)}catch{throw Error(`Hosted auth-menu request requires a non-empty requestId`)}}function ue(e){switch(e.type){case`PM_ACTIVATE_TRANSACTION_REVIEW`:case`PING`:case`PM_PREPARE_WALLET_RUNTIME`:case`PM_SET_CONFIG`:case`PM_CANCEL`:case`PM_SET_TRANSACTION_VIEW`:case`PM_TRANSACTION_BROADCAST_STARTED`:return{kind:`boot`,type:e.type,request:e};case`PM_REGISTER_WALLET`:case`PM_ADD_WALLET_SIGNER`:case`PM_ADD_PASSKEY`:case`PM_ADD_EMAIL_OTP`:case`PM_REVOKE_AUTH_METHOD`:case`PM_GET_NEAR_PROVISIONING_STATE`:case`PM_SIGN_TX_WITH_ACTIONS`:case`PM_SIGN_AND_SEND_TX`:case`PM_SEND_TRANSACTION`:case`PM_SIGN_DELEGATE_ACTION`:case`PM_SIGN_NEP413`:return{kind:`near`,type:e.type,request:e};case`PM_OPEN_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(s(e.payload),`hosted auth-menu open`)}}}case`PM_CANCEL_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(o(e.payload),`hosted auth-menu cancellation`)}}}case`PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(m(e.payload),`hosted auth-menu external-auth resolution`)}}}case`PM_UNLOCK`:case`PM_LOCK`:case`PM_LOCK_EXACT_WALLET_SESSION`:case`PM_GET_LAST_WALLET_MOVE_REQUEST`:case`PM_MOVE_WALLET`:case`PM_GET_WALLET_MOVE`:case`PM_GET_WALLET_PLACEMENT`:case`PM_GET_WALLET_SESSION`:case`PM_GET_EXACT_WALLET_SESSION_STATE`:case`PM_GET_RECENT_UNLOCKS`:return{kind:`auth`,type:e.type,request:e};case`PM_SIGN_TEMPO`:case`PM_REPORT_TEMPO_BROADCAST_ACCEPTED`:case`PM_REPORT_TEMPO_BROADCAST_REJECTED`:case`PM_REPORT_TEMPO_FINALIZED`:case`PM_REPORT_TEMPO_DROPPED_OR_REPLACED`:case`PM_RECONCILE_TEMPO_NONCE_LANE`:return{kind:`ecdsa`,type:e.type,request:e};case`PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION`:case`PM_REQUEST_EMAIL_OTP_CHALLENGE`:case`PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL`:case`PM_GET_WALLET_RECOVERY_CODE_STATUS`:case`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`:case`PM_ROTATE_WALLET_RECOVERY_CODES`:case`PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE`:return{kind:`email_otp`,type:e.type,request:e};case`PM_SYNC_ACCOUNT_FLOW`:return{kind:`recovery`,type:e.type,request:e};case`PM_RESOLVE_EXACT_KEY_EXPORT_LANE`:case`PM_EXPORT_KEYPAIR_UI`:return{kind:`export`,type:e.type,request:e};case`PM_HAS_PASSKEY`:case`PM_LIST_LINKED_DEVICES`:case`PM_REVOKE_LINKED_DEVICE`:case`PM_SCAN_AND_LINK_DEVICE`:case`PM_START_DEVICE2_LINKING_FLOW`:case`PM_DEVICE_LINK_TARGET_FACTOR_ACTION`:case`PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION`:case`PM_CANCEL_DEVICE_LINKING`:return{kind:`device_link`,type:e.type,request:e};case`PM_SET_CONFIRM_BEHAVIOR`:case`PM_SET_CONFIRMATION_CONFIG`:case`PM_GET_CONFIRMATION_CONFIG`:return{kind:`preferences`,type:e.type,request:e}}return U(e)}function de(e){return e.kind!==`boot`}let K=!1;const fe=[{selector:`.seams-auth-menu-surface`,cancellationKind:`native_cancel`},{selector:`.seams-confirmation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-export-surface`,cancellationKind:`wallet_iframe_cancel`},{selector:`[data-seams-wallet-recovery-backup-dialog]`,cancellationKind:`native_cancel`}];function q(e,t){let n=new Set(t),r=Object.keys(e);return r.length===t.length&&r.every(e=>n.has(e))}function pe(t){return!e(t)||!q(t,[`type`,`payload`])||t.type!==`CONNECT`||!e(t.payload)||!q(t.payload,[`protocolVersion`])?null:typeof t.payload.protocolVersion==`string`?{type:`CONNECT`,payload:{protocolVersion:t.payload.protocolVersion}}:null}function J(e){if(e===`null`)return!0;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.origin===e}catch{return!1}}function Y(e){try{e.close()}catch{}}function me(e,t){if(t===`16.0.0`)return!1;let n={expectedProtocolVersion:l,receivedProtocolVersion:t};try{e.postMessage({type:`ERROR`,payload:{code:f,message:`Wallet iframe protocol version mismatch: expected ${l}, received ${t??`missing`}`,details:n}})}catch{}return Y(e),!0}function X(e,t){return!t||t.has(e)}function Z(e,t,n,r){e.executionGeneration===t&&n(r)}function Q(e,t,n,r){return e.executionGeneration!==t||n(r)}function $(e={}){if(K)return;K=!0,T(),(!e.supportedRuntimeRouteKinds||e.supportedRuntimeRouteKinds.has(`email_otp`))&&j().catch(()=>void 0);let r=new Set,i=new Set,o=!1,s={parentOrigin:null,port:null,configuration:{kind:`unconfigured`},executionGeneration:0,onConfigurationChanged:null},c=e=>{try{s.port?.postMessage(e)}catch{}},u=e=>{e&&r.add(e)},d=e=>!!e&&(r.has(e)||_(e)?.cancelled===!0),f=e=>{e&&r.delete(e)},p=e=>{e&&c({type:`ERROR`,requestId:e,payload:{code:`cancelled`,message:`Request cancelled`}})},m=e=>!e||!d(e)?!1:_(e)?.cancelled?!0:(p(e),f(e),!0),x=()=>{for(let e of fe){let t=document.querySelectorAll(e.selector);for(let n of t)try{e.cancellationKind===`native_cancel`?n.dispatchEvent(new Event(`cancel`,{cancelable:!0})):n.dispatchEvent(new CustomEvent(b.TX_CONFIRMER_CANCEL,{bubbles:!0,composed:!0}))}catch{}}},C=async r=>{let l=r.data;if(!l||!t(l))return;let b=l.requestId,C=s.executionGeneration,w=Z.bind(null,s,C,c),T=null;try{if(`transactionReview`in l){if(l.type!==`PM_SIGN_AND_SEND_TX`&&l.type!==`PM_SIGN_TEMPO`)throw new h(`review_invalid_input`,`Review is unsupported for this request`);let e=g(l.transactionReview);if(e.requestId!==b)throw new h(`review_invalid_input`,`Review request identity mismatch`);let t=l.payload?.options?.confirmationConfig;if(t?.uiMode!==`modal`||t.behavior!==`requireClick`)throw new h(`review_unsupported_mode`,`Review requires modal presentation and explicit approval`);T=new ie(e,l.type===`PM_SIGN_TEMPO`&&l.payload?.request.senderSignatureAlgorithm!==`secp256k1`?`credential`:`mpc`,e=>w({type:`TRANSACTION_REVIEW_STATE`,requestId:b,payload:e}),e=>w({type:`ERROR`,requestId:b,payload:{code:e instanceof h?e.code:`cancelled`,message:e.message}}))}(l.type===`PM_LOCK`||l.type===`PM_LOCK_EXACT_WALLET_SESSION`)&&v(new h(`review_identity_changed`,`The wallet session changed`));let t=ue(l);if(!de(t))switch(t.type){case`PING`:c({type:`PONG`,requestId:b});return;case`PM_PREPARE_WALLET_RUNTIME`:X(`auth`,e.supportedRuntimeRouteKinds)&&ce(),c({type:`PONG`,requestId:b});return;case`PM_SET_CONFIG`:{let e=ee(s.configuration,te(t.request.payload)),r=a(s.configuration.kind===`configured`?s.configuration.config:null)!==a(e.config);if(s.configuration=e,r){s.executionGeneration+=1;let t=e.config;t.registration.publishableKey&&t.registration.projectEnvironmentId&&n(t.network.relayer.url);for(let e of i)c({type:`ERROR`,requestId:e,payload:{code:`wallet_configuration_changed`,message:`Wallet configuration changed during request`}});i.clear()}s.onConfigurationChanged?.(),r&&(v(new h(`review_identity_changed`,`Wallet execution configuration changed`)),x()),c({type:`PONG`,requestId:b});return}case`PM_ACTIVATE_TRANSACTION_REVIEW`:{let e=y(t.request.payload);e&&_(e.requestId)?.activate(e);return}case`PM_CANCEL`:{let e=t.request.payload?.requestId,n=t.request.payload,r=n&&typeof n==`object`?Reflect.get(n,`transactionReview`):void 0;if(r!==void 0){let t=g(r),i=_(t.requestId);if(t.requestId===e&&i&&ne(t,i.metadata)){let e=new h(ae(n&&typeof n==`object`?Reflect.get(n,`reviewErrorCode`):void 0),`Reviewed request cancelled`);try{re(i.metadata.validity)}catch(t){t instanceof Error&&(e=t)}i.cancel(e)}c({type:`PONG`,requestId:b});return}let i=e?_(e):void 0;if(i){i.cancel(new h(`cancelled`,`Request cancelled`)),c({type:`PONG`,requestId:b});return}u(e),x(),e&&p(e),c({type:`PONG`,requestId:b});return}case`PM_SET_TRANSACTION_VIEW`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`requestId`):null,r=e&&typeof e==`object`?Reflect.get(e,`view`):null;typeof n==`string`&&(r===`toast`||r===`closed`)&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).setTransactionActivityView(n,r);return}case`PM_TRANSACTION_BROADCAST_STARTED`:{let e=t.request.payload,n=e&&typeof e==`object`?Reflect.get(e,`signedTransaction`):null;typeof n==`string`&&(await import(`./transaction-activity-Cccvec2J.js`).then(e=>e.o)).transactionBroadcastStarted(n);return}}if(!X(t.kind,e.supportedRuntimeRouteKinds)){c({type:`ERROR`,requestId:b,payload:{code:`unsupported_request`,message:`Unsupported wallet iframe request type: ${t.type}`}});return}if(b&&i.add(b),!o&&P(t)&&await L()&&!o){if(C!==s.executionGeneration||m(b))return;w({type:`PM_RESULT`,requestId:b,payload:{ok:!0,result:F(t)}});return}o=!0;let r=await se(t);if(C!==s.executionGeneration)return;await r.handleWalletHostRuntimeRequest({transactionReview:T,state:s,executionGeneration:C,req:t.request,post:Z.bind(null,s,C,c),isCancelled:Q.bind(null,s,C,d),respondIfCancelled:Q.bind(null,s,C,m)})}catch(e){if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`||T?.cancelled)return;let t=await import(`./canonicalSignerErrorCode-Cz48v4oy.js`);if(C!==s.executionGeneration&&l.type!==`PM_SET_CONFIG`)return;let n=e&&typeof e==`object`&&`code`in e?e.code:void 0,r=S(e),i=t.resolveWalletBoundaryErrorCode({requestType:l.type,rawCode:n,message:r,defaultCode:`HOST_ERROR`}),a=t.resolveWalletBoundaryErrorMessage({requestType:l.type,rawCode:n,code:i,message:r}),o=t.resolveWalletBoundarySignerKind(l.type);c({type:`ERROR`,requestId:b,payload:{code:i,message:a,...t.isWalletSignerBoundaryRequestType(l.type)&&t.isCanonicalSignerSessionBoundaryCode(i)&&o?{signerKind:o}:{}}})}finally{b&&(i.delete(b),f(b)),T?.finish()}};window.addEventListener(`message`,e=>{let t=pe(e.data),n=e.ports[0];if(!(!t||!n||s.port)){if(e.source!==window.parent||!J(e.origin)){Y(n);return}if(!me(n,t.payload.protocolVersion)){typeof e.origin==`string`&&e.origin.length&&e.origin!==`null`&&(s.parentOrigin=e.origin),s.port=n;try{s.port.onmessage=C,s.port.start?.()}catch{}c({type:`READY`,payload:{protocolVersion:l}})}}})}try{$()}catch(e){console.error(`[WalletHost] init failed`,e)}export{$ as t};