@cartridge/controller 0.11.2-alpha.4 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { WalletAccount as Rt, constants as K, num as nt, shortString as Oe } from "starknet";
2
- import { R as Q, t as Ut, i as Tt, K as be, B as zt, N as E, p as Lt, v as Dt, A as Ot } from "./provider-Baak9Kvr.js";
3
- import { a as Xn, d as Jn, E as Zn, f as es, e as ts, F as rs, I as ns, h as ss, n as os, b as is, c as as } from "./provider-Baak9Kvr.js";
4
- class Me extends Rt {
1
+ import { WalletAccount as Rt, constants as K, num as rt, shortString as De } from "starknet";
2
+ import { R as Q, t as Ut, i as Tt, K as nt, B as zt, N as x, p as Lt, v as Dt, A as Ot } from "./provider-s-80NdXp.js";
3
+ import { a as Xn, d as Jn, E as Zn, f as es, e as ts, F as rs, I as ns, h as ss, n as os, b as is, c as as } from "./provider-s-80NdXp.js";
4
+ class Oe extends Rt {
5
5
  keychain;
6
6
  modal;
7
7
  options;
@@ -89,10 +89,10 @@ var G;
89
89
  (function(t) {
90
90
  t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
91
91
  })(G || (G = {}));
92
- var _e;
92
+ var be;
93
93
  (function(t) {
94
94
  t.DataCloneError = "DataCloneError";
95
- })(_e || (_e = {}));
95
+ })(be || (be = {}));
96
96
  var U;
