@canton-network/wallet-gateway-remote 1.10.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/init.d.ts.map +1 -1
  2. package/dist/init.js +17 -2
  3. package/dist/ledger/transaction-service.d.ts +2 -8
  4. package/dist/ledger/transaction-service.d.ts.map +1 -1
  5. package/dist/ledger/transaction-service.js +51 -474
  6. package/dist/ledger/transaction-service.test.js +26 -18
  7. package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts.map +1 -1
  8. package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.js +5 -6
  9. package/dist/ledger/wallet-allocation/wallet-allocation-service.test.js +1 -1
  10. package/dist/middleware/errorHandler.d.ts +4 -0
  11. package/dist/middleware/errorHandler.d.ts.map +1 -0
  12. package/dist/middleware/errorHandler.js +46 -0
  13. package/dist/middleware/errorHandler.test.d.ts +2 -0
  14. package/dist/middleware/errorHandler.test.d.ts.map +1 -0
  15. package/dist/middleware/errorHandler.test.js +100 -0
  16. package/dist/middleware/jsonRpcHandler.d.ts +0 -1
  17. package/dist/middleware/jsonRpcHandler.d.ts.map +1 -1
  18. package/dist/middleware/jsonRpcHandler.js +7 -4
  19. package/dist/middleware/jsonRpcHandler.test.js +30 -7
  20. package/dist/middleware/jwtAuth.d.ts.map +1 -1
  21. package/dist/middleware/jwtAuth.js +9 -4
  22. package/dist/middleware/jwtAuth.test.js +14 -7
  23. package/dist/middleware/sessionHandler.d.ts +1 -1
  24. package/dist/middleware/sessionHandler.d.ts.map +1 -1
  25. package/dist/middleware/sessionHandler.js +28 -15
  26. package/dist/middleware/sessionHandler.test.js +35 -1
  27. package/dist/web/frontend/404/index.html +2 -2
  28. package/dist/web/frontend/activities/index.html +3 -3
  29. package/dist/web/frontend/approve/index.html +3 -3
  30. package/dist/web/frontend/assets/{404-DaA35RoG.js → 404-CPixqKLO.js} +1 -1
  31. package/dist/web/frontend/assets/{activities-CuMcxQVi.js → activities-CVPKYW17.js} +1 -1
  32. package/dist/web/frontend/assets/{addIdentityProvider-BYCAWtiZ.js → addIdentityProvider-nAJ-qcC5.js} +1 -1
  33. package/dist/web/frontend/assets/{addNetwork-DJM_nq3n.js → addNetwork-BneU5JY2.js} +1 -1
  34. package/dist/web/frontend/assets/addParty-GstM-rQp.js +13 -0
  35. package/dist/web/frontend/assets/{approve-4Xp3Ck4z.js → approve-CWUpB-cM.js} +1 -1
  36. package/dist/web/frontend/assets/{callback-DCYIq514.js → callback-DX4EJbNv.js} +1 -1
  37. package/dist/web/frontend/assets/common-JTjsyB1o.js +31 -0
  38. package/dist/web/frontend/assets/editParty-B-21AFFC.js +14 -0
  39. package/dist/web/frontend/assets/{identityProviders-1ro-4zy9.js → identityProviders-DFmAVYxV.js} +1 -1
  40. package/dist/web/frontend/assets/{index-BhzcMGYw.js → index-BAXYVraq.js} +1 -1
  41. package/dist/web/frontend/assets/index-Cvcr2Fng.js +2 -0
  42. package/dist/web/frontend/assets/{index-D-NXyb6u.js → index-Dp1svjp8.js} +1 -1
  43. package/dist/web/frontend/assets/{login-VCs39tyk.js → login-DuwXiFvJ.js} +1 -1
  44. package/dist/web/frontend/assets/{networks-CRTkFNGb.js → networks-Bh4iCMzi.js} +1 -1
  45. package/dist/web/frontend/assets/{reviewIdentityProvider-8F5_K-A5.js → reviewIdentityProvider-Bd7IWXao.js} +1 -1
  46. package/dist/web/frontend/assets/{reviewNetwork-DL-oQDwd.js → reviewNetwork-CPEZ1fzY.js} +1 -1
  47. package/dist/web/frontend/assets/{settings-DgRrnzuq.js → settings-BUUAYz6_.js} +1 -1
  48. package/dist/web/frontend/callback/index.html +2 -2
  49. package/dist/web/frontend/identity-providers/add/index.html +2 -2
  50. package/dist/web/frontend/identity-providers/index.html +2 -2
  51. package/dist/web/frontend/identity-providers/review/index.html +2 -2
  52. package/dist/web/frontend/index.html +1 -1
  53. package/dist/web/frontend/login/index.html +2 -2
  54. package/dist/web/frontend/networks/add/index.html +2 -2
  55. package/dist/web/frontend/networks/index.html +2 -2
  56. package/dist/web/frontend/networks/review/index.html +2 -2
  57. package/dist/web/frontend/parties/add/index.html +4 -3
  58. package/dist/web/frontend/parties/edit/index.html +17 -0
  59. package/dist/web/frontend/parties/index.html +2 -2
  60. package/dist/web/frontend/settings/index.html +2 -2
  61. package/dist/web/server.d.ts +1 -1
  62. package/dist/web/server.d.ts.map +1 -1
  63. package/dist/web/server.js +3 -3
  64. package/package.json +27 -28
  65. package/dist/web/frontend/assets/addParty-SChbVsEF.js +0 -43
  66. package/dist/web/frontend/assets/index-BjhQnXf1.js +0 -2
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
4
4
  import { pino } from 'pino';
5
5
  import { sink } from 'pino-test';
6
6
  import { sessionHandler } from './sessionHandler.js';
