this.me 3.0.31 → 3.0.34
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/README.md +44 -3
- package/dist/index.d.ts +1 -2
- package/dist/me.cjs +2 -2
- package/dist/me.es.js +636 -417
- package/dist/me.umd.js +2 -2
- package/dist/src/crypto.d.ts +6 -0
- package/dist/src/handleCall.d.ts +29 -0
- package/dist/src/me.d.ts +36 -96
- package/dist/src/operators.d.ts +77 -0
- package/dist/src/postulate.d.ts +46 -0
- package/dist/src/types.d.ts +245 -0
- package/package.json +28 -27
- package/dist/me.es.d.ts +0 -2
package/dist/me.es.js
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return E && E.__esModule && Object.prototype.hasOwnProperty.call(E, "default") ? E.default : E;
|
|
1
|
+
function ve(c) {
|
|
2
|
+
return { __ptr: c };
|
|
4
3
|
}
|
|
5
|
-
|
|
4
|
+
function Yt(c) {
|
|
5
|
+
return !!c && typeof c == "object" && typeof c.__ptr == "string" && c.__ptr.length > 0;
|
|
6
|
+
}
|
|
7
|
+
function ge(c) {
|
|
8
|
+
return { __id: c };
|
|
9
|
+
}
|
|
10
|
+
function te(c) {
|
|
11
|
+
return !!c && typeof c == "object" && typeof c.__id == "string" && c.__id.length > 0;
|
|
12
|
+
}
|
|
13
|
+
function be(c) {
|
|
14
|
+
return !!c && typeof c == "object" && typeof c.path == "string" && typeof c.hash == "string" && typeof c.timestamp == "number";
|
|
15
|
+
}
|
|
16
|
+
function N(c) {
|
|
17
|
+
return c.length === 0 ? { scope: [], leaf: null } : { scope: c.slice(0, -1), leaf: c[c.length - 1] };
|
|
18
|
+
}
|
|
19
|
+
function le(c, r) {
|
|
20
|
+
if (r.length > c.length) return !1;
|
|
21
|
+
for (let e = 0; e < r.length; e++)
|
|
22
|
+
if (c[e] !== r[e]) return !1;
|
|
23
|
+
return !0;
|
|
24
|
+
}
|
|
25
|
+
function ce(c) {
|
|
26
|
+
const r = c.trim().toLowerCase();
|
|
27
|
+
if (r.length < 3 || r.length > 63)
|
|
28
|
+
throw new Error(`Invalid username length: ${r.length}. Expected 3..63 characters.`);
|
|
29
|
+
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(r))
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Invalid username. Use only [a-z0-9-], and start/end with [a-z0-9]. Got: ${c}`
|
|
32
|
+
);
|
|
33
|
+
if (r.includes("--"))
|
|
34
|
+
throw new Error(`Invalid username. "--" is not allowed. Got: ${c}`);
|
|
35
|
+
return r;
|
|
36
|
+
}
|
|
37
|
+
var Se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
38
|
+
function ke(c) {
|
|
39
|
+
return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
|
|
40
|
+
}
|
|
41
|
+
var ee = { exports: {} };
|
|
6
42
|
/**
|
|
7
43
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
8
44
|
*
|
|
@@ -11,15 +47,15 @@ var Ut = { exports: {} };
|
|
|
11
47
|
* @copyright Chen, Yi-Cyuan 2015-2023
|
|
12
48
|
* @license MIT
|
|
13
49
|
*/
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
return
|
|
50
|
+
var ae;
|
|
51
|
+
function me() {
|
|
52
|
+
return ae || (ae = 1, (function(c) {
|
|
17
53
|
(function() {
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
for (var
|
|
54
|
+
var r = "input is invalid type", e = "finalize already called", a = typeof window == "object", i = a ? window : {};
|
|
55
|
+
i.JS_SHA3_NO_WINDOW && (a = !1);
|
|
56
|
+
var f = !a && typeof self == "object", p = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node;
|
|
57
|
+
p ? i = Se : f && (i = self);
|
|
58
|
+
for (var b = !i.JS_SHA3_NO_COMMON_JS && !0 && c.exports, y = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", g = "0123456789abcdef".split(""), S = [31, 7936, 2031616, 520093696], O = [4, 1024, 262144, 67108864], W = [1, 256, 65536, 16777216], z = [6, 1536, 393216, 100663296], P = [0, 8, 16, 24], D = [
|
|
23
59
|
1,
|
|
24
60
|
0,
|
|
25
61
|
32898,
|
|
@@ -68,490 +104,673 @@ function he() {
|
|
|
68
104
|
0,
|
|
69
105
|
2147516424,
|
|
70
106
|
2147483648
|
|
71
|
-
],
|
|
107
|
+
], E = [224, 256, 384, 512], J = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], q = {
|
|
72
108
|
128: 168,
|
|
73
109
|
256: 136
|
|
74
|
-
},
|
|
110
|
+
}, Zt = i.JS_SHA3_NO_NODE_JS || !Array.isArray ? function(t) {
|
|
75
111
|
return Object.prototype.toString.call(t) === "[object Array]";
|
|
76
|
-
} : Array.isArray,
|
|
112
|
+
} : Array.isArray, L = y && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) ? function(t) {
|
|
77
113
|
return typeof t == "object" && t.buffer && t.buffer.constructor === ArrayBuffer;
|
|
78
|
-
} : ArrayBuffer.isView,
|
|
79
|
-
var
|
|
80
|
-
if (
|
|
114
|
+
} : ArrayBuffer.isView, k = function(t) {
|
|
115
|
+
var n = typeof t;
|
|
116
|
+
if (n === "string")
|
|
81
117
|
return [t, !0];
|
|
82
|
-
if (
|
|
83
|
-
throw new Error(
|
|
84
|
-
if (
|
|
118
|
+
if (n !== "object" || t === null)
|
|
119
|
+
throw new Error(r);
|
|
120
|
+
if (y && t.constructor === ArrayBuffer)
|
|
85
121
|
return [new Uint8Array(t), !1];
|
|
86
|
-
if (!
|
|
87
|
-
throw new Error(
|
|
122
|
+
if (!Zt(t) && !L(t))
|
|
123
|
+
throw new Error(r);
|
|
88
124
|
return [t, !1];
|
|
89
|
-
},
|
|
90
|
-
return
|
|
91
|
-
},
|
|
92
|
-
for (var
|
|
93
|
-
|
|
94
|
-
return
|
|
95
|
-
},
|
|
96
|
-
return function(
|
|
97
|
-
return new
|
|
125
|
+
}, x = function(t) {
|
|
126
|
+
return k(t)[0].length === 0;
|
|
127
|
+
}, C = function(t) {
|
|
128
|
+
for (var n = [], o = 0; o < t.length; ++o)
|
|
129
|
+
n[o] = t[o];
|
|
130
|
+
return n;
|
|
131
|
+
}, w = function(t, n, o) {
|
|
132
|
+
return function(l) {
|
|
133
|
+
return new B(t, n, t).update(l)[o]();
|
|
98
134
|
};
|
|
99
|
-
},
|
|
100
|
-
return function(
|
|
101
|
-
return new
|
|
135
|
+
}, _ = function(t, n, o) {
|
|
136
|
+
return function(l, u) {
|
|
137
|
+
return new B(t, n, u).update(l)[o]();
|
|
102
138
|
};
|
|
103
|
-
},
|
|
104
|
-
return function(
|
|
105
|
-
return
|
|
139
|
+
}, F = function(t, n, o) {
|
|
140
|
+
return function(l, u, h, d) {
|
|
141
|
+
return M["cshake" + t].update(l, u, h, d)[o]();
|
|
106
142
|
};
|
|
107
|
-
},
|
|
108
|
-
return function(
|
|
109
|
-
return
|
|
143
|
+
}, I = function(t, n, o) {
|
|
144
|
+
return function(l, u, h, d) {
|
|
145
|
+
return M["kmac" + t].update(l, u, h, d)[o]();
|
|
110
146
|
};
|
|
111
|
-
},
|
|
112
|
-
for (var
|
|
113
|
-
var h =
|
|
114
|
-
t[h] =
|
|
147
|
+
}, j = function(t, n, o, l) {
|
|
148
|
+
for (var u = 0; u < $.length; ++u) {
|
|
149
|
+
var h = $[u];
|
|
150
|
+
t[h] = n(o, l, h);
|
|
115
151
|
}
|
|
116
152
|
return t;
|
|
117
|
-
},
|
|
118
|
-
var
|
|
119
|
-
return
|
|
120
|
-
return new
|
|
121
|
-
},
|
|
122
|
-
return
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
var
|
|
126
|
-
return
|
|
127
|
-
return new
|
|
128
|
-
},
|
|
129
|
-
return
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
var
|
|
133
|
-
return
|
|
134
|
-
return
|
|
135
|
-
},
|
|
136
|
-
return
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
var
|
|
140
|
-
return
|
|
141
|
-
return new
|
|
142
|
-
},
|
|
143
|
-
return
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
{ name: "keccak", padding:
|
|
147
|
-
{ name: "sha3", padding:
|
|
148
|
-
{ name: "shake", padding:
|
|
149
|
-
{ name: "cshake", padding:
|
|
150
|
-
{ name: "kmac", padding:
|
|
151
|
-
],
|
|
152
|
-
for (var
|
|
153
|
-
var
|
|
154
|
-
if (
|
|
155
|
-
var
|
|
156
|
-
|
|
153
|
+
}, K = function(t, n) {
|
|
154
|
+
var o = w(t, n, "hex");
|
|
155
|
+
return o.create = function() {
|
|
156
|
+
return new B(t, n, t);
|
|
157
|
+
}, o.update = function(l) {
|
|
158
|
+
return o.create().update(l);
|
|
159
|
+
}, j(o, w, t, n);
|
|
160
|
+
}, de = function(t, n) {
|
|
161
|
+
var o = _(t, n, "hex");
|
|
162
|
+
return o.create = function(l) {
|
|
163
|
+
return new B(t, n, l);
|
|
164
|
+
}, o.update = function(l, u) {
|
|
165
|
+
return o.create(u).update(l);
|
|
166
|
+
}, j(o, _, t, n);
|
|
167
|
+
}, pe = function(t, n) {
|
|
168
|
+
var o = q[t], l = F(t, n, "hex");
|
|
169
|
+
return l.create = function(u, h, d) {
|
|
170
|
+
return x(h) && x(d) ? M["shake" + t].create(u) : new B(t, n, u).bytepad([h, d], o);
|
|
171
|
+
}, l.update = function(u, h, d, s) {
|
|
172
|
+
return l.create(h, d, s).update(u);
|
|
173
|
+
}, j(l, F, t, n);
|
|
174
|
+
}, ye = function(t, n) {
|
|
175
|
+
var o = q[t], l = I(t, n, "hex");
|
|
176
|
+
return l.create = function(u, h, d) {
|
|
177
|
+
return new Xt(t, n, h).bytepad(["KMAC", d], o).bytepad([u], o);
|
|
178
|
+
}, l.update = function(u, h, d, s) {
|
|
179
|
+
return l.create(u, d, s).update(h);
|
|
180
|
+
}, j(l, I, t, n);
|
|
181
|
+
}, ie = [
|
|
182
|
+
{ name: "keccak", padding: W, bits: E, createMethod: K },
|
|
183
|
+
{ name: "sha3", padding: z, bits: E, createMethod: K },
|
|
184
|
+
{ name: "shake", padding: S, bits: J, createMethod: de },
|
|
185
|
+
{ name: "cshake", padding: O, bits: J, createMethod: pe },
|
|
186
|
+
{ name: "kmac", padding: O, bits: J, createMethod: ye }
|
|
187
|
+
], M = {}, U = [], T = 0; T < ie.length; ++T)
|
|
188
|
+
for (var H = ie[T], Y = H.bits, V = 0; V < Y.length; ++V) {
|
|
189
|
+
var Qt = H.name + "_" + Y[V];
|
|
190
|
+
if (U.push(Qt), M[Qt] = H.createMethod(Y[V], H.padding), H.name !== "sha3") {
|
|
191
|
+
var oe = H.name + Y[V];
|
|
192
|
+
U.push(oe), M[oe] = M[Qt];
|
|
157
193
|
}
|
|
158
194
|
}
|
|
159
|
-
function
|
|
160
|
-
this.blocks = [], this.s = [], this.padding =
|
|
161
|
-
for (var
|
|
162
|
-
this.s[
|
|
195
|
+
function B(t, n, o) {
|
|
196
|
+
this.blocks = [], this.s = [], this.padding = n, this.outputBits = o, this.reset = !0, this.finalized = !1, this.block = 0, this.start = 0, this.blockCount = 1600 - (t << 1) >> 5, this.byteCount = this.blockCount << 2, this.outputBlocks = o >> 5, this.extraBytes = (o & 31) >> 3;
|
|
197
|
+
for (var l = 0; l < 50; ++l)
|
|
198
|
+
this.s[l] = 0;
|
|
163
199
|
}
|
|
164
|
-
|
|
200
|
+
B.prototype.update = function(t) {
|
|
165
201
|
if (this.finalized)
|
|
166
|
-
throw new Error(
|
|
167
|
-
var
|
|
168
|
-
t =
|
|
169
|
-
for (var
|
|
202
|
+
throw new Error(e);
|
|
203
|
+
var n = k(t);
|
|
204
|
+
t = n[0];
|
|
205
|
+
for (var o = n[1], l = this.blocks, u = this.byteCount, h = t.length, d = this.blockCount, s = 0, A = this.s, v, m; s < h; ) {
|
|
170
206
|
if (this.reset)
|
|
171
|
-
for (this.reset = !1,
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
for (
|
|
175
|
-
|
|
207
|
+
for (this.reset = !1, l[0] = this.block, v = 1; v < d + 1; ++v)
|
|
208
|
+
l[v] = 0;
|
|
209
|
+
if (o)
|
|
210
|
+
for (v = this.start; s < h && v < u; ++s)
|
|
211
|
+
m = t.charCodeAt(s), m < 128 ? l[v >> 2] |= m << P[v++ & 3] : m < 2048 ? (l[v >> 2] |= (192 | m >> 6) << P[v++ & 3], l[v >> 2] |= (128 | m & 63) << P[v++ & 3]) : m < 55296 || m >= 57344 ? (l[v >> 2] |= (224 | m >> 12) << P[v++ & 3], l[v >> 2] |= (128 | m >> 6 & 63) << P[v++ & 3], l[v >> 2] |= (128 | m & 63) << P[v++ & 3]) : (m = 65536 + ((m & 1023) << 10 | t.charCodeAt(++s) & 1023), l[v >> 2] |= (240 | m >> 18) << P[v++ & 3], l[v >> 2] |= (128 | m >> 12 & 63) << P[v++ & 3], l[v >> 2] |= (128 | m >> 6 & 63) << P[v++ & 3], l[v >> 2] |= (128 | m & 63) << P[v++ & 3]);
|
|
176
212
|
else
|
|
177
|
-
for (
|
|
178
|
-
|
|
179
|
-
if (this.lastByteIndex =
|
|
180
|
-
for (this.start =
|
|
181
|
-
|
|
182
|
-
|
|
213
|
+
for (v = this.start; s < h && v < u; ++s)
|
|
214
|
+
l[v >> 2] |= t[s] << P[v++ & 3];
|
|
215
|
+
if (this.lastByteIndex = v, v >= u) {
|
|
216
|
+
for (this.start = v - u, this.block = l[d], v = 0; v < d; ++v)
|
|
217
|
+
A[v] ^= l[v];
|
|
218
|
+
G(A), this.reset = !0;
|
|
183
219
|
} else
|
|
184
|
-
this.start =
|
|
220
|
+
this.start = v;
|
|
185
221
|
}
|
|
186
222
|
return this;
|
|
187
|
-
},
|
|
188
|
-
var
|
|
189
|
-
for (t = t >> 8,
|
|
190
|
-
|
|
191
|
-
return
|
|
192
|
-
},
|
|
193
|
-
var
|
|
194
|
-
t =
|
|
195
|
-
var
|
|
196
|
-
if (
|
|
223
|
+
}, B.prototype.encode = function(t, n) {
|
|
224
|
+
var o = t & 255, l = 1, u = [o];
|
|
225
|
+
for (t = t >> 8, o = t & 255; o > 0; )
|
|
226
|
+
u.unshift(o), t = t >> 8, o = t & 255, ++l;
|
|
227
|
+
return n ? u.push(l) : u.unshift(l), this.update(u), u.length;
|
|
228
|
+
}, B.prototype.encodeString = function(t) {
|
|
229
|
+
var n = k(t);
|
|
230
|
+
t = n[0];
|
|
231
|
+
var o = n[1], l = 0, u = t.length;
|
|
232
|
+
if (o)
|
|
197
233
|
for (var h = 0; h < t.length; ++h) {
|
|
198
|
-
var
|
|
199
|
-
|
|
234
|
+
var d = t.charCodeAt(h);
|
|
235
|
+
d < 128 ? l += 1 : d < 2048 ? l += 2 : d < 55296 || d >= 57344 ? l += 3 : (d = 65536 + ((d & 1023) << 10 | t.charCodeAt(++h) & 1023), l += 4);
|
|
200
236
|
}
|
|
201
237
|
else
|
|
202
|
-
|
|
203
|
-
return
|
|
204
|
-
},
|
|
205
|
-
for (var
|
|
206
|
-
|
|
207
|
-
var
|
|
208
|
-
return h.length =
|
|
209
|
-
},
|
|
238
|
+
l = u;
|
|
239
|
+
return l += this.encode(l * 8), this.update(t), l;
|
|
240
|
+
}, B.prototype.bytepad = function(t, n) {
|
|
241
|
+
for (var o = this.encode(n), l = 0; l < t.length; ++l)
|
|
242
|
+
o += this.encodeString(t[l]);
|
|
243
|
+
var u = (n - o % n) % n, h = [];
|
|
244
|
+
return h.length = u, this.update(h), this;
|
|
245
|
+
}, B.prototype.finalize = function() {
|
|
210
246
|
if (!this.finalized) {
|
|
211
247
|
this.finalized = !0;
|
|
212
|
-
var t = this.blocks,
|
|
213
|
-
if (t[
|
|
214
|
-
for (t[0] = t[
|
|
215
|
-
t[
|
|
216
|
-
for (t[
|
|
217
|
-
n
|
|
218
|
-
|
|
248
|
+
var t = this.blocks, n = this.lastByteIndex, o = this.blockCount, l = this.s;
|
|
249
|
+
if (t[n >> 2] |= this.padding[n & 3], this.lastByteIndex === this.byteCount)
|
|
250
|
+
for (t[0] = t[o], n = 1; n < o + 1; ++n)
|
|
251
|
+
t[n] = 0;
|
|
252
|
+
for (t[o - 1] |= 2147483648, n = 0; n < o; ++n)
|
|
253
|
+
l[n] ^= t[n];
|
|
254
|
+
G(l);
|
|
219
255
|
}
|
|
220
|
-
},
|
|
256
|
+
}, B.prototype.toString = B.prototype.hex = function() {
|
|
221
257
|
this.finalize();
|
|
222
|
-
for (var t = this.blockCount,
|
|
223
|
-
for (
|
|
224
|
-
|
|
225
|
-
h % t === 0 && (
|
|
258
|
+
for (var t = this.blockCount, n = this.s, o = this.outputBlocks, l = this.extraBytes, u = 0, h = 0, d = "", s; h < o; ) {
|
|
259
|
+
for (u = 0; u < t && h < o; ++u, ++h)
|
|
260
|
+
s = n[u], d += g[s >> 4 & 15] + g[s & 15] + g[s >> 12 & 15] + g[s >> 8 & 15] + g[s >> 20 & 15] + g[s >> 16 & 15] + g[s >> 28 & 15] + g[s >> 24 & 15];
|
|
261
|
+
h % t === 0 && (n = C(n), G(n), u = 0);
|
|
226
262
|
}
|
|
227
|
-
return
|
|
228
|
-
},
|
|
263
|
+
return l && (s = n[u], d += g[s >> 4 & 15] + g[s & 15], l > 1 && (d += g[s >> 12 & 15] + g[s >> 8 & 15]), l > 2 && (d += g[s >> 20 & 15] + g[s >> 16 & 15])), d;
|
|
264
|
+
}, B.prototype.arrayBuffer = function() {
|
|
229
265
|
this.finalize();
|
|
230
|
-
var t = this.blockCount,
|
|
231
|
-
|
|
232
|
-
for (var
|
|
233
|
-
for (
|
|
234
|
-
|
|
235
|
-
h % t === 0 && (
|
|
266
|
+
var t = this.blockCount, n = this.s, o = this.outputBlocks, l = this.extraBytes, u = 0, h = 0, d = this.outputBits >> 3, s;
|
|
267
|
+
l ? s = new ArrayBuffer(o + 1 << 2) : s = new ArrayBuffer(d);
|
|
268
|
+
for (var A = new Uint32Array(s); h < o; ) {
|
|
269
|
+
for (u = 0; u < t && h < o; ++u, ++h)
|
|
270
|
+
A[h] = n[u];
|
|
271
|
+
h % t === 0 && (n = C(n), G(n));
|
|
236
272
|
}
|
|
237
|
-
return
|
|
238
|
-
},
|
|
273
|
+
return l && (A[h] = n[u], s = s.slice(0, d)), s;
|
|
274
|
+
}, B.prototype.buffer = B.prototype.arrayBuffer, B.prototype.digest = B.prototype.array = function() {
|
|
239
275
|
this.finalize();
|
|
240
|
-
for (var t = this.blockCount,
|
|
241
|
-
for (
|
|
242
|
-
|
|
243
|
-
h % t === 0 && (
|
|
276
|
+
for (var t = this.blockCount, n = this.s, o = this.outputBlocks, l = this.extraBytes, u = 0, h = 0, d = [], s, A; h < o; ) {
|
|
277
|
+
for (u = 0; u < t && h < o; ++u, ++h)
|
|
278
|
+
s = h << 2, A = n[u], d[s] = A & 255, d[s + 1] = A >> 8 & 255, d[s + 2] = A >> 16 & 255, d[s + 3] = A >> 24 & 255;
|
|
279
|
+
h % t === 0 && (n = C(n), G(n));
|
|
244
280
|
}
|
|
245
|
-
return
|
|
281
|
+
return l && (s = h << 2, A = n[u], d[s] = A & 255, l > 1 && (d[s + 1] = A >> 8 & 255), l > 2 && (d[s + 2] = A >> 16 & 255)), d;
|
|
246
282
|
};
|
|
247
|
-
function
|
|
248
|
-
|
|
283
|
+
function Xt(t, n, o) {
|
|
284
|
+
B.call(this, t, n, o);
|
|
249
285
|
}
|
|
250
|
-
|
|
251
|
-
return this.encode(this.outputBits, !0),
|
|
286
|
+
Xt.prototype = new B(), Xt.prototype.finalize = function() {
|
|
287
|
+
return this.encode(this.outputBits, !0), B.prototype.finalize.call(this);
|
|
252
288
|
};
|
|
253
|
-
var
|
|
254
|
-
var
|
|
255
|
-
for (
|
|
256
|
-
|
|
289
|
+
var G = function(t) {
|
|
290
|
+
var n, o, l, u, h, d, s, A, v, m, Z, Q, X, tt, et, rt, nt, it, ot, lt, ct, at, ft, ut, ht, st, dt, pt, yt, vt, gt, bt, St, kt, mt, _t, xt, Bt, At, Pt, wt, Ct, Et, Ot, It, Ft, Nt, jt, Kt, Mt, Tt, zt, Dt, Rt, Wt, Jt, Ht, Ut, Vt, Gt, $t, qt, Lt;
|
|
291
|
+
for (l = 0; l < 48; l += 2)
|
|
292
|
+
u = t[0] ^ t[10] ^ t[20] ^ t[30] ^ t[40], h = t[1] ^ t[11] ^ t[21] ^ t[31] ^ t[41], d = t[2] ^ t[12] ^ t[22] ^ t[32] ^ t[42], s = t[3] ^ t[13] ^ t[23] ^ t[33] ^ t[43], A = t[4] ^ t[14] ^ t[24] ^ t[34] ^ t[44], v = t[5] ^ t[15] ^ t[25] ^ t[35] ^ t[45], m = t[6] ^ t[16] ^ t[26] ^ t[36] ^ t[46], Z = t[7] ^ t[17] ^ t[27] ^ t[37] ^ t[47], Q = t[8] ^ t[18] ^ t[28] ^ t[38] ^ t[48], X = t[9] ^ t[19] ^ t[29] ^ t[39] ^ t[49], n = Q ^ (d << 1 | s >>> 31), o = X ^ (s << 1 | d >>> 31), t[0] ^= n, t[1] ^= o, t[10] ^= n, t[11] ^= o, t[20] ^= n, t[21] ^= o, t[30] ^= n, t[31] ^= o, t[40] ^= n, t[41] ^= o, n = u ^ (A << 1 | v >>> 31), o = h ^ (v << 1 | A >>> 31), t[2] ^= n, t[3] ^= o, t[12] ^= n, t[13] ^= o, t[22] ^= n, t[23] ^= o, t[32] ^= n, t[33] ^= o, t[42] ^= n, t[43] ^= o, n = d ^ (m << 1 | Z >>> 31), o = s ^ (Z << 1 | m >>> 31), t[4] ^= n, t[5] ^= o, t[14] ^= n, t[15] ^= o, t[24] ^= n, t[25] ^= o, t[34] ^= n, t[35] ^= o, t[44] ^= n, t[45] ^= o, n = A ^ (Q << 1 | X >>> 31), o = v ^ (X << 1 | Q >>> 31), t[6] ^= n, t[7] ^= o, t[16] ^= n, t[17] ^= o, t[26] ^= n, t[27] ^= o, t[36] ^= n, t[37] ^= o, t[46] ^= n, t[47] ^= o, n = m ^ (u << 1 | h >>> 31), o = Z ^ (h << 1 | u >>> 31), t[8] ^= n, t[9] ^= o, t[18] ^= n, t[19] ^= o, t[28] ^= n, t[29] ^= o, t[38] ^= n, t[39] ^= o, t[48] ^= n, t[49] ^= o, tt = t[0], et = t[1], Ft = t[11] << 4 | t[10] >>> 28, Nt = t[10] << 4 | t[11] >>> 28, pt = t[20] << 3 | t[21] >>> 29, yt = t[21] << 3 | t[20] >>> 29, Gt = t[31] << 9 | t[30] >>> 23, $t = t[30] << 9 | t[31] >>> 23, Ct = t[40] << 18 | t[41] >>> 14, Et = t[41] << 18 | t[40] >>> 14, kt = t[2] << 1 | t[3] >>> 31, mt = t[3] << 1 | t[2] >>> 31, rt = t[13] << 12 | t[12] >>> 20, nt = t[12] << 12 | t[13] >>> 20, jt = t[22] << 10 | t[23] >>> 22, Kt = t[23] << 10 | t[22] >>> 22, vt = t[33] << 13 | t[32] >>> 19, gt = t[32] << 13 | t[33] >>> 19, qt = t[42] << 2 | t[43] >>> 30, Lt = t[43] << 2 | t[42] >>> 30, Rt = t[5] << 30 | t[4] >>> 2, Wt = t[4] << 30 | t[5] >>> 2, _t = t[14] << 6 | t[15] >>> 26, xt = t[15] << 6 | t[14] >>> 26, it = t[25] << 11 | t[24] >>> 21, ot = t[24] << 11 | t[25] >>> 21, Mt = t[34] << 15 | t[35] >>> 17, Tt = t[35] << 15 | t[34] >>> 17, bt = t[45] << 29 | t[44] >>> 3, St = t[44] << 29 | t[45] >>> 3, ut = t[6] << 28 | t[7] >>> 4, ht = t[7] << 28 | t[6] >>> 4, Jt = t[17] << 23 | t[16] >>> 9, Ht = t[16] << 23 | t[17] >>> 9, Bt = t[26] << 25 | t[27] >>> 7, At = t[27] << 25 | t[26] >>> 7, lt = t[36] << 21 | t[37] >>> 11, ct = t[37] << 21 | t[36] >>> 11, zt = t[47] << 24 | t[46] >>> 8, Dt = t[46] << 24 | t[47] >>> 8, Ot = t[8] << 27 | t[9] >>> 5, It = t[9] << 27 | t[8] >>> 5, st = t[18] << 20 | t[19] >>> 12, dt = t[19] << 20 | t[18] >>> 12, Ut = t[29] << 7 | t[28] >>> 25, Vt = t[28] << 7 | t[29] >>> 25, Pt = t[38] << 8 | t[39] >>> 24, wt = t[39] << 8 | t[38] >>> 24, at = t[48] << 14 | t[49] >>> 18, ft = t[49] << 14 | t[48] >>> 18, t[0] = tt ^ ~rt & it, t[1] = et ^ ~nt & ot, t[10] = ut ^ ~st & pt, t[11] = ht ^ ~dt & yt, t[20] = kt ^ ~_t & Bt, t[21] = mt ^ ~xt & At, t[30] = Ot ^ ~Ft & jt, t[31] = It ^ ~Nt & Kt, t[40] = Rt ^ ~Jt & Ut, t[41] = Wt ^ ~Ht & Vt, t[2] = rt ^ ~it & lt, t[3] = nt ^ ~ot & ct, t[12] = st ^ ~pt & vt, t[13] = dt ^ ~yt & gt, t[22] = _t ^ ~Bt & Pt, t[23] = xt ^ ~At & wt, t[32] = Ft ^ ~jt & Mt, t[33] = Nt ^ ~Kt & Tt, t[42] = Jt ^ ~Ut & Gt, t[43] = Ht ^ ~Vt & $t, t[4] = it ^ ~lt & at, t[5] = ot ^ ~ct & ft, t[14] = pt ^ ~vt & bt, t[15] = yt ^ ~gt & St, t[24] = Bt ^ ~Pt & Ct, t[25] = At ^ ~wt & Et, t[34] = jt ^ ~Mt & zt, t[35] = Kt ^ ~Tt & Dt, t[44] = Ut ^ ~Gt & qt, t[45] = Vt ^ ~$t & Lt, t[6] = lt ^ ~at & tt, t[7] = ct ^ ~ft & et, t[16] = vt ^ ~bt & ut, t[17] = gt ^ ~St & ht, t[26] = Pt ^ ~Ct & kt, t[27] = wt ^ ~Et & mt, t[36] = Mt ^ ~zt & Ot, t[37] = Tt ^ ~Dt & It, t[46] = Gt ^ ~qt & Rt, t[47] = $t ^ ~Lt & Wt, t[8] = at ^ ~tt & rt, t[9] = ft ^ ~et & nt, t[18] = bt ^ ~ut & st, t[19] = St ^ ~ht & dt, t[28] = Ct ^ ~kt & _t, t[29] = Et ^ ~mt & xt, t[38] = zt ^ ~Ot & Ft, t[39] = Dt ^ ~It & Nt, t[48] = qt ^ ~Rt & Jt, t[49] = Lt ^ ~Wt & Ht, t[0] ^= D[l], t[1] ^= D[l + 1];
|
|
257
293
|
};
|
|
258
|
-
if (
|
|
259
|
-
|
|
294
|
+
if (b)
|
|
295
|
+
c.exports = M;
|
|
260
296
|
else
|
|
261
|
-
for (
|
|
262
|
-
|
|
297
|
+
for (T = 0; T < U.length; ++T)
|
|
298
|
+
i[U[T]] = M[U[T]];
|
|
263
299
|
})();
|
|
264
|
-
})(
|
|
300
|
+
})(ee)), ee.exports;
|
|
301
|
+
}
|
|
302
|
+
var _e = me();
|
|
303
|
+
const xe = /* @__PURE__ */ ke(_e), { keccak256: he } = xe;
|
|
304
|
+
function ne(c) {
|
|
305
|
+
return new TextEncoder().encode(c);
|
|
306
|
+
}
|
|
307
|
+
function Be(c) {
|
|
308
|
+
const r = c.startsWith("0x") ? c.slice(2) : c, e = new Uint8Array(r.length / 2);
|
|
309
|
+
for (let a = 0; a < e.length; a++)
|
|
310
|
+
e[a] = parseInt(r.substring(a * 2, a * 2 + 2), 16);
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
function Ae(c) {
|
|
314
|
+
let r = "";
|
|
315
|
+
for (let e = 0; e < c.length; e++)
|
|
316
|
+
r += c[e].toString(16).padStart(2, "0");
|
|
317
|
+
return "0x" + r;
|
|
318
|
+
}
|
|
319
|
+
function fe(c, r, e) {
|
|
320
|
+
const a = JSON.stringify(c), i = ne(a), f = he(r + ":" + e.join(".")), p = ne(f), b = new Uint8Array(i.length);
|
|
321
|
+
for (let y = 0; y < i.length; y++)
|
|
322
|
+
b[y] = i[y] ^ p[y % p.length];
|
|
323
|
+
return Ae(b);
|
|
265
324
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
return
|
|
325
|
+
function re(c, r, e) {
|
|
326
|
+
try {
|
|
327
|
+
const a = Be(c), i = he(r + ":" + e.join(".")), f = ne(i), p = new Uint8Array(a.length);
|
|
328
|
+
for (let y = 0; y < a.length; y++)
|
|
329
|
+
p[y] = a[y] ^ f[y % f.length];
|
|
330
|
+
const b = new TextDecoder().decode(p);
|
|
331
|
+
return JSON.parse(b);
|
|
332
|
+
} catch {
|
|
333
|
+
return null;
|
|
273
334
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
return
|
|
287
|
-
},
|
|
288
|
-
apply(c, y, b) {
|
|
289
|
-
return o.handleCall(i, b);
|
|
335
|
+
}
|
|
336
|
+
function Pe(c) {
|
|
337
|
+
if (typeof c != "string" || !c.startsWith("0x")) return !1;
|
|
338
|
+
const r = c.slice(2);
|
|
339
|
+
return r.length < 2 || r.length % 2 !== 0 ? !1 : /^[0-9a-fA-F]+$/.test(r);
|
|
340
|
+
}
|
|
341
|
+
function we(c, r, e) {
|
|
342
|
+
if (r.length === 0) {
|
|
343
|
+
if (e.length === 1 && typeof e[0] == "string") {
|
|
344
|
+
const S = e[0].trim(), O = S.startsWith("_") || S.startsWith("~") || S.startsWith("@"), W = S.includes("."), z = /^[a-zA-Z][a-zA-Z0-9_-]*$/.test(S);
|
|
345
|
+
if (W || O || z) {
|
|
346
|
+
const P = S.split(".").filter(Boolean);
|
|
347
|
+
return c.readPath(P);
|
|
290
348
|
}
|
|
291
|
-
}
|
|
349
|
+
}
|
|
350
|
+
if (e.length === 0)
|
|
351
|
+
return c.createProxy([]);
|
|
352
|
+
const y = c.normalizeArgs(e), g = c.postulate([], y);
|
|
353
|
+
return g !== void 0 ? g : c.createProxy([]);
|
|
354
|
+
}
|
|
355
|
+
const a = c.normalizeArgs(e), i = c.postulate(r, a), { scope: f, leaf: p } = c.splitPath(r), b = p ? c.opKind(p) : null;
|
|
356
|
+
if (c.isThought(i)) {
|
|
357
|
+
const y = b ? f : r;
|
|
358
|
+
return c.createProxy(y);
|
|
292
359
|
}
|
|
360
|
+
return i !== void 0 ? i : c.createProxy(r);
|
|
361
|
+
}
|
|
362
|
+
const ue = "+";
|
|
363
|
+
function R(c) {
|
|
364
|
+
let r = 2166136261;
|
|
365
|
+
for (let e = 0; e < c.length; e++)
|
|
366
|
+
r ^= c.charCodeAt(e), r = Math.imul(r, 16777619);
|
|
367
|
+
return ("00000000" + (r >>> 0).toString(16)).slice(-8);
|
|
368
|
+
}
|
|
369
|
+
class se {
|
|
293
370
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* me
|
|
371
|
+
* Constructor base:
|
|
372
|
+
* me = new ME(expression?)
|
|
373
|
+
*
|
|
374
|
+
* Esto es equivalente a llamar:
|
|
375
|
+
* me(expression) en la raíz.
|
|
299
376
|
*/
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
377
|
+
constructor(r) {
|
|
378
|
+
this.localSecrets = {}, this.localNoises = {}, this.encryptedBranches = {}, this.index = {}, this._shortTermMemory = [], this.operators = {
|
|
379
|
+
_: { kind: "secret" },
|
|
380
|
+
"~": { kind: "noise" },
|
|
381
|
+
__: { kind: "pointer" },
|
|
382
|
+
"->": { kind: "pointer" },
|
|
383
|
+
"@": { kind: "identity" },
|
|
384
|
+
"=": { kind: "eval" },
|
|
385
|
+
"?": { kind: "query" },
|
|
386
|
+
"-": { kind: "remove" }
|
|
387
|
+
}, this.localSecrets = {}, this.localNoises = {}, this.encryptedBranches = {}, this.index = {}, this.operators = {
|
|
388
|
+
_: { kind: "secret" },
|
|
389
|
+
"~": { kind: "noise" },
|
|
390
|
+
__: { kind: "pointer" },
|
|
391
|
+
"->": { kind: "pointer" },
|
|
392
|
+
"@": { kind: "identity" },
|
|
393
|
+
"=": { kind: "eval" },
|
|
394
|
+
"?": { kind: "query" },
|
|
395
|
+
"-": { kind: "remove" }
|
|
396
|
+
}, this._shortTermMemory = [], r !== void 0 && this.postulate([], r), this.rebuildIndex();
|
|
397
|
+
const e = this.createProxy([]);
|
|
398
|
+
return Object.setPrototypeOf(e, se.prototype), Object.assign(e, this), e;
|
|
399
|
+
}
|
|
400
|
+
// semantic accessor (property-style)
|
|
401
|
+
get shortTermMemory() {
|
|
402
|
+
return this._shortTermMemory;
|
|
403
|
+
}
|
|
404
|
+
isRemoveCall(r, e) {
|
|
405
|
+
if (r.length === 0) return null;
|
|
406
|
+
const { scope: a, leaf: i } = N(r);
|
|
407
|
+
if (!i || this.opKind(i) !== "remove") return null;
|
|
408
|
+
if (e == null)
|
|
409
|
+
return { targetPath: a };
|
|
410
|
+
if (typeof e == "string") {
|
|
411
|
+
const f = e.split(".").filter(Boolean);
|
|
412
|
+
return { targetPath: [...a, ...f] };
|
|
320
413
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
// ---------------------------------------------------------
|
|
417
|
+
// Proxy infinito: me.foo.bar(...triada)
|
|
418
|
+
// ---------------------------------------------------------
|
|
419
|
+
createProxy(r) {
|
|
420
|
+
const e = this, a = (...i) => we(
|
|
421
|
+
{
|
|
422
|
+
createProxy: (f) => e.createProxy(f),
|
|
423
|
+
normalizeArgs: (f) => e.normalizeArgs(f),
|
|
424
|
+
readPath: (f) => e.readPath(f),
|
|
425
|
+
postulate: (f, p) => e.postulate(f, p),
|
|
426
|
+
opKind: (f) => e.opKind(f),
|
|
427
|
+
splitPath: N,
|
|
428
|
+
isThought: be
|
|
429
|
+
},
|
|
430
|
+
r,
|
|
431
|
+
i
|
|
328
432
|
);
|
|
329
|
-
return
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
433
|
+
return new Proxy(a, {
|
|
434
|
+
get(i, f) {
|
|
435
|
+
if (typeof f == "symbol") return i[f];
|
|
436
|
+
if (f in e) {
|
|
437
|
+
const b = e[f];
|
|
438
|
+
return typeof b == "function" ? b.bind(e) : b;
|
|
439
|
+
}
|
|
440
|
+
const p = [...r, String(f)];
|
|
441
|
+
return e.createProxy(p);
|
|
442
|
+
},
|
|
443
|
+
apply(i, f, p) {
|
|
444
|
+
return Reflect.apply(i, void 0, p);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
335
447
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
448
|
+
// Normaliza args:
|
|
449
|
+
// () → expression = undefined
|
|
450
|
+
// (expr) → expr
|
|
451
|
+
// Preserve operator multi-arg calls like:
|
|
452
|
+
// me["+"]("=", "eval")
|
|
453
|
+
// me["?"](["a.b"], fn)
|
|
454
|
+
// For normal writes, keep single-arg semantics.
|
|
455
|
+
// NOTE: secrets are declared structurally via _("..."), not as args.
|
|
456
|
+
normalizeArgs(r) {
|
|
457
|
+
if (r.length !== 0)
|
|
458
|
+
return r.length === 1 ? r[0] : r;
|
|
459
|
+
}
|
|
460
|
+
opKind(r) {
|
|
461
|
+
return this.operators[r]?.kind ?? null;
|
|
462
|
+
}
|
|
463
|
+
isSecretScopeCall(r, e) {
|
|
464
|
+
if (r.length === 0) return null;
|
|
465
|
+
const { scope: a, leaf: i } = N(r);
|
|
466
|
+
return !i || this.opKind(i) !== "secret" || typeof e != "string" ? null : { scopeKey: a.join(".") };
|
|
467
|
+
}
|
|
468
|
+
isNoiseScopeCall(r, e) {
|
|
469
|
+
if (r.length === 0) return null;
|
|
470
|
+
const { scope: a, leaf: i } = N(r);
|
|
471
|
+
return !i || this.opKind(i) !== "noise" || typeof e != "string" ? null : { scopeKey: a.join(".") };
|
|
472
|
+
}
|
|
473
|
+
isPointerCall(r, e) {
|
|
474
|
+
if (r.length === 0) return null;
|
|
475
|
+
const { leaf: a } = N(r);
|
|
476
|
+
if (!a || this.opKind(a) !== "pointer" || typeof e != "string") return null;
|
|
477
|
+
const i = e.trim().replace(/^\./, "");
|
|
478
|
+
return i ? { targetPath: i } : null;
|
|
479
|
+
}
|
|
480
|
+
isIdentityCall(r, e) {
|
|
481
|
+
if (r.length === 1 && this.opKind(r[0]) === "identity")
|
|
482
|
+
return typeof e != "string" ? null : { id: ce(e), targetPath: [] };
|
|
483
|
+
const { scope: a, leaf: i } = N(r);
|
|
484
|
+
return !i || this.opKind(i) !== "identity" || typeof e != "string" ? null : { id: ce(e), targetPath: a };
|
|
485
|
+
}
|
|
486
|
+
isEvalCall(r, e) {
|
|
487
|
+
if (r.length === 0) return null;
|
|
488
|
+
const { scope: a, leaf: i } = N(r);
|
|
489
|
+
if (!i || this.opKind(i) !== "eval") return null;
|
|
490
|
+
if (typeof e == "function")
|
|
491
|
+
return { mode: "thunk", targetPath: a, thunk: e };
|
|
492
|
+
if (Array.isArray(e) && e.length >= 2) {
|
|
493
|
+
const f = String(e[0] ?? "").trim(), p = String(e[1] ?? "").trim();
|
|
494
|
+
return !f || !p ? null : { mode: "assign", targetPath: a, name: f, expr: p };
|
|
347
495
|
}
|
|
348
|
-
return
|
|
496
|
+
return null;
|
|
349
497
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
498
|
+
isQueryCall(r, e) {
|
|
499
|
+
if (r.length === 0) return null;
|
|
500
|
+
const { scope: a, leaf: i } = N(r);
|
|
501
|
+
if (!i || this.opKind(i) !== "query") return null;
|
|
502
|
+
let f = null, p;
|
|
503
|
+
if (Array.isArray(e) && e.length > 0)
|
|
504
|
+
Array.isArray(e[0]) && (e.length === 1 || typeof e[1] == "function") ? (f = e[0], p = typeof e[1] == "function" ? e[1] : void 0) : f = e;
|
|
505
|
+
else
|
|
506
|
+
return null;
|
|
507
|
+
if (!Array.isArray(f) || f.length === 0) return null;
|
|
508
|
+
const b = f.map((y) => String(y)).map((y) => y.trim()).filter((y) => y.length > 0);
|
|
509
|
+
return b.length === 0 ? null : { targetPath: a, paths: b, fn: p };
|
|
355
510
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (c.length > 0) {
|
|
370
|
-
let k = {};
|
|
371
|
-
const F = this.branchVersions[y]?.[b], w = this.getSubPayload(c);
|
|
372
|
-
if (F) {
|
|
373
|
-
const A = this.decryptForPath(c, F);
|
|
374
|
-
A && typeof A == "object" && (k = A);
|
|
375
|
-
} else if (typeof w == "string") {
|
|
376
|
-
const A = this.decryptForPath(c, w);
|
|
377
|
-
A && typeof A == "object" && (k = A);
|
|
378
|
-
} else w && typeof w == "object" && (k = w);
|
|
379
|
-
const v = i.slice(c.length);
|
|
380
|
-
let _ = k;
|
|
381
|
-
for (let A = 0; A < v.length - 1; A++) {
|
|
382
|
-
const K = v[A];
|
|
383
|
-
(!_[K] || typeof _[K] != "object") && (_[K] = {}), _ = _[K];
|
|
384
|
-
}
|
|
385
|
-
const j = v[v.length - 1];
|
|
386
|
-
_[j] = o;
|
|
387
|
-
const C = this.encryptForPath(c, k);
|
|
388
|
-
this.branchVersions[y] || (this.branchVersions[y] = {}), this.branchVersions[y][b] = C, this.writeBranchBlob(c, C);
|
|
511
|
+
isDefineOpCall(r, e) {
|
|
512
|
+
if (r.length !== 1 || r[0] !== ue || !Array.isArray(e) || e.length < 2) return null;
|
|
513
|
+
const i = String(e[0] ?? "").trim(), f = String(e[1] ?? "").trim();
|
|
514
|
+
return !i || !f || i === ue ? null : { op: i, kind: f };
|
|
515
|
+
}
|
|
516
|
+
// ---------------------------------------------------------
|
|
517
|
+
// Postulate: semantic write at a given path
|
|
518
|
+
// ---------------------------------------------------------
|
|
519
|
+
postulate(r, e, a = null) {
|
|
520
|
+
let i = r, f = e;
|
|
521
|
+
const p = this.isDefineOpCall(i, e);
|
|
522
|
+
if (p) {
|
|
523
|
+
this.operators[p.op] = { kind: p.kind };
|
|
389
524
|
return;
|
|
390
525
|
}
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
526
|
+
const b = this.isEvalCall(i, e);
|
|
527
|
+
if (b) {
|
|
528
|
+
if (b.mode === "thunk") {
|
|
529
|
+
const x = b.thunk();
|
|
530
|
+
return b.targetPath.length === 0 ? x : this.postulate(b.targetPath, x, "=");
|
|
531
|
+
}
|
|
532
|
+
const k = [...b.targetPath, b.name];
|
|
533
|
+
return this.postulate(k, b.expr, "=");
|
|
396
534
|
}
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
this.payload = o;
|
|
535
|
+
const y = this.isQueryCall(i, e);
|
|
536
|
+
if (y) {
|
|
537
|
+
const k = y.paths.map((C) => this.readPath(C.split(".").filter(Boolean))), x = y.fn ? y.fn(...k) : k;
|
|
538
|
+
return y.targetPath.length === 0 ? x : this.postulate(y.targetPath, x, "?");
|
|
539
|
+
}
|
|
540
|
+
const g = this.isRemoveCall(i, e);
|
|
541
|
+
if (g) {
|
|
542
|
+
this.removeSubtree(g.targetPath);
|
|
406
543
|
return;
|
|
407
544
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
545
|
+
const S = this.isSecretScopeCall(i, e);
|
|
546
|
+
if (S) {
|
|
547
|
+
this.localSecrets[S.scopeKey] = e;
|
|
548
|
+
const k = S.scopeKey ? S.scopeKey.split(".").filter(Boolean) : [], x = k.join("."), C = this.computeEffectiveSecret(k), w = "***", _ = "***", F = JSON.stringify({
|
|
549
|
+
path: x,
|
|
550
|
+
operator: "_",
|
|
551
|
+
expression: w,
|
|
552
|
+
value: _,
|
|
553
|
+
effectiveSecret: C
|
|
554
|
+
}), I = R(F), j = Date.now(), K = {
|
|
555
|
+
path: x,
|
|
556
|
+
operator: "_",
|
|
557
|
+
expression: w,
|
|
558
|
+
value: _,
|
|
559
|
+
effectiveSecret: C,
|
|
560
|
+
hash: I,
|
|
561
|
+
timestamp: j
|
|
562
|
+
};
|
|
563
|
+
return this._shortTermMemory.push(K), this.rebuildIndex(), K;
|
|
412
564
|
}
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
565
|
+
const O = this.isNoiseScopeCall(i, e);
|
|
566
|
+
if (O) {
|
|
567
|
+
this.localNoises[O.scopeKey] = e;
|
|
568
|
+
const k = O.scopeKey ? O.scopeKey.split(".").filter(Boolean) : [], x = k.join("."), C = this.computeEffectiveSecret(k), w = "***", _ = "***", F = JSON.stringify({
|
|
569
|
+
path: x,
|
|
570
|
+
operator: "~",
|
|
571
|
+
expression: w,
|
|
572
|
+
value: _,
|
|
573
|
+
effectiveSecret: C
|
|
574
|
+
}), I = R(F), j = Date.now(), K = {
|
|
575
|
+
path: x,
|
|
576
|
+
operator: "~",
|
|
577
|
+
expression: w,
|
|
578
|
+
value: _,
|
|
579
|
+
effectiveSecret: C,
|
|
580
|
+
hash: I,
|
|
581
|
+
timestamp: j
|
|
582
|
+
};
|
|
583
|
+
return this._shortTermMemory.push(K), this.rebuildIndex(), K;
|
|
424
584
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
585
|
+
const W = this.isPointerCall(i, e);
|
|
586
|
+
if (W) {
|
|
587
|
+
const { scope: k } = N(i);
|
|
588
|
+
i = k, e = ve(W.targetPath), f = e, a === null && (a = "__");
|
|
589
|
+
}
|
|
590
|
+
const z = this.isIdentityCall(i, e);
|
|
591
|
+
z && (i = z.targetPath, e = ge(z.id), f = e, a === null && (a = "@"));
|
|
592
|
+
const P = i.join("."), D = this.computeEffectiveSecret(i), E = this.resolveBranchScope(i);
|
|
593
|
+
if (E && E.length === 0 && this.localSecrets[""] && this.localSecrets[P], E && E.length > 0) {
|
|
594
|
+
const k = this.computeEffectiveSecret(E), x = i.slice(E.length), C = this.getBranchBlob(E);
|
|
595
|
+
let w = {};
|
|
596
|
+
if (C && k) {
|
|
597
|
+
const _ = re(C, k, E);
|
|
598
|
+
_ && typeof _ == "object" && (w = _);
|
|
599
|
+
}
|
|
600
|
+
if (x.length === 0)
|
|
601
|
+
(typeof w != "object" || w === null) && (w = {}), w.expression = e;
|
|
602
|
+
else {
|
|
603
|
+
let _ = w;
|
|
604
|
+
for (let F = 0; F < x.length - 1; F++) {
|
|
605
|
+
const I = x[F];
|
|
606
|
+
(!_[I] || typeof _[I] != "object") && (_[I] = {}), _ = _[I];
|
|
607
|
+
}
|
|
608
|
+
_[x[x.length - 1]] = e;
|
|
437
609
|
}
|
|
438
|
-
const { path: b, secret: P } = y, p = b.join("."), d = O(P), B = this.getSubPayload(b), k = this.branchVersions[p]?.[d] ?? (typeof B == "string" ? B : void 0);
|
|
439
|
-
let F = {};
|
|
440
610
|
if (k) {
|
|
441
|
-
const
|
|
442
|
-
|
|
611
|
+
const _ = fe(w, k, E);
|
|
612
|
+
this.setBranchBlob(E, _);
|
|
443
613
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
614
|
+
f = e;
|
|
615
|
+
} else if (D) {
|
|
616
|
+
const k = a !== "=" && a !== "?";
|
|
617
|
+
Yt(e) || te(e) || !k ? f = e : f = fe(e, D, i);
|
|
618
|
+
} else
|
|
619
|
+
f = e;
|
|
620
|
+
const J = f, $ = JSON.stringify({
|
|
621
|
+
path: P,
|
|
622
|
+
operator: a,
|
|
623
|
+
expression: e,
|
|
624
|
+
value: J,
|
|
625
|
+
effectiveSecret: D
|
|
626
|
+
}), q = R($), Zt = Date.now(), L = {
|
|
627
|
+
path: P,
|
|
628
|
+
operator: a,
|
|
629
|
+
expression: e,
|
|
630
|
+
value: J,
|
|
631
|
+
effectiveSecret: D,
|
|
632
|
+
hash: q,
|
|
633
|
+
timestamp: Zt
|
|
634
|
+
};
|
|
635
|
+
return this._shortTermMemory.push(L), this.rebuildIndex(), L;
|
|
636
|
+
}
|
|
637
|
+
removeSubtree(r) {
|
|
638
|
+
const e = r.join(".");
|
|
639
|
+
for (const g of Object.keys(this.localSecrets)) {
|
|
640
|
+
if (e === "") {
|
|
641
|
+
delete this.localSecrets[g];
|
|
642
|
+
continue;
|
|
449
643
|
}
|
|
450
|
-
|
|
451
|
-
const _ = this.encryptForPath(b, F);
|
|
452
|
-
this.branchVersions[p] || (this.branchVersions[p] = {}), this.branchVersions[p][d] = _, l = b, c = _;
|
|
644
|
+
(g === e || g.startsWith(e + ".")) && delete this.localSecrets[g];
|
|
453
645
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
646
|
+
for (const g of Object.keys(this.localNoises)) {
|
|
647
|
+
if (e === "") {
|
|
648
|
+
delete this.localNoises[g];
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
(g === e || g.startsWith(e + ".")) && delete this.localNoises[g];
|
|
652
|
+
}
|
|
653
|
+
for (const g of Object.keys(this.encryptedBranches)) {
|
|
654
|
+
if (e === "") {
|
|
655
|
+
delete this.encryptedBranches[g];
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
(g === e || g.startsWith(e + ".")) && delete this.encryptedBranches[g];
|
|
460
659
|
}
|
|
461
|
-
|
|
660
|
+
const a = r.join("."), i = Date.now(), f = this.computeEffectiveSecret(r), p = JSON.stringify({ path: a, operator: "-", expression: "-", value: "-", effectiveSecret: f }), b = R(p), y = {
|
|
661
|
+
path: a,
|
|
662
|
+
operator: "-",
|
|
663
|
+
expression: "-",
|
|
664
|
+
value: "-",
|
|
665
|
+
effectiveSecret: f,
|
|
666
|
+
hash: b,
|
|
667
|
+
timestamp: i
|
|
668
|
+
};
|
|
669
|
+
this._shortTermMemory.push(y), this.rebuildIndex();
|
|
462
670
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
671
|
+
// ---------------------------------------------------------
|
|
672
|
+
// Fractal secret: combina todos los secrets a lo largo de la ruta, o noise acts as a new root for chaining
|
|
673
|
+
// ---------------------------------------------------------
|
|
674
|
+
computeEffectiveSecret(r) {
|
|
675
|
+
let e = null, a = null;
|
|
676
|
+
this.localNoises[""] !== void 0 && (e = "", a = this.localNoises[""]);
|
|
677
|
+
for (let f = 1; f <= r.length; f++) {
|
|
678
|
+
const p = r.slice(0, f).join(".");
|
|
679
|
+
this.localNoises[p] !== void 0 && (e = p, a = this.localNoises[p]);
|
|
472
680
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
681
|
+
let i = "root";
|
|
682
|
+
a ? i = R("noise::" + a) : this.localSecrets[""] && (i = R(i + "::" + this.localSecrets[""])), e === null || e === "" || e.split(".").filter(Boolean).length;
|
|
683
|
+
for (let f = 1; f <= r.length; f++) {
|
|
684
|
+
const p = r.slice(0, f).join(".");
|
|
685
|
+
if (this.localSecrets[p]) {
|
|
686
|
+
if (e !== null && e !== "") {
|
|
687
|
+
const b = e + ".";
|
|
688
|
+
if (!(p === e || p.startsWith(b))) continue;
|
|
689
|
+
}
|
|
690
|
+
i = R(i + "::" + this.localSecrets[p]);
|
|
691
|
+
}
|
|
479
692
|
}
|
|
480
|
-
return
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Encrypt a value (object or primitive) using the secret resolved for the given path.
|
|
484
|
-
* Produces a hex string compatible with decryptForPath().
|
|
485
|
-
*/
|
|
486
|
-
encryptForPath(i, o) {
|
|
487
|
-
const l = this.resolveSecret(i), c = JSON.stringify(o), y = new TextEncoder().encode(c), b = O(l + ":" + i.join(".")), P = this.asciiToBytes(b), p = new Uint8Array(y.length);
|
|
488
|
-
for (let B = 0; B < y.length; B++)
|
|
489
|
-
p[B] = y[B] ^ P[B % P.length];
|
|
490
|
-
let d = "";
|
|
491
|
-
for (let B = 0; B < p.length; B++)
|
|
492
|
-
d += p[B].toString(16).padStart(2, "0");
|
|
493
|
-
return d;
|
|
693
|
+
return i === "root" ? "" : i;
|
|
494
694
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
695
|
+
// ---------------------------------------------------------
|
|
696
|
+
// Índice derivado
|
|
697
|
+
// ---------------------------------------------------------
|
|
698
|
+
rebuildIndex() {
|
|
699
|
+
const r = {};
|
|
700
|
+
for (const e of this._shortTermMemory) {
|
|
701
|
+
const a = e.path, i = a.split(".").filter(Boolean), f = this.resolveBranchScope(i), p = f && f.length > 0 && le(i, f);
|
|
702
|
+
if (e.operator === "-") {
|
|
703
|
+
if (a === "") {
|
|
704
|
+
for (const y of Object.keys(r)) delete r[y];
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
const b = a + ".";
|
|
708
|
+
for (const y of Object.keys(r))
|
|
709
|
+
(y === a || y.startsWith(b)) && delete r[y];
|
|
710
|
+
continue;
|
|
711
|
+
}
|
|
712
|
+
p || (r[a] = e.value);
|
|
508
713
|
}
|
|
714
|
+
this.index = r;
|
|
509
715
|
}
|
|
510
|
-
|
|
511
|
-
return
|
|
716
|
+
getIndex(r) {
|
|
717
|
+
return this.index[r.join(".")];
|
|
512
718
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
for (let c = 0; c < l.length; c++)
|
|
516
|
-
l[c] = parseInt(o.substr(c * 2, 2), 16);
|
|
517
|
-
return l;
|
|
719
|
+
setIndex(r, e) {
|
|
720
|
+
this.index[r.join(".")] = e;
|
|
518
721
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
722
|
+
resolveIndexPointerPath(r, e = 8) {
|
|
723
|
+
let a = r;
|
|
724
|
+
for (let i = 0; i < e; i++) {
|
|
725
|
+
const f = this.getIndex(a);
|
|
726
|
+
if (!Yt(f)) return { path: a, raw: f };
|
|
727
|
+
a = f.__ptr.split(".").filter(Boolean);
|
|
728
|
+
}
|
|
729
|
+
return { path: a, raw: void 0 };
|
|
522
730
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
export() {
|
|
527
|
-
return {
|
|
528
|
-
identityRoot: this.identityRoot,
|
|
529
|
-
publicKey: this.publicKey,
|
|
530
|
-
identityHash: this.identityHash,
|
|
531
|
-
declarations: this.declarations,
|
|
532
|
-
payload: this.payload
|
|
533
|
-
};
|
|
731
|
+
setBranchBlob(r, e) {
|
|
732
|
+
const a = r.join(".");
|
|
733
|
+
this.encryptedBranches[a] = e;
|
|
534
734
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
735
|
+
getBranchBlob(r) {
|
|
736
|
+
const e = r.join(".");
|
|
737
|
+
return this.encryptedBranches[e];
|
|
738
|
+
}
|
|
739
|
+
resolveBranchScope(r) {
|
|
740
|
+
let e = null;
|
|
741
|
+
this.localSecrets[""] && (e = []);
|
|
742
|
+
for (let a = 1; a <= r.length; a++) {
|
|
743
|
+
const i = r.slice(0, a), f = i.join(".");
|
|
744
|
+
this.localSecrets[f] && (e = i);
|
|
544
745
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
746
|
+
return e;
|
|
747
|
+
}
|
|
748
|
+
readPath(r) {
|
|
749
|
+
const e = this.resolveBranchScope(r);
|
|
750
|
+
if (e && e.length > 0 && le(r, e)) {
|
|
751
|
+
if (r.length === e.length) return;
|
|
752
|
+
const p = this.computeEffectiveSecret(e);
|
|
753
|
+
if (!p) return null;
|
|
754
|
+
const b = this.getBranchBlob(e);
|
|
755
|
+
if (!b) return;
|
|
756
|
+
const y = re(b, p, e);
|
|
757
|
+
if (!y || typeof y != "object") return;
|
|
758
|
+
const g = r.slice(e.length);
|
|
759
|
+
let S = y;
|
|
760
|
+
for (const O of g) {
|
|
761
|
+
if (!S || typeof S != "object") return;
|
|
762
|
+
S = S[O];
|
|
550
763
|
}
|
|
551
|
-
return this.
|
|
764
|
+
return Yt(S) ? this.readPath(S.__ptr.split(".").filter(Boolean)) : (te(S), S);
|
|
552
765
|
}
|
|
766
|
+
const i = this.resolveIndexPointerPath(r).raw;
|
|
767
|
+
if (i === void 0) return;
|
|
768
|
+
if (Yt(i)) return this.readPath(i.__ptr.split(".").filter(Boolean));
|
|
769
|
+
if (te(i) || !Pe(i)) return i;
|
|
770
|
+
const f = this.computeEffectiveSecret(r);
|
|
771
|
+
return f ? re(i, f, r) : null;
|
|
553
772
|
}
|
|
554
773
|
}
|
|
555
774
|
export {
|
|
556
|
-
|
|
775
|
+
se as default
|
|
557
776
|
};
|