cppay-sdk 0.0.2-beta.25 → 0.0.2-beta.26
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/cppay-sdk.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/polygon-1pLQCNfb.js +3952 -0
- package/dist/polygon-zw79IkW8.cjs +15 -0
- package/dist/react.cjs +6 -1
- package/dist/react.js +422 -303
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +174 -235
- package/package.json +24 -7
- package/dist/AlertController-BPGQ5PgH.js +0 -12787
- package/dist/AlertController-CjTbf-Vd.cjs +0 -10
- package/dist/ApiController-Crww70p3.js +0 -5652
- package/dist/ApiController-DB43iwF1.cjs +0 -4
- package/dist/CaipNetworkUtil-Bd4HeTLY.js +0 -204
- package/dist/CaipNetworkUtil-Bg22uavB.cjs +0 -1
- package/dist/HelpersUtil-CeTmhhZv.js +0 -1415
- package/dist/HelpersUtil-L0eeYoE2.cjs +0 -225
- package/dist/PhArrowCircleDown-BBy_VuPx.js +0 -46
- package/dist/PhArrowCircleDown-BU4QSsA3.cjs +0 -14
- package/dist/PhArrowClockwise-D8C24T6J.js +0 -46
- package/dist/PhArrowClockwise-DWqhijc2.cjs +0 -14
- package/dist/PhArrowDown-Qm1T2ueY.cjs +0 -14
- package/dist/PhArrowDown-p9Tekztm.js +0 -46
- package/dist/PhArrowLeft-CEtyMFdq.cjs +0 -14
- package/dist/PhArrowLeft-CgSKs9Xe.js +0 -46
- package/dist/PhArrowRight-ZatyoD6R.cjs +0 -14
- package/dist/PhArrowRight-dMdzUgrx.js +0 -46
- package/dist/PhArrowSquareOut-CbP71Gny.js +0 -46
- package/dist/PhArrowSquareOut-HyssV9za.cjs +0 -14
- package/dist/PhArrowUp-Cz127u8b.cjs +0 -14
- package/dist/PhArrowUp-DNn-RQ7v.js +0 -46
- package/dist/PhArrowUpRight-BX6LlOL0.cjs +0 -14
- package/dist/PhArrowUpRight-OyGUhoGi.js +0 -46
- package/dist/PhArrowsClockwise-B6w_d2Gy.cjs +0 -14
- package/dist/PhArrowsClockwise-BWITTwAP.js +0 -46
- package/dist/PhArrowsDownUp-CHHtczH8.js +0 -46
- package/dist/PhArrowsDownUp-WYzjhvmQ.cjs +0 -14
- package/dist/PhArrowsLeftRight-BA0fjcLn.js +0 -46
- package/dist/PhArrowsLeftRight-bgyrYWLt.cjs +0 -14
- package/dist/PhBank-BInxTxLw.js +0 -46
- package/dist/PhBank-CZ_uTsAN.cjs +0 -14
- package/dist/PhBrowser--6CxS13p.js +0 -46
- package/dist/PhBrowser-BzOw0W8k.cjs +0 -14
- package/dist/PhCaretDown-D-zrPZN9.js +0 -46
- package/dist/PhCaretDown-DvF3M2iu.cjs +0 -14
- package/dist/PhCaretLeft-DND0SNkF.cjs +0 -14
- package/dist/PhCaretLeft-Dm6NsnIS.js +0 -46
- package/dist/PhCaretRight-BkRzbZ5m.js +0 -46
- package/dist/PhCaretRight-xQkT3bmO.cjs +0 -14
- package/dist/PhCaretUp-BEk_5jnn.cjs +0 -14
- package/dist/PhCaretUp-DZRZQ-T1.js +0 -46
- package/dist/PhCheck-BmwCUZuW.js +0 -46
- package/dist/PhCheck-C-u2QP3y.cjs +0 -14
- package/dist/PhCircleHalf--TfGDEAT.js +0 -46
- package/dist/PhCircleHalf-keQfI7pU.cjs +0 -14
- package/dist/PhClock-BvmbjmRx.cjs +0 -14
- package/dist/PhClock-DNCf5CVD.js +0 -46
- package/dist/PhCompass-B6tcbOFZ.js +0 -46
- package/dist/PhCompass-rWCQ_cR8.cjs +0 -14
- package/dist/PhCopy-CzC1olDO.cjs +0 -14
- package/dist/PhCopy-rbBTM6ME.js +0 -46
- package/dist/PhCreditCard-DOpOB0Pl.js +0 -46
- package/dist/PhCreditCard-D_qRVKuY.cjs +0 -14
- package/dist/PhCurrencyDollar-4EASQkjs.js +0 -46
- package/dist/PhCurrencyDollar-RVJJ6bQ3.cjs +0 -14
- package/dist/PhDesktop-CPaC-lRj.cjs +0 -14
- package/dist/PhDesktop-DZPux6RD.js +0 -46
- package/dist/PhDeviceMobile-BnXs4f3Q.cjs +0 -14
- package/dist/PhDeviceMobile-CcdKzyah.js +0 -46
- package/dist/PhDotsThree-19bbXQaM.js +0 -46
- package/dist/PhDotsThree-DSmFeW6i.cjs +0 -14
- package/dist/PhEnvelope-F7RF6h58.js +0 -46
- package/dist/PhEnvelope-QuTMQbE9.cjs +0 -14
- package/dist/PhFunnelSimple-B_FRP21W.js +0 -46
- package/dist/PhFunnelSimple-D4Ztu4ri.cjs +0 -14
- package/dist/PhGlobe-B8GrTk4S.cjs +0 -14
- package/dist/PhGlobe-BSPoRqTV.js +0 -46
- package/dist/PhIdentificationCard-fGDBGII0.cjs +0 -14
- package/dist/PhIdentificationCard-giQnti3K.js +0 -46
- package/dist/PhImage-BpUk8j27.cjs +0 -14
- package/dist/PhImage-PtBaftbW.js +0 -46
- package/dist/PhInfo-DQEDS02h.js +0 -46
- package/dist/PhInfo-V5wKJJoK.cjs +0 -14
- package/dist/PhLightbulb-Cisg0Myw.js +0 -46
- package/dist/PhLightbulb-xP9kaUlD.cjs +0 -14
- package/dist/PhMagnifyingGlass-C1cVSYf2.cjs +0 -14
- package/dist/PhMagnifyingGlass-DlkOfQXn.js +0 -46
- package/dist/PhPaperPlaneRight-C7Jp2jl_.js +0 -46
- package/dist/PhPaperPlaneRight-Kh3uxxIy.cjs +0 -14
- package/dist/PhPlus-BgHn57eW.js +0 -46
- package/dist/PhPlus-hJ6DZNjc.cjs +0 -14
- package/dist/PhPower-C369g1jk.js +0 -46
- package/dist/PhPower-DZ-SpUrD.cjs +0 -14
- package/dist/PhPuzzlePiece-B0oABcWl.js +0 -46
- package/dist/PhPuzzlePiece-DLtOLrcw.cjs +0 -14
- package/dist/PhQrCode-BT_hyeEa.js +0 -46
- package/dist/PhQrCode-yI6bLoYY.cjs +0 -14
- package/dist/PhQuestion-B1UeE96D.js +0 -46
- package/dist/PhQuestion-icSeWABx.cjs +0 -14
- package/dist/PhQuestionMark-CBVW9Awo.js +0 -46
- package/dist/PhQuestionMark-Cmhqu81E.cjs +0 -14
- package/dist/PhSealCheck-DTKS5QAx.cjs +0 -14
- package/dist/PhSealCheck-Dm2I2X7k.js +0 -46
- package/dist/PhSignOut-25xp33w2.cjs +0 -14
- package/dist/PhSignOut-BTTDADPY.js +0 -46
- package/dist/PhSpinner-Dbua7p0Y.js +0 -46
- package/dist/PhSpinner-DtpwblyA.cjs +0 -14
- package/dist/PhTrash-B3wUg10m.cjs +0 -14
- package/dist/PhTrash-gZghJkGX.js +0 -46
- package/dist/PhUser-Bvcv05IM.js +0 -46
- package/dist/PhUser-COPP3N-M.cjs +0 -14
- package/dist/PhVault-CFa5lrPU.cjs +0 -14
- package/dist/PhVault-DvlBF0VI.js +0 -46
- package/dist/PhWallet-CzJcybaO.cjs +0 -14
- package/dist/PhWallet-Do_lf9BX.js +0 -46
- package/dist/PhWarning-BrbSc7gQ.cjs +0 -14
- package/dist/PhWarning-DiIpJVsx.js +0 -46
- package/dist/PhWarningCircle-DE9BlEIc.js +0 -46
- package/dist/PhWarningCircle-F5Piypme.cjs +0 -14
- package/dist/PhX-BK3VZT8X.cjs +0 -14
- package/dist/PhX-CNlXuiat.js +0 -46
- package/dist/basic-C16-Uba1.js +0 -3796
- package/dist/basic-ChiCOE6E.cjs +0 -1329
- package/dist/chunk-2qRSBEuq.js +0 -18
- package/dist/chunk-DT80SxnK.cjs +0 -1
- package/dist/core-DKXmyfMB.js +0 -2337
- package/dist/core-PuDBroil.cjs +0 -1
- package/dist/dijkstra-CNhLvnjU.cjs +0 -1
- package/dist/dijkstra-kFl0HtsI.js +0 -56
- package/dist/features-BYfQH2hG.cjs +0 -2
- package/dist/features-_5Pi-gXV.js +0 -245
- package/dist/index.es-DDV8bPq_.js +0 -8311
- package/dist/index.es-fgFnvPDP.cjs +0 -19
- package/dist/property-Dil4gG0H.cjs +0 -3
- package/dist/property-JsW5AM1M.js +0 -578
- package/dist/w3m-modal-BBvmkTyb.cjs +0 -2416
- package/dist/w3m-modal-CFhImDZN.js +0 -5286
- package/dist/walletconnect-B0zXLUON.cjs +0 -17
- package/dist/walletconnect-Bb4rv9-G.js +0 -11314
- package/dist/wui-list-item-BGvfYb1W.cjs +0 -1452
- package/dist/wui-list-item-C4wJpGBn.js +0 -2123
|
@@ -0,0 +1,3952 @@
|
|
|
1
|
+
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJSMin = (e, C) => () => (C || e((C = { exports: {} }).exports, C), C.exports), __copyProps = (e, E, O, k) => {
|
|
2
|
+
if (E && typeof E == "object" || typeof E == "function") for (var A = __getOwnPropNames(E), j = 0, M = A.length, N; j < M; j++) N = A[j], !__hasOwnProp.call(e, N) && N !== O && __defProp(e, N, {
|
|
3
|
+
get: ((e) => E[e]).bind(null, N),
|
|
4
|
+
enumerable: !(k = __getOwnPropDesc(E, N)) || k.enumerable
|
|
5
|
+
});
|
|
6
|
+
return e;
|
|
7
|
+
}, __toESM = (w, T, D) => (D = w == null ? {} : __create(__getProtoOf(w)), __copyProps(T || !w || !w.__esModule ? __defProp(D, "default", {
|
|
8
|
+
value: w,
|
|
9
|
+
enumerable: !0
|
|
10
|
+
}) : D, w)), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, C) => (typeof require < "u" ? require : e)[C] }) : e)(function(e) {
|
|
11
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
12
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function.");
|
|
13
|
+
}), payment_dialog_default = "._cppay-overlay{z-index:999;background-color:#00000080;justify-content:center;align-items:center;padding:1rem;display:flex;position:fixed;inset:0}._cppay-dialog{background-color:#fff;border-radius:1.5rem;flex-direction:column;width:100%;max-width:28rem;max-height:90vh;display:flex;overflow:hidden;box-shadow:0 20px 25px -5px #0000001a,0 10px 10px -5px #0000000a}._cppay-header{border-bottom:1px solid #e5e7eb;justify-content:space-between;align-items:center;padding:1rem 1.25rem;display:flex}._cppay-title{color:#111827;margin:0;font-size:1.25rem;font-weight:600}._cppay-close-btn{color:#9ca3af;cursor:pointer;background:0 0;border:none;padding:.25rem;transition:color .2s}._cppay-close-btn:hover:not(:disabled){color:#4b5563}._cppay-close-btn:disabled{opacity:.5;cursor:not-allowed}._cppay-close-btn svg{width:1.5rem;height:1.5rem}._cppay-content{flex:1;padding:1.25rem;overflow-y:auto}._cppay-section{margin-bottom:1rem}._cppay-section:last-child{margin-bottom:0}._cppay-label{color:#374151;margin-bottom:.5rem;font-size:.875rem;font-weight:500;display:block}._cppay-grid{grid-template-columns:repeat(2,1fr);gap:.75rem;display:grid}._cppay-select-btn{cursor:pointer;background:#fff;border:2px solid #e5e7eb;border-radius:.75rem;align-items:center;gap:.5rem;padding:.75rem;font-family:inherit;font-size:.875rem;transition:all .2s;display:flex}._cppay-select-btn:hover{border-color:#d1d5db}._cppay-select-btn._cppay-selected{background-color:#eff6ff;border-color:#2563eb}._cppay-select-btn img{border-radius:9999px;width:1.5rem;height:1.5rem}._cppay-select-btn span{font-weight:500}._cppay-price-box{background-color:#f9fafb;border-radius:1rem;padding:1rem}._cppay-price-row{justify-content:space-between;align-items:center;display:flex}._cppay-price-label{color:#4b5563;font-size:.875rem}._cppay-price-amount{text-align:right}._cppay-price-main{color:#111827;margin:0;font-size:1.25rem;font-weight:700}._cppay-price-sub{color:#6b7280;margin-top:.25rem;font-size:.875rem}._cppay-btn{cursor:pointer;border:none;border-radius:.75rem;width:100%;padding:.75rem;font-family:inherit;font-size:1rem;font-weight:500;transition:all .2s}._cppay-btn-primary{color:#fff;background-color:#2563eb}._cppay-btn-primary:hover:not(:disabled){background-color:#1d4ed8}._cppay-btn-primary:disabled{opacity:.5;cursor:not-allowed}._cppay-btn-secondary{color:#374151;background-color:#fff;border:1px solid #d1d5db}._cppay-btn-secondary:hover:not(:disabled){background-color:#f9fafb}._cppay-btn-secondary:disabled{opacity:.5;cursor:not-allowed}._cppay-btn-text{color:#6b7280;text-align:center;background:0 0;border:none;padding:.5rem;font-size:.875rem}._cppay-btn-text:hover:not(:disabled){color:#2563eb;background:0 0}._cppay-btn-text:disabled{opacity:.5;cursor:not-allowed}._cppay-btn-container{align-items:center;gap:.5rem;display:flex}._cppay-qr-container{justify-content:center;margin-bottom:1rem;display:flex}._cppay-qr-code{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);border-radius:1rem;padding:.75rem;box-shadow:0 4px 12px #667eea26}._cppay-qr-placeholder{background-color:#f3f4f6;border-radius:.75rem;justify-content:center;align-items:center;width:10rem;height:10rem;display:flex}._cppay-qr-placeholder span{color:#9ca3af;font-size:.875rem}._cppay-info-box{background-color:#f9fafb;border-radius:.75rem;margin-bottom:.625rem;padding:.875rem}._cppay-info-box:last-child{margin-bottom:0}._cppay-info-label{color:#4b5563;margin-bottom:.25rem;font-size:.875rem}._cppay-info-value{color:#111827;font-size:1.25rem;font-weight:700}._cppay-address-row{align-items:center;gap:.5rem;display:flex}._cppay-address-row code{text-overflow:ellipsis;white-space:nowrap;color:#111827;background:0 0;flex:1;font-family:monospace;font-size:.75rem;overflow:hidden}._cppay-copy-btn{color:#2563eb;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:.25rem;transition:color .2s;display:flex}._cppay-copy-btn:hover{color:#1d4ed8}._cppay-copy-btn svg{width:1.25rem;height:1.25rem}@keyframes _cppay-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes _cppay-slideUp{0%{opacity:0;transform:translateY(1.25rem)}to{opacity:1;transform:translateY(0)}}._cppay-overlay{animation:.3s _cppay-fadeIn}._cppay-dialog{animation:.3s _cppay-slideUp}@media (max-width:640px){._cppay-dialog{margin:.5rem}._cppay-header,._cppay-content{padding:1rem}}";
|
|
14
|
+
function injectStyle(e) {
|
|
15
|
+
if (typeof document > "u" || document.getElementById("_cppay-payment-dialog-style")) return;
|
|
16
|
+
let C = document.createElement("style");
|
|
17
|
+
C.id = "_cppay-payment-dialog-style", C.textContent = e, document.head.appendChild(C);
|
|
18
|
+
}
|
|
19
|
+
var require_can_promise = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
20
|
+
C.exports = function() {
|
|
21
|
+
return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
|
|
22
|
+
};
|
|
23
|
+
})), require_utils$1 = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
24
|
+
var C, w = [
|
|
25
|
+
0,
|
|
26
|
+
26,
|
|
27
|
+
44,
|
|
28
|
+
70,
|
|
29
|
+
100,
|
|
30
|
+
134,
|
|
31
|
+
172,
|
|
32
|
+
196,
|
|
33
|
+
242,
|
|
34
|
+
292,
|
|
35
|
+
346,
|
|
36
|
+
404,
|
|
37
|
+
466,
|
|
38
|
+
532,
|
|
39
|
+
581,
|
|
40
|
+
655,
|
|
41
|
+
733,
|
|
42
|
+
815,
|
|
43
|
+
901,
|
|
44
|
+
991,
|
|
45
|
+
1085,
|
|
46
|
+
1156,
|
|
47
|
+
1258,
|
|
48
|
+
1364,
|
|
49
|
+
1474,
|
|
50
|
+
1588,
|
|
51
|
+
1706,
|
|
52
|
+
1828,
|
|
53
|
+
1921,
|
|
54
|
+
2051,
|
|
55
|
+
2185,
|
|
56
|
+
2323,
|
|
57
|
+
2465,
|
|
58
|
+
2611,
|
|
59
|
+
2761,
|
|
60
|
+
2876,
|
|
61
|
+
3034,
|
|
62
|
+
3196,
|
|
63
|
+
3362,
|
|
64
|
+
3532,
|
|
65
|
+
3706
|
|
66
|
+
];
|
|
67
|
+
e.getSymbolSize = function(e) {
|
|
68
|
+
if (!e) throw Error("\"version\" cannot be null or undefined");
|
|
69
|
+
if (e < 1 || e > 40) throw Error("\"version\" should be in range from 1 to 40");
|
|
70
|
+
return e * 4 + 17;
|
|
71
|
+
}, e.getSymbolTotalCodewords = function(e) {
|
|
72
|
+
return w[e];
|
|
73
|
+
}, e.getBCHDigit = function(e) {
|
|
74
|
+
let C = 0;
|
|
75
|
+
for (; e !== 0;) C++, e >>>= 1;
|
|
76
|
+
return C;
|
|
77
|
+
}, e.setToSJISFunction = function(e) {
|
|
78
|
+
if (typeof e != "function") throw Error("\"toSJISFunc\" is not a valid function.");
|
|
79
|
+
C = e;
|
|
80
|
+
}, e.isKanjiModeEnabled = function() {
|
|
81
|
+
return C !== void 0;
|
|
82
|
+
}, e.toSJIS = function(e) {
|
|
83
|
+
return C(e);
|
|
84
|
+
};
|
|
85
|
+
})), require_error_correction_level = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
86
|
+
e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
|
|
87
|
+
function C(C) {
|
|
88
|
+
if (typeof C != "string") throw Error("Param is not a string");
|
|
89
|
+
switch (C.toLowerCase()) {
|
|
90
|
+
case "l":
|
|
91
|
+
case "low": return e.L;
|
|
92
|
+
case "m":
|
|
93
|
+
case "medium": return e.M;
|
|
94
|
+
case "q":
|
|
95
|
+
case "quartile": return e.Q;
|
|
96
|
+
case "h":
|
|
97
|
+
case "high": return e.H;
|
|
98
|
+
default: throw Error("Unknown EC Level: " + C);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
e.isValid = function(e) {
|
|
102
|
+
return e && e.bit !== void 0 && e.bit >= 0 && e.bit < 4;
|
|
103
|
+
}, e.from = function(w, T) {
|
|
104
|
+
if (e.isValid(w)) return w;
|
|
105
|
+
try {
|
|
106
|
+
return C(w);
|
|
107
|
+
} catch {
|
|
108
|
+
return T;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
})), require_bit_buffer = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
112
|
+
function w() {
|
|
113
|
+
this.buffer = [], this.length = 0;
|
|
114
|
+
}
|
|
115
|
+
w.prototype = {
|
|
116
|
+
get: function(e) {
|
|
117
|
+
let C = Math.floor(e / 8);
|
|
118
|
+
return (this.buffer[C] >>> 7 - e % 8 & 1) == 1;
|
|
119
|
+
},
|
|
120
|
+
put: function(e, C) {
|
|
121
|
+
for (let w = 0; w < C; w++) this.putBit((e >>> C - w - 1 & 1) == 1);
|
|
122
|
+
},
|
|
123
|
+
getLengthInBits: function() {
|
|
124
|
+
return this.length;
|
|
125
|
+
},
|
|
126
|
+
putBit: function(e) {
|
|
127
|
+
let C = Math.floor(this.length / 8);
|
|
128
|
+
this.buffer.length <= C && this.buffer.push(0), e && (this.buffer[C] |= 128 >>> this.length % 8), this.length++;
|
|
129
|
+
}
|
|
130
|
+
}, C.exports = w;
|
|
131
|
+
})), require_bit_matrix = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
132
|
+
function w(e) {
|
|
133
|
+
if (!e || e < 1) throw Error("BitMatrix size must be defined and greater than 0");
|
|
134
|
+
this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
|
|
135
|
+
}
|
|
136
|
+
w.prototype.set = function(e, C, w, T) {
|
|
137
|
+
let E = e * this.size + C;
|
|
138
|
+
this.data[E] = w, T && (this.reservedBit[E] = !0);
|
|
139
|
+
}, w.prototype.get = function(e, C) {
|
|
140
|
+
return this.data[e * this.size + C];
|
|
141
|
+
}, w.prototype.xor = function(e, C, w) {
|
|
142
|
+
this.data[e * this.size + C] ^= w;
|
|
143
|
+
}, w.prototype.isReserved = function(e, C) {
|
|
144
|
+
return this.reservedBit[e * this.size + C];
|
|
145
|
+
}, C.exports = w;
|
|
146
|
+
})), require_alignment_pattern = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
147
|
+
var C = require_utils$1().getSymbolSize;
|
|
148
|
+
e.getRowColCoords = function(e) {
|
|
149
|
+
if (e === 1) return [];
|
|
150
|
+
let w = Math.floor(e / 7) + 2, T = C(e), E = T === 145 ? 26 : Math.ceil((T - 13) / (2 * w - 2)) * 2, D = [T - 7];
|
|
151
|
+
for (let e = 1; e < w - 1; e++) D[e] = D[e - 1] - E;
|
|
152
|
+
return D.push(6), D.reverse();
|
|
153
|
+
}, e.getPositions = function(C) {
|
|
154
|
+
let w = [], T = e.getRowColCoords(C), E = T.length;
|
|
155
|
+
for (let e = 0; e < E; e++) for (let C = 0; C < E; C++) e === 0 && C === 0 || e === 0 && C === E - 1 || e === E - 1 && C === 0 || w.push([T[e], T[C]]);
|
|
156
|
+
return w;
|
|
157
|
+
};
|
|
158
|
+
})), require_finder_pattern = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
159
|
+
var C = require_utils$1().getSymbolSize, w = 7;
|
|
160
|
+
e.getPositions = function(e) {
|
|
161
|
+
let T = C(e);
|
|
162
|
+
return [
|
|
163
|
+
[0, 0],
|
|
164
|
+
[T - w, 0],
|
|
165
|
+
[0, T - w]
|
|
166
|
+
];
|
|
167
|
+
};
|
|
168
|
+
})), require_mask_pattern = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
169
|
+
e.Patterns = {
|
|
170
|
+
PATTERN000: 0,
|
|
171
|
+
PATTERN001: 1,
|
|
172
|
+
PATTERN010: 2,
|
|
173
|
+
PATTERN011: 3,
|
|
174
|
+
PATTERN100: 4,
|
|
175
|
+
PATTERN101: 5,
|
|
176
|
+
PATTERN110: 6,
|
|
177
|
+
PATTERN111: 7
|
|
178
|
+
};
|
|
179
|
+
var C = {
|
|
180
|
+
N1: 3,
|
|
181
|
+
N2: 3,
|
|
182
|
+
N3: 40,
|
|
183
|
+
N4: 10
|
|
184
|
+
};
|
|
185
|
+
e.isValid = function(e) {
|
|
186
|
+
return e != null && e !== "" && !isNaN(e) && e >= 0 && e <= 7;
|
|
187
|
+
}, e.from = function(C) {
|
|
188
|
+
return e.isValid(C) ? parseInt(C, 10) : void 0;
|
|
189
|
+
}, e.getPenaltyN1 = function(e) {
|
|
190
|
+
let w = e.size, T = 0, E = 0, D = 0, O = null, k = null;
|
|
191
|
+
for (let A = 0; A < w; A++) {
|
|
192
|
+
E = D = 0, O = k = null;
|
|
193
|
+
for (let j = 0; j < w; j++) {
|
|
194
|
+
let w = e.get(A, j);
|
|
195
|
+
w === O ? E++ : (E >= 5 && (T += C.N1 + (E - 5)), O = w, E = 1), w = e.get(j, A), w === k ? D++ : (D >= 5 && (T += C.N1 + (D - 5)), k = w, D = 1);
|
|
196
|
+
}
|
|
197
|
+
E >= 5 && (T += C.N1 + (E - 5)), D >= 5 && (T += C.N1 + (D - 5));
|
|
198
|
+
}
|
|
199
|
+
return T;
|
|
200
|
+
}, e.getPenaltyN2 = function(e) {
|
|
201
|
+
let w = e.size, T = 0;
|
|
202
|
+
for (let C = 0; C < w - 1; C++) for (let E = 0; E < w - 1; E++) {
|
|
203
|
+
let w = e.get(C, E) + e.get(C, E + 1) + e.get(C + 1, E) + e.get(C + 1, E + 1);
|
|
204
|
+
(w === 4 || w === 0) && T++;
|
|
205
|
+
}
|
|
206
|
+
return T * C.N2;
|
|
207
|
+
}, e.getPenaltyN3 = function(e) {
|
|
208
|
+
let w = e.size, T = 0, E = 0, D = 0;
|
|
209
|
+
for (let C = 0; C < w; C++) {
|
|
210
|
+
E = D = 0;
|
|
211
|
+
for (let O = 0; O < w; O++) E = E << 1 & 2047 | e.get(C, O), O >= 10 && (E === 1488 || E === 93) && T++, D = D << 1 & 2047 | e.get(O, C), O >= 10 && (D === 1488 || D === 93) && T++;
|
|
212
|
+
}
|
|
213
|
+
return T * C.N3;
|
|
214
|
+
}, e.getPenaltyN4 = function(e) {
|
|
215
|
+
let w = 0, T = e.data.length;
|
|
216
|
+
for (let C = 0; C < T; C++) w += e.data[C];
|
|
217
|
+
return Math.abs(Math.ceil(w * 100 / T / 5) - 10) * C.N4;
|
|
218
|
+
};
|
|
219
|
+
function w(C, w, T) {
|
|
220
|
+
switch (C) {
|
|
221
|
+
case e.Patterns.PATTERN000: return (w + T) % 2 == 0;
|
|
222
|
+
case e.Patterns.PATTERN001: return w % 2 == 0;
|
|
223
|
+
case e.Patterns.PATTERN010: return T % 3 == 0;
|
|
224
|
+
case e.Patterns.PATTERN011: return (w + T) % 3 == 0;
|
|
225
|
+
case e.Patterns.PATTERN100: return (Math.floor(w / 2) + Math.floor(T / 3)) % 2 == 0;
|
|
226
|
+
case e.Patterns.PATTERN101: return w * T % 2 + w * T % 3 == 0;
|
|
227
|
+
case e.Patterns.PATTERN110: return (w * T % 2 + w * T % 3) % 2 == 0;
|
|
228
|
+
case e.Patterns.PATTERN111: return (w * T % 3 + (w + T) % 2) % 2 == 0;
|
|
229
|
+
default: throw Error("bad maskPattern:" + C);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
e.applyMask = function(e, C) {
|
|
233
|
+
let T = C.size;
|
|
234
|
+
for (let E = 0; E < T; E++) for (let D = 0; D < T; D++) C.isReserved(D, E) || C.xor(D, E, w(e, D, E));
|
|
235
|
+
}, e.getBestMask = function(C, w) {
|
|
236
|
+
let T = Object.keys(e.Patterns).length, E = 0, D = Infinity;
|
|
237
|
+
for (let O = 0; O < T; O++) {
|
|
238
|
+
w(O), e.applyMask(O, C);
|
|
239
|
+
let T = e.getPenaltyN1(C) + e.getPenaltyN2(C) + e.getPenaltyN3(C) + e.getPenaltyN4(C);
|
|
240
|
+
e.applyMask(O, C), T < D && (D = T, E = O);
|
|
241
|
+
}
|
|
242
|
+
return E;
|
|
243
|
+
};
|
|
244
|
+
})), require_error_correction_code = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
245
|
+
var C = require_error_correction_level(), w = [
|
|
246
|
+
1,
|
|
247
|
+
1,
|
|
248
|
+
1,
|
|
249
|
+
1,
|
|
250
|
+
1,
|
|
251
|
+
1,
|
|
252
|
+
1,
|
|
253
|
+
1,
|
|
254
|
+
1,
|
|
255
|
+
1,
|
|
256
|
+
2,
|
|
257
|
+
2,
|
|
258
|
+
1,
|
|
259
|
+
2,
|
|
260
|
+
2,
|
|
261
|
+
4,
|
|
262
|
+
1,
|
|
263
|
+
2,
|
|
264
|
+
4,
|
|
265
|
+
4,
|
|
266
|
+
2,
|
|
267
|
+
4,
|
|
268
|
+
4,
|
|
269
|
+
4,
|
|
270
|
+
2,
|
|
271
|
+
4,
|
|
272
|
+
6,
|
|
273
|
+
5,
|
|
274
|
+
2,
|
|
275
|
+
4,
|
|
276
|
+
6,
|
|
277
|
+
6,
|
|
278
|
+
2,
|
|
279
|
+
5,
|
|
280
|
+
8,
|
|
281
|
+
8,
|
|
282
|
+
4,
|
|
283
|
+
5,
|
|
284
|
+
8,
|
|
285
|
+
8,
|
|
286
|
+
4,
|
|
287
|
+
5,
|
|
288
|
+
8,
|
|
289
|
+
11,
|
|
290
|
+
4,
|
|
291
|
+
8,
|
|
292
|
+
10,
|
|
293
|
+
11,
|
|
294
|
+
4,
|
|
295
|
+
9,
|
|
296
|
+
12,
|
|
297
|
+
16,
|
|
298
|
+
4,
|
|
299
|
+
9,
|
|
300
|
+
16,
|
|
301
|
+
16,
|
|
302
|
+
6,
|
|
303
|
+
10,
|
|
304
|
+
12,
|
|
305
|
+
18,
|
|
306
|
+
6,
|
|
307
|
+
10,
|
|
308
|
+
17,
|
|
309
|
+
16,
|
|
310
|
+
6,
|
|
311
|
+
11,
|
|
312
|
+
16,
|
|
313
|
+
19,
|
|
314
|
+
6,
|
|
315
|
+
13,
|
|
316
|
+
18,
|
|
317
|
+
21,
|
|
318
|
+
7,
|
|
319
|
+
14,
|
|
320
|
+
21,
|
|
321
|
+
25,
|
|
322
|
+
8,
|
|
323
|
+
16,
|
|
324
|
+
20,
|
|
325
|
+
25,
|
|
326
|
+
8,
|
|
327
|
+
17,
|
|
328
|
+
23,
|
|
329
|
+
25,
|
|
330
|
+
9,
|
|
331
|
+
17,
|
|
332
|
+
23,
|
|
333
|
+
34,
|
|
334
|
+
9,
|
|
335
|
+
18,
|
|
336
|
+
25,
|
|
337
|
+
30,
|
|
338
|
+
10,
|
|
339
|
+
20,
|
|
340
|
+
27,
|
|
341
|
+
32,
|
|
342
|
+
12,
|
|
343
|
+
21,
|
|
344
|
+
29,
|
|
345
|
+
35,
|
|
346
|
+
12,
|
|
347
|
+
23,
|
|
348
|
+
34,
|
|
349
|
+
37,
|
|
350
|
+
12,
|
|
351
|
+
25,
|
|
352
|
+
34,
|
|
353
|
+
40,
|
|
354
|
+
13,
|
|
355
|
+
26,
|
|
356
|
+
35,
|
|
357
|
+
42,
|
|
358
|
+
14,
|
|
359
|
+
28,
|
|
360
|
+
38,
|
|
361
|
+
45,
|
|
362
|
+
15,
|
|
363
|
+
29,
|
|
364
|
+
40,
|
|
365
|
+
48,
|
|
366
|
+
16,
|
|
367
|
+
31,
|
|
368
|
+
43,
|
|
369
|
+
51,
|
|
370
|
+
17,
|
|
371
|
+
33,
|
|
372
|
+
45,
|
|
373
|
+
54,
|
|
374
|
+
18,
|
|
375
|
+
35,
|
|
376
|
+
48,
|
|
377
|
+
57,
|
|
378
|
+
19,
|
|
379
|
+
37,
|
|
380
|
+
51,
|
|
381
|
+
60,
|
|
382
|
+
19,
|
|
383
|
+
38,
|
|
384
|
+
53,
|
|
385
|
+
63,
|
|
386
|
+
20,
|
|
387
|
+
40,
|
|
388
|
+
56,
|
|
389
|
+
66,
|
|
390
|
+
21,
|
|
391
|
+
43,
|
|
392
|
+
59,
|
|
393
|
+
70,
|
|
394
|
+
22,
|
|
395
|
+
45,
|
|
396
|
+
62,
|
|
397
|
+
74,
|
|
398
|
+
24,
|
|
399
|
+
47,
|
|
400
|
+
65,
|
|
401
|
+
77,
|
|
402
|
+
25,
|
|
403
|
+
49,
|
|
404
|
+
68,
|
|
405
|
+
81
|
|
406
|
+
], T = [
|
|
407
|
+
7,
|
|
408
|
+
10,
|
|
409
|
+
13,
|
|
410
|
+
17,
|
|
411
|
+
10,
|
|
412
|
+
16,
|
|
413
|
+
22,
|
|
414
|
+
28,
|
|
415
|
+
15,
|
|
416
|
+
26,
|
|
417
|
+
36,
|
|
418
|
+
44,
|
|
419
|
+
20,
|
|
420
|
+
36,
|
|
421
|
+
52,
|
|
422
|
+
64,
|
|
423
|
+
26,
|
|
424
|
+
48,
|
|
425
|
+
72,
|
|
426
|
+
88,
|
|
427
|
+
36,
|
|
428
|
+
64,
|
|
429
|
+
96,
|
|
430
|
+
112,
|
|
431
|
+
40,
|
|
432
|
+
72,
|
|
433
|
+
108,
|
|
434
|
+
130,
|
|
435
|
+
48,
|
|
436
|
+
88,
|
|
437
|
+
132,
|
|
438
|
+
156,
|
|
439
|
+
60,
|
|
440
|
+
110,
|
|
441
|
+
160,
|
|
442
|
+
192,
|
|
443
|
+
72,
|
|
444
|
+
130,
|
|
445
|
+
192,
|
|
446
|
+
224,
|
|
447
|
+
80,
|
|
448
|
+
150,
|
|
449
|
+
224,
|
|
450
|
+
264,
|
|
451
|
+
96,
|
|
452
|
+
176,
|
|
453
|
+
260,
|
|
454
|
+
308,
|
|
455
|
+
104,
|
|
456
|
+
198,
|
|
457
|
+
288,
|
|
458
|
+
352,
|
|
459
|
+
120,
|
|
460
|
+
216,
|
|
461
|
+
320,
|
|
462
|
+
384,
|
|
463
|
+
132,
|
|
464
|
+
240,
|
|
465
|
+
360,
|
|
466
|
+
432,
|
|
467
|
+
144,
|
|
468
|
+
280,
|
|
469
|
+
408,
|
|
470
|
+
480,
|
|
471
|
+
168,
|
|
472
|
+
308,
|
|
473
|
+
448,
|
|
474
|
+
532,
|
|
475
|
+
180,
|
|
476
|
+
338,
|
|
477
|
+
504,
|
|
478
|
+
588,
|
|
479
|
+
196,
|
|
480
|
+
364,
|
|
481
|
+
546,
|
|
482
|
+
650,
|
|
483
|
+
224,
|
|
484
|
+
416,
|
|
485
|
+
600,
|
|
486
|
+
700,
|
|
487
|
+
224,
|
|
488
|
+
442,
|
|
489
|
+
644,
|
|
490
|
+
750,
|
|
491
|
+
252,
|
|
492
|
+
476,
|
|
493
|
+
690,
|
|
494
|
+
816,
|
|
495
|
+
270,
|
|
496
|
+
504,
|
|
497
|
+
750,
|
|
498
|
+
900,
|
|
499
|
+
300,
|
|
500
|
+
560,
|
|
501
|
+
810,
|
|
502
|
+
960,
|
|
503
|
+
312,
|
|
504
|
+
588,
|
|
505
|
+
870,
|
|
506
|
+
1050,
|
|
507
|
+
336,
|
|
508
|
+
644,
|
|
509
|
+
952,
|
|
510
|
+
1110,
|
|
511
|
+
360,
|
|
512
|
+
700,
|
|
513
|
+
1020,
|
|
514
|
+
1200,
|
|
515
|
+
390,
|
|
516
|
+
728,
|
|
517
|
+
1050,
|
|
518
|
+
1260,
|
|
519
|
+
420,
|
|
520
|
+
784,
|
|
521
|
+
1140,
|
|
522
|
+
1350,
|
|
523
|
+
450,
|
|
524
|
+
812,
|
|
525
|
+
1200,
|
|
526
|
+
1440,
|
|
527
|
+
480,
|
|
528
|
+
868,
|
|
529
|
+
1290,
|
|
530
|
+
1530,
|
|
531
|
+
510,
|
|
532
|
+
924,
|
|
533
|
+
1350,
|
|
534
|
+
1620,
|
|
535
|
+
540,
|
|
536
|
+
980,
|
|
537
|
+
1440,
|
|
538
|
+
1710,
|
|
539
|
+
570,
|
|
540
|
+
1036,
|
|
541
|
+
1530,
|
|
542
|
+
1800,
|
|
543
|
+
570,
|
|
544
|
+
1064,
|
|
545
|
+
1590,
|
|
546
|
+
1890,
|
|
547
|
+
600,
|
|
548
|
+
1120,
|
|
549
|
+
1680,
|
|
550
|
+
1980,
|
|
551
|
+
630,
|
|
552
|
+
1204,
|
|
553
|
+
1770,
|
|
554
|
+
2100,
|
|
555
|
+
660,
|
|
556
|
+
1260,
|
|
557
|
+
1860,
|
|
558
|
+
2220,
|
|
559
|
+
720,
|
|
560
|
+
1316,
|
|
561
|
+
1950,
|
|
562
|
+
2310,
|
|
563
|
+
750,
|
|
564
|
+
1372,
|
|
565
|
+
2040,
|
|
566
|
+
2430
|
|
567
|
+
];
|
|
568
|
+
e.getBlocksCount = function(e, T) {
|
|
569
|
+
switch (T) {
|
|
570
|
+
case C.L: return w[(e - 1) * 4 + 0];
|
|
571
|
+
case C.M: return w[(e - 1) * 4 + 1];
|
|
572
|
+
case C.Q: return w[(e - 1) * 4 + 2];
|
|
573
|
+
case C.H: return w[(e - 1) * 4 + 3];
|
|
574
|
+
default: return;
|
|
575
|
+
}
|
|
576
|
+
}, e.getTotalCodewordsCount = function(e, w) {
|
|
577
|
+
switch (w) {
|
|
578
|
+
case C.L: return T[(e - 1) * 4 + 0];
|
|
579
|
+
case C.M: return T[(e - 1) * 4 + 1];
|
|
580
|
+
case C.Q: return T[(e - 1) * 4 + 2];
|
|
581
|
+
case C.H: return T[(e - 1) * 4 + 3];
|
|
582
|
+
default: return;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
})), require_galois_field = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
586
|
+
var C = new Uint8Array(512), w = new Uint8Array(256);
|
|
587
|
+
(function() {
|
|
588
|
+
let e = 1;
|
|
589
|
+
for (let T = 0; T < 255; T++) C[T] = e, w[e] = T, e <<= 1, e & 256 && (e ^= 285);
|
|
590
|
+
for (let e = 255; e < 512; e++) C[e] = C[e - 255];
|
|
591
|
+
})(), e.log = function(e) {
|
|
592
|
+
if (e < 1) throw Error("log(" + e + ")");
|
|
593
|
+
return w[e];
|
|
594
|
+
}, e.exp = function(e) {
|
|
595
|
+
return C[e];
|
|
596
|
+
}, e.mul = function(e, T) {
|
|
597
|
+
return e === 0 || T === 0 ? 0 : C[w[e] + w[T]];
|
|
598
|
+
};
|
|
599
|
+
})), require_polynomial = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
600
|
+
var C = require_galois_field();
|
|
601
|
+
e.mul = function(e, w) {
|
|
602
|
+
let T = new Uint8Array(e.length + w.length - 1);
|
|
603
|
+
for (let E = 0; E < e.length; E++) for (let D = 0; D < w.length; D++) T[E + D] ^= C.mul(e[E], w[D]);
|
|
604
|
+
return T;
|
|
605
|
+
}, e.mod = function(e, w) {
|
|
606
|
+
let T = new Uint8Array(e);
|
|
607
|
+
for (; T.length - w.length >= 0;) {
|
|
608
|
+
let e = T[0];
|
|
609
|
+
for (let E = 0; E < w.length; E++) T[E] ^= C.mul(w[E], e);
|
|
610
|
+
let E = 0;
|
|
611
|
+
for (; E < T.length && T[E] === 0;) E++;
|
|
612
|
+
T = T.slice(E);
|
|
613
|
+
}
|
|
614
|
+
return T;
|
|
615
|
+
}, e.generateECPolynomial = function(w) {
|
|
616
|
+
let T = new Uint8Array([1]);
|
|
617
|
+
for (let E = 0; E < w; E++) T = e.mul(T, new Uint8Array([1, C.exp(E)]));
|
|
618
|
+
return T;
|
|
619
|
+
};
|
|
620
|
+
})), require_reed_solomon_encoder = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
621
|
+
var w = require_polynomial();
|
|
622
|
+
function T(e) {
|
|
623
|
+
this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
|
|
624
|
+
}
|
|
625
|
+
T.prototype.initialize = function(e) {
|
|
626
|
+
this.degree = e, this.genPoly = w.generateECPolynomial(this.degree);
|
|
627
|
+
}, T.prototype.encode = function(e) {
|
|
628
|
+
if (!this.genPoly) throw Error("Encoder not initialized");
|
|
629
|
+
let C = new Uint8Array(e.length + this.degree);
|
|
630
|
+
C.set(e);
|
|
631
|
+
let T = w.mod(C, this.genPoly), E = this.degree - T.length;
|
|
632
|
+
if (E > 0) {
|
|
633
|
+
let e = new Uint8Array(this.degree);
|
|
634
|
+
return e.set(T, E), e;
|
|
635
|
+
}
|
|
636
|
+
return T;
|
|
637
|
+
}, C.exports = T;
|
|
638
|
+
})), require_version_check = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
639
|
+
e.isValid = function(e) {
|
|
640
|
+
return !isNaN(e) && e >= 1 && e <= 40;
|
|
641
|
+
};
|
|
642
|
+
})), require_regex = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
643
|
+
var C = "[0-9]+", w = "[A-Z $%*+\\-./:]+", T = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
644
|
+
T = T.replace(/u/g, "\\u");
|
|
645
|
+
var E = "(?:(?![A-Z0-9 $%*+\\-./:]|" + T + ")(?:.|[\r\n]))+";
|
|
646
|
+
e.KANJI = new RegExp(T, "g"), e.BYTE_KANJI = RegExp("[^A-Z0-9 $%*+\\-./:]+", "g"), e.BYTE = new RegExp(E, "g"), e.NUMERIC = new RegExp(C, "g"), e.ALPHANUMERIC = new RegExp(w, "g");
|
|
647
|
+
var D = /* @__PURE__ */ RegExp("^" + T + "$"), O = /* @__PURE__ */ RegExp("^" + C + "$"), k = /* @__PURE__ */ RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
648
|
+
e.testKanji = function(e) {
|
|
649
|
+
return D.test(e);
|
|
650
|
+
}, e.testNumeric = function(e) {
|
|
651
|
+
return O.test(e);
|
|
652
|
+
}, e.testAlphanumeric = function(e) {
|
|
653
|
+
return k.test(e);
|
|
654
|
+
};
|
|
655
|
+
})), require_mode = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
656
|
+
var C = require_version_check(), w = require_regex();
|
|
657
|
+
e.NUMERIC = {
|
|
658
|
+
id: "Numeric",
|
|
659
|
+
bit: 1,
|
|
660
|
+
ccBits: [
|
|
661
|
+
10,
|
|
662
|
+
12,
|
|
663
|
+
14
|
|
664
|
+
]
|
|
665
|
+
}, e.ALPHANUMERIC = {
|
|
666
|
+
id: "Alphanumeric",
|
|
667
|
+
bit: 2,
|
|
668
|
+
ccBits: [
|
|
669
|
+
9,
|
|
670
|
+
11,
|
|
671
|
+
13
|
|
672
|
+
]
|
|
673
|
+
}, e.BYTE = {
|
|
674
|
+
id: "Byte",
|
|
675
|
+
bit: 4,
|
|
676
|
+
ccBits: [
|
|
677
|
+
8,
|
|
678
|
+
16,
|
|
679
|
+
16
|
|
680
|
+
]
|
|
681
|
+
}, e.KANJI = {
|
|
682
|
+
id: "Kanji",
|
|
683
|
+
bit: 8,
|
|
684
|
+
ccBits: [
|
|
685
|
+
8,
|
|
686
|
+
10,
|
|
687
|
+
12
|
|
688
|
+
]
|
|
689
|
+
}, e.MIXED = { bit: -1 }, e.getCharCountIndicator = function(e, w) {
|
|
690
|
+
if (!e.ccBits) throw Error("Invalid mode: " + e);
|
|
691
|
+
if (!C.isValid(w)) throw Error("Invalid version: " + w);
|
|
692
|
+
return w >= 1 && w < 10 ? e.ccBits[0] : w < 27 ? e.ccBits[1] : e.ccBits[2];
|
|
693
|
+
}, e.getBestModeForData = function(C) {
|
|
694
|
+
return w.testNumeric(C) ? e.NUMERIC : w.testAlphanumeric(C) ? e.ALPHANUMERIC : w.testKanji(C) ? e.KANJI : e.BYTE;
|
|
695
|
+
}, e.toString = function(e) {
|
|
696
|
+
if (e && e.id) return e.id;
|
|
697
|
+
throw Error("Invalid mode");
|
|
698
|
+
}, e.isValid = function(e) {
|
|
699
|
+
return e && e.bit && e.ccBits;
|
|
700
|
+
};
|
|
701
|
+
function T(C) {
|
|
702
|
+
if (typeof C != "string") throw Error("Param is not a string");
|
|
703
|
+
switch (C.toLowerCase()) {
|
|
704
|
+
case "numeric": return e.NUMERIC;
|
|
705
|
+
case "alphanumeric": return e.ALPHANUMERIC;
|
|
706
|
+
case "kanji": return e.KANJI;
|
|
707
|
+
case "byte": return e.BYTE;
|
|
708
|
+
default: throw Error("Unknown mode: " + C);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
e.from = function(C, w) {
|
|
712
|
+
if (e.isValid(C)) return C;
|
|
713
|
+
try {
|
|
714
|
+
return T(C);
|
|
715
|
+
} catch {
|
|
716
|
+
return w;
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
})), require_version = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
720
|
+
var C = require_utils$1(), w = require_error_correction_code(), T = require_error_correction_level(), E = require_mode(), D = require_version_check(), O = 7973, k = C.getBCHDigit(O);
|
|
721
|
+
function A(C, w, T) {
|
|
722
|
+
for (let E = 1; E <= 40; E++) if (w <= e.getCapacity(E, T, C)) return E;
|
|
723
|
+
}
|
|
724
|
+
function j(e, C) {
|
|
725
|
+
return E.getCharCountIndicator(e, C) + 4;
|
|
726
|
+
}
|
|
727
|
+
function M(e, C) {
|
|
728
|
+
let w = 0;
|
|
729
|
+
return e.forEach(function(e) {
|
|
730
|
+
let T = j(e.mode, C);
|
|
731
|
+
w += T + e.getBitsLength();
|
|
732
|
+
}), w;
|
|
733
|
+
}
|
|
734
|
+
function N(C, w) {
|
|
735
|
+
for (let T = 1; T <= 40; T++) if (M(C, T) <= e.getCapacity(T, w, E.MIXED)) return T;
|
|
736
|
+
}
|
|
737
|
+
e.from = function(e, C) {
|
|
738
|
+
return D.isValid(e) ? parseInt(e, 10) : C;
|
|
739
|
+
}, e.getCapacity = function(e, T, O) {
|
|
740
|
+
if (!D.isValid(e)) throw Error("Invalid QR Code version");
|
|
741
|
+
O === void 0 && (O = E.BYTE);
|
|
742
|
+
let k = (C.getSymbolTotalCodewords(e) - w.getTotalCodewordsCount(e, T)) * 8;
|
|
743
|
+
if (O === E.MIXED) return k;
|
|
744
|
+
let A = k - j(O, e);
|
|
745
|
+
switch (O) {
|
|
746
|
+
case E.NUMERIC: return Math.floor(A / 10 * 3);
|
|
747
|
+
case E.ALPHANUMERIC: return Math.floor(A / 11 * 2);
|
|
748
|
+
case E.KANJI: return Math.floor(A / 13);
|
|
749
|
+
case E.BYTE:
|
|
750
|
+
default: return Math.floor(A / 8);
|
|
751
|
+
}
|
|
752
|
+
}, e.getBestVersionForData = function(e, C) {
|
|
753
|
+
let w, E = T.from(C, T.M);
|
|
754
|
+
if (Array.isArray(e)) {
|
|
755
|
+
if (e.length > 1) return N(e, E);
|
|
756
|
+
if (e.length === 0) return 1;
|
|
757
|
+
w = e[0];
|
|
758
|
+
} else w = e;
|
|
759
|
+
return A(w.mode, w.getLength(), E);
|
|
760
|
+
}, e.getEncodedBits = function(e) {
|
|
761
|
+
if (!D.isValid(e) || e < 7) throw Error("Invalid QR Code version");
|
|
762
|
+
let w = e << 12;
|
|
763
|
+
for (; C.getBCHDigit(w) - k >= 0;) w ^= O << C.getBCHDigit(w) - k;
|
|
764
|
+
return e << 12 | w;
|
|
765
|
+
};
|
|
766
|
+
})), require_format_info = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
767
|
+
var C = require_utils$1(), w = 1335, T = 21522, E = C.getBCHDigit(w);
|
|
768
|
+
e.getEncodedBits = function(e, D) {
|
|
769
|
+
let O = e.bit << 3 | D, k = O << 10;
|
|
770
|
+
for (; C.getBCHDigit(k) - E >= 0;) k ^= w << C.getBCHDigit(k) - E;
|
|
771
|
+
return (O << 10 | k) ^ T;
|
|
772
|
+
};
|
|
773
|
+
})), require_numeric_data = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
774
|
+
var w = require_mode();
|
|
775
|
+
function T(e) {
|
|
776
|
+
this.mode = w.NUMERIC, this.data = e.toString();
|
|
777
|
+
}
|
|
778
|
+
T.getBitsLength = function(e) {
|
|
779
|
+
return 10 * Math.floor(e / 3) + (e % 3 ? e % 3 * 3 + 1 : 0);
|
|
780
|
+
}, T.prototype.getLength = function() {
|
|
781
|
+
return this.data.length;
|
|
782
|
+
}, T.prototype.getBitsLength = function() {
|
|
783
|
+
return T.getBitsLength(this.data.length);
|
|
784
|
+
}, T.prototype.write = function(e) {
|
|
785
|
+
let C, w, T;
|
|
786
|
+
for (C = 0; C + 3 <= this.data.length; C += 3) w = this.data.substr(C, 3), T = parseInt(w, 10), e.put(T, 10);
|
|
787
|
+
let E = this.data.length - C;
|
|
788
|
+
E > 0 && (w = this.data.substr(C), T = parseInt(w, 10), e.put(T, E * 3 + 1));
|
|
789
|
+
}, C.exports = T;
|
|
790
|
+
})), require_alphanumeric_data = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
791
|
+
var w = require_mode(), T = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
|
|
792
|
+
function E(e) {
|
|
793
|
+
this.mode = w.ALPHANUMERIC, this.data = e;
|
|
794
|
+
}
|
|
795
|
+
E.getBitsLength = function(e) {
|
|
796
|
+
return 11 * Math.floor(e / 2) + 6 * (e % 2);
|
|
797
|
+
}, E.prototype.getLength = function() {
|
|
798
|
+
return this.data.length;
|
|
799
|
+
}, E.prototype.getBitsLength = function() {
|
|
800
|
+
return E.getBitsLength(this.data.length);
|
|
801
|
+
}, E.prototype.write = function(e) {
|
|
802
|
+
let C;
|
|
803
|
+
for (C = 0; C + 2 <= this.data.length; C += 2) {
|
|
804
|
+
let w = T.indexOf(this.data[C]) * 45;
|
|
805
|
+
w += T.indexOf(this.data[C + 1]), e.put(w, 11);
|
|
806
|
+
}
|
|
807
|
+
this.data.length % 2 && e.put(T.indexOf(this.data[C]), 6);
|
|
808
|
+
}, C.exports = E;
|
|
809
|
+
})), require_byte_data = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
810
|
+
var w = require_mode();
|
|
811
|
+
function T(e) {
|
|
812
|
+
this.mode = w.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
|
|
813
|
+
}
|
|
814
|
+
T.getBitsLength = function(e) {
|
|
815
|
+
return e * 8;
|
|
816
|
+
}, T.prototype.getLength = function() {
|
|
817
|
+
return this.data.length;
|
|
818
|
+
}, T.prototype.getBitsLength = function() {
|
|
819
|
+
return T.getBitsLength(this.data.length);
|
|
820
|
+
}, T.prototype.write = function(e) {
|
|
821
|
+
for (let C = 0, w = this.data.length; C < w; C++) e.put(this.data[C], 8);
|
|
822
|
+
}, C.exports = T;
|
|
823
|
+
})), require_kanji_data = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
824
|
+
var w = require_mode(), T = require_utils$1();
|
|
825
|
+
function E(e) {
|
|
826
|
+
this.mode = w.KANJI, this.data = e;
|
|
827
|
+
}
|
|
828
|
+
E.getBitsLength = function(e) {
|
|
829
|
+
return e * 13;
|
|
830
|
+
}, E.prototype.getLength = function() {
|
|
831
|
+
return this.data.length;
|
|
832
|
+
}, E.prototype.getBitsLength = function() {
|
|
833
|
+
return E.getBitsLength(this.data.length);
|
|
834
|
+
}, E.prototype.write = function(e) {
|
|
835
|
+
let C;
|
|
836
|
+
for (C = 0; C < this.data.length; C++) {
|
|
837
|
+
let w = T.toSJIS(this.data[C]);
|
|
838
|
+
if (w >= 33088 && w <= 40956) w -= 33088;
|
|
839
|
+
else if (w >= 57408 && w <= 60351) w -= 49472;
|
|
840
|
+
else throw Error("Invalid SJIS character: " + this.data[C] + "\nMake sure your charset is UTF-8");
|
|
841
|
+
w = (w >>> 8 & 255) * 192 + (w & 255), e.put(w, 13);
|
|
842
|
+
}
|
|
843
|
+
}, C.exports = E;
|
|
844
|
+
})), require_dijkstra = /* @__PURE__ */ __commonJSMin(((e, C) => {
|
|
845
|
+
var w = {
|
|
846
|
+
single_source_shortest_paths: function(e, C, T) {
|
|
847
|
+
var E = {}, D = {};
|
|
848
|
+
D[C] = 0;
|
|
849
|
+
var O = w.PriorityQueue.make();
|
|
850
|
+
O.push(C, 0);
|
|
851
|
+
for (var k, A, j, M, N, P, F, I, L; !O.empty();) for (j in k = O.pop(), A = k.value, M = k.cost, N = e[A] || {}, N) N.hasOwnProperty(j) && (P = N[j], F = M + P, I = D[j], L = D[j] === void 0, (L || I > F) && (D[j] = F, O.push(j, F), E[j] = A));
|
|
852
|
+
if (T !== void 0 && D[T] === void 0) {
|
|
853
|
+
var R = [
|
|
854
|
+
"Could not find a path from ",
|
|
855
|
+
C,
|
|
856
|
+
" to ",
|
|
857
|
+
T,
|
|
858
|
+
"."
|
|
859
|
+
].join("");
|
|
860
|
+
throw Error(R);
|
|
861
|
+
}
|
|
862
|
+
return E;
|
|
863
|
+
},
|
|
864
|
+
extract_shortest_path_from_predecessor_list: function(e, C) {
|
|
865
|
+
for (var w = [], T = C; T;) w.push(T), e[T], T = e[T];
|
|
866
|
+
return w.reverse(), w;
|
|
867
|
+
},
|
|
868
|
+
find_path: function(e, C, T) {
|
|
869
|
+
var E = w.single_source_shortest_paths(e, C, T);
|
|
870
|
+
return w.extract_shortest_path_from_predecessor_list(E, T);
|
|
871
|
+
},
|
|
872
|
+
PriorityQueue: {
|
|
873
|
+
make: function(e) {
|
|
874
|
+
var C = w.PriorityQueue, T = {}, E;
|
|
875
|
+
for (E in e ||= {}, C) C.hasOwnProperty(E) && (T[E] = C[E]);
|
|
876
|
+
return T.queue = [], T.sorter = e.sorter || C.default_sorter, T;
|
|
877
|
+
},
|
|
878
|
+
default_sorter: function(e, C) {
|
|
879
|
+
return e.cost - C.cost;
|
|
880
|
+
},
|
|
881
|
+
push: function(e, C) {
|
|
882
|
+
var w = {
|
|
883
|
+
value: e,
|
|
884
|
+
cost: C
|
|
885
|
+
};
|
|
886
|
+
this.queue.push(w), this.queue.sort(this.sorter);
|
|
887
|
+
},
|
|
888
|
+
pop: function() {
|
|
889
|
+
return this.queue.shift();
|
|
890
|
+
},
|
|
891
|
+
empty: function() {
|
|
892
|
+
return this.queue.length === 0;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
C !== void 0 && (C.exports = w);
|
|
897
|
+
})), require_segments = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
898
|
+
var C = require_mode(), w = require_numeric_data(), T = require_alphanumeric_data(), E = require_byte_data(), D = require_kanji_data(), O = require_regex(), k = require_utils$1(), A = require_dijkstra();
|
|
899
|
+
function j(e) {
|
|
900
|
+
return unescape(encodeURIComponent(e)).length;
|
|
901
|
+
}
|
|
902
|
+
function M(e, C, w) {
|
|
903
|
+
let T = [], E;
|
|
904
|
+
for (; (E = e.exec(w)) !== null;) T.push({
|
|
905
|
+
data: E[0],
|
|
906
|
+
index: E.index,
|
|
907
|
+
mode: C,
|
|
908
|
+
length: E[0].length
|
|
909
|
+
});
|
|
910
|
+
return T;
|
|
911
|
+
}
|
|
912
|
+
function N(e) {
|
|
913
|
+
let w = M(O.NUMERIC, C.NUMERIC, e), T = M(O.ALPHANUMERIC, C.ALPHANUMERIC, e), E, D;
|
|
914
|
+
return k.isKanjiModeEnabled() ? (E = M(O.BYTE, C.BYTE, e), D = M(O.KANJI, C.KANJI, e)) : (E = M(O.BYTE_KANJI, C.BYTE, e), D = []), w.concat(T, E, D).sort(function(e, C) {
|
|
915
|
+
return e.index - C.index;
|
|
916
|
+
}).map(function(e) {
|
|
917
|
+
return {
|
|
918
|
+
data: e.data,
|
|
919
|
+
mode: e.mode,
|
|
920
|
+
length: e.length
|
|
921
|
+
};
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function P(e, O) {
|
|
925
|
+
switch (O) {
|
|
926
|
+
case C.NUMERIC: return w.getBitsLength(e);
|
|
927
|
+
case C.ALPHANUMERIC: return T.getBitsLength(e);
|
|
928
|
+
case C.KANJI: return D.getBitsLength(e);
|
|
929
|
+
case C.BYTE: return E.getBitsLength(e);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
function I(e) {
|
|
933
|
+
return e.reduce(function(e, C) {
|
|
934
|
+
let w = e.length - 1 >= 0 ? e[e.length - 1] : null;
|
|
935
|
+
return w && w.mode === C.mode ? (e[e.length - 1].data += C.data, e) : (e.push(C), e);
|
|
936
|
+
}, []);
|
|
937
|
+
}
|
|
938
|
+
function L(e) {
|
|
939
|
+
let w = [];
|
|
940
|
+
for (let T = 0; T < e.length; T++) {
|
|
941
|
+
let E = e[T];
|
|
942
|
+
switch (E.mode) {
|
|
943
|
+
case C.NUMERIC:
|
|
944
|
+
w.push([
|
|
945
|
+
E,
|
|
946
|
+
{
|
|
947
|
+
data: E.data,
|
|
948
|
+
mode: C.ALPHANUMERIC,
|
|
949
|
+
length: E.length
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
data: E.data,
|
|
953
|
+
mode: C.BYTE,
|
|
954
|
+
length: E.length
|
|
955
|
+
}
|
|
956
|
+
]);
|
|
957
|
+
break;
|
|
958
|
+
case C.ALPHANUMERIC:
|
|
959
|
+
w.push([E, {
|
|
960
|
+
data: E.data,
|
|
961
|
+
mode: C.BYTE,
|
|
962
|
+
length: E.length
|
|
963
|
+
}]);
|
|
964
|
+
break;
|
|
965
|
+
case C.KANJI:
|
|
966
|
+
w.push([E, {
|
|
967
|
+
data: E.data,
|
|
968
|
+
mode: C.BYTE,
|
|
969
|
+
length: j(E.data)
|
|
970
|
+
}]);
|
|
971
|
+
break;
|
|
972
|
+
case C.BYTE: w.push([{
|
|
973
|
+
data: E.data,
|
|
974
|
+
mode: C.BYTE,
|
|
975
|
+
length: j(E.data)
|
|
976
|
+
}]);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
return w;
|
|
980
|
+
}
|
|
981
|
+
function R(e, w) {
|
|
982
|
+
let T = {}, E = { start: {} }, D = ["start"];
|
|
983
|
+
for (let O = 0; O < e.length; O++) {
|
|
984
|
+
let k = e[O], A = [];
|
|
985
|
+
for (let e = 0; e < k.length; e++) {
|
|
986
|
+
let j = k[e], M = "" + O + e;
|
|
987
|
+
A.push(M), T[M] = {
|
|
988
|
+
node: j,
|
|
989
|
+
lastCount: 0
|
|
990
|
+
}, E[M] = {};
|
|
991
|
+
for (let e = 0; e < D.length; e++) {
|
|
992
|
+
let O = D[e];
|
|
993
|
+
T[O] && T[O].node.mode === j.mode ? (E[O][M] = P(T[O].lastCount + j.length, j.mode) - P(T[O].lastCount, j.mode), T[O].lastCount += j.length) : (T[O] && (T[O].lastCount = j.length), E[O][M] = P(j.length, j.mode) + 4 + C.getCharCountIndicator(j.mode, w));
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
D = A;
|
|
997
|
+
}
|
|
998
|
+
for (let e = 0; e < D.length; e++) E[D[e]].end = 0;
|
|
999
|
+
return {
|
|
1000
|
+
map: E,
|
|
1001
|
+
table: T
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
function z(e, O) {
|
|
1005
|
+
let A, j = C.getBestModeForData(e);
|
|
1006
|
+
if (A = C.from(O, j), A !== C.BYTE && A.bit < j.bit) throw Error("\"" + e + "\" cannot be encoded with mode " + C.toString(A) + ".\n Suggested mode is: " + C.toString(j));
|
|
1007
|
+
switch (A === C.KANJI && !k.isKanjiModeEnabled() && (A = C.BYTE), A) {
|
|
1008
|
+
case C.NUMERIC: return new w(e);
|
|
1009
|
+
case C.ALPHANUMERIC: return new T(e);
|
|
1010
|
+
case C.KANJI: return new D(e);
|
|
1011
|
+
case C.BYTE: return new E(e);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
e.fromArray = function(e) {
|
|
1015
|
+
return e.reduce(function(e, C) {
|
|
1016
|
+
return typeof C == "string" ? e.push(z(C, null)) : C.data && e.push(z(C.data, C.mode)), e;
|
|
1017
|
+
}, []);
|
|
1018
|
+
}, e.fromString = function(C, w) {
|
|
1019
|
+
let T = R(L(N(C, k.isKanjiModeEnabled())), w), E = A.find_path(T.map, "start", "end"), D = [];
|
|
1020
|
+
for (let e = 1; e < E.length - 1; e++) D.push(T.table[E[e]].node);
|
|
1021
|
+
return e.fromArray(I(D));
|
|
1022
|
+
}, e.rawSplit = function(C) {
|
|
1023
|
+
return e.fromArray(N(C, k.isKanjiModeEnabled()));
|
|
1024
|
+
};
|
|
1025
|
+
})), require_qrcode = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1026
|
+
var C = require_utils$1(), w = require_error_correction_level(), T = require_bit_buffer(), E = require_bit_matrix(), D = require_alignment_pattern(), O = require_finder_pattern(), k = require_mask_pattern(), A = require_error_correction_code(), j = require_reed_solomon_encoder(), M = require_version(), N = require_format_info(), P = require_mode(), U = require_segments();
|
|
1027
|
+
function W(e, C) {
|
|
1028
|
+
let w = e.size, T = O.getPositions(C);
|
|
1029
|
+
for (let C = 0; C < T.length; C++) {
|
|
1030
|
+
let E = T[C][0], D = T[C][1];
|
|
1031
|
+
for (let C = -1; C <= 7; C++) if (!(E + C <= -1 || w <= E + C)) for (let T = -1; T <= 7; T++) D + T <= -1 || w <= D + T || (C >= 0 && C <= 6 && (T === 0 || T === 6) || T >= 0 && T <= 6 && (C === 0 || C === 6) || C >= 2 && C <= 4 && T >= 2 && T <= 4 ? e.set(E + C, D + T, !0, !0) : e.set(E + C, D + T, !1, !0));
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
function K(e) {
|
|
1035
|
+
let C = e.size;
|
|
1036
|
+
for (let w = 8; w < C - 8; w++) {
|
|
1037
|
+
let C = w % 2 == 0;
|
|
1038
|
+
e.set(w, 6, C, !0), e.set(6, w, C, !0);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function q(e, C) {
|
|
1042
|
+
let w = D.getPositions(C);
|
|
1043
|
+
for (let C = 0; C < w.length; C++) {
|
|
1044
|
+
let T = w[C][0], E = w[C][1];
|
|
1045
|
+
for (let C = -2; C <= 2; C++) for (let w = -2; w <= 2; w++) C === -2 || C === 2 || w === -2 || w === 2 || C === 0 && w === 0 ? e.set(T + C, E + w, !0, !0) : e.set(T + C, E + w, !1, !0);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
function J(e, C) {
|
|
1049
|
+
let w = e.size, T = M.getEncodedBits(C), E, D, O;
|
|
1050
|
+
for (let C = 0; C < 18; C++) E = Math.floor(C / 3), D = C % 3 + w - 8 - 3, O = (T >> C & 1) == 1, e.set(E, D, O, !0), e.set(D, E, O, !0);
|
|
1051
|
+
}
|
|
1052
|
+
function Y(e, C, w) {
|
|
1053
|
+
let T = e.size, E = N.getEncodedBits(C, w), D, O;
|
|
1054
|
+
for (D = 0; D < 15; D++) O = (E >> D & 1) == 1, D < 6 ? e.set(D, 8, O, !0) : D < 8 ? e.set(D + 1, 8, O, !0) : e.set(T - 15 + D, 8, O, !0), D < 8 ? e.set(8, T - D - 1, O, !0) : D < 9 ? e.set(8, 15 - D - 1 + 1, O, !0) : e.set(8, 15 - D - 1, O, !0);
|
|
1055
|
+
e.set(T - 8, 8, 1, !0);
|
|
1056
|
+
}
|
|
1057
|
+
function X(e, C) {
|
|
1058
|
+
let w = e.size, T = -1, E = w - 1, D = 7, O = 0;
|
|
1059
|
+
for (let k = w - 1; k > 0; k -= 2) for (k === 6 && k--;;) {
|
|
1060
|
+
for (let w = 0; w < 2; w++) if (!e.isReserved(E, k - w)) {
|
|
1061
|
+
let T = !1;
|
|
1062
|
+
O < C.length && (T = (C[O] >>> D & 1) == 1), e.set(E, k - w, T), D--, D === -1 && (O++, D = 7);
|
|
1063
|
+
}
|
|
1064
|
+
if (E += T, E < 0 || w <= E) {
|
|
1065
|
+
E -= T, T = -T;
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
function Z(e, w, E) {
|
|
1071
|
+
let D = new T();
|
|
1072
|
+
E.forEach(function(C) {
|
|
1073
|
+
D.put(C.mode.bit, 4), D.put(C.getLength(), P.getCharCountIndicator(C.mode, e)), C.write(D);
|
|
1074
|
+
});
|
|
1075
|
+
let O = (C.getSymbolTotalCodewords(e) - A.getTotalCodewordsCount(e, w)) * 8;
|
|
1076
|
+
for (D.getLengthInBits() + 4 <= O && D.put(0, 4); D.getLengthInBits() % 8 != 0;) D.putBit(0);
|
|
1077
|
+
let k = (O - D.getLengthInBits()) / 8;
|
|
1078
|
+
for (let e = 0; e < k; e++) D.put(e % 2 ? 17 : 236, 8);
|
|
1079
|
+
return Q(D, e, w);
|
|
1080
|
+
}
|
|
1081
|
+
function Q(e, w, T) {
|
|
1082
|
+
let E = C.getSymbolTotalCodewords(w), D = E - A.getTotalCodewordsCount(w, T), O = A.getBlocksCount(w, T), k = O - E % O, M = Math.floor(E / O), N = Math.floor(D / O), P = N + 1, F = M - N, I = new j(F), L = 0, R = Array(O), z = Array(O), B = 0, V = new Uint8Array(e.buffer);
|
|
1083
|
+
for (let e = 0; e < O; e++) {
|
|
1084
|
+
let C = e < k ? N : P;
|
|
1085
|
+
R[e] = V.slice(L, L + C), z[e] = I.encode(R[e]), L += C, B = Math.max(B, C);
|
|
1086
|
+
}
|
|
1087
|
+
let H = new Uint8Array(E), U = 0, W, G;
|
|
1088
|
+
for (W = 0; W < B; W++) for (G = 0; G < O; G++) W < R[G].length && (H[U++] = R[G][W]);
|
|
1089
|
+
for (W = 0; W < F; W++) for (G = 0; G < O; G++) H[U++] = z[G][W];
|
|
1090
|
+
return H;
|
|
1091
|
+
}
|
|
1092
|
+
function $(e, w, T, D) {
|
|
1093
|
+
let O;
|
|
1094
|
+
if (Array.isArray(e)) O = U.fromArray(e);
|
|
1095
|
+
else if (typeof e == "string") {
|
|
1096
|
+
let C = w;
|
|
1097
|
+
if (!C) {
|
|
1098
|
+
let w = U.rawSplit(e);
|
|
1099
|
+
C = M.getBestVersionForData(w, T);
|
|
1100
|
+
}
|
|
1101
|
+
O = U.fromString(e, C || 40);
|
|
1102
|
+
} else throw Error("Invalid data");
|
|
1103
|
+
let A = M.getBestVersionForData(O, T);
|
|
1104
|
+
if (!A) throw Error("The amount of data is too big to be stored in a QR Code");
|
|
1105
|
+
if (!w) w = A;
|
|
1106
|
+
else if (w < A) throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + A + ".\n");
|
|
1107
|
+
let j = Z(w, T, O), N = new E(C.getSymbolSize(w));
|
|
1108
|
+
return W(N, w), K(N), q(N, w), Y(N, T, 0), w >= 7 && J(N, w), X(N, j), isNaN(D) && (D = k.getBestMask(N, Y.bind(null, N, T))), k.applyMask(D, N), Y(N, T, D), {
|
|
1109
|
+
modules: N,
|
|
1110
|
+
version: w,
|
|
1111
|
+
errorCorrectionLevel: T,
|
|
1112
|
+
maskPattern: D,
|
|
1113
|
+
segments: O
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
e.create = function(e, T) {
|
|
1117
|
+
if (e === void 0 || e === "") throw Error("No input text");
|
|
1118
|
+
let E = w.M, D, O;
|
|
1119
|
+
return T !== void 0 && (E = w.from(T.errorCorrectionLevel, w.M), D = M.from(T.version), O = k.from(T.maskPattern), T.toSJISFunc && C.setToSJISFunction(T.toSJISFunc)), $(e, D, E, O);
|
|
1120
|
+
};
|
|
1121
|
+
})), require_utils = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1122
|
+
function C(e) {
|
|
1123
|
+
if (typeof e == "number" && (e = e.toString()), typeof e != "string") throw Error("Color should be defined as hex string");
|
|
1124
|
+
let C = e.slice().replace("#", "").split("");
|
|
1125
|
+
if (C.length < 3 || C.length === 5 || C.length > 8) throw Error("Invalid hex color: " + e);
|
|
1126
|
+
(C.length === 3 || C.length === 4) && (C = Array.prototype.concat.apply([], C.map(function(e) {
|
|
1127
|
+
return [e, e];
|
|
1128
|
+
}))), C.length === 6 && C.push("F", "F");
|
|
1129
|
+
let w = parseInt(C.join(""), 16);
|
|
1130
|
+
return {
|
|
1131
|
+
r: w >> 24 & 255,
|
|
1132
|
+
g: w >> 16 & 255,
|
|
1133
|
+
b: w >> 8 & 255,
|
|
1134
|
+
a: w & 255,
|
|
1135
|
+
hex: "#" + C.slice(0, 6).join("")
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
e.getOptions = function(e) {
|
|
1139
|
+
e ||= {}, e.color ||= {};
|
|
1140
|
+
let w = e.margin === void 0 || e.margin === null || e.margin < 0 ? 4 : e.margin, T = e.width && e.width >= 21 ? e.width : void 0, E = e.scale || 4;
|
|
1141
|
+
return {
|
|
1142
|
+
width: T,
|
|
1143
|
+
scale: T ? 4 : E,
|
|
1144
|
+
margin: w,
|
|
1145
|
+
color: {
|
|
1146
|
+
dark: C(e.color.dark || "#000000ff"),
|
|
1147
|
+
light: C(e.color.light || "#ffffffff")
|
|
1148
|
+
},
|
|
1149
|
+
type: e.type,
|
|
1150
|
+
rendererOpts: e.rendererOpts || {}
|
|
1151
|
+
};
|
|
1152
|
+
}, e.getScale = function(e, C) {
|
|
1153
|
+
return C.width && C.width >= e + C.margin * 2 ? C.width / (e + C.margin * 2) : C.scale;
|
|
1154
|
+
}, e.getImageWidth = function(C, w) {
|
|
1155
|
+
let T = e.getScale(C, w);
|
|
1156
|
+
return Math.floor((C + w.margin * 2) * T);
|
|
1157
|
+
}, e.qrToImageData = function(C, w, T) {
|
|
1158
|
+
let E = w.modules.size, D = w.modules.data, O = e.getScale(E, T), k = Math.floor((E + T.margin * 2) * O), A = T.margin * O, j = [T.color.light, T.color.dark];
|
|
1159
|
+
for (let e = 0; e < k; e++) for (let w = 0; w < k; w++) {
|
|
1160
|
+
let M = (e * k + w) * 4, N = T.color.light;
|
|
1161
|
+
if (e >= A && w >= A && e < k - A && w < k - A) {
|
|
1162
|
+
let C = Math.floor((e - A) / O), T = Math.floor((w - A) / O);
|
|
1163
|
+
N = j[D[C * E + T] ? 1 : 0];
|
|
1164
|
+
}
|
|
1165
|
+
C[M++] = N.r, C[M++] = N.g, C[M++] = N.b, C[M] = N.a;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
})), require_canvas = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1169
|
+
var C = require_utils();
|
|
1170
|
+
function w(e, C, w) {
|
|
1171
|
+
e.clearRect(0, 0, C.width, C.height), C.style ||= {}, C.height = w, C.width = w, C.style.height = w + "px", C.style.width = w + "px";
|
|
1172
|
+
}
|
|
1173
|
+
function T() {
|
|
1174
|
+
try {
|
|
1175
|
+
return document.createElement("canvas");
|
|
1176
|
+
} catch {
|
|
1177
|
+
throw Error("You need to specify a canvas element");
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
e.render = function(e, E, D) {
|
|
1181
|
+
let O = D, k = E;
|
|
1182
|
+
O === void 0 && (!E || !E.getContext) && (O = E, E = void 0), E || (k = T()), O = C.getOptions(O);
|
|
1183
|
+
let A = C.getImageWidth(e.modules.size, O), j = k.getContext("2d"), M = j.createImageData(A, A);
|
|
1184
|
+
return C.qrToImageData(M.data, e, O), w(j, k, A), j.putImageData(M, 0, 0), k;
|
|
1185
|
+
}, e.renderToDataURL = function(C, w, T) {
|
|
1186
|
+
let E = T;
|
|
1187
|
+
E === void 0 && (!w || !w.getContext) && (E = w, w = void 0), E ||= {};
|
|
1188
|
+
let D = e.render(C, w, E), O = E.type || "image/png", k = E.rendererOpts || {};
|
|
1189
|
+
return D.toDataURL(O, k.quality);
|
|
1190
|
+
};
|
|
1191
|
+
})), require_svg_tag = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1192
|
+
var C = require_utils();
|
|
1193
|
+
function w(e, C) {
|
|
1194
|
+
let w = e.a / 255, T = C + "=\"" + e.hex + "\"";
|
|
1195
|
+
return w < 1 ? T + " " + C + "-opacity=\"" + w.toFixed(2).slice(1) + "\"" : T;
|
|
1196
|
+
}
|
|
1197
|
+
function T(e, C, w) {
|
|
1198
|
+
let T = e + C;
|
|
1199
|
+
return w !== void 0 && (T += " " + w), T;
|
|
1200
|
+
}
|
|
1201
|
+
function E(e, C, w) {
|
|
1202
|
+
let E = "", D = 0, O = !1, k = 0;
|
|
1203
|
+
for (let A = 0; A < e.length; A++) {
|
|
1204
|
+
let j = Math.floor(A % C), M = Math.floor(A / C);
|
|
1205
|
+
!j && !O && (O = !0), e[A] ? (k++, A > 0 && j > 0 && e[A - 1] || (E += O ? T("M", j + w, .5 + M + w) : T("m", D, 0), D = 0, O = !1), j + 1 < C && e[A + 1] || (E += T("h", k), k = 0)) : D++;
|
|
1206
|
+
}
|
|
1207
|
+
return E;
|
|
1208
|
+
}
|
|
1209
|
+
e.render = function(e, T, D) {
|
|
1210
|
+
let O = C.getOptions(T), k = e.modules.size, A = e.modules.data, j = k + O.margin * 2, M = O.color.light.a ? "<path " + w(O.color.light, "fill") + " d=\"M0 0h" + j + "v" + j + "H0z\"/>" : "", N = "<path " + w(O.color.dark, "stroke") + " d=\"" + E(A, k, O.margin) + "\"/>", P = "viewBox=\"0 0 " + j + " " + j + "\"", F = "<svg xmlns=\"http://www.w3.org/2000/svg\" " + (O.width ? "width=\"" + O.width + "\" height=\"" + O.width + "\" " : "") + P + " shape-rendering=\"crispEdges\">" + M + N + "</svg>\n";
|
|
1211
|
+
return typeof D == "function" && D(null, F), F;
|
|
1212
|
+
};
|
|
1213
|
+
})), require_browser = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1214
|
+
var C = require_can_promise(), w = require_qrcode(), T = require_canvas(), E = require_svg_tag();
|
|
1215
|
+
function D(e, T, E, D, O) {
|
|
1216
|
+
let k = [].slice.call(arguments, 1), A = k.length, j = typeof k[A - 1] == "function";
|
|
1217
|
+
if (!j && !C()) throw Error("Callback required as last argument");
|
|
1218
|
+
if (j) {
|
|
1219
|
+
if (A < 2) throw Error("Too few arguments provided");
|
|
1220
|
+
A === 2 ? (O = E, E = T, T = D = void 0) : A === 3 && (T.getContext && O === void 0 ? (O = D, D = void 0) : (O = D, D = E, E = T, T = void 0));
|
|
1221
|
+
} else {
|
|
1222
|
+
if (A < 1) throw Error("Too few arguments provided");
|
|
1223
|
+
return A === 1 ? (E = T, T = D = void 0) : A === 2 && !T.getContext && (D = E, E = T, T = void 0), new Promise(function(C, O) {
|
|
1224
|
+
try {
|
|
1225
|
+
C(e(w.create(E, D), T, D));
|
|
1226
|
+
} catch (e) {
|
|
1227
|
+
O(e);
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
try {
|
|
1232
|
+
let C = w.create(E, D);
|
|
1233
|
+
O(null, e(C, T, D));
|
|
1234
|
+
} catch (e) {
|
|
1235
|
+
O(e);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
e.create = w.create, e.toCanvas = D.bind(null, T.render), e.toDataURL = D.bind(null, T.renderToDataURL), e.toString = D.bind(null, function(e, C, w) {
|
|
1239
|
+
return E.render(e, w);
|
|
1240
|
+
});
|
|
1241
|
+
}));
|
|
1242
|
+
function isFunction(e) {
|
|
1243
|
+
return typeof e == "function";
|
|
1244
|
+
}
|
|
1245
|
+
function hasLift(e) {
|
|
1246
|
+
return isFunction(e?.lift);
|
|
1247
|
+
}
|
|
1248
|
+
function operate(e) {
|
|
1249
|
+
return function(C) {
|
|
1250
|
+
if (hasLift(C)) return C.lift(function(C) {
|
|
1251
|
+
try {
|
|
1252
|
+
return e(C, this);
|
|
1253
|
+
} catch (e) {
|
|
1254
|
+
this.error(e);
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
throw TypeError("Unable to lift unknown Observable type");
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
var extendStatics = function(e, C) {
|
|
1261
|
+
return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, C) {
|
|
1262
|
+
e.__proto__ = C;
|
|
1263
|
+
} || function(e, C) {
|
|
1264
|
+
for (var w in C) Object.prototype.hasOwnProperty.call(C, w) && (e[w] = C[w]);
|
|
1265
|
+
}, extendStatics(e, C);
|
|
1266
|
+
};
|
|
1267
|
+
function __extends(e, C) {
|
|
1268
|
+
if (typeof C != "function" && C !== null) throw TypeError("Class extends value " + String(C) + " is not a constructor or null");
|
|
1269
|
+
extendStatics(e, C);
|
|
1270
|
+
function w() {
|
|
1271
|
+
this.constructor = e;
|
|
1272
|
+
}
|
|
1273
|
+
e.prototype = C === null ? Object.create(C) : (w.prototype = C.prototype, new w());
|
|
1274
|
+
}
|
|
1275
|
+
function __awaiter(e, C, w, T) {
|
|
1276
|
+
function E(e) {
|
|
1277
|
+
return e instanceof w ? e : new w(function(C) {
|
|
1278
|
+
C(e);
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
return new (w ||= Promise)(function(w, D) {
|
|
1282
|
+
function O(e) {
|
|
1283
|
+
try {
|
|
1284
|
+
A(T.next(e));
|
|
1285
|
+
} catch (e) {
|
|
1286
|
+
D(e);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
function k(e) {
|
|
1290
|
+
try {
|
|
1291
|
+
A(T.throw(e));
|
|
1292
|
+
} catch (e) {
|
|
1293
|
+
D(e);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
function A(e) {
|
|
1297
|
+
e.done ? w(e.value) : E(e.value).then(O, k);
|
|
1298
|
+
}
|
|
1299
|
+
A((T = T.apply(e, C || [])).next());
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
function __generator(e, C) {
|
|
1303
|
+
var w = {
|
|
1304
|
+
label: 0,
|
|
1305
|
+
sent: function() {
|
|
1306
|
+
if (D[0] & 1) throw D[1];
|
|
1307
|
+
return D[1];
|
|
1308
|
+
},
|
|
1309
|
+
trys: [],
|
|
1310
|
+
ops: []
|
|
1311
|
+
}, T, E, D, O = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
1312
|
+
return O.next = k(0), O.throw = k(1), O.return = k(2), typeof Symbol == "function" && (O[Symbol.iterator] = function() {
|
|
1313
|
+
return this;
|
|
1314
|
+
}), O;
|
|
1315
|
+
function k(e) {
|
|
1316
|
+
return function(C) {
|
|
1317
|
+
return A([e, C]);
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function A(k) {
|
|
1321
|
+
if (T) throw TypeError("Generator is already executing.");
|
|
1322
|
+
for (; O && (O = 0, k[0] && (w = 0)), w;) try {
|
|
1323
|
+
if (T = 1, E && (D = k[0] & 2 ? E.return : k[0] ? E.throw || ((D = E.return) && D.call(E), 0) : E.next) && !(D = D.call(E, k[1])).done) return D;
|
|
1324
|
+
switch (E = 0, D && (k = [k[0] & 2, D.value]), k[0]) {
|
|
1325
|
+
case 0:
|
|
1326
|
+
case 1:
|
|
1327
|
+
D = k;
|
|
1328
|
+
break;
|
|
1329
|
+
case 4: return w.label++, {
|
|
1330
|
+
value: k[1],
|
|
1331
|
+
done: !1
|
|
1332
|
+
};
|
|
1333
|
+
case 5:
|
|
1334
|
+
w.label++, E = k[1], k = [0];
|
|
1335
|
+
continue;
|
|
1336
|
+
case 7:
|
|
1337
|
+
k = w.ops.pop(), w.trys.pop();
|
|
1338
|
+
continue;
|
|
1339
|
+
default:
|
|
1340
|
+
if ((D = w.trys, !(D = D.length > 0 && D[D.length - 1])) && (k[0] === 6 || k[0] === 2)) {
|
|
1341
|
+
w = 0;
|
|
1342
|
+
continue;
|
|
1343
|
+
}
|
|
1344
|
+
if (k[0] === 3 && (!D || k[1] > D[0] && k[1] < D[3])) {
|
|
1345
|
+
w.label = k[1];
|
|
1346
|
+
break;
|
|
1347
|
+
}
|
|
1348
|
+
if (k[0] === 6 && w.label < D[1]) {
|
|
1349
|
+
w.label = D[1], D = k;
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
if (D && w.label < D[2]) {
|
|
1353
|
+
w.label = D[2], w.ops.push(k);
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
D[2] && w.ops.pop(), w.trys.pop();
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1359
|
+
k = C.call(e, w);
|
|
1360
|
+
} catch (e) {
|
|
1361
|
+
k = [6, e], E = 0;
|
|
1362
|
+
} finally {
|
|
1363
|
+
T = D = 0;
|
|
1364
|
+
}
|
|
1365
|
+
if (k[0] & 5) throw k[1];
|
|
1366
|
+
return {
|
|
1367
|
+
value: k[0] ? k[1] : void 0,
|
|
1368
|
+
done: !0
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
function __values(e) {
|
|
1373
|
+
var C = typeof Symbol == "function" && Symbol.iterator, w = C && e[C], T = 0;
|
|
1374
|
+
if (w) return w.call(e);
|
|
1375
|
+
if (e && typeof e.length == "number") return { next: function() {
|
|
1376
|
+
return e && T >= e.length && (e = void 0), {
|
|
1377
|
+
value: e && e[T++],
|
|
1378
|
+
done: !e
|
|
1379
|
+
};
|
|
1380
|
+
} };
|
|
1381
|
+
throw TypeError(C ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1382
|
+
}
|
|
1383
|
+
function __read(e, C) {
|
|
1384
|
+
var w = typeof Symbol == "function" && e[Symbol.iterator];
|
|
1385
|
+
if (!w) return e;
|
|
1386
|
+
var T = w.call(e), E, D = [], O;
|
|
1387
|
+
try {
|
|
1388
|
+
for (; (C === void 0 || C-- > 0) && !(E = T.next()).done;) D.push(E.value);
|
|
1389
|
+
} catch (e) {
|
|
1390
|
+
O = { error: e };
|
|
1391
|
+
} finally {
|
|
1392
|
+
try {
|
|
1393
|
+
E && !E.done && (w = T.return) && w.call(T);
|
|
1394
|
+
} finally {
|
|
1395
|
+
if (O) throw O.error;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
return D;
|
|
1399
|
+
}
|
|
1400
|
+
function __spreadArray(e, C, w) {
|
|
1401
|
+
if (w || arguments.length === 2) for (var T = 0, E = C.length, D; T < E; T++) (D || !(T in C)) && (D ||= Array.prototype.slice.call(C, 0, T), D[T] = C[T]);
|
|
1402
|
+
return e.concat(D || Array.prototype.slice.call(C));
|
|
1403
|
+
}
|
|
1404
|
+
function __await(e) {
|
|
1405
|
+
return this instanceof __await ? (this.v = e, this) : new __await(e);
|
|
1406
|
+
}
|
|
1407
|
+
function __asyncGenerator(e, C, w) {
|
|
1408
|
+
if (!Symbol.asyncIterator) throw TypeError("Symbol.asyncIterator is not defined.");
|
|
1409
|
+
var T = w.apply(e, C || []), E, D = [];
|
|
1410
|
+
return E = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), k("next"), k("throw"), k("return", O), E[Symbol.asyncIterator] = function() {
|
|
1411
|
+
return this;
|
|
1412
|
+
}, E;
|
|
1413
|
+
function O(e) {
|
|
1414
|
+
return function(C) {
|
|
1415
|
+
return Promise.resolve(C).then(e, N);
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
function k(e, C) {
|
|
1419
|
+
T[e] && (E[e] = function(C) {
|
|
1420
|
+
return new Promise(function(w, T) {
|
|
1421
|
+
D.push([
|
|
1422
|
+
e,
|
|
1423
|
+
C,
|
|
1424
|
+
w,
|
|
1425
|
+
T
|
|
1426
|
+
]) > 1 || A(e, C);
|
|
1427
|
+
});
|
|
1428
|
+
}, C && (E[e] = C(E[e])));
|
|
1429
|
+
}
|
|
1430
|
+
function A(e, C) {
|
|
1431
|
+
try {
|
|
1432
|
+
j(T[e](C));
|
|
1433
|
+
} catch (e) {
|
|
1434
|
+
P(D[0][3], e);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
function j(e) {
|
|
1438
|
+
e.value instanceof __await ? Promise.resolve(e.value.v).then(M, N) : P(D[0][2], e);
|
|
1439
|
+
}
|
|
1440
|
+
function M(e) {
|
|
1441
|
+
A("next", e);
|
|
1442
|
+
}
|
|
1443
|
+
function N(e) {
|
|
1444
|
+
A("throw", e);
|
|
1445
|
+
}
|
|
1446
|
+
function P(e, C) {
|
|
1447
|
+
e(C), D.shift(), D.length && A(D[0][0], D[0][1]);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
function __asyncValues(e) {
|
|
1451
|
+
if (!Symbol.asyncIterator) throw TypeError("Symbol.asyncIterator is not defined.");
|
|
1452
|
+
var C = e[Symbol.asyncIterator], w;
|
|
1453
|
+
return C ? C.call(e) : (e = typeof __values == "function" ? __values(e) : e[Symbol.iterator](), w = {}, T("next"), T("throw"), T("return"), w[Symbol.asyncIterator] = function() {
|
|
1454
|
+
return this;
|
|
1455
|
+
}, w);
|
|
1456
|
+
function T(C) {
|
|
1457
|
+
w[C] = e[C] && function(w) {
|
|
1458
|
+
return new Promise(function(T, D) {
|
|
1459
|
+
w = e[C](w), E(T, D, w.done, w.value);
|
|
1460
|
+
});
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
function E(e, C, w, T) {
|
|
1464
|
+
Promise.resolve(T).then(function(C) {
|
|
1465
|
+
e({
|
|
1466
|
+
value: C,
|
|
1467
|
+
done: w
|
|
1468
|
+
});
|
|
1469
|
+
}, C);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
var isArrayLike = (function(e) {
|
|
1473
|
+
return e && typeof e.length == "number" && typeof e != "function";
|
|
1474
|
+
});
|
|
1475
|
+
function isPromise(e) {
|
|
1476
|
+
return isFunction(e?.then);
|
|
1477
|
+
}
|
|
1478
|
+
function createErrorClass(e) {
|
|
1479
|
+
var C = e(function(e) {
|
|
1480
|
+
Error.call(e), e.stack = (/* @__PURE__ */ Error()).stack;
|
|
1481
|
+
});
|
|
1482
|
+
return C.prototype = Object.create(Error.prototype), C.prototype.constructor = C, C;
|
|
1483
|
+
}
|
|
1484
|
+
var UnsubscriptionError = createErrorClass(function(e) {
|
|
1485
|
+
return function(C) {
|
|
1486
|
+
e(this), this.message = C ? C.length + " errors occurred during unsubscription:\n" + C.map(function(e, C) {
|
|
1487
|
+
return C + 1 + ") " + e.toString();
|
|
1488
|
+
}).join("\n ") : "", this.name = "UnsubscriptionError", this.errors = C;
|
|
1489
|
+
};
|
|
1490
|
+
});
|
|
1491
|
+
function arrRemove(e, C) {
|
|
1492
|
+
if (e) {
|
|
1493
|
+
var w = e.indexOf(C);
|
|
1494
|
+
0 <= w && e.splice(w, 1);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
var Subscription = function() {
|
|
1498
|
+
function e(e) {
|
|
1499
|
+
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
1500
|
+
}
|
|
1501
|
+
return e.prototype.unsubscribe = function() {
|
|
1502
|
+
var e, C, w, T, E;
|
|
1503
|
+
if (!this.closed) {
|
|
1504
|
+
this.closed = !0;
|
|
1505
|
+
var D = this._parentage;
|
|
1506
|
+
if (D) if (this._parentage = null, Array.isArray(D)) try {
|
|
1507
|
+
for (var O = __values(D), k = O.next(); !k.done; k = O.next()) k.value.remove(this);
|
|
1508
|
+
} catch (C) {
|
|
1509
|
+
e = { error: C };
|
|
1510
|
+
} finally {
|
|
1511
|
+
try {
|
|
1512
|
+
k && !k.done && (C = O.return) && C.call(O);
|
|
1513
|
+
} finally {
|
|
1514
|
+
if (e) throw e.error;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
else D.remove(this);
|
|
1518
|
+
var A = this.initialTeardown;
|
|
1519
|
+
if (isFunction(A)) try {
|
|
1520
|
+
A();
|
|
1521
|
+
} catch (e) {
|
|
1522
|
+
E = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
1523
|
+
}
|
|
1524
|
+
var j = this._finalizers;
|
|
1525
|
+
if (j) {
|
|
1526
|
+
this._finalizers = null;
|
|
1527
|
+
try {
|
|
1528
|
+
for (var M = __values(j), N = M.next(); !N.done; N = M.next()) {
|
|
1529
|
+
var P = N.value;
|
|
1530
|
+
try {
|
|
1531
|
+
execFinalizer(P);
|
|
1532
|
+
} catch (e) {
|
|
1533
|
+
E ??= [], e instanceof UnsubscriptionError ? E = __spreadArray(__spreadArray([], __read(E)), __read(e.errors)) : E.push(e);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
} catch (e) {
|
|
1537
|
+
w = { error: e };
|
|
1538
|
+
} finally {
|
|
1539
|
+
try {
|
|
1540
|
+
N && !N.done && (T = M.return) && T.call(M);
|
|
1541
|
+
} finally {
|
|
1542
|
+
if (w) throw w.error;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
if (E) throw new UnsubscriptionError(E);
|
|
1547
|
+
}
|
|
1548
|
+
}, e.prototype.add = function(C) {
|
|
1549
|
+
if (C && C !== this) if (this.closed) execFinalizer(C);
|
|
1550
|
+
else {
|
|
1551
|
+
if (C instanceof e) {
|
|
1552
|
+
if (C.closed || C._hasParent(this)) return;
|
|
1553
|
+
C._addParent(this);
|
|
1554
|
+
}
|
|
1555
|
+
(this._finalizers = this._finalizers ?? []).push(C);
|
|
1556
|
+
}
|
|
1557
|
+
}, e.prototype._hasParent = function(e) {
|
|
1558
|
+
var C = this._parentage;
|
|
1559
|
+
return C === e || Array.isArray(C) && C.includes(e);
|
|
1560
|
+
}, e.prototype._addParent = function(e) {
|
|
1561
|
+
var C = this._parentage;
|
|
1562
|
+
this._parentage = Array.isArray(C) ? (C.push(e), C) : C ? [C, e] : e;
|
|
1563
|
+
}, e.prototype._removeParent = function(e) {
|
|
1564
|
+
var C = this._parentage;
|
|
1565
|
+
C === e ? this._parentage = null : Array.isArray(C) && arrRemove(C, e);
|
|
1566
|
+
}, e.prototype.remove = function(C) {
|
|
1567
|
+
var w = this._finalizers;
|
|
1568
|
+
w && arrRemove(w, C), C instanceof e && C._removeParent(this);
|
|
1569
|
+
}, e.EMPTY = (function() {
|
|
1570
|
+
var C = new e();
|
|
1571
|
+
return C.closed = !0, C;
|
|
1572
|
+
})(), e;
|
|
1573
|
+
}();
|
|
1574
|
+
Subscription.EMPTY;
|
|
1575
|
+
function isSubscription(e) {
|
|
1576
|
+
return e instanceof Subscription || e && "closed" in e && isFunction(e.remove) && isFunction(e.add) && isFunction(e.unsubscribe);
|
|
1577
|
+
}
|
|
1578
|
+
function execFinalizer(e) {
|
|
1579
|
+
isFunction(e) ? e() : e.unsubscribe();
|
|
1580
|
+
}
|
|
1581
|
+
var config = {
|
|
1582
|
+
onUnhandledError: null,
|
|
1583
|
+
onStoppedNotification: null,
|
|
1584
|
+
Promise: void 0,
|
|
1585
|
+
useDeprecatedSynchronousErrorHandling: !1,
|
|
1586
|
+
useDeprecatedNextContext: !1
|
|
1587
|
+
}, timeoutProvider = {
|
|
1588
|
+
setTimeout: function(e, C) {
|
|
1589
|
+
var w = [...arguments].slice(2), T = timeoutProvider.delegate;
|
|
1590
|
+
return T?.setTimeout ? T.setTimeout.apply(T, __spreadArray([e, C], __read(w))) : setTimeout.apply(void 0, __spreadArray([e, C], __read(w)));
|
|
1591
|
+
},
|
|
1592
|
+
clearTimeout: function(e) {
|
|
1593
|
+
return (timeoutProvider.delegate?.clearTimeout || clearTimeout)(e);
|
|
1594
|
+
},
|
|
1595
|
+
delegate: void 0
|
|
1596
|
+
};
|
|
1597
|
+
function reportUnhandledError(e) {
|
|
1598
|
+
timeoutProvider.setTimeout(function() {
|
|
1599
|
+
var C = config.onUnhandledError;
|
|
1600
|
+
if (C) C(e);
|
|
1601
|
+
else throw e;
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
function noop() {}
|
|
1605
|
+
var COMPLETE_NOTIFICATION = (function() {
|
|
1606
|
+
return createNotification("C", void 0, void 0);
|
|
1607
|
+
})();
|
|
1608
|
+
function errorNotification(e) {
|
|
1609
|
+
return createNotification("E", void 0, e);
|
|
1610
|
+
}
|
|
1611
|
+
function nextNotification(e) {
|
|
1612
|
+
return createNotification("N", e, void 0);
|
|
1613
|
+
}
|
|
1614
|
+
function createNotification(e, C, w) {
|
|
1615
|
+
return {
|
|
1616
|
+
kind: e,
|
|
1617
|
+
value: C,
|
|
1618
|
+
error: w
|
|
1619
|
+
};
|
|
1620
|
+
}
|
|
1621
|
+
var context = null;
|
|
1622
|
+
function errorContext(e) {
|
|
1623
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
1624
|
+
var C = !context;
|
|
1625
|
+
if (C && (context = {
|
|
1626
|
+
errorThrown: !1,
|
|
1627
|
+
error: null
|
|
1628
|
+
}), e(), C) {
|
|
1629
|
+
var w = context, T = w.errorThrown, E = w.error;
|
|
1630
|
+
if (context = null, T) throw E;
|
|
1631
|
+
}
|
|
1632
|
+
} else e();
|
|
1633
|
+
}
|
|
1634
|
+
function captureError(e) {
|
|
1635
|
+
config.useDeprecatedSynchronousErrorHandling && context && (context.errorThrown = !0, context.error = e);
|
|
1636
|
+
}
|
|
1637
|
+
var Subscriber = function(e) {
|
|
1638
|
+
__extends(C, e);
|
|
1639
|
+
function C(C) {
|
|
1640
|
+
var w = e.call(this) || this;
|
|
1641
|
+
return w.isStopped = !1, C ? (w.destination = C, isSubscription(C) && C.add(w)) : w.destination = EMPTY_OBSERVER, w;
|
|
1642
|
+
}
|
|
1643
|
+
return C.create = function(e, C, w) {
|
|
1644
|
+
return new SafeSubscriber(e, C, w);
|
|
1645
|
+
}, C.prototype.next = function(e) {
|
|
1646
|
+
this.isStopped ? handleStoppedNotification(nextNotification(e), this) : this._next(e);
|
|
1647
|
+
}, C.prototype.error = function(e) {
|
|
1648
|
+
this.isStopped ? handleStoppedNotification(errorNotification(e), this) : (this.isStopped = !0, this._error(e));
|
|
1649
|
+
}, C.prototype.complete = function() {
|
|
1650
|
+
this.isStopped ? handleStoppedNotification(COMPLETE_NOTIFICATION, this) : (this.isStopped = !0, this._complete());
|
|
1651
|
+
}, C.prototype.unsubscribe = function() {
|
|
1652
|
+
this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
|
|
1653
|
+
}, C.prototype._next = function(e) {
|
|
1654
|
+
this.destination.next(e);
|
|
1655
|
+
}, C.prototype._error = function(e) {
|
|
1656
|
+
try {
|
|
1657
|
+
this.destination.error(e);
|
|
1658
|
+
} finally {
|
|
1659
|
+
this.unsubscribe();
|
|
1660
|
+
}
|
|
1661
|
+
}, C.prototype._complete = function() {
|
|
1662
|
+
try {
|
|
1663
|
+
this.destination.complete();
|
|
1664
|
+
} finally {
|
|
1665
|
+
this.unsubscribe();
|
|
1666
|
+
}
|
|
1667
|
+
}, C;
|
|
1668
|
+
}(Subscription), _bind = Function.prototype.bind;
|
|
1669
|
+
function bind(e, C) {
|
|
1670
|
+
return _bind.call(e, C);
|
|
1671
|
+
}
|
|
1672
|
+
var ConsumerObserver = function() {
|
|
1673
|
+
function e(e) {
|
|
1674
|
+
this.partialObserver = e;
|
|
1675
|
+
}
|
|
1676
|
+
return e.prototype.next = function(e) {
|
|
1677
|
+
var C = this.partialObserver;
|
|
1678
|
+
if (C.next) try {
|
|
1679
|
+
C.next(e);
|
|
1680
|
+
} catch (e) {
|
|
1681
|
+
handleUnhandledError(e);
|
|
1682
|
+
}
|
|
1683
|
+
}, e.prototype.error = function(e) {
|
|
1684
|
+
var C = this.partialObserver;
|
|
1685
|
+
if (C.error) try {
|
|
1686
|
+
C.error(e);
|
|
1687
|
+
} catch (e) {
|
|
1688
|
+
handleUnhandledError(e);
|
|
1689
|
+
}
|
|
1690
|
+
else handleUnhandledError(e);
|
|
1691
|
+
}, e.prototype.complete = function() {
|
|
1692
|
+
var e = this.partialObserver;
|
|
1693
|
+
if (e.complete) try {
|
|
1694
|
+
e.complete();
|
|
1695
|
+
} catch (e) {
|
|
1696
|
+
handleUnhandledError(e);
|
|
1697
|
+
}
|
|
1698
|
+
}, e;
|
|
1699
|
+
}(), SafeSubscriber = function(e) {
|
|
1700
|
+
__extends(C, e);
|
|
1701
|
+
function C(C, w, T) {
|
|
1702
|
+
var E = e.call(this) || this, D;
|
|
1703
|
+
if (isFunction(C) || !C) D = {
|
|
1704
|
+
next: C ?? void 0,
|
|
1705
|
+
error: w ?? void 0,
|
|
1706
|
+
complete: T ?? void 0
|
|
1707
|
+
};
|
|
1708
|
+
else {
|
|
1709
|
+
var O;
|
|
1710
|
+
E && config.useDeprecatedNextContext ? (O = Object.create(C), O.unsubscribe = function() {
|
|
1711
|
+
return E.unsubscribe();
|
|
1712
|
+
}, D = {
|
|
1713
|
+
next: C.next && bind(C.next, O),
|
|
1714
|
+
error: C.error && bind(C.error, O),
|
|
1715
|
+
complete: C.complete && bind(C.complete, O)
|
|
1716
|
+
}) : D = C;
|
|
1717
|
+
}
|
|
1718
|
+
return E.destination = new ConsumerObserver(D), E;
|
|
1719
|
+
}
|
|
1720
|
+
return C;
|
|
1721
|
+
}(Subscriber);
|
|
1722
|
+
function handleUnhandledError(e) {
|
|
1723
|
+
config.useDeprecatedSynchronousErrorHandling ? captureError(e) : reportUnhandledError(e);
|
|
1724
|
+
}
|
|
1725
|
+
function defaultErrorHandler(e) {
|
|
1726
|
+
throw e;
|
|
1727
|
+
}
|
|
1728
|
+
function handleStoppedNotification(e, C) {
|
|
1729
|
+
var w = config.onStoppedNotification;
|
|
1730
|
+
w && timeoutProvider.setTimeout(function() {
|
|
1731
|
+
return w(e, C);
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
var EMPTY_OBSERVER = {
|
|
1735
|
+
closed: !0,
|
|
1736
|
+
next: noop,
|
|
1737
|
+
error: defaultErrorHandler,
|
|
1738
|
+
complete: noop
|
|
1739
|
+
}, observable = (function() {
|
|
1740
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
1741
|
+
})();
|
|
1742
|
+
function identity(e) {
|
|
1743
|
+
return e;
|
|
1744
|
+
}
|
|
1745
|
+
function pipeFromArray(e) {
|
|
1746
|
+
return e.length === 0 ? identity : e.length === 1 ? e[0] : function(C) {
|
|
1747
|
+
return e.reduce(function(e, C) {
|
|
1748
|
+
return C(e);
|
|
1749
|
+
}, C);
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
var Observable = function() {
|
|
1753
|
+
function e(e) {
|
|
1754
|
+
e && (this._subscribe = e);
|
|
1755
|
+
}
|
|
1756
|
+
return e.prototype.lift = function(C) {
|
|
1757
|
+
var w = new e();
|
|
1758
|
+
return w.source = this, w.operator = C, w;
|
|
1759
|
+
}, e.prototype.subscribe = function(e, C, w) {
|
|
1760
|
+
var T = this, E = isSubscriber(e) ? e : new SafeSubscriber(e, C, w);
|
|
1761
|
+
return errorContext(function() {
|
|
1762
|
+
var e = T, C = e.operator, w = e.source;
|
|
1763
|
+
E.add(C ? C.call(E, w) : w ? T._subscribe(E) : T._trySubscribe(E));
|
|
1764
|
+
}), E;
|
|
1765
|
+
}, e.prototype._trySubscribe = function(e) {
|
|
1766
|
+
try {
|
|
1767
|
+
return this._subscribe(e);
|
|
1768
|
+
} catch (C) {
|
|
1769
|
+
e.error(C);
|
|
1770
|
+
}
|
|
1771
|
+
}, e.prototype.forEach = function(e, C) {
|
|
1772
|
+
var w = this;
|
|
1773
|
+
return C = getPromiseCtor(C), new C(function(C, T) {
|
|
1774
|
+
var E = new SafeSubscriber({
|
|
1775
|
+
next: function(C) {
|
|
1776
|
+
try {
|
|
1777
|
+
e(C);
|
|
1778
|
+
} catch (e) {
|
|
1779
|
+
T(e), E.unsubscribe();
|
|
1780
|
+
}
|
|
1781
|
+
},
|
|
1782
|
+
error: T,
|
|
1783
|
+
complete: C
|
|
1784
|
+
});
|
|
1785
|
+
w.subscribe(E);
|
|
1786
|
+
});
|
|
1787
|
+
}, e.prototype._subscribe = function(e) {
|
|
1788
|
+
return this.source?.subscribe(e);
|
|
1789
|
+
}, e.prototype[observable] = function() {
|
|
1790
|
+
return this;
|
|
1791
|
+
}, e.prototype.pipe = function() {
|
|
1792
|
+
return pipeFromArray([...arguments])(this);
|
|
1793
|
+
}, e.prototype.toPromise = function(e) {
|
|
1794
|
+
var C = this;
|
|
1795
|
+
return e = getPromiseCtor(e), new e(function(e, w) {
|
|
1796
|
+
var T;
|
|
1797
|
+
C.subscribe(function(e) {
|
|
1798
|
+
return T = e;
|
|
1799
|
+
}, function(e) {
|
|
1800
|
+
return w(e);
|
|
1801
|
+
}, function() {
|
|
1802
|
+
return e(T);
|
|
1803
|
+
});
|
|
1804
|
+
});
|
|
1805
|
+
}, e.create = function(C) {
|
|
1806
|
+
return new e(C);
|
|
1807
|
+
}, e;
|
|
1808
|
+
}();
|
|
1809
|
+
function getPromiseCtor(e) {
|
|
1810
|
+
return e ?? config.Promise ?? Promise;
|
|
1811
|
+
}
|
|
1812
|
+
function isObserver(e) {
|
|
1813
|
+
return e && isFunction(e.next) && isFunction(e.error) && isFunction(e.complete);
|
|
1814
|
+
}
|
|
1815
|
+
function isSubscriber(e) {
|
|
1816
|
+
return e && e instanceof Subscriber || isObserver(e) && isSubscription(e);
|
|
1817
|
+
}
|
|
1818
|
+
function isInteropObservable(e) {
|
|
1819
|
+
return isFunction(e[observable]);
|
|
1820
|
+
}
|
|
1821
|
+
function isAsyncIterable(e) {
|
|
1822
|
+
return Symbol.asyncIterator && isFunction(e?.[Symbol.asyncIterator]);
|
|
1823
|
+
}
|
|
1824
|
+
function createInvalidObservableTypeError(e) {
|
|
1825
|
+
return /* @__PURE__ */ TypeError("You provided " + (typeof e == "object" && e ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
1826
|
+
}
|
|
1827
|
+
function getSymbolIterator() {
|
|
1828
|
+
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
1829
|
+
}
|
|
1830
|
+
var iterator = getSymbolIterator();
|
|
1831
|
+
function isIterable(e) {
|
|
1832
|
+
return isFunction(e?.[iterator]);
|
|
1833
|
+
}
|
|
1834
|
+
function readableStreamLikeToAsyncGenerator(e) {
|
|
1835
|
+
return __asyncGenerator(this, arguments, function() {
|
|
1836
|
+
var C, w, T, E;
|
|
1837
|
+
return __generator(this, function(D) {
|
|
1838
|
+
switch (D.label) {
|
|
1839
|
+
case 0: C = e.getReader(), D.label = 1;
|
|
1840
|
+
case 1: D.trys.push([
|
|
1841
|
+
1,
|
|
1842
|
+
,
|
|
1843
|
+
9,
|
|
1844
|
+
10
|
|
1845
|
+
]), D.label = 2;
|
|
1846
|
+
case 2: return [4, __await(C.read())];
|
|
1847
|
+
case 3: return w = D.sent(), T = w.value, E = w.done, E ? [4, __await(void 0)] : [3, 5];
|
|
1848
|
+
case 4: return [2, D.sent()];
|
|
1849
|
+
case 5: return [4, __await(T)];
|
|
1850
|
+
case 6: return [4, D.sent()];
|
|
1851
|
+
case 7: return D.sent(), [3, 2];
|
|
1852
|
+
case 8: return [3, 10];
|
|
1853
|
+
case 9: return C.releaseLock(), [7];
|
|
1854
|
+
case 10: return [2];
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
function isReadableStreamLike(e) {
|
|
1860
|
+
return isFunction(e?.getReader);
|
|
1861
|
+
}
|
|
1862
|
+
function innerFrom(e) {
|
|
1863
|
+
if (e instanceof Observable) return e;
|
|
1864
|
+
if (e != null) {
|
|
1865
|
+
if (isInteropObservable(e)) return fromInteropObservable(e);
|
|
1866
|
+
if (isArrayLike(e)) return fromArrayLike(e);
|
|
1867
|
+
if (isPromise(e)) return fromPromise(e);
|
|
1868
|
+
if (isAsyncIterable(e)) return fromAsyncIterable(e);
|
|
1869
|
+
if (isIterable(e)) return fromIterable(e);
|
|
1870
|
+
if (isReadableStreamLike(e)) return fromReadableStreamLike(e);
|
|
1871
|
+
}
|
|
1872
|
+
throw createInvalidObservableTypeError(e);
|
|
1873
|
+
}
|
|
1874
|
+
function fromInteropObservable(e) {
|
|
1875
|
+
return new Observable(function(C) {
|
|
1876
|
+
var w = e[observable]();
|
|
1877
|
+
if (isFunction(w.subscribe)) return w.subscribe(C);
|
|
1878
|
+
throw TypeError("Provided object does not correctly implement Symbol.observable");
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
function fromArrayLike(e) {
|
|
1882
|
+
return new Observable(function(C) {
|
|
1883
|
+
for (var w = 0; w < e.length && !C.closed; w++) C.next(e[w]);
|
|
1884
|
+
C.complete();
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
function fromPromise(e) {
|
|
1888
|
+
return new Observable(function(C) {
|
|
1889
|
+
e.then(function(e) {
|
|
1890
|
+
C.closed || (C.next(e), C.complete());
|
|
1891
|
+
}, function(e) {
|
|
1892
|
+
return C.error(e);
|
|
1893
|
+
}).then(null, reportUnhandledError);
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
function fromIterable(e) {
|
|
1897
|
+
return new Observable(function(C) {
|
|
1898
|
+
var w, T;
|
|
1899
|
+
try {
|
|
1900
|
+
for (var E = __values(e), D = E.next(); !D.done; D = E.next()) {
|
|
1901
|
+
var O = D.value;
|
|
1902
|
+
if (C.next(O), C.closed) return;
|
|
1903
|
+
}
|
|
1904
|
+
} catch (e) {
|
|
1905
|
+
w = { error: e };
|
|
1906
|
+
} finally {
|
|
1907
|
+
try {
|
|
1908
|
+
D && !D.done && (T = E.return) && T.call(E);
|
|
1909
|
+
} finally {
|
|
1910
|
+
if (w) throw w.error;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
C.complete();
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
function fromAsyncIterable(e) {
|
|
1917
|
+
return new Observable(function(C) {
|
|
1918
|
+
process(e, C).catch(function(e) {
|
|
1919
|
+
return C.error(e);
|
|
1920
|
+
});
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
function fromReadableStreamLike(e) {
|
|
1924
|
+
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(e));
|
|
1925
|
+
}
|
|
1926
|
+
function process(e, C) {
|
|
1927
|
+
var w, T, E, D;
|
|
1928
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
1929
|
+
var O, k;
|
|
1930
|
+
return __generator(this, function(A) {
|
|
1931
|
+
switch (A.label) {
|
|
1932
|
+
case 0: A.trys.push([
|
|
1933
|
+
0,
|
|
1934
|
+
5,
|
|
1935
|
+
6,
|
|
1936
|
+
11
|
|
1937
|
+
]), w = __asyncValues(e), A.label = 1;
|
|
1938
|
+
case 1: return [4, w.next()];
|
|
1939
|
+
case 2:
|
|
1940
|
+
if (T = A.sent(), T.done) return [3, 4];
|
|
1941
|
+
if (O = T.value, C.next(O), C.closed) return [2];
|
|
1942
|
+
A.label = 3;
|
|
1943
|
+
case 3: return [3, 1];
|
|
1944
|
+
case 4: return [3, 11];
|
|
1945
|
+
case 5: return k = A.sent(), E = { error: k }, [3, 11];
|
|
1946
|
+
case 6: return A.trys.push([
|
|
1947
|
+
6,
|
|
1948
|
+
,
|
|
1949
|
+
9,
|
|
1950
|
+
10
|
|
1951
|
+
]), T && !T.done && (D = w.return) ? [4, D.call(w)] : [3, 8];
|
|
1952
|
+
case 7: A.sent(), A.label = 8;
|
|
1953
|
+
case 8: return [3, 10];
|
|
1954
|
+
case 9:
|
|
1955
|
+
if (E) throw E.error;
|
|
1956
|
+
return [7];
|
|
1957
|
+
case 10: return [7];
|
|
1958
|
+
case 11: return C.complete(), [2];
|
|
1959
|
+
}
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
function createOperatorSubscriber(e, C, w, T, E) {
|
|
1964
|
+
return new OperatorSubscriber(e, C, w, T, E);
|
|
1965
|
+
}
|
|
1966
|
+
var OperatorSubscriber = function(e) {
|
|
1967
|
+
__extends(C, e);
|
|
1968
|
+
function C(C, w, T, E, D, O) {
|
|
1969
|
+
var k = e.call(this, C) || this;
|
|
1970
|
+
return k.onFinalize = D, k.shouldUnsubscribe = O, k._next = w ? function(e) {
|
|
1971
|
+
try {
|
|
1972
|
+
w(e);
|
|
1973
|
+
} catch (e) {
|
|
1974
|
+
C.error(e);
|
|
1975
|
+
}
|
|
1976
|
+
} : e.prototype._next, k._error = E ? function(e) {
|
|
1977
|
+
try {
|
|
1978
|
+
E(e);
|
|
1979
|
+
} catch (e) {
|
|
1980
|
+
C.error(e);
|
|
1981
|
+
} finally {
|
|
1982
|
+
this.unsubscribe();
|
|
1983
|
+
}
|
|
1984
|
+
} : e.prototype._error, k._complete = T ? function() {
|
|
1985
|
+
try {
|
|
1986
|
+
T();
|
|
1987
|
+
} catch (e) {
|
|
1988
|
+
C.error(e);
|
|
1989
|
+
} finally {
|
|
1990
|
+
this.unsubscribe();
|
|
1991
|
+
}
|
|
1992
|
+
} : e.prototype._complete, k;
|
|
1993
|
+
}
|
|
1994
|
+
return C.prototype.unsubscribe = function() {
|
|
1995
|
+
var C;
|
|
1996
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
1997
|
+
var w = this.closed;
|
|
1998
|
+
e.prototype.unsubscribe.call(this), !w && ((C = this.onFinalize) == null || C.call(this));
|
|
1999
|
+
}
|
|
2000
|
+
}, C;
|
|
2001
|
+
}(Subscriber), Action = function(e) {
|
|
2002
|
+
__extends(C, e);
|
|
2003
|
+
function C(C, w) {
|
|
2004
|
+
return e.call(this) || this;
|
|
2005
|
+
}
|
|
2006
|
+
return C.prototype.schedule = function(e, C) {
|
|
2007
|
+
return C === void 0 && (C = 0), this;
|
|
2008
|
+
}, C;
|
|
2009
|
+
}(Subscription), intervalProvider = {
|
|
2010
|
+
setInterval: function(e, C) {
|
|
2011
|
+
var w = [...arguments].slice(2), T = intervalProvider.delegate;
|
|
2012
|
+
return T?.setInterval ? T.setInterval.apply(T, __spreadArray([e, C], __read(w))) : setInterval.apply(void 0, __spreadArray([e, C], __read(w)));
|
|
2013
|
+
},
|
|
2014
|
+
clearInterval: function(e) {
|
|
2015
|
+
return (intervalProvider.delegate?.clearInterval || clearInterval)(e);
|
|
2016
|
+
},
|
|
2017
|
+
delegate: void 0
|
|
2018
|
+
}, AsyncAction = function(e) {
|
|
2019
|
+
__extends(C, e);
|
|
2020
|
+
function C(C, w) {
|
|
2021
|
+
var T = e.call(this, C, w) || this;
|
|
2022
|
+
return T.scheduler = C, T.work = w, T.pending = !1, T;
|
|
2023
|
+
}
|
|
2024
|
+
return C.prototype.schedule = function(e, C) {
|
|
2025
|
+
if (C === void 0 && (C = 0), this.closed) return this;
|
|
2026
|
+
this.state = e;
|
|
2027
|
+
var w = this.id, T = this.scheduler;
|
|
2028
|
+
return w != null && (this.id = this.recycleAsyncId(T, w, C)), this.pending = !0, this.delay = C, this.id = this.id ?? this.requestAsyncId(T, this.id, C), this;
|
|
2029
|
+
}, C.prototype.requestAsyncId = function(e, C, w) {
|
|
2030
|
+
return w === void 0 && (w = 0), intervalProvider.setInterval(e.flush.bind(e, this), w);
|
|
2031
|
+
}, C.prototype.recycleAsyncId = function(e, C, w) {
|
|
2032
|
+
if (w === void 0 && (w = 0), w != null && this.delay === w && this.pending === !1) return C;
|
|
2033
|
+
C != null && intervalProvider.clearInterval(C);
|
|
2034
|
+
}, C.prototype.execute = function(e, C) {
|
|
2035
|
+
if (this.closed) return /* @__PURE__ */ Error("executing a cancelled action");
|
|
2036
|
+
this.pending = !1;
|
|
2037
|
+
var w = this._execute(e, C);
|
|
2038
|
+
if (w) return w;
|
|
2039
|
+
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
2040
|
+
}, C.prototype._execute = function(e, C) {
|
|
2041
|
+
var w = !1, T;
|
|
2042
|
+
try {
|
|
2043
|
+
this.work(e);
|
|
2044
|
+
} catch (e) {
|
|
2045
|
+
w = !0, T = e || /* @__PURE__ */ Error("Scheduled action threw falsy error");
|
|
2046
|
+
}
|
|
2047
|
+
if (w) return this.unsubscribe(), T;
|
|
2048
|
+
}, C.prototype.unsubscribe = function() {
|
|
2049
|
+
if (!this.closed) {
|
|
2050
|
+
var C = this, w = C.id, T = C.scheduler, E = T.actions;
|
|
2051
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, arrRemove(E, this), w != null && (this.id = this.recycleAsyncId(T, w, null)), this.delay = null, e.prototype.unsubscribe.call(this);
|
|
2052
|
+
}
|
|
2053
|
+
}, C;
|
|
2054
|
+
}(Action), dateTimestampProvider = {
|
|
2055
|
+
now: function() {
|
|
2056
|
+
return (dateTimestampProvider.delegate || Date).now();
|
|
2057
|
+
},
|
|
2058
|
+
delegate: void 0
|
|
2059
|
+
}, Scheduler = function() {
|
|
2060
|
+
function e(C, w) {
|
|
2061
|
+
w === void 0 && (w = e.now), this.schedulerActionCtor = C, this.now = w;
|
|
2062
|
+
}
|
|
2063
|
+
return e.prototype.schedule = function(e, C, w) {
|
|
2064
|
+
return C === void 0 && (C = 0), new this.schedulerActionCtor(this, e).schedule(w, C);
|
|
2065
|
+
}, e.now = dateTimestampProvider.now, e;
|
|
2066
|
+
}(), asyncScheduler = new (function(e) {
|
|
2067
|
+
__extends(C, e);
|
|
2068
|
+
function C(C, w) {
|
|
2069
|
+
w === void 0 && (w = Scheduler.now);
|
|
2070
|
+
var T = e.call(this, C, w) || this;
|
|
2071
|
+
return T.actions = [], T._active = !1, T;
|
|
2072
|
+
}
|
|
2073
|
+
return C.prototype.flush = function(e) {
|
|
2074
|
+
var C = this.actions;
|
|
2075
|
+
if (this._active) {
|
|
2076
|
+
C.push(e);
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
var w;
|
|
2080
|
+
this._active = !0;
|
|
2081
|
+
do
|
|
2082
|
+
if (w = e.execute(e.state, e.delay)) break;
|
|
2083
|
+
while (e = C.shift());
|
|
2084
|
+
if (this._active = !1, w) {
|
|
2085
|
+
for (; e = C.shift();) e.unsubscribe();
|
|
2086
|
+
throw w;
|
|
2087
|
+
}
|
|
2088
|
+
}, C;
|
|
2089
|
+
}(Scheduler))(AsyncAction), async = asyncScheduler;
|
|
2090
|
+
function isScheduler(e) {
|
|
2091
|
+
return e && isFunction(e.schedule);
|
|
2092
|
+
}
|
|
2093
|
+
function isValidDate(e) {
|
|
2094
|
+
return e instanceof Date && !isNaN(e);
|
|
2095
|
+
}
|
|
2096
|
+
function timer(e, C, w) {
|
|
2097
|
+
e === void 0 && (e = 0), w === void 0 && (w = async);
|
|
2098
|
+
var T = -1;
|
|
2099
|
+
return C != null && (isScheduler(C) ? w = C : T = C), new Observable(function(C) {
|
|
2100
|
+
var E = isValidDate(e) ? +e - w.now() : e;
|
|
2101
|
+
E < 0 && (E = 0);
|
|
2102
|
+
var D = 0;
|
|
2103
|
+
return w.schedule(function() {
|
|
2104
|
+
C.closed || (C.next(D++), 0 <= T ? this.schedule(void 0, T) : C.complete());
|
|
2105
|
+
}, E);
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
function executeSchedule(e, C, w, T, E) {
|
|
2109
|
+
T === void 0 && (T = 0), E === void 0 && (E = !1);
|
|
2110
|
+
var D = C.schedule(function() {
|
|
2111
|
+
w(), E ? e.add(this.schedule(null, T)) : this.unsubscribe();
|
|
2112
|
+
}, T);
|
|
2113
|
+
if (e.add(D), !E) return D;
|
|
2114
|
+
}
|
|
2115
|
+
function mergeInternals(e, C, w, T, E, D, O, k) {
|
|
2116
|
+
var A = [], j = 0, M = 0, N = !1, P = function() {
|
|
2117
|
+
N && !A.length && !j && C.complete();
|
|
2118
|
+
}, F = function(e) {
|
|
2119
|
+
return j < T ? I(e) : A.push(e);
|
|
2120
|
+
}, I = function(e) {
|
|
2121
|
+
D && C.next(e), j++;
|
|
2122
|
+
var k = !1;
|
|
2123
|
+
innerFrom(w(e, M++)).subscribe(createOperatorSubscriber(C, function(e) {
|
|
2124
|
+
E?.(e), D ? F(e) : C.next(e);
|
|
2125
|
+
}, function() {
|
|
2126
|
+
k = !0;
|
|
2127
|
+
}, void 0, function() {
|
|
2128
|
+
if (k) try {
|
|
2129
|
+
j--;
|
|
2130
|
+
for (var e = function() {
|
|
2131
|
+
var e = A.shift();
|
|
2132
|
+
O ? executeSchedule(C, O, function() {
|
|
2133
|
+
return I(e);
|
|
2134
|
+
}) : I(e);
|
|
2135
|
+
}; A.length && j < T;) e();
|
|
2136
|
+
P();
|
|
2137
|
+
} catch (e) {
|
|
2138
|
+
C.error(e);
|
|
2139
|
+
}
|
|
2140
|
+
}));
|
|
2141
|
+
};
|
|
2142
|
+
return e.subscribe(createOperatorSubscriber(C, F, function() {
|
|
2143
|
+
N = !0, P();
|
|
2144
|
+
})), function() {
|
|
2145
|
+
k?.();
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
function expand(e, C, w) {
|
|
2149
|
+
return C === void 0 && (C = Infinity), C = (C || 0) < 1 ? Infinity : C, operate(function(T, E) {
|
|
2150
|
+
return mergeInternals(T, E, e, C, void 0, !0, w);
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
function retry(e) {
|
|
2154
|
+
e === void 0 && (e = Infinity);
|
|
2155
|
+
var C = e && typeof e == "object" ? e : { count: e }, w = C.count, T = w === void 0 ? Infinity : w, E = C.delay, D = C.resetOnSuccess, O = D === void 0 ? !1 : D;
|
|
2156
|
+
return T <= 0 ? identity : operate(function(e, C) {
|
|
2157
|
+
var w = 0, D, k = function() {
|
|
2158
|
+
var A = !1;
|
|
2159
|
+
D = e.subscribe(createOperatorSubscriber(C, function(e) {
|
|
2160
|
+
O && (w = 0), C.next(e);
|
|
2161
|
+
}, void 0, function(e) {
|
|
2162
|
+
if (w++ < T) {
|
|
2163
|
+
var O = function() {
|
|
2164
|
+
D ? (D.unsubscribe(), D = null, k()) : A = !0;
|
|
2165
|
+
};
|
|
2166
|
+
if (E != null) {
|
|
2167
|
+
var j = typeof E == "number" ? timer(E) : innerFrom(E(e, w)), M = createOperatorSubscriber(C, function() {
|
|
2168
|
+
M.unsubscribe(), O();
|
|
2169
|
+
}, function() {
|
|
2170
|
+
C.complete();
|
|
2171
|
+
});
|
|
2172
|
+
j.subscribe(M);
|
|
2173
|
+
} else O();
|
|
2174
|
+
} else C.error(e);
|
|
2175
|
+
})), A && (D.unsubscribe(), D = null, k());
|
|
2176
|
+
};
|
|
2177
|
+
k();
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
function switchMap(e, C) {
|
|
2181
|
+
return operate(function(w, T) {
|
|
2182
|
+
var E = null, D = 0, O = !1, k = function() {
|
|
2183
|
+
return O && !E && T.complete();
|
|
2184
|
+
};
|
|
2185
|
+
w.subscribe(createOperatorSubscriber(T, function(w) {
|
|
2186
|
+
E?.unsubscribe();
|
|
2187
|
+
var O = 0, A = D++;
|
|
2188
|
+
innerFrom(e(w, A)).subscribe(E = createOperatorSubscriber(T, function(e) {
|
|
2189
|
+
return T.next(C ? C(w, e, A, O++) : e);
|
|
2190
|
+
}, function() {
|
|
2191
|
+
E = null, k();
|
|
2192
|
+
}));
|
|
2193
|
+
}, function() {
|
|
2194
|
+
O = !0, k();
|
|
2195
|
+
}));
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
function tap(e, C, w) {
|
|
2199
|
+
var T = isFunction(e) || C || w ? {
|
|
2200
|
+
next: e,
|
|
2201
|
+
error: C,
|
|
2202
|
+
complete: w
|
|
2203
|
+
} : e;
|
|
2204
|
+
return T ? operate(function(e, C) {
|
|
2205
|
+
var w;
|
|
2206
|
+
(w = T.subscribe) == null || w.call(T);
|
|
2207
|
+
var E = !0;
|
|
2208
|
+
e.subscribe(createOperatorSubscriber(C, function(e) {
|
|
2209
|
+
var w;
|
|
2210
|
+
(w = T.next) == null || w.call(T, e), C.next(e);
|
|
2211
|
+
}, function() {
|
|
2212
|
+
var e;
|
|
2213
|
+
E = !1, (e = T.complete) == null || e.call(T), C.complete();
|
|
2214
|
+
}, function(e) {
|
|
2215
|
+
var w;
|
|
2216
|
+
E = !1, (w = T.error) == null || w.call(T, e), C.error(e);
|
|
2217
|
+
}, function() {
|
|
2218
|
+
var e, C;
|
|
2219
|
+
E && ((e = T.unsubscribe) == null || e.call(T)), (C = T.finalize) == null || C.call(T);
|
|
2220
|
+
}));
|
|
2221
|
+
}) : identity;
|
|
2222
|
+
}
|
|
2223
|
+
var TimeoutError = createErrorClass(function(e) {
|
|
2224
|
+
return function(C) {
|
|
2225
|
+
C === void 0 && (C = null), e(this), this.message = "Timeout has occurred", this.name = "TimeoutError", this.info = C;
|
|
2226
|
+
};
|
|
2227
|
+
});
|
|
2228
|
+
function timeout(e, C) {
|
|
2229
|
+
var w = isValidDate(e) ? { first: e } : typeof e == "number" ? { each: e } : e, T = w.first, E = w.each, D = w.with, O = D === void 0 ? timeoutErrorFactory : D, k = w.scheduler, A = k === void 0 ? C ?? asyncScheduler : k, j = w.meta, M = j === void 0 ? null : j;
|
|
2230
|
+
if (T == null && E == null) throw TypeError("No timeout provided.");
|
|
2231
|
+
return operate(function(e, C) {
|
|
2232
|
+
var w, D, k = null, j = 0, N = function(e) {
|
|
2233
|
+
D = executeSchedule(C, A, function() {
|
|
2234
|
+
try {
|
|
2235
|
+
w.unsubscribe(), innerFrom(O({
|
|
2236
|
+
meta: M,
|
|
2237
|
+
lastValue: k,
|
|
2238
|
+
seen: j
|
|
2239
|
+
})).subscribe(C);
|
|
2240
|
+
} catch (e) {
|
|
2241
|
+
C.error(e);
|
|
2242
|
+
}
|
|
2243
|
+
}, e);
|
|
2244
|
+
};
|
|
2245
|
+
w = e.subscribe(createOperatorSubscriber(C, function(e) {
|
|
2246
|
+
D?.unsubscribe(), j++, C.next(k = e), E > 0 && N(E);
|
|
2247
|
+
}, void 0, void 0, function() {
|
|
2248
|
+
D?.closed || D?.unsubscribe(), k = null;
|
|
2249
|
+
})), !j && N(T == null ? E : typeof T == "number" ? T : +T - A.now());
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
function timeoutErrorFactory(e) {
|
|
2253
|
+
throw new TimeoutError(e);
|
|
2254
|
+
}
|
|
2255
|
+
function defineChain(e) {
|
|
2256
|
+
let C = {
|
|
2257
|
+
formatters: void 0,
|
|
2258
|
+
fees: void 0,
|
|
2259
|
+
serializers: void 0,
|
|
2260
|
+
...e
|
|
2261
|
+
};
|
|
2262
|
+
function w(e) {
|
|
2263
|
+
return (C) => {
|
|
2264
|
+
let T = typeof C == "function" ? C(e) : C, E = {
|
|
2265
|
+
...e,
|
|
2266
|
+
...T
|
|
2267
|
+
};
|
|
2268
|
+
return Object.assign(E, { extend: w(E) });
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
return Object.assign(C, { extend: w(C) });
|
|
2272
|
+
}
|
|
2273
|
+
const version = "2.44.4";
|
|
2274
|
+
var errorConfig = {
|
|
2275
|
+
getDocsUrl: ({ docsBaseUrl: e, docsPath: C = "", docsSlug: w }) => C ? `${e ?? "https://viem.sh"}${C}${w ? `#${w}` : ""}` : void 0,
|
|
2276
|
+
version: `viem@${version}`
|
|
2277
|
+
}, BaseError = class e extends Error {
|
|
2278
|
+
constructor(C, w = {}) {
|
|
2279
|
+
let T = (() => w.cause instanceof e ? w.cause.details : w.cause?.message ? w.cause.message : w.details)(), E = (() => w.cause instanceof e && w.cause.docsPath || w.docsPath)(), D = errorConfig.getDocsUrl?.({
|
|
2280
|
+
...w,
|
|
2281
|
+
docsPath: E
|
|
2282
|
+
}), O = [
|
|
2283
|
+
C || "An error occurred.",
|
|
2284
|
+
"",
|
|
2285
|
+
...w.metaMessages ? [...w.metaMessages, ""] : [],
|
|
2286
|
+
...D ? [`Docs: ${D}`] : [],
|
|
2287
|
+
...T ? [`Details: ${T}`] : [],
|
|
2288
|
+
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
2289
|
+
].join("\n");
|
|
2290
|
+
super(O, w.cause ? { cause: w.cause } : void 0), Object.defineProperty(this, "details", {
|
|
2291
|
+
enumerable: !0,
|
|
2292
|
+
configurable: !0,
|
|
2293
|
+
writable: !0,
|
|
2294
|
+
value: void 0
|
|
2295
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
2296
|
+
enumerable: !0,
|
|
2297
|
+
configurable: !0,
|
|
2298
|
+
writable: !0,
|
|
2299
|
+
value: void 0
|
|
2300
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
2301
|
+
enumerable: !0,
|
|
2302
|
+
configurable: !0,
|
|
2303
|
+
writable: !0,
|
|
2304
|
+
value: void 0
|
|
2305
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
2306
|
+
enumerable: !0,
|
|
2307
|
+
configurable: !0,
|
|
2308
|
+
writable: !0,
|
|
2309
|
+
value: void 0
|
|
2310
|
+
}), Object.defineProperty(this, "version", {
|
|
2311
|
+
enumerable: !0,
|
|
2312
|
+
configurable: !0,
|
|
2313
|
+
writable: !0,
|
|
2314
|
+
value: void 0
|
|
2315
|
+
}), Object.defineProperty(this, "name", {
|
|
2316
|
+
enumerable: !0,
|
|
2317
|
+
configurable: !0,
|
|
2318
|
+
writable: !0,
|
|
2319
|
+
value: "BaseError"
|
|
2320
|
+
}), this.details = T, this.docsPath = E, this.metaMessages = w.metaMessages, this.name = w.name ?? this.name, this.shortMessage = C, this.version = version;
|
|
2321
|
+
}
|
|
2322
|
+
walk(e) {
|
|
2323
|
+
return walk(this, e);
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
function walk(e, C) {
|
|
2327
|
+
return C?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? walk(e.cause, C) : C ? null : e;
|
|
2328
|
+
}
|
|
2329
|
+
var IntegerOutOfRangeError = class extends BaseError {
|
|
2330
|
+
constructor({ max: e, min: C, signed: w, size: T, value: E }) {
|
|
2331
|
+
super(`Number "${E}" is not in safe ${T ? `${T * 8}-bit ${w ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${C} to ${e})` : `(above ${C})`}`, { name: "IntegerOutOfRangeError" });
|
|
2332
|
+
}
|
|
2333
|
+
}, SizeOverflowError = class extends BaseError {
|
|
2334
|
+
constructor({ givenSize: e, maxSize: C }) {
|
|
2335
|
+
super(`Size cannot exceed ${C} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
function isHex(e, { strict: C = !0 } = {}) {
|
|
2339
|
+
return !e || typeof e != "string" ? !1 : C ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
2340
|
+
}
|
|
2341
|
+
function size(e) {
|
|
2342
|
+
return isHex(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
2343
|
+
}
|
|
2344
|
+
function trim(e, { dir: C = "left" } = {}) {
|
|
2345
|
+
let w = typeof e == "string" ? e.replace("0x", "") : e, T = 0;
|
|
2346
|
+
for (let e = 0; e < w.length - 1 && w[C === "left" ? e : w.length - e - 1].toString() === "0"; e++) T++;
|
|
2347
|
+
return w = C === "left" ? w.slice(T) : w.slice(0, w.length - T), typeof e == "string" ? (w.length === 1 && C === "right" && (w = `${w}0`), `0x${w.length % 2 == 1 ? `0${w}` : w}`) : w;
|
|
2348
|
+
}
|
|
2349
|
+
var SliceOffsetOutOfBoundsError = class extends BaseError {
|
|
2350
|
+
constructor({ offset: e, position: C, size: w }) {
|
|
2351
|
+
super(`Slice ${C === "start" ? "starting" : "ending"} at offset "${e}" is out-of-bounds (size: ${w}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
2352
|
+
}
|
|
2353
|
+
}, SizeExceedsPaddingSizeError = class extends BaseError {
|
|
2354
|
+
constructor({ size: e, targetSize: C, type: w }) {
|
|
2355
|
+
super(`${w.charAt(0).toUpperCase()}${w.slice(1).toLowerCase()} size (${e}) exceeds padding size (${C}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
function pad(e, { dir: C, size: w = 32 } = {}) {
|
|
2359
|
+
return typeof e == "string" ? padHex(e, {
|
|
2360
|
+
dir: C,
|
|
2361
|
+
size: w
|
|
2362
|
+
}) : padBytes(e, {
|
|
2363
|
+
dir: C,
|
|
2364
|
+
size: w
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
function padHex(e, { dir: C, size: w = 32 } = {}) {
|
|
2368
|
+
if (w === null) return e;
|
|
2369
|
+
let T = e.replace("0x", "");
|
|
2370
|
+
if (T.length > w * 2) throw new SizeExceedsPaddingSizeError({
|
|
2371
|
+
size: Math.ceil(T.length / 2),
|
|
2372
|
+
targetSize: w,
|
|
2373
|
+
type: "hex"
|
|
2374
|
+
});
|
|
2375
|
+
return `0x${T[C === "right" ? "padEnd" : "padStart"](w * 2, "0")}`;
|
|
2376
|
+
}
|
|
2377
|
+
function padBytes(e, { dir: C, size: w = 32 } = {}) {
|
|
2378
|
+
if (w === null) return e;
|
|
2379
|
+
if (e.length > w) throw new SizeExceedsPaddingSizeError({
|
|
2380
|
+
size: e.length,
|
|
2381
|
+
targetSize: w,
|
|
2382
|
+
type: "bytes"
|
|
2383
|
+
});
|
|
2384
|
+
let T = new Uint8Array(w);
|
|
2385
|
+
for (let E = 0; E < w; E++) {
|
|
2386
|
+
let D = C === "right";
|
|
2387
|
+
T[D ? E : w - E - 1] = e[D ? E : e.length - E - 1];
|
|
2388
|
+
}
|
|
2389
|
+
return T;
|
|
2390
|
+
}
|
|
2391
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (e, C) => C.toString(16).padStart(2, "0"));
|
|
2392
|
+
function toHex(e, C = {}) {
|
|
2393
|
+
return typeof e == "number" || typeof e == "bigint" ? numberToHex(e, C) : typeof e == "string" ? stringToHex(e, C) : typeof e == "boolean" ? boolToHex(e, C) : bytesToHex(e, C);
|
|
2394
|
+
}
|
|
2395
|
+
function boolToHex(e, C = {}) {
|
|
2396
|
+
let w = `0x${Number(e)}`;
|
|
2397
|
+
return typeof C.size == "number" ? (assertSize(w, { size: C.size }), pad(w, { size: C.size })) : w;
|
|
2398
|
+
}
|
|
2399
|
+
function bytesToHex(e, C = {}) {
|
|
2400
|
+
let w = "";
|
|
2401
|
+
for (let C = 0; C < e.length; C++) w += hexes[e[C]];
|
|
2402
|
+
let T = `0x${w}`;
|
|
2403
|
+
return typeof C.size == "number" ? (assertSize(T, { size: C.size }), pad(T, {
|
|
2404
|
+
dir: "right",
|
|
2405
|
+
size: C.size
|
|
2406
|
+
})) : T;
|
|
2407
|
+
}
|
|
2408
|
+
function numberToHex(e, C = {}) {
|
|
2409
|
+
let { signed: w, size: T } = C, E = BigInt(e), D;
|
|
2410
|
+
T ? D = w ? (1n << BigInt(T) * 8n - 1n) - 1n : 2n ** (BigInt(T) * 8n) - 1n : typeof e == "number" && (D = BigInt(2 ** 53 - 1));
|
|
2411
|
+
let O = typeof D == "bigint" && w ? -D - 1n : 0;
|
|
2412
|
+
if (D && E > D || E < O) {
|
|
2413
|
+
let C = typeof e == "bigint" ? "n" : "";
|
|
2414
|
+
throw new IntegerOutOfRangeError({
|
|
2415
|
+
max: D ? `${D}${C}` : void 0,
|
|
2416
|
+
min: `${O}${C}`,
|
|
2417
|
+
signed: w,
|
|
2418
|
+
size: T,
|
|
2419
|
+
value: `${e}${C}`
|
|
2420
|
+
});
|
|
2421
|
+
}
|
|
2422
|
+
let k = `0x${(w && E < 0 ? (1n << BigInt(T * 8)) + BigInt(E) : E).toString(16)}`;
|
|
2423
|
+
return T ? pad(k, { size: T }) : k;
|
|
2424
|
+
}
|
|
2425
|
+
var encoder$1 = /* @__PURE__ */ new TextEncoder();
|
|
2426
|
+
function stringToHex(e, C = {}) {
|
|
2427
|
+
return bytesToHex(encoder$1.encode(e), C);
|
|
2428
|
+
}
|
|
2429
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
2430
|
+
function toBytes(e, C = {}) {
|
|
2431
|
+
return typeof e == "number" || typeof e == "bigint" ? numberToBytes(e, C) : typeof e == "boolean" ? boolToBytes(e, C) : isHex(e) ? hexToBytes(e, C) : stringToBytes(e, C);
|
|
2432
|
+
}
|
|
2433
|
+
function boolToBytes(e, C = {}) {
|
|
2434
|
+
let w = new Uint8Array(1);
|
|
2435
|
+
return w[0] = Number(e), typeof C.size == "number" ? (assertSize(w, { size: C.size }), pad(w, { size: C.size })) : w;
|
|
2436
|
+
}
|
|
2437
|
+
var charCodeMap = {
|
|
2438
|
+
zero: 48,
|
|
2439
|
+
nine: 57,
|
|
2440
|
+
A: 65,
|
|
2441
|
+
F: 70,
|
|
2442
|
+
a: 97,
|
|
2443
|
+
f: 102
|
|
2444
|
+
};
|
|
2445
|
+
function charCodeToBase16(e) {
|
|
2446
|
+
if (e >= charCodeMap.zero && e <= charCodeMap.nine) return e - charCodeMap.zero;
|
|
2447
|
+
if (e >= charCodeMap.A && e <= charCodeMap.F) return e - (charCodeMap.A - 10);
|
|
2448
|
+
if (e >= charCodeMap.a && e <= charCodeMap.f) return e - (charCodeMap.a - 10);
|
|
2449
|
+
}
|
|
2450
|
+
function hexToBytes(e, C = {}) {
|
|
2451
|
+
let w = e;
|
|
2452
|
+
C.size && (assertSize(w, { size: C.size }), w = pad(w, {
|
|
2453
|
+
dir: "right",
|
|
2454
|
+
size: C.size
|
|
2455
|
+
}));
|
|
2456
|
+
let T = w.slice(2);
|
|
2457
|
+
T.length % 2 && (T = `0${T}`);
|
|
2458
|
+
let E = T.length / 2, D = new Uint8Array(E);
|
|
2459
|
+
for (let e = 0, C = 0; e < E; e++) {
|
|
2460
|
+
let w = charCodeToBase16(T.charCodeAt(C++)), E = charCodeToBase16(T.charCodeAt(C++));
|
|
2461
|
+
if (w === void 0 || E === void 0) throw new BaseError(`Invalid byte sequence ("${T[C - 2]}${T[C - 1]}" in "${T}").`);
|
|
2462
|
+
D[e] = w * 16 + E;
|
|
2463
|
+
}
|
|
2464
|
+
return D;
|
|
2465
|
+
}
|
|
2466
|
+
function numberToBytes(e, C) {
|
|
2467
|
+
return hexToBytes(numberToHex(e, C));
|
|
2468
|
+
}
|
|
2469
|
+
function stringToBytes(e, C = {}) {
|
|
2470
|
+
let w = encoder.encode(e);
|
|
2471
|
+
return typeof C.size == "number" ? (assertSize(w, { size: C.size }), pad(w, {
|
|
2472
|
+
dir: "right",
|
|
2473
|
+
size: C.size
|
|
2474
|
+
})) : w;
|
|
2475
|
+
}
|
|
2476
|
+
function assertSize(e, { size: C }) {
|
|
2477
|
+
if (size(e) > C) throw new SizeOverflowError({
|
|
2478
|
+
givenSize: size(e),
|
|
2479
|
+
maxSize: C
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
function hexToBigInt(e, C = {}) {
|
|
2483
|
+
let { signed: w } = C;
|
|
2484
|
+
C.size && assertSize(e, { size: C.size });
|
|
2485
|
+
let T = BigInt(e);
|
|
2486
|
+
if (!w) return T;
|
|
2487
|
+
let E = (e.length - 2) / 2;
|
|
2488
|
+
return T <= (1n << BigInt(E) * 8n - 1n) - 1n ? T : T - BigInt(`0x${"f".padStart(E * 2, "f")}`) - 1n;
|
|
2489
|
+
}
|
|
2490
|
+
function hexToNumber(e, C = {}) {
|
|
2491
|
+
let w = hexToBigInt(e, C), T = Number(w);
|
|
2492
|
+
if (!Number.isSafeInteger(T)) throw new IntegerOutOfRangeError({
|
|
2493
|
+
max: `${2 ** 53 - 1}`,
|
|
2494
|
+
min: `${-(2 ** 53 - 1)}`,
|
|
2495
|
+
signed: C.signed,
|
|
2496
|
+
size: C.size,
|
|
2497
|
+
value: `${w}n`
|
|
2498
|
+
});
|
|
2499
|
+
return T;
|
|
2500
|
+
}
|
|
2501
|
+
function defineFormatter(e, C) {
|
|
2502
|
+
return ({ exclude: w, format: T }) => ({
|
|
2503
|
+
exclude: w,
|
|
2504
|
+
format: (e, E) => {
|
|
2505
|
+
let D = C(e, E);
|
|
2506
|
+
if (w) for (let e of w) delete D[e];
|
|
2507
|
+
return {
|
|
2508
|
+
...D,
|
|
2509
|
+
...T(e, E)
|
|
2510
|
+
};
|
|
2511
|
+
},
|
|
2512
|
+
type: e
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2515
|
+
const transactionType = {
|
|
2516
|
+
"0x0": "legacy",
|
|
2517
|
+
"0x1": "eip2930",
|
|
2518
|
+
"0x2": "eip1559",
|
|
2519
|
+
"0x3": "eip4844",
|
|
2520
|
+
"0x4": "eip7702"
|
|
2521
|
+
};
|
|
2522
|
+
function formatTransaction(e, C) {
|
|
2523
|
+
let w = {
|
|
2524
|
+
...e,
|
|
2525
|
+
blockHash: e.blockHash ? e.blockHash : null,
|
|
2526
|
+
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
2527
|
+
chainId: e.chainId ? hexToNumber(e.chainId) : void 0,
|
|
2528
|
+
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
2529
|
+
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
2530
|
+
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
2531
|
+
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
2532
|
+
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
2533
|
+
nonce: e.nonce ? hexToNumber(e.nonce) : void 0,
|
|
2534
|
+
to: e.to ? e.to : null,
|
|
2535
|
+
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
2536
|
+
type: e.type ? transactionType[e.type] : void 0,
|
|
2537
|
+
typeHex: e.type ? e.type : void 0,
|
|
2538
|
+
value: e.value ? BigInt(e.value) : void 0,
|
|
2539
|
+
v: e.v ? BigInt(e.v) : void 0
|
|
2540
|
+
};
|
|
2541
|
+
return e.authorizationList && (w.authorizationList = formatAuthorizationList(e.authorizationList)), w.yParity = (() => {
|
|
2542
|
+
if (e.yParity) return Number(e.yParity);
|
|
2543
|
+
if (typeof w.v == "bigint") {
|
|
2544
|
+
if (w.v === 0n || w.v === 27n) return 0;
|
|
2545
|
+
if (w.v === 1n || w.v === 28n) return 1;
|
|
2546
|
+
if (w.v >= 35n) return w.v % 2n == 0n ? 1 : 0;
|
|
2547
|
+
}
|
|
2548
|
+
})(), w.type === "legacy" && (delete w.accessList, delete w.maxFeePerBlobGas, delete w.maxFeePerGas, delete w.maxPriorityFeePerGas, delete w.yParity), w.type === "eip2930" && (delete w.maxFeePerBlobGas, delete w.maxFeePerGas, delete w.maxPriorityFeePerGas), w.type === "eip1559" && delete w.maxFeePerBlobGas, w;
|
|
2549
|
+
}
|
|
2550
|
+
const defineTransaction = /* @__PURE__ */ defineFormatter("transaction", formatTransaction);
|
|
2551
|
+
function formatAuthorizationList(e) {
|
|
2552
|
+
return e.map((e) => ({
|
|
2553
|
+
address: e.address,
|
|
2554
|
+
chainId: Number(e.chainId),
|
|
2555
|
+
nonce: Number(e.nonce),
|
|
2556
|
+
r: e.r,
|
|
2557
|
+
s: e.s,
|
|
2558
|
+
yParity: Number(e.yParity)
|
|
2559
|
+
}));
|
|
2560
|
+
}
|
|
2561
|
+
function formatBlock(e, C) {
|
|
2562
|
+
let w = (e.transactions ?? []).map((e) => typeof e == "string" ? e : formatTransaction(e));
|
|
2563
|
+
return {
|
|
2564
|
+
...e,
|
|
2565
|
+
baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
|
|
2566
|
+
blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
|
|
2567
|
+
difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
|
|
2568
|
+
excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
|
|
2569
|
+
gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
|
|
2570
|
+
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
|
|
2571
|
+
hash: e.hash ? e.hash : null,
|
|
2572
|
+
logsBloom: e.logsBloom ? e.logsBloom : null,
|
|
2573
|
+
nonce: e.nonce ? e.nonce : null,
|
|
2574
|
+
number: e.number ? BigInt(e.number) : null,
|
|
2575
|
+
size: e.size ? BigInt(e.size) : void 0,
|
|
2576
|
+
timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
|
|
2577
|
+
transactions: w,
|
|
2578
|
+
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
const defineBlock = /* @__PURE__ */ defineFormatter("block", formatBlock);
|
|
2582
|
+
function formatLog(e, { args: C, eventName: w } = {}) {
|
|
2583
|
+
return {
|
|
2584
|
+
...e,
|
|
2585
|
+
blockHash: e.blockHash ? e.blockHash : null,
|
|
2586
|
+
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
2587
|
+
blockTimestamp: e.blockTimestamp ? BigInt(e.blockTimestamp) : e.blockTimestamp === null ? null : void 0,
|
|
2588
|
+
logIndex: e.logIndex ? Number(e.logIndex) : null,
|
|
2589
|
+
transactionHash: e.transactionHash ? e.transactionHash : null,
|
|
2590
|
+
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
2591
|
+
...w ? {
|
|
2592
|
+
args: C,
|
|
2593
|
+
eventName: w
|
|
2594
|
+
} : {}
|
|
2595
|
+
};
|
|
2596
|
+
}
|
|
2597
|
+
const receiptStatuses = {
|
|
2598
|
+
"0x0": "reverted",
|
|
2599
|
+
"0x1": "success"
|
|
2600
|
+
};
|
|
2601
|
+
function formatTransactionReceipt(e, C) {
|
|
2602
|
+
let w = {
|
|
2603
|
+
...e,
|
|
2604
|
+
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
2605
|
+
contractAddress: e.contractAddress ? e.contractAddress : null,
|
|
2606
|
+
cumulativeGasUsed: e.cumulativeGasUsed ? BigInt(e.cumulativeGasUsed) : null,
|
|
2607
|
+
effectiveGasPrice: e.effectiveGasPrice ? BigInt(e.effectiveGasPrice) : null,
|
|
2608
|
+
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : null,
|
|
2609
|
+
logs: e.logs ? e.logs.map((e) => formatLog(e)) : null,
|
|
2610
|
+
to: e.to ? e.to : null,
|
|
2611
|
+
transactionIndex: e.transactionIndex ? hexToNumber(e.transactionIndex) : null,
|
|
2612
|
+
status: e.status ? receiptStatuses[e.status] : null,
|
|
2613
|
+
type: e.type ? transactionType[e.type] || e.type : null
|
|
2614
|
+
};
|
|
2615
|
+
return e.blobGasPrice && (w.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (w.blobGasUsed = BigInt(e.blobGasUsed)), w;
|
|
2616
|
+
}
|
|
2617
|
+
const defineTransactionReceipt = /* @__PURE__ */ defineFormatter("transactionReceipt", formatTransactionReceipt);
|
|
2618
|
+
2n ** (8n - 1n) - 1n, 2n ** (16n - 1n) - 1n, 2n ** (24n - 1n) - 1n, 2n ** (32n - 1n) - 1n, 2n ** (40n - 1n) - 1n, 2n ** (48n - 1n) - 1n, 2n ** (56n - 1n) - 1n, 2n ** (64n - 1n) - 1n, 2n ** (72n - 1n) - 1n, 2n ** (80n - 1n) - 1n, 2n ** (88n - 1n) - 1n, 2n ** (96n - 1n) - 1n, 2n ** (104n - 1n) - 1n, 2n ** (112n - 1n) - 1n, 2n ** (120n - 1n) - 1n, 2n ** (128n - 1n) - 1n, 2n ** (136n - 1n) - 1n, 2n ** (144n - 1n) - 1n, 2n ** (152n - 1n) - 1n, 2n ** (160n - 1n) - 1n, 2n ** (168n - 1n) - 1n, 2n ** (176n - 1n) - 1n, 2n ** (184n - 1n) - 1n, 2n ** (192n - 1n) - 1n, 2n ** (200n - 1n) - 1n, 2n ** (208n - 1n) - 1n, 2n ** (216n - 1n) - 1n, 2n ** (224n - 1n) - 1n, 2n ** (232n - 1n) - 1n, 2n ** (240n - 1n) - 1n, 2n ** (248n - 1n) - 1n, 2n ** (256n - 1n) - 1n, -(2n ** (8n - 1n)), -(2n ** (16n - 1n)), -(2n ** (24n - 1n)), -(2n ** (32n - 1n)), -(2n ** (40n - 1n)), -(2n ** (48n - 1n)), -(2n ** (56n - 1n)), -(2n ** (64n - 1n)), -(2n ** (72n - 1n)), -(2n ** (80n - 1n)), -(2n ** (88n - 1n)), -(2n ** (96n - 1n)), -(2n ** (104n - 1n)), -(2n ** (112n - 1n)), -(2n ** (120n - 1n)), -(2n ** (128n - 1n)), -(2n ** (136n - 1n)), -(2n ** (144n - 1n)), -(2n ** (152n - 1n)), -(2n ** (160n - 1n)), -(2n ** (168n - 1n)), -(2n ** (176n - 1n)), -(2n ** (184n - 1n)), -(2n ** (192n - 1n)), -(2n ** (200n - 1n)), -(2n ** (208n - 1n)), -(2n ** (216n - 1n)), -(2n ** (224n - 1n)), -(2n ** (232n - 1n)), -(2n ** (240n - 1n)), -(2n ** (248n - 1n)), -(2n ** (256n - 1n));
|
|
2619
|
+
const maxUint256 = 2n ** 256n - 1n;
|
|
2620
|
+
function concatHex(e) {
|
|
2621
|
+
return `0x${e.reduce((e, C) => e + C.replace("0x", ""), "")}`;
|
|
2622
|
+
}
|
|
2623
|
+
var NegativeOffsetError = class extends BaseError {
|
|
2624
|
+
constructor({ offset: e }) {
|
|
2625
|
+
super(`Offset \`${e}\` cannot be negative.`, { name: "NegativeOffsetError" });
|
|
2626
|
+
}
|
|
2627
|
+
}, PositionOutOfBoundsError = class extends BaseError {
|
|
2628
|
+
constructor({ length: e, position: C }) {
|
|
2629
|
+
super(`Position \`${C}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" });
|
|
2630
|
+
}
|
|
2631
|
+
}, RecursiveReadLimitExceededError = class extends BaseError {
|
|
2632
|
+
constructor({ count: e, limit: C }) {
|
|
2633
|
+
super(`Recursive read limit of \`${C}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" });
|
|
2634
|
+
}
|
|
2635
|
+
}, staticCursor = {
|
|
2636
|
+
bytes: new Uint8Array(),
|
|
2637
|
+
dataView: /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(0)),
|
|
2638
|
+
position: 0,
|
|
2639
|
+
positionReadCount: /* @__PURE__ */ new Map(),
|
|
2640
|
+
recursiveReadCount: 0,
|
|
2641
|
+
recursiveReadLimit: Infinity,
|
|
2642
|
+
assertReadLimit() {
|
|
2643
|
+
if (this.recursiveReadCount >= this.recursiveReadLimit) throw new RecursiveReadLimitExceededError({
|
|
2644
|
+
count: this.recursiveReadCount + 1,
|
|
2645
|
+
limit: this.recursiveReadLimit
|
|
2646
|
+
});
|
|
2647
|
+
},
|
|
2648
|
+
assertPosition(e) {
|
|
2649
|
+
if (e < 0 || e > this.bytes.length - 1) throw new PositionOutOfBoundsError({
|
|
2650
|
+
length: this.bytes.length,
|
|
2651
|
+
position: e
|
|
2652
|
+
});
|
|
2653
|
+
},
|
|
2654
|
+
decrementPosition(e) {
|
|
2655
|
+
if (e < 0) throw new NegativeOffsetError({ offset: e });
|
|
2656
|
+
let C = this.position - e;
|
|
2657
|
+
this.assertPosition(C), this.position = C;
|
|
2658
|
+
},
|
|
2659
|
+
getReadCount(e) {
|
|
2660
|
+
return this.positionReadCount.get(e || this.position) || 0;
|
|
2661
|
+
},
|
|
2662
|
+
incrementPosition(e) {
|
|
2663
|
+
if (e < 0) throw new NegativeOffsetError({ offset: e });
|
|
2664
|
+
let C = this.position + e;
|
|
2665
|
+
this.assertPosition(C), this.position = C;
|
|
2666
|
+
},
|
|
2667
|
+
inspectByte(e) {
|
|
2668
|
+
let C = e ?? this.position;
|
|
2669
|
+
return this.assertPosition(C), this.bytes[C];
|
|
2670
|
+
},
|
|
2671
|
+
inspectBytes(e, C) {
|
|
2672
|
+
let w = C ?? this.position;
|
|
2673
|
+
return this.assertPosition(w + e - 1), this.bytes.subarray(w, w + e);
|
|
2674
|
+
},
|
|
2675
|
+
inspectUint8(e) {
|
|
2676
|
+
let C = e ?? this.position;
|
|
2677
|
+
return this.assertPosition(C), this.bytes[C];
|
|
2678
|
+
},
|
|
2679
|
+
inspectUint16(e) {
|
|
2680
|
+
let C = e ?? this.position;
|
|
2681
|
+
return this.assertPosition(C + 1), this.dataView.getUint16(C);
|
|
2682
|
+
},
|
|
2683
|
+
inspectUint24(e) {
|
|
2684
|
+
let C = e ?? this.position;
|
|
2685
|
+
return this.assertPosition(C + 2), (this.dataView.getUint16(C) << 8) + this.dataView.getUint8(C + 2);
|
|
2686
|
+
},
|
|
2687
|
+
inspectUint32(e) {
|
|
2688
|
+
let C = e ?? this.position;
|
|
2689
|
+
return this.assertPosition(C + 3), this.dataView.getUint32(C);
|
|
2690
|
+
},
|
|
2691
|
+
pushByte(e) {
|
|
2692
|
+
this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
|
|
2693
|
+
},
|
|
2694
|
+
pushBytes(e) {
|
|
2695
|
+
this.assertPosition(this.position + e.length - 1), this.bytes.set(e, this.position), this.position += e.length;
|
|
2696
|
+
},
|
|
2697
|
+
pushUint8(e) {
|
|
2698
|
+
this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
|
|
2699
|
+
},
|
|
2700
|
+
pushUint16(e) {
|
|
2701
|
+
this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, e), this.position += 2;
|
|
2702
|
+
},
|
|
2703
|
+
pushUint24(e) {
|
|
2704
|
+
this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, e >> 8), this.dataView.setUint8(this.position + 2, e & 255), this.position += 3;
|
|
2705
|
+
},
|
|
2706
|
+
pushUint32(e) {
|
|
2707
|
+
this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, e), this.position += 4;
|
|
2708
|
+
},
|
|
2709
|
+
readByte() {
|
|
2710
|
+
this.assertReadLimit(), this._touch();
|
|
2711
|
+
let e = this.inspectByte();
|
|
2712
|
+
return this.position++, e;
|
|
2713
|
+
},
|
|
2714
|
+
readBytes(e, C) {
|
|
2715
|
+
this.assertReadLimit(), this._touch();
|
|
2716
|
+
let w = this.inspectBytes(e);
|
|
2717
|
+
return this.position += C ?? e, w;
|
|
2718
|
+
},
|
|
2719
|
+
readUint8() {
|
|
2720
|
+
this.assertReadLimit(), this._touch();
|
|
2721
|
+
let e = this.inspectUint8();
|
|
2722
|
+
return this.position += 1, e;
|
|
2723
|
+
},
|
|
2724
|
+
readUint16() {
|
|
2725
|
+
this.assertReadLimit(), this._touch();
|
|
2726
|
+
let e = this.inspectUint16();
|
|
2727
|
+
return this.position += 2, e;
|
|
2728
|
+
},
|
|
2729
|
+
readUint24() {
|
|
2730
|
+
this.assertReadLimit(), this._touch();
|
|
2731
|
+
let e = this.inspectUint24();
|
|
2732
|
+
return this.position += 3, e;
|
|
2733
|
+
},
|
|
2734
|
+
readUint32() {
|
|
2735
|
+
this.assertReadLimit(), this._touch();
|
|
2736
|
+
let e = this.inspectUint32();
|
|
2737
|
+
return this.position += 4, e;
|
|
2738
|
+
},
|
|
2739
|
+
get remaining() {
|
|
2740
|
+
return this.bytes.length - this.position;
|
|
2741
|
+
},
|
|
2742
|
+
setPosition(e) {
|
|
2743
|
+
let C = this.position;
|
|
2744
|
+
return this.assertPosition(e), this.position = e, () => this.position = C;
|
|
2745
|
+
},
|
|
2746
|
+
_touch() {
|
|
2747
|
+
if (this.recursiveReadLimit === Infinity) return;
|
|
2748
|
+
let e = this.getReadCount();
|
|
2749
|
+
this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
|
|
2750
|
+
}
|
|
2751
|
+
};
|
|
2752
|
+
function createCursor(e, { recursiveReadLimit: C = 8192 } = {}) {
|
|
2753
|
+
let w = Object.create(staticCursor);
|
|
2754
|
+
return w.bytes = e, w.dataView = new DataView(e.buffer ?? e, e.byteOffset, e.byteLength), w.positionReadCount = /* @__PURE__ */ new Map(), w.recursiveReadLimit = C, w;
|
|
2755
|
+
}
|
|
2756
|
+
function toRlp(e, C = "hex") {
|
|
2757
|
+
let w = getEncodable(e), T = createCursor(new Uint8Array(w.length));
|
|
2758
|
+
return w.encode(T), C === "hex" ? bytesToHex(T.bytes) : T.bytes;
|
|
2759
|
+
}
|
|
2760
|
+
function getEncodable(e) {
|
|
2761
|
+
return Array.isArray(e) ? getEncodableList(e.map((e) => getEncodable(e))) : getEncodableBytes(e);
|
|
2762
|
+
}
|
|
2763
|
+
function getEncodableList(e) {
|
|
2764
|
+
let C = e.reduce((e, C) => e + C.length, 0), w = getSizeOfLength(C);
|
|
2765
|
+
return {
|
|
2766
|
+
length: (() => C <= 55 ? 1 + C : 1 + w + C)(),
|
|
2767
|
+
encode(T) {
|
|
2768
|
+
C <= 55 ? T.pushByte(192 + C) : (T.pushByte(247 + w), w === 1 ? T.pushUint8(C) : w === 2 ? T.pushUint16(C) : w === 3 ? T.pushUint24(C) : T.pushUint32(C));
|
|
2769
|
+
for (let { encode: C } of e) C(T);
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
}
|
|
2773
|
+
function getEncodableBytes(e) {
|
|
2774
|
+
let C = typeof e == "string" ? hexToBytes(e) : e, w = getSizeOfLength(C.length);
|
|
2775
|
+
return {
|
|
2776
|
+
length: (() => C.length === 1 && C[0] < 128 ? 1 : C.length <= 55 ? 1 + C.length : 1 + w + C.length)(),
|
|
2777
|
+
encode(e) {
|
|
2778
|
+
C.length === 1 && C[0] < 128 ? e.pushBytes(C) : C.length <= 55 ? (e.pushByte(128 + C.length), e.pushBytes(C)) : (e.pushByte(183 + w), w === 1 ? e.pushUint8(C.length) : w === 2 ? e.pushUint16(C.length) : w === 3 ? e.pushUint24(C.length) : e.pushUint32(C.length), e.pushBytes(C));
|
|
2779
|
+
}
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2782
|
+
function getSizeOfLength(e) {
|
|
2783
|
+
if (e < 2 ** 8) return 1;
|
|
2784
|
+
if (e < 2 ** 16) return 2;
|
|
2785
|
+
if (e < 2 ** 24) return 3;
|
|
2786
|
+
if (e < 2 ** 32) return 4;
|
|
2787
|
+
throw new BaseError("Length is too large.");
|
|
2788
|
+
}
|
|
2789
|
+
const gweiUnits = {
|
|
2790
|
+
ether: -9,
|
|
2791
|
+
wei: 9
|
|
2792
|
+
};
|
|
2793
|
+
function formatUnits(e, C) {
|
|
2794
|
+
let w = e.toString(), T = w.startsWith("-");
|
|
2795
|
+
T && (w = w.slice(1)), w = w.padStart(C, "0");
|
|
2796
|
+
let [E, D] = [w.slice(0, w.length - C), w.slice(w.length - C)];
|
|
2797
|
+
return D = D.replace(/(0+)$/, ""), `${T ? "-" : ""}${E || "0"}${D ? `.${D}` : ""}`;
|
|
2798
|
+
}
|
|
2799
|
+
function formatGwei(e, C = "wei") {
|
|
2800
|
+
return formatUnits(e, gweiUnits[C]);
|
|
2801
|
+
}
|
|
2802
|
+
function prettyPrint(e) {
|
|
2803
|
+
let C = Object.entries(e).map(([e, C]) => C === void 0 || C === !1 ? null : [e, C]).filter(Boolean), w = C.reduce((e, [C]) => Math.max(e, C.length), 0);
|
|
2804
|
+
return C.map(([e, C]) => ` ${`${e}:`.padEnd(w + 1)} ${C}`).join("\n");
|
|
2805
|
+
}
|
|
2806
|
+
var InvalidLegacyVError = class extends BaseError {
|
|
2807
|
+
constructor({ v: e }) {
|
|
2808
|
+
super(`Invalid \`v\` value "${e}". Expected 27 or 28.`, { name: "InvalidLegacyVError" });
|
|
2809
|
+
}
|
|
2810
|
+
}, InvalidSerializableTransactionError = class extends BaseError {
|
|
2811
|
+
constructor({ transaction: e }) {
|
|
2812
|
+
super("Cannot infer a transaction type from provided transaction.", {
|
|
2813
|
+
metaMessages: [
|
|
2814
|
+
"Provided Transaction:",
|
|
2815
|
+
"{",
|
|
2816
|
+
prettyPrint(e),
|
|
2817
|
+
"}",
|
|
2818
|
+
"",
|
|
2819
|
+
"To infer the type, either provide:",
|
|
2820
|
+
"- a `type` to the Transaction, or",
|
|
2821
|
+
"- an EIP-1559 Transaction with `maxFeePerGas`, or",
|
|
2822
|
+
"- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
|
|
2823
|
+
"- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
|
|
2824
|
+
"- an EIP-7702 Transaction with `authorizationList`, or",
|
|
2825
|
+
"- a Legacy Transaction with `gasPrice`"
|
|
2826
|
+
],
|
|
2827
|
+
name: "InvalidSerializableTransactionError"
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
}, InvalidStorageKeySizeError = class extends BaseError {
|
|
2831
|
+
constructor({ storageKey: e }) {
|
|
2832
|
+
super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
|
|
2833
|
+
}
|
|
2834
|
+
};
|
|
2835
|
+
function serializeAuthorizationList(e) {
|
|
2836
|
+
if (!e || e.length === 0) return [];
|
|
2837
|
+
let C = [];
|
|
2838
|
+
for (let w of e) {
|
|
2839
|
+
let { chainId: e, nonce: T, ...E } = w, D = w.address;
|
|
2840
|
+
C.push([
|
|
2841
|
+
e ? toHex(e) : "0x",
|
|
2842
|
+
D,
|
|
2843
|
+
T ? toHex(T) : "0x",
|
|
2844
|
+
...toYParitySignatureArray({}, E)
|
|
2845
|
+
]);
|
|
2846
|
+
}
|
|
2847
|
+
return C;
|
|
2848
|
+
}
|
|
2849
|
+
function blobsToCommitments(e) {
|
|
2850
|
+
let { kzg: C } = e, w = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), T = typeof e.blobs[0] == "string" ? e.blobs.map((e) => hexToBytes(e)) : e.blobs, E = [];
|
|
2851
|
+
for (let e of T) E.push(Uint8Array.from(C.blobToKzgCommitment(e)));
|
|
2852
|
+
return w === "bytes" ? E : E.map((e) => bytesToHex(e));
|
|
2853
|
+
}
|
|
2854
|
+
function blobsToProofs(e) {
|
|
2855
|
+
let { kzg: C } = e, w = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), T = typeof e.blobs[0] == "string" ? e.blobs.map((e) => hexToBytes(e)) : e.blobs, E = typeof e.commitments[0] == "string" ? e.commitments.map((e) => hexToBytes(e)) : e.commitments, D = [];
|
|
2856
|
+
for (let e = 0; e < T.length; e++) {
|
|
2857
|
+
let w = T[e], O = E[e];
|
|
2858
|
+
D.push(Uint8Array.from(C.computeBlobKzgProof(w, O)));
|
|
2859
|
+
}
|
|
2860
|
+
return w === "bytes" ? D : D.map((e) => bytesToHex(e));
|
|
2861
|
+
}
|
|
2862
|
+
function isBytes(e) {
|
|
2863
|
+
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
2864
|
+
}
|
|
2865
|
+
function anumber(e) {
|
|
2866
|
+
if (!Number.isSafeInteger(e) || e < 0) throw Error("positive integer expected, got " + e);
|
|
2867
|
+
}
|
|
2868
|
+
function abytes(e, ...C) {
|
|
2869
|
+
if (!isBytes(e)) throw Error("Uint8Array expected");
|
|
2870
|
+
if (C.length > 0 && !C.includes(e.length)) throw Error("Uint8Array expected of length " + C + ", got length=" + e.length);
|
|
2871
|
+
}
|
|
2872
|
+
function aexists(e, C = !0) {
|
|
2873
|
+
if (e.destroyed) throw Error("Hash instance has been destroyed");
|
|
2874
|
+
if (C && e.finished) throw Error("Hash#digest() has already been called");
|
|
2875
|
+
}
|
|
2876
|
+
function aoutput(e, C) {
|
|
2877
|
+
abytes(e);
|
|
2878
|
+
let w = C.outputLen;
|
|
2879
|
+
if (e.length < w) throw Error("digestInto() expects output buffer of length at least " + w);
|
|
2880
|
+
}
|
|
2881
|
+
function u32(e) {
|
|
2882
|
+
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
2883
|
+
}
|
|
2884
|
+
function clean(...e) {
|
|
2885
|
+
for (let C = 0; C < e.length; C++) e[C].fill(0);
|
|
2886
|
+
}
|
|
2887
|
+
function createView(e) {
|
|
2888
|
+
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
2889
|
+
}
|
|
2890
|
+
function rotr(e, C) {
|
|
2891
|
+
return e << 32 - C | e >>> C;
|
|
2892
|
+
}
|
|
2893
|
+
const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
2894
|
+
function byteSwap(e) {
|
|
2895
|
+
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
2896
|
+
}
|
|
2897
|
+
function byteSwap32(e) {
|
|
2898
|
+
for (let C = 0; C < e.length; C++) e[C] = byteSwap(e[C]);
|
|
2899
|
+
return e;
|
|
2900
|
+
}
|
|
2901
|
+
const swap32IfBE = isLE ? (e) => e : byteSwap32;
|
|
2902
|
+
function utf8ToBytes(e) {
|
|
2903
|
+
if (typeof e != "string") throw Error("string expected");
|
|
2904
|
+
return new Uint8Array(new TextEncoder().encode(e));
|
|
2905
|
+
}
|
|
2906
|
+
function toBytes$1(e) {
|
|
2907
|
+
return typeof e == "string" && (e = utf8ToBytes(e)), abytes(e), e;
|
|
2908
|
+
}
|
|
2909
|
+
var Hash = class {};
|
|
2910
|
+
function createHasher(e) {
|
|
2911
|
+
let C = (C) => e().update(toBytes$1(C)).digest(), w = e();
|
|
2912
|
+
return C.outputLen = w.outputLen, C.blockLen = w.blockLen, C.create = () => e(), C;
|
|
2913
|
+
}
|
|
2914
|
+
function setBigUint64(e, C, w, T) {
|
|
2915
|
+
if (typeof e.setBigUint64 == "function") return e.setBigUint64(C, w, T);
|
|
2916
|
+
let E = BigInt(32), D = BigInt(4294967295), O = Number(w >> E & D), k = Number(w & D), A = T ? 4 : 0, j = T ? 0 : 4;
|
|
2917
|
+
e.setUint32(C + A, O, T), e.setUint32(C + j, k, T);
|
|
2918
|
+
}
|
|
2919
|
+
function Chi(e, C, w) {
|
|
2920
|
+
return e & C ^ ~e & w;
|
|
2921
|
+
}
|
|
2922
|
+
function Maj(e, C, w) {
|
|
2923
|
+
return e & C ^ e & w ^ C & w;
|
|
2924
|
+
}
|
|
2925
|
+
var HashMD = class extends Hash {
|
|
2926
|
+
constructor(e, C, w, T) {
|
|
2927
|
+
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = C, this.padOffset = w, this.isLE = T, this.buffer = new Uint8Array(e), this.view = createView(this.buffer);
|
|
2928
|
+
}
|
|
2929
|
+
update(e) {
|
|
2930
|
+
aexists(this), e = toBytes$1(e), abytes(e);
|
|
2931
|
+
let { view: C, buffer: w, blockLen: T } = this, E = e.length;
|
|
2932
|
+
for (let D = 0; D < E;) {
|
|
2933
|
+
let O = Math.min(T - this.pos, E - D);
|
|
2934
|
+
if (O === T) {
|
|
2935
|
+
let C = createView(e);
|
|
2936
|
+
for (; T <= E - D; D += T) this.process(C, D);
|
|
2937
|
+
continue;
|
|
2938
|
+
}
|
|
2939
|
+
w.set(e.subarray(D, D + O), this.pos), this.pos += O, D += O, this.pos === T && (this.process(C, 0), this.pos = 0);
|
|
2940
|
+
}
|
|
2941
|
+
return this.length += e.length, this.roundClean(), this;
|
|
2942
|
+
}
|
|
2943
|
+
digestInto(e) {
|
|
2944
|
+
aexists(this), aoutput(e, this), this.finished = !0;
|
|
2945
|
+
let { buffer: C, view: w, blockLen: T, isLE: E } = this, { pos: D } = this;
|
|
2946
|
+
C[D++] = 128, clean(this.buffer.subarray(D)), this.padOffset > T - D && (this.process(w, 0), D = 0);
|
|
2947
|
+
for (let e = D; e < T; e++) C[e] = 0;
|
|
2948
|
+
setBigUint64(w, T - 8, BigInt(this.length * 8), E), this.process(w, 0);
|
|
2949
|
+
let O = createView(e), k = this.outputLen;
|
|
2950
|
+
if (k % 4) throw Error("_sha2: outputLen should be aligned to 32bit");
|
|
2951
|
+
let A = k / 4, j = this.get();
|
|
2952
|
+
if (A > j.length) throw Error("_sha2: outputLen bigger than state");
|
|
2953
|
+
for (let e = 0; e < A; e++) O.setUint32(4 * e, j[e], E);
|
|
2954
|
+
}
|
|
2955
|
+
digest() {
|
|
2956
|
+
let { buffer: e, outputLen: C } = this;
|
|
2957
|
+
this.digestInto(e);
|
|
2958
|
+
let w = e.slice(0, C);
|
|
2959
|
+
return this.destroy(), w;
|
|
2960
|
+
}
|
|
2961
|
+
_cloneInto(e) {
|
|
2962
|
+
e ||= new this.constructor(), e.set(...this.get());
|
|
2963
|
+
let { blockLen: C, buffer: w, length: T, finished: E, destroyed: D, pos: O } = this;
|
|
2964
|
+
return e.destroyed = D, e.finished = E, e.length = T, e.pos = O, T % C && e.buffer.set(w), e;
|
|
2965
|
+
}
|
|
2966
|
+
clone() {
|
|
2967
|
+
return this._cloneInto();
|
|
2968
|
+
}
|
|
2969
|
+
};
|
|
2970
|
+
const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
2971
|
+
1779033703,
|
|
2972
|
+
3144134277,
|
|
2973
|
+
1013904242,
|
|
2974
|
+
2773480762,
|
|
2975
|
+
1359893119,
|
|
2976
|
+
2600822924,
|
|
2977
|
+
528734635,
|
|
2978
|
+
1541459225
|
|
2979
|
+
]);
|
|
2980
|
+
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1), _32n = /* @__PURE__ */ BigInt(32);
|
|
2981
|
+
function fromBig(e, C = !1) {
|
|
2982
|
+
return C ? {
|
|
2983
|
+
h: Number(e & U32_MASK64),
|
|
2984
|
+
l: Number(e >> _32n & U32_MASK64)
|
|
2985
|
+
} : {
|
|
2986
|
+
h: Number(e >> _32n & U32_MASK64) | 0,
|
|
2987
|
+
l: Number(e & U32_MASK64) | 0
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
function split(e, C = !1) {
|
|
2991
|
+
let w = e.length, T = new Uint32Array(w), E = new Uint32Array(w);
|
|
2992
|
+
for (let D = 0; D < w; D++) {
|
|
2993
|
+
let { h: w, l: O } = fromBig(e[D], C);
|
|
2994
|
+
[T[D], E[D]] = [w, O];
|
|
2995
|
+
}
|
|
2996
|
+
return [T, E];
|
|
2997
|
+
}
|
|
2998
|
+
var rotlSH = (e, C, w) => e << w | C >>> 32 - w, rotlSL = (e, C, w) => C << w | e >>> 32 - w, rotlBH = (e, C, w) => C << w - 32 | e >>> 64 - w, rotlBL = (e, C, w) => e << w - 32 | C >>> 64 - w, SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
2999
|
+
1116352408,
|
|
3000
|
+
1899447441,
|
|
3001
|
+
3049323471,
|
|
3002
|
+
3921009573,
|
|
3003
|
+
961987163,
|
|
3004
|
+
1508970993,
|
|
3005
|
+
2453635748,
|
|
3006
|
+
2870763221,
|
|
3007
|
+
3624381080,
|
|
3008
|
+
310598401,
|
|
3009
|
+
607225278,
|
|
3010
|
+
1426881987,
|
|
3011
|
+
1925078388,
|
|
3012
|
+
2162078206,
|
|
3013
|
+
2614888103,
|
|
3014
|
+
3248222580,
|
|
3015
|
+
3835390401,
|
|
3016
|
+
4022224774,
|
|
3017
|
+
264347078,
|
|
3018
|
+
604807628,
|
|
3019
|
+
770255983,
|
|
3020
|
+
1249150122,
|
|
3021
|
+
1555081692,
|
|
3022
|
+
1996064986,
|
|
3023
|
+
2554220882,
|
|
3024
|
+
2821834349,
|
|
3025
|
+
2952996808,
|
|
3026
|
+
3210313671,
|
|
3027
|
+
3336571891,
|
|
3028
|
+
3584528711,
|
|
3029
|
+
113926993,
|
|
3030
|
+
338241895,
|
|
3031
|
+
666307205,
|
|
3032
|
+
773529912,
|
|
3033
|
+
1294757372,
|
|
3034
|
+
1396182291,
|
|
3035
|
+
1695183700,
|
|
3036
|
+
1986661051,
|
|
3037
|
+
2177026350,
|
|
3038
|
+
2456956037,
|
|
3039
|
+
2730485921,
|
|
3040
|
+
2820302411,
|
|
3041
|
+
3259730800,
|
|
3042
|
+
3345764771,
|
|
3043
|
+
3516065817,
|
|
3044
|
+
3600352804,
|
|
3045
|
+
4094571909,
|
|
3046
|
+
275423344,
|
|
3047
|
+
430227734,
|
|
3048
|
+
506948616,
|
|
3049
|
+
659060556,
|
|
3050
|
+
883997877,
|
|
3051
|
+
958139571,
|
|
3052
|
+
1322822218,
|
|
3053
|
+
1537002063,
|
|
3054
|
+
1747873779,
|
|
3055
|
+
1955562222,
|
|
3056
|
+
2024104815,
|
|
3057
|
+
2227730452,
|
|
3058
|
+
2361852424,
|
|
3059
|
+
2428436474,
|
|
3060
|
+
2756734187,
|
|
3061
|
+
3204031479,
|
|
3062
|
+
3329325298
|
|
3063
|
+
]), SHA256_W = /* @__PURE__ */ new Uint32Array(64), SHA256 = class extends HashMD {
|
|
3064
|
+
constructor(e = 32) {
|
|
3065
|
+
super(64, e, 8, !1), this.A = SHA256_IV[0] | 0, this.B = SHA256_IV[1] | 0, this.C = SHA256_IV[2] | 0, this.D = SHA256_IV[3] | 0, this.E = SHA256_IV[4] | 0, this.F = SHA256_IV[5] | 0, this.G = SHA256_IV[6] | 0, this.H = SHA256_IV[7] | 0;
|
|
3066
|
+
}
|
|
3067
|
+
get() {
|
|
3068
|
+
let { A: e, B: C, C: w, D: T, E, F: D, G: O, H: k } = this;
|
|
3069
|
+
return [
|
|
3070
|
+
e,
|
|
3071
|
+
C,
|
|
3072
|
+
w,
|
|
3073
|
+
T,
|
|
3074
|
+
E,
|
|
3075
|
+
D,
|
|
3076
|
+
O,
|
|
3077
|
+
k
|
|
3078
|
+
];
|
|
3079
|
+
}
|
|
3080
|
+
set(e, C, w, T, E, D, O, k) {
|
|
3081
|
+
this.A = e | 0, this.B = C | 0, this.C = w | 0, this.D = T | 0, this.E = E | 0, this.F = D | 0, this.G = O | 0, this.H = k | 0;
|
|
3082
|
+
}
|
|
3083
|
+
process(e, C) {
|
|
3084
|
+
for (let w = 0; w < 16; w++, C += 4) SHA256_W[w] = e.getUint32(C, !1);
|
|
3085
|
+
for (let e = 16; e < 64; e++) {
|
|
3086
|
+
let C = SHA256_W[e - 15], w = SHA256_W[e - 2], T = rotr(C, 7) ^ rotr(C, 18) ^ C >>> 3;
|
|
3087
|
+
SHA256_W[e] = (rotr(w, 17) ^ rotr(w, 19) ^ w >>> 10) + SHA256_W[e - 7] + T + SHA256_W[e - 16] | 0;
|
|
3088
|
+
}
|
|
3089
|
+
let { A: w, B: T, C: E, D, E: O, F: k, G: A, H: j } = this;
|
|
3090
|
+
for (let e = 0; e < 64; e++) {
|
|
3091
|
+
let C = rotr(O, 6) ^ rotr(O, 11) ^ rotr(O, 25), M = j + C + Chi(O, k, A) + SHA256_K[e] + SHA256_W[e] | 0, N = (rotr(w, 2) ^ rotr(w, 13) ^ rotr(w, 22)) + Maj(w, T, E) | 0;
|
|
3092
|
+
j = A, A = k, k = O, O = D + M | 0, D = E, E = T, T = w, w = M + N | 0;
|
|
3093
|
+
}
|
|
3094
|
+
w = w + this.A | 0, T = T + this.B | 0, E = E + this.C | 0, D = D + this.D | 0, O = O + this.E | 0, k = k + this.F | 0, A = A + this.G | 0, j = j + this.H | 0, this.set(w, T, E, D, O, k, A, j);
|
|
3095
|
+
}
|
|
3096
|
+
roundClean() {
|
|
3097
|
+
clean(SHA256_W);
|
|
3098
|
+
}
|
|
3099
|
+
destroy() {
|
|
3100
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), clean(this.buffer);
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
const sha256$1 = /* @__PURE__ */ createHasher(() => new SHA256());
|
|
3104
|
+
function sha256(e, C) {
|
|
3105
|
+
let w = C || "hex", T = sha256$1(isHex(e, { strict: !1 }) ? toBytes(e) : e);
|
|
3106
|
+
return w === "bytes" ? T : toHex(T);
|
|
3107
|
+
}
|
|
3108
|
+
function commitmentToVersionedHash(e) {
|
|
3109
|
+
let { commitment: C, version: w = 1 } = e, T = e.to ?? (typeof C == "string" ? "hex" : "bytes"), E = sha256(C, "bytes");
|
|
3110
|
+
return E.set([w], 0), T === "bytes" ? E : bytesToHex(E);
|
|
3111
|
+
}
|
|
3112
|
+
function commitmentsToVersionedHashes(e) {
|
|
3113
|
+
let { commitments: C, version: w } = e, T = e.to ?? (typeof C[0] == "string" ? "hex" : "bytes"), E = [];
|
|
3114
|
+
for (let e of C) E.push(commitmentToVersionedHash({
|
|
3115
|
+
commitment: e,
|
|
3116
|
+
to: T,
|
|
3117
|
+
version: w
|
|
3118
|
+
}));
|
|
3119
|
+
return E;
|
|
3120
|
+
}
|
|
3121
|
+
var blobsPerTransaction = 6;
|
|
3122
|
+
const fieldElementsPerBlob = 4096, bytesPerBlob = 32 * fieldElementsPerBlob, maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - 1 - 1 * fieldElementsPerBlob * blobsPerTransaction;
|
|
3123
|
+
var BlobSizeTooLargeError = class extends BaseError {
|
|
3124
|
+
constructor({ maxSize: e, size: C }) {
|
|
3125
|
+
super("Blob size is too large.", {
|
|
3126
|
+
metaMessages: [`Max: ${e} bytes`, `Given: ${C} bytes`],
|
|
3127
|
+
name: "BlobSizeTooLargeError"
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
}, EmptyBlobError = class extends BaseError {
|
|
3131
|
+
constructor() {
|
|
3132
|
+
super("Blob data must not be empty.", { name: "EmptyBlobError" });
|
|
3133
|
+
}
|
|
3134
|
+
}, InvalidVersionedHashSizeError = class extends BaseError {
|
|
3135
|
+
constructor({ hash: e, size: C }) {
|
|
3136
|
+
super(`Versioned hash "${e}" size is invalid.`, {
|
|
3137
|
+
metaMessages: ["Expected: 32", `Received: ${C}`],
|
|
3138
|
+
name: "InvalidVersionedHashSizeError"
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
}, InvalidVersionedHashVersionError = class extends BaseError {
|
|
3142
|
+
constructor({ hash: e, version: C }) {
|
|
3143
|
+
super(`Versioned hash "${e}" version is invalid.`, {
|
|
3144
|
+
metaMessages: ["Expected: 1", `Received: ${C}`],
|
|
3145
|
+
name: "InvalidVersionedHashVersionError"
|
|
3146
|
+
});
|
|
3147
|
+
}
|
|
3148
|
+
};
|
|
3149
|
+
function toBlobs(e) {
|
|
3150
|
+
let C = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), w = typeof e.data == "string" ? hexToBytes(e.data) : e.data, T = size(w);
|
|
3151
|
+
if (!T) throw new EmptyBlobError();
|
|
3152
|
+
if (T > 761855) throw new BlobSizeTooLargeError({
|
|
3153
|
+
maxSize: maxBytesPerTransaction,
|
|
3154
|
+
size: T
|
|
3155
|
+
});
|
|
3156
|
+
let E = [], D = !0, O = 0;
|
|
3157
|
+
for (; D;) {
|
|
3158
|
+
let e = createCursor(new Uint8Array(bytesPerBlob)), C = 0;
|
|
3159
|
+
for (; C < fieldElementsPerBlob;) {
|
|
3160
|
+
let T = w.slice(O, O + 31);
|
|
3161
|
+
if (e.pushByte(0), e.pushBytes(T), T.length < 31) {
|
|
3162
|
+
e.pushByte(128), D = !1;
|
|
3163
|
+
break;
|
|
3164
|
+
}
|
|
3165
|
+
C++, O += 31;
|
|
3166
|
+
}
|
|
3167
|
+
E.push(e);
|
|
3168
|
+
}
|
|
3169
|
+
return C === "bytes" ? E.map((e) => e.bytes) : E.map((e) => bytesToHex(e.bytes));
|
|
3170
|
+
}
|
|
3171
|
+
function toBlobSidecars(e) {
|
|
3172
|
+
let { data: C, kzg: w, to: T } = e, E = e.blobs ?? toBlobs({
|
|
3173
|
+
data: C,
|
|
3174
|
+
to: T
|
|
3175
|
+
}), D = e.commitments ?? blobsToCommitments({
|
|
3176
|
+
blobs: E,
|
|
3177
|
+
kzg: w,
|
|
3178
|
+
to: T
|
|
3179
|
+
}), O = e.proofs ?? blobsToProofs({
|
|
3180
|
+
blobs: E,
|
|
3181
|
+
commitments: D,
|
|
3182
|
+
kzg: w,
|
|
3183
|
+
to: T
|
|
3184
|
+
}), k = [];
|
|
3185
|
+
for (let e = 0; e < E.length; e++) k.push({
|
|
3186
|
+
blob: E[e],
|
|
3187
|
+
commitment: D[e],
|
|
3188
|
+
proof: O[e]
|
|
3189
|
+
});
|
|
3190
|
+
return k;
|
|
3191
|
+
}
|
|
3192
|
+
var InvalidAddressError = class extends BaseError {
|
|
3193
|
+
constructor({ address: e }) {
|
|
3194
|
+
super(`Address "${e}" is invalid.`, {
|
|
3195
|
+
metaMessages: ["- Address must be a hex value of 20 bytes (40 hex characters).", "- Address must match its checksum counterpart."],
|
|
3196
|
+
name: "InvalidAddressError"
|
|
3197
|
+
});
|
|
3198
|
+
}
|
|
3199
|
+
}, InvalidChainIdError = class extends BaseError {
|
|
3200
|
+
constructor({ chainId: e }) {
|
|
3201
|
+
super(typeof e == "number" ? `Chain ID "${e}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
|
|
3202
|
+
}
|
|
3203
|
+
}, ExecutionRevertedError = class extends BaseError {
|
|
3204
|
+
constructor({ cause: e, message: C } = {}) {
|
|
3205
|
+
let w = C?.replace("execution reverted: ", "")?.replace("execution reverted", "");
|
|
3206
|
+
super(`Execution reverted ${w ? `with reason: ${w}` : "for an unknown reason"}.`, {
|
|
3207
|
+
cause: e,
|
|
3208
|
+
name: "ExecutionRevertedError"
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
};
|
|
3212
|
+
Object.defineProperty(ExecutionRevertedError, "code", {
|
|
3213
|
+
enumerable: !0,
|
|
3214
|
+
configurable: !0,
|
|
3215
|
+
writable: !0,
|
|
3216
|
+
value: 3
|
|
3217
|
+
}), Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
|
|
3218
|
+
enumerable: !0,
|
|
3219
|
+
configurable: !0,
|
|
3220
|
+
writable: !0,
|
|
3221
|
+
value: /execution reverted|gas required exceeds allowance/
|
|
3222
|
+
});
|
|
3223
|
+
var FeeCapTooHighError = class extends BaseError {
|
|
3224
|
+
constructor({ cause: e, maxFeePerGas: C } = {}) {
|
|
3225
|
+
super(`The fee cap (\`maxFeePerGas\`${C ? ` = ${formatGwei(C)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
3226
|
+
cause: e,
|
|
3227
|
+
name: "FeeCapTooHighError"
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
|
|
3232
|
+
enumerable: !0,
|
|
3233
|
+
configurable: !0,
|
|
3234
|
+
writable: !0,
|
|
3235
|
+
value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
|
|
3236
|
+
});
|
|
3237
|
+
var FeeCapTooLowError = class extends BaseError {
|
|
3238
|
+
constructor({ cause: e, maxFeePerGas: C } = {}) {
|
|
3239
|
+
super(`The fee cap (\`maxFeePerGas\`${C ? ` = ${formatGwei(C)}` : ""} gwei) cannot be lower than the block base fee.`, {
|
|
3240
|
+
cause: e,
|
|
3241
|
+
name: "FeeCapTooLowError"
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
|
|
3246
|
+
enumerable: !0,
|
|
3247
|
+
configurable: !0,
|
|
3248
|
+
writable: !0,
|
|
3249
|
+
value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
|
|
3250
|
+
});
|
|
3251
|
+
var NonceTooHighError = class extends BaseError {
|
|
3252
|
+
constructor({ cause: e, nonce: C } = {}) {
|
|
3253
|
+
super(`Nonce provided for the transaction ${C ? `(${C}) ` : ""}is higher than the next one expected.`, {
|
|
3254
|
+
cause: e,
|
|
3255
|
+
name: "NonceTooHighError"
|
|
3256
|
+
});
|
|
3257
|
+
}
|
|
3258
|
+
};
|
|
3259
|
+
Object.defineProperty(NonceTooHighError, "nodeMessage", {
|
|
3260
|
+
enumerable: !0,
|
|
3261
|
+
configurable: !0,
|
|
3262
|
+
writable: !0,
|
|
3263
|
+
value: /nonce too high/
|
|
3264
|
+
});
|
|
3265
|
+
var NonceTooLowError = class extends BaseError {
|
|
3266
|
+
constructor({ cause: e, nonce: C } = {}) {
|
|
3267
|
+
super([`Nonce provided for the transaction ${C ? `(${C}) ` : ""}is lower than the current nonce of the account.`, "Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"), {
|
|
3268
|
+
cause: e,
|
|
3269
|
+
name: "NonceTooLowError"
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
};
|
|
3273
|
+
Object.defineProperty(NonceTooLowError, "nodeMessage", {
|
|
3274
|
+
enumerable: !0,
|
|
3275
|
+
configurable: !0,
|
|
3276
|
+
writable: !0,
|
|
3277
|
+
value: /nonce too low|transaction already imported|already known/
|
|
3278
|
+
});
|
|
3279
|
+
var NonceMaxValueError = class extends BaseError {
|
|
3280
|
+
constructor({ cause: e, nonce: C } = {}) {
|
|
3281
|
+
super(`Nonce provided for the transaction ${C ? `(${C}) ` : ""}exceeds the maximum allowed nonce.`, {
|
|
3282
|
+
cause: e,
|
|
3283
|
+
name: "NonceMaxValueError"
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
};
|
|
3287
|
+
Object.defineProperty(NonceMaxValueError, "nodeMessage", {
|
|
3288
|
+
enumerable: !0,
|
|
3289
|
+
configurable: !0,
|
|
3290
|
+
writable: !0,
|
|
3291
|
+
value: /nonce has max value/
|
|
3292
|
+
});
|
|
3293
|
+
var InsufficientFundsError = class extends BaseError {
|
|
3294
|
+
constructor({ cause: e } = {}) {
|
|
3295
|
+
super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"), {
|
|
3296
|
+
cause: e,
|
|
3297
|
+
metaMessages: [
|
|
3298
|
+
"This error could arise when the account does not have enough funds to:",
|
|
3299
|
+
" - pay for the total gas fee,",
|
|
3300
|
+
" - pay for the value to send.",
|
|
3301
|
+
" ",
|
|
3302
|
+
"The cost of the transaction is calculated as `gas * gas fee + value`, where:",
|
|
3303
|
+
" - `gas` is the amount of gas needed for transaction to execute,",
|
|
3304
|
+
" - `gas fee` is the gas fee,",
|
|
3305
|
+
" - `value` is the amount of ether to send to the recipient."
|
|
3306
|
+
],
|
|
3307
|
+
name: "InsufficientFundsError"
|
|
3308
|
+
});
|
|
3309
|
+
}
|
|
3310
|
+
};
|
|
3311
|
+
Object.defineProperty(InsufficientFundsError, "nodeMessage", {
|
|
3312
|
+
enumerable: !0,
|
|
3313
|
+
configurable: !0,
|
|
3314
|
+
writable: !0,
|
|
3315
|
+
value: /insufficient funds|exceeds transaction sender account balance/
|
|
3316
|
+
});
|
|
3317
|
+
var IntrinsicGasTooHighError = class extends BaseError {
|
|
3318
|
+
constructor({ cause: e, gas: C } = {}) {
|
|
3319
|
+
super(`The amount of gas ${C ? `(${C}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
|
|
3320
|
+
cause: e,
|
|
3321
|
+
name: "IntrinsicGasTooHighError"
|
|
3322
|
+
});
|
|
3323
|
+
}
|
|
3324
|
+
};
|
|
3325
|
+
Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
|
|
3326
|
+
enumerable: !0,
|
|
3327
|
+
configurable: !0,
|
|
3328
|
+
writable: !0,
|
|
3329
|
+
value: /intrinsic gas too high|gas limit reached/
|
|
3330
|
+
});
|
|
3331
|
+
var IntrinsicGasTooLowError = class extends BaseError {
|
|
3332
|
+
constructor({ cause: e, gas: C } = {}) {
|
|
3333
|
+
super(`The amount of gas ${C ? `(${C}) ` : ""}provided for the transaction is too low.`, {
|
|
3334
|
+
cause: e,
|
|
3335
|
+
name: "IntrinsicGasTooLowError"
|
|
3336
|
+
});
|
|
3337
|
+
}
|
|
3338
|
+
};
|
|
3339
|
+
Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
|
|
3340
|
+
enumerable: !0,
|
|
3341
|
+
configurable: !0,
|
|
3342
|
+
writable: !0,
|
|
3343
|
+
value: /intrinsic gas too low/
|
|
3344
|
+
});
|
|
3345
|
+
var TransactionTypeNotSupportedError = class extends BaseError {
|
|
3346
|
+
constructor({ cause: e }) {
|
|
3347
|
+
super("The transaction type is not supported for this chain.", {
|
|
3348
|
+
cause: e,
|
|
3349
|
+
name: "TransactionTypeNotSupportedError"
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
|
|
3354
|
+
enumerable: !0,
|
|
3355
|
+
configurable: !0,
|
|
3356
|
+
writable: !0,
|
|
3357
|
+
value: /transaction type not valid/
|
|
3358
|
+
});
|
|
3359
|
+
var TipAboveFeeCapError = class extends BaseError {
|
|
3360
|
+
constructor({ cause: e, maxPriorityFeePerGas: C, maxFeePerGas: w } = {}) {
|
|
3361
|
+
super([`The provided tip (\`maxPriorityFeePerGas\`${C ? ` = ${formatGwei(C)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${w ? ` = ${formatGwei(w)} gwei` : ""}).`].join("\n"), {
|
|
3362
|
+
cause: e,
|
|
3363
|
+
name: "TipAboveFeeCapError"
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
};
|
|
3367
|
+
Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
|
|
3368
|
+
enumerable: !0,
|
|
3369
|
+
configurable: !0,
|
|
3370
|
+
writable: !0,
|
|
3371
|
+
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
3372
|
+
});
|
|
3373
|
+
var LruMap = class extends Map {
|
|
3374
|
+
constructor(e) {
|
|
3375
|
+
super(), Object.defineProperty(this, "maxSize", {
|
|
3376
|
+
enumerable: !0,
|
|
3377
|
+
configurable: !0,
|
|
3378
|
+
writable: !0,
|
|
3379
|
+
value: void 0
|
|
3380
|
+
}), this.maxSize = e;
|
|
3381
|
+
}
|
|
3382
|
+
get(e) {
|
|
3383
|
+
let C = super.get(e);
|
|
3384
|
+
return super.has(e) && C !== void 0 && (this.delete(e), super.set(e, C)), C;
|
|
3385
|
+
}
|
|
3386
|
+
set(e, C) {
|
|
3387
|
+
if (super.set(e, C), this.maxSize && this.size > this.maxSize) {
|
|
3388
|
+
let e = this.keys().next().value;
|
|
3389
|
+
e && this.delete(e);
|
|
3390
|
+
}
|
|
3391
|
+
return this;
|
|
3392
|
+
}
|
|
3393
|
+
}, _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _7n = BigInt(7), _256n = BigInt(256), _0x71n = BigInt(113), SHA3_PI = [], SHA3_ROTL = [], _SHA3_IOTA = [];
|
|
3394
|
+
for (let e = 0, C = _1n, w = 1, T = 0; e < 24; e++) {
|
|
3395
|
+
[w, T] = [T, (2 * w + 3 * T) % 5], SHA3_PI.push(2 * (5 * T + w)), SHA3_ROTL.push((e + 1) * (e + 2) / 2 % 64);
|
|
3396
|
+
let E = _0n;
|
|
3397
|
+
for (let e = 0; e < 7; e++) C = (C << _1n ^ (C >> _7n) * _0x71n) % _256n, C & _2n && (E ^= _1n << (_1n << /* @__PURE__ */ BigInt(e)) - _1n);
|
|
3398
|
+
_SHA3_IOTA.push(E);
|
|
3399
|
+
}
|
|
3400
|
+
var IOTAS = split(_SHA3_IOTA, !0), SHA3_IOTA_H = IOTAS[0], SHA3_IOTA_L = IOTAS[1], rotlH = (e, C, w) => w > 32 ? rotlBH(e, C, w) : rotlSH(e, C, w), rotlL = (e, C, w) => w > 32 ? rotlBL(e, C, w) : rotlSL(e, C, w);
|
|
3401
|
+
function keccakP(e, C = 24) {
|
|
3402
|
+
let w = new Uint32Array(10);
|
|
3403
|
+
for (let T = 24 - C; T < 24; T++) {
|
|
3404
|
+
for (let C = 0; C < 10; C++) w[C] = e[C] ^ e[C + 10] ^ e[C + 20] ^ e[C + 30] ^ e[C + 40];
|
|
3405
|
+
for (let C = 0; C < 10; C += 2) {
|
|
3406
|
+
let T = (C + 8) % 10, E = (C + 2) % 10, D = w[E], O = w[E + 1], k = rotlH(D, O, 1) ^ w[T], A = rotlL(D, O, 1) ^ w[T + 1];
|
|
3407
|
+
for (let w = 0; w < 50; w += 10) e[C + w] ^= k, e[C + w + 1] ^= A;
|
|
3408
|
+
}
|
|
3409
|
+
let C = e[2], E = e[3];
|
|
3410
|
+
for (let w = 0; w < 24; w++) {
|
|
3411
|
+
let T = SHA3_ROTL[w], D = rotlH(C, E, T), O = rotlL(C, E, T), k = SHA3_PI[w];
|
|
3412
|
+
C = e[k], E = e[k + 1], e[k] = D, e[k + 1] = O;
|
|
3413
|
+
}
|
|
3414
|
+
for (let C = 0; C < 50; C += 10) {
|
|
3415
|
+
for (let T = 0; T < 10; T++) w[T] = e[C + T];
|
|
3416
|
+
for (let T = 0; T < 10; T++) e[C + T] ^= ~w[(T + 2) % 10] & w[(T + 4) % 10];
|
|
3417
|
+
}
|
|
3418
|
+
e[0] ^= SHA3_IOTA_H[T], e[1] ^= SHA3_IOTA_L[T];
|
|
3419
|
+
}
|
|
3420
|
+
clean(w);
|
|
3421
|
+
}
|
|
3422
|
+
var Keccak = class e extends Hash {
|
|
3423
|
+
constructor(e, C, w, T = !1, E = 24) {
|
|
3424
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = C, this.outputLen = w, this.enableXOF = T, this.rounds = E, anumber(w), !(0 < e && e < 200)) throw Error("only keccak-f1600 function is supported");
|
|
3425
|
+
this.state = new Uint8Array(200), this.state32 = u32(this.state);
|
|
3426
|
+
}
|
|
3427
|
+
clone() {
|
|
3428
|
+
return this._cloneInto();
|
|
3429
|
+
}
|
|
3430
|
+
keccak() {
|
|
3431
|
+
swap32IfBE(this.state32), keccakP(this.state32, this.rounds), swap32IfBE(this.state32), this.posOut = 0, this.pos = 0;
|
|
3432
|
+
}
|
|
3433
|
+
update(e) {
|
|
3434
|
+
aexists(this), e = toBytes$1(e), abytes(e);
|
|
3435
|
+
let { blockLen: C, state: w } = this, T = e.length;
|
|
3436
|
+
for (let E = 0; E < T;) {
|
|
3437
|
+
let D = Math.min(C - this.pos, T - E);
|
|
3438
|
+
for (let C = 0; C < D; C++) w[this.pos++] ^= e[E++];
|
|
3439
|
+
this.pos === C && this.keccak();
|
|
3440
|
+
}
|
|
3441
|
+
return this;
|
|
3442
|
+
}
|
|
3443
|
+
finish() {
|
|
3444
|
+
if (this.finished) return;
|
|
3445
|
+
this.finished = !0;
|
|
3446
|
+
let { state: e, suffix: C, pos: w, blockLen: T } = this;
|
|
3447
|
+
e[w] ^= C, C & 128 && w === T - 1 && this.keccak(), e[T - 1] ^= 128, this.keccak();
|
|
3448
|
+
}
|
|
3449
|
+
writeInto(e) {
|
|
3450
|
+
aexists(this, !1), abytes(e), this.finish();
|
|
3451
|
+
let C = this.state, { blockLen: w } = this;
|
|
3452
|
+
for (let T = 0, E = e.length; T < E;) {
|
|
3453
|
+
this.posOut >= w && this.keccak();
|
|
3454
|
+
let D = Math.min(w - this.posOut, E - T);
|
|
3455
|
+
e.set(C.subarray(this.posOut, this.posOut + D), T), this.posOut += D, T += D;
|
|
3456
|
+
}
|
|
3457
|
+
return e;
|
|
3458
|
+
}
|
|
3459
|
+
xofInto(e) {
|
|
3460
|
+
if (!this.enableXOF) throw Error("XOF is not possible for this instance");
|
|
3461
|
+
return this.writeInto(e);
|
|
3462
|
+
}
|
|
3463
|
+
xof(e) {
|
|
3464
|
+
return anumber(e), this.xofInto(new Uint8Array(e));
|
|
3465
|
+
}
|
|
3466
|
+
digestInto(e) {
|
|
3467
|
+
if (aoutput(e, this), this.finished) throw Error("digest() was already called");
|
|
3468
|
+
return this.writeInto(e), this.destroy(), e;
|
|
3469
|
+
}
|
|
3470
|
+
digest() {
|
|
3471
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
3472
|
+
}
|
|
3473
|
+
destroy() {
|
|
3474
|
+
this.destroyed = !0, clean(this.state);
|
|
3475
|
+
}
|
|
3476
|
+
_cloneInto(C) {
|
|
3477
|
+
let { blockLen: w, suffix: T, outputLen: E, rounds: D, enableXOF: O } = this;
|
|
3478
|
+
return C ||= new e(w, T, E, O, D), C.state32.set(this.state32), C.pos = this.pos, C.posOut = this.posOut, C.finished = this.finished, C.rounds = D, C.suffix = T, C.outputLen = E, C.enableXOF = O, C.destroyed = this.destroyed, C;
|
|
3479
|
+
}
|
|
3480
|
+
}, gen = (e, C, w) => createHasher(() => new Keccak(C, e, w));
|
|
3481
|
+
const keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
3482
|
+
function keccak256(e, C) {
|
|
3483
|
+
let w = C || "hex", T = keccak_256(isHex(e, { strict: !1 }) ? toBytes(e) : e);
|
|
3484
|
+
return w === "bytes" ? T : toHex(T);
|
|
3485
|
+
}
|
|
3486
|
+
var checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
3487
|
+
function checksumAddress(e, C) {
|
|
3488
|
+
if (checksumAddressCache.has(`${e}.${C}`)) return checksumAddressCache.get(`${e}.${C}`);
|
|
3489
|
+
let w = C ? `${C}${e.toLowerCase()}` : e.substring(2).toLowerCase(), T = keccak256(stringToBytes(w), "bytes"), E = (C ? w.substring(`${C}0x`.length) : w).split("");
|
|
3490
|
+
for (let e = 0; e < 40; e += 2) T[e >> 1] >> 4 >= 8 && E[e] && (E[e] = E[e].toUpperCase()), (T[e >> 1] & 15) >= 8 && E[e + 1] && (E[e + 1] = E[e + 1].toUpperCase());
|
|
3491
|
+
let D = `0x${E.join("")}`;
|
|
3492
|
+
return checksumAddressCache.set(`${e}.${C}`, D), D;
|
|
3493
|
+
}
|
|
3494
|
+
var addressRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
3495
|
+
const isAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
3496
|
+
function isAddress(e, C) {
|
|
3497
|
+
let { strict: w = !0 } = C ?? {}, T = `${e}.${w}`;
|
|
3498
|
+
if (isAddressCache.has(T)) return isAddressCache.get(T);
|
|
3499
|
+
let E = (() => addressRegex.test(e) ? e.toLowerCase() === e ? !0 : w ? checksumAddress(e) === e : !0 : !1)();
|
|
3500
|
+
return isAddressCache.set(T, E), E;
|
|
3501
|
+
}
|
|
3502
|
+
function slice(e, C, w, { strict: T } = {}) {
|
|
3503
|
+
return isHex(e, { strict: !1 }) ? sliceHex(e, C, w, { strict: T }) : sliceBytes(e, C, w, { strict: T });
|
|
3504
|
+
}
|
|
3505
|
+
function assertStartOffset(e, C) {
|
|
3506
|
+
if (typeof C == "number" && C > 0 && C > size(e) - 1) throw new SliceOffsetOutOfBoundsError({
|
|
3507
|
+
offset: C,
|
|
3508
|
+
position: "start",
|
|
3509
|
+
size: size(e)
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
function assertEndOffset(e, C, w) {
|
|
3513
|
+
if (typeof C == "number" && typeof w == "number" && size(e) !== w - C) throw new SliceOffsetOutOfBoundsError({
|
|
3514
|
+
offset: w,
|
|
3515
|
+
position: "end",
|
|
3516
|
+
size: size(e)
|
|
3517
|
+
});
|
|
3518
|
+
}
|
|
3519
|
+
function sliceBytes(e, C, w, { strict: T } = {}) {
|
|
3520
|
+
assertStartOffset(e, C);
|
|
3521
|
+
let E = e.slice(C, w);
|
|
3522
|
+
return T && assertEndOffset(E, C, w), E;
|
|
3523
|
+
}
|
|
3524
|
+
function sliceHex(e, C, w, { strict: T } = {}) {
|
|
3525
|
+
assertStartOffset(e, C);
|
|
3526
|
+
let E = `0x${e.replace("0x", "").slice((C ?? 0) * 2, (w ?? e.length) * 2)}`;
|
|
3527
|
+
return T && assertEndOffset(E, C, w), E;
|
|
3528
|
+
}
|
|
3529
|
+
function assertTransactionEIP7702(e) {
|
|
3530
|
+
let { authorizationList: C } = e;
|
|
3531
|
+
if (C) for (let e of C) {
|
|
3532
|
+
let { chainId: C } = e, w = e.address;
|
|
3533
|
+
if (!isAddress(w)) throw new InvalidAddressError({ address: w });
|
|
3534
|
+
if (C < 0) throw new InvalidChainIdError({ chainId: C });
|
|
3535
|
+
}
|
|
3536
|
+
assertTransactionEIP1559(e);
|
|
3537
|
+
}
|
|
3538
|
+
function assertTransactionEIP4844(e) {
|
|
3539
|
+
let { blobVersionedHashes: C } = e;
|
|
3540
|
+
if (C) {
|
|
3541
|
+
if (C.length === 0) throw new EmptyBlobError();
|
|
3542
|
+
for (let e of C) {
|
|
3543
|
+
let C = size(e), w = hexToNumber(slice(e, 0, 1));
|
|
3544
|
+
if (C !== 32) throw new InvalidVersionedHashSizeError({
|
|
3545
|
+
hash: e,
|
|
3546
|
+
size: C
|
|
3547
|
+
});
|
|
3548
|
+
if (w !== 1) throw new InvalidVersionedHashVersionError({
|
|
3549
|
+
hash: e,
|
|
3550
|
+
version: w
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
assertTransactionEIP1559(e);
|
|
3555
|
+
}
|
|
3556
|
+
function assertTransactionEIP1559(e) {
|
|
3557
|
+
let { chainId: C, maxPriorityFeePerGas: w, maxFeePerGas: T, to: E } = e;
|
|
3558
|
+
if (C <= 0) throw new InvalidChainIdError({ chainId: C });
|
|
3559
|
+
if (E && !isAddress(E)) throw new InvalidAddressError({ address: E });
|
|
3560
|
+
if (T && T > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: T });
|
|
3561
|
+
if (w && T && w > T) throw new TipAboveFeeCapError({
|
|
3562
|
+
maxFeePerGas: T,
|
|
3563
|
+
maxPriorityFeePerGas: w
|
|
3564
|
+
});
|
|
3565
|
+
}
|
|
3566
|
+
function assertTransactionEIP2930(e) {
|
|
3567
|
+
let { chainId: C, maxPriorityFeePerGas: w, gasPrice: T, maxFeePerGas: E, to: D } = e;
|
|
3568
|
+
if (C <= 0) throw new InvalidChainIdError({ chainId: C });
|
|
3569
|
+
if (D && !isAddress(D)) throw new InvalidAddressError({ address: D });
|
|
3570
|
+
if (w || E) throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
3571
|
+
if (T && T > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: T });
|
|
3572
|
+
}
|
|
3573
|
+
function assertTransactionLegacy(e) {
|
|
3574
|
+
let { chainId: C, maxPriorityFeePerGas: w, gasPrice: T, maxFeePerGas: E, to: D } = e;
|
|
3575
|
+
if (D && !isAddress(D)) throw new InvalidAddressError({ address: D });
|
|
3576
|
+
if (C !== void 0 && C <= 0) throw new InvalidChainIdError({ chainId: C });
|
|
3577
|
+
if (w || E) throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
3578
|
+
if (T && T > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas: T });
|
|
3579
|
+
}
|
|
3580
|
+
function getTransactionType(e) {
|
|
3581
|
+
if (e.type) return e.type;
|
|
3582
|
+
if (e.authorizationList !== void 0) return "eip7702";
|
|
3583
|
+
if (e.blobs !== void 0 || e.blobVersionedHashes !== void 0 || e.maxFeePerBlobGas !== void 0 || e.sidecars !== void 0) return "eip4844";
|
|
3584
|
+
if (e.maxFeePerGas !== void 0 || e.maxPriorityFeePerGas !== void 0) return "eip1559";
|
|
3585
|
+
if (e.gasPrice !== void 0) return e.accessList === void 0 ? "legacy" : "eip2930";
|
|
3586
|
+
throw new InvalidSerializableTransactionError({ transaction: e });
|
|
3587
|
+
}
|
|
3588
|
+
function serializeAccessList(e) {
|
|
3589
|
+
if (!e || e.length === 0) return [];
|
|
3590
|
+
let C = [];
|
|
3591
|
+
for (let w = 0; w < e.length; w++) {
|
|
3592
|
+
let { address: T, storageKeys: E } = e[w];
|
|
3593
|
+
for (let e = 0; e < E.length; e++) if (E[e].length - 2 != 64) throw new InvalidStorageKeySizeError({ storageKey: E[e] });
|
|
3594
|
+
if (!isAddress(T, { strict: !1 })) throw new InvalidAddressError({ address: T });
|
|
3595
|
+
C.push([T, E]);
|
|
3596
|
+
}
|
|
3597
|
+
return C;
|
|
3598
|
+
}
|
|
3599
|
+
function serializeTransaction(e, C) {
|
|
3600
|
+
let w = getTransactionType(e);
|
|
3601
|
+
return w === "eip1559" ? serializeTransactionEIP1559(e, C) : w === "eip2930" ? serializeTransactionEIP2930(e, C) : w === "eip4844" ? serializeTransactionEIP4844(e, C) : w === "eip7702" ? serializeTransactionEIP7702(e, C) : serializeTransactionLegacy(e, C);
|
|
3602
|
+
}
|
|
3603
|
+
function serializeTransactionEIP7702(e, C) {
|
|
3604
|
+
let { authorizationList: w, chainId: T, gas: E, nonce: D, to: O, value: k, maxFeePerGas: A, maxPriorityFeePerGas: j, accessList: M, data: N } = e;
|
|
3605
|
+
assertTransactionEIP7702(e);
|
|
3606
|
+
let P = serializeAccessList(M), F = serializeAuthorizationList(w);
|
|
3607
|
+
return concatHex(["0x04", toRlp([
|
|
3608
|
+
numberToHex(T),
|
|
3609
|
+
D ? numberToHex(D) : "0x",
|
|
3610
|
+
j ? numberToHex(j) : "0x",
|
|
3611
|
+
A ? numberToHex(A) : "0x",
|
|
3612
|
+
E ? numberToHex(E) : "0x",
|
|
3613
|
+
O ?? "0x",
|
|
3614
|
+
k ? numberToHex(k) : "0x",
|
|
3615
|
+
N ?? "0x",
|
|
3616
|
+
P,
|
|
3617
|
+
F,
|
|
3618
|
+
...toYParitySignatureArray(e, C)
|
|
3619
|
+
])]);
|
|
3620
|
+
}
|
|
3621
|
+
function serializeTransactionEIP4844(e, C) {
|
|
3622
|
+
let { chainId: w, gas: T, nonce: E, to: D, value: O, maxFeePerBlobGas: k, maxFeePerGas: A, maxPriorityFeePerGas: j, accessList: M, data: N } = e;
|
|
3623
|
+
assertTransactionEIP4844(e);
|
|
3624
|
+
let P = e.blobVersionedHashes, F = e.sidecars;
|
|
3625
|
+
if (e.blobs && (P === void 0 || F === void 0)) {
|
|
3626
|
+
let C = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((e) => bytesToHex(e)), w = e.kzg, T = blobsToCommitments({
|
|
3627
|
+
blobs: C,
|
|
3628
|
+
kzg: w
|
|
3629
|
+
});
|
|
3630
|
+
P === void 0 && (P = commitmentsToVersionedHashes({ commitments: T })), F === void 0 && (F = toBlobSidecars({
|
|
3631
|
+
blobs: C,
|
|
3632
|
+
commitments: T,
|
|
3633
|
+
proofs: blobsToProofs({
|
|
3634
|
+
blobs: C,
|
|
3635
|
+
commitments: T,
|
|
3636
|
+
kzg: w
|
|
3637
|
+
})
|
|
3638
|
+
}));
|
|
3639
|
+
}
|
|
3640
|
+
let I = serializeAccessList(M), L = [
|
|
3641
|
+
numberToHex(w),
|
|
3642
|
+
E ? numberToHex(E) : "0x",
|
|
3643
|
+
j ? numberToHex(j) : "0x",
|
|
3644
|
+
A ? numberToHex(A) : "0x",
|
|
3645
|
+
T ? numberToHex(T) : "0x",
|
|
3646
|
+
D ?? "0x",
|
|
3647
|
+
O ? numberToHex(O) : "0x",
|
|
3648
|
+
N ?? "0x",
|
|
3649
|
+
I,
|
|
3650
|
+
k ? numberToHex(k) : "0x",
|
|
3651
|
+
P ?? [],
|
|
3652
|
+
...toYParitySignatureArray(e, C)
|
|
3653
|
+
], R = [], z = [], B = [];
|
|
3654
|
+
if (F) for (let e = 0; e < F.length; e++) {
|
|
3655
|
+
let { blob: C, commitment: w, proof: T } = F[e];
|
|
3656
|
+
R.push(C), z.push(w), B.push(T);
|
|
3657
|
+
}
|
|
3658
|
+
return concatHex(["0x03", toRlp(F ? [
|
|
3659
|
+
L,
|
|
3660
|
+
R,
|
|
3661
|
+
z,
|
|
3662
|
+
B
|
|
3663
|
+
] : L)]);
|
|
3664
|
+
}
|
|
3665
|
+
function serializeTransactionEIP1559(e, C) {
|
|
3666
|
+
let { chainId: w, gas: T, nonce: E, to: D, value: O, maxFeePerGas: k, maxPriorityFeePerGas: A, accessList: j, data: M } = e;
|
|
3667
|
+
assertTransactionEIP1559(e);
|
|
3668
|
+
let N = serializeAccessList(j);
|
|
3669
|
+
return concatHex(["0x02", toRlp([
|
|
3670
|
+
numberToHex(w),
|
|
3671
|
+
E ? numberToHex(E) : "0x",
|
|
3672
|
+
A ? numberToHex(A) : "0x",
|
|
3673
|
+
k ? numberToHex(k) : "0x",
|
|
3674
|
+
T ? numberToHex(T) : "0x",
|
|
3675
|
+
D ?? "0x",
|
|
3676
|
+
O ? numberToHex(O) : "0x",
|
|
3677
|
+
M ?? "0x",
|
|
3678
|
+
N,
|
|
3679
|
+
...toYParitySignatureArray(e, C)
|
|
3680
|
+
])]);
|
|
3681
|
+
}
|
|
3682
|
+
function serializeTransactionEIP2930(e, C) {
|
|
3683
|
+
let { chainId: w, gas: T, data: E, nonce: D, to: O, value: k, accessList: A, gasPrice: j } = e;
|
|
3684
|
+
assertTransactionEIP2930(e);
|
|
3685
|
+
let M = serializeAccessList(A);
|
|
3686
|
+
return concatHex(["0x01", toRlp([
|
|
3687
|
+
numberToHex(w),
|
|
3688
|
+
D ? numberToHex(D) : "0x",
|
|
3689
|
+
j ? numberToHex(j) : "0x",
|
|
3690
|
+
T ? numberToHex(T) : "0x",
|
|
3691
|
+
O ?? "0x",
|
|
3692
|
+
k ? numberToHex(k) : "0x",
|
|
3693
|
+
E ?? "0x",
|
|
3694
|
+
M,
|
|
3695
|
+
...toYParitySignatureArray(e, C)
|
|
3696
|
+
])]);
|
|
3697
|
+
}
|
|
3698
|
+
function serializeTransactionLegacy(e, C) {
|
|
3699
|
+
let { chainId: w = 0, gas: T, data: E, nonce: D, to: O, value: k, gasPrice: A } = e;
|
|
3700
|
+
assertTransactionLegacy(e);
|
|
3701
|
+
let j = [
|
|
3702
|
+
D ? numberToHex(D) : "0x",
|
|
3703
|
+
A ? numberToHex(A) : "0x",
|
|
3704
|
+
T ? numberToHex(T) : "0x",
|
|
3705
|
+
O ?? "0x",
|
|
3706
|
+
k ? numberToHex(k) : "0x",
|
|
3707
|
+
E ?? "0x"
|
|
3708
|
+
];
|
|
3709
|
+
if (C) {
|
|
3710
|
+
let e = (() => {
|
|
3711
|
+
if (C.v >= 35n) return (C.v - 35n) / 2n > 0 ? C.v : 27n + (C.v === 35n ? 0n : 1n);
|
|
3712
|
+
if (w > 0) return BigInt(w * 2) + BigInt(35n + C.v - 27n);
|
|
3713
|
+
let e = 27n + (C.v === 27n ? 0n : 1n);
|
|
3714
|
+
if (C.v !== e) throw new InvalidLegacyVError({ v: C.v });
|
|
3715
|
+
return e;
|
|
3716
|
+
})(), T = trim(C.r), E = trim(C.s);
|
|
3717
|
+
j = [
|
|
3718
|
+
...j,
|
|
3719
|
+
numberToHex(e),
|
|
3720
|
+
T === "0x00" ? "0x" : T,
|
|
3721
|
+
E === "0x00" ? "0x" : E
|
|
3722
|
+
];
|
|
3723
|
+
} else w > 0 && (j = [
|
|
3724
|
+
...j,
|
|
3725
|
+
numberToHex(w),
|
|
3726
|
+
"0x",
|
|
3727
|
+
"0x"
|
|
3728
|
+
]);
|
|
3729
|
+
return toRlp(j);
|
|
3730
|
+
}
|
|
3731
|
+
function toYParitySignatureArray(e, C) {
|
|
3732
|
+
let w = C ?? e, { v: T, yParity: E } = w;
|
|
3733
|
+
if (w.r === void 0 || w.s === void 0 || T === void 0 && E === void 0) return [];
|
|
3734
|
+
let D = trim(w.r), O = trim(w.s);
|
|
3735
|
+
return [
|
|
3736
|
+
(() => typeof E == "number" ? E ? numberToHex(1) : "0x" : T === 0n ? "0x" : T === 1n ? numberToHex(1) : T === 27n ? "0x" : numberToHex(1))(),
|
|
3737
|
+
D === "0x00" ? "0x" : D,
|
|
3738
|
+
O === "0x00" ? "0x" : O
|
|
3739
|
+
];
|
|
3740
|
+
}
|
|
3741
|
+
const contracts = {
|
|
3742
|
+
gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
|
|
3743
|
+
l1Block: { address: "0x4200000000000000000000000000000000000015" },
|
|
3744
|
+
l2CrossDomainMessenger: { address: "0x4200000000000000000000000000000000000007" },
|
|
3745
|
+
l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
|
|
3746
|
+
l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
|
|
3747
|
+
l2ToL1MessagePasser: { address: "0x4200000000000000000000000000000000000016" }
|
|
3748
|
+
}, formatters = {
|
|
3749
|
+
block: /* @__PURE__ */ defineBlock({ format(e) {
|
|
3750
|
+
return {
|
|
3751
|
+
transactions: e.transactions?.map((e) => {
|
|
3752
|
+
if (typeof e == "string") return e;
|
|
3753
|
+
let C = formatTransaction(e);
|
|
3754
|
+
return C.typeHex === "0x7e" && (C.isSystemTx = e.isSystemTx, C.mint = e.mint ? hexToBigInt(e.mint) : void 0, C.sourceHash = e.sourceHash, C.type = "deposit"), C;
|
|
3755
|
+
}),
|
|
3756
|
+
stateRoot: e.stateRoot
|
|
3757
|
+
};
|
|
3758
|
+
} }),
|
|
3759
|
+
transaction: /* @__PURE__ */ defineTransaction({ format(e) {
|
|
3760
|
+
let C = {};
|
|
3761
|
+
return e.type === "0x7e" && (C.isSystemTx = e.isSystemTx, C.mint = e.mint ? hexToBigInt(e.mint) : void 0, C.sourceHash = e.sourceHash, C.type = "deposit"), C;
|
|
3762
|
+
} }),
|
|
3763
|
+
transactionReceipt: /* @__PURE__ */ defineTransactionReceipt({ format(e) {
|
|
3764
|
+
return {
|
|
3765
|
+
l1GasPrice: e.l1GasPrice ? hexToBigInt(e.l1GasPrice) : null,
|
|
3766
|
+
l1GasUsed: e.l1GasUsed ? hexToBigInt(e.l1GasUsed) : null,
|
|
3767
|
+
l1Fee: e.l1Fee ? hexToBigInt(e.l1Fee) : null,
|
|
3768
|
+
l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
|
|
3769
|
+
};
|
|
3770
|
+
} })
|
|
3771
|
+
};
|
|
3772
|
+
function serializeTransaction$1(e, C) {
|
|
3773
|
+
return isDeposit(e) ? serializeTransactionDeposit(e) : serializeTransaction(e, C);
|
|
3774
|
+
}
|
|
3775
|
+
const serializers = { transaction: serializeTransaction$1 };
|
|
3776
|
+
function serializeTransactionDeposit(e) {
|
|
3777
|
+
assertTransactionDeposit(e);
|
|
3778
|
+
let { sourceHash: C, data: w, from: T, gas: E, isSystemTx: D, mint: O, to: k, value: A } = e;
|
|
3779
|
+
return concatHex(["0x7e", toRlp([
|
|
3780
|
+
C,
|
|
3781
|
+
T,
|
|
3782
|
+
k ?? "0x",
|
|
3783
|
+
O ? toHex(O) : "0x",
|
|
3784
|
+
A ? toHex(A) : "0x",
|
|
3785
|
+
E ? toHex(E) : "0x",
|
|
3786
|
+
D ? "0x1" : "0x",
|
|
3787
|
+
w ?? "0x"
|
|
3788
|
+
])]);
|
|
3789
|
+
}
|
|
3790
|
+
function isDeposit(e) {
|
|
3791
|
+
return e.type === "deposit" || e.sourceHash !== void 0;
|
|
3792
|
+
}
|
|
3793
|
+
function assertTransactionDeposit(e) {
|
|
3794
|
+
let { from: C, to: w } = e;
|
|
3795
|
+
if (C && !isAddress(C)) throw new InvalidAddressError({ address: C });
|
|
3796
|
+
if (w && !isAddress(w)) throw new InvalidAddressError({ address: w });
|
|
3797
|
+
}
|
|
3798
|
+
const chainConfig = {
|
|
3799
|
+
blockTime: 2e3,
|
|
3800
|
+
contracts,
|
|
3801
|
+
formatters,
|
|
3802
|
+
serializers
|
|
3803
|
+
}, arbitrum = /* @__PURE__ */ defineChain({
|
|
3804
|
+
id: 42161,
|
|
3805
|
+
name: "Arbitrum One",
|
|
3806
|
+
nativeCurrency: {
|
|
3807
|
+
name: "Ether",
|
|
3808
|
+
symbol: "ETH",
|
|
3809
|
+
decimals: 18
|
|
3810
|
+
},
|
|
3811
|
+
blockTime: 250,
|
|
3812
|
+
rpcUrls: { default: { http: ["https://arb1.arbitrum.io/rpc"] } },
|
|
3813
|
+
blockExplorers: { default: {
|
|
3814
|
+
name: "Arbiscan",
|
|
3815
|
+
url: "https://arbiscan.io",
|
|
3816
|
+
apiUrl: "https://api.arbiscan.io/api"
|
|
3817
|
+
} },
|
|
3818
|
+
contracts: { multicall3: {
|
|
3819
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
3820
|
+
blockCreated: 7654707
|
|
3821
|
+
} }
|
|
3822
|
+
});
|
|
3823
|
+
var sourceId$1 = 1;
|
|
3824
|
+
const base = /* @__PURE__ */ defineChain({
|
|
3825
|
+
...chainConfig,
|
|
3826
|
+
id: 8453,
|
|
3827
|
+
name: "Base",
|
|
3828
|
+
nativeCurrency: {
|
|
3829
|
+
name: "Ether",
|
|
3830
|
+
symbol: "ETH",
|
|
3831
|
+
decimals: 18
|
|
3832
|
+
},
|
|
3833
|
+
rpcUrls: { default: { http: ["https://mainnet.base.org"] } },
|
|
3834
|
+
blockExplorers: { default: {
|
|
3835
|
+
name: "Basescan",
|
|
3836
|
+
url: "https://basescan.org",
|
|
3837
|
+
apiUrl: "https://api.basescan.org/api"
|
|
3838
|
+
} },
|
|
3839
|
+
contracts: {
|
|
3840
|
+
...chainConfig.contracts,
|
|
3841
|
+
disputeGameFactory: { [sourceId$1]: { address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e" } },
|
|
3842
|
+
l2OutputOracle: { [sourceId$1]: { address: "0x56315b90c40730925ec5485cf004d835058518A0" } },
|
|
3843
|
+
multicall3: {
|
|
3844
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
3845
|
+
blockCreated: 5022
|
|
3846
|
+
},
|
|
3847
|
+
portal: { [sourceId$1]: {
|
|
3848
|
+
address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
|
|
3849
|
+
blockCreated: 17482143
|
|
3850
|
+
} },
|
|
3851
|
+
l1StandardBridge: { [sourceId$1]: {
|
|
3852
|
+
address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
|
|
3853
|
+
blockCreated: 17482143
|
|
3854
|
+
} }
|
|
3855
|
+
},
|
|
3856
|
+
sourceId: sourceId$1
|
|
3857
|
+
});
|
|
3858
|
+
({ ...base });
|
|
3859
|
+
const bsc = /* @__PURE__ */ defineChain({
|
|
3860
|
+
id: 56,
|
|
3861
|
+
name: "BNB Smart Chain",
|
|
3862
|
+
blockTime: 750,
|
|
3863
|
+
nativeCurrency: {
|
|
3864
|
+
decimals: 18,
|
|
3865
|
+
name: "BNB",
|
|
3866
|
+
symbol: "BNB"
|
|
3867
|
+
},
|
|
3868
|
+
rpcUrls: { default: { http: ["https://56.rpc.thirdweb.com"] } },
|
|
3869
|
+
blockExplorers: { default: {
|
|
3870
|
+
name: "BscScan",
|
|
3871
|
+
url: "https://bscscan.com",
|
|
3872
|
+
apiUrl: "https://api.bscscan.com/api"
|
|
3873
|
+
} },
|
|
3874
|
+
contracts: { multicall3: {
|
|
3875
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
3876
|
+
blockCreated: 15921452
|
|
3877
|
+
} }
|
|
3878
|
+
}), mainnet = /* @__PURE__ */ defineChain({
|
|
3879
|
+
id: 1,
|
|
3880
|
+
name: "Ethereum",
|
|
3881
|
+
nativeCurrency: {
|
|
3882
|
+
name: "Ether",
|
|
3883
|
+
symbol: "ETH",
|
|
3884
|
+
decimals: 18
|
|
3885
|
+
},
|
|
3886
|
+
blockTime: 12e3,
|
|
3887
|
+
rpcUrls: { default: { http: ["https://eth.merkle.io"] } },
|
|
3888
|
+
blockExplorers: { default: {
|
|
3889
|
+
name: "Etherscan",
|
|
3890
|
+
url: "https://etherscan.io",
|
|
3891
|
+
apiUrl: "https://api.etherscan.io/api"
|
|
3892
|
+
} },
|
|
3893
|
+
contracts: {
|
|
3894
|
+
ensUniversalResolver: {
|
|
3895
|
+
address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee",
|
|
3896
|
+
blockCreated: 23085558
|
|
3897
|
+
},
|
|
3898
|
+
multicall3: {
|
|
3899
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
3900
|
+
blockCreated: 14353601
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
});
|
|
3904
|
+
var sourceId = 1;
|
|
3905
|
+
const optimism = /* @__PURE__ */ defineChain({
|
|
3906
|
+
...chainConfig,
|
|
3907
|
+
id: 10,
|
|
3908
|
+
name: "OP Mainnet",
|
|
3909
|
+
nativeCurrency: {
|
|
3910
|
+
name: "Ether",
|
|
3911
|
+
symbol: "ETH",
|
|
3912
|
+
decimals: 18
|
|
3913
|
+
},
|
|
3914
|
+
rpcUrls: { default: { http: ["https://mainnet.optimism.io"] } },
|
|
3915
|
+
blockExplorers: { default: {
|
|
3916
|
+
name: "Optimism Explorer",
|
|
3917
|
+
url: "https://optimistic.etherscan.io",
|
|
3918
|
+
apiUrl: "https://api-optimistic.etherscan.io/api"
|
|
3919
|
+
} },
|
|
3920
|
+
contracts: {
|
|
3921
|
+
...chainConfig.contracts,
|
|
3922
|
+
disputeGameFactory: { [sourceId]: { address: "0xe5965Ab5962eDc7477C8520243A95517CD252fA9" } },
|
|
3923
|
+
l2OutputOracle: { [sourceId]: { address: "0xdfe97868233d1aa22e815a266982f2cf17685a27" } },
|
|
3924
|
+
multicall3: {
|
|
3925
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
3926
|
+
blockCreated: 4286263
|
|
3927
|
+
},
|
|
3928
|
+
portal: { [sourceId]: { address: "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed" } },
|
|
3929
|
+
l1StandardBridge: { [sourceId]: { address: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1" } }
|
|
3930
|
+
},
|
|
3931
|
+
sourceId
|
|
3932
|
+
}), polygon = /* @__PURE__ */ defineChain({
|
|
3933
|
+
id: 137,
|
|
3934
|
+
name: "Polygon",
|
|
3935
|
+
blockTime: 2e3,
|
|
3936
|
+
nativeCurrency: {
|
|
3937
|
+
name: "POL",
|
|
3938
|
+
symbol: "POL",
|
|
3939
|
+
decimals: 18
|
|
3940
|
+
},
|
|
3941
|
+
rpcUrls: { default: { http: ["https://polygon-rpc.com"] } },
|
|
3942
|
+
blockExplorers: { default: {
|
|
3943
|
+
name: "PolygonScan",
|
|
3944
|
+
url: "https://polygonscan.com",
|
|
3945
|
+
apiUrl: "https://api.etherscan.io/v2/api"
|
|
3946
|
+
} },
|
|
3947
|
+
contracts: { multicall3: {
|
|
3948
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
3949
|
+
blockCreated: 25770160
|
|
3950
|
+
} }
|
|
3951
|
+
});
|
|
3952
|
+
export { __toESM as _, base as a, tap as c, expand as d, require_browser as f, __require as g, __commonJSMin as h, bsc as i, switchMap as l, payment_dialog_default as m, optimism as n, arbitrum as o, injectStyle as p, mainnet as r, timeout as s, polygon as t, retry as u };
|