7
+ import { providerErrors } from '@canton-network/core-rpc-errors';
7
8
  describe('sessionHandler', () => {
8
9
  const getSession = vi.fn();
9
10
  const withAuthContext = vi.fn(() => ({ getSession }));
@@ -94,9 +95,42 @@ describe('sessionHandler', () => {
94
95
  expect(next).not.toHaveBeenCalled();
95
96
  expect(status).toHaveBeenCalledWith(401);
96
97
  expect(json).toHaveBeenCalledWith({
97
- error: 'No active session found',
98
+ jsonrpc: '2.0',
99
+ id: null,
100
+ error: {
101
+ code: providerErrors.unauthorized().code,
102
+ message: 'No active session found',
103
+ },
98
104
  });
99
105
  });
106
+ it('returns 401 without calling getSession when no access token is present', async () => {
107
+ const req = makeReq({
108
+ body: { method: 'listWallets' },
109
+ authContext: undefined,
110
+ });
111
+ const res = makeRes();
112
+ const middleware = sessionHandler(store, allowedPaths, logger);
113
+ await middleware(req, res, next);
114
+ expect(getSession).not.toHaveBeenCalled();
115
+ expect(next).not.toHaveBeenCalled();
116
+ expect(status).toHaveBeenCalledWith(401);
117
+ expect(json).toHaveBeenCalledWith({
118
+ jsonrpc: '2.0',
119
+ id: null,
120
+ error: {
121
+ code: providerErrors.unauthorized().code,
122
+ message: 'No active session found',
123
+ },
124
+ });
125
+ });
126
+ it('keeps the JSON-RPC request id in the 401 response', async () => {
127
+ getSession.mockResolvedValue(undefined);
128
+ const req = makeReq({ body: { method: 'listWallets', id: 42 } });
129
+ const res = makeRes();
130
+ const middleware = sessionHandler(store, allowedPaths, logger);
131
+ await middleware(req, res, next);
132
+ expect(json).toHaveBeenCalledWith(expect.objectContaining({ id: 42 }));
133
+ });
100
134
  it('requires a session when the path is not in the allow list config', async () => {
101
135
  getSession.mockResolvedValue(undefined);
102
136
  const req = makeReq({
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Wallet Gateway - Not found</title>
7
- <script type="module" crossorigin src="../assets/404-DaA35RoG.js"></script>
8
- <link rel="modulepreload" crossorigin href="../assets/index-BhzcMGYw.js">
7
+ <script type="module" crossorigin src="../assets/404-CPixqKLO.js"></script>
8
+ <link rel="modulepreload" crossorigin href="../assets/index-BAXYVraq.js">
9
9
  </head>
10
10
 
11
11
  <body>
@@ -4,9 +4,9 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Wallet Gateway - Activities</title>
7
- <script type="module" crossorigin src="../assets/activities-CuMcxQVi.js"></script>
8
- <link rel="modulepreload" crossorigin href="../assets/index-BhzcMGYw.js">
9
- <link rel="modulepreload" crossorigin href="../assets/index-BjhQnXf1.js">
7
+ <script type="module" crossorigin src="../assets/activities-CVPKYW17.js"></script>
8
+ <link rel="modulepreload" crossorigin href="../assets/index-BAXYVraq.js">
9
+ <link rel="modulepreload" crossorigin href="../assets/index-Cvcr2Fng.js">
10
10
  </head>
11
11
  <body>
12
12
  <user-app>
@@ -4,9 +4,9 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Wallet Gateway - Activity detail</title>
7
- <script type="module" crossorigin src="../assets/approve-4Xp3Ck4z.js"></script>
8
- <link rel="modulepreload" crossorigin href="../assets/index-BhzcMGYw.js">
9
- <link rel="modulepreload" crossorigin href="../assets/index-BjhQnXf1.js">
7
+ <script type="module" crossorigin src="../assets/approve-CWUpB-cM.js"></script>
8
+ <link rel="modulepreload" crossorigin href="../assets/index-BAXYVraq.js">
9
+ <link rel="modulepreload" crossorigin href="../assets/index-Cvcr2Fng.js">
10
10
  </head>
11
11
 
12
12
  <body>
@@ -1,4 +1,4 @@
1
- import{v as h,i as z,V as E,b as I,t as j}from"./index-BhzcMGYw.js";var k=Object.create,s=Object.defineProperty,D=Object.getOwnPropertyDescriptor,y=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),x=r=>{throw TypeError(r)},F=(r,e,o)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,V=(r,e)=>s(r,"name",{value:e,configurable:!0}),g=r=>[,,,k(r?.[y("metadata")]??null)],A=["class","method","getter","setter","accessor","field","value","get","set"],S=r=>r!==void 0&&typeof r!="function"?x("Function expected"):r,C=(r,e,o,_,t)=>({kind:A[r],name:e,metadata:_,addInitializer:a=>o._?x("Already initialized"):t.push(S(a||null))}),M=(r,e)=>F(e,y("metadata"),r[3]),N=(r,e,o,_)=>{for(var t=0,a=r[e>>1],n=a&&a.length;t<n;t++)a[t].call(o);return _},T=(r,e,o,_,t,a)=>{var n,p,f,i=e&7,b=!1,m=0,P=r[m]||(r[m]=[]),c=i&&(t=t.prototype,i<5&&(i>3||!b)&&D(t,o));V(t,o);for(var d=_.length-1;d>=0;d--)f=C(i,o,p={},r[3],P),n=(0,_[d])(t,f),p._=1,S(n)&&(t=n);return M(r,t),c&&s(t,o,c),b?i^4?a:c:t},w,v,O;w=[j("user-ui-404")];const u=class u extends(O=h){render(){return I`<not-found href=${E("/")}></not-found>`}};u.styles=[h.styles,z`
1
+ import{v as h,i as z,V as E,b as I,t as j}from"./index-BAXYVraq.js";var k=Object.create,s=Object.defineProperty,D=Object.getOwnPropertyDescriptor,y=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),x=r=>{throw TypeError(r)},F=(r,e,o)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,V=(r,e)=>s(r,"name",{value:e,configurable:!0}),g=r=>[,,,k(r?.[y("metadata")]??null)],A=["class","method","getter","setter","accessor","field","value","get","set"],S=r=>r!==void 0&&typeof r!="function"?x("Function expected"):r,C=(r,e,o,_,t)=>({kind:A[r],name:e,metadata:_,addInitializer:a=>o._?x("Already initialized"):t.push(S(a||null))}),M=(r,e)=>F(e,y("metadata"),r[3]),N=(r,e,o,_)=>{for(var t=0,a=r[e>>1],n=a&&a.length;t<n;t++)a[t].call(o);return _},T=(r,e,o,_,t,a)=>{var n,p,f,i=e&7,b=!1,m=0,P=r[m]||(r[m]=[]),c=i&&(t=t.prototype,i<5&&(i>3||!b)&&D(t,o));V(t,o);for(var d=_.length-1;d>=0;d--)f=C(i,o,p={},r[3],P),n=(0,_[d])(t,f),p._=1,S(n)&&(t=n);return M(r,t),c&&s(t,o,c),b?i^4?a:c:t},w,v,O;w=[j("user-ui-404")];const u=class u extends(O=h){render(){return I`<not-found href=${E("/")}></not-found>`}};u.styles=[h.styles,z`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{r as C,b as _,V as Y,s as Z,d as j,c as tt,a as at,f as et,v as N,i as it,t as st}from"./index-BhzcMGYw.js";import{p as rt}from"./index-BjhQnXf1.js";var nt=Object.create,I=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,R=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),v=a=>{throw TypeError(a)},ct=(a,t,e)=>t in a?I(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,F=(a,t)=>I(a,"name",{value:t,configurable:!0}),dt=a=>[,,,nt(a?.[R("metadata")]??null)],V=["class","method","getter","setter","accessor","field","value","get","set"],m=a=>a!==void 0&&typeof a!="function"?v("Function expected"):a,lt=(a,t,e,o,s)=>({kind:V[a],name:t,metadata:o,addInitializer:r=>e._?v("Already initialized"):s.push(m(r||null))}),pt=(a,t)=>ct(t,R("metadata"),a[3]),p=(a,t,e,o)=>{for(var s=0,r=a[t>>1],h=r&&r.length;s<h;s++)t&1?r[s].call(e):o=r[s].call(e,o);return o},f=(a,t,e,o,s,r)=>{var h,d,x,w,T,i=t&7,$=!!(t&8),u=!!(t&16),P=i>3?a.length+1:i?$?1:2:0,E=V[i+5],D=i>3&&(a[P-1]=[]),X=a[P]||(a[P]=[]),l=i&&(!u&&!$&&(s=s.prototype),i<5&&(i>3||!u)&&ot(i<4?s:{get[e](){return H(this,r)},set[e](c){return L(this,r,c)}},e));i?u&&i<4&&F(r,(i>2?"set ":i>1?"get ":"")+e):F(s,e);for(var b=o.length-1;b>=0;b--)w=lt(i,e,x={},a[3],X),i&&(w.static=$,w.private=u,T=w.access={has:u?c=>ht(s,c):c=>e in c},i^3&&(T.get=u?c=>(i^1?H:ut)(c,s,i^4?r:l.get):c=>c[e]),i>2&&(T.set=u?(c,k)=>L(c,s,k,i^4?r:l.set):(c,k)=>c[e]=k)),d=(0,o[b])(i?i<4?u?r:l[E]:i>4?void 0:{get:l.get,set:l.set}:s,w),x._=1,i^4||d===void 0?m(d)&&(i>4?D.unshift(d):i?u?r=d:l[E]=d:s=d):typeof d!="object"||d===null?v("Object expected"):(m(h=d.get)&&(l.get=h),m(h=d.set)&&(l.set=h),m(h=d.init)&&D.unshift(h));return i||pt(a,s),l&&I(s,e,l),u?i^4?r:l:s},z=(a,t,e)=>t.has(a)||v("Cannot "+e),ht=(a,t)=>Object(t)!==t?v('Cannot use the "in" operator on this value'):a.has(t),H=(a,t,e)=>(z(a,t,"read from private field"),e?e.call(a):t.get(a)),y=(a,t,e)=>t.has(a)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,e),L=(a,t,e,o)=>(z(a,t,"write to private field"),o?o.call(a,e):t.set(a,e),e),ut=(a,t,e)=>(z(a,t,"access private method"),e),q,G,B,J,K,S,Q,n,A,M,O,U,W;Q=[st("user-ui-activities")];class g extends(S=N,K=[C()],J=[C()],B=[C()],G=[C()],q=[C()],S){constructor(){super(...arguments),y(this,A,p(n,8,this,[])),p(n,11,this),y(this,M,p(n,12,this,new Map)),p(n,15,this),y(this,O,p(n,16,this,!1)),p(n,19,this),y(this,U,p(n,20,this,1)),p(n,23,this),y(this,W,p(n,24,this,0)),p(n,27,this),this.pageCursors=[void 0],this.pageSize=4}render(){return _`
1
+ import{r as C,b as _,V as Y,s as Z,d as j,c as tt,a as at,f as et,v as N,i as it,t as st}from"./index-BAXYVraq.js";import{p as rt}from"./index-Cvcr2Fng.js";var nt=Object.create,I=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,R=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),v=a=>{throw TypeError(a)},ct=(a,t,e)=>t in a?I(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,F=(a,t)=>I(a,"name",{value:t,configurable:!0}),dt=a=>[,,,nt(a?.[R("metadata")]??null)],V=["class","method","getter","setter","accessor","field","value","get","set"],m=a=>a!==void 0&&typeof a!="function"?v("Function expected"):a,lt=(a,t,e,o,s)=>({kind:V[a],name:t,metadata:o,addInitializer:r=>e._?v("Already initialized"):s.push(m(r||null))}),pt=(a,t)=>ct(t,R("metadata"),a[3]),p=(a,t,e,o)=>{for(var s=0,r=a[t>>1],h=r&&r.length;s<h;s++)t&1?r[s].call(e):o=r[s].call(e,o);return o},f=(a,t,e,o,s,r)=>{var h,d,x,w,T,i=t&7,$=!!(t&8),u=!!(t&16),P=i>3?a.length+1:i?$?1:2:0,E=V[i+5],D=i>3&&(a[P-1]=[]),X=a[P]||(a[P]=[]),l=i&&(!u&&!$&&(s=s.prototype),i<5&&(i>3||!u)&&ot(i<4?s:{get[e](){return H(this,r)},set[e](c){return L(this,r,c)}},e));i?u&&i<4&&F(r,(i>2?"set ":i>1?"get ":"")+e):F(s,e);for(var b=o.length-1;b>=0;b--)w=lt(i,e,x={},a[3],X),i&&(w.static=$,w.private=u,T=w.access={has:u?c=>ht(s,c):c=>e in c},i^3&&(T.get=u?c=>(i^1?H:ut)(c,s,i^4?r:l.get):c=>c[e]),i>2&&(T.set=u?(c,k)=>L(c,s,k,i^4?r:l.set):(c,k)=>c[e]=k)),d=(0,o[b])(i?i<4?u?r:l[E]:i>4?void 0:{get:l.get,set:l.set}:s,w),x._=1,i^4||d===void 0?m(d)&&(i>4?D.unshift(d):i?u?r=d:l[E]=d:s=d):typeof d!="object"||d===null?v("Object expected"):(m(h=d.get)&&(l.get=h),m(h=d.set)&&(l.set=h),m(h=d.init)&&D.unshift(h));return i||pt(a,s),l&&I(s,e,l),u?i^4?r:l:s},z=(a,t,e)=>t.has(a)||v("Cannot "+e),ht=(a,t)=>Object(t)!==t?v('Cannot use the "in" operator on this value'):a.has(t),H=(a,t,e)=>(z(a,t,"read from private field"),e?e.call(a):t.get(a)),y=(a,t,e)=>t.has(a)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,e),L=(a,t,e,o)=>(z(a,t,"write to private field"),o?o.call(a,e):t.set(a,e),e),ut=(a,t,e)=>(z(a,t,"access private method"),e),q,G,B,J,K,S,Q,n,A,M,O,U,W;Q=[st("user-ui-activities")];class g extends(S=N,K=[C()],J=[C()],B=[C()],G=[C()],q=[C()],S){constructor(){super(...arguments),y(this,A,p(n,8,this,[])),p(n,11,this),y(this,M,p(n,12,this,new Map)),p(n,15,this),y(this,O,p(n,16,this,!1)),p(n,19,this),y(this,U,p(n,20,this,1)),p(n,23,this),y(this,W,p(n,24,this,0)),p(n,27,this),this.pageCursors=[void 0],this.pageSize=4}render(){return _`
2
2
  <div class="page-header">
3
3
  <h1 class="h4 fw-semibold mb-0 text-body">Activities</h1>
4
4
  </div>
@@ -1,4 +1,4 @@
1
- import{r as q,s as P,V as G,d as H,c as L,a as N,x as J,f as K,b as Q,v as B,i as R,t as X}from"./index-BhzcMGYw.js";var Y=Object.create,C=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,D=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},j=(e,t,a)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,x=(e,t)=>C(e,"name",{value:t,configurable:!0}),ee=e=>[,,,Y(e?.[D("metadata")]??null)],F=["class","method","getter","setter","accessor","field","value","get","set"],u=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,te=(e,t,a,n,i)=>({kind:F[e],name:t,metadata:n,addInitializer:s=>a._?_("Already initialized"):i.push(u(s||null))}),ae=(e,t)=>j(t,D("metadata"),e[3]),S=(e,t,a,n)=>{for(var i=0,s=e[t>>1],p=s&&s.length;i<p;i++)t&1?s[i].call(a):n=s[i].call(a,n);return n},T=(e,t,a,n,i,s)=>{var p,o,U,h,g,r=t&7,w=!!(t&8),l=!!(t&16),m=r>3?e.length+1:r?w?1:2:0,A=F[r+5],z=r>3&&(e[m-1]=[]),$=e[m]||(e[m]=[]),c=r&&(!l&&!w&&(i=i.prototype),r<5&&(r>3||!l)&&Z(r<4?i:{get[a](){return M(this,s)},set[a](d){return E(this,s,d)}},a));r?l&&r<4&&x(s,(r>2?"set ":r>1?"get ":"")+a):x(i,a);for(var y=n.length-1;y>=0;y--)h=te(r,a,U={},e[3],$),r&&(h.static=w,h.private=l,g=h.access={has:l?d=>re(i,d):d=>a in d},r^3&&(g.get=l?d=>(r^1?M:se)(d,i,r^4?s:c.get):d=>d[a]),r>2&&(g.set=l?(d,k)=>E(d,i,k,r^4?s:c.set):(d,k)=>d[a]=k)),o=(0,n[y])(r?r<4?l?s:c[A]:r>4?void 0:{get:c.get,set:c.set}:i,h),U._=1,r^4||o===void 0?u(o)&&(r>4?z.unshift(o):r?l?s=o:c[A]=o:i=o):typeof o!="object"||o===null?_("Object expected"):(u(p=o.get)&&(c.get=p),u(p=o.set)&&(c.set=p),u(p=o.init)&&z.unshift(p));return r||ae(e,i),c&&C(i,a,c),l?r^4?s:c:i},O=(e,t,a)=>t.has(e)||_("Cannot "+a),re=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),M=(e,t,a)=>(O(e,t,"read from private field"),a?a.call(e):t.get(e)),ie=(e,t,a)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),E=(e,t,a,n)=>(O(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a),se=(e,t,a)=>(O(e,t,"access private method"),a),V,b,W,v,I;W=[X("user-ui-add-idp")];class f extends(b=B,V=[q()],b){constructor(){super(...arguments),ie(this,I,S(v,8,this,!1)),S(v,11,this)}navigateBack(){P(G("/identity-providers"))}async onSave(t){this.loading=!0;try{const a=await H();await(await L(await N.accessToken.get(a))).request({method:"addIdp",params:{idp:t.idp}}),P(J("/identity-providers/"))}catch(a){this.loading=!1,K(a)}}render(){return Q`
1
+ import{r as q,s as P,V as G,d as H,c as L,a as N,x as J,f as K,b as Q,v as B,i as R,t as X}from"./index-BAXYVraq.js";var Y=Object.create,C=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,D=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},j=(e,t,a)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,x=(e,t)=>C(e,"name",{value:t,configurable:!0}),ee=e=>[,,,Y(e?.[D("metadata")]??null)],F=["class","method","getter","setter","accessor","field","value","get","set"],u=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,te=(e,t,a,n,i)=>({kind:F[e],name:t,metadata:n,addInitializer:s=>a._?_("Already initialized"):i.push(u(s||null))}),ae=(e,t)=>j(t,D("metadata"),e[3]),S=(e,t,a,n)=>{for(var i=0,s=e[t>>1],p=s&&s.length;i<p;i++)t&1?s[i].call(a):n=s[i].call(a,n);return n},T=(e,t,a,n,i,s)=>{var p,o,U,h,g,r=t&7,w=!!(t&8),l=!!(t&16),m=r>3?e.length+1:r?w?1:2:0,A=F[r+5],z=r>3&&(e[m-1]=[]),$=e[m]||(e[m]=[]),c=r&&(!l&&!w&&(i=i.prototype),r<5&&(r>3||!l)&&Z(r<4?i:{get[a](){return M(this,s)},set[a](d){return E(this,s,d)}},a));r?l&&r<4&&x(s,(r>2?"set ":r>1?"get ":"")+a):x(i,a);for(var y=n.length-1;y>=0;y--)h=te(r,a,U={},e[3],$),r&&(h.static=w,h.private=l,g=h.access={has:l?d=>re(i,d):d=>a in d},r^3&&(g.get=l?d=>(r^1?M:se)(d,i,r^4?s:c.get):d=>d[a]),r>2&&(g.set=l?(d,k)=>E(d,i,k,r^4?s:c.set):(d,k)=>d[a]=k)),o=(0,n[y])(r?r<4?l?s:c[A]:r>4?void 0:{get:c.get,set:c.set}:i,h),U._=1,r^4||o===void 0?u(o)&&(r>4?z.unshift(o):r?l?s=o:c[A]=o:i=o):typeof o!="object"||o===null?_("Object expected"):(u(p=o.get)&&(c.get=p),u(p=o.set)&&(c.set=p),u(p=o.init)&&z.unshift(p));return r||ae(e,i),c&&C(i,a,c),l?r^4?s:c:i},O=(e,t,a)=>t.has(e)||_("Cannot "+a),re=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),M=(e,t,a)=>(O(e,t,"read from private field"),a?a.call(e):t.get(e)),ie=(e,t,a)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),E=(e,t,a,n)=>(O(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a),se=(e,t,a)=>(O(e,t,"access private method"),a),V,b,W,v,I;W=[X("user-ui-add-idp")];class f extends(b=B,V=[q()],b){constructor(){super(...arguments),ie(this,I,S(v,8,this,!1)),S(v,11,this)}navigateBack(){P(G("/identity-providers"))}async onSave(t){this.loading=!0;try{const a=await H();await(await L(await N.accessToken.get(a))).request({method:"addIdp",params:{idp:t.idp}}),P(J("/identity-providers/"))}catch(a){this.loading=!1,K(a)}}render(){return Q`
2
2
  <div class="page-header">
3
3
  <h1 class="h4 fw-semibold mb-0">Add a new identity provider</h1>
4
4
  <wg-back-link @click=${this.navigateBack}></wg-back-link>
@@ -1,4 +1,4 @@
1
- import{r as V,s as P,V as W,d as G,c as H,a as L,x as J,f as K,z as Q,b as R,v as B,i as X,t as Y}from"./index-BhzcMGYw.js";var Z=Object.create,S=Object.defineProperty,j=Object.getOwnPropertyDescriptor,E=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},ee=(e,t,r)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,U=(e,t)=>S(e,"name",{value:t,configurable:!0}),te=e=>[,,,Z(e?.[E("metadata")]??null)],$=["class","method","getter","setter","accessor","field","value","get","set"],w=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,re=(e,t,r,s,i)=>({kind:$[e],name:t,metadata:s,addInitializer:n=>r._?_("Already initialized"):i.push(w(n||null))}),ae=(e,t)=>ee(t,E("metadata"),e[3]),b=(e,t,r,s)=>{for(var i=0,n=e[t>>1],p=n&&n.length;i<p;i++)t&1?n[i].call(r):s=n[i].call(r,s);return s},q=(e,t,r,s,i,n)=>{var p,d,I,h,k,a=t&7,f=!!(t&8),l=!!(t&16),g=a>3?e.length+1:a?f?1:2:0,O=$[a+5],x=a>3&&(e[g-1]=[]),T=e[g]||(e[g]=[]),c=a&&(!l&&!f&&(i=i.prototype),a<5&&(a>3||!l)&&j(a<4?i:{get[r](){return N(this,n)},set[r](o){return M(this,n,o)}},r));a?l&&a<4&&U(n,(a>2?"set ":a>1?"get ":"")+r):U(i,r);for(var m=s.length-1;m>=0;m--)h=re(a,r,I={},e[3],T),a&&(h.static=f,h.private=l,k=h.access={has:l?o=>ie(i,o):o=>r in o},a^3&&(k.get=l?o=>(a^1?N:se)(o,i,a^4?n:c.get):o=>o[r]),a>2&&(k.set=l?(o,y)=>M(o,i,y,a^4?n:c.set):(o,y)=>o[r]=y)),d=(0,s[m])(a?a<4?l?n:c[O]:a>4?void 0:{get:c.get,set:c.set}:i,h),I._=1,a^4||d===void 0?w(d)&&(a>4?x.unshift(d):a?l?n=d:c[O]=d:i=d):typeof d!="object"||d===null?_("Object expected"):(w(p=d.get)&&(c.get=p),w(p=d.set)&&(c.set=p),w(p=d.init)&&x.unshift(p));return a||ae(e,i),c&&S(i,r,c),l?a^4?n:c:i},z=(e,t,r)=>t.has(e)||_("Cannot "+r),ie=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),N=(e,t,r)=>(z(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),M=(e,t,r,s)=>(z(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),se=(e,t,r)=>(z(e,t,"access private method"),r),D,A,F,v,C;F=[Y("user-ui-add-network")];class u extends(A=B,D=[V()],A){constructor(){super(...arguments),ne(this,C,b(v,8,this,!1)),b(v,11,this)}navigateBack(){P(W("/networks"))}async onSave(t){this.loading=!0;const{auth:r,adminAuth:s,serviceAccountAuth:i}=t.network;try{const n=await G();await(await H(await L.accessToken.get(n))).request({method:"addNetwork",params:{network:{id:t.network.id,name:t.network.name,description:t.network.description,identityProviderId:t.network.identityProviderId,...t.network.synchronizerId&&{synchronizerId:t.network.synchronizerId},ledgerApi:t.network.ledgerApi,auth:r,...s&&{adminAuth:s},...i&&{serviceAccountAuth:i}}}}),P(J("/networks/"))}catch(n){this.loading=!1,K(n)}}render(){return R`
1
+ import{r as V,s as P,V as W,d as G,c as H,a as L,x as J,f as K,z as Q,b as R,v as B,i as X,t as Y}from"./index-BAXYVraq.js";var Z=Object.create,S=Object.defineProperty,j=Object.getOwnPropertyDescriptor,E=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},ee=(e,t,r)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,U=(e,t)=>S(e,"name",{value:t,configurable:!0}),te=e=>[,,,Z(e?.[E("metadata")]??null)],$=["class","method","getter","setter","accessor","field","value","get","set"],w=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,re=(e,t,r,s,i)=>({kind:$[e],name:t,metadata:s,addInitializer:n=>r._?_("Already initialized"):i.push(w(n||null))}),ae=(e,t)=>ee(t,E("metadata"),e[3]),b=(e,t,r,s)=>{for(var i=0,n=e[t>>1],p=n&&n.length;i<p;i++)t&1?n[i].call(r):s=n[i].call(r,s);return s},q=(e,t,r,s,i,n)=>{var p,d,I,h,k,a=t&7,f=!!(t&8),l=!!(t&16),g=a>3?e.length+1:a?f?1:2:0,O=$[a+5],x=a>3&&(e[g-1]=[]),T=e[g]||(e[g]=[]),c=a&&(!l&&!f&&(i=i.prototype),a<5&&(a>3||!l)&&j(a<4?i:{get[r](){return N(this,n)},set[r](o){return M(this,n,o)}},r));a?l&&a<4&&U(n,(a>2?"set ":a>1?"get ":"")+r):U(i,r);for(var m=s.length-1;m>=0;m--)h=re(a,r,I={},e[3],T),a&&(h.static=f,h.private=l,k=h.access={has:l?o=>ie(i,o):o=>r in o},a^3&&(k.get=l?o=>(a^1?N:se)(o,i,a^4?n:c.get):o=>o[r]),a>2&&(k.set=l?(o,y)=>M(o,i,y,a^4?n:c.set):(o,y)=>o[r]=y)),d=(0,s[m])(a?a<4?l?n:c[O]:a>4?void 0:{get:c.get,set:c.set}:i,h),I._=1,a^4||d===void 0?w(d)&&(a>4?x.unshift(d):a?l?n=d:c[O]=d:i=d):typeof d!="object"||d===null?_("Object expected"):(w(p=d.get)&&(c.get=p),w(p=d.set)&&(c.set=p),w(p=d.init)&&x.unshift(p));return a||ae(e,i),c&&S(i,r,c),l?a^4?n:c:i},z=(e,t,r)=>t.has(e)||_("Cannot "+r),ie=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),N=(e,t,r)=>(z(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),M=(e,t,r,s)=>(z(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),se=(e,t,r)=>(z(e,t,"access private method"),r),D,A,F,v,C;F=[Y("user-ui-add-network")];class u extends(A=B,D=[V()],A){constructor(){super(...arguments),ne(this,C,b(v,8,this,!1)),b(v,11,this)}navigateBack(){P(W("/networks"))}async onSave(t){this.loading=!0;const{auth:r,adminAuth:s,serviceAccountAuth:i}=t.network;try{const n=await G();await(await H(await L.accessToken.get(n))).request({method:"addNetwork",params:{network:{id:t.network.id,name:t.network.name,description:t.network.description,identityProviderId:t.network.identityProviderId,...t.network.synchronizerId&&{synchronizerId:t.network.synchronizerId},ledgerApi:t.network.ledgerApi,auth:r,...s&&{adminAuth:s},...i&&{serviceAccountAuth:i}}}}),P(J("/networks/"))}catch(n){this.loading=!1,K(n)}}render(){return R`
2
2
  <div class="page-header">
3
3
  <h1 class="h4 fw-semibold mb-0">Add a new network</h1>
4
4
  <button
@@ -0,0 +1,13 @@
1
+ import{d as E,c as C,a as A,s as O,x as T,f as I,b as U,t as $}from"./index-BAXYVraq.js";import{S as P,W as l}from"./index-Dp1svjp8.js";import{U as x}from"./common-JTjsyB1o.js";var k=Object.create,g=Object.defineProperty,D=Object.getOwnPropertyDescriptor,h=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),b=r=>{throw TypeError(r)},K=(r,e,a)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,W=(r,e)=>g(r,"name",{value:e,configurable:!0}),z=r=>[,,,k(r?.[h("metadata")]??null)],M=["class","method","getter","setter","accessor","field","value","get","set"],S=r=>r!==void 0&&typeof r!="function"?b("Function expected"):r,N=(r,e,a,s,t)=>({kind:M[r],name:e,metadata:s,addInitializer:i=>a._?b("Already initialized"):t.push(S(i||null))}),F=(r,e)=>K(e,h("metadata"),r[3]),H=(r,e,a,s)=>{for(var t=0,i=r[e>>1],n=i&&i.length;t<n;t++)i[t].call(a);return s},R=(r,e,a,s,t,i)=>{var n,p,m,o=e&7,v=!1,y=0,L=r[y]||(r[y]=[]),d=o&&(t=t.prototype,o<5&&(o>3||!v)&&D(t,a));W(t,a);for(var c=s.length-1;c>=0;c--)m=N(o,a,p={},r[3],L),n=(0,s[c])(t,m),p._=1,S(n)&&(t=n);return F(r,t),d&&g(t,a,d),v?o^4?i:d:t},f,_,w;f=[$("user-ui-add-party")];class u extends(w=x){constructor(){super(...arguments),this.pageTitle="Create a new party"}get showToast(){return this.selectedSigningProvider===P.FIREBLOCKS}async onCreateParty(e){this.submitting=!0;try{const a=await E(),t=await(await C(await A.accessToken.get(a))).request({method:"createWallet",params:{primary:e.primary,partyHint:e.partyHint,signingProviderId:e.signingProviderId,...e.keyName&&{keyName:e.keyName}}}),n={allocated:l.WALLET_ALLOCATED,initialized:l.WALLET_INITIALIZED,removed:l.WALLET_REMOVED}[t.wallet.status];O(`${T("/parties/")}?createPartyStatus=${n}`)}catch(a){this.submitting=!1,I(a)}}get form(){return U`
2
+ <wg-wallet-create-form
3
+ .signingProviders=${this.signingProviders}
4
+ .keySigningProviders=${[P.FIREBLOCKS]}
5
+ .selectedSigningProvider=${this.selectedSigningProvider}
6
+ .publicKeys=${this.publicKeys}
7
+ .submitLabel=${"Create party"}
8
+ ?submitting=${this.submitting}
9
+ ?publicKeysLoading=${this.publicKeysLoading}
10
+ @wallet-create=${this.onCreateParty}
11
+ @signing-provider-change=${this.onSigningProviderChange}
12
+ ></wg-wallet-create-form>
13
+ `}}_=z(w);u=R(_,0,"UserUiAddParty",f,u);H(_,1,u);
@@ -1,4 +1,4 @@
1
- import{o as m,e as i,l as A,g as z,u as Pt,h as ht,j as pt,k as st,n as ut,r as u,s as Dt,V as at,A as it,d as W,c as $,a as O,m as S,f as nt,b as rt,v as zt,t as Ht}from"./index-BhzcMGYw.js";import{p as Ut}from"./index-BjhQnXf1.js";const _t=m({method:A("authorization_code"),audience:i(),scope:i(),clientId:i()}).meta({description:"Authorization code flow authentication configuration. This is used for browser-based application login."}),Rt=m({method:A("client_credentials"),audience:i(),scope:i(),clientId:i(),clientSecret:i()}),jt=m({method:A("self_signed"),issuer:i(),audience:i(),scope:i(),clientId:i(),clientSecret:i()}),qt=m({method:A("client_credentials"),audience:i(),scope:i(),clientId:i(),clientSecretEnv:i()}),Gt=m({method:A("self_signed"),issuer:i(),audience:i(),scope:i(),clientId:i(),clientSecretEnv:i()}),P=z("method",[_t,Rt,jt]);z("method",[_t,qt,Gt]);const Lt=z("type",[m({id:i(),type:A("self_signed"),issuer:i()}),m({id:i(),type:A("oauth"),issuer:i(),configUrl:i().url()})]);let ct=(function(t){return t.CanActAs="CanActAs",t.CanReadAs="CanReadAs",t.CanExecuteAs="CanExecuteAs",t})({});const Ft=m({baseUrl:Pt()}),Vt=m({id:i(),name:i(),description:i(),synchronizerId:i().includes("::").min(10).optional(),identityProviderId:i(),ledgerApi:Ft,auth:P,adminAuth:P.optional(),serviceAccountAuth:P.optional()}),Bt=ht({type:A("postgres"),host:i(),port:ut(),user:i(),password:i(),database:i()}),Nt=ht({type:A("postgres"),host:i(),port:ut(),user:i(),passwordEnv:i(),database:i()}),Jt=pt([Bt,Nt]);m({connection:pt([m({type:A("memory")}),m({type:A("sqlite"),database:i()}),Jt])});m({idps:st(Lt),networks:st(Vt)});var Kt=Object.create,H=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,gt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),I=t=>{throw TypeError(t)},Xt=(t,e,a)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,ot=(t,e)=>H(t,"name",{value:e,configurable:!0}),Yt=t=>[,,,Kt(t?.[gt("metadata")]??null)],mt=["class","method","getter","setter","accessor","field","value","get","set"],b=t=>t!==void 0&&typeof t!="function"?I("Function expected"):t,Zt=(t,e,a,c,o)=>({kind:mt[t],name:e,metadata:c,addInitializer:d=>a._?I("Already initialized"):o.push(b(d||null))}),te=(t,e)=>Xt(e,gt("metadata"),t[3]),n=(t,e,a,c)=>{for(var o=0,d=t[e>>1],v=d&&d.length;o<v;o++)e&1?d[o].call(a):c=d[o].call(a,c);return c},h=(t,e,a,c,o,d)=>{var v,p,y,C,k,r=e&7,x=!!(e&8),f=!!(e&16),M=r>3?t.length+1:r?x?1:2:0,tt=mt[r+5],et=r>3&&(t[M-1]=[]),Ot=t[M]||(t[M]=[]),w=r&&(!f&&!x&&(o=o.prototype),r<5&&(r>3||!f)&&Qt(r<4?o:{get[a](){return dt(this,d)},set[a](g){return lt(this,d,g)}},a));r?f&&r<4&&ot(d,(r>2?"set ":r>1?"get ":"")+a):ot(o,a);for(var E=c.length-1;E>=0;E--)C=Zt(r,a,y={},t[3],Ot),r&&(C.static=x,C.private=f,k=C.access={has:f?g=>ee(o,g):g=>a in g},r^3&&(k.get=f?g=>(r^1?dt:se)(g,o,r^4?d:w.get):g=>g[a]),r>2&&(k.set=f?(g,T)=>lt(g,o,T,r^4?d:w.set):(g,T)=>g[a]=T)),p=(0,c[E])(r?r<4?f?d:w[tt]:r>4?void 0:{get:w.get,set:w.set}:o,C),y._=1,r^4||p===void 0?b(p)&&(r>4?et.unshift(p):r?f?d=p:w[tt]=p:o=p):typeof p!="object"||p===null?I("Object expected"):(b(v=p.get)&&(w.get=v),b(v=p.set)&&(w.set=v),b(v=p.init)&&et.unshift(v));return r||te(t,o),w&&H(o,a,w),f?r^4?d:w:o},U=(t,e,a)=>e.has(t)||I("Cannot "+a),ee=(t,e)=>Object(e)!==e?I('Cannot use the "in" operator on this value'):t.has(e),dt=(t,e,a)=>(U(t,e,"read from private field"),a?a.call(t):e.get(t)),_=(t,e,a)=>e.has(t)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),lt=(t,e,a,c)=>(U(t,e,"write to private field"),c?c.call(t,a):e.set(t,a),a),se=(t,e,a)=>(U(t,e,"access private method"),a),vt,wt,At,ft,yt,It,Ct,St,bt,kt,xt,Mt,Et,Tt,Wt,D,$t,s,R,j,q,G,L,F,V,B,N,J,K,Q,X,Y,Z;$t=[Ht("user-ui-approve")];class l extends(D=zt,Wt=[u()],Tt=[u()],Et=[u()],Mt=[u()],xt=[u()],kt=[u()],bt=[u()],St=[u()],Ct=[u()],It=[u()],yt=[u()],ft=[u()],At=[u()],wt=[u()],vt=[u()],D){constructor(){super(...arguments),_(this,R,n(s,8,this,!1)),n(s,11,this),_(this,j,n(s,12,this,!1)),n(s,15,this),_(this,q,n(s,16,this,!1)),n(s,19,this),_(this,G,n(s,20,this,"")),n(s,23,this),_(this,L,n(s,24,this,"")),n(s,27,this),_(this,F,n(s,28,this,"")),n(s,31,this),_(this,V,n(s,32,this,"")),n(s,35,this),_(this,B,n(s,36,this,"")),n(s,39,this),_(this,N,n(s,40,this,null)),n(s,43,this),_(this,J,n(s,44,this,"")),n(s,47,this),_(this,K,n(s,48,this,null)),n(s,51,this),_(this,Q,n(s,52,this,null)),n(s,55,this),_(this,X,n(s,56,this,null)),n(s,59,this),_(this,Y,n(s,60,this,!0)),n(s,63,this),_(this,Z,n(s,64,this,null)),n(s,67,this)}connectedCallback(){super.connectedCallback();const e=new URL(window.location.href);this.transactionId=e.searchParams.get("transactionId")||"",this.updateState()}closeOrGoToList(){this.disabled=!0;const a=new URLSearchParams(window.location.search).has("closeafteraction");setTimeout(()=>{a&&window.opener?window.close():Dt(at(it))},2e3)}async updateState(){const e=await W(),a=await $(await O.accessToken.get(e)),c=await a.request({method:"getTransaction",params:{transactionId:this.transactionId}});this.transactionId=c.id,this.commandId=c.commandId,this.txHash=c.preparedTransactionHash,this.tx=c.preparedTransaction,this.status=c.status,this.createdAt=c.createdAt||null,this.signedAt=c.signedAt||null,this.origin=c.origin||null;try{this.txParsed=Ut(this.tx)}catch(y){console.error("Error parsing prepared transaction:",y),this.txParsed=null}const d=(await a.request({method:"listWallets",params:{}})).find(y=>y.primary===!0);this.partyId=d?.partyId||"";const v=d?.rights,p=!!(v?.includes(ct.CanActAs)||v?.includes(ct.CanExecuteAs));this.canSubmit=p,this.walletCapabilityMessage=p?null:"The selected wallet is read-only for submission (no CanActAs/CanExecuteAs right)."}async handleReject(){if(confirm(`Reject pending activity "${this.commandId}"?`)){this.isDeleting=!0;try{const e=await W();await(await $(await O.accessToken.get(e))).request({method:"deleteTransaction",params:{transactionId:this.transactionId}}),S("","Activity rejected successfully","success"),this.closeOrGoToList()}catch(e){console.error(e),nt(e,{message:"Error rejecting activity"})}finally{this.isDeleting=!1}}}async handleApprove(){if(!this.canSubmit){S("Read-only wallet","This wallet can read but cannot submit transactions. Switch to a wallet with CanActAs or CanExecuteAs.","error");return}this.isApproving=!0;try{const e=await W(),a=await $(await O.accessToken.get(e)),c=await a.request({method:"sign",params:{transactionId:this.transactionId,partyId:this.partyId}});if(c.status==="pending"){S("Activity pending","Complete signing in your external provider, then click Approve to finish.","info"),await this.updateState();return}if(c.status==="signed"){await a.request({method:"execute",params:{signature:c.signature,signedBy:c.signedBy,transactionId:this.transactionId,partyId:this.partyId}}),S("","Activity executed successfully","success"),this.closeOrGoToList();return}const o=c.status==="rejected"?"Activity was rejected":"Activity failed";S("",o,"error"),await this.updateState()}catch(e){console.error(e),nt(e,{message:"Error executing activity"})}finally{this.isApproving=!1}}render(){return rt`
1
+ import{o as m,e as i,l as A,g as z,u as Pt,h as ht,j as pt,k as st,n as ut,r as u,s as Dt,V as at,A as it,d as W,c as $,a as O,m as S,f as nt,b as rt,v as zt,t as Ht}from"./index-BAXYVraq.js";import{p as Ut}from"./index-Cvcr2Fng.js";const _t=m({method:A("authorization_code"),audience:i(),scope:i(),clientId:i()}).meta({description:"Authorization code flow authentication configuration. This is used for browser-based application login."}),Rt=m({method:A("client_credentials"),audience:i(),scope:i(),clientId:i(),clientSecret:i()}),jt=m({method:A("self_signed"),issuer:i(),audience:i(),scope:i(),clientId:i(),clientSecret:i()}),qt=m({method:A("client_credentials"),audience:i(),scope:i(),clientId:i(),clientSecretEnv:i()}),Gt=m({method:A("self_signed"),issuer:i(),audience:i(),scope:i(),clientId:i(),clientSecretEnv:i()}),P=z("method",[_t,Rt,jt]);z("method",[_t,qt,Gt]);const Lt=z("type",[m({id:i(),type:A("self_signed"),issuer:i()}),m({id:i(),type:A("oauth"),issuer:i(),configUrl:i().url()})]);let ct=(function(t){return t.CanActAs="CanActAs",t.CanReadAs="CanReadAs",t.CanExecuteAs="CanExecuteAs",t})({});const Ft=m({baseUrl:Pt()}),Vt=m({id:i(),name:i(),description:i(),synchronizerId:i().includes("::").min(10).optional(),identityProviderId:i(),ledgerApi:Ft,auth:P,adminAuth:P.optional(),serviceAccountAuth:P.optional()}),Bt=ht({type:A("postgres"),host:i(),port:ut(),user:i(),password:i(),database:i()}),Nt=ht({type:A("postgres"),host:i(),port:ut(),user:i(),passwordEnv:i(),database:i()}),Jt=pt([Bt,Nt]);m({connection:pt([m({type:A("memory")}),m({type:A("sqlite"),database:i()}),Jt])});m({idps:st(Lt),networks:st(Vt)});var Kt=Object.create,H=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,gt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),I=t=>{throw TypeError(t)},Xt=(t,e,a)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,ot=(t,e)=>H(t,"name",{value:e,configurable:!0}),Yt=t=>[,,,Kt(t?.[gt("metadata")]??null)],mt=["class","method","getter","setter","accessor","field","value","get","set"],b=t=>t!==void 0&&typeof t!="function"?I("Function expected"):t,Zt=(t,e,a,c,o)=>({kind:mt[t],name:e,metadata:c,addInitializer:d=>a._?I("Already initialized"):o.push(b(d||null))}),te=(t,e)=>Xt(e,gt("metadata"),t[3]),n=(t,e,a,c)=>{for(var o=0,d=t[e>>1],v=d&&d.length;o<v;o++)e&1?d[o].call(a):c=d[o].call(a,c);return c},h=(t,e,a,c,o,d)=>{var v,p,y,C,k,r=e&7,x=!!(e&8),f=!!(e&16),M=r>3?t.length+1:r?x?1:2:0,tt=mt[r+5],et=r>3&&(t[M-1]=[]),Ot=t[M]||(t[M]=[]),w=r&&(!f&&!x&&(o=o.prototype),r<5&&(r>3||!f)&&Qt(r<4?o:{get[a](){return dt(this,d)},set[a](g){return lt(this,d,g)}},a));r?f&&r<4&&ot(d,(r>2?"set ":r>1?"get ":"")+a):ot(o,a);for(var E=c.length-1;E>=0;E--)C=Zt(r,a,y={},t[3],Ot),r&&(C.static=x,C.private=f,k=C.access={has:f?g=>ee(o,g):g=>a in g},r^3&&(k.get=f?g=>(r^1?dt:se)(g,o,r^4?d:w.get):g=>g[a]),r>2&&(k.set=f?(g,T)=>lt(g,o,T,r^4?d:w.set):(g,T)=>g[a]=T)),p=(0,c[E])(r?r<4?f?d:w[tt]:r>4?void 0:{get:w.get,set:w.set}:o,C),y._=1,r^4||p===void 0?b(p)&&(r>4?et.unshift(p):r?f?d=p:w[tt]=p:o=p):typeof p!="object"||p===null?I("Object expected"):(b(v=p.get)&&(w.get=v),b(v=p.set)&&(w.set=v),b(v=p.init)&&et.unshift(v));return r||te(t,o),w&&H(o,a,w),f?r^4?d:w:o},U=(t,e,a)=>e.has(t)||I("Cannot "+a),ee=(t,e)=>Object(e)!==e?I('Cannot use the "in" operator on this value'):t.has(e),dt=(t,e,a)=>(U(t,e,"read from private field"),a?a.call(t):e.get(t)),_=(t,e,a)=>e.has(t)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),lt=(t,e,a,c)=>(U(t,e,"write to private field"),c?c.call(t,a):e.set(t,a),a),se=(t,e,a)=>(U(t,e,"access private method"),a),vt,wt,At,ft,yt,It,Ct,St,bt,kt,xt,Mt,Et,Tt,Wt,D,$t,s,R,j,q,G,L,F,V,B,N,J,K,Q,X,Y,Z;$t=[Ht("user-ui-approve")];class l extends(D=zt,Wt=[u()],Tt=[u()],Et=[u()],Mt=[u()],xt=[u()],kt=[u()],bt=[u()],St=[u()],Ct=[u()],It=[u()],yt=[u()],ft=[u()],At=[u()],wt=[u()],vt=[u()],D){constructor(){super(...arguments),_(this,R,n(s,8,this,!1)),n(s,11,this),_(this,j,n(s,12,this,!1)),n(s,15,this),_(this,q,n(s,16,this,!1)),n(s,19,this),_(this,G,n(s,20,this,"")),n(s,23,this),_(this,L,n(s,24,this,"")),n(s,27,this),_(this,F,n(s,28,this,"")),n(s,31,this),_(this,V,n(s,32,this,"")),n(s,35,this),_(this,B,n(s,36,this,"")),n(s,39,this),_(this,N,n(s,40,this,null)),n(s,43,this),_(this,J,n(s,44,this,"")),n(s,47,this),_(this,K,n(s,48,this,null)),n(s,51,this),_(this,Q,n(s,52,this,null)),n(s,55,this),_(this,X,n(s,56,this,null)),n(s,59,this),_(this,Y,n(s,60,this,!0)),n(s,63,this),_(this,Z,n(s,64,this,null)),n(s,67,this)}connectedCallback(){super.connectedCallback();const e=new URL(window.location.href);this.transactionId=e.searchParams.get("transactionId")||"",this.updateState()}closeOrGoToList(){this.disabled=!0;const a=new URLSearchParams(window.location.search).has("closeafteraction");setTimeout(()=>{a&&window.opener?window.close():Dt(at(it))},2e3)}async updateState(){const e=await W(),a=await $(await O.accessToken.get(e)),c=await a.request({method:"getTransaction",params:{transactionId:this.transactionId}});this.transactionId=c.id,this.commandId=c.commandId,this.txHash=c.preparedTransactionHash,this.tx=c.preparedTransaction,this.status=c.status,this.createdAt=c.createdAt||null,this.signedAt=c.signedAt||null,this.origin=c.origin||null;try{this.txParsed=Ut(this.tx)}catch(y){console.error("Error parsing prepared transaction:",y),this.txParsed=null}const d=(await a.request({method:"listWallets",params:{}})).find(y=>y.primary===!0);this.partyId=d?.partyId||"";const v=d?.rights,p=!!(v?.includes(ct.CanActAs)||v?.includes(ct.CanExecuteAs));this.canSubmit=p,this.walletCapabilityMessage=p?null:"The selected wallet is read-only for submission (no CanActAs/CanExecuteAs right)."}async handleReject(){if(confirm(`Reject pending activity "${this.commandId}"?`)){this.isDeleting=!0;try{const e=await W();await(await $(await O.accessToken.get(e))).request({method:"deleteTransaction",params:{transactionId:this.transactionId}}),S("","Activity rejected successfully","success"),this.closeOrGoToList()}catch(e){console.error(e),nt(e,{message:"Error rejecting activity"})}finally{this.isDeleting=!1}}}async handleApprove(){if(!this.canSubmit){S("Read-only wallet","This wallet can read but cannot submit transactions. Switch to a wallet with CanActAs or CanExecuteAs.","error");return}this.isApproving=!0;try{const e=await W(),a=await $(await O.accessToken.get(e)),c=await a.request({method:"sign",params:{transactionId:this.transactionId,partyId:this.partyId}});if(c.status==="pending"){S("Activity pending","Complete signing in your external provider, then click Approve to finish.","info"),await this.updateState();return}if(c.status==="signed"){await a.request({method:"execute",params:{signature:c.signature,signedBy:c.signedBy,transactionId:this.transactionId,partyId:this.partyId}}),S("","Activity executed successfully","success"),this.closeOrGoToList();return}const o=c.status==="rejected"?"Activity was rejected":"Activity failed";S("",o,"error"),await this.updateState()}catch(e){console.error(e),nt(e,{message:"Error executing activity"})}finally{this.isApproving=!1}}render(){return rt`
2
2
  ${this.walletCapabilityMessage?rt`<div class="alert alert-warning" role="alert">
3
3
  ${this.walletCapabilityMessage}
4
4
  </div>`:""}
@@ -1,4 +1,4 @@
1
- import{r as V,V as W,d as F,a as E,p as J,q,f as H,L as K,b as z,w as B,t as Q}from"./index-BhzcMGYw.js";var X=Object.create,y=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,T=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),u=e=>{throw TypeError(e)},Z=(e,t,r)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>y(e,"name",{value:t,configurable:!0}),j=e=>[,,,X(e?.[T("metadata")]??null)],U=["class","method","getter","setter","accessor","field","value","get","set"],f=e=>e!==void 0&&typeof e!="function"?u("Function expected"):e,ee=(e,t,r,i,o)=>({kind:U[e],name:t,metadata:i,addInitializer:n=>r._?u("Already initialized"):o.push(f(n||null))}),te=(e,t)=>Z(t,T("metadata"),e[3]),b=(e,t,r,i)=>{for(var o=0,n=e[t>>1],_=n&&n.length;o<_;o++)t&1?n[o].call(r):i=n[o].call(r,i);return i},x=(e,t,r,i,o,n)=>{var _,s,v,h,w,a=t&7,p=!!(t&8),d=!!(t&16),S=a>3?e.length+1:a?p?1:2:0,L=U[a+5],R=a>3&&(e[S-1]=[]),G=e[S]||(e[S]=[]),l=a&&(!d&&!p&&(o=o.prototype),a<5&&(a>3||!d)&&Y(a<4?o:{get[r](){return D(this,n)},set[r](c){return M(this,n,c)}},r));a?d&&a<4&&A(n,(a>2?"set ":a>1?"get ":"")+r):A(o,r);for(var O=i.length-1;O>=0;O--)h=ee(a,r,v={},e[3],G),a&&(h.static=p,h.private=d,w=h.access={has:d?c=>re(o,c):c=>r in c},a^3&&(w.get=d?c=>(a^1?D:oe)(c,o,a^4?n:l.get):c=>c[r]),a>2&&(w.set=d?(c,C)=>M(c,o,C,a^4?n:l.set):(c,C)=>c[r]=C)),s=(0,i[O])(a?a<4?d?n:l[L]:a>4?void 0:{get:l.get,set:l.set}:o,h),v._=1,a^4||s===void 0?f(s)&&(a>4?R.unshift(s):a?d?n=s:l[L]=s:o=s):typeof s!="object"||s===null?u("Object expected"):(f(_=s.get)&&(l.get=_),f(_=s.set)&&(l.set=_),f(_=s.init)&&R.unshift(_));return a||te(e,o),l&&y(o,r,l),d?a^4?n:l:o},P=(e,t,r)=>t.has(e)||u("Cannot "+r),re=(e,t)=>Object(t)!==t?u('Cannot use the "in" operator on this value'):e.has(t),D=(e,t,r)=>(P(e,t,"read from private field"),r?r.call(e):t.get(e)),ae=(e,t,r)=>t.has(e)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),M=(e,t,r,i)=>(P(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),oe=(e,t,r)=>(P(e,t,"access private method"),r),N,I,$,g,m;$=[Q("login-callback")];class k extends(I=B,N=[V()],I){constructor(){super(...arguments),ae(this,m,b(g,8,this,!1)),b(g,11,this)}connectedCallback(){super.connectedCallback(),this.handleRedirect()}async handleRedirect(){try{const t=new URL(window.location.href),r=t.searchParams.get("code"),i=t.searchParams.get("state");if(!r||!i)throw new Error("Missing state or code in OAuth callback");const o=JSON.parse(atob(i)),n=sessionStorage.getItem(`oauth-pkce-${o.stateId}`);if(!n)throw new Error("Missing PKCE verifier for OAuth callback state");sessionStorage.removeItem(`oauth-pkce-${o.stateId}`);const v=(await(await fetch(o.configUrl)).json()).token_endpoint,h=new URL(W("/callback"),window.location.origin).toString(),a=await(await fetch(v,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:r,redirect_uri:h,client_id:o.clientId,audience:o.audience,code_verifier:n})})).json();if(!a.access_token)throw new Error("OAuth token response has no access token");const p=await F(),d=JSON.parse(atob(a.access_token.split(".")[1]));E.expirationDate.set(new Date(d.exp*1e3).toISOString(),p),await E.accessToken.set(a.access_token,p),await J(a.access_token,E.networkId.get(p)||""),await q()}catch(t){this.hasError=!0,H(t)}}render(){return this.hasError?z`<wg-error-page
1
+ import{r as V,V as W,d as F,a as E,p as J,q,f as H,L as K,b as z,w as B,t as Q}from"./index-BAXYVraq.js";var X=Object.create,y=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,T=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),u=e=>{throw TypeError(e)},Z=(e,t,r)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>y(e,"name",{value:t,configurable:!0}),j=e=>[,,,X(e?.[T("metadata")]??null)],U=["class","method","getter","setter","accessor","field","value","get","set"],f=e=>e!==void 0&&typeof e!="function"?u("Function expected"):e,ee=(e,t,r,i,o)=>({kind:U[e],name:t,metadata:i,addInitializer:n=>r._?u("Already initialized"):o.push(f(n||null))}),te=(e,t)=>Z(t,T("metadata"),e[3]),b=(e,t,r,i)=>{for(var o=0,n=e[t>>1],_=n&&n.length;o<_;o++)t&1?n[o].call(r):i=n[o].call(r,i);return i},x=(e,t,r,i,o,n)=>{var _,s,v,h,w,a=t&7,p=!!(t&8),d=!!(t&16),S=a>3?e.length+1:a?p?1:2:0,L=U[a+5],R=a>3&&(e[S-1]=[]),G=e[S]||(e[S]=[]),l=a&&(!d&&!p&&(o=o.prototype),a<5&&(a>3||!d)&&Y(a<4?o:{get[r](){return D(this,n)},set[r](c){return M(this,n,c)}},r));a?d&&a<4&&A(n,(a>2?"set ":a>1?"get ":"")+r):A(o,r);for(var O=i.length-1;O>=0;O--)h=ee(a,r,v={},e[3],G),a&&(h.static=p,h.private=d,w=h.access={has:d?c=>re(o,c):c=>r in c},a^3&&(w.get=d?c=>(a^1?D:oe)(c,o,a^4?n:l.get):c=>c[r]),a>2&&(w.set=d?(c,C)=>M(c,o,C,a^4?n:l.set):(c,C)=>c[r]=C)),s=(0,i[O])(a?a<4?d?n:l[L]:a>4?void 0:{get:l.get,set:l.set}:o,h),v._=1,a^4||s===void 0?f(s)&&(a>4?R.unshift(s):a?d?n=s:l[L]=s:o=s):typeof s!="object"||s===null?u("Object expected"):(f(_=s.get)&&(l.get=_),f(_=s.set)&&(l.set=_),f(_=s.init)&&R.unshift(_));return a||te(e,o),l&&y(o,r,l),d?a^4?n:l:o},P=(e,t,r)=>t.has(e)||u("Cannot "+r),re=(e,t)=>Object(t)!==t?u('Cannot use the "in" operator on this value'):e.has(t),D=(e,t,r)=>(P(e,t,"read from private field"),r?r.call(e):t.get(e)),ae=(e,t,r)=>t.has(e)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),M=(e,t,r,i)=>(P(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),oe=(e,t,r)=>(P(e,t,"access private method"),r),N,I,$,g,m;$=[Q("login-callback")];class k extends(I=B,N=[V()],I){constructor(){super(...arguments),ae(this,m,b(g,8,this,!1)),b(g,11,this)}connectedCallback(){super.connectedCallback(),this.handleRedirect()}async handleRedirect(){try{const t=new URL(window.location.href),r=t.searchParams.get("code"),i=t.searchParams.get("state");if(!r||!i)throw new Error("Missing state or code in OAuth callback");const o=JSON.parse(atob(i)),n=sessionStorage.getItem(`oauth-pkce-${o.stateId}`);if(!n)throw new Error("Missing PKCE verifier for OAuth callback state");sessionStorage.removeItem(`oauth-pkce-${o.stateId}`);const v=(await(await fetch(o.configUrl)).json()).token_endpoint,h=new URL(W("/callback"),window.location.origin).toString(),a=await(await fetch(v,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:r,redirect_uri:h,client_id:o.clientId,audience:o.audience,code_verifier:n})})).json();if(!a.access_token)throw new Error("OAuth token response has no access token");const p=await F(),d=JSON.parse(atob(a.access_token.split(".")[1]));E.expirationDate.set(new Date(d.exp*1e3).toISOString(),p),await E.accessToken.set(a.access_token,p),await J(a.access_token,E.networkId.get(p)||""),await q()}catch(t){this.hasError=!0,H(t)}}render(){return this.hasError?z`<wg-error-page
2
2
  title="Login failed"
3
3
  message="We could not complete your login. Return to network selection and try again."
4
4
  .backHref=${K}
@@ -0,0 +1,31 @@
1
+ import{r as u,s as V,V as G,d as H,c as R,a as J,m as Q,f as X,z as Y,b as Z,v as z,i as ee}from"./index-BAXYVraq.js";import{S as T}from"./index-Dp1svjp8.js";var te=Object.create,I=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,L=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},ae=(e,t,i)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,re=e=>[,,,te(e?.[L("metadata")]??null)],M=["class","method","getter","setter","accessor","field","value","get","set"],h=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,se=(e,t,i,s,a)=>({kind:M[e],name:t,metadata:s,addInitializer:n=>i._?_("Already initialized"):a.push(h(n||null))}),ne=(e,t)=>ae(t,L("metadata"),e[3]),d=(e,t,i,s)=>{for(var a=0,n=e[t>>1],o=n&&n.length;a<o;a++)t&1?n[a].call(i):s=n[a].call(i,s);return s},y=(e,t,i,s,a,n)=>{for(var o,c,C,v,b,O=t&7,$=!1,B=!1,w=e.length+1,j=M[O+5],q=e[w-1]=[],D=e[w]||(e[w]=[]),l=(a=a.prototype,ie({get[i](){return oe(this,n)},set[i](g){return ce(this,n,g)}},i)),m=s.length-1;m>=0;m--)v=se(O,i,C={},e[3],D),v.static=$,v.private=B,b=v.access={has:g=>i in g},b.get=g=>g[i],b.set=(g,F)=>g[i]=F,c=(0,s[m])({get:l.get,set:l.set},v),C._=1,c===void 0?h(c)&&(l[j]=c):typeof c!="object"||c===null?_("Object expected"):(h(o=c.get)&&(l.get=o),h(o=c.set)&&(l.set=o),h(o=c.init)&&q.unshift(o));return l&&I(a,i,l),a},A=(e,t,i)=>t.has(e)||_("Cannot "+i),oe=(e,t,i)=>(A(e,t,"read from private field"),t.get(e)),f=(e,t,i)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ce=(e,t,i,s)=>(A(e,t,"write to private field"),t.set(e,i),i),W,E,N,U,P,r,k,S,K,x;class p extends(P=z,U=[u()],N=[u()],E=[u()],W=[u()],P){constructor(){super(...arguments),this.signingProviders=Object.values(T),f(this,k,d(r,8,this,!1)),d(r,11,this),f(this,S,d(r,12,this,[])),d(r,15,this),f(this,K,d(r,16,this,!1)),d(r,19,this),f(this,x,d(r,20,this,"")),d(r,23,this)}navigateBack(){V(G("/parties"))}async getSigningProviderKeys(t){this.publicKeysLoading=!0;const i=await H();try{const s=await R(await J.accessToken.get(i)),{keys:a}=await s.request({method:"listSigningProviderKeys",params:{signingProviderId:t}});this.publicKeys=a.sort((n,o)=>n.name.localeCompare(o.name)),a.length===0&&this.showToast&&Q("No public keys found","No public keys are available for the selected signing provider.","info")}catch(s){X(s)}finally{this.publicKeysLoading=!1}}async onSigningProviderChange(t){this.publicKeys=[];const{signingProviderId:i}=t;this.selectedSigningProvider=i,i!==T.PARTICIPANT&&await this.getSigningProviderKeys(i)}render(){return Z`
2
+ <div class="page-header">
3
+ <h1 class="h4 fw-semibold mb-0">${this.pageTitle}</h1>
4
+ <button
5
+ class="btn btn-link btn-sm text-body text-decoration-none p-0 d-inline-flex align-items-center gap-1"
6
+ type="button"
7
+ @click=${this.navigateBack}
8
+ >
9
+ ${Y}
10
+ <span>Back</span>
11
+ </button>
12
+ </div>
13
+
14
+ <div class="form-wrap">${this.form}</div>
15
+ `}}r=re(P);k=new WeakMap;S=new WeakMap;K=new WeakMap;x=new WeakMap;y(r,4,"submitting",U,p,k);y(r,4,"publicKeys",N,p,S);y(r,4,"publicKeysLoading",E,p,K);y(r,4,"selectedSigningProvider",W,p,x);ne(r,p);p.styles=[z.styles,ee`
16
+ :host {
17
+ display: block;
18
+ }
19
+
20
+ .page-header {
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: space-between;
24
+ margin-bottom: var(--wg-space-4);
25
+ gap: var(--wg-space-3);
26
+ }
27
+
28
+ .form-wrap {
29
+ width: 100%;
30
+ }
31
+ `];export{p as U};
@@ -0,0 +1,14 @@
1
+ import{r as C,d as H,c as J,a as Q,s as V,x as X,f as Y,b as Z,t as j}from"./index-BAXYVraq.js";import{S as W,W as ee}from"./index-Dp1svjp8.js";import{U as te}from"./common-JTjsyB1o.js";var ie=Object.create,K=Object.defineProperty,re=Object.getOwnPropertyDescriptor,q=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_=e=>{throw TypeError(e)},se=(e,t,i)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,M=(e,t)=>K(e,"name",{value:t,configurable:!0}),ae=e=>[,,,ie(e?.[q("metadata")]??null)],N=["class","method","getter","setter","accessor","field","value","get","set"],y=e=>e!==void 0&&typeof e!="function"?_("Function expected"):e,ne=(e,t,i,l,s)=>({kind:N[e],name:t,metadata:l,addInitializer:a=>i._?_("Already initialized"):s.push(y(a||null))}),de=(e,t)=>se(t,q("metadata"),e[3]),p=(e,t,i,l)=>{for(var s=0,a=e[t>>1],u=a&&a.length;s<u;s++)t&1?a[s].call(i):l=a[s].call(i,l);return l},P=(e,t,i,l,s,a)=>{var u,d,k,v,w,r=t&7,f=!!(t&8),h=!!(t&16),I=r>3?e.length+1:r?f?1:2:0,A=N[r+5],L=r>3&&(e[I-1]=[]),G=e[I]||(e[I]=[]),c=r&&(!h&&!f&&(s=s.prototype),r<5&&(r>3||!h)&&re(r<4?s:{get[i](){return z(this,a)},set[i](n){return D(this,a,n)}},i));r?h&&r<4&&M(a,(r>2?"set ":r>1?"get ":"")+i):M(s,i);for(var b=l.length-1;b>=0;b--)v=ne(r,i,k={},e[3],G),r&&(v.static=f,v.private=h,w=v.access={has:h?n=>oe(s,n):n=>i in n},r^3&&(w.get=h?n=>(r^1?z:le)(n,s,r^4?a:c.get):n=>n[i]),r>2&&(w.set=h?(n,S)=>D(n,s,S,r^4?a:c.set):(n,S)=>n[i]=S)),d=(0,l[b])(r?r<4?h?a:c[A]:r>4?void 0:{get:c.get,set:c.set}:s,v),k._=1,r^4||d===void 0?y(d)&&(r>4?L.unshift(d):r?h?a=d:c[A]=d:s=d):typeof d!="object"||d===null?_("Object expected"):(y(u=d.get)&&(c.get=u),y(u=d.set)&&(c.set=u),y(u=d.init)&&L.unshift(u));return r||de(e,s),c&&K(s,i,c),h?r^4?a:c:s},T=(e,t,i)=>t.has(e)||_("Cannot "+i),oe=(e,t)=>Object(t)!==t?_('Cannot use the "in" operator on this value'):e.has(t),z=(e,t,i)=>(T(e,t,"read from private field"),i?i.call(e):t.get(e)),m=(e,t,i)=>t.has(e)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),D=(e,t,i,l)=>(T(e,t,"write to private field"),l?l.call(e,i):t.set(e,i),i),le=(e,t,i)=>(T(e,t,"access private method"),i),R,F,x,E,B,o,U,$,O;B=[j("user-ui-edit-party")];class g extends(E=te,x=[C()],F=[C()],R=[C()],E){constructor(){super(...arguments),m(this,U,p(o,8,this)),p(o,11,this),m(this,$,p(o,12,this)),p(o,15,this),m(this,O,p(o,16,this,"")),p(o,19,this),this.pageTitle="Edit party",this.showToast=!0}get partyId(){const t=new URLSearchParams(window.location.search).get("partyId");if(!t)throw new Error("partyId query param must be provided");return t}get loaded(){return!!this.userClient}async connectedCallback(){super.connectedCallback();const t=await H();this.userClient=await J(await Q.accessToken.get(t));const i=await this.userClient.request({method:"getWallet",params:{partyId:this.partyId}});if(!i)throw new Error("wallet not found");this.wallet=i,this.selectedSigningProvider=this.wallet.signingProviderId,this.selectedPublicKey=this.wallet.publicKey,this.selectedSigningProvider!==W.PARTICIPANT&&await this.getSigningProviderKeys(this.wallet.signingProviderId)}async onEditParty(t){if(this.loaded){this.submitting=!0;try{await this.userClient.request({method:"changeSigningProvider",params:{signingProviderId:t.signingProviderId,partyId:t.partyId,publicKey:t.publicKey}}),V(`${X("/parties/")}?createPartyStatus=${ee.WALLET_EDITED}`)}catch(i){this.submitting=!1,Y(i)}}}get form(){return Z`
2
+ <wg-wallet-edit-form
3
+ .signingProviders=${this.signingProviders}
4
+ .disabledSigningProviders=${[W.PARTICIPANT]}
5
+ .publicKeys=${this.publicKeys}
6
+ .selectedSigningProvider=${this.selectedSigningProvider}
7
+ .partyId=${this.partyId}
8
+ .selectedPublicKey=${this.selectedPublicKey}
9
+ ?publicKeysLoading=${this.publicKeysLoading}
10
+ ?submitting=${this.submitting}
11
+ @signing-provider-change=${this.onSigningProviderChange}
12
+ @wallet-edit=${this.onEditParty}
13
+ ></wg-wallet-edit-form>
14
+ `}}o=ae(E);U=new WeakMap;$=new WeakMap;O=new WeakMap;P(o,4,"userClient",x,g,U);P(o,4,"wallet",F,g,$);P(o,4,"selectedPublicKey",R,g,O);g=P(o,0,"UserUiEditParty",B,g);p(o,1,g);
@@ -1,4 +1,4 @@
1
- import{r as C,d as V,c as X,a as Y,f as Z,s as W,x as E,b as _,v as T,i as j,t as ee}from"./index-BhzcMGYw.js";var te=Object.create,z=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,G=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),u=t=>{throw TypeError(t)},ae=(t,e,i)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,N=(t,e)=>z(t,"name",{value:e,configurable:!0}),se=t=>[,,,te(t?.[G("metadata")]??null)],H=["class","method","getter","setter","accessor","field","value","get","set"],w=t=>t!==void 0&&typeof t!="function"?u("Function expected"):t,re=(t,e,i,n,s)=>({kind:H[t],name:e,metadata:n,addInitializer:r=>i._?u("Already initialized"):s.push(w(r||null))}),ne=(t,e)=>ae(e,G("metadata"),t[3]),g=(t,e,i,n)=>{for(var s=0,r=t[e>>1],h=r&&r.length;s<h;s++)e&1?r[s].call(i):n=r[s].call(i,n);return n},m=(t,e,i,n,s,r)=>{var h,c,M,f,y,a=e&7,P=!!(e&8),l=!!(e&16),b=a>3?t.length+1:a?P?1:2:0,R=H[a+5],D=a>3&&(t[b-1]=[]),Q=t[b]||(t[b]=[]),p=a&&(!l&&!P&&(s=s.prototype),a<5&&(a>3||!l)&&ie(a<4?s:{get[i](){return q(this,r)},set[i](d){return F(this,r,d)}},i));a?l&&a<4&&N(r,(a>2?"set ":a>1?"get ":"")+i):N(s,i);for(var S=n.length-1;S>=0;S--)f=re(a,i,M={},t[3],Q),a&&(f.static=P,f.private=l,y=f.access={has:l?d=>de(s,d):d=>i in d},a^3&&(y.get=l?d=>(a^1?q:ce)(d,s,a^4?r:p.get):d=>d[i]),a>2&&(y.set=l?(d,$)=>F(d,s,$,a^4?r:p.set):(d,$)=>d[i]=$)),c=(0,n[S])(a?a<4?l?r:p[R]:a>4?void 0:{get:p.get,set:p.set}:s,f),M._=1,a^4||c===void 0?w(c)&&(a>4?D.unshift(c):a?l?r=c:p[R]=c:s=c):typeof c!="object"||c===null?u("Object expected"):(w(h=c.get)&&(p.get=h),w(h=c.set)&&(p.set=h),w(h=c.init)&&D.unshift(h));return a||ne(t,s),p&&z(s,i,p),l?a^4?r:p:s},x=(t,e,i)=>e.has(t)||u("Cannot "+i),de=(t,e)=>Object(e)!==e?u('Cannot use the "in" operator on this value'):t.has(e),q=(t,e,i)=>(x(t,e,"read from private field"),i?i.call(t):e.get(t)),I=(t,e,i)=>e.has(t)?u("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),F=(t,e,i,n)=>(x(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),ce=(t,e,i)=>(x(t,e,"access private method"),i),L,B,J,k,K,o,A,O,U;K=[ee("user-ui-identity-providers")];class v extends(k=T,J=[C()],B=[C()],L=[C()],k){constructor(){super(...arguments),I(this,A,g(o,8,this,[])),g(o,11,this),I(this,O,g(o,12,this,!1)),g(o,15,this),I(this,U,g(o,16,this,1)),g(o,19,this),this.pageSize=4}get pagedIdps(){const e=(this.currentPage-1)*this.pageSize;return this.idps.slice(e,e+this.pageSize)}async connectedCallback(){super.connectedCallback(),await this.loadData()}async loadData(){try{const e=await V(),i=await X(await Y.accessToken.get(e)),[n,s]=await Promise.all([i.request({method:"listIdps"}),i.request({method:"getUser"}).catch(()=>({userId:"",isAdmin:!1}))]);this.idps=n.idps,this.isAdmin=s.isAdmin;const r=Math.max(1,Math.ceil(this.idps.length/this.pageSize));this.currentPage>r&&(this.currentPage=r)}catch(e){Z(e)}}_onReview(e){W(`${E("/identity-providers/review/")}?id=${encodeURIComponent(e.idp.id)}`)}_onPageChange(e){this.currentPage=e.page}render(){return _`
1
+ import{r as C,d as V,c as X,a as Y,f as Z,s as W,x as E,b as _,v as T,i as j,t as ee}from"./index-BAXYVraq.js";var te=Object.create,z=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,G=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),u=t=>{throw TypeError(t)},ae=(t,e,i)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,N=(t,e)=>z(t,"name",{value:e,configurable:!0}),se=t=>[,,,te(t?.[G("metadata")]??null)],H=["class","method","getter","setter","accessor","field","value","get","set"],w=t=>t!==void 0&&typeof t!="function"?u("Function expected"):t,re=(t,e,i,n,s)=>({kind:H[t],name:e,metadata:n,addInitializer:r=>i._?u("Already initialized"):s.push(w(r||null))}),ne=(t,e)=>ae(e,G("metadata"),t[3]),g=(t,e,i,n)=>{for(var s=0,r=t[e>>1],h=r&&r.length;s<h;s++)e&1?r[s].call(i):n=r[s].call(i,n);return n},m=(t,e,i,n,s,r)=>{var h,c,M,f,y,a=e&7,P=!!(e&8),l=!!(e&16),b=a>3?t.length+1:a?P?1:2:0,R=H[a+5],D=a>3&&(t[b-1]=[]),Q=t[b]||(t[b]=[]),p=a&&(!l&&!P&&(s=s.prototype),a<5&&(a>3||!l)&&ie(a<4?s:{get[i](){return q(this,r)},set[i](d){return F(this,r,d)}},i));a?l&&a<4&&N(r,(a>2?"set ":a>1?"get ":"")+i):N(s,i);for(var S=n.length-1;S>=0;S--)f=re(a,i,M={},t[3],Q),a&&(f.static=P,f.private=l,y=f.access={has:l?d=>de(s,d):d=>i in d},a^3&&(y.get=l?d=>(a^1?q:ce)(d,s,a^4?r:p.get):d=>d[i]),a>2&&(y.set=l?(d,$)=>F(d,s,$,a^4?r:p.set):(d,$)=>d[i]=$)),c=(0,n[S])(a?a<4?l?r:p[R]:a>4?void 0:{get:p.get,set:p.set}:s,f),M._=1,a^4||c===void 0?w(c)&&(a>4?D.unshift(c):a?l?r=c:p[R]=c:s=c):typeof c!="object"||c===null?u("Object expected"):(w(h=c.get)&&(p.get=h),w(h=c.set)&&(p.set=h),w(h=c.init)&&D.unshift(h));return a||ne(t,s),p&&z(s,i,p),l?a^4?r:p:s},x=(t,e,i)=>e.has(t)||u("Cannot "+i),de=(t,e)=>Object(e)!==e?u('Cannot use the "in" operator on this value'):t.has(e),q=(t,e,i)=>(x(t,e,"read from private field"),i?i.call(t):e.get(t)),I=(t,e,i)=>e.has(t)?u("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),F=(t,e,i,n)=>(x(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),ce=(t,e,i)=>(x(t,e,"access private method"),i),L,B,J,k,K,o,A,O,U;K=[ee("user-ui-identity-providers")];class v extends(k=T,J=[C()],B=[C()],L=[C()],k){constructor(){super(...arguments),I(this,A,g(o,8,this,[])),g(o,11,this),I(this,O,g(o,12,this,!1)),g(o,15,this),I(this,U,g(o,16,this,1)),g(o,19,this),this.pageSize=4}get pagedIdps(){const e=(this.currentPage-1)*this.pageSize;return this.idps.slice(e,e+this.pageSize)}async connectedCallback(){super.connectedCallback(),await this.loadData()}async loadData(){try{const e=await V(),i=await X(await Y.accessToken.get(e)),[n,s]=await Promise.all([i.request({method:"listIdps"}),i.request({method:"getUser"}).catch(()=>({userId:"",isAdmin:!1}))]);this.idps=n.idps,this.isAdmin=s.isAdmin;const r=Math.max(1,Math.ceil(this.idps.length/this.pageSize));this.currentPage>r&&(this.currentPage=r)}catch(e){Z(e)}}_onReview(e){W(`${E("/identity-providers/review/")}?id=${encodeURIComponent(e.idp.id)}`)}_onPageChange(e){this.currentPage=e.page}render(){return _`
2
2
  <div class="page-header">
3
3
  <h1 class="h4 fw-semibold mb-0">Identity Providers</h1>
4
4
 
@@ -4914,7 +4914,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4914
4914
 
4915
4915
  `)}h.write("payload.value = newResult;"),h.write("return payload;");const R=h.compile();return(S,k)=>R(u,S,k)};let i;const a=sr,s=!ri.jitless,d=s&&Tf.value,c=t.catchall;let p;e._zod.parse=(u,h)=>{p??(p=o.value);const y=u.value;return a(y)?s&&d&&h?.async===!1&&h.jitless!==!0?(i||(i=n(t.shape)),u=i(u,h),c?Hl([],y,u,h,p,e):u):r(u,h):(u.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),u)}});function xa(e,t,r,o){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const n=e.filter(i=>!vt(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Ee(a,o,Se())))}),t)}const Vl=b("$ZodUnion",(e,t)=>{T.init(e,t),P(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),P(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>ni(n.source)).join("|")})$`)}});const r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1;const a=[];for(const s of t.options){const l=s._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(s=>xa(s,o,e,n)):xa(a,o,e,n)}}),Sw=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Vl.init(e,t);const r=e._zod.parse;P(e._zod,"propValues",()=>{const n={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[s,l]of Object.entries(a)){n[s]||(n[s]=new Set);for(const d of l)n[s].add(d)}}return n});const o=rn(()=>{const n=t.options,i=new Map;for(const a of n){const s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const l of s){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,a)}}return i});e._zod.parse=(n,i)=>{const a=n.value;if(!sr(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;const s=o.value.get(a?.[t.discriminator]);return s?s._zod.run(n,i):t.unionFallback||i.direction==="backward"?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:a,path:[t.discriminator],inst:e}),n)}}),Ew=b("$ZodIntersection",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{const n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,d])=>ka(r,l,d)):ka(r,i,a)}});function An(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($t(e)&&$t(t)){const r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(const i of o){const a=An(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let o=0;o<e.length;o++){const n=e[o],i=t[o],a=An(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ka(e,t,r){const o=new Map;let n;for(const s of t.issues)if(s.code==="unrecognized_keys"){n??(n=s);for(const l of s.keys)o.has(l)||o.set(l,{}),o.get(l).l=!0}else e.issues.push(s);for(const s of r.issues)if(s.code==="unrecognized_keys")for(const l of s.keys)o.has(l)||o.set(l,{}),o.get(l).r=!0;else e.issues.push(s);const i=[...o].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&n&&e.issues.push({...n,keys:i}),vt(e))return e;const a=An(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Ow=b("$ZodRecord",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!$t(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const i=[],a=t.keyType._zod.values;if(a){r.value={};const s=new Set;for(const d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){s.add(typeof d=="number"?d.toString():d);const c=t.keyType._zod.run({value:d,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>Ee(h,o,Se())),input:d,path:[d],inst:e});continue}const p=c.value,u=t.valueType._zod.run({value:n[d],issues:[]},o);u instanceof Promise?i.push(u.then(h=>{h.issues.length&&r.issues.push(...wt(d,h.issues)),r.value[p]=h.value})):(u.issues.length&&r.issues.push(...wt(d,u.issues)),r.value[p]=u.value)}let l;for(const d in n)s.has(d)||(l=l??[],l.push(d));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{r.value={};for(const s of Reflect.ownKeys(n)){if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,s))continue;let l=t.keyType._zod.run({value:s,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Zl.test(s)&&l.issues.length){const p=t.keyType._zod.run({value:Number(s),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){t.mode==="loose"?r.value[s]=n[s]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>Ee(p,o,Se())),input:s,path:[s],inst:e});continue}const c=t.valueType._zod.run({value:n[s],issues:[]},o);c instanceof Promise?i.push(c.then(p=>{p.issues.length&&r.issues.push(...wt(s,p.issues)),r.value[l.value]=p.value})):(c.issues.length&&r.issues.push(...wt(s,c.issues)),r.value[l.value]=c.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Iw=b("$ZodEnum",(e,t)=>{T.init(e,t);const r=Il(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>jf.has(typeof n)).map(n=>typeof n=="string"?Ct(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),Pw=b("$ZodLiteral",(e,t)=>{if(T.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Ct(o):o?Ct(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),$w=b("$ZodTransform",(e,t)=>{T.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ol(e.constructor.name);const n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r.fallback=!0,r));if(n instanceof Promise)throw new xt;return r.value=n,r.fallback=!0,r}});function za(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Kl=b("$ZodOptional",(e,t)=>{T.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${ni(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){const n=r.value,i=t.innerType._zod.run(r,o);return i instanceof Promise?i.then(a=>za(a,n)):za(i,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),Cw=b("$ZodExactOptional",(e,t)=>{Kl.init(e,t),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Tw=b("$ZodNullable",(e,t)=>{T.init(e,t),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${ni(r.source)}|null)$`):void 0}),P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),jw=b("$ZodDefault",(e,t)=>{T.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>_a(i,t)):_a(n,t)}});function _a(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Nw=b("$ZodPrefault",(e,t)=>{T.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),Dw=b("$ZodNonOptional",(e,t)=>{T.init(e,t),P(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Aa(i,e)):Aa(n,e)}});function Aa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rw=b("$ZodCatch",(e,t)=>{T.init(e,t),e._zod.optin="optional",P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>Ee(a,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(i=>Ee(i,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Zw=b("$ZodPipe",(e,t)=>{T.init(e,t),P(e._zod,"values",()=>t.in._zod.values),P(e._zod,"optin",()=>t.in._zod.optin),P(e._zod,"optout",()=>t.out._zod.optout),P(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){const i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>Cr(a,t.in,o)):Cr(i,t.in,o)}const n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>Cr(i,t.out,o)):Cr(n,t.out,o)}});function Cr(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const Mw=b("$ZodReadonly",(e,t)=>{T.init(e,t),P(e._zod,"propValues",()=>t.innerType._zod.propValues),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"optin",()=>t.innerType?._zod?.optin),P(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Sa):Sa(n)}});function Sa(e){return e.value=Object.freeze(e.value),e}const Bw=b("$ZodCustom",(e,t)=>{re.init(e,t),T.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{const o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>Ea(i,r,o,e));Ea(n,r,o,e)}});function Ea(e,t,r,o){if(!e){const n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(lr(n))}}var Oa;class Lw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const o={...this.get(r)??{}};delete o.id;const n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Uw(){return new Lw}(Oa=globalThis).__zod_globalRegistry??(Oa.__zod_globalRegistry=Uw());const Kt=globalThis.__zod_globalRegistry;function Yw(e,t){return new e({type:"string",...v(t)})}function Gw(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function Ia(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function Hw(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function Vw(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function Kw(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function Fw(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function Fl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function qw(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function Xw(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function Jw(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function Ww(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function Qw(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function e0(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function t0(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function r0(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function o0(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function n0(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function i0(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function a0(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function s0(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function l0(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function d0(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}function c0(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function p0(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function m0(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function u0(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function b0(e,t){return new e({type:"number",checks:[],...v(t)})}function g0(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function h0(e,t){return new e({type:"boolean",...v(t)})}function f0(e,t){return new e({type:"undefined",...v(t)})}function v0(e,t){return new e({type:"null",...v(t)})}function w0(e){return new e({type:"any"})}function y0(e){return new e({type:"unknown"})}function x0(e,t){return new e({type:"never",...v(t)})}function Pa(e,t){return new Bl({check:"less_than",...v(t),value:e,inclusive:!1})}function gn(e,t){return new Bl({check:"less_than",...v(t),value:e,inclusive:!0})}function $a(e,t){return new Ll({check:"greater_than",...v(t),value:e,inclusive:!1})}function hn(e,t){return new Ll({check:"greater_than",...v(t),value:e,inclusive:!0})}function Ca(e,t){return new $v({check:"multiple_of",...v(t),value:e})}function ql(e,t){return new Tv({check:"max_length",...v(t),maximum:e})}function Ro(e,t){return new jv({check:"min_length",...v(t),minimum:e})}function Xl(e,t){return new Nv({check:"length_equals",...v(t),length:e})}function k0(e,t){return new Dv({check:"string_format",format:"regex",...v(t),pattern:e})}function z0(e){return new Rv({check:"string_format",format:"lowercase",...v(e)})}function _0(e){return new Zv({check:"string_format",format:"uppercase",...v(e)})}function A0(e,t){return new Mv({check:"string_format",format:"includes",...v(t),includes:e})}function S0(e,t){return new Bv({check:"string_format",format:"starts_with",...v(t),prefix:e})}function E0(e,t){return new Lv({check:"string_format",format:"ends_with",...v(t),suffix:e})}function Zt(e){return new Uv({check:"overwrite",tx:e})}function O0(e){return Zt(t=>t.normalize(e))}function I0(){return Zt(e=>e.trim())}function P0(){return Zt(e=>e.toLowerCase())}function $0(){return Zt(e=>e.toUpperCase())}function C0(){return Zt(e=>Cf(e))}function T0(e,t,r){return new e({type:"array",element:t,...v(r)})}function j0(e,t,r){return new e({type:"custom",check:"custom",fn:t,...v(r)})}function N0(e,t){const r=D0(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(lr(n,o.value,r._zod.def));else{const i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(lr(i))}},e(o.value,o)),t);return r}function D0(e,t){const r=new re({check:"custom",...v(t)});return r._zod.check=e,r}function Jl(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Kt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function K(e,t,r={path:[],schemaPath:[]}){var o;const n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{const c={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,c);else{const u=a.schema,h=t.processors[n.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);h(e,t,u,c)}const p=e._zod.parent;p&&(a.ref||(a.ref=p),K(p,t,c),t.seen.get(p).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&W(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Wl(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const a of e.seen.entries()){const s=e.metadataRegistry.get(a[0])?.id;if(s){const l=o.get(s);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(s,a[0])}}const n=a=>{const s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const p=e.external.registry.get(a[0])?.id,u=e.external.uri??(y=>y);if(p)return{ref:u(p)};const h=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=h,{defId:h,ref:`${u("__shared")}#/${s}/${h}`}}if(a[1]===r)return{ref:"#"};const d=`#/${s}/`,c=a[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:d+c}},i=a=>{if(a[1].schema.$ref)return;const s=a[1],{ref:l,defId:d}=n(a);s.def={...s.schema},d&&(s.defId=d);const c=s.schema;for(const p in c)delete c[p];c.$ref=l};if(e.cycles==="throw")for(const a of e.seen.entries()){const s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
4916
4916
 
4917
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const s=a[1];if(t===a[0]){i(a);continue}if(e.external){const d=e.external.registry.get(a[0])?.id;if(t!==a[0]&&d){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function Ql(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=s=>{const l=e.seen.get(s);if(l.ref===null)return;const d=l.def??l.schema,c={...d},p=l.ref;if(l.ref=null,p){o(p);const h=e.seen.get(p),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(y)):Object.assign(d,y),Object.assign(d,c),s._zod.parent===p)for(const C in d)C==="$ref"||C==="allOf"||C in c||delete d[C];if(y.$ref&&h.def)for(const C in d)C==="$ref"||C==="allOf"||C in h.def&&JSON.stringify(d[C])===JSON.stringify(h.def[C])&&delete d[C]}const u=s._zod.parent;if(u&&u!==p){o(u);const h=e.seen.get(u);if(h?.schema.$ref&&(d.$ref=h.schema.$ref,h.def))for(const y in d)y==="$ref"||y==="allOf"||y in h.def&&JSON.stringify(d[y])===JSON.stringify(h.def[y])&&delete d[y]}e.override({zodSchema:s,jsonSchema:d,path:l.path??[]})};for(const s of[...e.seen.entries()].reverse())o(s[0]);const n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;const a=e.external?.defs??{};for(const s of e.seen.entries()){const l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{const s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Zo(t,"input",e.processors),output:Zo(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function W(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return W(o.element,r);if(o.type==="set")return W(o.valueType,r);if(o.type==="lazy")return W(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return W(o.innerType,r);if(o.type==="intersection")return W(o.left,r)||W(o.right,r);if(o.type==="record"||o.type==="map")return W(o.keyType,r)||W(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:W(o.in,r)||W(o.out,r);if(o.type==="object"){for(const n in o.shape)if(W(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(const n of o.options)if(W(n,r))return!0;return!1}if(o.type==="tuple"){for(const n of o.items)if(W(n,r))return!0;return!!(o.rest&&W(o.rest,r))}return!1}const R0=(e,t={})=>r=>{const o=Jl({...r,processors:t});return K(e,o),Wl(o,e),Ql(o,e)},Zo=(e,t,r={})=>o=>{const{libraryOptions:n,target:i}=o??{},a=Jl({...n??{},target:i,io:t,processors:r});return K(e,a),Wl(a,e),Ql(a,e)},Z0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},M0=(e,t,r,o)=>{const n=r;n.type="string";const{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=Z0[s]??s,n.format===""&&delete n.format,s==="time"&&delete n.format),d&&(n.contentEncoding=d),l&&l.size>0){const c=[...l];c.length===1?n.pattern=c[0].source:c.length>1&&(n.allOf=[...c.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},B0=(e,t,r,o)=>{const n=r,{minimum:i,maximum:a,format:s,multipleOf:l,exclusiveMaximum:d,exclusiveMinimum:c}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number";const p=typeof c=="number"&&c>=(i??Number.NEGATIVE_INFINITY),u=typeof d=="number"&&d<=(a??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";p?h?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:typeof i=="number"&&(n.minimum=i),u?h?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d:typeof a=="number"&&(n.maximum=a),typeof l=="number"&&(n.multipleOf=l)},L0=(e,t,r,o)=>{r.type="boolean"},U0=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Y0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},G0=(e,t,r,o)=>{r.not={}},H0=(e,t,r,o)=>{},V0=(e,t,r,o)=>{},K0=(e,t,r,o)=>{const n=e._zod.def,i=Il(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},F0=(e,t,r,o)=>{const n=e._zod.def,i=[];for(const a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},q0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},X0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},J0=(e,t,r,o)=>{const n=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=K(i.element,t,{...o,path:[...o.path,"items"]})},W0=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="object",n.properties={};const a=i.shape;for(const d in a)n.properties[d]=K(a[d],t,{...o,path:[...o.path,"properties",d]});const s=new Set(Object.keys(a)),l=new Set([...s].filter(d=>{const c=i.shape[d]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));l.size>0&&(n.required=Array.from(l)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=K(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Q0=(e,t,r,o)=>{const n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,l)=>K(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=a:r.anyOf=a},ey=(e,t,r,o)=>{const n=e._zod.def,i=K(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=K(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=d=>"allOf"in d&&Object.keys(d).length===1,l=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=l},ty=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="object";const a=i.keyType,l=a._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){const c=K(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(const p of l)n.patternProperties[p.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=K(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=K(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=a._zod.values;if(d){const c=[...d].filter(p=>typeof p=="string"||typeof p=="number");c.length>0&&(n.required=c)}},ry=(e,t,r,o)=>{const n=e._zod.def,i=K(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},oy=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},ny=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},iy=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},ay=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},sy=(e,t,r,o)=>{const n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;K(a,t,o);const s=t.seen.get(e);s.ref=a},ly=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},ed=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},dy=b("ZodISODateTime",(e,t)=>{rw.init(e,t),Y.init(e,t)});function cy(e){return c0(dy,e)}const py=b("ZodISODate",(e,t)=>{ow.init(e,t),Y.init(e,t)});function my(e){return p0(py,e)}const uy=b("ZodISOTime",(e,t)=>{nw.init(e,t),Y.init(e,t)});function by(e){return m0(uy,e)}const gy=b("ZodISODuration",(e,t)=>{iw.init(e,t),Y.init(e,t)});function hy(e){return u0(gy,e)}const fy=(e,t)=>{Tl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Vf(e,r)},flatten:{value:r=>Hf(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,_n,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,_n,2)}},isEmpty:{get(){return e.issues.length===0}}})},se=b("ZodError",fy,{Parent:Error}),vy=ai(se),wy=si(se),yy=on(se),xy=nn(se),ky=qf(se),zy=Xf(se),_y=Jf(se),Ay=Wf(se),Sy=Qf(se),Ey=ev(se),Oy=tv(se),Iy=rv(se),Ta=new WeakMap;function vr(e,t,r){const o=Object.getPrototypeOf(e);let n=Ta.get(o);if(n||(n=new Set,Ta.set(o,n)),!n.has(t)){n.add(t);for(const i in r){const a=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){const s=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}const j=b("ZodType",(e,t)=>(T.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zo(e,"input"),output:Zo(e,"output")}}),e.toJSONSchema=R0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>vy(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>yy(e,r,o),e.parseAsync=async(r,o)=>wy(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>xy(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>ky(e,r,o),e.decode=(r,o)=>zy(e,r,o),e.encodeAsync=async(r,o)=>_y(e,r,o),e.decodeAsync=async(r,o)=>Ay(e,r,o),e.safeEncode=(r,o)=>Sy(e,r,o),e.safeDecode=(r,o)=>Ey(e,r,o),e.safeEncodeAsync=async(r,o)=>Oy(e,r,o),e.safeDecodeAsync=async(r,o)=>Iy(e,r,o),vr(e,"ZodType",{check(...r){const o=this.def;return this.clone(Be(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Le(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(_x(r,o))},superRefine(r,o){return this.check(Ax(r,o))},overwrite(r){return this.check(Zt(r))},optional(){return tt(this)},exactOptional(){return px(this)},nullable(){return Ra(this)},nullish(){return tt(Ra(this))},nonoptional(r){return fx(this,r)},array(){return ad(this)},or(r){return di([this,r])},and(r){return ci(this,r)},transform(r){return Za(this,dx(r))},default(r){return bx(this,r)},prefault(r){return hx(this,r)},catch(r){return wx(this,r)},pipe(r){return Za(this,r)},readonly(){return kx(this)},describe(r){const o=this.clone();return Kt.add(o,{description:r}),o},meta(...r){if(r.length===0)return Kt.get(this);const o=this.clone();return Kt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Kt.get(e)?.description},configurable:!0}),e)),td=b("_ZodString",(e,t)=>{li.init(e,t),j.init(e,t),e._zod.processJSONSchema=(o,n,i)=>M0(e,o,n);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,vr(e,"_ZodString",{regex(...o){return this.check(k0(...o))},includes(...o){return this.check(A0(...o))},startsWith(...o){return this.check(S0(...o))},endsWith(...o){return this.check(E0(...o))},min(...o){return this.check(Ro(...o))},max(...o){return this.check(ql(...o))},length(...o){return this.check(Xl(...o))},nonempty(...o){return this.check(Ro(1,...o))},lowercase(o){return this.check(z0(o))},uppercase(o){return this.check(_0(o))},trim(){return this.check(I0())},normalize(...o){return this.check(O0(...o))},toLowerCase(){return this.check(P0())},toUpperCase(){return this.check($0())},slugify(){return this.check(C0())}})}),Py=b("ZodString",(e,t)=>{li.init(e,t),td.init(e,t),e.email=r=>e.check(Gw($y,r)),e.url=r=>e.check(Fl(rd,r)),e.jwt=r=>e.check(d0(Vy,r)),e.emoji=r=>e.check(qw(Cy,r)),e.guid=r=>e.check(Ia(ja,r)),e.uuid=r=>e.check(Hw(Tr,r)),e.uuidv4=r=>e.check(Vw(Tr,r)),e.uuidv6=r=>e.check(Kw(Tr,r)),e.uuidv7=r=>e.check(Fw(Tr,r)),e.nanoid=r=>e.check(Xw(Ty,r)),e.guid=r=>e.check(Ia(ja,r)),e.cuid=r=>e.check(Jw(jy,r)),e.cuid2=r=>e.check(Ww(Ny,r)),e.ulid=r=>e.check(Qw(Dy,r)),e.base64=r=>e.check(a0(Yy,r)),e.base64url=r=>e.check(s0(Gy,r)),e.xid=r=>e.check(e0(Ry,r)),e.ksuid=r=>e.check(t0(Zy,r)),e.ipv4=r=>e.check(r0(My,r)),e.ipv6=r=>e.check(o0(By,r)),e.cidrv4=r=>e.check(n0(Ly,r)),e.cidrv6=r=>e.check(i0(Uy,r)),e.e164=r=>e.check(l0(Hy,r)),e.datetime=r=>e.check(cy(r)),e.date=r=>e.check(my(r)),e.time=r=>e.check(by(r)),e.duration=r=>e.check(hy(r))});function oe(e){return Yw(Py,e)}const Y=b("ZodStringFormat",(e,t)=>{B.init(e,t),td.init(e,t)}),$y=b("ZodEmail",(e,t)=>{Kv.init(e,t),Y.init(e,t)}),ja=b("ZodGUID",(e,t)=>{Hv.init(e,t),Y.init(e,t)}),Tr=b("ZodUUID",(e,t)=>{Vv.init(e,t),Y.init(e,t)}),rd=b("ZodURL",(e,t)=>{Fv.init(e,t),Y.init(e,t)});function Sn(e){return Fl(rd,e)}const Cy=b("ZodEmoji",(e,t)=>{qv.init(e,t),Y.init(e,t)}),Ty=b("ZodNanoID",(e,t)=>{Xv.init(e,t),Y.init(e,t)}),jy=b("ZodCUID",(e,t)=>{Jv.init(e,t),Y.init(e,t)}),Ny=b("ZodCUID2",(e,t)=>{Wv.init(e,t),Y.init(e,t)}),Dy=b("ZodULID",(e,t)=>{Qv.init(e,t),Y.init(e,t)}),Ry=b("ZodXID",(e,t)=>{ew.init(e,t),Y.init(e,t)}),Zy=b("ZodKSUID",(e,t)=>{tw.init(e,t),Y.init(e,t)}),My=b("ZodIPv4",(e,t)=>{aw.init(e,t),Y.init(e,t)}),By=b("ZodIPv6",(e,t)=>{sw.init(e,t),Y.init(e,t)}),Ly=b("ZodCIDRv4",(e,t)=>{lw.init(e,t),Y.init(e,t)}),Uy=b("ZodCIDRv6",(e,t)=>{dw.init(e,t),Y.init(e,t)}),Yy=b("ZodBase64",(e,t)=>{cw.init(e,t),Y.init(e,t)}),Gy=b("ZodBase64URL",(e,t)=>{mw.init(e,t),Y.init(e,t)}),Hy=b("ZodE164",(e,t)=>{uw.init(e,t),Y.init(e,t)}),Vy=b("ZodJWT",(e,t)=>{gw.init(e,t),Y.init(e,t)}),od=b("ZodNumber",(e,t)=>{Yl.init(e,t),j.init(e,t),e._zod.processJSONSchema=(o,n,i)=>B0(e,o,n),vr(e,"ZodNumber",{gt(o,n){return this.check($a(o,n))},gte(o,n){return this.check(hn(o,n))},min(o,n){return this.check(hn(o,n))},lt(o,n){return this.check(Pa(o,n))},lte(o,n){return this.check(gn(o,n))},max(o,n){return this.check(gn(o,n))},int(o){return this.check(Na(o))},safe(o){return this.check(Na(o))},positive(o){return this.check($a(0,o))},nonnegative(o){return this.check(hn(0,o))},negative(o){return this.check(Pa(0,o))},nonpositive(o){return this.check(gn(0,o))},multipleOf(o,n){return this.check(Ca(o,n))},step(o,n){return this.check(Ca(o,n))},finite(){return this}});const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function En(e){return b0(od,e)}const Ky=b("ZodNumberFormat",(e,t)=>{hw.init(e,t),od.init(e,t)});function Na(e){return g0(Ky,e)}const Fy=b("ZodBoolean",(e,t)=>{fw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>L0(e,r,o)});function qy(e){return h0(Fy,e)}const Xy=b("ZodUndefined",(e,t)=>{vw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Y0(e,r)});function Jy(e){return f0(Xy,e)}const Wy=b("ZodNull",(e,t)=>{ww.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>U0(e,r,o)});function nd(e){return v0(Wy,e)}const Qy=b("ZodAny",(e,t)=>{yw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>H0()});function v1(){return w0(Qy)}const ex=b("ZodUnknown",(e,t)=>{xw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>V0()});function et(){return y0(ex)}const tx=b("ZodNever",(e,t)=>{kw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>G0(e,r,o)});function id(e){return x0(tx,e)}const rx=b("ZodArray",(e,t)=>{zw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>J0(e,r,o,n),e.element=t.element,vr(e,"ZodArray",{min(r,o){return this.check(Ro(r,o))},nonempty(r){return this.check(Ro(1,r))},max(r,o){return this.check(ql(r,o))},length(r,o){return this.check(Xl(r,o))},unwrap(){return this.element}})});function ad(e,t){return T0(rx,e,t)}const sd=b("ZodObject",(e,t)=>{Aw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>W0(e,r,o,n),P(e,"shape",()=>t.shape),vr(e,"ZodObject",{keyof(){return ax(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:et()})},loose(){return this.clone({...this._zod.def,catchall:et()})},strict(){return this.clone({...this._zod.def,catchall:id()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Mf(this,r)},safeExtend(r){return Bf(this,r)},merge(r){return Lf(this,r)},pick(r){return Rf(this,r)},omit(r){return Zf(this,r)},partial(...r){return Uf(cd,this,r[0])},required(...r){return Yf(pd,this,r[0])}})});function X(e,t){const r={type:"object",shape:e??{},...v(t)};return new sd(r)}function w1(e,t){return new sd({type:"object",shape:e,catchall:et(),...v(t)})}const ld=b("ZodUnion",(e,t)=>{Vl.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Q0(e,r,o,n),e.options=t.options});function di(e,t){return new ld({type:"union",options:e,...v(t)})}const ox=b("ZodDiscriminatedUnion",(e,t)=>{ld.init(e,t),Sw.init(e,t)});function dd(e,t,r){return new ox({type:"union",options:t,discriminator:e,...v(r)})}const nx=b("ZodIntersection",(e,t)=>{Ew.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ey(e,r,o,n)});function ci(e,t){return new nx({type:"intersection",left:e,right:t})}const Da=b("ZodRecord",(e,t)=>{Ow.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ty(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ix(e,t,r){return!t||!t._zod?new Da({type:"record",keyType:oe(),valueType:e,...v(t)}):new Da({type:"record",keyType:e,valueType:t,...v(r)})}const Mo=b("ZodEnum",(e,t)=>{Iw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(o,n,i)=>K0(e,o,n),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{const i={};for(const a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Mo({...t,checks:[],...v(n),entries:i})},e.exclude=(o,n)=>{const i={...t.entries};for(const a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Mo({...t,checks:[],...v(n),entries:i})}});function ax(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Mo({type:"enum",entries:r,...v(t)})}function y1(e,t){return new Mo({type:"enum",entries:e,...v(t)})}const sx=b("ZodLiteral",(e,t)=>{Pw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>F0(e,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function le(e,t){return new sx({type:"literal",values:Array.isArray(e)?e:[e],...v(t)})}const lx=b("ZodTransform",(e,t)=>{$w.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>X0(e,r),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ol(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(lr(i,r.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(lr(a))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function dx(e){return new lx({type:"transform",transform:e})}const cd=b("ZodOptional",(e,t)=>{Kl.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ed(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function tt(e){return new cd({type:"optional",innerType:e})}const cx=b("ZodExactOptional",(e,t)=>{Cw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ed(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function px(e){return new cx({type:"optional",innerType:e})}const mx=b("ZodNullable",(e,t)=>{Tw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ry(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ra(e){return new mx({type:"nullable",innerType:e})}const ux=b("ZodDefault",(e,t)=>{jw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ny(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bx(e,t){return new ux({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$l(t)}})}const gx=b("ZodPrefault",(e,t)=>{Nw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iy(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function hx(e,t){return new gx({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$l(t)}})}const pd=b("ZodNonOptional",(e,t)=>{Dw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oy(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function fx(e,t){return new pd({type:"nonoptional",innerType:e,...v(t)})}const vx=b("ZodCatch",(e,t)=>{Rw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ay(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wx(e,t){return new vx({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const yx=b("ZodPipe",(e,t)=>{Zw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sy(e,r,o,n),e.in=t.in,e.out=t.out});function Za(e,t){return new yx({type:"pipe",in:e,out:t})}const xx=b("ZodReadonly",(e,t)=>{Mw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ly(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kx(e){return new xx({type:"readonly",innerType:e})}const zx=b("ZodCustom",(e,t)=>{Bw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>q0(e,r)});function _x(e,t={}){return j0(zx,e,t)}function Ax(e,t){return N0(e,t)}const Sx="party-hint::fingerprint",Ex=`Must be in the form ${Sx}`,Ox=/^[a-zA-Z0-9:_-]*::[a-z0-9]*/;oe().regex(Ox,Ex);Sn({message:"Must be a valid HTTP or HTTPS URL",protocol:/^https?$/}).transform(e=>new URL(e).toString());const Ix=X({method:oe(),params:tt(di([ad(et()),ix(oe(),et())]))}),Px=X({result:tt(et())}),md=X({error:X({code:En(),message:oe(),data:tt(oe().or(En()).or(qy()).or(nd()).or(et()))})}),ud=di([Px,md]),bd=X({jsonrpc:le("2.0"),id:tt(oe().or(En()).or(Jy()).or(nd()))}),$x=ci(bd,Ix),Cx=ci(bd,ud);let Bo=(function(e){return e.SPLICE_WALLET_REQUEST="SPLICE_WALLET_REQUEST",e.SPLICE_WALLET_RESPONSE="SPLICE_WALLET_RESPONSE",e.SPLICE_WALLET_EXT_READY="SPLICE_WALLET_EXT_READY",e.SPLICE_WALLET_EXT_ACK="SPLICE_WALLET_EXT_ACK",e.SPLICE_WALLET_EXT_OPEN="SPLICE_WALLET_EXT_OPEN",e.SPLICE_WALLET_IDP_AUTH_SUCCESS="SPLICE_WALLET_IDP_AUTH_SUCCESS",e.SPLICE_WALLET_LOGOUT="SPLICE_WALLET_LOGOUT",e.SPLICE_WALLET_BROADCAST_ORIGIN="SPLICE_WALLET_BROADCAST_ORIGIN",e.SPLICE_WALLET_BROADCAST_ORIGIN_ACK="SPLICE_WALLET_BROADCAST_ORIGIN_ACK",e})({});const jr=oe().min(1).describe("Optional routing key for browser-extension messaging. When present, only the matching extension should handle the message."),Tx=dd("type",[X({type:le("SPLICE_WALLET_REQUEST"),request:$x,target:jr.optional()}),X({type:le("SPLICE_WALLET_RESPONSE"),response:Cx}),X({type:le("SPLICE_WALLET_EXT_READY"),target:jr.optional()}),X({type:le("SPLICE_WALLET_EXT_ACK"),target:jr.optional()}),X({type:le("SPLICE_WALLET_EXT_OPEN"),url:Sn(),target:jr.optional()}),X({type:le("SPLICE_WALLET_IDP_AUTH_SUCCESS"),token:oe(),sessionId:oe()}),X({type:le("SPLICE_WALLET_BROADCAST_ORIGIN"),origin:Sn()}),X({type:le("SPLICE_WALLET_BROADCAST_ORIGIN_ACK")})]),jx=e=>typeof e=="object"&&e!==null&&"data"in e?Nx(e.data):!1,Nx=e=>Tx.safeParse(e).success;dd("walletType",[X({walletType:le("extension"),providerId:oe().optional(),url:tt(id())}),X({walletType:le("remote"),url:oe().url()})]);X({name:oe()});var gd=class{constructor(e,t){this.url=e,this.accessToken=t}async handleErrorResponse(e){const t=await e.text();let r;try{const o=JSON.parse(t);md.safeParse(o).success&&(r=o)}catch{}throw r!==void 0?r:{error:{code:e.status,message:e.statusText,data:t}}}async submit(e){const t={jsonrpc:"2.0",method:e.method,params:e.params,id:If()},r=this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:void 0,o=await fetch(this.url.href,{method:"POST",headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)return this.handleErrorResponse(o);const n=await o.json(),i=ud.parse(n);if("error"in i)throw i;return i}};function dr(e){"@babel/helpers - typeof";return dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(e)}function Dx(e,t){if(dr(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,t);if(dr(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rx(e){var t=Dx(e,"string");return dr(t)=="symbol"?t:t+""}function Zx(e,t,r){return(t=Rx(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var hd=class{constructor(e){Zx(this,"transport",void 0),this.transport=e}async request(e){const t=await this.transport.submit(e);if("error"in t)throw new Error("RPC error: "+t.error.code+" - "+t.error.message);return t.result}};const Mx="com.splice.wallet.crypto",Bx=1,cr="keys",On="access-token-key";function pi(){return new Promise((e,t)=>{const r=indexedDB.open(Mx,Bx);r.onupgradeneeded=()=>{const o=r.result;o.objectStoreNames.contains(cr)||o.createObjectStore(cr)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}async function Lx(e,t){const r=await pi();return new Promise((o,n)=>{const a=r.transaction(e,"readonly").objectStore(e).get(t);a.onsuccess=()=>o(a.result),a.onerror=()=>n(a.error)})}async function Ux(e,t,r){const o=await pi();return new Promise((n,i)=>{const a=o.transaction(e,"readwrite");a.objectStore(e).put(r,t),a.oncomplete=()=>n(),a.onerror=()=>i(a.error)})}async function Yx(e,t){const r=await pi();return new Promise((o,n)=>{const i=r.transaction(e,"readwrite");i.objectStore(e).delete(t),i.oncomplete=()=>o(),i.onerror=()=>n(i.error)})}let yo=null;function fd(){return yo||(yo=(async()=>{const e=await Lx(cr,On);if(e)return e;const t=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return await Ux(cr,On,t),t})()),yo}async function Gx(e){const t=await fd(),r=crypto.getRandomValues(new Uint8Array(12)),o=new TextEncoder().encode(e),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,o),i={ciphertext:Array.from(new Uint8Array(n)),iv:Array.from(r)};return JSON.stringify(i)}async function Hx(e){const{ciphertext:t,iv:r}=JSON.parse(e),o=await fd(),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(r)},o,new Uint8Array(t));return new TextDecoder().decode(n)}async function Vx(){await Yx(cr,On),yo=null}const Ma="com.splice.wallet.v1";class ve{constructor(){this.state=new Map,this.accessTokenCache=new Map,this.accessToken={get:async t=>{if(this.accessTokenCache.has(t))return this.accessTokenCache.get(t);const r=localStorage.getItem(ve.localStorageKey("accessToken",t));if(r){try{this.accessTokenCache.set(t,await Hx(r))}catch(o){localStorage.removeItem(ve.localStorageKey("accessToken",t)),console.warn(o),this.accessTokenCache.delete(t)}return this.accessTokenCache.get(t)}},set:async(t,r)=>{const o=await Gx(t);localStorage.setItem(ve.localStorageKey("accessToken",r),o),this.accessTokenCache.set(r,t)},clear:async t=>{localStorage.removeItem(ve.localStorageKey("accessToken",t)),this.accessTokenCache.delete(t)}},this.networkId={get:t=>this.getWithStorage("networkId",t),set:(t,r)=>this.setWithStorage("networkId",t,r),clear:t=>this.clearWithStorage("networkId",t)},this.expirationDate={get:t=>this.getWithStorage("expirationDate",t),set:(t,r)=>this.setWithStorage("expirationDate",t,r),clear:t=>this.clearWithStorage("expirationDate",t)},this.intendedPage={get:t=>this.getWithStorage("intendedPage",t),set:(t,r)=>this.setWithStorage("intendedPage",t,r),clear:t=>this.clearWithStorage("intendedPage",t)},this.currentOrigin={get:()=>this.getWithStorage("origin","current",sessionStorage),set:t=>this.setWithStorage("origin",t,"current",sessionStorage),clear:()=>this.clearWithStorage("origin","current",sessionStorage)},this.sessionId={get:t=>this.getWithStorage("sessionId",t),set:(t,r)=>this.setWithStorage("sessionId",t,r),clear:t=>this.clearWithStorage("sessionId",t)};for(const t in localStorage)t.startsWith(Ma)||localStorage.removeItem(t)}static localStorageKey(t,r){return`${Ma}.${r}.${t}`}getWithStorage(t,r,o=localStorage){if(this.state.has(t))return this.state.get(t);const n=o.getItem(ve.localStorageKey(t,r));if(n)return this.state.set(t,n),n}setWithStorage(t,r,o,n=localStorage){n.setItem(ve.localStorageKey(t,o),r),this.state.set(t,r)}clearWithStorage(t,r,o=localStorage){o.removeItem(ve.localStorageKey(t,r)),this.state.delete(t)}async clearAuthState(t){await this.accessToken.clear(t),this.networkId.clear(t),this.expirationDate.clear(t),this.intendedPage.clear(t),this.sessionId.clear(t)}async revokeAccessToken(t){await this.accessToken.clear(t),await Vx()}}const G=new ve,Kx="/parties",Fx="/404",ce="/login",x1="/activities",Ba=5e3,qx=1440*60*1e3;function ye(e){window.location.href=e}const vd=e=>{jx(e)&&(window.opener&&e.source!==window.opener||e.data.type===Bo.SPLICE_WALLET_BROADCAST_ORIGIN&&e.data.origin===e.origin&&(G.currentOrigin.set(e.data.origin),window.opener.postMessage({type:Bo.SPLICE_WALLET_BROADCAST_ORIGIN_ACK},e.origin),window.removeEventListener("message",vd)))};window.addEventListener("message",vd);async function pe(){return window.opener?new Promise(e=>{const t=setInterval(()=>{const r=G.currentOrigin.get();r&&(clearInterval(t),e(r))},100)}):(G.currentOrigin.set(window.origin),window.origin)}let fn=!1,vn=null;const wd=async()=>{const e=new URL(je("/api/v0/user"),window.location.origin);return vn||(vn=fetch(je("/.well-known/wallet-gateway-config")).then(t=>t.json()).then(t=>t?.userPath?new URL(t.userPath):e).catch(t=>(console.warn("Failed to fetch userPath from config, using default",t),e))),vn},xo=async e=>{try{const t=await wd();await new hd(new gd(t,e)).request({method:"removeSession"})}catch(t){console.debug("Failed to remove session: ",t)}},Xx=async()=>{if(fn)return;fn=!0;const e=await pe();try{const t=await G.accessToken.get(e);t&&await xo(t)}finally{await G.clearAuthState(e),fn=!1,He(window.location.pathname)!==ce&&ye(we(ce))}};class Jx extends gd{async handleErrorResponse(t){return t.status===401&&Xx(),super.handleErrorResponse(t)}}const Lo=async e=>{const t=await wd();return new hd(new Jx(t,e))},La=(e,t,r)=>{const o=new be;o.title=e,o.message=t,o.type=r,document.body.appendChild(o)};async function Ua(){const e=new URL(je("/api/v0/dapp"),window.location.origin).toString();try{const t=await fetch(je("/.well-known/wallet-gateway-config"));return t.ok&&(await t.json()).dappApiUrl||e}catch{return e}}var Wx=Object.create,mi=Object.defineProperty,Qx=Object.getOwnPropertyDescriptor,yd=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Mt=e=>{throw TypeError(e)},e1=(e,t,r)=>t in e?mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ya=(e,t)=>mi(e,"name",{value:t,configurable:!0}),ui=e=>[,,,Wx(e?.[yd("metadata")]??null)],xd=["class","method","getter","setter","accessor","field","value","get","set"],Ft=e=>e!==void 0&&typeof e!="function"?Mt("Function expected"):e,t1=(e,t,r,o,n)=>({kind:xd[e],name:t,metadata:o,addInitializer:i=>r._?Mt("Already initialized"):n.push(Ft(i||null))}),r1=(e,t)=>e1(t,yd("metadata"),e[3]),de=(e,t,r,o)=>{for(var n=0,i=e[t>>1],a=i&&i.length;n<a;n++)t&1?i[n].call(r):o=i[n].call(r,o);return o},lt=(e,t,r,o,n,i)=>{var a,s,l,d,c,p=t&7,u=!!(t&8),h=!!(t&16),y=p>3?e.length+1:p?u?1:2:0,A=xd[p+5],C=p>3&&(e[y-1]=[]),Ue=e[y]||(e[y]=[]),R=p&&(!h&&!u&&(n=n.prototype),p<5&&(p>3||!h)&&Qx(p<4?n:{get[r](){return Ga(this,i)},set[r](k){return Ha(this,i,k)}},r));p?h&&p<4&&Ya(i,(p>2?"set ":p>1?"get ":"")+r):Ya(n,r);for(var S=o.length-1;S>=0;S--)d=t1(p,r,l={},e[3],Ue),p&&(d.static=u,d.private=h,c=d.access={has:h?k=>o1(n,k):k=>r in k},p^3&&(c.get=h?k=>(p^1?Ga:n1)(k,n,p^4?i:R.get):k=>k[r]),p>2&&(c.set=h?(k,Z)=>Ha(k,n,Z,p^4?i:R.set):(k,Z)=>k[r]=Z)),s=(0,o[S])(p?p<4?h?i:R[A]:p>4?void 0:{get:R.get,set:R.set}:n,d),l._=1,p^4||s===void 0?Ft(s)&&(p>4?C.unshift(s):p?h?i=s:R[A]=s:n=s):typeof s!="object"||s===null?Mt("Object expected"):(Ft(a=s.get)&&(R.get=a),Ft(a=s.set)&&(R.set=a),Ft(a=s.init)&&C.unshift(a));return p||r1(e,n),R&&mi(n,r,R),h?p^4?i:R:n},bi=(e,t,r)=>t.has(e)||Mt("Cannot "+r),o1=(e,t)=>Object(t)!==t?Mt('Cannot use the "in" operator on this value'):e.has(t),Ga=(e,t,r)=>(bi(e,t,"read from private field"),r?r.call(e):t.get(e)),Nr=(e,t,r)=>t.has(e)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ha=(e,t,r,o)=>(bi(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),n1=(e,t,r)=>(bi(e,t,"access private method"),r),kd,zd,_d,Ad,In,Sd,Q,gi,hi,fi,vi,Ed,wi,Od,Id,yi,Pd;const $d=document.createElement("style");$d.textContent=`
4917
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const s=a[1];if(t===a[0]){i(a);continue}if(e.external){const d=e.external.registry.get(a[0])?.id;if(t!==a[0]&&d){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function Ql(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=s=>{const l=e.seen.get(s);if(l.ref===null)return;const d=l.def??l.schema,c={...d},p=l.ref;if(l.ref=null,p){o(p);const h=e.seen.get(p),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(y)):Object.assign(d,y),Object.assign(d,c),s._zod.parent===p)for(const C in d)C==="$ref"||C==="allOf"||C in c||delete d[C];if(y.$ref&&h.def)for(const C in d)C==="$ref"||C==="allOf"||C in h.def&&JSON.stringify(d[C])===JSON.stringify(h.def[C])&&delete d[C]}const u=s._zod.parent;if(u&&u!==p){o(u);const h=e.seen.get(u);if(h?.schema.$ref&&(d.$ref=h.schema.$ref,h.def))for(const y in d)y==="$ref"||y==="allOf"||y in h.def&&JSON.stringify(d[y])===JSON.stringify(h.def[y])&&delete d[y]}e.override({zodSchema:s,jsonSchema:d,path:l.path??[]})};for(const s of[...e.seen.entries()].reverse())o(s[0]);const n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;const a=e.external?.defs??{};for(const s of e.seen.entries()){const l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{const s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Zo(t,"input",e.processors),output:Zo(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function W(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return W(o.element,r);if(o.type==="set")return W(o.valueType,r);if(o.type==="lazy")return W(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return W(o.innerType,r);if(o.type==="intersection")return W(o.left,r)||W(o.right,r);if(o.type==="record"||o.type==="map")return W(o.keyType,r)||W(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:W(o.in,r)||W(o.out,r);if(o.type==="object"){for(const n in o.shape)if(W(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(const n of o.options)if(W(n,r))return!0;return!1}if(o.type==="tuple"){for(const n of o.items)if(W(n,r))return!0;return!!(o.rest&&W(o.rest,r))}return!1}const R0=(e,t={})=>r=>{const o=Jl({...r,processors:t});return K(e,o),Wl(o,e),Ql(o,e)},Zo=(e,t,r={})=>o=>{const{libraryOptions:n,target:i}=o??{},a=Jl({...n??{},target:i,io:t,processors:r});return K(e,a),Wl(a,e),Ql(a,e)},Z0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},M0=(e,t,r,o)=>{const n=r;n.type="string";const{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=Z0[s]??s,n.format===""&&delete n.format,s==="time"&&delete n.format),d&&(n.contentEncoding=d),l&&l.size>0){const c=[...l];c.length===1?n.pattern=c[0].source:c.length>1&&(n.allOf=[...c.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},B0=(e,t,r,o)=>{const n=r,{minimum:i,maximum:a,format:s,multipleOf:l,exclusiveMaximum:d,exclusiveMinimum:c}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number";const p=typeof c=="number"&&c>=(i??Number.NEGATIVE_INFINITY),u=typeof d=="number"&&d<=(a??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";p?h?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:typeof i=="number"&&(n.minimum=i),u?h?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d:typeof a=="number"&&(n.maximum=a),typeof l=="number"&&(n.multipleOf=l)},L0=(e,t,r,o)=>{r.type="boolean"},U0=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Y0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},G0=(e,t,r,o)=>{r.not={}},H0=(e,t,r,o)=>{},V0=(e,t,r,o)=>{},K0=(e,t,r,o)=>{const n=e._zod.def,i=Il(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},F0=(e,t,r,o)=>{const n=e._zod.def,i=[];for(const a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},q0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},X0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},J0=(e,t,r,o)=>{const n=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=K(i.element,t,{...o,path:[...o.path,"items"]})},W0=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="object",n.properties={};const a=i.shape;for(const d in a)n.properties[d]=K(a[d],t,{...o,path:[...o.path,"properties",d]});const s=new Set(Object.keys(a)),l=new Set([...s].filter(d=>{const c=i.shape[d]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));l.size>0&&(n.required=Array.from(l)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=K(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Q0=(e,t,r,o)=>{const n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,l)=>K(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=a:r.anyOf=a},ey=(e,t,r,o)=>{const n=e._zod.def,i=K(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=K(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=d=>"allOf"in d&&Object.keys(d).length===1,l=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=l},ty=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="object";const a=i.keyType,l=a._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){const c=K(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(const p of l)n.patternProperties[p.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=K(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=K(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=a._zod.values;if(d){const c=[...d].filter(p=>typeof p=="string"||typeof p=="number");c.length>0&&(n.required=c)}},ry=(e,t,r,o)=>{const n=e._zod.def,i=K(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},oy=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},ny=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},iy=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},ay=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},sy=(e,t,r,o)=>{const n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;K(a,t,o);const s=t.seen.get(e);s.ref=a},ly=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},ed=(e,t,r,o)=>{const n=e._zod.def;K(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},dy=b("ZodISODateTime",(e,t)=>{rw.init(e,t),Y.init(e,t)});function cy(e){return c0(dy,e)}const py=b("ZodISODate",(e,t)=>{ow.init(e,t),Y.init(e,t)});function my(e){return p0(py,e)}const uy=b("ZodISOTime",(e,t)=>{nw.init(e,t),Y.init(e,t)});function by(e){return m0(uy,e)}const gy=b("ZodISODuration",(e,t)=>{iw.init(e,t),Y.init(e,t)});function hy(e){return u0(gy,e)}const fy=(e,t)=>{Tl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Vf(e,r)},flatten:{value:r=>Hf(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,_n,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,_n,2)}},isEmpty:{get(){return e.issues.length===0}}})},se=b("ZodError",fy,{Parent:Error}),vy=ai(se),wy=si(se),yy=on(se),xy=nn(se),ky=qf(se),zy=Xf(se),_y=Jf(se),Ay=Wf(se),Sy=Qf(se),Ey=ev(se),Oy=tv(se),Iy=rv(se),Ta=new WeakMap;function vr(e,t,r){const o=Object.getPrototypeOf(e);let n=Ta.get(o);if(n||(n=new Set,Ta.set(o,n)),!n.has(t)){n.add(t);for(const i in r){const a=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){const s=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}const j=b("ZodType",(e,t)=>(T.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zo(e,"input"),output:Zo(e,"output")}}),e.toJSONSchema=R0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>vy(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>yy(e,r,o),e.parseAsync=async(r,o)=>wy(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>xy(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>ky(e,r,o),e.decode=(r,o)=>zy(e,r,o),e.encodeAsync=async(r,o)=>_y(e,r,o),e.decodeAsync=async(r,o)=>Ay(e,r,o),e.safeEncode=(r,o)=>Sy(e,r,o),e.safeDecode=(r,o)=>Ey(e,r,o),e.safeEncodeAsync=async(r,o)=>Oy(e,r,o),e.safeDecodeAsync=async(r,o)=>Iy(e,r,o),vr(e,"ZodType",{check(...r){const o=this.def;return this.clone(Be(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Le(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(_x(r,o))},superRefine(r,o){return this.check(Ax(r,o))},overwrite(r){return this.check(Zt(r))},optional(){return tt(this)},exactOptional(){return px(this)},nullable(){return Ra(this)},nullish(){return tt(Ra(this))},nonoptional(r){return fx(this,r)},array(){return ad(this)},or(r){return di([this,r])},and(r){return ci(this,r)},transform(r){return Za(this,dx(r))},default(r){return bx(this,r)},prefault(r){return hx(this,r)},catch(r){return wx(this,r)},pipe(r){return Za(this,r)},readonly(){return kx(this)},describe(r){const o=this.clone();return Kt.add(o,{description:r}),o},meta(...r){if(r.length===0)return Kt.get(this);const o=this.clone();return Kt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Kt.get(e)?.description},configurable:!0}),e)),td=b("_ZodString",(e,t)=>{li.init(e,t),j.init(e,t),e._zod.processJSONSchema=(o,n,i)=>M0(e,o,n);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,vr(e,"_ZodString",{regex(...o){return this.check(k0(...o))},includes(...o){return this.check(A0(...o))},startsWith(...o){return this.check(S0(...o))},endsWith(...o){return this.check(E0(...o))},min(...o){return this.check(Ro(...o))},max(...o){return this.check(ql(...o))},length(...o){return this.check(Xl(...o))},nonempty(...o){return this.check(Ro(1,...o))},lowercase(o){return this.check(z0(o))},uppercase(o){return this.check(_0(o))},trim(){return this.check(I0())},normalize(...o){return this.check(O0(...o))},toLowerCase(){return this.check(P0())},toUpperCase(){return this.check($0())},slugify(){return this.check(C0())}})}),Py=b("ZodString",(e,t)=>{li.init(e,t),td.init(e,t),e.email=r=>e.check(Gw($y,r)),e.url=r=>e.check(Fl(rd,r)),e.jwt=r=>e.check(d0(Vy,r)),e.emoji=r=>e.check(qw(Cy,r)),e.guid=r=>e.check(Ia(ja,r)),e.uuid=r=>e.check(Hw(Tr,r)),e.uuidv4=r=>e.check(Vw(Tr,r)),e.uuidv6=r=>e.check(Kw(Tr,r)),e.uuidv7=r=>e.check(Fw(Tr,r)),e.nanoid=r=>e.check(Xw(Ty,r)),e.guid=r=>e.check(Ia(ja,r)),e.cuid=r=>e.check(Jw(jy,r)),e.cuid2=r=>e.check(Ww(Ny,r)),e.ulid=r=>e.check(Qw(Dy,r)),e.base64=r=>e.check(a0(Yy,r)),e.base64url=r=>e.check(s0(Gy,r)),e.xid=r=>e.check(e0(Ry,r)),e.ksuid=r=>e.check(t0(Zy,r)),e.ipv4=r=>e.check(r0(My,r)),e.ipv6=r=>e.check(o0(By,r)),e.cidrv4=r=>e.check(n0(Ly,r)),e.cidrv6=r=>e.check(i0(Uy,r)),e.e164=r=>e.check(l0(Hy,r)),e.datetime=r=>e.check(cy(r)),e.date=r=>e.check(my(r)),e.time=r=>e.check(by(r)),e.duration=r=>e.check(hy(r))});function oe(e){return Yw(Py,e)}const Y=b("ZodStringFormat",(e,t)=>{B.init(e,t),td.init(e,t)}),$y=b("ZodEmail",(e,t)=>{Kv.init(e,t),Y.init(e,t)}),ja=b("ZodGUID",(e,t)=>{Hv.init(e,t),Y.init(e,t)}),Tr=b("ZodUUID",(e,t)=>{Vv.init(e,t),Y.init(e,t)}),rd=b("ZodURL",(e,t)=>{Fv.init(e,t),Y.init(e,t)});function Sn(e){return Fl(rd,e)}const Cy=b("ZodEmoji",(e,t)=>{qv.init(e,t),Y.init(e,t)}),Ty=b("ZodNanoID",(e,t)=>{Xv.init(e,t),Y.init(e,t)}),jy=b("ZodCUID",(e,t)=>{Jv.init(e,t),Y.init(e,t)}),Ny=b("ZodCUID2",(e,t)=>{Wv.init(e,t),Y.init(e,t)}),Dy=b("ZodULID",(e,t)=>{Qv.init(e,t),Y.init(e,t)}),Ry=b("ZodXID",(e,t)=>{ew.init(e,t),Y.init(e,t)}),Zy=b("ZodKSUID",(e,t)=>{tw.init(e,t),Y.init(e,t)}),My=b("ZodIPv4",(e,t)=>{aw.init(e,t),Y.init(e,t)}),By=b("ZodIPv6",(e,t)=>{sw.init(e,t),Y.init(e,t)}),Ly=b("ZodCIDRv4",(e,t)=>{lw.init(e,t),Y.init(e,t)}),Uy=b("ZodCIDRv6",(e,t)=>{dw.init(e,t),Y.init(e,t)}),Yy=b("ZodBase64",(e,t)=>{cw.init(e,t),Y.init(e,t)}),Gy=b("ZodBase64URL",(e,t)=>{mw.init(e,t),Y.init(e,t)}),Hy=b("ZodE164",(e,t)=>{uw.init(e,t),Y.init(e,t)}),Vy=b("ZodJWT",(e,t)=>{gw.init(e,t),Y.init(e,t)}),od=b("ZodNumber",(e,t)=>{Yl.init(e,t),j.init(e,t),e._zod.processJSONSchema=(o,n,i)=>B0(e,o,n),vr(e,"ZodNumber",{gt(o,n){return this.check($a(o,n))},gte(o,n){return this.check(hn(o,n))},min(o,n){return this.check(hn(o,n))},lt(o,n){return this.check(Pa(o,n))},lte(o,n){return this.check(gn(o,n))},max(o,n){return this.check(gn(o,n))},int(o){return this.check(Na(o))},safe(o){return this.check(Na(o))},positive(o){return this.check($a(0,o))},nonnegative(o){return this.check(hn(0,o))},negative(o){return this.check(Pa(0,o))},nonpositive(o){return this.check(gn(0,o))},multipleOf(o,n){return this.check(Ca(o,n))},step(o,n){return this.check(Ca(o,n))},finite(){return this}});const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function En(e){return b0(od,e)}const Ky=b("ZodNumberFormat",(e,t)=>{hw.init(e,t),od.init(e,t)});function Na(e){return g0(Ky,e)}const Fy=b("ZodBoolean",(e,t)=>{fw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>L0(e,r,o)});function qy(e){return h0(Fy,e)}const Xy=b("ZodUndefined",(e,t)=>{vw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Y0(e,r)});function Jy(e){return f0(Xy,e)}const Wy=b("ZodNull",(e,t)=>{ww.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>U0(e,r,o)});function nd(e){return v0(Wy,e)}const Qy=b("ZodAny",(e,t)=>{yw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>H0()});function v1(){return w0(Qy)}const ex=b("ZodUnknown",(e,t)=>{xw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>V0()});function et(){return y0(ex)}const tx=b("ZodNever",(e,t)=>{kw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>G0(e,r,o)});function id(e){return x0(tx,e)}const rx=b("ZodArray",(e,t)=>{zw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>J0(e,r,o,n),e.element=t.element,vr(e,"ZodArray",{min(r,o){return this.check(Ro(r,o))},nonempty(r){return this.check(Ro(1,r))},max(r,o){return this.check(ql(r,o))},length(r,o){return this.check(Xl(r,o))},unwrap(){return this.element}})});function ad(e,t){return T0(rx,e,t)}const sd=b("ZodObject",(e,t)=>{Aw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>W0(e,r,o,n),P(e,"shape",()=>t.shape),vr(e,"ZodObject",{keyof(){return ax(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:et()})},loose(){return this.clone({...this._zod.def,catchall:et()})},strict(){return this.clone({...this._zod.def,catchall:id()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Mf(this,r)},safeExtend(r){return Bf(this,r)},merge(r){return Lf(this,r)},pick(r){return Rf(this,r)},omit(r){return Zf(this,r)},partial(...r){return Uf(cd,this,r[0])},required(...r){return Yf(pd,this,r[0])}})});function X(e,t){const r={type:"object",shape:e??{},...v(t)};return new sd(r)}function w1(e,t){return new sd({type:"object",shape:e,catchall:et(),...v(t)})}const ld=b("ZodUnion",(e,t)=>{Vl.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Q0(e,r,o,n),e.options=t.options});function di(e,t){return new ld({type:"union",options:e,...v(t)})}const ox=b("ZodDiscriminatedUnion",(e,t)=>{ld.init(e,t),Sw.init(e,t)});function dd(e,t,r){return new ox({type:"union",options:t,discriminator:e,...v(r)})}const nx=b("ZodIntersection",(e,t)=>{Ew.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ey(e,r,o,n)});function ci(e,t){return new nx({type:"intersection",left:e,right:t})}const Da=b("ZodRecord",(e,t)=>{Ow.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ty(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ix(e,t,r){return!t||!t._zod?new Da({type:"record",keyType:oe(),valueType:e,...v(t)}):new Da({type:"record",keyType:e,valueType:t,...v(r)})}const Mo=b("ZodEnum",(e,t)=>{Iw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(o,n,i)=>K0(e,o,n),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{const i={};for(const a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Mo({...t,checks:[],...v(n),entries:i})},e.exclude=(o,n)=>{const i={...t.entries};for(const a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Mo({...t,checks:[],...v(n),entries:i})}});function ax(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Mo({type:"enum",entries:r,...v(t)})}function y1(e,t){return new Mo({type:"enum",entries:e,...v(t)})}const sx=b("ZodLiteral",(e,t)=>{Pw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>F0(e,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function le(e,t){return new sx({type:"literal",values:Array.isArray(e)?e:[e],...v(t)})}const lx=b("ZodTransform",(e,t)=>{$w.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>X0(e,r),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ol(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(lr(i,r.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(lr(a))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function dx(e){return new lx({type:"transform",transform:e})}const cd=b("ZodOptional",(e,t)=>{Kl.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ed(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function tt(e){return new cd({type:"optional",innerType:e})}const cx=b("ZodExactOptional",(e,t)=>{Cw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ed(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function px(e){return new cx({type:"optional",innerType:e})}const mx=b("ZodNullable",(e,t)=>{Tw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ry(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ra(e){return new mx({type:"nullable",innerType:e})}const ux=b("ZodDefault",(e,t)=>{jw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ny(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bx(e,t){return new ux({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$l(t)}})}const gx=b("ZodPrefault",(e,t)=>{Nw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iy(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function hx(e,t){return new gx({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$l(t)}})}const pd=b("ZodNonOptional",(e,t)=>{Dw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oy(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function fx(e,t){return new pd({type:"nonoptional",innerType:e,...v(t)})}const vx=b("ZodCatch",(e,t)=>{Rw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ay(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wx(e,t){return new vx({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const yx=b("ZodPipe",(e,t)=>{Zw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sy(e,r,o,n),e.in=t.in,e.out=t.out});function Za(e,t){return new yx({type:"pipe",in:e,out:t})}const xx=b("ZodReadonly",(e,t)=>{Mw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ly(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kx(e){return new xx({type:"readonly",innerType:e})}const zx=b("ZodCustom",(e,t)=>{Bw.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,n)=>q0(e,r)});function _x(e,t={}){return j0(zx,e,t)}function Ax(e,t){return N0(e,t)}const Sx="party-hint::fingerprint",Ex=`Must be in the form ${Sx}`,Ox=/^[a-zA-Z0-9:_-]*::[a-z0-9]*/;oe().regex(Ox,Ex);Sn({message:"Must be a valid HTTP or HTTPS URL",protocol:/^https?$/}).transform(e=>new URL(e).toString());const Ix=X({method:oe(),params:tt(di([ad(et()),ix(oe(),et())]))}),Px=X({result:tt(et())}),md=X({error:X({code:En(),message:oe(),data:tt(oe().or(En()).or(qy()).or(nd()).or(et()))})}),ud=di([Px,md]),bd=X({jsonrpc:le("2.0"),id:tt(oe().or(En()).or(Jy()).or(nd()))}),$x=ci(bd,Ix),Cx=ci(bd,ud);let Bo=(function(e){return e.SPLICE_WALLET_REQUEST="SPLICE_WALLET_REQUEST",e.SPLICE_WALLET_RESPONSE="SPLICE_WALLET_RESPONSE",e.SPLICE_WALLET_EXT_READY="SPLICE_WALLET_EXT_READY",e.SPLICE_WALLET_EXT_ACK="SPLICE_WALLET_EXT_ACK",e.SPLICE_WALLET_EXT_OPEN="SPLICE_WALLET_EXT_OPEN",e.SPLICE_WALLET_IDP_AUTH_SUCCESS="SPLICE_WALLET_IDP_AUTH_SUCCESS",e.SPLICE_WALLET_LOGOUT="SPLICE_WALLET_LOGOUT",e.SPLICE_WALLET_BROADCAST_ORIGIN="SPLICE_WALLET_BROADCAST_ORIGIN",e.SPLICE_WALLET_BROADCAST_ORIGIN_ACK="SPLICE_WALLET_BROADCAST_ORIGIN_ACK",e})({});const jr=oe().min(1).describe("Optional routing key for browser-extension messaging. When present, only the matching extension should handle the message."),Tx=dd("type",[X({type:le("SPLICE_WALLET_REQUEST"),request:$x,target:jr.optional()}),X({type:le("SPLICE_WALLET_RESPONSE"),response:Cx}),X({type:le("SPLICE_WALLET_EXT_READY"),target:jr.optional()}),X({type:le("SPLICE_WALLET_EXT_ACK"),target:jr.optional()}),X({type:le("SPLICE_WALLET_EXT_OPEN"),url:Sn(),target:jr.optional()}),X({type:le("SPLICE_WALLET_IDP_AUTH_SUCCESS"),token:oe(),sessionId:oe()}),X({type:le("SPLICE_WALLET_BROADCAST_ORIGIN"),origin:Sn()}),X({type:le("SPLICE_WALLET_BROADCAST_ORIGIN_ACK")})]),jx=e=>typeof e=="object"&&e!==null&&"data"in e?Nx(e.data):!1,Nx=e=>Tx.safeParse(e).success;dd("walletType",[X({walletType:le("extension"),providerId:oe().optional(),url:tt(id())}),X({walletType:le("remote"),url:oe().url()})]);X({name:oe()});var gd=class{constructor(e,t){this.url=e,this.accessToken=t}async handleErrorResponse(e){const t=await e.text();let r;try{const o=JSON.parse(t);md.safeParse(o).success&&(r=o)}catch{}throw r!==void 0?r:{error:{code:e.status,message:e.statusText,data:t}}}async submit(e){const t={jsonrpc:"2.0",method:e.method,params:e.params,id:If()},r=this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:void 0,o=await fetch(this.url.href,{method:"POST",headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)return this.handleErrorResponse(o);const n=await o.json(),i=ud.parse(n);if("error"in i)throw i;return i}};function dr(e){"@babel/helpers - typeof";return dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(e)}function Dx(e,t){if(dr(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,t);if(dr(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rx(e){var t=Dx(e,"string");return dr(t)=="symbol"?t:t+""}function Zx(e,t,r){return(t=Rx(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var hd=class{constructor(e){Zx(this,"transport",void 0),this.transport=e}async request(e){const t=await this.transport.submit(e);if("error"in t)throw new Error("RPC error: "+t.error.code+" - "+t.error.message);return t.result}};const Mx="com.splice.wallet.crypto",Bx=1,cr="keys",On="access-token-key";function pi(){return new Promise((e,t)=>{const r=indexedDB.open(Mx,Bx);r.onupgradeneeded=()=>{const o=r.result;o.objectStoreNames.contains(cr)||o.createObjectStore(cr)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}async function Lx(e,t){const r=await pi();return new Promise((o,n)=>{const a=r.transaction(e,"readonly").objectStore(e).get(t);a.onsuccess=()=>o(a.result),a.onerror=()=>n(a.error)})}async function Ux(e,t,r){const o=await pi();return new Promise((n,i)=>{const a=o.transaction(e,"readwrite");a.objectStore(e).put(r,t),a.oncomplete=()=>n(),a.onerror=()=>i(a.error)})}async function Yx(e,t){const r=await pi();return new Promise((o,n)=>{const i=r.transaction(e,"readwrite");i.objectStore(e).delete(t),i.oncomplete=()=>o(),i.onerror=()=>n(i.error)})}let yo=null;function fd(){return yo||(yo=(async()=>{const e=await Lx(cr,On);if(e)return e;const t=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return await Ux(cr,On,t),t})()),yo}async function Gx(e){const t=await fd(),r=crypto.getRandomValues(new Uint8Array(12)),o=new TextEncoder().encode(e),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,o),i={ciphertext:Array.from(new Uint8Array(n)),iv:Array.from(r)};return JSON.stringify(i)}async function Hx(e){const{ciphertext:t,iv:r}=JSON.parse(e),o=await fd(),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(r)},o,new Uint8Array(t));return new TextDecoder().decode(n)}async function Vx(){await Yx(cr,On),yo=null}const Ma="com.splice.wallet.v1";class ve{constructor(){this.state=new Map,this.accessTokenCache=new Map,this.accessToken={get:async t=>{if(this.accessTokenCache.has(t))return this.accessTokenCache.get(t);const r=localStorage.getItem(ve.localStorageKey("accessToken",t));if(r){try{this.accessTokenCache.set(t,await Hx(r))}catch(o){localStorage.removeItem(ve.localStorageKey("accessToken",t)),console.warn(o),this.accessTokenCache.delete(t)}return this.accessTokenCache.get(t)}},set:async(t,r)=>{const o=await Gx(t);localStorage.setItem(ve.localStorageKey("accessToken",r),o),this.accessTokenCache.set(r,t)},clear:async t=>{localStorage.removeItem(ve.localStorageKey("accessToken",t)),this.accessTokenCache.delete(t)}},this.networkId={get:t=>this.getWithStorage("networkId",t),set:(t,r)=>this.setWithStorage("networkId",t,r),clear:t=>this.clearWithStorage("networkId",t)},this.expirationDate={get:t=>this.getWithStorage("expirationDate",t),set:(t,r)=>this.setWithStorage("expirationDate",t,r),clear:t=>this.clearWithStorage("expirationDate",t)},this.intendedPage={get:t=>this.getWithStorage("intendedPage",t),set:(t,r)=>this.setWithStorage("intendedPage",t,r),clear:t=>this.clearWithStorage("intendedPage",t)},this.currentOrigin={get:()=>this.getWithStorage("origin","current",sessionStorage),set:t=>this.setWithStorage("origin",t,"current",sessionStorage),clear:()=>this.clearWithStorage("origin","current",sessionStorage)},this.sessionId={get:t=>this.getWithStorage("sessionId",t),set:(t,r)=>this.setWithStorage("sessionId",t,r),clear:t=>this.clearWithStorage("sessionId",t)};for(const t in localStorage)t.startsWith(Ma)||localStorage.removeItem(t)}static localStorageKey(t,r){return`${Ma}.${r}.${t}`}getWithStorage(t,r,o=localStorage){if(this.state.has(t))return this.state.get(t);const n=o.getItem(ve.localStorageKey(t,r));if(n)return this.state.set(t,n),n}setWithStorage(t,r,o,n=localStorage){n.setItem(ve.localStorageKey(t,o),r),this.state.set(t,r)}clearWithStorage(t,r,o=localStorage){o.removeItem(ve.localStorageKey(t,r)),this.state.delete(t)}async clearAuthState(t){await this.accessToken.clear(t),this.networkId.clear(t),this.expirationDate.clear(t),this.intendedPage.clear(t),this.sessionId.clear(t)}async revokeAccessToken(t){await this.accessToken.clear(t),await Vx()}}const G=new ve,Kx="/parties",Fx="/404",ce="/login",x1="/activities",Ba=5e3,qx=1440*60*1e3;function ye(e){window.location.href=e}const vd=e=>{jx(e)&&(window.opener&&e.source!==window.opener||e.data.type===Bo.SPLICE_WALLET_BROADCAST_ORIGIN&&e.data.origin===e.origin&&(G.currentOrigin.set(e.data.origin),window.opener.postMessage({type:Bo.SPLICE_WALLET_BROADCAST_ORIGIN_ACK},e.origin),window.removeEventListener("message",vd)))};window.addEventListener("message",vd);async function pe(){return window.opener?new Promise(e=>{const t=setInterval(()=>{const r=G.currentOrigin.get();r&&(clearInterval(t),e(r))},100)}):(G.currentOrigin.set(window.origin),window.origin)}let fn=!1,vn=null;const wd=async()=>{const e=new URL(je("/api/v0/user"),window.location.origin);return vn||(vn=fetch(je("/.well-known/wallet-gateway-config")).then(t=>t.json()).then(t=>t?.userApiUrl?new URL(t.userApiUrl):e).catch(t=>(console.warn("Failed to fetch userApiUrl from config, using default",t),e))),vn},xo=async e=>{try{const t=await wd();await new hd(new gd(t,e)).request({method:"removeSession"})}catch(t){console.debug("Failed to remove session: ",t)}},Xx=async()=>{if(fn)return;fn=!0;const e=await pe();try{const t=await G.accessToken.get(e);t&&await xo(t)}finally{await G.clearAuthState(e),fn=!1,He(window.location.pathname)!==ce&&ye(we(ce))}};class Jx extends gd{async handleErrorResponse(t){return t.status===401&&Xx(),super.handleErrorResponse(t)}}const Lo=async e=>{const t=await wd();return new hd(new Jx(t,e))},La=(e,t,r)=>{const o=new be;o.title=e,o.message=t,o.type=r,document.body.appendChild(o)};async function Ua(){const e=new URL(je("/api/v0/dapp"),window.location.origin).toString();try{const t=await fetch(je("/.well-known/wallet-gateway-config"));return t.ok&&(await t.json()).dappApiUrl||e}catch{return e}}var Wx=Object.create,mi=Object.defineProperty,Qx=Object.getOwnPropertyDescriptor,yd=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Mt=e=>{throw TypeError(e)},e1=(e,t,r)=>t in e?mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ya=(e,t)=>mi(e,"name",{value:t,configurable:!0}),ui=e=>[,,,Wx(e?.[yd("metadata")]??null)],xd=["class","method","getter","setter","accessor","field","value","get","set"],Ft=e=>e!==void 0&&typeof e!="function"?Mt("Function expected"):e,t1=(e,t,r,o,n)=>({kind:xd[e],name:t,metadata:o,addInitializer:i=>r._?Mt("Already initialized"):n.push(Ft(i||null))}),r1=(e,t)=>e1(t,yd("metadata"),e[3]),de=(e,t,r,o)=>{for(var n=0,i=e[t>>1],a=i&&i.length;n<a;n++)t&1?i[n].call(r):o=i[n].call(r,o);return o},lt=(e,t,r,o,n,i)=>{var a,s,l,d,c,p=t&7,u=!!(t&8),h=!!(t&16),y=p>3?e.length+1:p?u?1:2:0,A=xd[p+5],C=p>3&&(e[y-1]=[]),Ue=e[y]||(e[y]=[]),R=p&&(!h&&!u&&(n=n.prototype),p<5&&(p>3||!h)&&Qx(p<4?n:{get[r](){return Ga(this,i)},set[r](k){return Ha(this,i,k)}},r));p?h&&p<4&&Ya(i,(p>2?"set ":p>1?"get ":"")+r):Ya(n,r);for(var S=o.length-1;S>=0;S--)d=t1(p,r,l={},e[3],Ue),p&&(d.static=u,d.private=h,c=d.access={has:h?k=>o1(n,k):k=>r in k},p^3&&(c.get=h?k=>(p^1?Ga:n1)(k,n,p^4?i:R.get):k=>k[r]),p>2&&(c.set=h?(k,Z)=>Ha(k,n,Z,p^4?i:R.set):(k,Z)=>k[r]=Z)),s=(0,o[S])(p?p<4?h?i:R[A]:p>4?void 0:{get:R.get,set:R.set}:n,d),l._=1,p^4||s===void 0?Ft(s)&&(p>4?C.unshift(s):p?h?i=s:R[A]=s:n=s):typeof s!="object"||s===null?Mt("Object expected"):(Ft(a=s.get)&&(R.get=a),Ft(a=s.set)&&(R.set=a),Ft(a=s.init)&&C.unshift(a));return p||r1(e,n),R&&mi(n,r,R),h?p^4?i:R:n},bi=(e,t,r)=>t.has(e)||Mt("Cannot "+r),o1=(e,t)=>Object(t)!==t?Mt('Cannot use the "in" operator on this value'):e.has(t),Ga=(e,t,r)=>(bi(e,t,"read from private field"),r?r.call(e):t.get(e)),Nr=(e,t,r)=>t.has(e)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ha=(e,t,r,o)=>(bi(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),n1=(e,t,r)=>(bi(e,t,"access private method"),r),kd,zd,_d,Ad,In,Sd,Q,gi,hi,fi,vi,Ed,wi,Od,Id,yi,Pd;const $d=document.createElement("style");$d.textContent=`
4918
4918
  html,
4919
4919
  body {
4920
4920
  margin: 0;