97
97
  (function(t) {
98
98
  t.Message = "message";
@@ -123,7 +123,7 @@ const Mt = (t, e) => {
123
123
  r ? (n = r[1] ? r[1] : e.protocol, s = r[2], o = r[4]) : (n = e.protocol, s = e.hostname, o = e.port);
124
124
  const i = o && o !== Ft[n] ? `:${o}` : "";
125
125
  return `${n}//${s}${i}`;
126
- }, Qe = ({ name: t, message: e, stack: r }) => ({
126
+ }, Me = ({ name: t, message: e, stack: r }) => ({
127
127
  name: t,
128
128
  message: e,
129
129
  stack: r
@@ -142,7 +142,7 @@ const Mt = (t, e) => {
142
142
  }
143
143
  const h = d.data, { methodName: f, args: u, id: w } = h;
144
144
  r(`${n}: Received ${f}() call`);
145
- const b = (p) => (v) => {
145
+ const b = (y) => (m) => {
146
146
  if (r(`${n}: Sending ${f}() reply`), l) {
147
147
  r(`${n}: Unable to send ${f}() reply due to destroyed connection`);
148
148
  return;
@@ -150,27 +150,27 @@ const Mt = (t, e) => {
150
150
  const k = {
151
151
  penpal: B.Reply,
152
152
  id: w,
153
- resolution: p,
154
- returnValue: v
153
+ resolution: y,
154
+ returnValue: m
155
155
  };
156
- p === z.Rejected && v instanceof Error && (k.returnValue = Qe(v), k.returnValueIsError = !0);
156
+ y === z.Rejected && m instanceof Error && (k.returnValue = Me(m), k.returnValueIsError = !0);
157
157
  try {
158
158
  o.postMessage(k, i);
159
- } catch (y) {
160
- if (y.name === _e.DataCloneError) {
161
- const x = {
159
+ } catch (p) {
160
+ if (p.name === be.DataCloneError) {
161
+ const v = {
162
162
  penpal: B.Reply,
163
163
  id: w,
164
164
  resolution: z.Rejected,
165
- returnValue: Qe(y),
165
+ returnValue: Me(p),
166
166
  returnValueIsError: !0
167
167
  };
168
- o.postMessage(x, i);
168
+ o.postMessage(v, i);
169
169
  }
170
- throw y;
170
+ throw p;
171
171
  }
172
172
  };
173
- new Promise((p) => p(e[f].call(e, d.origin).apply(e, u))).then(b(z.Fulfilled), b(z.Rejected));
173
+ new Promise((y) => y(e[f].call(e, d.origin).apply(e, u))).then(b(z.Fulfilled), b(z.Rejected));
174
174
  };
175
175
  return s.addEventListener(U.Message, c), () => {
176
176
  l = !0, s.removeEventListener(U.Message, c);
@@ -207,11 +207,11 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
207
207
  b = !0;
208
208
  }
209
209
  if (b && n(), d) {
210
- const p = new Error(`Unable to send ${u}() call due to destroyed connection`);
211
- throw p.code = G.ConnectionDestroyed, p;
210
+ const y = new Error(`Unable to send ${u}() call due to destroyed connection`);
211
+ throw y.code = G.ConnectionDestroyed, y;
212
212
  }
213
- return new Promise((p, v) => {
214
- const k = qt(), y = (C) => {
213
+ return new Promise((y, m) => {
214
+ const k = qt(), p = (C) => {
215
215
  if (C.source !== a || C.data.penpal !== B.Reply || C.data.id !== k)
216
216
  return;
217
217
  if (c !== "*" && C.origin !== c) {
@@ -219,18 +219,18 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
219
219
  return;
220
220
  }
221
221
  const de = C.data;
222
- s(`${o}: Received ${u}() reply`), i.removeEventListener(U.Message, y);
222
+ s(`${o}: Received ${u}() reply`), i.removeEventListener(U.Message, p);
223
223
  let he = de.returnValue;
224
- de.returnValueIsError && (he = Ht(he)), (de.resolution === z.Fulfilled ? p : v)(he);
224
+ de.returnValueIsError && (he = Ht(he)), (de.resolution === z.Fulfilled ? y : m)(he);
225
225
  };
226
- i.addEventListener(U.Message, y);
227
- const x = {
226
+ i.addEventListener(U.Message, p);
227
+ const v = {
228
228
  penpal: B.Call,
229
229
  id: k,
230
230
  methodName: u,
231
231
  args: w
232
232
  };
233
- a.postMessage(x, l);
233
+ a.postMessage(v, l);
234
234
  });
235
235
  }, f = r.reduce((u, w) => (u[w] = h(w), u), {});
236
236
  return Object.assign(t, Zt(f)), () => {
@@ -298,22 +298,22 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
298
298
  n || (ir(e), n = Yt(e.src));
299
299
  const d = n === "null" ? "*" : n, h = it(r), f = rr(i, h, n, d), u = tr(h, n, d, a, i);
300
300
  return {
301
- promise: new Promise((b, p) => {
302
- const v = or(s, c), k = (y) => {
303
- if (!(y.source !== e.contentWindow || !y.data)) {
304
- if (y.data.penpal === B.Syn) {
305
- f(y);
301
+ promise: new Promise((b, y) => {
302
+ const m = or(s, c), k = (p) => {
303
+ if (!(p.source !== e.contentWindow || !p.data)) {
304
+ if (p.data.penpal === B.Syn) {
305
+ f(p);
306
306
  return;
307
307
  }
308
- if (y.data.penpal === B.Ack) {
309
- const x = u(y);
310
- x && (v(), b(x));
308
+ if (p.data.penpal === B.Ack) {
309
+ const v = u(p);
310
+ v && (m(), b(v));
311
311
  return;
312
312
  }
313
313
  }
314
314
  };
315
- window.addEventListener(U.Message, k), i("Parent: Awaiting handshake"), sr(e, a), l((y) => {
316
- window.removeEventListener(U.Message, k), y && p(y);
315
+ window.addEventListener(U.Message, k), i("Parent: Awaiting handshake"), sr(e, a), l((p) => {
316
+ window.removeEventListener(U.Message, k), p && y(p);
317
317
  });
318
318
  }),
319
319
  destroy() {
@@ -415,7 +415,7 @@ class cr {
415
415
  }
416
416
  }
417
417
  const lr = "6.13.7";
418
- function Fe(t, e, r) {
418
+ function Qe(t, e, r) {
419
419
  for (let n in e) {
420
420
  let s = e[n];
421
421
  Object.defineProperty(t, n, { enumerable: !0, value: s, writable: !1 });
@@ -480,7 +480,7 @@ function dr(t, e, r) {
480
480
  default:
481
481
  s = new Error(t);
482
482
  }
483
- return Fe(s, { code: e }), r && Object.assign(s, r), s.shortMessage == null && Fe(s, { shortMessage: n }), s;
483
+ return Qe(s, { code: e }), r && Object.assign(s, r), s.shortMessage == null && Qe(s, { shortMessage: n }), s;
484
484
  }
485
485
  function hr(t, e, r, n) {
486
486
  if (!t)
@@ -512,16 +512,16 @@ function fr(t, e, r) {
512
512
  }
513
513
  Y(!1, "invalid BytesLike value", e || "value", t);
514
514
  }
515
- function $e(t, e) {
515
+ function xe(t, e) {
516
516
  return fr(t, e);
517
517
  }
518
- const We = "0123456789abcdef";
518
+ const Fe = "0123456789abcdef";
519
519
  function ur(t) {
520
- const e = $e(t);
520
+ const e = xe(t);
521
521
  let r = "0x";
522
522
  for (let n = 0; n < e.length; n++) {
523
523
  const s = e[n];
524
- r += We[(s & 240) >> 4] + We[s & 15];
524
+ r += Fe[(s & 240) >> 4] + Fe[s & 15];
525
525
  }
526
526
  return r;
527
527
  }
@@ -529,7 +529,7 @@ function ur(t) {
529
529
  function wr(t) {
530
530
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
531
531
  }
532
- function je(t) {
532
+ function We(t) {
533
533
  if (!Number.isSafeInteger(t) || t < 0)
534
534
  throw new Error("positive integer expected, got " + t);
535
535
  }
@@ -539,7 +539,7 @@ function re(t, ...e) {
539
539
  if (e.length > 0 && !e.includes(t.length))
540
540
  throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
541
541
  }
542
- function Ye(t, e = !0) {
542
+ function je(t, e = !0) {
543
543
  if (t.destroyed)
544
544
  throw new Error("Hash instance has been destroyed");
545
545
  if (e && t.finished)
@@ -558,16 +558,16 @@ function at(...t) {
558
558
  for (let e = 0; e < t.length; e++)
559
559
  t[e].fill(0);
560
560
  }
561
- const yr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
562
- function mr(t) {
561
+ const mr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
562
+ function yr(t) {
563
563
  return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
564
564
  }
565
565
  function br(t) {
566
566
  for (let e = 0; e < t.length; e++)
567
- t[e] = mr(t[e]);
567
+ t[e] = yr(t[e]);
568
568
  return t;
569
569
  }
570
- const He = yr ? (t) => t : br;
570
+ const Ye = mr ? (t) => t : br;
571
571
  function _r(t) {
572
572
  if (typeof t != "string")
573
573
  throw new Error("string expected");
@@ -582,9 +582,9 @@ function Ar(t) {
582
582
  const e = (n) => t().update(ct(n)).digest(), r = t();
583
583
  return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e;
584
584
  }
585
- const Z = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ve = /* @__PURE__ */ BigInt(32);
585
+ const Z = /* @__PURE__ */ BigInt(2 ** 32 - 1), He = /* @__PURE__ */ BigInt(32);
586
586
  function Er(t, e = !1) {
587
- return e ? { h: Number(t & Z), l: Number(t >> Ve & Z) } : { h: Number(t >> Ve & Z) | 0, l: Number(t & Z) | 0 };
587
+ return e ? { h: Number(t & Z), l: Number(t >> He & Z) } : { h: Number(t >> He & Z) | 0, l: Number(t & Z) | 0 };
588
588
  }
589
589
  function vr(t, e = !1) {
590
590
  const r = t.length;
@@ -603,20 +603,20 @@ for (let t = 0, e = j, r = 1, n = 0; t < 24; t++) {
603
603
  e = (e << j ^ (e >> Br) * Rr) % Nr, e & Pr && (s ^= j << (j << /* @__PURE__ */ BigInt(o)) - j);
604
604
  ht.push(s);
605
605
  }
606
- const ft = vr(ht, !0), Ur = ft[0], Tr = ft[1], Ke = (t, e, r) => r > 32 ? Ir(t, e, r) : xr(t, e, r), qe = (t, e, r) => r > 32 ? Sr(t, e, r) : $r(t, e, r);
606
+ const ft = vr(ht, !0), Ur = ft[0], Tr = ft[1], Ve = (t, e, r) => r > 32 ? Ir(t, e, r) : xr(t, e, r), Ke = (t, e, r) => r > 32 ? Sr(t, e, r) : $r(t, e, r);
607
607
  function zr(t, e = 24) {
608
608
  const r = new Uint32Array(10);
609
609
  for (let n = 24 - e; n < 24; n++) {
610
610
  for (let i = 0; i < 10; i++)
611
611
  r[i] = t[i] ^ t[i + 10] ^ t[i + 20] ^ t[i + 30] ^ t[i + 40];
612
612
  for (let i = 0; i < 10; i += 2) {
613
- const a = (i + 8) % 10, l = (i + 2) % 10, c = r[l], d = r[l + 1], h = Ke(c, d, 1) ^ r[a], f = qe(c, d, 1) ^ r[a + 1];
613
+ const a = (i + 8) % 10, l = (i + 2) % 10, c = r[l], d = r[l + 1], h = Ve(c, d, 1) ^ r[a], f = Ke(c, d, 1) ^ r[a + 1];
614
614
  for (let u = 0; u < 50; u += 10)
615
615
  t[i + u] ^= h, t[i + u + 1] ^= f;
616
616
  }
617
617
  let s = t[2], o = t[3];
618
618
  for (let i = 0; i < 24; i++) {
619
- const a = dt[i], l = Ke(s, o, a), c = qe(s, o, a), d = lt[i];
619
+ const a = dt[i], l = Ve(s, o, a), c = Ke(s, o, a), d = lt[i];
620
620
  s = t[d], o = t[d + 1], t[d] = l, t[d + 1] = c;
621
621
  }
622
622
  for (let i = 0; i < 50; i += 10) {
@@ -629,10 +629,10 @@ function zr(t, e = 24) {
629
629
  }
630
630
  at(r);
631
631
  }
632
- class Ie extends kr {
632
+ class $e extends kr {
633
633
  // NOTE: we accept arguments in bytes instead of bits here.
634
634
  constructor(e, r, n, s = !1, o = 24) {
635
- if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = s, this.rounds = o, je(n), !(0 < e && e < 200))
635
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = s, this.rounds = o, We(n), !(0 < e && e < 200))
636
636
  throw new Error("only keccak-f1600 function is supported");
637
637
  this.state = new Uint8Array(200), this.state32 = pr(this.state);
638
638
  }
@@ -640,10 +640,10 @@ class Ie extends kr {
640
640
  return this._cloneInto();
641
641
  }
642
642
  keccak() {
643
- He(this.state32), zr(this.state32, this.rounds), He(this.state32), this.posOut = 0, this.pos = 0;
643
+ Ye(this.state32), zr(this.state32, this.rounds), Ye(this.state32), this.posOut = 0, this.pos = 0;
644
644
  }
645
645
  update(e) {
646
- Ye(this), e = ct(e), re(e);
646
+ je(this), e = ct(e), re(e);
647
647
  const { blockLen: r, state: n } = this, s = e.length;
648
648
  for (let o = 0; o < s; ) {
649
649
  const i = Math.min(r - this.pos, s - o);
@@ -661,7 +661,7 @@ class Ie extends kr {
661
661
  e[n] ^= r, (r & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
662
662
  }
663
663
  writeInto(e) {
664
- Ye(this, !1), re(e), this.finish();
664
+ je(this, !1), re(e), this.finish();
665
665
  const r = this.state, { blockLen: n } = this;
666
666
  for (let s = 0, o = e.length; s < o; ) {
667
667
  this.posOut >= n && this.keccak();
@@ -676,7 +676,7 @@ class Ie extends kr {
676
676
  return this.writeInto(e);
677
677
  }
678
678
  xof(e) {
679
- return je(e), this.xofInto(new Uint8Array(e));
679
+ return We(e), this.xofInto(new Uint8Array(e));
680
680
  }
681
681
  digestInto(e) {
682
682
  if (gr(e, this), this.finished)
@@ -691,17 +691,17 @@ class Ie extends kr {
691
691
  }
692
692
  _cloneInto(e) {
693
693
  const { blockLen: r, suffix: n, outputLen: s, rounds: o, enableXOF: i } = this;
694
- return e || (e = new Ie(r, n, s, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = n, e.outputLen = s, e.enableXOF = i, e.destroyed = this.destroyed, e;
694
+ return e || (e = new $e(r, n, s, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = n, e.outputLen = s, e.enableXOF = i, e.destroyed = this.destroyed, e;
695
695
  }
696
696
  }
697
- const Lr = (t, e, r) => Ar(() => new Ie(e, t, r)), Dr = Lr(1, 136, 256 / 8);
697
+ const Lr = (t, e, r) => Ar(() => new $e(e, t, r)), Dr = Lr(1, 136, 256 / 8);
698
698
  let ut = !1;
699
699
  const wt = function(t) {
700
700
  return Dr(t);
701
701
  };
702
702
  let gt = wt;
703
703
  function X(t) {
704
- const e = $e(t, "data");
704
+ const e = xe(t, "data");
705
705
  return ur(gt(e));
706
706
  }
707
707
  X._ = wt;
@@ -715,27 +715,27 @@ X.register = function(t) {
715
715
  };
716
716
  Object.freeze(X);
717
717
  const Or = BigInt(0), Mr = BigInt(36);
718
- function Ge(t) {
718
+ function qe(t) {
719
719
  t = t.toLowerCase();
720
720
  const e = t.substring(2).split(""), r = new Uint8Array(40);
721
721
  for (let s = 0; s < 40; s++)
722
722
  r[s] = e[s].charCodeAt(0);
723
- const n = $e(X(r));
723
+ const n = xe(X(r));
724
724
  for (let s = 0; s < 40; s += 2)
725
725
  n[s >> 1] >> 4 >= 8 && (e[s] = e[s].toUpperCase()), (n[s >> 1] & 15) >= 8 && (e[s + 1] = e[s + 1].toUpperCase());
726
726
  return "0x" + e.join("");
727
727
  }
728
- const Se = {};
728
+ const Ie = {};
729
729
  for (let t = 0; t < 10; t++)
730
- Se[String(t)] = String(t);
730
+ Ie[String(t)] = String(t);
731
731
  for (let t = 0; t < 26; t++)
732
- Se[String.fromCharCode(65 + t)] = String(10 + t);
733
- const Xe = 15;
732
+ Ie[String.fromCharCode(65 + t)] = String(10 + t);
733
+ const Ge = 15;
734
734
  function Qr(t) {
735
735
  t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00";
736
- let e = t.split("").map((n) => Se[n]).join("");
737
- for (; e.length >= Xe; ) {
738
- let n = e.substring(0, Xe);
736
+ let e = t.split("").map((n) => Ie[n]).join("");
737
+ for (; e.length >= Ge; ) {
738
+ let n = e.substring(0, Ge);
739
739
  e = parseInt(n, 10) % 97 + e.substring(n.length);
740
740
  }
741
741
  let r = String(98 - parseInt(e, 10) % 97);
@@ -761,7 +761,7 @@ function Wr(t) {
761
761
  function N(t) {
762
762
  if (Y(typeof t == "string", "invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
763
763
  t.startsWith("0x") || (t = "0x" + t);
764
- const e = Ge(t);
764
+ const e = qe(t);
765
765
  return Y(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === t, "bad address checksum", "address", t), e;
766
766
  }
767
767
  if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
@@ -769,7 +769,7 @@ function N(t) {
769
769
  let e = Wr(t.substring(4)).toString(16);
770
770
  for (; e.length < 40; )
771
771
  e = "0" + e;
772
- return Ge("0x" + e);
772
+ return qe("0x" + e);
773
773
  }
774
774
  Y(!1, "invalid address", "address", t);
775
775
  }
@@ -964,10 +964,10 @@ const Vr = {
964
964
  [K.StarknetChainId.SN_MAIN]: "starknet",
965
965
  [K.StarknetChainId.SN_SEPOLIA]: "starknet"
966
966
  }, fe = (t) => {
967
- const e = nt.toHex(t), r = Vr[e];
967
+ const e = rt.toHex(t), r = Vr[e];
968
968
  return r || console.warn(`Unknown chain ID: ${e}`), r;
969
969
  };
970
- class Ce {
970
+ class Se {
971
971
  platform;
972
972
  account = void 0;
973
973
  store = Hr();
@@ -1226,27 +1226,27 @@ class Ce {
1226
1226
  }
1227
1227
  }
1228
1228
  }
1229
- class Kr extends Ce {
1229
+ class Kr extends Se {
1230
1230
  type = "base";
1231
1231
  rdns = "com.coinbase.wallet";
1232
1232
  displayName = "Base Wallet";
1233
1233
  }
1234
- class qr extends Ce {
1234
+ class qr extends Se {
1235
1235
  type = "metamask";
1236
1236
  rdns = "io.metamask";
1237
1237
  displayName = "MetaMask";
1238
1238
  }
1239
1239
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1240
- function Pe(t) {
1240
+ function Ce(t) {
1241
1241
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
1242
1242
  }
1243
1243
  function pt(t, ...e) {
1244
- if (!Pe(t))
1244
+ if (!Ce(t))
1245
1245
  throw new Error("Uint8Array expected");
1246
1246
  if (e.length > 0 && !e.includes(t.length))
1247
1247
  throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
1248
1248
  }
1249
- function yt(t, e) {
1249
+ function mt(t, e) {
1250
1250
  return Array.isArray(e) ? e.length === 0 ? !0 : t ? e.every((r) => typeof r == "string") : e.every((r) => Number.isSafeInteger(r)) : !1;
1251
1251
  }
1252
1252
  function Gr(t) {
@@ -1268,20 +1268,20 @@ function ne(t) {
1268
1268
  throw new Error("array expected");
1269
1269
  }
1270
1270
  function se(t, e) {
1271
- if (!yt(!0, e))
1271
+ if (!mt(!0, e))
1272
1272
  throw new Error(`${t}: array of strings expected`);
1273
1273
  }
1274
- function mt(t, e) {
1275
- if (!yt(!1, e))
1274
+ function yt(t, e) {
1275
+ if (!mt(!1, e))
1276
1276
  throw new Error(`${t}: array of numbers expected`);
1277
1277
  }
1278
1278
  // @__NO_SIDE_EFFECTS__
1279
- function Be(...t) {
1279
+ function Pe(...t) {
1280
1280
  const e = (o) => o, r = (o, i) => (a) => o(i(a)), n = t.map((o) => o.encode).reduceRight(r, e), s = t.map((o) => o.decode).reduce(r, e);
1281
1281
  return { encode: n, decode: s };
1282
1282
  }
1283
1283
  // @__NO_SIDE_EFFECTS__
1284
- function Ne(t) {
1284
+ function Be(t) {
1285
1285
  const e = typeof t == "string" ? t.split("") : t, r = e.length;
1286
1286
  se("alphabet", e);
1287
1287
  const n = new Map(e.map((s, o) => [s, o]));
@@ -1301,7 +1301,7 @@ function Ne(t) {
1301
1301
  };
1302
1302
  }
1303
1303
  // @__NO_SIDE_EFFECTS__
1304
- function Re(t = "") {
1304
+ function Ne(t = "") {
1305
1305
  return W("join", t), {
1306
1306
  encode: (e) => (se("join.decode", e), e.join(t)),
1307
1307
  decode: (e) => (W("join.decode", e), e.split(t))
@@ -1331,7 +1331,7 @@ function Xr(t, e = "=") {
1331
1331
  function Jr(t) {
1332
1332
  return Gr(t), { encode: (e) => e, decode: (e) => t(e) };
1333
1333
  }
1334
- function Je(t, e, r) {
1334
+ function Xe(t, e, r) {
1335
1335
  if (e < 2)
1336
1336
  throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);
1337
1337
  if (r < 2)
@@ -1372,7 +1372,7 @@ const bt = (t, e) => e === 0 ? t : bt(e, t % e), oe = /* @__NO_SIDE_EFFECTS__ */
1372
1372
  t.push(2 ** e);
1373
1373
  return t;
1374
1374
  })();
1375
- function Ze(t, e, r, n) {
1375
+ function Je(t, e, r, n) {
1376
1376
  if (ne(t), e <= 0 || e > 32)
1377
1377
  throw new Error(`convertRadix2: wrong from=${e}`);
1378
1378
  if (r <= 0 || r > 32)
@@ -1405,11 +1405,11 @@ function Zr(t) {
1405
1405
  const e = 2 ** 8;
1406
1406
  return {
1407
1407
  encode: (r) => {
1408
- if (!Pe(r))
1408
+ if (!Ce(r))
1409
1409
  throw new Error("radix.encode input should be Uint8Array");
1410
- return Je(Array.from(r), e, t);
1410
+ return Xe(Array.from(r), e, t);
1411
1411
  },
1412
- decode: (r) => (mt("radix.decode", r), Uint8Array.from(Je(r, t, e)))
1412
+ decode: (r) => (yt("radix.decode", r), Uint8Array.from(Xe(r, t, e)))
1413
1413
  };
1414
1414
  }
1415
1415
  // @__NO_SIDE_EFFECTS__
@@ -1420,11 +1420,11 @@ function _t(t, e = !1) {
1420
1420
  throw new Error("radix2: carry overflow");
1421
1421
  return {
1422
1422
  encode: (r) => {
1423
- if (!Pe(r))
1423
+ if (!Ce(r))
1424
1424
  throw new Error("radix2.encode input should be Uint8Array");
1425
- return Ze(Array.from(r), 8, t, !e);
1425
+ return Je(Array.from(r), 8, t, !e);
1426
1426
  },
1427
- decode: (r) => (mt("radix2.decode", r), Uint8Array.from(Ze(r, t, 8, e)))
1427
+ decode: (r) => (yt("radix2.decode", r), Uint8Array.from(Je(r, t, 8, e)))
1428
1428
  };
1429
1429
  }
1430
1430
  const en = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", tn = en ? {
@@ -1434,7 +1434,7 @@ const en = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Arra
1434
1434
  decode(t) {
1435
1435
  return W("base64", t), Uint8Array.fromBase64(t, { lastChunkHandling: "strict" });
1436
1436
  }
1437
- } : /* @__PURE__ */ Be(/* @__PURE__ */ _t(6), /* @__PURE__ */ Ne("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ Xr(6), /* @__PURE__ */ Re("")), rn = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Be(/* @__PURE__ */ Zr(58), /* @__PURE__ */ Ne(t), /* @__PURE__ */ Re("")), ke = /* @__PURE__ */ rn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), nn = {
1437
+ } : /* @__PURE__ */ Pe(/* @__PURE__ */ _t(6), /* @__PURE__ */ Be("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ Xr(6), /* @__PURE__ */ Ne("")), rn = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Pe(/* @__PURE__ */ Zr(58), /* @__PURE__ */ Be(t), /* @__PURE__ */ Ne("")), _e = /* @__PURE__ */ rn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), nn = {
1438
1438
  encode: (t) => new TextDecoder().decode(t),
1439
1439
  decode: (t) => new TextEncoder().encode(t)
1440
1440
  }, sn = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", on = {
@@ -1444,12 +1444,12 @@ const en = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Arra
1444
1444
  decode(t) {
1445
1445
  return W("hex", t), Uint8Array.fromHex(t);
1446
1446
  }
1447
- }, we = sn ? on : /* @__PURE__ */ Be(/* @__PURE__ */ _t(4), /* @__PURE__ */ Ne("0123456789abcdef"), /* @__PURE__ */ Re(""), /* @__PURE__ */ Jr((t) => {
1447
+ }, we = sn ? on : /* @__PURE__ */ Pe(/* @__PURE__ */ _t(4), /* @__PURE__ */ Be("0123456789abcdef"), /* @__PURE__ */ Ne(""), /* @__PURE__ */ Jr((t) => {
1448
1448
  if (typeof t != "string" || t.length % 2 !== 0)
1449
1449
  throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);
1450
1450
  return t.toLowerCase();
1451
1451
  }));
1452
- function Ae(t, e) {
1452
+ function ke(t, e) {
1453
1453
  if (t.length !== e.length)
1454
1454
  return !1;
1455
1455
  for (let r = 0; r < t.length; r++)
@@ -1487,17 +1487,17 @@ const At = (t) => {
1487
1487
  return r;
1488
1488
  }
1489
1489
  };
1490
- }, A = {
1490
+ }, E = {
1491
1491
  BITS: 32,
1492
1492
  FULL_MASK: -1 >>> 0,
1493
1493
  // 1<<32 will overflow
1494
1494
  len: (t) => Math.ceil(t / 32),
1495
- create: (t) => new Uint32Array(A.len(t)),
1495
+ create: (t) => new Uint32Array(E.len(t)),
1496
1496
  clean: (t) => t.fill(0),
1497
1497
  debug: (t) => Array.from(t).map((e) => (e >>> 0).toString(2).padStart(32, "0")),
1498
1498
  checkLen: (t, e) => {
1499
- if (A.len(e) !== t.length)
1500
- throw new Error(`wrong length=${t.length}. Expected: ${A.len(e)}`);
1499
+ if (E.len(e) !== t.length)
1500
+ throw new Error(`wrong length=${t.length}. Expected: ${E.len(e)}`);
1501
1501
  },
1502
1502
  chunkLen: (t, e, r) => {
1503
1503
  if (e < 0)
@@ -1511,8 +1511,8 @@ const At = (t) => {
1511
1511
  mask: 1 << 32 - (t + e) % 32 - 1
1512
1512
  }),
1513
1513
  indices: (t, e, r = !1) => {
1514
- A.checkLen(t, e);
1515
- const { FULL_MASK: n, BITS: s } = A, o = s - e % s, i = o ? n >>> o << o : n, a = [];
1514
+ E.checkLen(t, e);
1515
+ const { FULL_MASK: n, BITS: s } = E, o = s - e % s, i = o ? n >>> o << o : n, a = [];
1516
1516
  for (let l = 0; l < t.length; l++) {
1517
1517
  let c = t[l];
1518
1518
  if (r && (c = ~c), l === t.length - 1 && (c &= i), c !== 0)
@@ -1530,19 +1530,19 @@ const At = (t) => {
1530
1530
  r === void 0 || n !== r.pos + r.length ? e.push(r = { pos: n, length: 1 }) : r.length += 1;
1531
1531
  return e;
1532
1532
  },
1533
- rangeDebug: (t, e, r = !1) => `[${A.range(A.indices(t, e, r)).map((n) => `(${n.pos}/${n.length})`).join(", ")}]`,
1533
+ rangeDebug: (t, e, r = !1) => `[${E.range(E.indices(t, e, r)).map((n) => `(${n.pos}/${n.length})`).join(", ")}]`,
1534
1534
  setRange: (t, e, r, n, s = !0) => {
1535
- A.chunkLen(e, r, n);
1536
- const { FULL_MASK: o, BITS: i } = A, a = r % i ? Math.floor(r / i) : void 0, l = r + n, c = l % i ? Math.floor(l / i) : void 0;
1535
+ E.chunkLen(e, r, n);
1536
+ const { FULL_MASK: o, BITS: i } = E, a = r % i ? Math.floor(r / i) : void 0, l = r + n, c = l % i ? Math.floor(l / i) : void 0;
1537
1537
  if (a !== void 0 && a === c)
1538
- return A.set(t, a, o >>> i - n << i - n - r, s);
1539
- if (a !== void 0 && !A.set(t, a, o >>> r % i, s))
1538
+ return E.set(t, a, o >>> i - n << i - n - r, s);
1539
+ if (a !== void 0 && !E.set(t, a, o >>> r % i, s))
1540
1540
  return !1;
1541
1541
  const d = a !== void 0 ? a + 1 : r / i, h = c !== void 0 ? c : l / i;
1542
1542
  for (let f = d; f < h; f++)
1543
- if (!A.set(t, f, o, s))
1543
+ if (!E.set(t, f, o, s))
1544
1544
  return !1;
1545
- return !(c !== void 0 && a !== c && !A.set(t, c, o << i - l % i, s));
1545
+ return !(c !== void 0 && a !== c && !E.set(t, c, o << i - l % i, s));
1546
1546
  }
1547
1547
  }, D = {
1548
1548
  /**
@@ -1583,7 +1583,7 @@ const At = (t) => {
1583
1583
  return o;
1584
1584
  }
1585
1585
  };
1586
- class Ue {
1586
+ class Re {
1587
1587
  constructor(e, r = {}, n = [], s = void 0, o = 0) {
1588
1588
  this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = r, this.stack = n, this.parent = s, this.parentOffset = o, this.view = kt(e);
1589
1589
  }
@@ -1591,10 +1591,10 @@ class Ue {
1591
1591
  _enablePointers() {
1592
1592
  if (this.parent)
1593
1593
  return this.parent._enablePointers();
1594
- this.bs || (this.bs = A.create(this.data.length), A.setRange(this.bs, this.data.length, 0, this.pos, this.opts.allowMultipleReads));
1594
+ this.bs || (this.bs = E.create(this.data.length), E.setRange(this.bs, this.data.length, 0, this.pos, this.opts.allowMultipleReads));
1595
1595
  }
1596
1596
  markBytesBS(e, r) {
1597
- return this.parent ? this.parent.markBytesBS(this.parentOffset + e, r) : !r || !this.bs ? !0 : A.setRange(this.bs, this.data.length, e, r, !1);
1597
+ return this.parent ? this.parent.markBytesBS(this.parentOffset + e, r) : !r || !this.bs ? !0 : E.setRange(this.bs, this.data.length, e, r, !1);
1598
1598
  }
1599
1599
  markBytes(e) {
1600
1600
  const r = this.pos;
@@ -1626,9 +1626,9 @@ class Ue {
1626
1626
  if (this.bitPos)
1627
1627
  throw this.err(`${this.bitPos} bits left after unpack: ${we.encode(this.data.slice(this.pos))}`);
1628
1628
  if (this.bs && !this.parent) {
1629
- const e = A.indices(this.bs, this.data.length, !0);
1629
+ const e = E.indices(this.bs, this.data.length, !0);
1630
1630
  if (e.length) {
1631
- const r = A.range(e).map(({ pos: n, length: s }) => `(${n}/${s})[${we.encode(this.data.subarray(n, n + s))}]`).join(", ");
1631
+ const r = E.range(e).map(({ pos: n, length: s }) => `(${n}/${s})[${we.encode(this.data.subarray(n, n + s))}]`).join(", ");
1632
1632
  throw this.err(`unread byte ranges: ${r} (total=${this.data.length})`);
1633
1633
  } else
1634
1634
  return;
@@ -1644,7 +1644,7 @@ class Ue {
1644
1644
  offsetReader(e) {
1645
1645
  if (e > this.data.length)
1646
1646
  throw this.err("offsetReader: Unexpected end of buffer");
1647
- return new Ue(this.absBytes(e), this.opts, this.stack, this, e);
1647
+ return new Re(this.absBytes(e), this.opts, this.stack, this, e);
1648
1648
  }
1649
1649
  bytes(e, r = !1) {
1650
1650
  if (this.bitPos)
@@ -1695,7 +1695,7 @@ class Ue {
1695
1695
  for (let n = r; (n = this.data.indexOf(e[0], n)) !== -1; n++) {
1696
1696
  if (n === -1 || this.data.length - n < e.length)
1697
1697
  return;
1698
- if (Ae(e, this.data.subarray(n, n + e.length)))
1698
+ if (ke(e, this.data.subarray(n, n + e.length)))
1699
1699
  return n;
1700
1700
  }
1701
1701
  }
@@ -1767,7 +1767,7 @@ class an {
1767
1767
  }
1768
1768
  }
1769
1769
  }
1770
- const Ee = (t) => Uint8Array.from(t).reverse();
1770
+ const Ae = (t) => Uint8Array.from(t).reverse();
1771
1771
  function cn(t, e, r) {
1772
1772
  if (r) {
1773
1773
  const n = 2n ** (e - 1n);
@@ -1787,7 +1787,7 @@ function Et(t) {
1787
1787
  return t.encodeStream(r, e), r.finish();
1788
1788
  },
1789
1789
  decode: (e, r = {}) => {
1790
- const n = new Ue(e, r), s = t.decodeStream(n);
1790
+ const n = new Re(e, r), s = t.decodeStream(n);
1791
1791
  return n.finish(), s;
1792
1792
  }
1793
1793
  };
@@ -1970,7 +1970,7 @@ const wn = (t) => {
1970
1970
  i.bytes(e ? c.reverse() : c);
1971
1971
  },
1972
1972
  decodeStream: (i) => {
1973
- const a = i.bytes(n ? t : Math.min(t, i.leftBytes)), l = e ? a : Ee(a);
1973
+ const a = i.bytes(n ? t : Math.min(t, i.leftBytes)), l = e ? a : Ae(a);
1974
1974
  let c = 0n;
1975
1975
  for (let d = 0; d < l.length; d++)
1976
1976
  c |= BigInt(l[d]) << 8n * BigInt(d);
@@ -1982,7 +1982,7 @@ const wn = (t) => {
1982
1982
  return cn(i, 8n * s, !!r), i;
1983
1983
  }
1984
1984
  });
1985
- }, _ = /* @__PURE__ */ gn(8, !0), pn = (t, e) => $({
1985
+ }, A = /* @__PURE__ */ gn(8, !0), pn = (t, e) => $({
1986
1986
  size: t,
1987
1987
  encodeStream: (r, n) => r.writeView(t, (s) => e.write(s, n)),
1988
1988
  decodeStream: (r) => r.readView(t, e.read),
@@ -2014,7 +2014,7 @@ const wn = (t) => {
2014
2014
  }), I = /* @__PURE__ */ xt(1, !1, {
2015
2015
  read: (t, e) => t.getUint8(e),
2016
2016
  write: (t, e) => t.setUint8(0, e)
2017
- }), ve = /* @__PURE__ */ $({
2017
+ }), Ee = /* @__PURE__ */ $({
2018
2018
  size: 1,
2019
2019
  encodeStream: (t, e) => t.byte(e ? 1 : 0),
2020
2020
  decodeStream: (t) => {
@@ -2035,7 +2035,7 @@ const wn = (t) => {
2035
2035
  return $({
2036
2036
  size: typeof t == "number" ? t : void 0,
2037
2037
  encodeStream: (s, o) => {
2038
- n || r.encodeStream(s, o.length), s.bytes(e ? Ee(o) : o), n && s.bytes(t);
2038
+ n || r.encodeStream(s, o.length), s.bytes(e ? Ae(o) : o), n && s.bytes(t);
2039
2039
  },
2040
2040
  decodeStream: (s) => {
2041
2041
  let o;
@@ -2046,7 +2046,7 @@ const wn = (t) => {
2046
2046
  o = s.bytes(i - s.pos), s.bytes(t.length);
2047
2047
  } else
2048
2048
  o = s.bytes(t === null ? s.leftBytes : r.decodeStream(s));
2049
- return e ? Ee(o) : o;
2049
+ return e ? Ae(o) : o;
2050
2050
  },
2051
2051
  validate: (s) => {
2052
2052
  if (!R(s))
@@ -2054,12 +2054,12 @@ const wn = (t) => {
2054
2054
  return s;
2055
2055
  }
2056
2056
  });
2057
- }, yn = (t, e = !1) => vt(mn(le(t, e), nn), (r) => {
2057
+ }, mn = (t, e = !1) => vt(yn(le(t, e), nn), (r) => {
2058
2058
  if (typeof r != "string")
2059
2059
  throw new Error(`expected string, got ${typeof r}`);
2060
2060
  return r;
2061
2061
  });
2062
- function mn(t, e) {
2062
+ function yn(t, e) {
2063
2063
  if (!S(t))
2064
2064
  throw new Error(`apply: invalid inner value ${t}`);
2065
2065
  if (!ce(e))
@@ -2165,7 +2165,7 @@ function te(t, e) {
2165
2165
  if (t.length > o.pos - c)
2166
2166
  return;
2167
2167
  const d = o.finish(!1).subarray(c, o.pos);
2168
- if (Ae(d.subarray(0, t.length), t))
2168
+ if (ke(d.subarray(0, t.length), t))
2169
2169
  throw o.err(`array: inner element encoding same as separator. elm=${l} data=${d}`);
2170
2170
  }
2171
2171
  });
@@ -2179,7 +2179,7 @@ function te(t, e) {
2179
2179
  ;
2180
2180
  else if (R(t))
2181
2181
  for (let i = 0; ; i++) {
2182
- if (Ae(n.bytes(t.length, !0), t)) {
2182
+ if (ke(n.bytes(t.length, !0), t)) {
2183
2183
  n.bytes(t.length);
2184
2184
  break;
2185
2185
  }
@@ -2200,7 +2200,7 @@ function te(t, e) {
2200
2200
  }
2201
2201
  });
2202
2202
  }
2203
- function Te(t, e) {
2203
+ function Ue(t, e) {
2204
2204
  if (!S(t))
2205
2205
  throw new Error(`map: invalid inner value ${t}`);
2206
2206
  if (!O(e))
@@ -2297,32 +2297,32 @@ const En = 9, pe = H.decimal(En), V = $({
2297
2297
  }
2298
2298
  return e;
2299
2299
  }
2300
- }), ee = yn($t(8, ie, void 0)), vn = () => {
2300
+ }), ee = mn($t(8, ie, void 0)), vn = () => {
2301
2301
  const t = le(32);
2302
2302
  return $({
2303
2303
  size: t.size,
2304
- encodeStream: (e, r) => t.encodeStream(e, ke.decode(r)),
2305
- decodeStream: (e) => ke.encode(t.decodeStream(e))
2304
+ encodeStream: (e, r) => t.encodeStream(e, _e.decode(r)),
2305
+ decodeStream: (e) => _e.encode(t.decodeStream(e))
2306
2306
  });
2307
- }, m = vn(), xn = g({
2307
+ }, _ = vn(), xn = g({
2308
2308
  requiredSignatures: I,
2309
2309
  readSigned: I,
2310
2310
  readUnsigned: I,
2311
- keys: te(V, m),
2312
- blockhash: m,
2311
+ keys: te(V, _),
2312
+ blockhash: _,
2313
2313
  instructions: te(V, g({ programIdx: I, keys: te(V, I), data: le(V) }))
2314
2314
  });
2315
2315
  function $n(t) {
2316
- if (ke.decode(t).length !== 32)
2316
+ if (_e.decode(t).length !== 32)
2317
2317
  throw new Error("Invalid Solana address");
2318
2318
  }
2319
2319
  const In = (t, e, r, n, s) => ({
2320
2320
  sign: t < e,
2321
2321
  write: t < e - r || t >= e && t < s - n
2322
- }), et = g({
2322
+ }), Ze = g({
2323
2323
  signatures: te(V, le(64)),
2324
2324
  msg: xn
2325
- }), xe = $({
2325
+ }), ve = $({
2326
2326
  encodeStream: (t, e) => {
2327
2327
  const { msg: r, signatures: n } = e, s = {}, o = (h, f, u) => {
2328
2328
  let w = s[h] || (s[h] = { sign: !1, write: !1 });
@@ -2344,7 +2344,7 @@ const In = (t, e, r, n, s) => ({
2344
2344
  let l = 0, c = 0, d = 0;
2345
2345
  for (let h of a)
2346
2346
  s[h].sign && l++, !s[h].write && (s[h].sign ? c++ : d++);
2347
- et.encodeStream(t, {
2347
+ Ze.encodeStream(t, {
2348
2348
  signatures: a.filter((h) => s[h].sign).map((h) => n[h] || new Uint8Array(64)),
2349
2349
  msg: {
2350
2350
  requiredSignatures: l,
@@ -2362,7 +2362,7 @@ const In = (t, e, r, n, s) => ({
2362
2362
  });
2363
2363
  },
2364
2364
  decodeStream: (t) => {
2365
- const { signatures: e, msg: r } = et.decodeStream(t);
2365
+ const { signatures: e, msg: r } = Ze.decodeStream(t);
2366
2366
  if (e.length !== r.requiredSignatures)
2367
2367
  throw new Error("SOL.tx: wrong signatures length");
2368
2368
  if (r.keys.length < e.length)
@@ -2391,12 +2391,12 @@ const In = (t, e, r, n, s) => ({
2391
2391
  signatures: n
2392
2392
  };
2393
2393
  }
2394
- }), tt = {};
2395
- function ze(t, e, r) {
2396
- if (tt[t])
2394
+ }), et = {};
2395
+ function Te(t, e, r) {
2396
+ if (et[t])
2397
2397
  throw new Error("SOL: program for this address already defined");
2398
- const n = Te(e, Object.keys(r).reduce((a, l, c) => ({ ...a, [l]: c }), {})), s = Object.keys(r).reduce((a, l) => ({ ...a, [l]: r[l].coder }), {}), o = kn(n, s);
2399
- tt[t] = (a, l) => {
2398
+ const n = Ue(e, Object.keys(r).reduce((a, l, c) => ({ ...a, [l]: c }), {})), s = Object.keys(r).reduce((a, l) => ({ ...a, [l]: r[l].coder }), {}), o = kn(n, s);
2399
+ et[t] = (a, l) => {
2400
2400
  if (a.program !== t)
2401
2401
  throw new Error("SOL.parseInstruction: Wrong instruction program address");
2402
2402
  const { TAG: c, data: d } = o.decode(a.data), h = { type: c, info: d }, f = Object.keys(r[c].keys);
@@ -2425,9 +2425,9 @@ function ze(t, e, r) {
2425
2425
  });
2426
2426
  return i;
2427
2427
  }
2428
- const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent111111111111111111111111111111111", It = "11111111111111111111111111111111", St = ze(It, ie, {
2428
+ const me = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent111111111111111111111111111111111", It = "11111111111111111111111111111111", St = Te(It, ie, {
2429
2429
  createAccount: {
2430
- coder: g({ lamports: _, space: _, owner: m }),
2430
+ coder: g({ lamports: A, space: A, owner: _ }),
2431
2431
  keys: {
2432
2432
  source: { sign: !0, write: !0 },
2433
2433
  newAccount: { sign: !0, write: !0 }
@@ -2435,22 +2435,22 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
2435
2435
  hint: (t) => `Create new account=${t.newAccount} with balance of ${pe.encode(t.lamports)} and owner program ${t.owner}, using funding account ${t.source}`
2436
2436
  },
2437
2437
  assign: {
2438
- coder: g({ owner: m }),
2438
+ coder: g({ owner: _ }),
2439
2439
  keys: { account: { sign: !0, write: !0 } },
2440
2440
  hint: (t) => `Assign account=${t.account} to owner program=${t.owner}`
2441
2441
  },
2442
2442
  transfer: {
2443
- coder: g({ lamports: _ }),
2443
+ coder: g({ lamports: A }),
2444
2444
  keys: { source: { sign: !0, write: !0 }, destination: { sign: !1, write: !0 } },
2445
2445
  hint: (t) => `Transfer ${pe.encode(t.lamports)} SOL from ${t.source} to ${t.destination}`
2446
2446
  },
2447
2447
  createAccountWithSeed: {
2448
2448
  coder: g({
2449
- base: m,
2449
+ base: _,
2450
2450
  seed: ee,
2451
- lamports: _,
2452
- space: _,
2453
- owner: m
2451
+ lamports: A,
2452
+ space: A,
2453
+ owner: _
2454
2454
  }),
2455
2455
  keys: {
2456
2456
  source: { sign: !0, write: !0 },
@@ -2462,32 +2462,32 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
2462
2462
  coder: g({}),
2463
2463
  keys: {
2464
2464
  nonceAccount: { sign: !1, write: !0 },
2465
- _recent_bh: { address: ye, sign: !1, write: !1 },
2465
+ _recent_bh: { address: me, sign: !1, write: !1 },
2466
2466
  nonceAuthority: { sign: !0, write: !1 }
2467
2467
  },
2468
2468
  hint: (t) => `Consume nonce in nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority})`
2469
2469
  },
2470
2470
  withdrawFromNonce: {
2471
- coder: g({ lamports: _ }),
2471
+ coder: g({ lamports: A }),
2472
2472
  keys: {
2473
2473
  nonceAccount: { sign: !1, write: !0 },
2474
2474
  destination: { sign: !1, write: !0 },
2475
- _recent_bh: { address: ye, sign: !1, write: !1 },
2475
+ _recent_bh: { address: me, sign: !1, write: !1 },
2476
2476
  _rent: { address: L, sign: !1, write: !1 },
2477
2477
  nonceAuthority: { sign: !0, write: !1 }
2478
2478
  },
2479
2479
  hint: (t) => `Withdraw ${pe.encode(t.lamports)} SOL from nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority}) to ${t.destination}`
2480
2480
  },
2481
2481
  initializeNonce: {
2482
- coder: g({ nonceAuthority: m }),
2482
+ coder: g({ nonceAuthority: _ }),
2483
2483
  keys: {
2484
2484
  nonceAccount: { sign: !1, write: !0 },
2485
- _recent_bh: { address: ye, sign: !1, write: !1 },
2485
+ _recent_bh: { address: me, sign: !1, write: !1 },
2486
2486
  _rent: { address: L, sign: !1, write: !1 }
2487
2487
  }
2488
2488
  },
2489
2489
  authorizeNonce: {
2490
- coder: g({ newAuthorized: m }),
2490
+ coder: g({ newAuthorized: _ }),
2491
2491
  keys: {
2492
2492
  nonceAccount: { sign: !1, write: !0 },
2493
2493
  nonceAuthority: { sign: !0, write: !1 }
@@ -2495,17 +2495,17 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
2495
2495
  hint: (t) => `Change owner of nonce account=${t.nonceAccount} from ${t.nonceAuthority} to ${t.newAuthorized}`
2496
2496
  },
2497
2497
  allocate: {
2498
- coder: g({ space: _ }),
2498
+ coder: g({ space: A }),
2499
2499
  keys: {
2500
2500
  account: { sign: !0, write: !0 }
2501
2501
  }
2502
2502
  },
2503
2503
  allocateWithSeed: {
2504
2504
  coder: g({
2505
- base: m,
2505
+ base: _,
2506
2506
  seed: ee,
2507
- space: _,
2508
- owner: m
2507
+ space: A,
2508
+ owner: _
2509
2509
  }),
2510
2510
  keys: {
2511
2511
  account: { sign: !1, write: !0 },
@@ -2514,9 +2514,9 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
2514
2514
  },
2515
2515
  assignWithSeed: {
2516
2516
  coder: g({
2517
- base: m,
2517
+ base: _,
2518
2518
  seed: ee,
2519
- owner: m
2519
+ owner: _
2520
2520
  }),
2521
2521
  keys: {
2522
2522
  account: { sign: !1, write: !0 },
@@ -2525,9 +2525,9 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
2525
2525
  },
2526
2526
  transferWithSeed: {
2527
2527
  coder: g({
2528
- lamports: _,
2528
+ lamports: A,
2529
2529
  sourceSeed: ee,
2530
- sourceOwner: m
2530
+ sourceOwner: _
2531
2531
  }),
2532
2532
  keys: {
2533
2533
  source: { sign: !1, write: !0 },
@@ -2539,18 +2539,18 @@ const ye = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
2539
2539
  };
2540
2540
  Ct(St.transfer);
2541
2541
  Ct(St.advanceNonce);
2542
- const Sn = Te(I, {
2542
+ const Sn = Ue(I, {
2543
2543
  MintTokens: 0,
2544
2544
  FreezeAccount: 1,
2545
2545
  AccountOwner: 2,
2546
2546
  CloseAccount: 3
2547
2547
  }), T = (t, e) => e[t]?.symbol || t, Pt = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2548
- ze(Pt, I, {
2548
+ Te(Pt, I, {
2549
2549
  initializeMint: {
2550
2550
  coder: g({
2551
2551
  decimals: I,
2552
- mintAuthority: m,
2553
- freezeAuthority: q(ve, m, "11111111111111111111111111111111")
2552
+ mintAuthority: _,
2553
+ freezeAuthority: q(Ee, _, "11111111111111111111111111111111")
2554
2554
  }),
2555
2555
  keys: {
2556
2556
  mint: { sign: !1, write: !0 },
@@ -2577,7 +2577,7 @@ ze(Pt, I, {
2577
2577
  hint: (t, e) => `Initialize multi-sig token account=${t.account} with signatures=${t.m}`
2578
2578
  },
2579
2579
  transfer: {
2580
- coder: g({ amount: _ }),
2580
+ coder: g({ amount: A }),
2581
2581
  keys: {
2582
2582
  source: { sign: !1, write: !0 },
2583
2583
  destination: { sign: !1, write: !0 },
@@ -2586,7 +2586,7 @@ ze(Pt, I, {
2586
2586
  hint: (t, e) => `Transfer ${t.amount} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
2587
2587
  },
2588
2588
  approve: {
2589
- coder: g({ amount: _ }),
2589
+ coder: g({ amount: A }),
2590
2590
  keys: {
2591
2591
  account: { sign: !1, write: !0 },
2592
2592
  delegate: { sign: !1, write: !1 },
@@ -2605,7 +2605,7 @@ ze(Pt, I, {
2605
2605
  setAuthority: {
2606
2606
  coder: g({
2607
2607
  authorityType: Sn,
2608
- newAuthority: q(ve, m, "11111111111111111111111111111111")
2608
+ newAuthority: q(Ee, _, "11111111111111111111111111111111")
2609
2609
  }),
2610
2610
  keys: {
2611
2611
  account: { sign: !1, write: !0 },
@@ -2614,7 +2614,7 @@ ze(Pt, I, {
2614
2614
  hint: (t, e) => `Sets a new authority=${t.newAuthority} of a mint or account=${t.account}. Current authority=${t.currentAuthority}. Authority Type: ${t.authorityType}`
2615
2615
  },
2616
2616
  mintTo: {
2617
- coder: g({ amount: _ }),
2617
+ coder: g({ amount: A }),
2618
2618
  keys: {
2619
2619
  mint: { sign: !1, write: !0 },
2620
2620
  dest: { sign: !1, write: !0 },
@@ -2622,7 +2622,7 @@ ze(Pt, I, {
2622
2622
  }
2623
2623
  },
2624
2624
  burn: {
2625
- coder: g({ amount: _ }),
2625
+ coder: g({ amount: A }),
2626
2626
  keys: {
2627
2627
  account: { sign: !1, write: !0 },
2628
2628
  mint: { sign: !1, write: !0 },
@@ -2658,7 +2658,7 @@ ze(Pt, I, {
2658
2658
  hint: (t, e) => `Thaw a frozne token account=${t.account} of mint=${t.mint} using freeze_authority=${t.authority}`
2659
2659
  },
2660
2660
  transferChecked: {
2661
- coder: g({ amount: _, decimals: I }),
2661
+ coder: g({ amount: A, decimals: I }),
2662
2662
  keys: {
2663
2663
  source: { sign: !1, write: !0 },
2664
2664
  mint: { sign: !1, write: !1 },
@@ -2668,7 +2668,7 @@ ze(Pt, I, {
2668
2668
  hint: (t, e) => `Transfer ${H.decimal(t.decimals).encode(t.amount)} ${T(t.mint, e)} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
2669
2669
  },
2670
2670
  approveChecked: {
2671
- coder: g({ amount: _, decimals: I }),
2671
+ coder: g({ amount: A, decimals: I }),
2672
2672
  keys: {
2673
2673
  source: { sign: !1, write: !0 },
2674
2674
  mint: { sign: !1, write: !1 },
@@ -2678,7 +2678,7 @@ ze(Pt, I, {
2678
2678
  hint: (t, e) => `Approve delgate=${t.delegate} authority on behalf account=${t.source} owner=${t.owner} over ${H.decimal(t.decimals).encode(t.amount)} ${T(t.mint, e)}`
2679
2679
  },
2680
2680
  mintToChecked: {
2681
- coder: g({ amount: _, decimals: I }),
2681
+ coder: g({ amount: A, decimals: I }),
2682
2682
  keys: {
2683
2683
  mint: { sign: !1, write: !0 },
2684
2684
  dest: { sign: !1, write: !0 },
@@ -2687,7 +2687,7 @@ ze(Pt, I, {
2687
2687
  hint: (t, e) => `Mint new tokens (${H.decimal(t.decimals).encode(t.amount)} ${T(t.mint, e)}) to account=${t.dest} using authority=${t.authority}`
2688
2688
  },
2689
2689
  burnChecked: {
2690
- coder: g({ amount: _, decimals: I }),
2690
+ coder: g({ amount: A, decimals: I }),
2691
2691
  keys: {
2692
2692
  mint: { sign: !1, write: !0 },
2693
2693
  account: { sign: !1, write: !0 },
@@ -2696,7 +2696,7 @@ ze(Pt, I, {
2696
2696
  hint: (t, e) => `Burn tokens (${H.decimal(t.decimals).encode(t.amount)} ${T(t.mint, e)}) on account=${t.account} of owner=${t.owner}`
2697
2697
  },
2698
2698
  initializeAccount2: {
2699
- coder: g({ owner: m }),
2699
+ coder: g({ owner: _ }),
2700
2700
  keys: {
2701
2701
  account: { sign: !1, write: !0 },
2702
2702
  mint: { sign: !1, write: !1 },
@@ -2713,12 +2713,12 @@ ze(Pt, I, {
2713
2713
  g({
2714
2714
  version: ie,
2715
2715
  state: ie,
2716
- authority: m,
2717
- nonce: m,
2718
- lamportPerSignature: _
2716
+ authority: _,
2717
+ nonce: _,
2718
+ lamportPerSignature: A
2719
2719
  });
2720
2720
  const Cn = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
2721
- ze(Cn, bn(0), {
2721
+ Te(Cn, bn(0), {
2722
2722
  create: {
2723
2723
  coder: g({}),
2724
2724
  keys: {
@@ -2733,25 +2733,25 @@ ze(Cn, bn(0), {
2733
2733
  hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${T(t.mint, e)}, payed by ${t.source}`
2734
2734
  }
2735
2735
  });
2736
- const me = $t(4, ve, () => 0);
2736
+ const ye = $t(4, Ee, () => 0);
2737
2737
  g({
2738
- mint: m,
2739
- owner: m,
2740
- amount: _,
2741
- delegate: q(me, m, "11111111111111111111111111111111"),
2742
- state: Te(I, {
2738
+ mint: _,
2739
+ owner: _,
2740
+ amount: A,
2741
+ delegate: q(ye, _, "11111111111111111111111111111111"),
2742
+ state: Ue(I, {
2743
2743
  uninitialized: 0,
2744
2744
  initialized: 1,
2745
2745
  frozen: 2
2746
2746
  }),
2747
- isNative: q(me, _, 0n),
2748
- delegateAmount: _,
2749
- closeAuthority: q(me, m, "11111111111111111111111111111111")
2747
+ isNative: q(ye, A, 0n),
2748
+ delegateAmount: A,
2749
+ closeAuthority: q(ye, _, "11111111111111111111111111111111")
2750
2750
  });
2751
- function rt(t, e, r) {
2751
+ function tt(t, e, r) {
2752
2752
  if (!e.length)
2753
2753
  throw new Error("SOLPublic: empty instructions array");
2754
- return tn.encode(xe.encode({
2754
+ return tn.encode(ve.encode({
2755
2755
  msg: { feePayer: t, blockhash: r, instructions: e },
2756
2756
  signatures: {}
2757
2757
  }));
@@ -2780,20 +2780,20 @@ function Pn(t) {
2780
2780
  f++, d++;
2781
2781
  const w = (u - f) * o + 1 >>> 0, b = new Uint8Array(w);
2782
2782
  for (; f !== u; ) {
2783
- let k = c[f], y = 0;
2784
- for (let x = w - 1; (k !== 0 || y < h) && x !== -1; x--, y++)
2785
- k += 256 * b[x] >>> 0, b[x] = k % r >>> 0, k = k / r >>> 0;
2783
+ let k = c[f], p = 0;
2784
+ for (let v = w - 1; (k !== 0 || p < h) && v !== -1; v--, p++)
2785
+ k += 256 * b[v] >>> 0, b[v] = k % r >>> 0, k = k / r >>> 0;
2786
2786
  if (k !== 0)
2787
2787
  throw new Error("Non-zero carry");
2788
- h = y, f++;
2788
+ h = p, f++;
2789
2789
  }
2790
- let p = w - h;
2791
- for (; p !== w && b[p] === 0; )
2792
- p++;
2793
- let v = n.repeat(d);
2794
- for (; p < w; ++p)
2795
- v += t.charAt(b[p]);
2796
- return v;
2790
+ let y = w - h;
2791
+ for (; y !== w && b[y] === 0; )
2792
+ y++;
2793
+ let m = n.repeat(d);
2794
+ for (; y < w; ++y)
2795
+ m += t.charAt(b[y]);
2796
+ return m;
2797
2797
  }
2798
2798
  function a(c) {
2799
2799
  if (typeof c != "string")
@@ -2808,24 +2808,24 @@ function Pn(t) {
2808
2808
  const k = c.charCodeAt(d);
2809
2809
  if (k > 255)
2810
2810
  return;
2811
- let y = e[k];
2812
- if (y === 255)
2811
+ let p = e[k];
2812
+ if (p === 255)
2813
2813
  return;
2814
- let x = 0;
2815
- for (let C = u - 1; (y !== 0 || x < f) && C !== -1; C--, x++)
2816
- y += r * w[C] >>> 0, w[C] = y % 256 >>> 0, y = y / 256 >>> 0;
2817
- if (y !== 0)
2814
+ let v = 0;
2815
+ for (let C = u - 1; (p !== 0 || v < f) && C !== -1; C--, v++)
2816
+ p += r * w[C] >>> 0, w[C] = p % 256 >>> 0, p = p / 256 >>> 0;
2817
+ if (p !== 0)
2818
2818
  throw new Error("Non-zero carry");
2819
- f = x, d++;
2819
+ f = v, d++;
2820
2820
  }
2821
2821
  let b = u - f;
2822
2822
  for (; b !== u && w[b] === 0; )
2823
2823
  b++;
2824
- const p = new Uint8Array(h + (u - b));
2825
- let v = h;
2824
+ const y = new Uint8Array(h + (u - b));
2825
+ let m = h;
2826
2826
  for (; b !== u; )
2827
- p[v++] = w[b++];
2828
- return p;
2827
+ y[m++] = w[b++];
2828
+ return y;
2829
2829
  }
2830
2830
  function l(c) {
2831
2831
  const d = a(c);
@@ -2841,7 +2841,7 @@ function Pn(t) {
2841
2841
  }
2842
2842
  var Bn = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2843
2843
  Pn(Bn);
2844
- class Le {
2844
+ class ze {
2845
2845
  _transaction;
2846
2846
  signatures = [];
2847
2847
  feePayer;
@@ -2854,15 +2854,15 @@ class Le {
2854
2854
  return this._instructions.push(...e), this;
2855
2855
  }
2856
2856
  static from(e) {
2857
- const r = e instanceof Uint8Array ? e : new Uint8Array(e), n = xe.decode(r), s = new Le();
2857
+ const r = e instanceof Uint8Array ? e : new Uint8Array(e), n = ve.decode(r), s = new ze();
2858
2858
  return s._transaction = n, s;
2859
2859
  }
2860
2860
  serialize(e) {
2861
2861
  if (this._transaction)
2862
- return Buffer.from(xe.encode(this._transaction));
2862
+ return Buffer.from(ve.encode(this._transaction));
2863
2863
  if (!this.feePayer || !this.recentBlockhash)
2864
2864
  throw new Error("Transaction requires feePayer and recentBlockhash");
2865
- const r = rt(
2865
+ const r = tt(
2866
2866
  this.feePayer.toString(),
2867
2867
  this._instructions,
2868
2868
  this.recentBlockhash
@@ -2872,7 +2872,7 @@ class Le {
2872
2872
  serializeMessage() {
2873
2873
  if (!this.feePayer || !this.recentBlockhash)
2874
2874
  throw new Error("Transaction requires feePayer and recentBlockhash");
2875
- const e = rt(
2875
+ const e = tt(
2876
2876
  this.feePayer.toString(),
2877
2877
  this._instructions,
2878
2878
  this.recentBlockhash
@@ -2948,7 +2948,7 @@ class Nn {
2948
2948
  if (!this.isAvailable() || !this.account)
2949
2949
  throw new Error("Phantom is not connected");
2950
2950
  try {
2951
- const r = Le.from(e), s = await this.getProvider().signAndSendTransaction(r);
2951
+ const r = ze.from(e), s = await this.getProvider().signAndSendTransaction(r);
2952
2952
  return {
2953
2953
  success: !0,
2954
2954
  wallet: this.type,
@@ -2990,7 +2990,7 @@ class Nn {
2990
2990
  };
2991
2991
  }
2992
2992
  }
2993
- class Rn extends Ce {
2993
+ class Rn extends Se {
2994
2994
  type = "rabby";
2995
2995
  rdns = "io.rabby";
2996
2996
  displayName = "Rabby";
@@ -3315,27 +3315,28 @@ class zn extends cr {
3315
3315
  needsSessionCreation: f,
3316
3316
  username: u,
3317
3317
  onSessionCreated: w,
3318
- ...b
3318
+ encryptedBlob: b,
3319
+ ...y
3319
3320
  }) {
3320
- const p = new URL(e ?? be), v = new Tn();
3321
- n && p.searchParams.set("v", encodeURIComponent(n)), s && p.searchParams.set("ps", encodeURIComponent(s)), o && p.searchParams.set("ns", encodeURIComponent(o)), i?.erc20 && p.searchParams.set(
3321
+ const m = new URL(e ?? nt), k = new Tn();
3322
+ n && m.searchParams.set("v", encodeURIComponent(n)), s && m.searchParams.set("ps", encodeURIComponent(s)), o && m.searchParams.set("ns", encodeURIComponent(o)), i?.erc20 && m.searchParams.set(
3322
3323
  "erc20",
3323
3324
  encodeURIComponent(i.erc20.toString())
3324
- ), c && p.searchParams.set("rpc_url", encodeURIComponent(c)), d && p.searchParams.set("ref", encodeURIComponent(d)), h && p.searchParams.set("ref_group", encodeURIComponent(h)), f && p.searchParams.set("needs_session_creation", "true"), u && p.searchParams.set("username", encodeURIComponent(u)), (!a || l) && r ? p.searchParams.set(
3325
+ ), c && m.searchParams.set("rpc_url", encodeURIComponent(c)), d && m.searchParams.set("ref", encodeURIComponent(d)), h && m.searchParams.set("ref_group", encodeURIComponent(h)), f && m.searchParams.set("needs_session_creation", "true"), u && m.searchParams.set("username", encodeURIComponent(u)), (!a || l) && r ? m.searchParams.set(
3325
3326
  "policies",
3326
3327
  encodeURIComponent(JSON.stringify(r))
3327
- ) : a && p.searchParams.set("preset", a), super({
3328
- ...b,
3328
+ ) : a && m.searchParams.set("preset", a), b && (m.hash = `kc=${encodeURIComponent(b)}`), super({
3329
+ ...y,
3329
3330
  id: "controller-keychain",
3330
- url: p,
3331
+ url: m,
3331
3332
  methods: {
3332
- ...v.getIFrameMethods(),
3333
+ ...k.getIFrameMethods(),
3333
3334
  // Expose callback for keychain to notify parent that session was created and storage access granted
3334
- onSessionCreated: (k) => () => {
3335
+ onSessionCreated: (p) => () => {
3335
3336
  w && w();
3336
3337
  }
3337
3338
  }
3338
- }), this.walletBridge = v, typeof window < "u" && (window.external_wallets = this.walletBridge);
3339
+ }), this.walletBridge = k, typeof window < "u" && (window.external_wallets = this.walletBridge);
3339
3340
  }
3340
3341
  getWalletBridge() {
3341
3342
  return this.walletBridge;
@@ -3380,6 +3381,7 @@ class Qn extends zt {
3380
3381
  selectedChain;
3381
3382
  chains;
3382
3383
  referral;
3384
+ encryptedBlob;
3383
3385
  isReady() {
3384
3386
  return !!this.keychain;
3385
3387
  }
@@ -3394,22 +3396,25 @@ class Qn extends zt {
3394
3396
  if (this.referral = {
3395
3397
  ref: o?.get("ref") ?? void 0,
3396
3398
  refGroup: o?.get("ref_group") ?? void 0
3397
- }, this.options = { ...e, chains: n, defaultChainId: s }, typeof window < "u" && o?.has("controller_redirect")) {
3398
- const a = new URL(e.url || be), l = new URL(window.location.href);
3399
- l.searchParams.delete("controller_redirect");
3400
- const c = l.toString();
3401
- a.searchParams.set("redirect_url", c), e.preset && a.searchParams.set("preset", e.preset), window.location.href = a.toString();
3402
- return;
3403
- }
3404
- if (typeof window < "u" && typeof localStorage < "u") {
3399
+ }, this.options = { ...e, chains: n, defaultChainId: s }, typeof window < "u" && typeof localStorage < "u") {
3405
3400
  const i = o?.get("controller_standalone");
3406
3401
  i === "1" && sessionStorage.setItem("controller_standalone", "1");
3407
3402
  const a = o?.get("lastUsedConnector");
3408
- if (a && localStorage.setItem("lastUsedConnector", a), o && window.history?.replaceState) {
3403
+ if (a && localStorage.setItem("lastUsedConnector", a), window.location.hash) {
3404
+ const c = new URLSearchParams(window.location.hash.slice(1)).get("kc");
3405
+ c && (this.encryptedBlob = c);
3406
+ }
3407
+ if (o && window.history?.replaceState) {
3409
3408
  let l = !1;
3410
- if (i && (o.delete("controller_standalone"), l = !0), a && (o.delete("lastUsedConnector"), l = !0), o.has("controller_redirect") && (o.delete("controller_redirect"), l = !0), l) {
3411
- const c = window.location.pathname + (o.toString() ? "?" + o.toString() : "") + window.location.hash;
3412
- window.history.replaceState({}, "", c);
3409
+ i && (o.delete("controller_standalone"), l = !0), a && (o.delete("lastUsedConnector"), l = !0);
3410
+ let c = window.location.hash;
3411
+ if (c) {
3412
+ const d = new URLSearchParams(c.slice(1));
3413
+ d.has("kc") && (d.delete("kc"), c = d.toString() ? `#${d.toString()}` : "", l = !0);
3414
+ }
3415
+ if (l) {
3416
+ const d = window.location.pathname + (o.toString() ? "?" + o.toString() : "") + c;
3417
+ window.history.replaceState({}, "", d);
3413
3418
  }
3414
3419
  }
3415
3420
  }
@@ -3419,7 +3424,7 @@ class Qn extends zt {
3419
3424
  }
3420
3425
  async logout() {
3421
3426
  if (!this.keychain) {
3422
- console.error(new E().message);
3427
+ console.error(new x().message);
3423
3428
  return;
3424
3429
  }
3425
3430
  try {
@@ -3437,12 +3442,12 @@ class Qn extends zt {
3437
3442
  if (this.iframes) {
3438
3443
  try {
3439
3444
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe()), await this.waitForKeychain(), !this.keychain) {
3440
- console.error(new E().message);
3445
+ console.error(new x().message);
3441
3446
  return;
3442
3447
  }
3443
3448
  const e = await this.keychain.probe(this.rpcUrl());
3444
3449
  let r = e?.rpcUrl || this.rpcUrl();
3445
- this.account = new Me(
3450
+ this.account = new Oe(
3446
3451
  this,
3447
3452
  r,
3448
3453
  e.address,
@@ -3462,7 +3467,7 @@ class Qn extends zt {
3462
3467
  if (this.account)
3463
3468
  return this.account;
3464
3469
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe(), await this.waitForKeychain()), !this.keychain || !this.iframes.keychain) {
3465
- console.error(new E().message);
3470
+ console.error(new x().message);
3466
3471
  return;
3467
3472
  }
3468
3473
  this.iframes.keychain.open();
@@ -3470,7 +3475,7 @@ class Qn extends zt {
3470
3475
  let e = await this.keychain.connect(this.options.signupOptions);
3471
3476
  if (e.code !== Q.SUCCESS)
3472
3477
  throw new Error(e.message);
3473
- return e = e, this.account = new Me(
3478
+ return e = e, this.account = new Oe(
3474
3479
  this,
3475
3480
  this.rpcUrl(),
3476
3481
  e.address,
@@ -3489,7 +3494,7 @@ class Qn extends zt {
3489
3494
  if (!this.iframes)
3490
3495
  return !1;
3491
3496
  if (!this.keychain || !this.iframes.keychain)
3492
- return console.error(new E().message), !1;
3497
+ return console.error(new x().message), !1;
3493
3498
  const r = this.selectedChain;
3494
3499
  try {
3495
3500
  this.selectedChain = e, await this.keychain.switchChain(this.rpcUrl());
@@ -3503,7 +3508,7 @@ class Qn extends zt {
3503
3508
  }
3504
3509
  async disconnect() {
3505
3510
  if (!this.keychain) {
3506
- console.error(new E().message);
3511
+ console.error(new x().message);
3507
3512
  return;
3508
3513
  }
3509
3514
  return this.account = void 0, this.keychain.disconnect();
@@ -3512,7 +3517,7 @@ class Qn extends zt {
3512
3517
  if (!this.iframes)
3513
3518
  return;
3514
3519
  if (!this.keychain || !this.iframes.keychain) {
3515
- console.error(new E().message);
3520
+ console.error(new x().message);
3516
3521
  return;
3517
3522
  }
3518
3523
  if (!this.account) {
@@ -3528,7 +3533,7 @@ class Qn extends zt {
3528
3533
  if (!this.iframes)
3529
3534
  return;
3530
3535
  if (!this.keychain || !this.iframes.keychain) {
3531
- console.error(new E().message);
3536
+ console.error(new x().message);
3532
3537
  return;
3533
3538
  }
3534
3539
  if (!this.account) {
@@ -3543,7 +3548,7 @@ class Qn extends zt {
3543
3548
  async openProfileAt(e) {
3544
3549
  if (this.iframes) {
3545
3550
  if (!this.keychain || !this.iframes.keychain) {
3546
- console.error(new E().message);
3551
+ console.error(new x().message);
3547
3552
  return;
3548
3553
  }
3549
3554
  if (!this.account) {
@@ -3556,30 +3561,30 @@ class Qn extends zt {
3556
3561
  openSettings() {
3557
3562
  if (this.iframes) {
3558
3563
  if (!this.keychain || !this.iframes.keychain) {
3559
- console.error(new E().message);
3564
+ console.error(new x().message);
3560
3565
  return;
3561
3566
  }
3562
3567
  this.iframes.keychain.open(), this.keychain.openSettings();
3563
3568
  }
3564
3569
  }
3565
3570
  revoke(e, r) {
3566
- return this.keychain ? this.keychain.revoke(e) : (console.error(new E().message), null);
3571
+ return this.keychain ? this.keychain.revoke(e) : (console.error(new x().message), null);
3567
3572
  }
3568
3573
  rpcUrl() {
3569
3574
  const e = this.chains.get(this.selectedChain);
3570
3575
  if (!e) {
3571
3576
  const r = Array.from(this.chains.keys()).map(
3572
- (n) => Oe.decodeShortString(n)
3577
+ (n) => De.decodeShortString(n)
3573
3578
  );
3574
3579
  throw new Error(
3575
- `Chain not found: ${Oe.decodeShortString(this.selectedChain)}. Available chains: ${r.join(", ")}`
3580
+ `Chain not found: ${De.decodeShortString(this.selectedChain)}. Available chains: ${r.join(", ")}`
3576
3581
  );
3577
3582
  }
3578
3583
  return e.rpcUrl;
3579
3584
  }
3580
3585
  username() {
3581
3586
  if (!this.keychain) {
3582
- console.error(new E().message);
3587
+ console.error(new x().message);
3583
3588
  return;
3584
3589
  }
3585
3590
  return this.keychain.username();
@@ -3587,7 +3592,7 @@ class Qn extends zt {
3587
3592
  openPurchaseCredits() {
3588
3593
  if (this.iframes) {
3589
3594
  if (!this.keychain || !this.iframes.keychain) {
3590
- console.error(new E().message);
3595
+ console.error(new x().message);
3591
3596
  return;
3592
3597
  }
3593
3598
  this.keychain.navigate("/purchase/credits").then(() => {
@@ -3598,7 +3603,7 @@ class Qn extends zt {
3598
3603
  async openStarterPack(e, r) {
3599
3604
  if (this.iframes) {
3600
3605
  if (!this.keychain || !this.iframes.keychain) {
3601
- console.error(new E().message);
3606
+ console.error(new x().message);
3602
3607
  return;
3603
3608
  }
3604
3609
  await this.keychain.openStarterPack(e, r), this.iframes.keychain?.open();
@@ -3608,7 +3613,7 @@ class Qn extends zt {
3608
3613
  if (!this.iframes)
3609
3614
  return;
3610
3615
  if (!this.keychain || !this.iframes.keychain) {
3611
- console.error(new E().message);
3616
+ console.error(new x().message);
3612
3617
  return;
3613
3618
  }
3614
3619
  let n = this.selectedChain;
@@ -3620,7 +3625,7 @@ class Qn extends zt {
3620
3625
  };
3621
3626
  }
3622
3627
  async delegateAccount() {
3623
- return this.keychain ? await this.keychain.delegateAccount() : (console.error(new E().message), null);
3628
+ return this.keychain ? await this.keychain.delegateAccount() : (console.error(new x().message), null);
3624
3629
  }
3625
3630
  /**
3626
3631
  * Opens the keychain in standalone mode (first-party context) for authentication.
@@ -3632,7 +3637,7 @@ class Qn extends zt {
3632
3637
  console.error("open can only be called in browser context");
3633
3638
  return;
3634
3639
  }
3635
- const r = new URL(this.options.url || be), n = e.redirectUrl || window.location.href, s = Ln(n);
3640
+ const r = new URL(this.options.url || nt), n = e.redirectUrl || window.location.href, s = Ln(n);
3636
3641
  if (!s.isValid) {
3637
3642
  console.error(
3638
3643
  `Invalid redirect URL: ${s.error}`,
@@ -3645,20 +3650,6 @@ class Qn extends zt {
3645
3650
  this.options.tokens.erc20.toString()
3646
3651
  ), this.rpcUrl() && r.searchParams.set("rpc_url", this.rpcUrl()), window.location.href = r.toString();
3647
3652
  }
3648
- /**
3649
- * Checks if the keychain iframe has first-party storage access.
3650
- * Returns true if the user has previously authenticated via standalone mode.
3651
- * @returns Promise<boolean> indicating if storage access is available
3652
- */
3653
- async hasFirstPartyAccess() {
3654
- if (!this.keychain)
3655
- return console.error(new E().message), !1;
3656
- try {
3657
- return await this.keychain.hasStorageAccess();
3658
- } catch (e) {
3659
- return console.error("Error checking storage access:", e), !1;
3660
- }
3661
- }
3662
3653
  initializeChains(e) {
3663
3654
  for (const r of e)
3664
3655
  try {
@@ -3676,27 +3667,28 @@ class Qn extends zt {
3676
3667
  );
3677
3668
  }
3678
3669
  createKeychainIframe() {
3679
- const e = typeof window < "u" && typeof sessionStorage < "u" && sessionStorage.getItem("controller_standalone") === "1", n = (typeof window < "u" ? new URLSearchParams(window.location.search) : void 0)?.get("username") ?? void 0;
3680
- e && sessionStorage.removeItem("controller_standalone");
3681
- const s = new zn({
3670
+ const e = typeof window < "u" && typeof sessionStorage < "u" && sessionStorage.getItem("controller_standalone") === "1", n = (typeof window < "u" ? new URLSearchParams(window.location.search) : void 0)?.get("username") ?? void 0, s = this.encryptedBlob;
3671
+ e && sessionStorage.removeItem("controller_standalone"), s && (this.encryptedBlob = void 0);
3672
+ const o = new zn({
3682
3673
  ...this.options,
3683
3674
  rpcUrl: this.rpcUrl(),
3684
3675
  onClose: this.keychain?.reset,
3685
- onConnect: (o) => {
3686
- this.keychain = o;
3676
+ onConnect: (i) => {
3677
+ this.keychain = i;
3687
3678
  },
3688
3679
  version: Dt,
3689
3680
  ref: this.referral.ref,
3690
3681
  refGroup: this.referral.refGroup,
3691
3682
  needsSessionCreation: e,
3683
+ encryptedBlob: s ?? void 0,
3692
3684
  username: n,
3693
3685
  onSessionCreated: async () => {
3694
3686
  await this.probe();
3695
3687
  }
3696
3688
  });
3697
3689
  return e && setTimeout(() => {
3698
- s.open();
3699
- }, 100), s;
3690
+ o.open();
3691
+ }, 100), o;
3700
3692
  }
3701
3693
  waitForKeychain({
3702
3694
  timeout: e = 5e4,
@@ -3737,7 +3729,7 @@ async function Fn(t) {
3737
3729
  );
3738
3730
  }
3739
3731
  async function Wn(t) {
3740
- t = t.map(nt.toHex);
3732
+ t = t.map(rt.toHex);
3741
3733
  const e = t.filter((r) => !F.has(r));
3742
3734
  return e.length > 0 && (await Bt({
3743
3735
  addresses: e
@@ -4335,7 +4327,7 @@ var Dn = [
4335
4327
  icon: "icon.svg"
4336
4328
  }
4337
4329
  }, ae = "https://static.cartridge.gg/presets";
4338
- async function De() {
4330
+ async function Le() {
4339
4331
  try {
4340
4332
  const t = await fetch(`${ae}/index.json`);
4341
4333
  if (!t.ok)
@@ -4346,11 +4338,11 @@ async function De() {
4346
4338
  }
4347
4339
  }
4348
4340
  async function jn() {
4349
- return (await De()).configs;
4341
+ return (await Le()).configs;
4350
4342
  }
4351
4343
  async function Yn(t) {
4352
4344
  try {
4353
- const n = `${(await De()).baseUrl || ae}/${t}`, s = await fetch(`${n}/config.json`);
4345
+ const n = `${(await Le()).baseUrl || ae}/${t}`, s = await fetch(`${n}/config.json`);
4354
4346
  if (!s.ok)
4355
4347
  throw new Error(
4356
4348
  `Failed to load config ${t}: ${s.statusText}`
@@ -4381,7 +4373,7 @@ async function Yn(t) {
4381
4373
  }
4382
4374
  }
4383
4375
  async function Hn() {
4384
- const t = await De(), e = t.configs, r = t.baseUrl || ae, n = {};
4376
+ const t = await Le(), e = t.configs, r = t.baseUrl || ae, n = {};
4385
4377
  return await Promise.all(
4386
4378
  e.map(async (s) => {
4387
4379
  try {
@@ -4407,11 +4399,11 @@ export {
4407
4399
  Zn as EMBEDDED_WALLETS,
4408
4400
  es as EXTERNAL_WALLETS,
4409
4401
  ts as EXTRA_EXTERNAL_WALLETS,
4410
- Ce as EthereumWalletBase,
4402
+ Se as EthereumWalletBase,
4411
4403
  rs as FeeSource,
4412
4404
  ns as IMPLEMENTED_AUTH_OPTIONS,
4413
4405
  qr as MetaMaskWallet,
4414
- E as NotReadyToConnect,
4406
+ x as NotReadyToConnect,
4415
4407
  Nn as PhantomWallet,
4416
4408
  Rn as RabbyWallet,
4417
4409
  Q as ResponseCodes,
@@ -4421,7 +4413,7 @@ export {
4421
4413
  Kn as defaultTheme,
4422
4414
  Vn as erc20Metadata,
4423
4415
  jn as getAvailableConfigs,
4424
- De as getConfigsIndex,
4416
+ Le as getConfigsIndex,
4425
4417
  ss as humanizeString,
4426
4418
  Tt as isMobile,
4427
4419
  Hn as loadAllConfigs,