cotomy 1.0.5 → 2.0.0
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 +3 -1
- package/dist/browser/cotomy.js +803 -127
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +2 -1
- package/dist/browser/cotomy.min.js.LICENSE.txt +1 -0
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +2 -1
- package/dist/cjs/index.cjs.LICENSE.txt +1 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/view.js +4 -4
- package/dist/esm/view.js.map +1 -1
- package/package.json +12 -12
package/dist/browser/cotomy.js
CHANGED
|
@@ -11,172 +11,849 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/
|
|
15
|
-
|
|
14
|
+
/***/ 318
|
|
15
|
+
(__unused_webpack_module, exports) {
|
|
16
16
|
|
|
17
|
+
"use strict";
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20
|
+
exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
|
|
21
|
+
exports.add = add;
|
|
22
|
+
exports.fromBig = fromBig;
|
|
23
|
+
exports.split = split;
|
|
24
|
+
/**
|
|
25
|
+
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
|
26
|
+
* @todo re-check https://issues.chromium.org/issues/42212588
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
30
|
+
const _32n = /* @__PURE__ */ BigInt(32);
|
|
31
|
+
function fromBig(n, le = false) {
|
|
32
|
+
if (le)
|
|
33
|
+
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
34
|
+
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
35
|
+
}
|
|
36
|
+
function split(lst, le = false) {
|
|
37
|
+
const len = lst.length;
|
|
38
|
+
let Ah = new Uint32Array(len);
|
|
39
|
+
let Al = new Uint32Array(len);
|
|
40
|
+
for (let i = 0; i < len; i++) {
|
|
41
|
+
const { h, l } = fromBig(lst[i], le);
|
|
42
|
+
[Ah[i], Al[i]] = [h, l];
|
|
43
|
+
}
|
|
44
|
+
return [Ah, Al];
|
|
45
|
+
}
|
|
46
|
+
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
|
47
|
+
exports.toBig = toBig;
|
|
48
|
+
// for Shift in [0, 32)
|
|
49
|
+
const shrSH = (h, _l, s) => h >>> s;
|
|
50
|
+
exports.shrSH = shrSH;
|
|
51
|
+
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
52
|
+
exports.shrSL = shrSL;
|
|
53
|
+
// Right rotate for Shift in [1, 32)
|
|
54
|
+
const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
|
|
55
|
+
exports.rotrSH = rotrSH;
|
|
56
|
+
const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
57
|
+
exports.rotrSL = rotrSL;
|
|
58
|
+
// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
59
|
+
const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
|
|
60
|
+
exports.rotrBH = rotrBH;
|
|
61
|
+
const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
|
|
62
|
+
exports.rotrBL = rotrBL;
|
|
63
|
+
// Right rotate for shift===32 (just swaps l&h)
|
|
64
|
+
const rotr32H = (_h, l) => l;
|
|
65
|
+
exports.rotr32H = rotr32H;
|
|
66
|
+
const rotr32L = (h, _l) => h;
|
|
67
|
+
exports.rotr32L = rotr32L;
|
|
68
|
+
// Left rotate for Shift in [1, 32)
|
|
69
|
+
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
70
|
+
exports.rotlSH = rotlSH;
|
|
71
|
+
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
72
|
+
exports.rotlSL = rotlSL;
|
|
73
|
+
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
74
|
+
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
75
|
+
exports.rotlBH = rotlBH;
|
|
76
|
+
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
77
|
+
exports.rotlBL = rotlBL;
|
|
78
|
+
// JS uses 32-bit signed integers for bitwise operations which means we cannot
|
|
79
|
+
// simple take carry out of low bit sum by shift, we need to use division.
|
|
80
|
+
function add(Ah, Al, Bh, Bl) {
|
|
81
|
+
const l = (Al >>> 0) + (Bl >>> 0);
|
|
82
|
+
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
|
|
32
83
|
}
|
|
84
|
+
// Addition with more than 2 elements
|
|
85
|
+
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
86
|
+
exports.add3L = add3L;
|
|
87
|
+
const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
|
|
88
|
+
exports.add3H = add3H;
|
|
89
|
+
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
90
|
+
exports.add4L = add4L;
|
|
91
|
+
const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
|
|
92
|
+
exports.add4H = add4H;
|
|
93
|
+
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
94
|
+
exports.add5L = add5L;
|
|
95
|
+
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
|
96
|
+
exports.add5H = add5H;
|
|
97
|
+
// prettier-ignore
|
|
98
|
+
const u64 = {
|
|
99
|
+
fromBig, split, toBig,
|
|
100
|
+
shrSH, shrSL,
|
|
101
|
+
rotrSH, rotrSL, rotrBH, rotrBL,
|
|
102
|
+
rotr32H, rotr32L,
|
|
103
|
+
rotlSH, rotlSL, rotlBH, rotlBL,
|
|
104
|
+
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
|
105
|
+
};
|
|
106
|
+
exports["default"] = u64;
|
|
107
|
+
//# sourceMappingURL=_u64.js.map
|
|
33
108
|
|
|
34
|
-
|
|
109
|
+
/***/ },
|
|
35
110
|
|
|
111
|
+
/***/ 145
|
|
112
|
+
(__unused_webpack_module, exports) {
|
|
36
113
|
|
|
37
|
-
|
|
114
|
+
"use strict";
|
|
38
115
|
|
|
39
|
-
|
|
40
|
-
|
|
116
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
117
|
+
exports.crypto = void 0;
|
|
118
|
+
exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
119
|
+
//# sourceMappingURL=crypto.js.map
|
|
41
120
|
|
|
42
|
-
|
|
121
|
+
/***/ },
|
|
43
122
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;
|
|
47
|
-
var clientId = pad((mimeTypesLength +
|
|
48
|
-
navigator.userAgent.length).toString(36) +
|
|
49
|
-
globalCount.toString(36), 4);
|
|
123
|
+
/***/ 955
|
|
124
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
50
125
|
|
|
51
|
-
|
|
52
|
-
return clientId;
|
|
53
|
-
};
|
|
126
|
+
"use strict";
|
|
54
127
|
|
|
128
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129
|
+
exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;
|
|
130
|
+
exports.keccakP = keccakP;
|
|
131
|
+
/**
|
|
132
|
+
* SHA3 (keccak) hash function, based on a new "Sponge function" design.
|
|
133
|
+
* Different from older hashes, the internal state is bigger than output size.
|
|
134
|
+
*
|
|
135
|
+
* Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),
|
|
136
|
+
* [Website](https://keccak.team/keccak.html),
|
|
137
|
+
* [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).
|
|
138
|
+
*
|
|
139
|
+
* Check out `sha3-addons` module for cSHAKE, k12, and others.
|
|
140
|
+
* @module
|
|
141
|
+
*/
|
|
142
|
+
const _u64_ts_1 = __webpack_require__(318);
|
|
143
|
+
// prettier-ignore
|
|
144
|
+
const utils_ts_1 = __webpack_require__(175);
|
|
145
|
+
// No __PURE__ annotations in sha3 header:
|
|
146
|
+
// EVERYTHING is in fact used on every export.
|
|
147
|
+
// Various per round constants calculations
|
|
148
|
+
const _0n = BigInt(0);
|
|
149
|
+
const _1n = BigInt(1);
|
|
150
|
+
const _2n = BigInt(2);
|
|
151
|
+
const _7n = BigInt(7);
|
|
152
|
+
const _256n = BigInt(256);
|
|
153
|
+
const _0x71n = BigInt(0x71);
|
|
154
|
+
const SHA3_PI = [];
|
|
155
|
+
const SHA3_ROTL = [];
|
|
156
|
+
const _SHA3_IOTA = [];
|
|
157
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
158
|
+
// Pi
|
|
159
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
160
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
161
|
+
// Rotational
|
|
162
|
+
SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
|
|
163
|
+
// Iota
|
|
164
|
+
let t = _0n;
|
|
165
|
+
for (let j = 0; j < 7; j++) {
|
|
166
|
+
R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
|
|
167
|
+
if (R & _2n)
|
|
168
|
+
t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);
|
|
169
|
+
}
|
|
170
|
+
_SHA3_IOTA.push(t);
|
|
171
|
+
}
|
|
172
|
+
const IOTAS = (0, _u64_ts_1.split)(_SHA3_IOTA, true);
|
|
173
|
+
const SHA3_IOTA_H = IOTAS[0];
|
|
174
|
+
const SHA3_IOTA_L = IOTAS[1];
|
|
175
|
+
// Left rotation (without 0, 32, 64)
|
|
176
|
+
const rotlH = (h, l, s) => (s > 32 ? (0, _u64_ts_1.rotlBH)(h, l, s) : (0, _u64_ts_1.rotlSH)(h, l, s));
|
|
177
|
+
const rotlL = (h, l, s) => (s > 32 ? (0, _u64_ts_1.rotlBL)(h, l, s) : (0, _u64_ts_1.rotlSL)(h, l, s));
|
|
178
|
+
/** `keccakf1600` internal function, additionally allows to adjust round count. */
|
|
179
|
+
function keccakP(s, rounds = 24) {
|
|
180
|
+
const B = new Uint32Array(5 * 2);
|
|
181
|
+
// NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
|
|
182
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
183
|
+
// Theta θ
|
|
184
|
+
for (let x = 0; x < 10; x++)
|
|
185
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
186
|
+
for (let x = 0; x < 10; x += 2) {
|
|
187
|
+
const idx1 = (x + 8) % 10;
|
|
188
|
+
const idx0 = (x + 2) % 10;
|
|
189
|
+
const B0 = B[idx0];
|
|
190
|
+
const B1 = B[idx0 + 1];
|
|
191
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
192
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
193
|
+
for (let y = 0; y < 50; y += 10) {
|
|
194
|
+
s[x + y] ^= Th;
|
|
195
|
+
s[x + y + 1] ^= Tl;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Rho (ρ) and Pi (π)
|
|
199
|
+
let curH = s[2];
|
|
200
|
+
let curL = s[3];
|
|
201
|
+
for (let t = 0; t < 24; t++) {
|
|
202
|
+
const shift = SHA3_ROTL[t];
|
|
203
|
+
const Th = rotlH(curH, curL, shift);
|
|
204
|
+
const Tl = rotlL(curH, curL, shift);
|
|
205
|
+
const PI = SHA3_PI[t];
|
|
206
|
+
curH = s[PI];
|
|
207
|
+
curL = s[PI + 1];
|
|
208
|
+
s[PI] = Th;
|
|
209
|
+
s[PI + 1] = Tl;
|
|
210
|
+
}
|
|
211
|
+
// Chi (χ)
|
|
212
|
+
for (let y = 0; y < 50; y += 10) {
|
|
213
|
+
for (let x = 0; x < 10; x++)
|
|
214
|
+
B[x] = s[y + x];
|
|
215
|
+
for (let x = 0; x < 10; x++)
|
|
216
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
217
|
+
}
|
|
218
|
+
// Iota (ι)
|
|
219
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
220
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
221
|
+
}
|
|
222
|
+
(0, utils_ts_1.clean)(B);
|
|
223
|
+
}
|
|
224
|
+
/** Keccak sponge function. */
|
|
225
|
+
class Keccak extends utils_ts_1.Hash {
|
|
226
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
227
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
228
|
+
super();
|
|
229
|
+
this.pos = 0;
|
|
230
|
+
this.posOut = 0;
|
|
231
|
+
this.finished = false;
|
|
232
|
+
this.destroyed = false;
|
|
233
|
+
this.enableXOF = false;
|
|
234
|
+
this.blockLen = blockLen;
|
|
235
|
+
this.suffix = suffix;
|
|
236
|
+
this.outputLen = outputLen;
|
|
237
|
+
this.enableXOF = enableXOF;
|
|
238
|
+
this.rounds = rounds;
|
|
239
|
+
// Can be passed from user as dkLen
|
|
240
|
+
(0, utils_ts_1.anumber)(outputLen);
|
|
241
|
+
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
|
|
242
|
+
// 0 < blockLen < 200
|
|
243
|
+
if (!(0 < blockLen && blockLen < 200))
|
|
244
|
+
throw new Error('only keccak-f1600 function is supported');
|
|
245
|
+
this.state = new Uint8Array(200);
|
|
246
|
+
this.state32 = (0, utils_ts_1.u32)(this.state);
|
|
247
|
+
}
|
|
248
|
+
clone() {
|
|
249
|
+
return this._cloneInto();
|
|
250
|
+
}
|
|
251
|
+
keccak() {
|
|
252
|
+
(0, utils_ts_1.swap32IfBE)(this.state32);
|
|
253
|
+
keccakP(this.state32, this.rounds);
|
|
254
|
+
(0, utils_ts_1.swap32IfBE)(this.state32);
|
|
255
|
+
this.posOut = 0;
|
|
256
|
+
this.pos = 0;
|
|
257
|
+
}
|
|
258
|
+
update(data) {
|
|
259
|
+
(0, utils_ts_1.aexists)(this);
|
|
260
|
+
data = (0, utils_ts_1.toBytes)(data);
|
|
261
|
+
(0, utils_ts_1.abytes)(data);
|
|
262
|
+
const { blockLen, state } = this;
|
|
263
|
+
const len = data.length;
|
|
264
|
+
for (let pos = 0; pos < len;) {
|
|
265
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
266
|
+
for (let i = 0; i < take; i++)
|
|
267
|
+
state[this.pos++] ^= data[pos++];
|
|
268
|
+
if (this.pos === blockLen)
|
|
269
|
+
this.keccak();
|
|
270
|
+
}
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
273
|
+
finish() {
|
|
274
|
+
if (this.finished)
|
|
275
|
+
return;
|
|
276
|
+
this.finished = true;
|
|
277
|
+
const { state, suffix, pos, blockLen } = this;
|
|
278
|
+
// Do the padding
|
|
279
|
+
state[pos] ^= suffix;
|
|
280
|
+
if ((suffix & 0x80) !== 0 && pos === blockLen - 1)
|
|
281
|
+
this.keccak();
|
|
282
|
+
state[blockLen - 1] ^= 0x80;
|
|
283
|
+
this.keccak();
|
|
284
|
+
}
|
|
285
|
+
writeInto(out) {
|
|
286
|
+
(0, utils_ts_1.aexists)(this, false);
|
|
287
|
+
(0, utils_ts_1.abytes)(out);
|
|
288
|
+
this.finish();
|
|
289
|
+
const bufferOut = this.state;
|
|
290
|
+
const { blockLen } = this;
|
|
291
|
+
for (let pos = 0, len = out.length; pos < len;) {
|
|
292
|
+
if (this.posOut >= blockLen)
|
|
293
|
+
this.keccak();
|
|
294
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
295
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
296
|
+
this.posOut += take;
|
|
297
|
+
pos += take;
|
|
298
|
+
}
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
xofInto(out) {
|
|
302
|
+
// Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
|
|
303
|
+
if (!this.enableXOF)
|
|
304
|
+
throw new Error('XOF is not possible for this instance');
|
|
305
|
+
return this.writeInto(out);
|
|
306
|
+
}
|
|
307
|
+
xof(bytes) {
|
|
308
|
+
(0, utils_ts_1.anumber)(bytes);
|
|
309
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
310
|
+
}
|
|
311
|
+
digestInto(out) {
|
|
312
|
+
(0, utils_ts_1.aoutput)(out, this);
|
|
313
|
+
if (this.finished)
|
|
314
|
+
throw new Error('digest() was already called');
|
|
315
|
+
this.writeInto(out);
|
|
316
|
+
this.destroy();
|
|
317
|
+
return out;
|
|
318
|
+
}
|
|
319
|
+
digest() {
|
|
320
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
321
|
+
}
|
|
322
|
+
destroy() {
|
|
323
|
+
this.destroyed = true;
|
|
324
|
+
(0, utils_ts_1.clean)(this.state);
|
|
325
|
+
}
|
|
326
|
+
_cloneInto(to) {
|
|
327
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
328
|
+
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
329
|
+
to.state32.set(this.state32);
|
|
330
|
+
to.pos = this.pos;
|
|
331
|
+
to.posOut = this.posOut;
|
|
332
|
+
to.finished = this.finished;
|
|
333
|
+
to.rounds = rounds;
|
|
334
|
+
// Suffix can change in cSHAKE
|
|
335
|
+
to.suffix = suffix;
|
|
336
|
+
to.outputLen = outputLen;
|
|
337
|
+
to.enableXOF = enableXOF;
|
|
338
|
+
to.destroyed = this.destroyed;
|
|
339
|
+
return to;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.Keccak = Keccak;
|
|
343
|
+
const gen = (suffix, blockLen, outputLen) => (0, utils_ts_1.createHasher)(() => new Keccak(blockLen, suffix, outputLen));
|
|
344
|
+
/** SHA3-224 hash function. */
|
|
345
|
+
exports.sha3_224 = (() => gen(0x06, 144, 224 / 8))();
|
|
346
|
+
/** SHA3-256 hash function. Different from keccak-256. */
|
|
347
|
+
exports.sha3_256 = (() => gen(0x06, 136, 256 / 8))();
|
|
348
|
+
/** SHA3-384 hash function. */
|
|
349
|
+
exports.sha3_384 = (() => gen(0x06, 104, 384 / 8))();
|
|
350
|
+
/** SHA3-512 hash function. */
|
|
351
|
+
exports.sha3_512 = (() => gen(0x06, 72, 512 / 8))();
|
|
352
|
+
/** keccak-224 hash function. */
|
|
353
|
+
exports.keccak_224 = (() => gen(0x01, 144, 224 / 8))();
|
|
354
|
+
/** keccak-256 hash function. Different from SHA3-256. */
|
|
355
|
+
exports.keccak_256 = (() => gen(0x01, 136, 256 / 8))();
|
|
356
|
+
/** keccak-384 hash function. */
|
|
357
|
+
exports.keccak_384 = (() => gen(0x01, 104, 384 / 8))();
|
|
358
|
+
/** keccak-512 hash function. */
|
|
359
|
+
exports.keccak_512 = (() => gen(0x01, 72, 512 / 8))();
|
|
360
|
+
const genShake = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
|
|
361
|
+
/** SHAKE128 XOF with 128-bit security. */
|
|
362
|
+
exports.shake128 = (() => genShake(0x1f, 168, 128 / 8))();
|
|
363
|
+
/** SHAKE256 XOF with 256-bit security. */
|
|
364
|
+
exports.shake256 = (() => genShake(0x1f, 136, 256 / 8))();
|
|
365
|
+
//# sourceMappingURL=sha3.js.map
|
|
366
|
+
|
|
367
|
+
/***/ },
|
|
368
|
+
|
|
369
|
+
/***/ 175
|
|
370
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
55
371
|
|
|
56
|
-
|
|
372
|
+
"use strict";
|
|
57
373
|
|
|
58
|
-
|
|
59
|
-
|
|
374
|
+
/**
|
|
375
|
+
* Utilities for hex, bytes, CSPRNG.
|
|
376
|
+
* @module
|
|
377
|
+
*/
|
|
378
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
379
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
380
|
+
exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
|
|
381
|
+
exports.isBytes = isBytes;
|
|
382
|
+
exports.anumber = anumber;
|
|
383
|
+
exports.abytes = abytes;
|
|
384
|
+
exports.ahash = ahash;
|
|
385
|
+
exports.aexists = aexists;
|
|
386
|
+
exports.aoutput = aoutput;
|
|
387
|
+
exports.u8 = u8;
|
|
388
|
+
exports.u32 = u32;
|
|
389
|
+
exports.clean = clean;
|
|
390
|
+
exports.createView = createView;
|
|
391
|
+
exports.rotr = rotr;
|
|
392
|
+
exports.rotl = rotl;
|
|
393
|
+
exports.byteSwap = byteSwap;
|
|
394
|
+
exports.byteSwap32 = byteSwap32;
|
|
395
|
+
exports.bytesToHex = bytesToHex;
|
|
396
|
+
exports.hexToBytes = hexToBytes;
|
|
397
|
+
exports.asyncLoop = asyncLoop;
|
|
398
|
+
exports.utf8ToBytes = utf8ToBytes;
|
|
399
|
+
exports.bytesToUtf8 = bytesToUtf8;
|
|
400
|
+
exports.toBytes = toBytes;
|
|
401
|
+
exports.kdfInputToBytes = kdfInputToBytes;
|
|
402
|
+
exports.concatBytes = concatBytes;
|
|
403
|
+
exports.checkOpts = checkOpts;
|
|
404
|
+
exports.createHasher = createHasher;
|
|
405
|
+
exports.createOptHasher = createOptHasher;
|
|
406
|
+
exports.createXOFer = createXOFer;
|
|
407
|
+
exports.randomBytes = randomBytes;
|
|
408
|
+
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
409
|
+
// node.js versions earlier than v19 don't declare it in global scope.
|
|
410
|
+
// For node.js, package.json#exports field mapping rewrites import
|
|
411
|
+
// from `crypto` to `cryptoNode`, which imports native module.
|
|
412
|
+
// Makes the utils un-importable in browsers without a bundler.
|
|
413
|
+
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
|
414
|
+
const crypto_1 = __webpack_require__(145);
|
|
415
|
+
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
416
|
+
function isBytes(a) {
|
|
417
|
+
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
|
418
|
+
}
|
|
419
|
+
/** Asserts something is positive integer. */
|
|
420
|
+
function anumber(n) {
|
|
421
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
422
|
+
throw new Error('positive integer expected, got ' + n);
|
|
423
|
+
}
|
|
424
|
+
/** Asserts something is Uint8Array. */
|
|
425
|
+
function abytes(b, ...lengths) {
|
|
426
|
+
if (!isBytes(b))
|
|
427
|
+
throw new Error('Uint8Array expected');
|
|
428
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
429
|
+
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
|
430
|
+
}
|
|
431
|
+
/** Asserts something is hash */
|
|
432
|
+
function ahash(h) {
|
|
433
|
+
if (typeof h !== 'function' || typeof h.create !== 'function')
|
|
434
|
+
throw new Error('Hash should be wrapped by utils.createHasher');
|
|
435
|
+
anumber(h.outputLen);
|
|
436
|
+
anumber(h.blockLen);
|
|
437
|
+
}
|
|
438
|
+
/** Asserts a hash instance has not been destroyed / finished */
|
|
439
|
+
function aexists(instance, checkFinished = true) {
|
|
440
|
+
if (instance.destroyed)
|
|
441
|
+
throw new Error('Hash instance has been destroyed');
|
|
442
|
+
if (checkFinished && instance.finished)
|
|
443
|
+
throw new Error('Hash#digest() has already been called');
|
|
444
|
+
}
|
|
445
|
+
/** Asserts output is properly-sized byte array */
|
|
446
|
+
function aoutput(out, instance) {
|
|
447
|
+
abytes(out);
|
|
448
|
+
const min = instance.outputLen;
|
|
449
|
+
if (out.length < min) {
|
|
450
|
+
throw new Error('digestInto() expects output buffer of length at least ' + min);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/** Cast u8 / u16 / u32 to u8. */
|
|
454
|
+
function u8(arr) {
|
|
455
|
+
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
456
|
+
}
|
|
457
|
+
/** Cast u8 / u16 / u32 to u32. */
|
|
458
|
+
function u32(arr) {
|
|
459
|
+
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
460
|
+
}
|
|
461
|
+
/** Zeroize a byte array. Warning: JS provides no guarantees. */
|
|
462
|
+
function clean(...arrays) {
|
|
463
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
464
|
+
arrays[i].fill(0);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
/** Create DataView of an array for easy byte-level manipulation. */
|
|
468
|
+
function createView(arr) {
|
|
469
|
+
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
470
|
+
}
|
|
471
|
+
/** The rotate right (circular right shift) operation for uint32 */
|
|
472
|
+
function rotr(word, shift) {
|
|
473
|
+
return (word << (32 - shift)) | (word >>> shift);
|
|
474
|
+
}
|
|
475
|
+
/** The rotate left (circular left shift) operation for uint32 */
|
|
476
|
+
function rotl(word, shift) {
|
|
477
|
+
return (word << shift) | ((word >>> (32 - shift)) >>> 0);
|
|
478
|
+
}
|
|
479
|
+
/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
|
|
480
|
+
exports.isLE = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
|
|
481
|
+
/** The byte swap operation for uint32 */
|
|
482
|
+
function byteSwap(word) {
|
|
483
|
+
return (((word << 24) & 0xff000000) |
|
|
484
|
+
((word << 8) & 0xff0000) |
|
|
485
|
+
((word >>> 8) & 0xff00) |
|
|
486
|
+
((word >>> 24) & 0xff));
|
|
487
|
+
}
|
|
488
|
+
/** Conditionally byte swap if on a big-endian platform */
|
|
489
|
+
exports.swap8IfBE = exports.isLE
|
|
490
|
+
? (n) => n
|
|
491
|
+
: (n) => byteSwap(n);
|
|
492
|
+
/** @deprecated */
|
|
493
|
+
exports.byteSwapIfBE = exports.swap8IfBE;
|
|
494
|
+
/** In place byte swap for Uint32Array */
|
|
495
|
+
function byteSwap32(arr) {
|
|
496
|
+
for (let i = 0; i < arr.length; i++) {
|
|
497
|
+
arr[i] = byteSwap(arr[i]);
|
|
498
|
+
}
|
|
499
|
+
return arr;
|
|
500
|
+
}
|
|
501
|
+
exports.swap32IfBE = exports.isLE
|
|
502
|
+
? (u) => u
|
|
503
|
+
: byteSwap32;
|
|
504
|
+
// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
|
|
505
|
+
const hasHexBuiltin = /* @__PURE__ */ (() =>
|
|
506
|
+
// @ts-ignore
|
|
507
|
+
typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();
|
|
508
|
+
// Array where index 0xf0 (240) is mapped to string 'f0'
|
|
509
|
+
const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
|
|
510
|
+
/**
|
|
511
|
+
* Convert byte array to hex string. Uses built-in function, when available.
|
|
512
|
+
* @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
|
|
513
|
+
*/
|
|
514
|
+
function bytesToHex(bytes) {
|
|
515
|
+
abytes(bytes);
|
|
516
|
+
// @ts-ignore
|
|
517
|
+
if (hasHexBuiltin)
|
|
518
|
+
return bytes.toHex();
|
|
519
|
+
// pre-caching improves the speed 6x
|
|
520
|
+
let hex = '';
|
|
521
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
522
|
+
hex += hexes[bytes[i]];
|
|
523
|
+
}
|
|
524
|
+
return hex;
|
|
525
|
+
}
|
|
526
|
+
// We use optimized technique to convert hex string to byte array
|
|
527
|
+
const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
528
|
+
function asciiToBase16(ch) {
|
|
529
|
+
if (ch >= asciis._0 && ch <= asciis._9)
|
|
530
|
+
return ch - asciis._0; // '2' => 50-48
|
|
531
|
+
if (ch >= asciis.A && ch <= asciis.F)
|
|
532
|
+
return ch - (asciis.A - 10); // 'B' => 66-(65-10)
|
|
533
|
+
if (ch >= asciis.a && ch <= asciis.f)
|
|
534
|
+
return ch - (asciis.a - 10); // 'b' => 98-(97-10)
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Convert hex string to byte array. Uses built-in function, when available.
|
|
539
|
+
* @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
|
540
|
+
*/
|
|
541
|
+
function hexToBytes(hex) {
|
|
542
|
+
if (typeof hex !== 'string')
|
|
543
|
+
throw new Error('hex string expected, got ' + typeof hex);
|
|
544
|
+
// @ts-ignore
|
|
545
|
+
if (hasHexBuiltin)
|
|
546
|
+
return Uint8Array.fromHex(hex);
|
|
547
|
+
const hl = hex.length;
|
|
548
|
+
const al = hl / 2;
|
|
549
|
+
if (hl % 2)
|
|
550
|
+
throw new Error('hex string expected, got unpadded hex of length ' + hl);
|
|
551
|
+
const array = new Uint8Array(al);
|
|
552
|
+
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
553
|
+
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
|
554
|
+
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
|
555
|
+
if (n1 === undefined || n2 === undefined) {
|
|
556
|
+
const char = hex[hi] + hex[hi + 1];
|
|
557
|
+
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
|
558
|
+
}
|
|
559
|
+
array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
|
|
560
|
+
}
|
|
561
|
+
return array;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* There is no setImmediate in browser and setTimeout is slow.
|
|
565
|
+
* Call of async fn will return Promise, which will be fullfiled only on
|
|
566
|
+
* next scheduler queue processing step and this is exactly what we need.
|
|
567
|
+
*/
|
|
568
|
+
const nextTick = async () => { };
|
|
569
|
+
exports.nextTick = nextTick;
|
|
570
|
+
/** Returns control to thread each 'tick' ms to avoid blocking. */
|
|
571
|
+
async function asyncLoop(iters, tick, cb) {
|
|
572
|
+
let ts = Date.now();
|
|
573
|
+
for (let i = 0; i < iters; i++) {
|
|
574
|
+
cb(i);
|
|
575
|
+
// Date.now() is not monotonic, so in case if clock goes backwards we return return control too
|
|
576
|
+
const diff = Date.now() - ts;
|
|
577
|
+
if (diff >= 0 && diff < tick)
|
|
578
|
+
continue;
|
|
579
|
+
await (0, exports.nextTick)();
|
|
580
|
+
ts += diff;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Converts string to bytes using UTF8 encoding.
|
|
585
|
+
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
586
|
+
*/
|
|
587
|
+
function utf8ToBytes(str) {
|
|
588
|
+
if (typeof str !== 'string')
|
|
589
|
+
throw new Error('string expected');
|
|
590
|
+
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Converts bytes to string using UTF8 encoding.
|
|
594
|
+
* @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
|
|
595
|
+
*/
|
|
596
|
+
function bytesToUtf8(bytes) {
|
|
597
|
+
return new TextDecoder().decode(bytes);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
601
|
+
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
602
|
+
* Keep in mind for future mutable operations.
|
|
603
|
+
*/
|
|
604
|
+
function toBytes(data) {
|
|
605
|
+
if (typeof data === 'string')
|
|
606
|
+
data = utf8ToBytes(data);
|
|
607
|
+
abytes(data);
|
|
608
|
+
return data;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Helper for KDFs: consumes uint8array or string.
|
|
612
|
+
* When string is passed, does utf8 decoding, using TextDecoder.
|
|
613
|
+
*/
|
|
614
|
+
function kdfInputToBytes(data) {
|
|
615
|
+
if (typeof data === 'string')
|
|
616
|
+
data = utf8ToBytes(data);
|
|
617
|
+
abytes(data);
|
|
618
|
+
return data;
|
|
619
|
+
}
|
|
620
|
+
/** Copies several Uint8Arrays into one. */
|
|
621
|
+
function concatBytes(...arrays) {
|
|
622
|
+
let sum = 0;
|
|
623
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
624
|
+
const a = arrays[i];
|
|
625
|
+
abytes(a);
|
|
626
|
+
sum += a.length;
|
|
627
|
+
}
|
|
628
|
+
const res = new Uint8Array(sum);
|
|
629
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
630
|
+
const a = arrays[i];
|
|
631
|
+
res.set(a, pad);
|
|
632
|
+
pad += a.length;
|
|
633
|
+
}
|
|
634
|
+
return res;
|
|
635
|
+
}
|
|
636
|
+
function checkOpts(defaults, opts) {
|
|
637
|
+
if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
|
|
638
|
+
throw new Error('options should be object or undefined');
|
|
639
|
+
const merged = Object.assign(defaults, opts);
|
|
640
|
+
return merged;
|
|
641
|
+
}
|
|
642
|
+
/** For runtime check if class implements interface */
|
|
643
|
+
class Hash {
|
|
644
|
+
}
|
|
645
|
+
exports.Hash = Hash;
|
|
646
|
+
/** Wraps hash function, creating an interface on top of it */
|
|
647
|
+
function createHasher(hashCons) {
|
|
648
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
649
|
+
const tmp = hashCons();
|
|
650
|
+
hashC.outputLen = tmp.outputLen;
|
|
651
|
+
hashC.blockLen = tmp.blockLen;
|
|
652
|
+
hashC.create = () => hashCons();
|
|
653
|
+
return hashC;
|
|
654
|
+
}
|
|
655
|
+
function createOptHasher(hashCons) {
|
|
656
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
657
|
+
const tmp = hashCons({});
|
|
658
|
+
hashC.outputLen = tmp.outputLen;
|
|
659
|
+
hashC.blockLen = tmp.blockLen;
|
|
660
|
+
hashC.create = (opts) => hashCons(opts);
|
|
661
|
+
return hashC;
|
|
662
|
+
}
|
|
663
|
+
function createXOFer(hashCons) {
|
|
664
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
665
|
+
const tmp = hashCons({});
|
|
666
|
+
hashC.outputLen = tmp.outputLen;
|
|
667
|
+
hashC.blockLen = tmp.blockLen;
|
|
668
|
+
hashC.create = (opts) => hashCons(opts);
|
|
669
|
+
return hashC;
|
|
670
|
+
}
|
|
671
|
+
exports.wrapConstructor = createHasher;
|
|
672
|
+
exports.wrapConstructorWithOpts = createOptHasher;
|
|
673
|
+
exports.wrapXOFConstructorWithOpts = createXOFer;
|
|
674
|
+
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
|
675
|
+
function randomBytes(bytesLength = 32) {
|
|
676
|
+
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
|
|
677
|
+
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
678
|
+
}
|
|
679
|
+
// Legacy Node.js compatibility
|
|
680
|
+
if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === 'function') {
|
|
681
|
+
return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
|
|
682
|
+
}
|
|
683
|
+
throw new Error('crypto.getRandomValues must be defined');
|
|
684
|
+
}
|
|
685
|
+
//# sourceMappingURL=utils.js.map
|
|
60
686
|
|
|
61
|
-
|
|
687
|
+
/***/ },
|
|
62
688
|
|
|
63
|
-
/***/
|
|
689
|
+
/***/ 410
|
|
690
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
64
691
|
|
|
65
|
-
|
|
66
|
-
|
|
692
|
+
var __webpack_unused_export__;
|
|
693
|
+
const { createId, init, getConstants, isCuid } = __webpack_require__(859);
|
|
67
694
|
|
|
68
|
-
module.exports =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
695
|
+
module.exports.sX = createId;
|
|
696
|
+
__webpack_unused_export__ = init;
|
|
697
|
+
__webpack_unused_export__ = getConstants;
|
|
698
|
+
__webpack_unused_export__ = isCuid;
|
|
72
699
|
|
|
73
700
|
|
|
74
|
-
/***/ }
|
|
701
|
+
/***/ },
|
|
75
702
|
|
|
76
|
-
/***/
|
|
77
|
-
|
|
703
|
+
/***/ 859
|
|
704
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
78
705
|
|
|
79
|
-
|
|
706
|
+
/* global global, window, module */
|
|
707
|
+
const { sha3_512: sha3 } = __webpack_require__(955);
|
|
80
708
|
|
|
81
|
-
|
|
709
|
+
const defaultLength = 24;
|
|
710
|
+
const bigLength = 32;
|
|
82
711
|
|
|
83
|
-
|
|
84
|
-
|
|
712
|
+
const createEntropy = (length = 4, random = Math.random) => {
|
|
713
|
+
let entropy = "";
|
|
85
714
|
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
* Extracted from CLCTR
|
|
93
|
-
*
|
|
94
|
-
* Copyright (c) Eric Elliott 2012
|
|
95
|
-
* MIT License
|
|
96
|
-
*/
|
|
715
|
+
while (entropy.length < length) {
|
|
716
|
+
entropy = entropy + Math.floor(random() * 36).toString(36);
|
|
717
|
+
}
|
|
718
|
+
return entropy;
|
|
719
|
+
};
|
|
97
720
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
721
|
+
/*
|
|
722
|
+
* Adapted from https://github.com/juanelas/bigint-conversion
|
|
723
|
+
* MIT License Copyright (c) 2018 Juan Hernández Serrano
|
|
724
|
+
*/
|
|
725
|
+
function bufToBigInt(buf) {
|
|
726
|
+
let bits = 8n;
|
|
727
|
+
|
|
728
|
+
let value = 0n;
|
|
729
|
+
for (const i of buf.values()) {
|
|
730
|
+
const bi = BigInt(i);
|
|
731
|
+
value = (value << bits) + bi;
|
|
732
|
+
}
|
|
733
|
+
return value;
|
|
734
|
+
}
|
|
101
735
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
736
|
+
const hash = (input = "") => {
|
|
737
|
+
// Drop the first character because it will bias the histogram
|
|
738
|
+
// to the left.
|
|
739
|
+
return bufToBigInt(sha3(input)).toString(36).slice(1);
|
|
740
|
+
};
|
|
106
741
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
742
|
+
const alphabet = Array.from({ length: 26 }, (x, i) =>
|
|
743
|
+
String.fromCharCode(i + 97)
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
const randomLetter = (random) =>
|
|
747
|
+
alphabet[Math.floor(random() * alphabet.length)];
|
|
748
|
+
|
|
749
|
+
/*
|
|
750
|
+
This is a fingerprint of the host environment. It is used to help
|
|
751
|
+
prevent collisions when generating ids in a distributed system.
|
|
752
|
+
If no global object is available, you can pass in your own, or fall back
|
|
753
|
+
on a random string.
|
|
754
|
+
*/
|
|
755
|
+
const createFingerprint = ({
|
|
756
|
+
globalObj = typeof globalThis !== "undefined"
|
|
757
|
+
? globalThis
|
|
758
|
+
: typeof window !== "undefined"
|
|
759
|
+
? window
|
|
760
|
+
: {},
|
|
761
|
+
random = Math.random,
|
|
762
|
+
} = {}) => {
|
|
763
|
+
const globals = Object.keys(globalObj).toString();
|
|
764
|
+
const sourceString = globals.length
|
|
765
|
+
? globals + createEntropy(bigLength, random)
|
|
766
|
+
: createEntropy(bigLength, random);
|
|
767
|
+
|
|
768
|
+
return hash(sourceString).substring(0, bigLength);
|
|
769
|
+
};
|
|
112
770
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return c - 1;
|
|
117
|
-
}
|
|
771
|
+
const createCounter = (count) => () => {
|
|
772
|
+
return count++;
|
|
773
|
+
};
|
|
118
774
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
775
|
+
// ~22k hosts before 50% chance of initial counter collision
|
|
776
|
+
// with a remaining counter range of 9.0e+15 in JavaScript.
|
|
777
|
+
const initialCountMax = 476782367;
|
|
778
|
+
|
|
779
|
+
const init = ({
|
|
780
|
+
// Fallback if the user does not pass in a CSPRNG. This should be OK
|
|
781
|
+
// because we don't rely solely on the random number generator for entropy.
|
|
782
|
+
// We also use the host fingerprint, current time, and a session counter.
|
|
783
|
+
random = Math.random,
|
|
784
|
+
counter = createCounter(Math.floor(random() * initialCountMax)),
|
|
785
|
+
length = defaultLength,
|
|
786
|
+
fingerprint = createFingerprint({ random }),
|
|
787
|
+
} = {}) => {
|
|
788
|
+
return function cuid2() {
|
|
789
|
+
const firstLetter = randomLetter(random);
|
|
790
|
+
|
|
791
|
+
// If we're lucky, the `.toString(36)` calls may reduce hashing rounds
|
|
792
|
+
// by shortening the input to the hash function a little.
|
|
793
|
+
const time = Date.now().toString(36);
|
|
794
|
+
const count = counter().toString(36);
|
|
795
|
+
|
|
796
|
+
// The salt should be long enough to be globally unique across the full
|
|
797
|
+
// length of the hash. For simplicity, we use the same length as the
|
|
798
|
+
// intended id output.
|
|
799
|
+
const salt = createEntropy(length, random);
|
|
800
|
+
const hashInput = `${time + salt + count + fingerprint}`;
|
|
801
|
+
|
|
802
|
+
return `${firstLetter + hash(hashInput).substring(1, length)}`;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
123
805
|
|
|
124
|
-
|
|
125
|
-
// warning: this exposes the exact date and time
|
|
126
|
-
// that the uid was created.
|
|
127
|
-
timestamp = (new Date().getTime()).toString(base),
|
|
806
|
+
const createId = init();
|
|
128
807
|
|
|
129
|
-
|
|
130
|
-
|
|
808
|
+
const isCuid = (id, { minLength = 2, maxLength = bigLength } = {}) => {
|
|
809
|
+
const length = id.length;
|
|
810
|
+
const regex = /^[0-9a-z]+$/;
|
|
131
811
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
812
|
+
try {
|
|
813
|
+
if (
|
|
814
|
+
typeof id === "string" &&
|
|
815
|
+
length >= minLength &&
|
|
816
|
+
length <= maxLength &&
|
|
817
|
+
regex.test(id)
|
|
818
|
+
)
|
|
819
|
+
return true;
|
|
820
|
+
} finally {
|
|
821
|
+
}
|
|
136
822
|
|
|
137
|
-
|
|
138
|
-
|
|
823
|
+
return false;
|
|
824
|
+
};
|
|
139
825
|
|
|
140
|
-
|
|
141
|
-
|
|
826
|
+
module.exports.getConstants = () => ({ defaultLength, bigLength });
|
|
827
|
+
module.exports.init = init;
|
|
828
|
+
module.exports.createId = createId;
|
|
829
|
+
module.exports.bufToBigInt = bufToBigInt;
|
|
830
|
+
module.exports.createCounter = createCounter;
|
|
831
|
+
module.exports.createFingerprint = createFingerprint;
|
|
832
|
+
module.exports.isCuid = isCuid;
|
|
142
833
|
|
|
143
|
-
cuid.slug = function slug () {
|
|
144
|
-
var date = new Date().getTime().toString(36),
|
|
145
|
-
counter = safeCounter().toString(36).slice(-4),
|
|
146
|
-
print = fingerprint().slice(0, 1) +
|
|
147
|
-
fingerprint().slice(-1),
|
|
148
|
-
random = randomBlock().slice(-2);
|
|
149
834
|
|
|
150
|
-
|
|
151
|
-
counter + print + random;
|
|
152
|
-
};
|
|
835
|
+
/***/ },
|
|
153
836
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (stringToCheck.startsWith('c')) return true;
|
|
157
|
-
return false;
|
|
158
|
-
};
|
|
837
|
+
/***/ 353
|
|
838
|
+
(module) {
|
|
159
839
|
|
|
160
|
-
|
|
161
|
-
if (typeof stringToCheck !== 'string') return false;
|
|
162
|
-
var stringLength = stringToCheck.length;
|
|
163
|
-
if (stringLength >= 7 && stringLength <= 10) return true;
|
|
164
|
-
return false;
|
|
165
|
-
};
|
|
840
|
+
!function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
166
841
|
|
|
167
|
-
|
|
842
|
+
/***/ },
|
|
168
843
|
|
|
169
|
-
|
|
844
|
+
/***/ 569
|
|
845
|
+
(module) {
|
|
170
846
|
|
|
847
|
+
!function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10))}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return(o.utc(h).valueOf()-(v-=v%1e3))/6e4},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,!0),e){var m=n.utcOffset();n=n.add(i-m,"minute")}return n.$x.$timezone=t,n},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return[i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t}}}));
|
|
171
848
|
|
|
172
|
-
/***/ }
|
|
849
|
+
/***/ },
|
|
173
850
|
|
|
174
|
-
/***/ 826
|
|
175
|
-
|
|
851
|
+
/***/ 826
|
|
852
|
+
(module) {
|
|
176
853
|
|
|
177
|
-
!function(t,i){ true?module.exports=i():0}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var
|
|
854
|
+
!function(t,i){ true?module.exports=i():0}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t)};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=!1,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return"s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)}}}));
|
|
178
855
|
|
|
179
|
-
/***/ }
|
|
856
|
+
/***/ }
|
|
180
857
|
|
|
181
858
|
/******/ });
|
|
182
859
|
/************************************************************************/
|
|
@@ -698,9 +1375,8 @@ class CotomyDebugSettings {
|
|
|
698
1375
|
}
|
|
699
1376
|
CotomyDebugSettings.PREFIX = "cotomy:debug";
|
|
700
1377
|
|
|
701
|
-
// EXTERNAL MODULE: ./node_modules/
|
|
702
|
-
var
|
|
703
|
-
var cuid_default = /*#__PURE__*/__webpack_require__.n(cuid);
|
|
1378
|
+
// EXTERNAL MODULE: ./node_modules/@paralleldrive/cuid2/index.js
|
|
1379
|
+
var cuid2 = __webpack_require__(410);
|
|
704
1380
|
;// ./src/view.ts
|
|
705
1381
|
|
|
706
1382
|
|
|
@@ -978,7 +1654,7 @@ class CotomyElement {
|
|
|
978
1654
|
}
|
|
979
1655
|
setInstanceId() {
|
|
980
1656
|
if (!this.hasAttribute("data-cotomy-instance")) {
|
|
981
|
-
this.attribute("data-cotomy-instance",
|
|
1657
|
+
this.attribute("data-cotomy-instance", (0,cuid2/* createId */.sX)());
|
|
982
1658
|
this.removed(() => {
|
|
983
1659
|
this._element = CotomyElement.createHTMLElement(`<div data-cotomy-invalidated style="display: none;"></div>`);
|
|
984
1660
|
EventRegistry.instance.clear(this);
|
|
@@ -998,7 +1674,7 @@ class CotomyElement {
|
|
|
998
1674
|
}
|
|
999
1675
|
get scopeId() {
|
|
1000
1676
|
if (!this.hasAttribute("data-cotomy-scopeid")) {
|
|
1001
|
-
this.attribute("data-cotomy-scopeid",
|
|
1677
|
+
this.attribute("data-cotomy-scopeid", (0,cuid2/* createId */.sX)());
|
|
1002
1678
|
}
|
|
1003
1679
|
return this.attribute("data-cotomy-scopeid");
|
|
1004
1680
|
}
|
|
@@ -1049,7 +1725,7 @@ class CotomyElement {
|
|
|
1049
1725
|
}
|
|
1050
1726
|
generateId(prefix = "__cotomy_elem__") {
|
|
1051
1727
|
if (!this.id) {
|
|
1052
|
-
this.attribute("id", `${prefix}${
|
|
1728
|
+
this.attribute("id", `${prefix}${(0,cuid2/* createId */.sX)()}`);
|
|
1053
1729
|
}
|
|
1054
1730
|
return this;
|
|
1055
1731
|
}
|