hyoo_sync_client 0.0.377 → 0.0.379
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/node.d.ts +176 -177
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +1738 -1736
- package/node.js.map +1 -1
- package/node.mjs +1738 -1736
- package/node.test.js +1824 -1822
- package/node.test.js.map +1 -1
- package/package.json +17 -17
package/node.test.js
CHANGED
|
@@ -235,1568 +235,1124 @@ var $;
|
|
|
235
235
|
"use strict";
|
|
236
236
|
var $;
|
|
237
237
|
(function ($) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
243
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
244
|
-
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
238
|
+
function $mol_promise_like(val) {
|
|
239
|
+
return val && typeof val === 'object' && 'then' in val && typeof val.then === 'function';
|
|
240
|
+
}
|
|
241
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
245
242
|
})($ || ($ = {}));
|
|
246
243
|
|
|
247
244
|
;
|
|
248
245
|
"use strict";
|
|
249
246
|
var $;
|
|
250
247
|
(function ($) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return Array;
|
|
255
|
-
}
|
|
256
|
-
sub_from = 0;
|
|
257
|
-
get sub_list() {
|
|
258
|
-
const res = [];
|
|
259
|
-
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
260
|
-
res.push(this.data[i]);
|
|
261
|
-
}
|
|
262
|
-
return res;
|
|
263
|
-
}
|
|
264
|
-
get sub_empty() {
|
|
265
|
-
return this.sub_from === this.data.length;
|
|
266
|
-
}
|
|
267
|
-
sub_on(sub, pub_pos) {
|
|
268
|
-
const pos = this.data.length;
|
|
269
|
-
this.data.push(sub, pub_pos);
|
|
270
|
-
return pos;
|
|
271
|
-
}
|
|
272
|
-
sub_off(sub_pos) {
|
|
273
|
-
if (!(sub_pos < this.data.length)) {
|
|
274
|
-
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
275
|
-
}
|
|
276
|
-
const end = this.data.length - 2;
|
|
277
|
-
if (sub_pos !== end) {
|
|
278
|
-
this.peer_move(end, sub_pos);
|
|
279
|
-
}
|
|
280
|
-
this.data.pop();
|
|
281
|
-
this.data.pop();
|
|
282
|
-
if (this.data.length === this.sub_from)
|
|
283
|
-
this.reap();
|
|
284
|
-
}
|
|
285
|
-
reap() { }
|
|
286
|
-
promote() {
|
|
287
|
-
$mol_wire_auto()?.track_next(this);
|
|
288
|
-
}
|
|
289
|
-
fresh() { }
|
|
290
|
-
complete() { }
|
|
291
|
-
get incompleted() {
|
|
248
|
+
const catched = new WeakMap();
|
|
249
|
+
function $mol_fail_catch(error) {
|
|
250
|
+
if (typeof error !== 'object')
|
|
292
251
|
return false;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
peer_move(from_pos, to_pos) {
|
|
301
|
-
const peer = this.data[from_pos];
|
|
302
|
-
const self_pos = this.data[from_pos + 1];
|
|
303
|
-
this.data[to_pos] = peer;
|
|
304
|
-
this.data[to_pos + 1] = self_pos;
|
|
305
|
-
peer.peer_repos(self_pos, to_pos);
|
|
306
|
-
}
|
|
307
|
-
peer_repos(peer_pos, self_pos) {
|
|
308
|
-
this.data[peer_pos + 1] = self_pos;
|
|
309
|
-
}
|
|
252
|
+
if ($mol_promise_like(error))
|
|
253
|
+
$mol_fail_hidden(error);
|
|
254
|
+
if (catched.get(error))
|
|
255
|
+
return false;
|
|
256
|
+
catched.set(error, true);
|
|
257
|
+
return true;
|
|
310
258
|
}
|
|
311
|
-
$.$
|
|
259
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
312
260
|
})($ || ($ = {}));
|
|
313
261
|
|
|
314
|
-
;
|
|
315
|
-
"use strict";
|
|
316
|
-
|
|
317
262
|
;
|
|
318
263
|
"use strict";
|
|
319
264
|
var $;
|
|
320
265
|
(function ($) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
266
|
+
function $mol_fail_log(error) {
|
|
267
|
+
if ($mol_promise_like(error))
|
|
268
|
+
return false;
|
|
269
|
+
if (!$mol_fail_catch(error))
|
|
270
|
+
return false;
|
|
271
|
+
console.error(error);
|
|
272
|
+
return true;
|
|
324
273
|
}
|
|
325
|
-
$.$
|
|
326
|
-
$.$mol_wire_affected = [];
|
|
274
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
327
275
|
})($ || ($ = {}));
|
|
328
276
|
|
|
329
277
|
;
|
|
330
278
|
"use strict";
|
|
331
|
-
var
|
|
332
|
-
(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
279
|
+
var $node = new Proxy({ require }, {
|
|
280
|
+
get(target, name, wrapper) {
|
|
281
|
+
if (target[name])
|
|
282
|
+
return target[name];
|
|
283
|
+
const mod = target.require('module');
|
|
284
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
285
|
+
return target.require(name);
|
|
286
|
+
if (name[0] === '.')
|
|
287
|
+
return target.require(name);
|
|
288
|
+
const path = target.require('path');
|
|
289
|
+
const fs = target.require('fs');
|
|
290
|
+
let dir = path.resolve('.');
|
|
291
|
+
const suffix = `./node_modules/${name}`;
|
|
292
|
+
const $$ = $;
|
|
293
|
+
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
294
|
+
const parent = path.resolve(dir, '..');
|
|
295
|
+
if (parent === dir) {
|
|
296
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
347
297
|
try {
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
catch (error) {
|
|
351
|
-
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
298
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
352
299
|
}
|
|
300
|
+
catch { }
|
|
301
|
+
break;
|
|
353
302
|
}
|
|
354
|
-
|
|
355
|
-
|
|
303
|
+
else {
|
|
304
|
+
dir = parent;
|
|
356
305
|
}
|
|
357
|
-
|
|
358
|
-
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
return target.require(name);
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
312
|
+
const module = cache.get(name);
|
|
313
|
+
if (module)
|
|
314
|
+
return module;
|
|
315
|
+
throw import(name).then(module => cache.set(name, module));
|
|
359
316
|
}
|
|
317
|
+
$.$mol_fail_log(error);
|
|
360
318
|
return null;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
function $
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
styles.push(`${key} : ${style[key]}`);
|
|
393
|
-
return [
|
|
394
|
-
element,
|
|
395
|
-
{
|
|
396
|
-
style: styles.join(' ; '),
|
|
397
|
-
},
|
|
398
|
-
...content,
|
|
399
|
-
];
|
|
400
|
-
}
|
|
401
|
-
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
402
|
-
function $mol_dev_format_span(style, ...content) {
|
|
403
|
-
return $mol_dev_format_element('span', {
|
|
404
|
-
...style,
|
|
405
|
-
}, ...content);
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
set(target, name, value) {
|
|
322
|
+
target[name] = value;
|
|
323
|
+
return true;
|
|
324
|
+
},
|
|
325
|
+
});
|
|
326
|
+
const cache = new Map();
|
|
327
|
+
require = (req => Object.assign(function require(name) {
|
|
328
|
+
return $node[name];
|
|
329
|
+
}, req))(require);
|
|
330
|
+
|
|
331
|
+
;
|
|
332
|
+
"use strict";
|
|
333
|
+
var $;
|
|
334
|
+
(function ($) {
|
|
335
|
+
function $mol_log3_area_lazy(event) {
|
|
336
|
+
const self = this;
|
|
337
|
+
const stack = self.$mol_log3_stack;
|
|
338
|
+
const deep = stack.length;
|
|
339
|
+
let logged = false;
|
|
340
|
+
stack.push(() => {
|
|
341
|
+
logged = true;
|
|
342
|
+
self.$mol_log3_area.call(self, event);
|
|
343
|
+
});
|
|
344
|
+
return () => {
|
|
345
|
+
if (logged)
|
|
346
|
+
self.console.groupEnd();
|
|
347
|
+
if (stack.length > deep)
|
|
348
|
+
stack.length = deep;
|
|
349
|
+
};
|
|
406
350
|
}
|
|
407
|
-
$.$
|
|
408
|
-
$.$
|
|
409
|
-
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
410
|
-
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
411
|
-
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
412
|
-
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
413
|
-
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
414
|
-
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
415
|
-
'color': 'magenta',
|
|
416
|
-
});
|
|
417
|
-
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
418
|
-
'font-weight': 'bold',
|
|
419
|
-
});
|
|
420
|
-
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
421
|
-
'color': 'green',
|
|
422
|
-
});
|
|
423
|
-
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
424
|
-
'color': 'gray',
|
|
425
|
-
});
|
|
426
|
-
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
427
|
-
'margin-left': '13px'
|
|
428
|
-
});
|
|
351
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
352
|
+
$.$mol_log3_stack = [];
|
|
429
353
|
})($ || ($ = {}));
|
|
430
354
|
|
|
431
355
|
;
|
|
432
356
|
"use strict";
|
|
433
357
|
var $;
|
|
434
358
|
(function ($) {
|
|
435
|
-
class $
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
track_on() {
|
|
451
|
-
this.cursor = this.pub_from;
|
|
452
|
-
const sub = $mol_wire_auto();
|
|
453
|
-
$mol_wire_auto(this);
|
|
454
|
-
return sub;
|
|
455
|
-
}
|
|
456
|
-
promote() {
|
|
457
|
-
if (this.cursor >= this.pub_from) {
|
|
458
|
-
$mol_fail(new Error('Circular subscription'));
|
|
459
|
-
}
|
|
460
|
-
super.promote();
|
|
359
|
+
class $mol_span extends $mol_object2 {
|
|
360
|
+
uri;
|
|
361
|
+
source;
|
|
362
|
+
row;
|
|
363
|
+
col;
|
|
364
|
+
length;
|
|
365
|
+
constructor(uri, source, row, col, length) {
|
|
366
|
+
super();
|
|
367
|
+
this.uri = uri;
|
|
368
|
+
this.source = source;
|
|
369
|
+
this.row = row;
|
|
370
|
+
this.col = col;
|
|
371
|
+
this.length = length;
|
|
372
|
+
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
461
373
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (this.cursor < this.sub_from) {
|
|
466
|
-
const next = this.data[this.cursor];
|
|
467
|
-
if (pub === undefined)
|
|
468
|
-
return next ?? null;
|
|
469
|
-
if (next === pub) {
|
|
470
|
-
this.cursor += 2;
|
|
471
|
-
return next;
|
|
472
|
-
}
|
|
473
|
-
if (next) {
|
|
474
|
-
if (this.sub_from < this.data.length) {
|
|
475
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
476
|
-
}
|
|
477
|
-
this.peer_move(this.cursor, this.sub_from);
|
|
478
|
-
this.sub_from += 2;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
if (pub === undefined)
|
|
483
|
-
return null;
|
|
484
|
-
if (this.sub_from < this.data.length) {
|
|
485
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
486
|
-
}
|
|
487
|
-
this.sub_from += 2;
|
|
488
|
-
}
|
|
489
|
-
this.data[this.cursor] = pub;
|
|
490
|
-
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
491
|
-
this.cursor += 2;
|
|
492
|
-
return pub;
|
|
374
|
+
static unknown = $mol_span.begin('?');
|
|
375
|
+
static begin(uri, source = '') {
|
|
376
|
+
return new $mol_span(uri, source, 1, 1, 0);
|
|
493
377
|
}
|
|
494
|
-
|
|
495
|
-
$
|
|
496
|
-
if (this.cursor < 0) {
|
|
497
|
-
$mol_fail(new Error('End of non begun sub'));
|
|
498
|
-
}
|
|
499
|
-
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
500
|
-
const pub = this.data[cursor];
|
|
501
|
-
pub.fresh();
|
|
502
|
-
}
|
|
503
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
378
|
+
static end(uri, source) {
|
|
379
|
+
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
504
380
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
this.data[sub_pos + 1] = undefined;
|
|
381
|
+
static entire(uri, source) {
|
|
382
|
+
return new $mol_span(uri, source, 1, 1, source.length);
|
|
508
383
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
const sub = this.data[cursor];
|
|
512
|
-
const pos = this.data[cursor + 1];
|
|
513
|
-
sub.pub_off(pos);
|
|
514
|
-
this.data.pop();
|
|
515
|
-
this.data.pop();
|
|
516
|
-
}
|
|
517
|
-
this.cursor = this.pub_from;
|
|
518
|
-
this.track_cut();
|
|
519
|
-
this.cursor = $mol_wire_cursor.final;
|
|
384
|
+
toString() {
|
|
385
|
+
return this[Symbol.toStringTag];
|
|
520
386
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
pub?.sub_off(this.data[cursor + 1]);
|
|
529
|
-
if (this.sub_from < this.data.length) {
|
|
530
|
-
this.peer_move(this.data.length - 2, cursor);
|
|
531
|
-
this.data.pop();
|
|
532
|
-
this.data.pop();
|
|
533
|
-
}
|
|
534
|
-
else {
|
|
535
|
-
++tail;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
for (; tail; --tail) {
|
|
539
|
-
this.data.pop();
|
|
540
|
-
this.data.pop();
|
|
541
|
-
}
|
|
542
|
-
this.sub_from = this.cursor;
|
|
387
|
+
toJSON() {
|
|
388
|
+
return {
|
|
389
|
+
uri: this.uri,
|
|
390
|
+
row: this.row,
|
|
391
|
+
col: this.col,
|
|
392
|
+
length: this.length
|
|
393
|
+
};
|
|
543
394
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
547
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
548
|
-
const pub = this.data[cursor];
|
|
549
|
-
if (pub?.incompleted)
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
553
|
-
const pub = this.data[cursor];
|
|
554
|
-
pub?.complete();
|
|
555
|
-
}
|
|
395
|
+
error(message, Class = Error) {
|
|
396
|
+
return new Class(`${message} (${this})`);
|
|
556
397
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
return;
|
|
560
|
-
if (this.cursor >= quant)
|
|
561
|
-
return;
|
|
562
|
-
this.cursor = quant;
|
|
563
|
-
this.emit($mol_wire_cursor.doubt);
|
|
398
|
+
span(row, col, length) {
|
|
399
|
+
return new $mol_span(this.uri, this.source, row, col, length);
|
|
564
400
|
}
|
|
565
|
-
|
|
566
|
-
return $
|
|
401
|
+
after(length = 0) {
|
|
402
|
+
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
567
403
|
}
|
|
568
|
-
|
|
569
|
-
|
|
404
|
+
slice(begin, end = -1) {
|
|
405
|
+
let len = this.length;
|
|
406
|
+
if (begin < 0)
|
|
407
|
+
begin += len;
|
|
408
|
+
if (end < 0)
|
|
409
|
+
end += len;
|
|
410
|
+
if (begin < 0 || begin > len)
|
|
411
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
412
|
+
if (end < 0 || end > len)
|
|
413
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
414
|
+
if (end < begin)
|
|
415
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
416
|
+
return this.span(this.row, this.col + begin, end - begin);
|
|
570
417
|
}
|
|
571
418
|
}
|
|
572
|
-
$.$
|
|
419
|
+
$.$mol_span = $mol_span;
|
|
573
420
|
})($ || ($ = {}));
|
|
574
421
|
|
|
575
422
|
;
|
|
576
423
|
"use strict";
|
|
577
424
|
var $;
|
|
578
425
|
(function ($) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
426
|
+
function $mol_tree2_to_string(tree) {
|
|
427
|
+
let output = [];
|
|
428
|
+
function dump(tree, prefix = '') {
|
|
429
|
+
if (tree.type.length) {
|
|
430
|
+
if (!prefix.length) {
|
|
431
|
+
prefix = "\t";
|
|
432
|
+
}
|
|
433
|
+
output.push(tree.type);
|
|
434
|
+
if (tree.kids.length == 1) {
|
|
435
|
+
output.push(' ');
|
|
436
|
+
dump(tree.kids[0], prefix);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
output.push("\n");
|
|
440
|
+
}
|
|
441
|
+
else if (tree.value.length || prefix.length) {
|
|
442
|
+
output.push("\\" + tree.value + "\n");
|
|
443
|
+
}
|
|
444
|
+
for (const kid of tree.kids) {
|
|
445
|
+
output.push(prefix);
|
|
446
|
+
dump(kid, prefix + "\t");
|
|
447
|
+
}
|
|
591
448
|
}
|
|
449
|
+
dump(tree);
|
|
450
|
+
return output.join('');
|
|
592
451
|
}
|
|
593
|
-
$.$
|
|
452
|
+
$.$mol_tree2_to_string = $mol_tree2_to_string;
|
|
594
453
|
})($ || ($ = {}));
|
|
595
454
|
|
|
596
455
|
;
|
|
597
456
|
"use strict";
|
|
598
457
|
var $;
|
|
599
458
|
(function ($) {
|
|
600
|
-
class $
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
459
|
+
class $mol_tree2 extends Object {
|
|
460
|
+
type;
|
|
461
|
+
value;
|
|
462
|
+
kids;
|
|
463
|
+
span;
|
|
464
|
+
constructor(type, value, kids, span) {
|
|
465
|
+
super();
|
|
466
|
+
this.type = type;
|
|
467
|
+
this.value = value;
|
|
468
|
+
this.kids = kids;
|
|
469
|
+
this.span = span;
|
|
470
|
+
this[Symbol.toStringTag] = type || '\\' + value;
|
|
605
471
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
})($ || ($ = {}));
|
|
609
|
-
|
|
610
|
-
;
|
|
611
|
-
"use strict";
|
|
612
|
-
var $;
|
|
613
|
-
(function ($) {
|
|
614
|
-
function $mol_promise_like(val) {
|
|
615
|
-
return val && typeof val === 'object' && 'then' in val && typeof val.then === 'function';
|
|
616
|
-
}
|
|
617
|
-
$.$mol_promise_like = $mol_promise_like;
|
|
618
|
-
})($ || ($ = {}));
|
|
619
|
-
|
|
620
|
-
;
|
|
621
|
-
"use strict";
|
|
622
|
-
var $;
|
|
623
|
-
(function ($) {
|
|
624
|
-
const handled = new WeakSet();
|
|
625
|
-
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
626
|
-
task;
|
|
627
|
-
host;
|
|
628
|
-
static warm = true;
|
|
629
|
-
static planning = new Set();
|
|
630
|
-
static reaping = new Set();
|
|
631
|
-
static plan_task = null;
|
|
632
|
-
static plan() {
|
|
633
|
-
if (this.plan_task)
|
|
634
|
-
return;
|
|
635
|
-
this.plan_task = new $mol_after_frame(() => {
|
|
636
|
-
try {
|
|
637
|
-
this.sync();
|
|
638
|
-
}
|
|
639
|
-
finally {
|
|
640
|
-
$mol_wire_fiber.plan_task = null;
|
|
641
|
-
}
|
|
642
|
-
});
|
|
472
|
+
static list(kids, span = $mol_span.unknown) {
|
|
473
|
+
return new $mol_tree2('', '', kids, span);
|
|
643
474
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
for (const fiber of this.planning) {
|
|
647
|
-
this.planning.delete(fiber);
|
|
648
|
-
if (fiber.cursor >= 0)
|
|
649
|
-
continue;
|
|
650
|
-
if (fiber.cursor === $mol_wire_cursor.final)
|
|
651
|
-
continue;
|
|
652
|
-
fiber.fresh();
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
while (this.reaping.size) {
|
|
656
|
-
const fibers = this.reaping;
|
|
657
|
-
this.reaping = new Set;
|
|
658
|
-
for (const fiber of fibers) {
|
|
659
|
-
if (!fiber.sub_empty)
|
|
660
|
-
continue;
|
|
661
|
-
fiber.destructor();
|
|
662
|
-
}
|
|
663
|
-
}
|
|
475
|
+
list(kids) {
|
|
476
|
+
return $mol_tree2.list(kids, this.span);
|
|
664
477
|
}
|
|
665
|
-
[
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
478
|
+
static data(value, kids = [], span = $mol_span.unknown) {
|
|
479
|
+
const chunks = value.split('\n');
|
|
480
|
+
if (chunks.length > 1) {
|
|
481
|
+
let kid_span = span.span(span.row, span.col, 0);
|
|
482
|
+
const data = chunks.map(chunk => {
|
|
483
|
+
kid_span = kid_span.after(chunk.length);
|
|
484
|
+
return new $mol_tree2('', chunk, [], kid_span);
|
|
485
|
+
});
|
|
486
|
+
kids = [...data, ...kids];
|
|
487
|
+
value = '';
|
|
488
|
+
}
|
|
489
|
+
return new $mol_tree2('', value, kids, span);
|
|
669
490
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
return;
|
|
673
|
-
if (this.cache instanceof Error)
|
|
674
|
-
return;
|
|
675
|
-
return this.cache;
|
|
491
|
+
data(value, kids = []) {
|
|
492
|
+
return $mol_tree2.data(value, kids, this.span);
|
|
676
493
|
}
|
|
677
|
-
|
|
678
|
-
|
|
494
|
+
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
495
|
+
if (/[ \n\t\\]/.test(type)) {
|
|
496
|
+
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
497
|
+
}
|
|
498
|
+
return new $mol_tree2(type, '', kids, span);
|
|
679
499
|
}
|
|
680
|
-
|
|
681
|
-
return
|
|
500
|
+
struct(type, kids = []) {
|
|
501
|
+
return $mol_tree2.struct(type, kids, this.span);
|
|
682
502
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
this.task = task;
|
|
686
|
-
this.host = host;
|
|
687
|
-
if (args)
|
|
688
|
-
this.data.push(...args);
|
|
689
|
-
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
690
|
-
this[Symbol.toStringTag] = id;
|
|
503
|
+
clone(kids, span = this.span) {
|
|
504
|
+
return new $mol_tree2(this.type, this.value, kids, span);
|
|
691
505
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
506
|
+
text() {
|
|
507
|
+
var values = [];
|
|
508
|
+
for (var kid of this.kids) {
|
|
509
|
+
if (kid.type)
|
|
510
|
+
continue;
|
|
511
|
+
values.push(kid.value);
|
|
512
|
+
}
|
|
513
|
+
return this.value + values.join('\n');
|
|
695
514
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
$mol_wire_fiber.plan();
|
|
515
|
+
static fromString(str, uri = 'unknown') {
|
|
516
|
+
return $$.$mol_tree2_from_string(str, uri);
|
|
699
517
|
}
|
|
700
518
|
toString() {
|
|
701
|
-
return this
|
|
702
|
-
}
|
|
703
|
-
toJSON() {
|
|
704
|
-
return this[Symbol.toStringTag];
|
|
705
|
-
}
|
|
706
|
-
[$mol_dev_format_head]() {
|
|
707
|
-
const cursor = {
|
|
708
|
-
[$mol_wire_cursor.stale]: '🔴',
|
|
709
|
-
[$mol_wire_cursor.doubt]: '🟡',
|
|
710
|
-
[$mol_wire_cursor.fresh]: '🟢',
|
|
711
|
-
[$mol_wire_cursor.final]: '🔵',
|
|
712
|
-
}[this.cursor] ?? this.cursor.toString();
|
|
713
|
-
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
714
|
-
? $mol_dev_format_auto({
|
|
715
|
-
[$mol_dev_format_head]: () => $mol_dev_format_shade(cursor),
|
|
716
|
-
[$mol_dev_format_body]: () => $mol_dev_format_native(this),
|
|
717
|
-
})
|
|
718
|
-
: $mol_dev_format_shade($mol_dev_format_native(this), cursor), $mol_dev_format_auto(this.cache));
|
|
719
|
-
}
|
|
720
|
-
get $() {
|
|
721
|
-
return (this.host ?? this.task)['$'];
|
|
722
|
-
}
|
|
723
|
-
emit(quant = $mol_wire_cursor.stale) {
|
|
724
|
-
if (this.sub_empty)
|
|
725
|
-
this.plan();
|
|
726
|
-
else
|
|
727
|
-
super.emit(quant);
|
|
519
|
+
return $$.$mol_tree2_to_string(this);
|
|
728
520
|
}
|
|
729
|
-
|
|
730
|
-
if (
|
|
731
|
-
return;
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
521
|
+
insert(value, ...path) {
|
|
522
|
+
if (path.length === 0)
|
|
523
|
+
return value;
|
|
524
|
+
const type = path[0];
|
|
525
|
+
if (typeof type === 'string') {
|
|
526
|
+
let replaced = false;
|
|
527
|
+
const sub = this.kids.map((item, index) => {
|
|
528
|
+
if (item.type !== type)
|
|
529
|
+
return item;
|
|
530
|
+
replaced = true;
|
|
531
|
+
return item.insert(value, ...path.slice(1));
|
|
532
|
+
}).filter(Boolean);
|
|
533
|
+
if (!replaced && value) {
|
|
534
|
+
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
740
535
|
}
|
|
741
|
-
this.
|
|
742
|
-
return;
|
|
536
|
+
return this.clone(sub);
|
|
743
537
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
538
|
+
else if (typeof type === 'number') {
|
|
539
|
+
const sub = this.kids.slice();
|
|
540
|
+
sub[type] = (sub[type] || this.list([]))
|
|
541
|
+
.insert(value, ...path.slice(1));
|
|
542
|
+
return this.clone(sub.filter(Boolean));
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
546
|
+
.map(item => item.insert(value, ...path.slice(1)))
|
|
547
|
+
.filter(Boolean);
|
|
548
|
+
return this.clone(kids);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
select(...path) {
|
|
552
|
+
let next = [this];
|
|
553
|
+
for (const type of path) {
|
|
554
|
+
if (!next.length)
|
|
555
|
+
break;
|
|
556
|
+
const prev = next;
|
|
557
|
+
next = [];
|
|
558
|
+
for (var item of prev) {
|
|
559
|
+
switch (typeof (type)) {
|
|
560
|
+
case 'string':
|
|
561
|
+
for (var child of item.kids) {
|
|
562
|
+
if (child.type == type) {
|
|
563
|
+
next.push(child);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
break;
|
|
567
|
+
case 'number':
|
|
568
|
+
if (type < item.kids.length)
|
|
569
|
+
next.push(item.kids[type]);
|
|
570
|
+
break;
|
|
571
|
+
default: next.push(...item.kids);
|
|
572
|
+
}
|
|
765
573
|
}
|
|
766
574
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
575
|
+
return this.list(next);
|
|
576
|
+
}
|
|
577
|
+
filter(path, value) {
|
|
578
|
+
const sub = this.kids.filter(item => {
|
|
579
|
+
var found = item.select(...path);
|
|
580
|
+
if (value === undefined) {
|
|
581
|
+
return Boolean(found.kids.length);
|
|
770
582
|
}
|
|
771
583
|
else {
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
775
|
-
result = result.finally(() => {
|
|
776
|
-
if (this.cache === result)
|
|
777
|
-
this.absorb();
|
|
778
|
-
});
|
|
584
|
+
return found.kids.some(child => child.value == value);
|
|
779
585
|
}
|
|
586
|
+
});
|
|
587
|
+
return this.clone(sub);
|
|
588
|
+
}
|
|
589
|
+
hack_self(belt, context = {}) {
|
|
590
|
+
let handle = belt[this.type] || belt[''];
|
|
591
|
+
if (!handle || handle === Object.prototype[this.type]) {
|
|
592
|
+
handle = (input, belt, context) => [
|
|
593
|
+
input.clone(input.hack(belt, context), context.span)
|
|
594
|
+
];
|
|
780
595
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
destructor: result['destructor'] ?? (() => { })
|
|
784
|
-
});
|
|
785
|
-
handled.add(result);
|
|
786
|
-
const error = new Error(`Promise in ${this}`);
|
|
787
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
596
|
+
try {
|
|
597
|
+
return handle(this, belt, context);
|
|
788
598
|
}
|
|
789
|
-
|
|
790
|
-
this.
|
|
599
|
+
catch (error) {
|
|
600
|
+
error.message += `\n${this.clone([])}${this.span}`;
|
|
601
|
+
$mol_fail_hidden(error);
|
|
791
602
|
}
|
|
792
|
-
this.track_off(bu);
|
|
793
|
-
this.put(result);
|
|
794
603
|
}
|
|
795
|
-
|
|
796
|
-
this.
|
|
797
|
-
this.fresh();
|
|
604
|
+
hack(belt, context = {}) {
|
|
605
|
+
return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
|
|
798
606
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
607
|
+
error(message, Class = Error) {
|
|
608
|
+
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
$.$mol_tree2 = $mol_tree2;
|
|
612
|
+
class $mol_tree2_empty extends $mol_tree2 {
|
|
613
|
+
constructor() {
|
|
614
|
+
super('', '', [], $mol_span.unknown);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
618
|
+
})($ || ($ = {}));
|
|
619
|
+
|
|
620
|
+
;
|
|
621
|
+
"use strict";
|
|
622
|
+
var $;
|
|
623
|
+
(function ($) {
|
|
624
|
+
class $mol_error_syntax extends SyntaxError {
|
|
625
|
+
reason;
|
|
626
|
+
line;
|
|
627
|
+
span;
|
|
628
|
+
constructor(reason, line, span) {
|
|
629
|
+
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
630
|
+
this.reason = reason;
|
|
631
|
+
this.line = line;
|
|
632
|
+
this.span = span;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
$.$mol_error_syntax = $mol_error_syntax;
|
|
636
|
+
})($ || ($ = {}));
|
|
637
|
+
|
|
638
|
+
;
|
|
639
|
+
"use strict";
|
|
640
|
+
var $;
|
|
641
|
+
(function ($) {
|
|
642
|
+
function $mol_tree2_from_string(str, uri = '?') {
|
|
643
|
+
const span = $mol_span.entire(uri, str);
|
|
644
|
+
var root = $mol_tree2.list([], span);
|
|
645
|
+
var stack = [root];
|
|
646
|
+
var pos = 0, row = 0, min_indent = 0;
|
|
647
|
+
while (str.length > pos) {
|
|
648
|
+
var indent = 0;
|
|
649
|
+
var line_start = pos;
|
|
650
|
+
row++;
|
|
651
|
+
while (str.length > pos && str[pos] == '\t') {
|
|
652
|
+
indent++;
|
|
653
|
+
pos++;
|
|
807
654
|
}
|
|
808
|
-
if (
|
|
809
|
-
|
|
655
|
+
if (!root.kids.length) {
|
|
656
|
+
min_indent = indent;
|
|
810
657
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
if (this.cache instanceof Error) {
|
|
817
|
-
$mol_fail_hidden(this.cache);
|
|
658
|
+
indent -= min_indent;
|
|
659
|
+
if (indent < 0 || indent >= stack.length) {
|
|
660
|
+
const sp = span.span(row, 1, pos - line_start);
|
|
661
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
662
|
+
pos++;
|
|
818
663
|
}
|
|
819
|
-
if (
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
664
|
+
if (indent < 0) {
|
|
665
|
+
if (str.length > pos) {
|
|
666
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
826
671
|
}
|
|
827
672
|
}
|
|
673
|
+
stack.length = indent + 1;
|
|
674
|
+
var parent = stack[indent];
|
|
675
|
+
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
676
|
+
var error_start = pos;
|
|
677
|
+
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
678
|
+
pos++;
|
|
679
|
+
}
|
|
680
|
+
if (pos > error_start) {
|
|
681
|
+
let line_end = str.indexOf('\n', pos);
|
|
682
|
+
if (line_end === -1)
|
|
683
|
+
line_end = str.length;
|
|
684
|
+
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
685
|
+
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
686
|
+
}
|
|
687
|
+
var type_start = pos;
|
|
688
|
+
while (str.length > pos &&
|
|
689
|
+
str[pos] != '\\' &&
|
|
690
|
+
str[pos] != ' ' &&
|
|
691
|
+
str[pos] != '\t' &&
|
|
692
|
+
str[pos] != '\n') {
|
|
693
|
+
pos++;
|
|
694
|
+
}
|
|
695
|
+
if (pos > type_start) {
|
|
696
|
+
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
697
|
+
const parent_kids = parent.kids;
|
|
698
|
+
parent_kids.push(next);
|
|
699
|
+
parent = next;
|
|
700
|
+
}
|
|
701
|
+
if (str.length > pos && str[pos] == ' ') {
|
|
702
|
+
pos++;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (str.length > pos && str[pos] == '\\') {
|
|
706
|
+
var data_start = pos;
|
|
707
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
708
|
+
pos++;
|
|
709
|
+
}
|
|
710
|
+
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
711
|
+
const parent_kids = parent.kids;
|
|
712
|
+
parent_kids.push(next);
|
|
713
|
+
parent = next;
|
|
714
|
+
}
|
|
715
|
+
if (str.length === pos && stack.length > 0) {
|
|
716
|
+
const sp = span.span(row, pos - line_start + 1, 1);
|
|
717
|
+
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
718
|
+
}
|
|
719
|
+
stack.push(parent);
|
|
720
|
+
pos++;
|
|
828
721
|
}
|
|
829
|
-
|
|
830
|
-
return new Promise(done => {
|
|
831
|
-
const sub = new $mol_wire_pub_sub;
|
|
832
|
-
const prev = sub.track_on();
|
|
833
|
-
sub.track_next(this);
|
|
834
|
-
sub.track_off(prev);
|
|
835
|
-
sub.absorb = () => {
|
|
836
|
-
done(null);
|
|
837
|
-
sub.destructor();
|
|
838
|
-
};
|
|
839
|
-
});
|
|
840
|
-
}
|
|
722
|
+
return root;
|
|
841
723
|
}
|
|
842
|
-
$.$
|
|
724
|
+
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
843
725
|
})($ || ($ = {}));
|
|
844
726
|
|
|
845
727
|
;
|
|
846
728
|
"use strict";
|
|
847
729
|
var $;
|
|
848
730
|
(function ($) {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return true;
|
|
853
|
-
if (left === null)
|
|
854
|
-
return false;
|
|
855
|
-
if (right === null)
|
|
856
|
-
return false;
|
|
857
|
-
if (typeof left !== 'object')
|
|
858
|
-
return false;
|
|
859
|
-
if (typeof right !== 'object')
|
|
860
|
-
return false;
|
|
861
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
862
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
863
|
-
if (left_proto !== right_proto)
|
|
864
|
-
return false;
|
|
865
|
-
if (left instanceof Boolean)
|
|
866
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
867
|
-
if (left instanceof Number)
|
|
868
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
869
|
-
if (left instanceof String)
|
|
870
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
871
|
-
if (left instanceof Date)
|
|
872
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
873
|
-
if (left instanceof RegExp)
|
|
874
|
-
return left.source === right.source && left.flags === right.flags;
|
|
875
|
-
if (left instanceof Error)
|
|
876
|
-
return left.message === right.message && left.stack === right.stack;
|
|
877
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
878
|
-
if (left_cache) {
|
|
879
|
-
const right_cache = left_cache.get(right);
|
|
880
|
-
if (typeof right_cache === 'boolean')
|
|
881
|
-
return right_cache;
|
|
731
|
+
function $mol_tree2_from_json(json, span = $mol_span.unknown) {
|
|
732
|
+
if (typeof json === 'boolean' || typeof json === 'number' || json === null) {
|
|
733
|
+
return new $mol_tree2(String(json), '', [], span);
|
|
882
734
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
735
|
+
if (typeof json === 'string') {
|
|
736
|
+
return $mol_tree2.data(json, [], span);
|
|
886
737
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
result = compare_pojo(left, right);
|
|
891
|
-
else if (!Reflect.getPrototypeOf(left_proto))
|
|
892
|
-
result = compare_pojo(left, right);
|
|
893
|
-
else if (Symbol.toPrimitive in left)
|
|
894
|
-
result = compare_primitive(left, right);
|
|
895
|
-
else if (Array.isArray(left))
|
|
896
|
-
result = compare_array(left, right);
|
|
897
|
-
else if (left instanceof Set)
|
|
898
|
-
result = compare_set(left, right);
|
|
899
|
-
else if (left instanceof Map)
|
|
900
|
-
result = compare_map(left, right);
|
|
901
|
-
else if (ArrayBuffer.isView(left))
|
|
902
|
-
result = compare_buffer(left, right);
|
|
903
|
-
else if (Symbol.iterator in left)
|
|
904
|
-
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
905
|
-
else
|
|
906
|
-
result = false;
|
|
738
|
+
if (Array.isArray(json)) {
|
|
739
|
+
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
740
|
+
return new $mol_tree2('/', '', sub, span);
|
|
907
741
|
}
|
|
908
|
-
|
|
909
|
-
|
|
742
|
+
if (ArrayBuffer.isView(json)) {
|
|
743
|
+
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
744
|
+
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
910
745
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
914
|
-
function compare_array(left, right) {
|
|
915
|
-
const len = left.length;
|
|
916
|
-
if (len !== right.length)
|
|
917
|
-
return false;
|
|
918
|
-
for (let i = 0; i < len; ++i) {
|
|
919
|
-
if (!$mol_compare_deep(left[i], right[i]))
|
|
920
|
-
return false;
|
|
746
|
+
if (json instanceof Date) {
|
|
747
|
+
return new $mol_tree2('', json.toISOString(), [], span);
|
|
921
748
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
function compare_buffer(left, right) {
|
|
925
|
-
const len = left.byteLength;
|
|
926
|
-
if (len !== right.byteLength)
|
|
927
|
-
return false;
|
|
928
|
-
if (left instanceof DataView)
|
|
929
|
-
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
|
|
930
|
-
for (let i = 0; i < len; ++i) {
|
|
931
|
-
if (left[i] !== right[i])
|
|
932
|
-
return false;
|
|
749
|
+
if (typeof json.toJSON === 'function') {
|
|
750
|
+
return $mol_tree2_from_json(json.toJSON());
|
|
933
751
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
function compare_iterator(left, right) {
|
|
937
|
-
while (true) {
|
|
938
|
-
const left_next = left.next();
|
|
939
|
-
const right_next = right.next();
|
|
940
|
-
if (left_next.done !== right_next.done)
|
|
941
|
-
return false;
|
|
942
|
-
if (left_next.done)
|
|
943
|
-
break;
|
|
944
|
-
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
945
|
-
return false;
|
|
752
|
+
if (json.toString !== Object.prototype.toString) {
|
|
753
|
+
return $mol_tree2.data(json.toString(), [], span);
|
|
946
754
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
if (left.size !== right.size)
|
|
951
|
-
return false;
|
|
952
|
-
return compare_iterator(left.values(), right.values());
|
|
953
|
-
}
|
|
954
|
-
function compare_map(left, right) {
|
|
955
|
-
if (left.size !== right.size)
|
|
956
|
-
return false;
|
|
957
|
-
return compare_iterator(left.keys(), right.keys())
|
|
958
|
-
&& compare_iterator(left.values(), right.values());
|
|
959
|
-
}
|
|
960
|
-
function compare_pojo(left, right) {
|
|
961
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
962
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
963
|
-
if (!compare_array(left_keys, right_keys))
|
|
964
|
-
return false;
|
|
965
|
-
for (let key of left_keys) {
|
|
966
|
-
if (!$mol_compare_deep(left[key], right[key]))
|
|
967
|
-
return false;
|
|
755
|
+
if (json instanceof Error) {
|
|
756
|
+
const { name, message, stack } = json;
|
|
757
|
+
json = { ...json, name, message, stack };
|
|
968
758
|
}
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
759
|
+
const sub = [];
|
|
760
|
+
for (var key in json) {
|
|
761
|
+
const val = json[key];
|
|
762
|
+
if (val === undefined)
|
|
763
|
+
continue;
|
|
764
|
+
const subsub = $mol_tree2_from_json(val, span);
|
|
765
|
+
if (/^[^\n\t\\ ]+$/.test(key)) {
|
|
766
|
+
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
sub.push($mol_tree2.data(key, [subsub], span));
|
|
770
|
+
}
|
|
976
771
|
}
|
|
977
|
-
return
|
|
772
|
+
return new $mol_tree2('*', '', sub, span);
|
|
978
773
|
}
|
|
979
|
-
|
|
980
|
-
|
|
774
|
+
$.$mol_tree2_from_json = $mol_tree2_from_json;
|
|
775
|
+
})($ || ($ = {}));
|
|
776
|
+
|
|
777
|
+
;
|
|
778
|
+
"use strict";
|
|
779
|
+
var $;
|
|
780
|
+
(function ($) {
|
|
781
|
+
class $mol_term_color {
|
|
782
|
+
static reset = this.ansi(0, 0);
|
|
783
|
+
static bold = this.ansi(1, 22);
|
|
784
|
+
static italic = this.ansi(3, 23);
|
|
785
|
+
static underline = this.ansi(4, 24);
|
|
786
|
+
static inverse = this.ansi(7, 27);
|
|
787
|
+
static hidden = this.ansi(8, 28);
|
|
788
|
+
static strike = this.ansi(9, 29);
|
|
789
|
+
static gray = this.ansi(90, 39);
|
|
790
|
+
static red = this.ansi(91, 39);
|
|
791
|
+
static green = this.ansi(92, 39);
|
|
792
|
+
static yellow = this.ansi(93, 39);
|
|
793
|
+
static blue = this.ansi(94, 39);
|
|
794
|
+
static magenta = this.ansi(95, 39);
|
|
795
|
+
static cyan = this.ansi(96, 39);
|
|
796
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
797
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
798
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
799
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
800
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
801
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
802
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
803
|
+
static ansi(open, close) {
|
|
804
|
+
if (typeof process === 'undefined')
|
|
805
|
+
return String;
|
|
806
|
+
if (!process.stdout.isTTY)
|
|
807
|
+
return String;
|
|
808
|
+
const prefix = `\x1b[${open}m`;
|
|
809
|
+
const postfix = `\x1b[${close}m`;
|
|
810
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
811
|
+
return function colorer(str) {
|
|
812
|
+
str = String(str);
|
|
813
|
+
if (str === '')
|
|
814
|
+
return str;
|
|
815
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
816
|
+
return prefix + suffix + postfix;
|
|
817
|
+
};
|
|
818
|
+
}
|
|
981
819
|
}
|
|
820
|
+
$.$mol_term_color = $mol_term_color;
|
|
982
821
|
})($ || ($ = {}));
|
|
983
822
|
|
|
984
823
|
;
|
|
985
824
|
"use strict";
|
|
986
825
|
var $;
|
|
987
826
|
(function ($) {
|
|
988
|
-
function $
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (logged)
|
|
999
|
-
self.console.groupEnd();
|
|
1000
|
-
if (stack.length > deep)
|
|
1001
|
-
stack.length = deep;
|
|
827
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
828
|
+
return function $mol_log3_logger(event) {
|
|
829
|
+
if (!event.time)
|
|
830
|
+
event = { time: new Date().toISOString(), ...event };
|
|
831
|
+
let tree = this.$mol_tree2_from_json(event);
|
|
832
|
+
tree = tree.struct(type, tree.kids);
|
|
833
|
+
let str = color(tree.toString());
|
|
834
|
+
this.console[level](str);
|
|
835
|
+
const self = this;
|
|
836
|
+
return () => self.console.groupEnd();
|
|
1002
837
|
};
|
|
1003
838
|
}
|
|
1004
|
-
$.$
|
|
1005
|
-
$.$
|
|
839
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
840
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
841
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
842
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
843
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
844
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
845
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1006
846
|
})($ || ($ = {}));
|
|
1007
847
|
|
|
1008
848
|
;
|
|
1009
849
|
"use strict";
|
|
1010
850
|
var $;
|
|
1011
851
|
(function ($) {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
source;
|
|
1015
|
-
row;
|
|
1016
|
-
col;
|
|
1017
|
-
length;
|
|
1018
|
-
constructor(uri, source, row, col, length) {
|
|
1019
|
-
super();
|
|
1020
|
-
this.uri = uri;
|
|
1021
|
-
this.source = source;
|
|
1022
|
-
this.row = row;
|
|
1023
|
-
this.col = col;
|
|
1024
|
-
this.length = length;
|
|
1025
|
-
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
1026
|
-
}
|
|
1027
|
-
static unknown = $mol_span.begin('?');
|
|
1028
|
-
static begin(uri, source = '') {
|
|
1029
|
-
return new $mol_span(uri, source, 1, 1, 0);
|
|
1030
|
-
}
|
|
1031
|
-
static end(uri, source) {
|
|
1032
|
-
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1033
|
-
}
|
|
1034
|
-
static entire(uri, source) {
|
|
1035
|
-
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1036
|
-
}
|
|
1037
|
-
toString() {
|
|
1038
|
-
return this[Symbol.toStringTag];
|
|
1039
|
-
}
|
|
1040
|
-
toJSON() {
|
|
1041
|
-
return {
|
|
1042
|
-
uri: this.uri,
|
|
1043
|
-
row: this.row,
|
|
1044
|
-
col: this.col,
|
|
1045
|
-
length: this.length
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
error(message, Class = Error) {
|
|
1049
|
-
return new Class(`${message} (${this})`);
|
|
1050
|
-
}
|
|
1051
|
-
span(row, col, length) {
|
|
1052
|
-
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1053
|
-
}
|
|
1054
|
-
after(length = 0) {
|
|
1055
|
-
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
1056
|
-
}
|
|
1057
|
-
slice(begin, end = -1) {
|
|
1058
|
-
let len = this.length;
|
|
1059
|
-
if (begin < 0)
|
|
1060
|
-
begin += len;
|
|
1061
|
-
if (end < 0)
|
|
1062
|
-
end += len;
|
|
1063
|
-
if (begin < 0 || begin > len)
|
|
1064
|
-
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1065
|
-
if (end < 0 || end > len)
|
|
1066
|
-
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1067
|
-
if (end < begin)
|
|
1068
|
-
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1069
|
-
return this.span(this.row, this.col + begin, end - begin);
|
|
1070
|
-
}
|
|
852
|
+
function $mol_env() {
|
|
853
|
+
return {};
|
|
1071
854
|
}
|
|
1072
|
-
$.$
|
|
855
|
+
$.$mol_env = $mol_env;
|
|
1073
856
|
})($ || ($ = {}));
|
|
1074
857
|
|
|
1075
858
|
;
|
|
1076
859
|
"use strict";
|
|
1077
860
|
var $;
|
|
1078
861
|
(function ($) {
|
|
1079
|
-
function $
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
862
|
+
$.$mol_env = function $mol_env() {
|
|
863
|
+
return this.process.env;
|
|
864
|
+
};
|
|
865
|
+
})($ || ($ = {}));
|
|
866
|
+
|
|
867
|
+
;
|
|
868
|
+
"use strict";
|
|
869
|
+
var $;
|
|
870
|
+
(function ($) {
|
|
871
|
+
function $mol_exec(dir, command, ...args) {
|
|
872
|
+
let [app, ...args0] = command.split(' ');
|
|
873
|
+
args = [...args0, ...args];
|
|
874
|
+
this.$mol_log3_come({
|
|
875
|
+
place: '$mol_exec',
|
|
876
|
+
dir: $node.path.relative('', dir),
|
|
877
|
+
message: 'Run',
|
|
878
|
+
command: `${app} ${args.join(' ')}`,
|
|
879
|
+
});
|
|
880
|
+
var res = $node['child_process'].spawnSync(app, args, {
|
|
881
|
+
cwd: $node.path.resolve(dir),
|
|
882
|
+
shell: true,
|
|
883
|
+
env: this.$mol_env(),
|
|
884
|
+
});
|
|
885
|
+
if (res.status || res.error) {
|
|
886
|
+
return $mol_fail(res.error || new Error(res.stderr.toString(), { cause: res.stdout }));
|
|
1101
887
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
888
|
+
if (!res.stdout)
|
|
889
|
+
res.stdout = Buffer.from([]);
|
|
890
|
+
return res;
|
|
1104
891
|
}
|
|
1105
|
-
$.$
|
|
892
|
+
$.$mol_exec = $mol_exec;
|
|
1106
893
|
})($ || ($ = {}));
|
|
1107
894
|
|
|
1108
895
|
;
|
|
1109
896
|
"use strict";
|
|
1110
897
|
var $;
|
|
1111
898
|
(function ($) {
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
return
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
return $mol_tree2.data(value, kids, this.span);
|
|
1146
|
-
}
|
|
1147
|
-
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1148
|
-
if (/[ \n\t\\]/.test(type)) {
|
|
1149
|
-
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1150
|
-
}
|
|
1151
|
-
return new $mol_tree2(type, '', kids, span);
|
|
1152
|
-
}
|
|
1153
|
-
struct(type, kids = []) {
|
|
1154
|
-
return $mol_tree2.struct(type, kids, this.span);
|
|
1155
|
-
}
|
|
1156
|
-
clone(kids, span = this.span) {
|
|
1157
|
-
return new $mol_tree2(this.type, this.value, kids, span);
|
|
1158
|
-
}
|
|
1159
|
-
text() {
|
|
1160
|
-
var values = [];
|
|
1161
|
-
for (var kid of this.kids) {
|
|
1162
|
-
if (kid.type)
|
|
1163
|
-
continue;
|
|
1164
|
-
values.push(kid.value);
|
|
1165
|
-
}
|
|
1166
|
-
return this.value + values.join('\n');
|
|
1167
|
-
}
|
|
1168
|
-
static fromString(str, uri = 'unknown') {
|
|
1169
|
-
return $$.$mol_tree2_from_string(str, uri);
|
|
1170
|
-
}
|
|
1171
|
-
toString() {
|
|
1172
|
-
return $$.$mol_tree2_to_string(this);
|
|
1173
|
-
}
|
|
1174
|
-
insert(value, ...path) {
|
|
1175
|
-
if (path.length === 0)
|
|
1176
|
-
return value;
|
|
1177
|
-
const type = path[0];
|
|
1178
|
-
if (typeof type === 'string') {
|
|
1179
|
-
let replaced = false;
|
|
1180
|
-
const sub = this.kids.map((item, index) => {
|
|
1181
|
-
if (item.type !== type)
|
|
1182
|
-
return item;
|
|
1183
|
-
replaced = true;
|
|
1184
|
-
return item.insert(value, ...path.slice(1));
|
|
1185
|
-
}).filter(Boolean);
|
|
1186
|
-
if (!replaced && value) {
|
|
1187
|
-
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
1188
|
-
}
|
|
1189
|
-
return this.clone(sub);
|
|
1190
|
-
}
|
|
1191
|
-
else if (typeof type === 'number') {
|
|
1192
|
-
const sub = this.kids.slice();
|
|
1193
|
-
sub[type] = (sub[type] || this.list([]))
|
|
1194
|
-
.insert(value, ...path.slice(1));
|
|
1195
|
-
return this.clone(sub.filter(Boolean));
|
|
1196
|
-
}
|
|
1197
|
-
else {
|
|
1198
|
-
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
1199
|
-
.map(item => item.insert(value, ...path.slice(1)))
|
|
1200
|
-
.filter(Boolean);
|
|
1201
|
-
return this.clone(kids);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
select(...path) {
|
|
1205
|
-
let next = [this];
|
|
1206
|
-
for (const type of path) {
|
|
1207
|
-
if (!next.length)
|
|
1208
|
-
break;
|
|
1209
|
-
const prev = next;
|
|
1210
|
-
next = [];
|
|
1211
|
-
for (var item of prev) {
|
|
1212
|
-
switch (typeof (type)) {
|
|
1213
|
-
case 'string':
|
|
1214
|
-
for (var child of item.kids) {
|
|
1215
|
-
if (child.type == type) {
|
|
1216
|
-
next.push(child);
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
break;
|
|
1220
|
-
case 'number':
|
|
1221
|
-
if (type < item.kids.length)
|
|
1222
|
-
next.push(item.kids[type]);
|
|
1223
|
-
break;
|
|
1224
|
-
default: next.push(...item.kids);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
return this.list(next);
|
|
1229
|
-
}
|
|
1230
|
-
filter(path, value) {
|
|
1231
|
-
const sub = this.kids.filter(item => {
|
|
1232
|
-
var found = item.select(...path);
|
|
1233
|
-
if (value === undefined) {
|
|
1234
|
-
return Boolean(found.kids.length);
|
|
1235
|
-
}
|
|
1236
|
-
else {
|
|
1237
|
-
return found.kids.some(child => child.value == value);
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
return this.clone(sub);
|
|
1241
|
-
}
|
|
1242
|
-
hack_self(belt, context = {}) {
|
|
1243
|
-
let handle = belt[this.type] || belt[''];
|
|
1244
|
-
if (!handle || handle === Object.prototype[this.type]) {
|
|
1245
|
-
handle = (input, belt, context) => [
|
|
1246
|
-
input.clone(input.hack(belt, context), context.span)
|
|
1247
|
-
];
|
|
1248
|
-
}
|
|
1249
|
-
try {
|
|
1250
|
-
return handle(this, belt, context);
|
|
1251
|
-
}
|
|
1252
|
-
catch (error) {
|
|
1253
|
-
error.message += `\n${this.clone([])}${this.span}`;
|
|
1254
|
-
$mol_fail_hidden(error);
|
|
1255
|
-
}
|
|
899
|
+
const TextEncoder = globalThis.TextEncoder ?? $node.util.TextEncoder;
|
|
900
|
+
const encoder = new TextEncoder();
|
|
901
|
+
function $mol_charset_encode(value) {
|
|
902
|
+
return encoder.encode(value);
|
|
903
|
+
}
|
|
904
|
+
$.$mol_charset_encode = $mol_charset_encode;
|
|
905
|
+
})($ || ($ = {}));
|
|
906
|
+
|
|
907
|
+
;
|
|
908
|
+
"use strict";
|
|
909
|
+
var $;
|
|
910
|
+
(function ($) {
|
|
911
|
+
function $mol_int62_string_ensure(str) {
|
|
912
|
+
if (typeof str !== 'string')
|
|
913
|
+
return null;
|
|
914
|
+
return $mol_int62_from_string(str) && str;
|
|
915
|
+
}
|
|
916
|
+
$.$mol_int62_string_ensure = $mol_int62_string_ensure;
|
|
917
|
+
$.$mol_int62_max = (2 ** 30) - 1;
|
|
918
|
+
$.$mol_int62_min = -(2 ** 30);
|
|
919
|
+
$.$mol_int62_range = $.$mol_int62_max - $.$mol_int62_min + 1;
|
|
920
|
+
function $mol_int62_to_string({ lo, hi }) {
|
|
921
|
+
lo = (lo + $.$mol_int62_range) % $.$mol_int62_range;
|
|
922
|
+
hi = (hi + $.$mol_int62_range) % $.$mol_int62_range;
|
|
923
|
+
return lo.toString(36) + '_' + hi.toString(36);
|
|
924
|
+
}
|
|
925
|
+
$.$mol_int62_to_string = $mol_int62_to_string;
|
|
926
|
+
function $mol_int62_from_string(str) {
|
|
927
|
+
const [str_lo, str_hi] = str.split('_');
|
|
928
|
+
const int_lo = parseInt(str_lo, 36);
|
|
929
|
+
const int_hi = parseInt(str_hi, 36);
|
|
930
|
+
if (int_lo.toString(36) !== str_lo || int_hi.toString(36) !== str_hi) {
|
|
931
|
+
return null;
|
|
1256
932
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
933
|
+
return {
|
|
934
|
+
lo: (int_lo - $.$mol_int62_min) % $.$mol_int62_range + $.$mol_int62_min,
|
|
935
|
+
hi: (int_hi - $.$mol_int62_min) % $.$mol_int62_range + $.$mol_int62_min,
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
$.$mol_int62_from_string = $mol_int62_from_string;
|
|
939
|
+
function $mol_int62_compare(left_lo, left_hi, right_lo, right_hi) {
|
|
940
|
+
return (right_hi - left_hi) || (right_lo - left_lo);
|
|
941
|
+
}
|
|
942
|
+
$.$mol_int62_compare = $mol_int62_compare;
|
|
943
|
+
function $mol_int62_inc(lo, hi, max = $.$mol_int62_max) {
|
|
944
|
+
if (lo === max) {
|
|
945
|
+
return { lo: -max, hi: hi + 1 };
|
|
1259
946
|
}
|
|
1260
|
-
|
|
1261
|
-
return
|
|
947
|
+
else {
|
|
948
|
+
return { lo: lo + 1, hi };
|
|
1262
949
|
}
|
|
1263
950
|
}
|
|
1264
|
-
$.$
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
951
|
+
$.$mol_int62_inc = $mol_int62_inc;
|
|
952
|
+
function $mol_int62_random() {
|
|
953
|
+
return {
|
|
954
|
+
lo: Math.floor(Math.random() * $.$mol_int62_range + $.$mol_int62_min),
|
|
955
|
+
hi: Math.floor(Math.random() * $.$mol_int62_range + $.$mol_int62_min),
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
$.$mol_int62_random = $mol_int62_random;
|
|
959
|
+
function $mol_int62_hash_string(str) {
|
|
960
|
+
return $mol_int62_to_string($mol_int62_hash_buffer($mol_charset_encode(str)));
|
|
961
|
+
}
|
|
962
|
+
$.$mol_int62_hash_string = $mol_int62_hash_string;
|
|
963
|
+
function $mol_int62_hash_buffer(buf, seed = { lo: 0, hi: 0 }) {
|
|
964
|
+
let h1 = 0xdeadbeef ^ seed.lo;
|
|
965
|
+
let h2 = 0x41c6ce57 ^ seed.hi;
|
|
966
|
+
for (const byte of buf) {
|
|
967
|
+
h1 = Math.imul(h1 ^ byte, 2654435761);
|
|
968
|
+
h2 = Math.imul(h2 ^ byte, 1597334677);
|
|
1268
969
|
}
|
|
970
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
971
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
972
|
+
return { lo: h1 << 1 >> 1, hi: h2 << 1 >> 1 };
|
|
1269
973
|
}
|
|
1270
|
-
$.$
|
|
974
|
+
$.$mol_int62_hash_buffer = $mol_int62_hash_buffer;
|
|
1271
975
|
})($ || ($ = {}));
|
|
1272
976
|
|
|
977
|
+
;
|
|
978
|
+
"use strict";
|
|
979
|
+
|
|
1273
980
|
;
|
|
1274
981
|
"use strict";
|
|
1275
982
|
var $;
|
|
1276
983
|
(function ($) {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
984
|
+
function $mol_data_setup(value, config) {
|
|
985
|
+
return Object.assign(value, {
|
|
986
|
+
config,
|
|
987
|
+
Value: null
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
$.$mol_data_setup = $mol_data_setup;
|
|
991
|
+
})($ || ($ = {}));
|
|
992
|
+
|
|
993
|
+
;
|
|
994
|
+
"use strict";
|
|
995
|
+
var $;
|
|
996
|
+
(function ($) {
|
|
997
|
+
class $mol_error_mix extends AggregateError {
|
|
998
|
+
cause;
|
|
999
|
+
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
|
1000
|
+
constructor(message, cause = {}, ...errors) {
|
|
1001
|
+
super(errors, message, { cause });
|
|
1002
|
+
this.cause = cause;
|
|
1003
|
+
const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
|
|
1004
|
+
Object.defineProperty(this, 'stack', {
|
|
1005
|
+
get: () => (stack_get.call(this) ?? this.message) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
|
|
1006
|
+
.replace(/at /gm, ' at ')
|
|
1007
|
+
.replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
|
|
1008
|
+
});
|
|
1286
1009
|
}
|
|
1287
1010
|
}
|
|
1288
|
-
$.$
|
|
1011
|
+
$.$mol_error_mix = $mol_error_mix;
|
|
1289
1012
|
})($ || ($ = {}));
|
|
1290
1013
|
|
|
1291
1014
|
;
|
|
1292
1015
|
"use strict";
|
|
1293
1016
|
var $;
|
|
1294
1017
|
(function ($) {
|
|
1295
|
-
|
|
1296
|
-
const span = $mol_span.entire(uri, str);
|
|
1297
|
-
var root = $mol_tree2.list([], span);
|
|
1298
|
-
var stack = [root];
|
|
1299
|
-
var pos = 0, row = 0, min_indent = 0;
|
|
1300
|
-
while (str.length > pos) {
|
|
1301
|
-
var indent = 0;
|
|
1302
|
-
var line_start = pos;
|
|
1303
|
-
row++;
|
|
1304
|
-
while (str.length > pos && str[pos] == '\t') {
|
|
1305
|
-
indent++;
|
|
1306
|
-
pos++;
|
|
1307
|
-
}
|
|
1308
|
-
if (!root.kids.length) {
|
|
1309
|
-
min_indent = indent;
|
|
1310
|
-
}
|
|
1311
|
-
indent -= min_indent;
|
|
1312
|
-
if (indent < 0 || indent >= stack.length) {
|
|
1313
|
-
const sp = span.span(row, 1, pos - line_start);
|
|
1314
|
-
while (str.length > pos && str[pos] != '\n') {
|
|
1315
|
-
pos++;
|
|
1316
|
-
}
|
|
1317
|
-
if (indent < 0) {
|
|
1318
|
-
if (str.length > pos) {
|
|
1319
|
-
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
else {
|
|
1323
|
-
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
stack.length = indent + 1;
|
|
1327
|
-
var parent = stack[indent];
|
|
1328
|
-
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1329
|
-
var error_start = pos;
|
|
1330
|
-
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1331
|
-
pos++;
|
|
1332
|
-
}
|
|
1333
|
-
if (pos > error_start) {
|
|
1334
|
-
let line_end = str.indexOf('\n', pos);
|
|
1335
|
-
if (line_end === -1)
|
|
1336
|
-
line_end = str.length;
|
|
1337
|
-
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1338
|
-
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1339
|
-
}
|
|
1340
|
-
var type_start = pos;
|
|
1341
|
-
while (str.length > pos &&
|
|
1342
|
-
str[pos] != '\\' &&
|
|
1343
|
-
str[pos] != ' ' &&
|
|
1344
|
-
str[pos] != '\t' &&
|
|
1345
|
-
str[pos] != '\n') {
|
|
1346
|
-
pos++;
|
|
1347
|
-
}
|
|
1348
|
-
if (pos > type_start) {
|
|
1349
|
-
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
1350
|
-
const parent_kids = parent.kids;
|
|
1351
|
-
parent_kids.push(next);
|
|
1352
|
-
parent = next;
|
|
1353
|
-
}
|
|
1354
|
-
if (str.length > pos && str[pos] == ' ') {
|
|
1355
|
-
pos++;
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
if (str.length > pos && str[pos] == '\\') {
|
|
1359
|
-
var data_start = pos;
|
|
1360
|
-
while (str.length > pos && str[pos] != '\n') {
|
|
1361
|
-
pos++;
|
|
1362
|
-
}
|
|
1363
|
-
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
1364
|
-
const parent_kids = parent.kids;
|
|
1365
|
-
parent_kids.push(next);
|
|
1366
|
-
parent = next;
|
|
1367
|
-
}
|
|
1368
|
-
if (str.length === pos && stack.length > 0) {
|
|
1369
|
-
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1370
|
-
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
1371
|
-
}
|
|
1372
|
-
stack.push(parent);
|
|
1373
|
-
pos++;
|
|
1374
|
-
}
|
|
1375
|
-
return root;
|
|
1018
|
+
class $mol_data_error extends $mol_error_mix {
|
|
1376
1019
|
}
|
|
1377
|
-
$.$
|
|
1020
|
+
$.$mol_data_error = $mol_data_error;
|
|
1378
1021
|
})($ || ($ = {}));
|
|
1379
1022
|
|
|
1380
1023
|
;
|
|
1381
1024
|
"use strict";
|
|
1382
1025
|
var $;
|
|
1383
1026
|
(function ($) {
|
|
1384
|
-
function $
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
return $mol_tree2.data(json, [], span);
|
|
1390
|
-
}
|
|
1391
|
-
if (Array.isArray(json)) {
|
|
1392
|
-
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
1393
|
-
return new $mol_tree2('/', '', sub, span);
|
|
1394
|
-
}
|
|
1395
|
-
if (ArrayBuffer.isView(json)) {
|
|
1396
|
-
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1397
|
-
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
1398
|
-
}
|
|
1399
|
-
if (json instanceof Date) {
|
|
1400
|
-
return new $mol_tree2('', json.toISOString(), [], span);
|
|
1401
|
-
}
|
|
1402
|
-
if (typeof json.toJSON === 'function') {
|
|
1403
|
-
return $mol_tree2_from_json(json.toJSON());
|
|
1404
|
-
}
|
|
1405
|
-
if (json.toString !== Object.prototype.toString) {
|
|
1406
|
-
return $mol_tree2.data(json.toString(), [], span);
|
|
1407
|
-
}
|
|
1408
|
-
if (json instanceof Error) {
|
|
1409
|
-
const { name, message, stack } = json;
|
|
1410
|
-
json = { ...json, name, message, stack };
|
|
1411
|
-
}
|
|
1412
|
-
const sub = [];
|
|
1413
|
-
for (var key in json) {
|
|
1414
|
-
const val = json[key];
|
|
1415
|
-
if (val === undefined)
|
|
1416
|
-
continue;
|
|
1417
|
-
const subsub = $mol_tree2_from_json(val, span);
|
|
1418
|
-
if (/^[^\n\t\\ ]+$/.test(key)) {
|
|
1419
|
-
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
1420
|
-
}
|
|
1421
|
-
else {
|
|
1422
|
-
sub.push($mol_tree2.data(key, [subsub], span));
|
|
1027
|
+
function $mol_data_enum(name, dict) {
|
|
1028
|
+
const index = {};
|
|
1029
|
+
for (let key in dict) {
|
|
1030
|
+
if (Number.isNaN(Number(key))) {
|
|
1031
|
+
index[dict[key]] = key;
|
|
1423
1032
|
}
|
|
1424
1033
|
}
|
|
1425
|
-
return
|
|
1034
|
+
return $mol_data_setup((value) => {
|
|
1035
|
+
if (typeof index[value] !== 'string') {
|
|
1036
|
+
return $mol_fail(new $mol_data_error(`${value} is not value of ${name} enum`));
|
|
1037
|
+
}
|
|
1038
|
+
return value;
|
|
1039
|
+
}, { name, dict });
|
|
1426
1040
|
}
|
|
1427
|
-
$.$
|
|
1041
|
+
$.$mol_data_enum = $mol_data_enum;
|
|
1428
1042
|
})($ || ($ = {}));
|
|
1429
1043
|
|
|
1430
1044
|
;
|
|
1431
1045
|
"use strict";
|
|
1432
1046
|
var $;
|
|
1433
1047
|
(function ($) {
|
|
1434
|
-
|
|
1435
|
-
static reset = this.ansi(0, 0);
|
|
1436
|
-
static bold = this.ansi(1, 22);
|
|
1437
|
-
static italic = this.ansi(3, 23);
|
|
1438
|
-
static underline = this.ansi(4, 24);
|
|
1439
|
-
static inverse = this.ansi(7, 27);
|
|
1440
|
-
static hidden = this.ansi(8, 28);
|
|
1441
|
-
static strike = this.ansi(9, 29);
|
|
1442
|
-
static gray = this.ansi(90, 39);
|
|
1443
|
-
static red = this.ansi(91, 39);
|
|
1444
|
-
static green = this.ansi(92, 39);
|
|
1445
|
-
static yellow = this.ansi(93, 39);
|
|
1446
|
-
static blue = this.ansi(94, 39);
|
|
1447
|
-
static magenta = this.ansi(95, 39);
|
|
1448
|
-
static cyan = this.ansi(96, 39);
|
|
1449
|
-
static Gray = (str) => this.inverse(this.gray(str));
|
|
1450
|
-
static Red = (str) => this.inverse(this.red(str));
|
|
1451
|
-
static Green = (str) => this.inverse(this.green(str));
|
|
1452
|
-
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1453
|
-
static Blue = (str) => this.inverse(this.blue(str));
|
|
1454
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1455
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1456
|
-
static ansi(open, close) {
|
|
1457
|
-
if (typeof process === 'undefined')
|
|
1458
|
-
return String;
|
|
1459
|
-
if (!process.stdout.isTTY)
|
|
1460
|
-
return String;
|
|
1461
|
-
const prefix = `\x1b[${open}m`;
|
|
1462
|
-
const postfix = `\x1b[${close}m`;
|
|
1463
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1464
|
-
return function colorer(str) {
|
|
1465
|
-
str = String(str);
|
|
1466
|
-
if (str === '')
|
|
1467
|
-
return str;
|
|
1468
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
1469
|
-
return prefix + suffix + postfix;
|
|
1470
|
-
};
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
$.$mol_term_color = $mol_term_color;
|
|
1048
|
+
$.$mol_crypto_native = $node.crypto.webcrypto;
|
|
1474
1049
|
})($ || ($ = {}));
|
|
1475
1050
|
|
|
1476
1051
|
;
|
|
1477
1052
|
"use strict";
|
|
1478
1053
|
var $;
|
|
1479
1054
|
(function ($) {
|
|
1480
|
-
function $
|
|
1481
|
-
|
|
1482
|
-
if (!event.time)
|
|
1483
|
-
event = { time: new Date().toISOString(), ...event };
|
|
1484
|
-
let tree = this.$mol_tree2_from_json(event);
|
|
1485
|
-
tree = tree.struct(type, tree.kids);
|
|
1486
|
-
let str = color(tree.toString());
|
|
1487
|
-
this.console[level](str);
|
|
1488
|
-
const self = this;
|
|
1489
|
-
return () => self.console.groupEnd();
|
|
1490
|
-
};
|
|
1055
|
+
function $mol_base64_encode(src) {
|
|
1056
|
+
throw new Error('Not implemented');
|
|
1491
1057
|
}
|
|
1492
|
-
$.$
|
|
1493
|
-
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1494
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1495
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1496
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1497
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1498
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1058
|
+
$.$mol_base64_encode = $mol_base64_encode;
|
|
1499
1059
|
})($ || ($ = {}));
|
|
1500
1060
|
|
|
1501
1061
|
;
|
|
1502
1062
|
"use strict";
|
|
1503
1063
|
var $;
|
|
1504
1064
|
(function ($) {
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
return
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
if (!existen.temp)
|
|
1512
|
-
break reuse;
|
|
1513
|
-
if (existen.host !== host)
|
|
1514
|
-
break reuse;
|
|
1515
|
-
if (existen.task !== task)
|
|
1516
|
-
break reuse;
|
|
1517
|
-
if (!$mol_compare_deep(existen.args, args))
|
|
1518
|
-
break reuse;
|
|
1519
|
-
return existen;
|
|
1520
|
-
}
|
|
1521
|
-
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}<#>`, task, host, args);
|
|
1522
|
-
if (existen?.temp) {
|
|
1523
|
-
$$.$mol_log3_warn({
|
|
1524
|
-
place: '$mol_wire_task',
|
|
1525
|
-
message: `Non idempotency`,
|
|
1526
|
-
existen,
|
|
1527
|
-
next,
|
|
1528
|
-
hint: 'Ignore it',
|
|
1529
|
-
});
|
|
1530
|
-
}
|
|
1531
|
-
return next;
|
|
1532
|
-
};
|
|
1533
|
-
}
|
|
1534
|
-
get temp() {
|
|
1535
|
-
return true;
|
|
1536
|
-
}
|
|
1537
|
-
complete() {
|
|
1538
|
-
if ($mol_promise_like(this.cache))
|
|
1539
|
-
return;
|
|
1540
|
-
this.destructor();
|
|
1541
|
-
}
|
|
1542
|
-
put(next) {
|
|
1543
|
-
const prev = this.cache;
|
|
1544
|
-
this.cache = next;
|
|
1545
|
-
if ($mol_promise_like(next)) {
|
|
1546
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1547
|
-
if (next !== prev)
|
|
1548
|
-
this.emit();
|
|
1549
|
-
return next;
|
|
1550
|
-
}
|
|
1551
|
-
this.cursor = $mol_wire_cursor.final;
|
|
1552
|
-
if (this.sub_empty)
|
|
1553
|
-
this.destructor();
|
|
1554
|
-
else if (next !== prev)
|
|
1555
|
-
this.emit();
|
|
1556
|
-
return next;
|
|
1557
|
-
}
|
|
1065
|
+
function $mol_base64_encode_node(str) {
|
|
1066
|
+
if (!str)
|
|
1067
|
+
return '';
|
|
1068
|
+
if (Buffer.isBuffer(str))
|
|
1069
|
+
return str.toString('base64');
|
|
1070
|
+
return Buffer.from(str).toString('base64');
|
|
1558
1071
|
}
|
|
1559
|
-
$.$
|
|
1072
|
+
$.$mol_base64_encode_node = $mol_base64_encode_node;
|
|
1073
|
+
$.$mol_base64_encode = $mol_base64_encode_node;
|
|
1560
1074
|
})($ || ($ = {}));
|
|
1561
1075
|
|
|
1562
1076
|
;
|
|
1563
1077
|
"use strict";
|
|
1564
1078
|
var $;
|
|
1565
1079
|
(function ($) {
|
|
1566
|
-
function $
|
|
1567
|
-
|
|
1568
|
-
get(obj, field) {
|
|
1569
|
-
const val = obj[field];
|
|
1570
|
-
if (typeof val !== 'function')
|
|
1571
|
-
return val;
|
|
1572
|
-
const temp = $mol_wire_task.getter(val);
|
|
1573
|
-
return function $mol_wire_sync(...args) {
|
|
1574
|
-
const fiber = temp(obj, args);
|
|
1575
|
-
return fiber.sync();
|
|
1576
|
-
};
|
|
1577
|
-
},
|
|
1578
|
-
apply(obj, self, args) {
|
|
1579
|
-
const temp = $mol_wire_task.getter(obj);
|
|
1580
|
-
const fiber = temp(self, args);
|
|
1581
|
-
return fiber.sync();
|
|
1582
|
-
},
|
|
1583
|
-
});
|
|
1080
|
+
function $mol_base64_decode(base64) {
|
|
1081
|
+
throw new Error('Not implemented');
|
|
1584
1082
|
}
|
|
1585
|
-
$.$
|
|
1083
|
+
$.$mol_base64_decode = $mol_base64_decode;
|
|
1586
1084
|
})($ || ($ = {}));
|
|
1587
1085
|
|
|
1588
1086
|
;
|
|
1589
1087
|
"use strict";
|
|
1590
1088
|
var $;
|
|
1591
1089
|
(function ($) {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
if ($mol_promise_like(error))
|
|
1597
|
-
$mol_fail_hidden(error);
|
|
1598
|
-
if (catched.get(error))
|
|
1599
|
-
return false;
|
|
1600
|
-
catched.set(error, true);
|
|
1601
|
-
return true;
|
|
1090
|
+
function $mol_base64_decode_node(base64Str) {
|
|
1091
|
+
base64Str = base64Str.replace(/-/g, '+').replace(/_/g, '/');
|
|
1092
|
+
const buffer = Buffer.from(base64Str, 'base64');
|
|
1093
|
+
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1602
1094
|
}
|
|
1603
|
-
$.$
|
|
1095
|
+
$.$mol_base64_decode_node = $mol_base64_decode_node;
|
|
1096
|
+
$.$mol_base64_decode = $mol_base64_decode_node;
|
|
1604
1097
|
})($ || ($ = {}));
|
|
1605
1098
|
|
|
1606
1099
|
;
|
|
1607
1100
|
"use strict";
|
|
1608
1101
|
var $;
|
|
1609
1102
|
(function ($) {
|
|
1610
|
-
function $
|
|
1611
|
-
|
|
1612
|
-
return false;
|
|
1613
|
-
if (!$mol_fail_catch(error))
|
|
1614
|
-
return false;
|
|
1615
|
-
console.error(error);
|
|
1616
|
-
return true;
|
|
1103
|
+
function $mol_base64_url_encode(buffer) {
|
|
1104
|
+
return $mol_base64_encode(buffer).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
1617
1105
|
}
|
|
1618
|
-
$.$
|
|
1106
|
+
$.$mol_base64_url_encode = $mol_base64_url_encode;
|
|
1107
|
+
function $mol_base64_url_decode(str) {
|
|
1108
|
+
return $mol_base64_decode(str.replace(/-/g, '+').replace(/_/g, '/'));
|
|
1109
|
+
}
|
|
1110
|
+
$.$mol_base64_url_decode = $mol_base64_url_decode;
|
|
1619
1111
|
})($ || ($ = {}));
|
|
1620
1112
|
|
|
1621
1113
|
;
|
|
1622
1114
|
"use strict";
|
|
1623
|
-
var
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1115
|
+
var $;
|
|
1116
|
+
(function ($) {
|
|
1117
|
+
const algorithm = {
|
|
1118
|
+
name: 'ECDSA',
|
|
1119
|
+
hash: 'SHA-256',
|
|
1120
|
+
namedCurve: "P-256",
|
|
1121
|
+
};
|
|
1122
|
+
async function $mol_crypto_auditor_pair() {
|
|
1123
|
+
const pair = await $mol_crypto_native.subtle.generateKey(algorithm, true, ['sign', 'verify']);
|
|
1124
|
+
return {
|
|
1125
|
+
public: new $mol_crypto_auditor_public(pair.publicKey),
|
|
1126
|
+
private: new $mol_crypto_auditor_private(pair.privateKey),
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
$.$mol_crypto_auditor_pair = $mol_crypto_auditor_pair;
|
|
1130
|
+
class $mol_crypto_auditor_public extends Object {
|
|
1131
|
+
native;
|
|
1132
|
+
static size_str = 86;
|
|
1133
|
+
static size_bin = 64;
|
|
1134
|
+
constructor(native) {
|
|
1135
|
+
super();
|
|
1136
|
+
this.native = native;
|
|
1137
|
+
}
|
|
1138
|
+
static async from(serial) {
|
|
1139
|
+
if (typeof serial !== 'string') {
|
|
1140
|
+
serial = $mol_base64_url_encode(serial.subarray(0, 32))
|
|
1141
|
+
+ $mol_base64_url_encode(serial.subarray(32, 64));
|
|
1649
1142
|
}
|
|
1143
|
+
return new this(await $mol_crypto_native.subtle.importKey('jwk', {
|
|
1144
|
+
crv: "P-256",
|
|
1145
|
+
ext: true,
|
|
1146
|
+
key_ops: ['verify'],
|
|
1147
|
+
kty: "EC",
|
|
1148
|
+
x: serial.slice(0, 43),
|
|
1149
|
+
y: serial.slice(43, 86),
|
|
1150
|
+
}, algorithm, true, ['verify']));
|
|
1650
1151
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1152
|
+
async serial() {
|
|
1153
|
+
const { x, y } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
1154
|
+
return x + y;
|
|
1653
1155
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1156
|
+
async toArray() {
|
|
1157
|
+
const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
1158
|
+
return new Uint8Array([
|
|
1159
|
+
...$mol_base64_url_decode(x),
|
|
1160
|
+
...$mol_base64_url_decode(y),
|
|
1161
|
+
]);
|
|
1162
|
+
}
|
|
1163
|
+
async verify(data, sign) {
|
|
1164
|
+
return await $mol_crypto_native.subtle.verify(algorithm, this.native, sign, data);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
$.$mol_crypto_auditor_public = $mol_crypto_auditor_public;
|
|
1168
|
+
class $mol_crypto_auditor_private extends Object {
|
|
1169
|
+
native;
|
|
1170
|
+
static size_str = 129;
|
|
1171
|
+
static size_bin = 96;
|
|
1172
|
+
constructor(native) {
|
|
1173
|
+
super();
|
|
1174
|
+
this.native = native;
|
|
1175
|
+
}
|
|
1176
|
+
static async from(serial) {
|
|
1177
|
+
if (typeof serial !== 'string') {
|
|
1178
|
+
serial = $mol_base64_url_encode(serial.subarray(0, 32))
|
|
1179
|
+
+ $mol_base64_url_encode(serial.subarray(32, 64))
|
|
1180
|
+
+ $mol_base64_url_encode(serial.subarray(64));
|
|
1657
1181
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1182
|
+
return new this(await $mol_crypto_native.subtle.importKey('jwk', {
|
|
1183
|
+
crv: "P-256",
|
|
1184
|
+
ext: true,
|
|
1185
|
+
key_ops: ['sign'],
|
|
1186
|
+
kty: "EC",
|
|
1187
|
+
x: serial.slice(0, 43),
|
|
1188
|
+
y: serial.slice(43, 86),
|
|
1189
|
+
d: serial.slice(86, 129),
|
|
1190
|
+
}, algorithm, true, ['sign']));
|
|
1191
|
+
}
|
|
1192
|
+
async serial() {
|
|
1193
|
+
const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
1194
|
+
return x + y + d;
|
|
1195
|
+
}
|
|
1196
|
+
async toArray() {
|
|
1197
|
+
const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
1198
|
+
return new Uint8Array([
|
|
1199
|
+
...$mol_base64_url_decode(x),
|
|
1200
|
+
...$mol_base64_url_decode(y),
|
|
1201
|
+
...$mol_base64_url_decode(d),
|
|
1202
|
+
]);
|
|
1203
|
+
}
|
|
1204
|
+
async sign(data) {
|
|
1205
|
+
return await $mol_crypto_native.subtle.sign(algorithm, this.native, data);
|
|
1206
|
+
}
|
|
1207
|
+
async public() {
|
|
1208
|
+
return await $mol_crypto_auditor_public.from($mol_crypto_auditor_private_to_public(await this.serial()));
|
|
1660
1209
|
}
|
|
1661
|
-
},
|
|
1662
|
-
set(target, name, value) {
|
|
1663
|
-
target[name] = value;
|
|
1664
|
-
return true;
|
|
1665
|
-
},
|
|
1666
|
-
});
|
|
1667
|
-
const importAsync = async (uri) => import(uri);
|
|
1668
|
-
const importSync = $.$mol_wire_sync(importAsync);
|
|
1669
|
-
require = (req => Object.assign(function require(name) {
|
|
1670
|
-
return $node[name];
|
|
1671
|
-
}, req))(require);
|
|
1672
|
-
|
|
1673
|
-
;
|
|
1674
|
-
"use strict";
|
|
1675
|
-
var $;
|
|
1676
|
-
(function ($) {
|
|
1677
|
-
function $mol_env() {
|
|
1678
|
-
return {};
|
|
1679
1210
|
}
|
|
1680
|
-
$.$
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
;
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
(function ($) {
|
|
1687
|
-
$.$mol_env = function $mol_env() {
|
|
1688
|
-
return this.process.env;
|
|
1689
|
-
};
|
|
1211
|
+
$.$mol_crypto_auditor_private = $mol_crypto_auditor_private;
|
|
1212
|
+
$.$mol_crypto_auditor_sign_size = 64;
|
|
1213
|
+
function $mol_crypto_auditor_private_to_public(serial) {
|
|
1214
|
+
return serial.slice(0, 86);
|
|
1215
|
+
}
|
|
1216
|
+
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
|
|
1690
1217
|
})($ || ($ = {}));
|
|
1691
1218
|
|
|
1692
1219
|
;
|
|
1693
1220
|
"use strict";
|
|
1694
1221
|
var $;
|
|
1695
1222
|
(function ($) {
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1223
|
+
let $hyoo_crowd_peer_level;
|
|
1224
|
+
(function ($hyoo_crowd_peer_level) {
|
|
1225
|
+
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["get"] = 0] = "get";
|
|
1226
|
+
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["add"] = 1] = "add";
|
|
1227
|
+
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["mod"] = 2] = "mod";
|
|
1228
|
+
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["law"] = 3] = "law";
|
|
1229
|
+
})($hyoo_crowd_peer_level = $.$hyoo_crowd_peer_level || ($.$hyoo_crowd_peer_level = {}));
|
|
1230
|
+
class $hyoo_crowd_peer extends Object {
|
|
1231
|
+
key_public;
|
|
1232
|
+
key_public_serial;
|
|
1233
|
+
key_private;
|
|
1234
|
+
key_private_serial;
|
|
1235
|
+
id;
|
|
1236
|
+
constructor(key_public, key_public_serial, key_private, key_private_serial) {
|
|
1237
|
+
super();
|
|
1238
|
+
this.key_public = key_public;
|
|
1239
|
+
this.key_public_serial = key_public_serial;
|
|
1240
|
+
this.key_private = key_private;
|
|
1241
|
+
this.key_private_serial = key_private_serial;
|
|
1242
|
+
this.id = $mol_int62_hash_string(this.key_public_serial);
|
|
1243
|
+
}
|
|
1244
|
+
static async generate() {
|
|
1245
|
+
const pair = await $$.$mol_crypto_auditor_pair();
|
|
1246
|
+
const serial = await pair.private.serial();
|
|
1247
|
+
return new this(pair.public, $mol_crypto_auditor_private_to_public(serial), pair.private, serial);
|
|
1248
|
+
}
|
|
1249
|
+
static async restore(serial) {
|
|
1250
|
+
return new this(await $$.$mol_crypto_auditor_public.from(serial), $mol_crypto_auditor_private_to_public(serial), await $$.$mol_crypto_auditor_private.from(serial), serial);
|
|
1712
1251
|
}
|
|
1713
|
-
if (!res.stdout)
|
|
1714
|
-
res.stdout = Buffer.from([]);
|
|
1715
|
-
return res;
|
|
1716
1252
|
}
|
|
1717
|
-
$.$
|
|
1253
|
+
$.$hyoo_crowd_peer = $hyoo_crowd_peer;
|
|
1718
1254
|
})($ || ($ = {}));
|
|
1719
1255
|
|
|
1720
1256
|
;
|
|
1721
1257
|
"use strict";
|
|
1722
1258
|
var $;
|
|
1723
1259
|
(function ($) {
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
return encoder.encode(value);
|
|
1260
|
+
$['devtoolsFormatters'] ||= [];
|
|
1261
|
+
function $mol_dev_format_register(config) {
|
|
1262
|
+
$['devtoolsFormatters'].push(config);
|
|
1728
1263
|
}
|
|
1729
|
-
$.$
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
const [str_lo, str_hi] = str.split('_');
|
|
1753
|
-
const int_lo = parseInt(str_lo, 36);
|
|
1754
|
-
const int_hi = parseInt(str_hi, 36);
|
|
1755
|
-
if (int_lo.toString(36) !== str_lo || int_hi.toString(36) !== str_hi) {
|
|
1264
|
+
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
1265
|
+
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
1266
|
+
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
1267
|
+
$mol_dev_format_register({
|
|
1268
|
+
header: (val, config = false) => {
|
|
1269
|
+
if (config)
|
|
1270
|
+
return null;
|
|
1271
|
+
if (!val)
|
|
1272
|
+
return null;
|
|
1273
|
+
if ($.$mol_dev_format_head in val) {
|
|
1274
|
+
try {
|
|
1275
|
+
return val[$.$mol_dev_format_head]();
|
|
1276
|
+
}
|
|
1277
|
+
catch (error) {
|
|
1278
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
if (typeof val === 'function') {
|
|
1282
|
+
return $mol_dev_format_native(val);
|
|
1283
|
+
}
|
|
1284
|
+
if (Symbol.toStringTag in val) {
|
|
1285
|
+
return $mol_dev_format_native(val);
|
|
1286
|
+
}
|
|
1756
1287
|
return null;
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
}
|
|
1772
|
-
else {
|
|
1773
|
-
return { lo: lo + 1, hi };
|
|
1774
|
-
}
|
|
1288
|
+
},
|
|
1289
|
+
hasBody: val => val[$.$mol_dev_format_body],
|
|
1290
|
+
body: val => val[$.$mol_dev_format_body](),
|
|
1291
|
+
});
|
|
1292
|
+
function $mol_dev_format_native(obj) {
|
|
1293
|
+
if (typeof obj === 'undefined')
|
|
1294
|
+
return $.$mol_dev_format_shade('undefined');
|
|
1295
|
+
return [
|
|
1296
|
+
'object',
|
|
1297
|
+
{
|
|
1298
|
+
object: obj,
|
|
1299
|
+
config: true,
|
|
1300
|
+
},
|
|
1301
|
+
];
|
|
1775
1302
|
}
|
|
1776
|
-
$.$
|
|
1777
|
-
function $
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1303
|
+
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
1304
|
+
function $mol_dev_format_auto(obj) {
|
|
1305
|
+
if (obj == null)
|
|
1306
|
+
return $.$mol_dev_format_shade(String(obj));
|
|
1307
|
+
return [
|
|
1308
|
+
'object',
|
|
1309
|
+
{
|
|
1310
|
+
object: obj,
|
|
1311
|
+
config: false,
|
|
1312
|
+
},
|
|
1313
|
+
];
|
|
1782
1314
|
}
|
|
1783
|
-
$.$
|
|
1784
|
-
function $
|
|
1785
|
-
|
|
1315
|
+
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
1316
|
+
function $mol_dev_format_element(element, style, ...content) {
|
|
1317
|
+
const styles = [];
|
|
1318
|
+
for (let key in style)
|
|
1319
|
+
styles.push(`${key} : ${style[key]}`);
|
|
1320
|
+
return [
|
|
1321
|
+
element,
|
|
1322
|
+
{
|
|
1323
|
+
style: styles.join(' ; '),
|
|
1324
|
+
},
|
|
1325
|
+
...content,
|
|
1326
|
+
];
|
|
1786
1327
|
}
|
|
1787
|
-
$.$
|
|
1788
|
-
function $
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
h1 = Math.imul(h1 ^ byte, 2654435761);
|
|
1793
|
-
h2 = Math.imul(h2 ^ byte, 1597334677);
|
|
1794
|
-
}
|
|
1795
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
1796
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
1797
|
-
return { lo: h1 << 1 >> 1, hi: h2 << 1 >> 1 };
|
|
1328
|
+
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
1329
|
+
function $mol_dev_format_span(style, ...content) {
|
|
1330
|
+
return $mol_dev_format_element('span', {
|
|
1331
|
+
...style,
|
|
1332
|
+
}, ...content);
|
|
1798
1333
|
}
|
|
1799
|
-
$.$
|
|
1334
|
+
$.$mol_dev_format_span = $mol_dev_format_span;
|
|
1335
|
+
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
1336
|
+
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
1337
|
+
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
1338
|
+
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
1339
|
+
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
1340
|
+
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
1341
|
+
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
1342
|
+
'color': 'magenta',
|
|
1343
|
+
});
|
|
1344
|
+
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
1345
|
+
'font-weight': 'bold',
|
|
1346
|
+
});
|
|
1347
|
+
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
1348
|
+
'color': 'green',
|
|
1349
|
+
});
|
|
1350
|
+
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
1351
|
+
'color': 'gray',
|
|
1352
|
+
});
|
|
1353
|
+
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
1354
|
+
'margin-left': '13px'
|
|
1355
|
+
});
|
|
1800
1356
|
})($ || ($ = {}));
|
|
1801
1357
|
|
|
1802
1358
|
;
|
|
@@ -1806,574 +1362,994 @@ var $;
|
|
|
1806
1362
|
"use strict";
|
|
1807
1363
|
var $;
|
|
1808
1364
|
(function ($) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1365
|
+
const decoders = {};
|
|
1366
|
+
function $mol_charset_decode(buffer, encoding = 'utf8') {
|
|
1367
|
+
let decoder = decoders[encoding];
|
|
1368
|
+
if (!decoder)
|
|
1369
|
+
decoder = decoders[encoding] = new TextDecoder(encoding);
|
|
1370
|
+
return decoder.decode(buffer);
|
|
1814
1371
|
}
|
|
1815
|
-
$.$
|
|
1372
|
+
$.$mol_charset_decode = $mol_charset_decode;
|
|
1816
1373
|
})($ || ($ = {}));
|
|
1817
1374
|
|
|
1818
1375
|
;
|
|
1819
1376
|
"use strict";
|
|
1820
1377
|
var $;
|
|
1821
1378
|
(function ($) {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1379
|
+
const level = $mol_data_enum('level', $hyoo_crowd_peer_level);
|
|
1380
|
+
let $hyoo_crowd_unit_kind;
|
|
1381
|
+
(function ($hyoo_crowd_unit_kind) {
|
|
1382
|
+
$hyoo_crowd_unit_kind[$hyoo_crowd_unit_kind["grab"] = 0] = "grab";
|
|
1383
|
+
$hyoo_crowd_unit_kind[$hyoo_crowd_unit_kind["join"] = 1] = "join";
|
|
1384
|
+
$hyoo_crowd_unit_kind[$hyoo_crowd_unit_kind["give"] = 2] = "give";
|
|
1385
|
+
$hyoo_crowd_unit_kind[$hyoo_crowd_unit_kind["data"] = 3] = "data";
|
|
1386
|
+
})($hyoo_crowd_unit_kind = $.$hyoo_crowd_unit_kind || ($.$hyoo_crowd_unit_kind = {}));
|
|
1387
|
+
let $hyoo_crowd_unit_group;
|
|
1388
|
+
(function ($hyoo_crowd_unit_group) {
|
|
1389
|
+
$hyoo_crowd_unit_group[$hyoo_crowd_unit_group["auth"] = 0] = "auth";
|
|
1390
|
+
$hyoo_crowd_unit_group[$hyoo_crowd_unit_group["data"] = 1] = "data";
|
|
1391
|
+
})($hyoo_crowd_unit_group = $.$hyoo_crowd_unit_group || ($.$hyoo_crowd_unit_group = {}));
|
|
1392
|
+
class $hyoo_crowd_unit extends Object {
|
|
1393
|
+
land;
|
|
1394
|
+
auth;
|
|
1395
|
+
head;
|
|
1396
|
+
self;
|
|
1397
|
+
next;
|
|
1398
|
+
prev;
|
|
1399
|
+
time;
|
|
1400
|
+
data;
|
|
1401
|
+
bin;
|
|
1402
|
+
constructor(land, auth, head, self, next, prev, time, data, bin) {
|
|
1403
|
+
super();
|
|
1404
|
+
this.land = land;
|
|
1405
|
+
this.auth = auth;
|
|
1406
|
+
this.head = head;
|
|
1407
|
+
this.self = self;
|
|
1408
|
+
this.next = next;
|
|
1409
|
+
this.prev = prev;
|
|
1410
|
+
this.time = time;
|
|
1411
|
+
this.data = data;
|
|
1412
|
+
this.bin = bin;
|
|
1834
1413
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
class $mol_data_error extends $mol_error_mix {
|
|
1844
|
-
}
|
|
1845
|
-
$.$mol_data_error = $mol_data_error;
|
|
1846
|
-
})($ || ($ = {}));
|
|
1847
|
-
|
|
1848
|
-
;
|
|
1849
|
-
"use strict";
|
|
1850
|
-
var $;
|
|
1851
|
-
(function ($) {
|
|
1852
|
-
function $mol_data_enum(name, dict) {
|
|
1853
|
-
const index = {};
|
|
1854
|
-
for (let key in dict) {
|
|
1855
|
-
if (Number.isNaN(Number(key))) {
|
|
1856
|
-
index[dict[key]] = key;
|
|
1414
|
+
kind() {
|
|
1415
|
+
if (this.head === this.self && this.auth === this.self) {
|
|
1416
|
+
if (this.head === this.land) {
|
|
1417
|
+
return $hyoo_crowd_unit_kind.grab;
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
return $hyoo_crowd_unit_kind.join;
|
|
1421
|
+
}
|
|
1857
1422
|
}
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
if (typeof index[value] !== 'string') {
|
|
1861
|
-
return $mol_fail(new $mol_data_error(`${value} is not value of ${name} enum`));
|
|
1423
|
+
if (this.head === this.land) {
|
|
1424
|
+
return $hyoo_crowd_unit_kind.give;
|
|
1862
1425
|
}
|
|
1863
|
-
return
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1426
|
+
return $hyoo_crowd_unit_kind.data;
|
|
1427
|
+
}
|
|
1428
|
+
group() {
|
|
1429
|
+
return this.kind() === $hyoo_crowd_unit_kind.data
|
|
1430
|
+
? $hyoo_crowd_unit_group.data
|
|
1431
|
+
: $hyoo_crowd_unit_group.auth;
|
|
1432
|
+
}
|
|
1433
|
+
level() {
|
|
1434
|
+
switch (this.kind()) {
|
|
1435
|
+
case $hyoo_crowd_unit_kind.grab: return $hyoo_crowd_peer_level.law;
|
|
1436
|
+
case $hyoo_crowd_unit_kind.give: return level(this.data);
|
|
1437
|
+
default: $mol_fail(new Error(`Wrong unit kind for getting level: ${this.kind()}`));
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
[Symbol.toPrimitive]() {
|
|
1441
|
+
return JSON.stringify(this);
|
|
1442
|
+
}
|
|
1443
|
+
[$mol_dev_format_head]() {
|
|
1444
|
+
switch (this.kind()) {
|
|
1445
|
+
case $hyoo_crowd_unit_kind.grab:
|
|
1446
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), ' 👑');
|
|
1447
|
+
case $hyoo_crowd_unit_kind.join:
|
|
1448
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' 🔑 ', this.self));
|
|
1449
|
+
case $hyoo_crowd_unit_kind.give:
|
|
1450
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' 🏅 ', this.self, ' '), $mol_dev_format_native($hyoo_crowd_peer_level[this.data] ?? this.data));
|
|
1451
|
+
case $hyoo_crowd_unit_kind.data:
|
|
1452
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' 📦 ', this.head, '!', this.self, ' '), $mol_dev_format_native(this.data));
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
$.$hyoo_crowd_unit = $hyoo_crowd_unit;
|
|
1457
|
+
const offset = {
|
|
1458
|
+
land_lo: 0,
|
|
1459
|
+
land_hi: 4,
|
|
1460
|
+
auth_lo: 8,
|
|
1461
|
+
auth_hi: 12,
|
|
1462
|
+
head_lo: 16,
|
|
1463
|
+
head_hi: 20,
|
|
1464
|
+
self_lo: 24,
|
|
1465
|
+
self_hi: 28,
|
|
1466
|
+
next_lo: 32,
|
|
1467
|
+
next_hi: 36,
|
|
1468
|
+
prev_lo: 40,
|
|
1469
|
+
prev_hi: 44,
|
|
1470
|
+
time: 48,
|
|
1471
|
+
size: 54,
|
|
1472
|
+
data: 56,
|
|
1473
|
+
};
|
|
1474
|
+
class $hyoo_crowd_unit_bin extends DataView {
|
|
1475
|
+
static from_buffer(buffer) {
|
|
1476
|
+
const size = Math.ceil(Math.abs(buffer[offset.size / 2]) / 8) * 8 + offset.data + $mol_crypto_auditor_sign_size;
|
|
1477
|
+
return new this(buffer.slice(0, size / 2).buffer);
|
|
1478
|
+
}
|
|
1479
|
+
static from_unit(unit) {
|
|
1480
|
+
if (unit.bin)
|
|
1481
|
+
return unit.bin;
|
|
1482
|
+
const type = unit.data === null
|
|
1483
|
+
? 0
|
|
1484
|
+
: unit.data instanceof Uint8Array
|
|
1485
|
+
? -1
|
|
1486
|
+
: 1;
|
|
1487
|
+
const buff = type === 0 ? null
|
|
1488
|
+
: type > 0 ? $mol_charset_encode(JSON.stringify(unit.data))
|
|
1489
|
+
: unit.data;
|
|
1490
|
+
const size = buff?.byteLength ?? 0;
|
|
1491
|
+
if (type > 0 && size > 2 ** 15 - 1)
|
|
1492
|
+
throw new Error(`Too large json data: ${size} > ${2 ** 15 - 1}`);
|
|
1493
|
+
if (type < 0 && size > 2 ** 15)
|
|
1494
|
+
throw new Error(`Too large binary data: ${size} > ${2 ** 15}`);
|
|
1495
|
+
const total = offset.data + Math.ceil(size / 8) * 8 + $mol_crypto_auditor_sign_size;
|
|
1496
|
+
const mem = new Uint8Array(total);
|
|
1497
|
+
const bin = new $hyoo_crowd_unit_bin(mem.buffer);
|
|
1498
|
+
const land = $mol_int62_from_string(unit.land);
|
|
1499
|
+
bin.setInt32(offset.land_lo, land.lo, true);
|
|
1500
|
+
bin.setInt32(offset.land_hi, land.hi, true);
|
|
1501
|
+
const auth = $mol_int62_from_string(unit.auth);
|
|
1502
|
+
bin.setInt32(offset.auth_lo, auth.lo, true);
|
|
1503
|
+
bin.setInt32(offset.auth_hi, auth.hi, true);
|
|
1504
|
+
const head = $mol_int62_from_string(unit.head);
|
|
1505
|
+
bin.setInt32(offset.head_lo, head.lo, true);
|
|
1506
|
+
bin.setInt32(offset.head_hi, head.hi, true);
|
|
1507
|
+
const self = $mol_int62_from_string(unit.self);
|
|
1508
|
+
bin.setInt32(offset.self_lo, self.lo, true);
|
|
1509
|
+
bin.setInt32(offset.self_hi, self.hi, true);
|
|
1510
|
+
const next = $mol_int62_from_string(unit.next);
|
|
1511
|
+
bin.setInt32(offset.next_lo, next.lo, true);
|
|
1512
|
+
bin.setInt32(offset.next_hi, next.hi, true);
|
|
1513
|
+
const prev = $mol_int62_from_string(unit.prev);
|
|
1514
|
+
bin.setInt32(offset.prev_lo, prev.lo, true);
|
|
1515
|
+
bin.setInt32(offset.prev_hi, prev.hi, true);
|
|
1516
|
+
bin.setInt32(offset.time, unit.time, true);
|
|
1517
|
+
bin.setInt16(offset.size, type * size, true);
|
|
1518
|
+
if (buff)
|
|
1519
|
+
mem.set(buff, offset.data);
|
|
1520
|
+
return bin;
|
|
1521
|
+
}
|
|
1522
|
+
sign(next) {
|
|
1523
|
+
const sign_offset = this.byteOffset + this.byteLength - $mol_crypto_auditor_sign_size;
|
|
1524
|
+
const buff = new Uint8Array(this.buffer, sign_offset, $mol_crypto_auditor_sign_size);
|
|
1525
|
+
if (!next)
|
|
1526
|
+
return buff;
|
|
1527
|
+
buff.set(next);
|
|
1528
|
+
return buff;
|
|
1529
|
+
}
|
|
1530
|
+
size() {
|
|
1531
|
+
return Math.ceil(Math.abs(this.getInt16(offset.size, true)) / 8) * 8 + offset.data + $mol_crypto_auditor_sign_size;
|
|
1532
|
+
}
|
|
1533
|
+
sens() {
|
|
1534
|
+
return new Uint8Array(this.buffer, this.byteOffset, this.size() - $mol_crypto_auditor_sign_size);
|
|
1535
|
+
}
|
|
1536
|
+
unit() {
|
|
1537
|
+
const land = $mol_int62_to_string({
|
|
1538
|
+
lo: this.getInt32(offset.land_lo, true) << 1 >> 1,
|
|
1539
|
+
hi: this.getInt32(offset.land_hi, true) << 1 >> 1,
|
|
1540
|
+
});
|
|
1541
|
+
const auth = $mol_int62_to_string({
|
|
1542
|
+
lo: this.getInt32(offset.auth_lo, true) << 1 >> 1,
|
|
1543
|
+
hi: this.getInt32(offset.auth_hi, true) << 1 >> 1,
|
|
1544
|
+
});
|
|
1545
|
+
const head = $mol_int62_to_string({
|
|
1546
|
+
lo: this.getInt32(offset.head_lo, true) << 1 >> 1,
|
|
1547
|
+
hi: this.getInt32(offset.head_hi, true) << 1 >> 1,
|
|
1548
|
+
});
|
|
1549
|
+
const self = $mol_int62_to_string({
|
|
1550
|
+
lo: this.getInt32(offset.self_lo, true) << 1 >> 1,
|
|
1551
|
+
hi: this.getInt32(offset.self_hi, true) << 1 >> 1,
|
|
1552
|
+
});
|
|
1553
|
+
const next = $mol_int62_to_string({
|
|
1554
|
+
lo: this.getInt32(offset.next_lo, true) << 1 >> 1,
|
|
1555
|
+
hi: this.getInt32(offset.next_hi, true) << 1 >> 1,
|
|
1556
|
+
});
|
|
1557
|
+
const prev = $mol_int62_to_string({
|
|
1558
|
+
lo: this.getInt32(offset.prev_lo, true) << 1 >> 1,
|
|
1559
|
+
hi: this.getInt32(offset.prev_hi, true) << 1 >> 1,
|
|
1560
|
+
});
|
|
1561
|
+
const time = this.getInt32(offset.time, true) << 1 >> 1;
|
|
1562
|
+
const type_size = this.getInt16(offset.size, true);
|
|
1563
|
+
let data = null;
|
|
1564
|
+
if (type_size) {
|
|
1565
|
+
try {
|
|
1566
|
+
var buff = new Uint8Array(this.buffer, this.byteOffset + offset.data, Math.abs(type_size));
|
|
1567
|
+
}
|
|
1568
|
+
catch (error) {
|
|
1569
|
+
error['message'] += `\nhead=${head};self=${self}`;
|
|
1570
|
+
$mol_fail_hidden(error);
|
|
1571
|
+
}
|
|
1572
|
+
if (type_size < 0)
|
|
1573
|
+
data = buff;
|
|
1574
|
+
else
|
|
1575
|
+
data = JSON.parse($mol_charset_decode(buff));
|
|
1576
|
+
}
|
|
1577
|
+
return new $hyoo_crowd_unit(land, auth, head, self, next, prev, time, data, this);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
$.$hyoo_crowd_unit_bin = $hyoo_crowd_unit_bin;
|
|
1581
|
+
function $hyoo_crowd_unit_compare(left, right) {
|
|
1582
|
+
return (left.group() - right.group())
|
|
1583
|
+
|| (left.time - right.time)
|
|
1584
|
+
|| ((left.auth > right.auth) ? 1 : (left.auth < right.auth) ? -1 : 0)
|
|
1585
|
+
|| ((left.self > right.self) ? 1 : (left.self < right.self) ? -1 : 0)
|
|
1586
|
+
|| ((left.head > right.head) ? 1 : (left.head < right.head) ? -1 : 0)
|
|
1587
|
+
|| ((left.prev > right.prev) ? 1 : (left.prev < right.prev) ? -1 : 0)
|
|
1588
|
+
|| ((left.next > right.next) ? 1 : (left.next < right.next) ? -1 : 0)
|
|
1589
|
+
|| ((left.land > right.land) ? 1 : (left.land < right.land) ? -1 : 0);
|
|
1590
|
+
}
|
|
1591
|
+
$.$hyoo_crowd_unit_compare = $hyoo_crowd_unit_compare;
|
|
1874
1592
|
})($ || ($ = {}));
|
|
1875
1593
|
|
|
1876
1594
|
;
|
|
1877
1595
|
"use strict";
|
|
1878
1596
|
var $;
|
|
1879
1597
|
(function ($) {
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1598
|
+
let $mol_wire_cursor;
|
|
1599
|
+
(function ($mol_wire_cursor) {
|
|
1600
|
+
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
1601
|
+
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
1602
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
1603
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
1604
|
+
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
1884
1605
|
})($ || ($ = {}));
|
|
1885
1606
|
|
|
1886
1607
|
;
|
|
1887
1608
|
"use strict";
|
|
1888
1609
|
var $;
|
|
1889
1610
|
(function ($) {
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1611
|
+
class $mol_wire_pub extends Object {
|
|
1612
|
+
data = [];
|
|
1613
|
+
static get [Symbol.species]() {
|
|
1614
|
+
return Array;
|
|
1615
|
+
}
|
|
1616
|
+
sub_from = 0;
|
|
1617
|
+
get sub_list() {
|
|
1618
|
+
const res = [];
|
|
1619
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
1620
|
+
res.push(this.data[i]);
|
|
1621
|
+
}
|
|
1622
|
+
return res;
|
|
1623
|
+
}
|
|
1624
|
+
get sub_empty() {
|
|
1625
|
+
return this.sub_from === this.data.length;
|
|
1626
|
+
}
|
|
1627
|
+
sub_on(sub, pub_pos) {
|
|
1628
|
+
const pos = this.data.length;
|
|
1629
|
+
this.data.push(sub, pub_pos);
|
|
1630
|
+
return pos;
|
|
1631
|
+
}
|
|
1632
|
+
sub_off(sub_pos) {
|
|
1633
|
+
if (!(sub_pos < this.data.length)) {
|
|
1634
|
+
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
1635
|
+
}
|
|
1636
|
+
const end = this.data.length - 2;
|
|
1637
|
+
if (sub_pos !== end) {
|
|
1638
|
+
this.peer_move(end, sub_pos);
|
|
1639
|
+
}
|
|
1640
|
+
this.data.pop();
|
|
1641
|
+
this.data.pop();
|
|
1642
|
+
if (this.data.length === this.sub_from)
|
|
1643
|
+
this.reap();
|
|
1644
|
+
}
|
|
1645
|
+
reap() { }
|
|
1646
|
+
promote() {
|
|
1647
|
+
$mol_wire_auto()?.track_next(this);
|
|
1648
|
+
}
|
|
1649
|
+
fresh() { }
|
|
1650
|
+
complete() { }
|
|
1651
|
+
get incompleted() {
|
|
1652
|
+
return false;
|
|
1653
|
+
}
|
|
1654
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
1655
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
1656
|
+
;
|
|
1657
|
+
this.data[i].absorb(quant);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
peer_move(from_pos, to_pos) {
|
|
1661
|
+
const peer = this.data[from_pos];
|
|
1662
|
+
const self_pos = this.data[from_pos + 1];
|
|
1663
|
+
this.data[to_pos] = peer;
|
|
1664
|
+
this.data[to_pos + 1] = self_pos;
|
|
1665
|
+
peer.peer_repos(self_pos, to_pos);
|
|
1666
|
+
}
|
|
1667
|
+
peer_repos(peer_pos, self_pos) {
|
|
1668
|
+
this.data[peer_pos + 1] = self_pos;
|
|
1669
|
+
}
|
|
1896
1670
|
}
|
|
1897
|
-
$.$
|
|
1898
|
-
$.$mol_base64_encode = $mol_base64_encode_node;
|
|
1671
|
+
$.$mol_wire_pub = $mol_wire_pub;
|
|
1899
1672
|
})($ || ($ = {}));
|
|
1900
1673
|
|
|
1901
1674
|
;
|
|
1902
1675
|
"use strict";
|
|
1903
|
-
var $;
|
|
1904
|
-
(function ($) {
|
|
1905
|
-
function $mol_base64_decode(base64) {
|
|
1906
|
-
throw new Error('Not implemented');
|
|
1907
|
-
}
|
|
1908
|
-
$.$mol_base64_decode = $mol_base64_decode;
|
|
1909
|
-
})($ || ($ = {}));
|
|
1910
1676
|
|
|
1911
1677
|
;
|
|
1912
1678
|
"use strict";
|
|
1913
1679
|
var $;
|
|
1914
1680
|
(function ($) {
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1919
|
-
}
|
|
1920
|
-
$.$mol_base64_decode_node = $mol_base64_decode_node;
|
|
1921
|
-
$.$mol_base64_decode = $mol_base64_decode_node;
|
|
1922
|
-
})($ || ($ = {}));
|
|
1923
|
-
|
|
1924
|
-
;
|
|
1925
|
-
"use strict";
|
|
1926
|
-
var $;
|
|
1927
|
-
(function ($) {
|
|
1928
|
-
function $mol_base64_url_encode(buffer) {
|
|
1929
|
-
return $mol_base64_encode(buffer).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
1930
|
-
}
|
|
1931
|
-
$.$mol_base64_url_encode = $mol_base64_url_encode;
|
|
1932
|
-
function $mol_base64_url_decode(str) {
|
|
1933
|
-
return $mol_base64_decode(str.replace(/-/g, '+').replace(/_/g, '/'));
|
|
1681
|
+
$.$mol_wire_auto_sub = null;
|
|
1682
|
+
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
1683
|
+
return $.$mol_wire_auto_sub = next;
|
|
1934
1684
|
}
|
|
1935
|
-
$.$
|
|
1685
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
1686
|
+
$.$mol_wire_affected = [];
|
|
1936
1687
|
})($ || ($ = {}));
|
|
1937
1688
|
|
|
1938
1689
|
;
|
|
1939
1690
|
"use strict";
|
|
1940
1691
|
var $;
|
|
1941
1692
|
(function ($) {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
async function $mol_crypto_auditor_pair() {
|
|
1948
|
-
const pair = await $mol_crypto_native.subtle.generateKey(algorithm, true, ['sign', 'verify']);
|
|
1949
|
-
return {
|
|
1950
|
-
public: new $mol_crypto_auditor_public(pair.publicKey),
|
|
1951
|
-
private: new $mol_crypto_auditor_private(pair.privateKey),
|
|
1952
|
-
};
|
|
1953
|
-
}
|
|
1954
|
-
$.$mol_crypto_auditor_pair = $mol_crypto_auditor_pair;
|
|
1955
|
-
class $mol_crypto_auditor_public extends Object {
|
|
1956
|
-
native;
|
|
1957
|
-
static size_str = 86;
|
|
1958
|
-
static size_bin = 64;
|
|
1959
|
-
constructor(native) {
|
|
1960
|
-
super();
|
|
1961
|
-
this.native = native;
|
|
1693
|
+
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
1694
|
+
pub_from = 0;
|
|
1695
|
+
cursor = $mol_wire_cursor.stale;
|
|
1696
|
+
get temp() {
|
|
1697
|
+
return false;
|
|
1962
1698
|
}
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1699
|
+
get pub_list() {
|
|
1700
|
+
const res = [];
|
|
1701
|
+
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
1702
|
+
for (let i = this.pub_from; i < max; i += 2) {
|
|
1703
|
+
if (this.data[i])
|
|
1704
|
+
res.push(this.data[i]);
|
|
1967
1705
|
}
|
|
1968
|
-
return
|
|
1969
|
-
crv: "P-256",
|
|
1970
|
-
ext: true,
|
|
1971
|
-
key_ops: ['verify'],
|
|
1972
|
-
kty: "EC",
|
|
1973
|
-
x: serial.slice(0, 43),
|
|
1974
|
-
y: serial.slice(43, 86),
|
|
1975
|
-
}, algorithm, true, ['verify']));
|
|
1706
|
+
return res;
|
|
1976
1707
|
}
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1708
|
+
track_on() {
|
|
1709
|
+
this.cursor = this.pub_from;
|
|
1710
|
+
const sub = $mol_wire_auto();
|
|
1711
|
+
$mol_wire_auto(this);
|
|
1712
|
+
return sub;
|
|
1980
1713
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
]);
|
|
1714
|
+
promote() {
|
|
1715
|
+
if (this.cursor >= this.pub_from) {
|
|
1716
|
+
$mol_fail(new Error('Circular subscription'));
|
|
1717
|
+
}
|
|
1718
|
+
super.promote();
|
|
1987
1719
|
}
|
|
1988
|
-
|
|
1989
|
-
|
|
1720
|
+
track_next(pub) {
|
|
1721
|
+
if (this.cursor < 0)
|
|
1722
|
+
$mol_fail(new Error('Promo to non begun sub'));
|
|
1723
|
+
if (this.cursor < this.sub_from) {
|
|
1724
|
+
const next = this.data[this.cursor];
|
|
1725
|
+
if (pub === undefined)
|
|
1726
|
+
return next ?? null;
|
|
1727
|
+
if (next === pub) {
|
|
1728
|
+
this.cursor += 2;
|
|
1729
|
+
return next;
|
|
1730
|
+
}
|
|
1731
|
+
if (next) {
|
|
1732
|
+
if (this.sub_from < this.data.length) {
|
|
1733
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
1734
|
+
}
|
|
1735
|
+
this.peer_move(this.cursor, this.sub_from);
|
|
1736
|
+
this.sub_from += 2;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
else {
|
|
1740
|
+
if (pub === undefined)
|
|
1741
|
+
return null;
|
|
1742
|
+
if (this.sub_from < this.data.length) {
|
|
1743
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
1744
|
+
}
|
|
1745
|
+
this.sub_from += 2;
|
|
1746
|
+
}
|
|
1747
|
+
this.data[this.cursor] = pub;
|
|
1748
|
+
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
1749
|
+
this.cursor += 2;
|
|
1750
|
+
return pub;
|
|
1990
1751
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
1752
|
+
track_off(sub) {
|
|
1753
|
+
$mol_wire_auto(sub);
|
|
1754
|
+
if (this.cursor < 0) {
|
|
1755
|
+
$mol_fail(new Error('End of non begun sub'));
|
|
1756
|
+
}
|
|
1757
|
+
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
1758
|
+
const pub = this.data[cursor];
|
|
1759
|
+
pub.fresh();
|
|
1760
|
+
}
|
|
1761
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
2000
1762
|
}
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
1763
|
+
pub_off(sub_pos) {
|
|
1764
|
+
this.data[sub_pos] = undefined;
|
|
1765
|
+
this.data[sub_pos + 1] = undefined;
|
|
1766
|
+
}
|
|
1767
|
+
destructor() {
|
|
1768
|
+
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
1769
|
+
const sub = this.data[cursor];
|
|
1770
|
+
const pos = this.data[cursor + 1];
|
|
1771
|
+
sub.pub_off(pos);
|
|
1772
|
+
this.data.pop();
|
|
1773
|
+
this.data.pop();
|
|
2006
1774
|
}
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
key_ops: ['sign'],
|
|
2011
|
-
kty: "EC",
|
|
2012
|
-
x: serial.slice(0, 43),
|
|
2013
|
-
y: serial.slice(43, 86),
|
|
2014
|
-
d: serial.slice(86, 129),
|
|
2015
|
-
}, algorithm, true, ['sign']));
|
|
1775
|
+
this.cursor = this.pub_from;
|
|
1776
|
+
this.track_cut();
|
|
1777
|
+
this.cursor = $mol_wire_cursor.final;
|
|
2016
1778
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
1779
|
+
track_cut() {
|
|
1780
|
+
if (this.cursor < this.pub_from) {
|
|
1781
|
+
$mol_fail(new Error('Cut of non begun sub'));
|
|
1782
|
+
}
|
|
1783
|
+
let tail = 0;
|
|
1784
|
+
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
1785
|
+
const pub = this.data[cursor];
|
|
1786
|
+
pub?.sub_off(this.data[cursor + 1]);
|
|
1787
|
+
if (this.sub_from < this.data.length) {
|
|
1788
|
+
this.peer_move(this.data.length - 2, cursor);
|
|
1789
|
+
this.data.pop();
|
|
1790
|
+
this.data.pop();
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
++tail;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
for (; tail; --tail) {
|
|
1797
|
+
this.data.pop();
|
|
1798
|
+
this.data.pop();
|
|
1799
|
+
}
|
|
1800
|
+
this.sub_from = this.cursor;
|
|
2020
1801
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
1802
|
+
complete() { }
|
|
1803
|
+
complete_pubs() {
|
|
1804
|
+
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
1805
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1806
|
+
const pub = this.data[cursor];
|
|
1807
|
+
if (pub?.incompleted)
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1811
|
+
const pub = this.data[cursor];
|
|
1812
|
+
pub?.complete();
|
|
1813
|
+
}
|
|
2028
1814
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
1815
|
+
absorb(quant = $mol_wire_cursor.stale) {
|
|
1816
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
1817
|
+
return;
|
|
1818
|
+
if (this.cursor >= quant)
|
|
1819
|
+
return;
|
|
1820
|
+
this.cursor = quant;
|
|
1821
|
+
this.emit($mol_wire_cursor.doubt);
|
|
2031
1822
|
}
|
|
2032
|
-
|
|
2033
|
-
return
|
|
1823
|
+
[$mol_dev_format_head]() {
|
|
1824
|
+
return $mol_dev_format_native(this);
|
|
1825
|
+
}
|
|
1826
|
+
get pub_empty() {
|
|
1827
|
+
return this.sub_from === this.pub_from;
|
|
2034
1828
|
}
|
|
2035
1829
|
}
|
|
2036
|
-
$.$
|
|
2037
|
-
$.$mol_crypto_auditor_sign_size = 64;
|
|
2038
|
-
function $mol_crypto_auditor_private_to_public(serial) {
|
|
2039
|
-
return serial.slice(0, 86);
|
|
2040
|
-
}
|
|
2041
|
-
$.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
|
|
1830
|
+
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
2042
1831
|
})($ || ($ = {}));
|
|
2043
1832
|
|
|
2044
1833
|
;
|
|
2045
1834
|
"use strict";
|
|
2046
1835
|
var $;
|
|
2047
1836
|
(function ($) {
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["add"] = 1] = "add";
|
|
2052
|
-
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["mod"] = 2] = "mod";
|
|
2053
|
-
$hyoo_crowd_peer_level[$hyoo_crowd_peer_level["law"] = 3] = "law";
|
|
2054
|
-
})($hyoo_crowd_peer_level = $.$hyoo_crowd_peer_level || ($.$hyoo_crowd_peer_level = {}));
|
|
2055
|
-
class $hyoo_crowd_peer extends Object {
|
|
2056
|
-
key_public;
|
|
2057
|
-
key_public_serial;
|
|
2058
|
-
key_private;
|
|
2059
|
-
key_private_serial;
|
|
1837
|
+
class $mol_after_timeout extends $mol_object2 {
|
|
1838
|
+
delay;
|
|
1839
|
+
task;
|
|
2060
1840
|
id;
|
|
2061
|
-
constructor(
|
|
1841
|
+
constructor(delay, task) {
|
|
2062
1842
|
super();
|
|
2063
|
-
this.
|
|
2064
|
-
this.
|
|
2065
|
-
this.
|
|
2066
|
-
this.key_private_serial = key_private_serial;
|
|
2067
|
-
this.id = $mol_int62_hash_string(this.key_public_serial);
|
|
2068
|
-
}
|
|
2069
|
-
static async generate() {
|
|
2070
|
-
const pair = await $$.$mol_crypto_auditor_pair();
|
|
2071
|
-
const serial = await pair.private.serial();
|
|
2072
|
-
return new this(pair.public, $mol_crypto_auditor_private_to_public(serial), pair.private, serial);
|
|
1843
|
+
this.delay = delay;
|
|
1844
|
+
this.task = task;
|
|
1845
|
+
this.id = setTimeout(task, delay);
|
|
2073
1846
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
1847
|
+
destructor() {
|
|
1848
|
+
clearTimeout(this.id);
|
|
2076
1849
|
}
|
|
2077
1850
|
}
|
|
2078
|
-
$.$
|
|
1851
|
+
$.$mol_after_timeout = $mol_after_timeout;
|
|
2079
1852
|
})($ || ($ = {}));
|
|
2080
1853
|
|
|
2081
|
-
;
|
|
2082
|
-
"use strict";
|
|
2083
|
-
|
|
2084
1854
|
;
|
|
2085
1855
|
"use strict";
|
|
2086
1856
|
var $;
|
|
2087
1857
|
(function ($) {
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
1858
|
+
class $mol_after_frame extends $mol_after_timeout {
|
|
1859
|
+
task;
|
|
1860
|
+
constructor(task) {
|
|
1861
|
+
super(16, task);
|
|
1862
|
+
this.task = task;
|
|
1863
|
+
}
|
|
2094
1864
|
}
|
|
2095
|
-
$.$
|
|
1865
|
+
$.$mol_after_frame = $mol_after_frame;
|
|
2096
1866
|
})($ || ($ = {}));
|
|
2097
1867
|
|
|
2098
1868
|
;
|
|
2099
1869
|
"use strict";
|
|
2100
1870
|
var $;
|
|
2101
1871
|
(function ($) {
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
land;
|
|
2117
|
-
auth;
|
|
2118
|
-
head;
|
|
2119
|
-
self;
|
|
2120
|
-
next;
|
|
2121
|
-
prev;
|
|
2122
|
-
time;
|
|
2123
|
-
data;
|
|
2124
|
-
bin;
|
|
2125
|
-
constructor(land, auth, head, self, next, prev, time, data, bin) {
|
|
2126
|
-
super();
|
|
2127
|
-
this.land = land;
|
|
2128
|
-
this.auth = auth;
|
|
2129
|
-
this.head = head;
|
|
2130
|
-
this.self = self;
|
|
2131
|
-
this.next = next;
|
|
2132
|
-
this.prev = prev;
|
|
2133
|
-
this.time = time;
|
|
2134
|
-
this.data = data;
|
|
2135
|
-
this.bin = bin;
|
|
2136
|
-
}
|
|
2137
|
-
kind() {
|
|
2138
|
-
if (this.head === this.self && this.auth === this.self) {
|
|
2139
|
-
if (this.head === this.land) {
|
|
2140
|
-
return $hyoo_crowd_unit_kind.grab;
|
|
1872
|
+
const handled = new WeakSet();
|
|
1873
|
+
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
1874
|
+
task;
|
|
1875
|
+
host;
|
|
1876
|
+
static warm = true;
|
|
1877
|
+
static planning = new Set();
|
|
1878
|
+
static reaping = new Set();
|
|
1879
|
+
static plan_task = null;
|
|
1880
|
+
static plan() {
|
|
1881
|
+
if (this.plan_task)
|
|
1882
|
+
return;
|
|
1883
|
+
this.plan_task = new $mol_after_frame(() => {
|
|
1884
|
+
try {
|
|
1885
|
+
this.sync();
|
|
2141
1886
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
1887
|
+
finally {
|
|
1888
|
+
$mol_wire_fiber.plan_task = null;
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
static sync() {
|
|
1893
|
+
while (this.planning.size) {
|
|
1894
|
+
for (const fiber of this.planning) {
|
|
1895
|
+
this.planning.delete(fiber);
|
|
1896
|
+
if (fiber.cursor >= 0)
|
|
1897
|
+
continue;
|
|
1898
|
+
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1899
|
+
continue;
|
|
1900
|
+
fiber.fresh();
|
|
2144
1901
|
}
|
|
2145
1902
|
}
|
|
2146
|
-
|
|
2147
|
-
|
|
1903
|
+
while (this.reaping.size) {
|
|
1904
|
+
const fibers = this.reaping;
|
|
1905
|
+
this.reaping = new Set;
|
|
1906
|
+
for (const fiber of fibers) {
|
|
1907
|
+
if (!fiber.sub_empty)
|
|
1908
|
+
continue;
|
|
1909
|
+
fiber.destructor();
|
|
1910
|
+
}
|
|
2148
1911
|
}
|
|
2149
|
-
return $hyoo_crowd_unit_kind.data;
|
|
2150
1912
|
}
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
1913
|
+
[Symbol.toStringTag];
|
|
1914
|
+
cache = undefined;
|
|
1915
|
+
get args() {
|
|
1916
|
+
return this.data.slice(0, this.pub_from);
|
|
2155
1917
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
1918
|
+
result() {
|
|
1919
|
+
if ($mol_promise_like(this.cache))
|
|
1920
|
+
return;
|
|
1921
|
+
if (this.cache instanceof Error)
|
|
1922
|
+
return;
|
|
1923
|
+
return this.cache;
|
|
2162
1924
|
}
|
|
2163
|
-
|
|
2164
|
-
return
|
|
1925
|
+
get incompleted() {
|
|
1926
|
+
return $mol_promise_like(this.cache);
|
|
2165
1927
|
}
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
case $hyoo_crowd_unit_kind.grab:
|
|
2169
|
-
return $mol_dev_format_div({}, $mol_dev_format_native(this), ' 👑');
|
|
2170
|
-
case $hyoo_crowd_unit_kind.join:
|
|
2171
|
-
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' 🔑 ', this.self));
|
|
2172
|
-
case $hyoo_crowd_unit_kind.give:
|
|
2173
|
-
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' 🏅 ', this.self, ' '), $mol_dev_format_native($hyoo_crowd_peer_level[this.data] ?? this.data));
|
|
2174
|
-
case $hyoo_crowd_unit_kind.data:
|
|
2175
|
-
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' 📦 ', this.head, '!', this.self, ' '), $mol_dev_format_native(this.data));
|
|
2176
|
-
}
|
|
1928
|
+
field() {
|
|
1929
|
+
return this.task.name + '<>';
|
|
2177
1930
|
}
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
head_hi: 20,
|
|
2187
|
-
self_lo: 24,
|
|
2188
|
-
self_hi: 28,
|
|
2189
|
-
next_lo: 32,
|
|
2190
|
-
next_hi: 36,
|
|
2191
|
-
prev_lo: 40,
|
|
2192
|
-
prev_hi: 44,
|
|
2193
|
-
time: 48,
|
|
2194
|
-
size: 54,
|
|
2195
|
-
data: 56,
|
|
2196
|
-
};
|
|
2197
|
-
class $hyoo_crowd_unit_bin extends DataView {
|
|
2198
|
-
static from_buffer(buffer) {
|
|
2199
|
-
const size = Math.ceil(Math.abs(buffer[offset.size / 2]) / 8) * 8 + offset.data + $mol_crypto_auditor_sign_size;
|
|
2200
|
-
return new this(buffer.slice(0, size / 2).buffer);
|
|
1931
|
+
constructor(id, task, host, args) {
|
|
1932
|
+
super();
|
|
1933
|
+
this.task = task;
|
|
1934
|
+
this.host = host;
|
|
1935
|
+
if (args)
|
|
1936
|
+
this.data.push(...args);
|
|
1937
|
+
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
1938
|
+
this[Symbol.toStringTag] = id;
|
|
2201
1939
|
}
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
const type = unit.data === null
|
|
2206
|
-
? 0
|
|
2207
|
-
: unit.data instanceof Uint8Array
|
|
2208
|
-
? -1
|
|
2209
|
-
: 1;
|
|
2210
|
-
const buff = type === 0 ? null
|
|
2211
|
-
: type > 0 ? $mol_charset_encode(JSON.stringify(unit.data))
|
|
2212
|
-
: unit.data;
|
|
2213
|
-
const size = buff?.byteLength ?? 0;
|
|
2214
|
-
if (type > 0 && size > 2 ** 15 - 1)
|
|
2215
|
-
throw new Error(`Too large json data: ${size} > ${2 ** 15 - 1}`);
|
|
2216
|
-
if (type < 0 && size > 2 ** 15)
|
|
2217
|
-
throw new Error(`Too large binary data: ${size} > ${2 ** 15}`);
|
|
2218
|
-
const total = offset.data + Math.ceil(size / 8) * 8 + $mol_crypto_auditor_sign_size;
|
|
2219
|
-
const mem = new Uint8Array(total);
|
|
2220
|
-
const bin = new $hyoo_crowd_unit_bin(mem.buffer);
|
|
2221
|
-
const land = $mol_int62_from_string(unit.land);
|
|
2222
|
-
bin.setInt32(offset.land_lo, land.lo, true);
|
|
2223
|
-
bin.setInt32(offset.land_hi, land.hi, true);
|
|
2224
|
-
const auth = $mol_int62_from_string(unit.auth);
|
|
2225
|
-
bin.setInt32(offset.auth_lo, auth.lo, true);
|
|
2226
|
-
bin.setInt32(offset.auth_hi, auth.hi, true);
|
|
2227
|
-
const head = $mol_int62_from_string(unit.head);
|
|
2228
|
-
bin.setInt32(offset.head_lo, head.lo, true);
|
|
2229
|
-
bin.setInt32(offset.head_hi, head.hi, true);
|
|
2230
|
-
const self = $mol_int62_from_string(unit.self);
|
|
2231
|
-
bin.setInt32(offset.self_lo, self.lo, true);
|
|
2232
|
-
bin.setInt32(offset.self_hi, self.hi, true);
|
|
2233
|
-
const next = $mol_int62_from_string(unit.next);
|
|
2234
|
-
bin.setInt32(offset.next_lo, next.lo, true);
|
|
2235
|
-
bin.setInt32(offset.next_hi, next.hi, true);
|
|
2236
|
-
const prev = $mol_int62_from_string(unit.prev);
|
|
2237
|
-
bin.setInt32(offset.prev_lo, prev.lo, true);
|
|
2238
|
-
bin.setInt32(offset.prev_hi, prev.hi, true);
|
|
2239
|
-
bin.setInt32(offset.time, unit.time, true);
|
|
2240
|
-
bin.setInt16(offset.size, type * size, true);
|
|
2241
|
-
if (buff)
|
|
2242
|
-
mem.set(buff, offset.data);
|
|
2243
|
-
return bin;
|
|
1940
|
+
plan() {
|
|
1941
|
+
$mol_wire_fiber.planning.add(this);
|
|
1942
|
+
$mol_wire_fiber.plan();
|
|
2244
1943
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
if (!next)
|
|
2249
|
-
return buff;
|
|
2250
|
-
buff.set(next);
|
|
2251
|
-
return buff;
|
|
1944
|
+
reap() {
|
|
1945
|
+
$mol_wire_fiber.reaping.add(this);
|
|
1946
|
+
$mol_wire_fiber.plan();
|
|
2252
1947
|
}
|
|
2253
|
-
|
|
2254
|
-
return
|
|
1948
|
+
toString() {
|
|
1949
|
+
return this[Symbol.toStringTag];
|
|
2255
1950
|
}
|
|
2256
|
-
|
|
2257
|
-
return
|
|
1951
|
+
toJSON() {
|
|
1952
|
+
return this[Symbol.toStringTag];
|
|
2258
1953
|
}
|
|
2259
|
-
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
if (
|
|
2288
|
-
|
|
2289
|
-
|
|
1954
|
+
[$mol_dev_format_head]() {
|
|
1955
|
+
const cursor = {
|
|
1956
|
+
[$mol_wire_cursor.stale]: '🔴',
|
|
1957
|
+
[$mol_wire_cursor.doubt]: '🟡',
|
|
1958
|
+
[$mol_wire_cursor.fresh]: '🟢',
|
|
1959
|
+
[$mol_wire_cursor.final]: '🔵',
|
|
1960
|
+
}[this.cursor] ?? this.cursor.toString();
|
|
1961
|
+
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
1962
|
+
? $mol_dev_format_auto({
|
|
1963
|
+
[$mol_dev_format_head]: () => $mol_dev_format_shade(cursor),
|
|
1964
|
+
[$mol_dev_format_body]: () => $mol_dev_format_native(this),
|
|
1965
|
+
})
|
|
1966
|
+
: $mol_dev_format_shade($mol_dev_format_native(this), cursor), $mol_dev_format_auto(this.cache));
|
|
1967
|
+
}
|
|
1968
|
+
get $() {
|
|
1969
|
+
return (this.host ?? this.task)['$'];
|
|
1970
|
+
}
|
|
1971
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
1972
|
+
if (this.sub_empty)
|
|
1973
|
+
this.plan();
|
|
1974
|
+
else
|
|
1975
|
+
super.emit(quant);
|
|
1976
|
+
}
|
|
1977
|
+
fresh() {
|
|
1978
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1979
|
+
return;
|
|
1980
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
1981
|
+
return;
|
|
1982
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1983
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1984
|
+
;
|
|
1985
|
+
this.data[i]?.fresh();
|
|
1986
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1987
|
+
break check;
|
|
2290
1988
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
1989
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
const bu = this.track_on();
|
|
1993
|
+
let result;
|
|
1994
|
+
try {
|
|
1995
|
+
switch (this.pub_from) {
|
|
1996
|
+
case 0:
|
|
1997
|
+
result = this.task.call(this.host);
|
|
1998
|
+
break;
|
|
1999
|
+
case 1:
|
|
2000
|
+
result = this.task.call(this.host, this.data[0]);
|
|
2001
|
+
break;
|
|
2002
|
+
default:
|
|
2003
|
+
result = this.task.call(this.host, ...this.args);
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
2007
|
+
const put = (res) => {
|
|
2008
|
+
if (this.cache === result)
|
|
2009
|
+
this.put(res);
|
|
2010
|
+
return res;
|
|
2011
|
+
};
|
|
2012
|
+
result = result.then(put, put);
|
|
2294
2013
|
}
|
|
2295
|
-
if (type_size < 0)
|
|
2296
|
-
data = buff;
|
|
2297
|
-
else
|
|
2298
|
-
data = JSON.parse($mol_charset_decode(buff));
|
|
2299
2014
|
}
|
|
2300
|
-
|
|
2015
|
+
catch (error) {
|
|
2016
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
2017
|
+
result = error;
|
|
2018
|
+
}
|
|
2019
|
+
else {
|
|
2020
|
+
result = new Error(String(error), { cause: error });
|
|
2021
|
+
}
|
|
2022
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
2023
|
+
result = result.finally(() => {
|
|
2024
|
+
if (this.cache === result)
|
|
2025
|
+
this.absorb();
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
2030
|
+
result = Object.assign(result, {
|
|
2031
|
+
destructor: result['destructor'] ?? (() => { })
|
|
2032
|
+
});
|
|
2033
|
+
handled.add(result);
|
|
2034
|
+
const error = new Error(`Promise in ${this}`);
|
|
2035
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
2036
|
+
}
|
|
2037
|
+
if (!$mol_promise_like(result)) {
|
|
2038
|
+
this.track_cut();
|
|
2039
|
+
}
|
|
2040
|
+
this.track_off(bu);
|
|
2041
|
+
this.put(result);
|
|
2042
|
+
}
|
|
2043
|
+
refresh() {
|
|
2044
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
2045
|
+
this.fresh();
|
|
2046
|
+
}
|
|
2047
|
+
sync() {
|
|
2048
|
+
if (!$mol_wire_fiber.warm) {
|
|
2049
|
+
return this.result();
|
|
2050
|
+
}
|
|
2051
|
+
this.promote();
|
|
2052
|
+
this.fresh();
|
|
2053
|
+
if (this.cache instanceof Error) {
|
|
2054
|
+
return $mol_fail_hidden(this.cache);
|
|
2055
|
+
}
|
|
2056
|
+
if ($mol_promise_like(this.cache)) {
|
|
2057
|
+
return $mol_fail_hidden(this.cache);
|
|
2058
|
+
}
|
|
2059
|
+
return this.cache;
|
|
2060
|
+
}
|
|
2061
|
+
async async() {
|
|
2062
|
+
while (true) {
|
|
2063
|
+
this.fresh();
|
|
2064
|
+
if (this.cache instanceof Error) {
|
|
2065
|
+
$mol_fail_hidden(this.cache);
|
|
2066
|
+
}
|
|
2067
|
+
if (!$mol_promise_like(this.cache))
|
|
2068
|
+
return this.cache;
|
|
2069
|
+
await Promise.race([this.cache, this.step()]);
|
|
2070
|
+
if (!$mol_promise_like(this.cache))
|
|
2071
|
+
return this.cache;
|
|
2072
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
2073
|
+
await new Promise(() => { });
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
step() {
|
|
2078
|
+
return new Promise(done => {
|
|
2079
|
+
const sub = new $mol_wire_pub_sub;
|
|
2080
|
+
const prev = sub.track_on();
|
|
2081
|
+
sub.track_next(this);
|
|
2082
|
+
sub.track_off(prev);
|
|
2083
|
+
sub.absorb = () => {
|
|
2084
|
+
done(null);
|
|
2085
|
+
sub.destructor();
|
|
2086
|
+
};
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
2091
|
+
})($ || ($ = {}));
|
|
2092
|
+
|
|
2093
|
+
;
|
|
2094
|
+
"use strict";
|
|
2095
|
+
var $;
|
|
2096
|
+
(function ($) {
|
|
2097
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
2098
|
+
for (;;) {
|
|
2099
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
2100
|
+
if (exists(id))
|
|
2101
|
+
continue;
|
|
2102
|
+
return id;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
$.$mol_guid = $mol_guid;
|
|
2106
|
+
})($ || ($ = {}));
|
|
2107
|
+
|
|
2108
|
+
;
|
|
2109
|
+
"use strict";
|
|
2110
|
+
var $;
|
|
2111
|
+
(function ($) {
|
|
2112
|
+
$.$mol_key_store = new WeakMap();
|
|
2113
|
+
function $mol_key(value) {
|
|
2114
|
+
if (typeof value === 'bigint')
|
|
2115
|
+
return value.toString() + 'n';
|
|
2116
|
+
if (typeof value === 'symbol')
|
|
2117
|
+
return value.description;
|
|
2118
|
+
if (!value)
|
|
2119
|
+
return JSON.stringify(value);
|
|
2120
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
2121
|
+
return JSON.stringify(value);
|
|
2122
|
+
return JSON.stringify(value, (field, value) => {
|
|
2123
|
+
if (typeof value === 'bigint')
|
|
2124
|
+
return value.toString() + 'n';
|
|
2125
|
+
if (typeof value === 'symbol')
|
|
2126
|
+
return value.description;
|
|
2127
|
+
if (!value)
|
|
2128
|
+
return value;
|
|
2129
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
2130
|
+
return value;
|
|
2131
|
+
if (Array.isArray(value))
|
|
2132
|
+
return value;
|
|
2133
|
+
const proto = Reflect.getPrototypeOf(value);
|
|
2134
|
+
if (!proto)
|
|
2135
|
+
return value;
|
|
2136
|
+
if (Reflect.getPrototypeOf(proto) === null)
|
|
2137
|
+
return value;
|
|
2138
|
+
if ('toJSON' in value)
|
|
2139
|
+
return value;
|
|
2140
|
+
if (value instanceof RegExp)
|
|
2141
|
+
return value.toString();
|
|
2142
|
+
if (value instanceof Uint8Array)
|
|
2143
|
+
return [...value];
|
|
2144
|
+
let key = $.$mol_key_store.get(value);
|
|
2145
|
+
if (key)
|
|
2146
|
+
return key;
|
|
2147
|
+
key = $mol_guid();
|
|
2148
|
+
$.$mol_key_store.set(value, key);
|
|
2149
|
+
return key;
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
$.$mol_key = $mol_key;
|
|
2153
|
+
})($ || ($ = {}));
|
|
2154
|
+
|
|
2155
|
+
;
|
|
2156
|
+
"use strict";
|
|
2157
|
+
var $;
|
|
2158
|
+
(function ($) {
|
|
2159
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
2160
|
+
function $mol_compare_deep(left, right) {
|
|
2161
|
+
if (Object.is(left, right))
|
|
2162
|
+
return true;
|
|
2163
|
+
if (left === null)
|
|
2164
|
+
return false;
|
|
2165
|
+
if (right === null)
|
|
2166
|
+
return false;
|
|
2167
|
+
if (typeof left !== 'object')
|
|
2168
|
+
return false;
|
|
2169
|
+
if (typeof right !== 'object')
|
|
2170
|
+
return false;
|
|
2171
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
2172
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
2173
|
+
if (left_proto !== right_proto)
|
|
2174
|
+
return false;
|
|
2175
|
+
if (left instanceof Boolean)
|
|
2176
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
2177
|
+
if (left instanceof Number)
|
|
2178
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
2179
|
+
if (left instanceof String)
|
|
2180
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
2181
|
+
if (left instanceof Date)
|
|
2182
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
2183
|
+
if (left instanceof RegExp)
|
|
2184
|
+
return left.source === right.source && left.flags === right.flags;
|
|
2185
|
+
if (left instanceof Error)
|
|
2186
|
+
return left.message === right.message && left.stack === right.stack;
|
|
2187
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
2188
|
+
if (left_cache) {
|
|
2189
|
+
const right_cache = left_cache.get(right);
|
|
2190
|
+
if (typeof right_cache === 'boolean')
|
|
2191
|
+
return right_cache;
|
|
2192
|
+
}
|
|
2193
|
+
else {
|
|
2194
|
+
left_cache = new WeakMap([[right, true]]);
|
|
2195
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
2196
|
+
}
|
|
2197
|
+
let result;
|
|
2198
|
+
try {
|
|
2199
|
+
if (!left_proto)
|
|
2200
|
+
result = compare_pojo(left, right);
|
|
2201
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
2202
|
+
result = compare_pojo(left, right);
|
|
2203
|
+
else if (Symbol.toPrimitive in left)
|
|
2204
|
+
result = compare_primitive(left, right);
|
|
2205
|
+
else if (Array.isArray(left))
|
|
2206
|
+
result = compare_array(left, right);
|
|
2207
|
+
else if (left instanceof Set)
|
|
2208
|
+
result = compare_set(left, right);
|
|
2209
|
+
else if (left instanceof Map)
|
|
2210
|
+
result = compare_map(left, right);
|
|
2211
|
+
else if (ArrayBuffer.isView(left))
|
|
2212
|
+
result = compare_buffer(left, right);
|
|
2213
|
+
else if (Symbol.iterator in left)
|
|
2214
|
+
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
2215
|
+
else
|
|
2216
|
+
result = false;
|
|
2217
|
+
}
|
|
2218
|
+
finally {
|
|
2219
|
+
left_cache.set(right, result);
|
|
2220
|
+
}
|
|
2221
|
+
return result;
|
|
2222
|
+
}
|
|
2223
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
2224
|
+
function compare_array(left, right) {
|
|
2225
|
+
const len = left.length;
|
|
2226
|
+
if (len !== right.length)
|
|
2227
|
+
return false;
|
|
2228
|
+
for (let i = 0; i < len; ++i) {
|
|
2229
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
2230
|
+
return false;
|
|
2231
|
+
}
|
|
2232
|
+
return true;
|
|
2233
|
+
}
|
|
2234
|
+
function compare_buffer(left, right) {
|
|
2235
|
+
const len = left.byteLength;
|
|
2236
|
+
if (len !== right.byteLength)
|
|
2237
|
+
return false;
|
|
2238
|
+
if (left instanceof DataView)
|
|
2239
|
+
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
|
|
2240
|
+
for (let i = 0; i < len; ++i) {
|
|
2241
|
+
if (left[i] !== right[i])
|
|
2242
|
+
return false;
|
|
2301
2243
|
}
|
|
2244
|
+
return true;
|
|
2302
2245
|
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2246
|
+
function compare_iterator(left, right) {
|
|
2247
|
+
while (true) {
|
|
2248
|
+
const left_next = left.next();
|
|
2249
|
+
const right_next = right.next();
|
|
2250
|
+
if (left_next.done !== right_next.done)
|
|
2251
|
+
return false;
|
|
2252
|
+
if (left_next.done)
|
|
2253
|
+
break;
|
|
2254
|
+
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
2255
|
+
return false;
|
|
2256
|
+
}
|
|
2257
|
+
return true;
|
|
2313
2258
|
}
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
;
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
(
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2259
|
+
function compare_set(left, right) {
|
|
2260
|
+
if (left.size !== right.size)
|
|
2261
|
+
return false;
|
|
2262
|
+
return compare_iterator(left.values(), right.values());
|
|
2263
|
+
}
|
|
2264
|
+
function compare_map(left, right) {
|
|
2265
|
+
if (left.size !== right.size)
|
|
2266
|
+
return false;
|
|
2267
|
+
return compare_iterator(left.keys(), right.keys())
|
|
2268
|
+
&& compare_iterator(left.values(), right.values());
|
|
2269
|
+
}
|
|
2270
|
+
function compare_pojo(left, right) {
|
|
2271
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
2272
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
2273
|
+
if (!compare_array(left_keys, right_keys))
|
|
2274
|
+
return false;
|
|
2275
|
+
for (let key of left_keys) {
|
|
2276
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
2277
|
+
return false;
|
|
2278
|
+
}
|
|
2279
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
2280
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
2281
|
+
if (!compare_array(left_syms, right_syms))
|
|
2282
|
+
return false;
|
|
2283
|
+
for (let key of left_syms) {
|
|
2284
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
2285
|
+
return false;
|
|
2327
2286
|
}
|
|
2287
|
+
return true;
|
|
2288
|
+
}
|
|
2289
|
+
function compare_primitive(left, right) {
|
|
2290
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
2328
2291
|
}
|
|
2329
|
-
$.$mol_guid = $mol_guid;
|
|
2330
2292
|
})($ || ($ = {}));
|
|
2331
2293
|
|
|
2332
2294
|
;
|
|
2333
2295
|
"use strict";
|
|
2334
2296
|
var $;
|
|
2335
2297
|
(function ($) {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
if (
|
|
2370
|
-
return
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2298
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
2299
|
+
static getter(task) {
|
|
2300
|
+
return function $mol_wire_task_get(host, args) {
|
|
2301
|
+
const sub = $mol_wire_auto();
|
|
2302
|
+
const existen = sub?.track_next();
|
|
2303
|
+
reuse: if (existen) {
|
|
2304
|
+
if (!existen.temp)
|
|
2305
|
+
break reuse;
|
|
2306
|
+
if (existen.host !== host)
|
|
2307
|
+
break reuse;
|
|
2308
|
+
if (existen.task !== task)
|
|
2309
|
+
break reuse;
|
|
2310
|
+
if (!$mol_compare_deep(existen.args, args))
|
|
2311
|
+
break reuse;
|
|
2312
|
+
return existen;
|
|
2313
|
+
}
|
|
2314
|
+
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}<#>`, task, host, args);
|
|
2315
|
+
if (existen?.temp) {
|
|
2316
|
+
$$.$mol_log3_warn({
|
|
2317
|
+
place: '$mol_wire_task',
|
|
2318
|
+
message: `Non idempotency`,
|
|
2319
|
+
existen,
|
|
2320
|
+
next,
|
|
2321
|
+
hint: 'Ignore it',
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
return next;
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
get temp() {
|
|
2328
|
+
return true;
|
|
2329
|
+
}
|
|
2330
|
+
complete() {
|
|
2331
|
+
if ($mol_promise_like(this.cache))
|
|
2332
|
+
return;
|
|
2333
|
+
this.destructor();
|
|
2334
|
+
}
|
|
2335
|
+
put(next) {
|
|
2336
|
+
const prev = this.cache;
|
|
2337
|
+
this.cache = next;
|
|
2338
|
+
if ($mol_promise_like(next)) {
|
|
2339
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
2340
|
+
if (next !== prev)
|
|
2341
|
+
this.emit();
|
|
2342
|
+
return next;
|
|
2343
|
+
}
|
|
2344
|
+
this.cursor = $mol_wire_cursor.final;
|
|
2345
|
+
if (this.sub_empty)
|
|
2346
|
+
this.destructor();
|
|
2347
|
+
else if (next !== prev)
|
|
2348
|
+
this.emit();
|
|
2349
|
+
return next;
|
|
2350
|
+
}
|
|
2375
2351
|
}
|
|
2376
|
-
$.$
|
|
2352
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
2377
2353
|
})($ || ($ = {}));
|
|
2378
2354
|
|
|
2379
2355
|
;
|
|
@@ -2622,6 +2598,32 @@ var $;
|
|
|
2622
2598
|
$.$mol_mem_key = $mol_wire_plex;
|
|
2623
2599
|
})($ || ($ = {}));
|
|
2624
2600
|
|
|
2601
|
+
;
|
|
2602
|
+
"use strict";
|
|
2603
|
+
var $;
|
|
2604
|
+
(function ($) {
|
|
2605
|
+
function $mol_wire_sync(obj) {
|
|
2606
|
+
return new Proxy(obj, {
|
|
2607
|
+
get(obj, field) {
|
|
2608
|
+
const val = obj[field];
|
|
2609
|
+
if (typeof val !== 'function')
|
|
2610
|
+
return val;
|
|
2611
|
+
const temp = $mol_wire_task.getter(val);
|
|
2612
|
+
return function $mol_wire_sync(...args) {
|
|
2613
|
+
const fiber = temp(obj, args);
|
|
2614
|
+
return fiber.sync();
|
|
2615
|
+
};
|
|
2616
|
+
},
|
|
2617
|
+
apply(obj, self, args) {
|
|
2618
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2619
|
+
const fiber = temp(self, args);
|
|
2620
|
+
return fiber.sync();
|
|
2621
|
+
},
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
2625
|
+
})($ || ($ = {}));
|
|
2626
|
+
|
|
2625
2627
|
;
|
|
2626
2628
|
"use strict";
|
|
2627
2629
|
var $;
|
|
@@ -5102,39 +5104,6 @@ var $;
|
|
|
5102
5104
|
$.$mol_test_complete = $mol_test_complete;
|
|
5103
5105
|
})($ || ($ = {}));
|
|
5104
5106
|
|
|
5105
|
-
;
|
|
5106
|
-
"use strict";
|
|
5107
|
-
|
|
5108
|
-
;
|
|
5109
|
-
"use strict";
|
|
5110
|
-
|
|
5111
|
-
;
|
|
5112
|
-
"use strict";
|
|
5113
|
-
|
|
5114
|
-
;
|
|
5115
|
-
"use strict";
|
|
5116
|
-
|
|
5117
|
-
;
|
|
5118
|
-
"use strict";
|
|
5119
|
-
|
|
5120
|
-
;
|
|
5121
|
-
"use strict";
|
|
5122
|
-
var $;
|
|
5123
|
-
(function ($_1) {
|
|
5124
|
-
$mol_test({
|
|
5125
|
-
'test types'($) {
|
|
5126
|
-
class A {
|
|
5127
|
-
static a() {
|
|
5128
|
-
return Promise.resolve('');
|
|
5129
|
-
}
|
|
5130
|
-
static b() {
|
|
5131
|
-
return $mol_wire_sync(this).a();
|
|
5132
|
-
}
|
|
5133
|
-
}
|
|
5134
|
-
},
|
|
5135
|
-
});
|
|
5136
|
-
})($ || ($ = {}));
|
|
5137
|
-
|
|
5138
5107
|
;
|
|
5139
5108
|
"use strict";
|
|
5140
5109
|
var $;
|
|
@@ -5217,6 +5186,21 @@ var $;
|
|
|
5217
5186
|
;
|
|
5218
5187
|
"use strict";
|
|
5219
5188
|
|
|
5189
|
+
;
|
|
5190
|
+
"use strict";
|
|
5191
|
+
|
|
5192
|
+
;
|
|
5193
|
+
"use strict";
|
|
5194
|
+
|
|
5195
|
+
;
|
|
5196
|
+
"use strict";
|
|
5197
|
+
|
|
5198
|
+
;
|
|
5199
|
+
"use strict";
|
|
5200
|
+
|
|
5201
|
+
;
|
|
5202
|
+
"use strict";
|
|
5203
|
+
|
|
5220
5204
|
;
|
|
5221
5205
|
"use strict";
|
|
5222
5206
|
var $;
|
|
@@ -6469,6 +6453,24 @@ var $;
|
|
|
6469
6453
|
;
|
|
6470
6454
|
"use strict";
|
|
6471
6455
|
|
|
6456
|
+
;
|
|
6457
|
+
"use strict";
|
|
6458
|
+
var $;
|
|
6459
|
+
(function ($_1) {
|
|
6460
|
+
$mol_test({
|
|
6461
|
+
'test types'($) {
|
|
6462
|
+
class A {
|
|
6463
|
+
static a() {
|
|
6464
|
+
return Promise.resolve('');
|
|
6465
|
+
}
|
|
6466
|
+
static b() {
|
|
6467
|
+
return $mol_wire_sync(this).a();
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
},
|
|
6471
|
+
});
|
|
6472
|
+
})($ || ($ = {}));
|
|
6473
|
+
|
|
6472
6474
|
;
|
|
6473
6475
|
"use strict";
|
|
6474
6476
|
var $;
|