mol_dump_lib 0.0.1011 → 0.0.1012
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 +318 -357
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +3234 -3385
- package/node.js.map +1 -1
- package/node.mjs +3234 -3385
- package/node.test.js +3641 -3814
- package/node.test.js.map +1 -1
- package/package.json +30 -33
- package/web.d.ts +132 -178
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +1792 -1986
- package/web.js.map +1 -1
- package/web.mjs +1792 -1986
- package/web.test.js +754 -809
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -275,136 +275,69 @@ var $;
|
|
|
275
275
|
$.$mol_style_prop = $mol_style_prop;
|
|
276
276
|
})($ || ($ = {}));
|
|
277
277
|
|
|
278
|
-
;
|
|
279
|
-
"use strict";
|
|
280
|
-
|
|
281
278
|
;
|
|
282
279
|
"use strict";
|
|
283
280
|
var $;
|
|
284
281
|
(function ($) {
|
|
285
|
-
$.$
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
282
|
+
$.$mol_theme = $mol_style_prop('mol_theme', [
|
|
283
|
+
'back',
|
|
284
|
+
'hover',
|
|
285
|
+
'card',
|
|
286
|
+
'current',
|
|
287
|
+
'special',
|
|
288
|
+
'text',
|
|
289
|
+
'control',
|
|
290
|
+
'shade',
|
|
291
|
+
'line',
|
|
292
|
+
'focus',
|
|
293
|
+
'field',
|
|
294
|
+
'image',
|
|
295
|
+
'spirit',
|
|
296
|
+
]);
|
|
290
297
|
})($ || ($ = {}));
|
|
291
298
|
|
|
292
299
|
;
|
|
293
300
|
"use strict";
|
|
294
301
|
var $;
|
|
295
302
|
(function ($) {
|
|
296
|
-
|
|
297
|
-
function $mol_delegate(proto, target) {
|
|
298
|
-
const proxy = new Proxy(proto, {
|
|
299
|
-
get: (_, field) => {
|
|
300
|
-
const obj = target();
|
|
301
|
-
let val = Reflect.get(obj, field);
|
|
302
|
-
if (typeof val === 'function') {
|
|
303
|
-
val = val.bind(obj);
|
|
304
|
-
}
|
|
305
|
-
return val;
|
|
306
|
-
},
|
|
307
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
308
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
309
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
310
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
311
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
312
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
313
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
314
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
315
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
316
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
317
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
318
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
319
|
-
});
|
|
320
|
-
instances.add(proxy);
|
|
321
|
-
return proxy;
|
|
322
|
-
}
|
|
323
|
-
$.$mol_delegate = $mol_delegate;
|
|
324
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
325
|
-
value: (obj) => instances.has(obj),
|
|
326
|
-
});
|
|
303
|
+
$mol_style_attach("mol/theme/theme.css", ":root {\n\t--mol_theme_hue: 240deg;\n\t--mol_theme_hue_spread: 90deg;\n\tcolor-scheme: dark light;\n}\n\n:root, :where([mol_theme]) {\n\tcolor: var(--mol_theme_text);\n\tfill: var(--mol_theme_text);\n\tbackground-color: var(--mol_theme_back);\n}\n\t\n:root, [mol_theme=\"$mol_theme_dark\"], :where([mol_theme=\"$mol_theme_dark\"]) [mol_theme] {\n\n\t--mol_theme_luma: -1;\n\t--mol_theme_image: invert(1) hue-rotate( 180deg );\n\t--mol_theme_spirit: hsl( 0deg, 0%, 0%, .75 );\n\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 20%, 10% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 50%, 20%, .25 );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 50%, 8%, .25 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0%, 80% );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 60%, 1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, 65% );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 60%, 65% );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 60%, 65% );\n\t--mol_theme_special: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 60%, 65% );\n\n} @supports( color: oklch( 0% 0 0deg ) ) {\n:root, [mol_theme=\"$mol_theme_dark\"], :where([mol_theme=\"$mol_theme_dark\"]) [mol_theme] {\n\t\n\t--mol_theme_back: oklch( 20% .03 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 30% .05 var(--mol_theme_hue) / .25 );\n\t--mol_theme_field: oklch( 15% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_hover: oklch( 70% 0 var(--mol_theme_hue) / .1 );\n\t\n\t--mol_theme_text: oklch( 80% 0 var(--mol_theme_hue) );\n\t--mol_theme_shade: oklch( 60% 0 var(--mol_theme_hue) );\n\t--mol_theme_line: oklch( 60% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_focus: oklch( 80% .2 calc( var(--mol_theme_hue) + 180deg ) );\n\t\n\t--mol_theme_control: oklch( 70% .1 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 70% .2 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_special: oklch( 70% .2 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\n} }\n\n[mol_theme=\"$mol_theme_light\"], :where([mol_theme=\"$mol_theme_light\"]) [mol_theme] {\n\t\n\t--mol_theme_luma: 1;\n\t--mol_theme_image: none;\n\t--mol_theme_spirit: hsl( 0deg, 0%, 100%, .75 );\n\t\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 20%, 92% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 50%, 100%, .5 );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 50%, 100%, .75 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0%, 0% );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 40%, 1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, 40% );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 80%, 30% );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 80%, 30% );\n\t--mol_theme_special: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 80%, 30% );\n\n} @supports( color: oklch( 0% 0 0deg ) ) {\n[mol_theme=\"$mol_theme_light\"], :where([mol_theme=\"$mol_theme_light\"]) [mol_theme] {\n\t--mol_theme_back: oklch( 92% .01 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 99% .01 var(--mol_theme_hue) / .5 );\n\t--mol_theme_field: oklch( 100% 0 var(--mol_theme_hue) / .5 );\n\t--mol_theme_hover: oklch( 50% 0 var(--mol_theme_hue) / .1 );\n\t\n\t--mol_theme_text: oklch( 20% 0 var(--mol_theme_hue) );\n\t--mol_theme_shade: oklch( 60% 0 var(--mol_theme_hue) );\n\t--mol_theme_line: oklch( 50% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_focus: oklch( 60% .2 calc( var(--mol_theme_hue) + 180deg ) );\n\t\n\t--mol_theme_control: oklch( 40% .15 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 50% .2 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_special: oklch( 50% .2 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\n} }\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: oklch( 25% .075 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 35% .1 var(--mol_theme_hue) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: oklch( 85% .075 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 98% .03 var(--mol_theme_hue) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: oklch( 85% .05 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: oklch( 85% .05 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: oklch( 35% .1 calc( var(--mol_theme_hue) + 180deg ) );\n\t--mol_theme_card: oklch( 45% .15 calc( var(--mol_theme_hue) + 180deg ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: oklch( 83% .1 calc( var(--mol_theme_hue) + 180deg ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) + 180deg ) / .25 );\n}\n\n");
|
|
327
304
|
})($ || ($ = {}));
|
|
328
305
|
|
|
306
|
+
;
|
|
307
|
+
"use strict";
|
|
308
|
+
|
|
329
309
|
;
|
|
330
310
|
"use strict";
|
|
331
311
|
var $;
|
|
332
312
|
(function ($) {
|
|
333
|
-
$.$
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (typeof having['destructor'] !== 'function')
|
|
343
|
-
return false;
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
catch {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
$.$mol_owning_allow = $mol_owning_allow;
|
|
351
|
-
function $mol_owning_get(having, Owner) {
|
|
352
|
-
if (!$mol_owning_allow(having))
|
|
353
|
-
return null;
|
|
354
|
-
while (true) {
|
|
355
|
-
const owner = $.$mol_owning_map.get(having);
|
|
356
|
-
if (!owner)
|
|
357
|
-
return owner;
|
|
358
|
-
if (!Owner)
|
|
359
|
-
return owner;
|
|
360
|
-
if (owner instanceof Owner)
|
|
361
|
-
return owner;
|
|
362
|
-
having = owner;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
$.$mol_owning_get = $mol_owning_get;
|
|
366
|
-
function $mol_owning_check(owner, having) {
|
|
367
|
-
if (!$mol_owning_allow(having))
|
|
368
|
-
return false;
|
|
369
|
-
if ($.$mol_owning_map.get(having) !== owner)
|
|
370
|
-
return false;
|
|
371
|
-
return true;
|
|
372
|
-
}
|
|
373
|
-
$.$mol_owning_check = $mol_owning_check;
|
|
374
|
-
function $mol_owning_catch(owner, having) {
|
|
375
|
-
if (!$mol_owning_allow(having))
|
|
376
|
-
return false;
|
|
377
|
-
if ($.$mol_owning_map.get(having))
|
|
378
|
-
return false;
|
|
379
|
-
$.$mol_owning_map.set(having, owner);
|
|
380
|
-
return true;
|
|
381
|
-
}
|
|
382
|
-
$.$mol_owning_catch = $mol_owning_catch;
|
|
313
|
+
$.$mol_gap = $mol_style_prop('mol_gap', [
|
|
314
|
+
'page',
|
|
315
|
+
'block',
|
|
316
|
+
'text',
|
|
317
|
+
'emoji',
|
|
318
|
+
'round',
|
|
319
|
+
'space',
|
|
320
|
+
'blur',
|
|
321
|
+
]);
|
|
383
322
|
})($ || ($ = {}));
|
|
384
323
|
|
|
385
324
|
;
|
|
386
325
|
"use strict";
|
|
387
326
|
var $;
|
|
388
327
|
(function ($) {
|
|
389
|
-
|
|
390
|
-
throw error;
|
|
391
|
-
}
|
|
392
|
-
$.$mol_fail = $mol_fail;
|
|
328
|
+
$mol_style_attach("mol/gap/gap.css", ":root {\n\t--mol_gap_page: 3rem;\n\t--mol_gap_block: .75rem;\n\t--mol_gap_text: .5rem .75rem;\n\t--mol_gap_emoji: .5rem;\n\t--mol_gap_round: .25rem;\n\t--mol_gap_space: .25rem;\n\t--mol_gap_blur: .5rem;\n}\n");
|
|
393
329
|
})($ || ($ = {}));
|
|
394
330
|
|
|
395
331
|
;
|
|
396
332
|
"use strict";
|
|
397
333
|
var $;
|
|
398
334
|
(function ($) {
|
|
399
|
-
function $
|
|
335
|
+
function $mol_fail(error) {
|
|
400
336
|
throw error;
|
|
401
337
|
}
|
|
402
|
-
$.$
|
|
338
|
+
$.$mol_fail = $mol_fail;
|
|
403
339
|
})($ || ($ = {}));
|
|
404
340
|
|
|
405
|
-
;
|
|
406
|
-
"use strict";
|
|
407
|
-
|
|
408
341
|
;
|
|
409
342
|
"use strict";
|
|
410
343
|
var $;
|
|
@@ -441,2202 +374,1823 @@ var $;
|
|
|
441
374
|
"use strict";
|
|
442
375
|
var $;
|
|
443
376
|
(function ($) {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
return this.toString();
|
|
486
|
-
}
|
|
487
|
-
destructor() { }
|
|
488
|
-
static destructor() { }
|
|
489
|
-
[Symbol.dispose]() {
|
|
490
|
-
this.destructor();
|
|
491
|
-
}
|
|
492
|
-
toString() {
|
|
493
|
-
return this[Symbol.toStringTag] || this.constructor.name + '<>';
|
|
377
|
+
function $mol_dom_render_children(el, childNodes) {
|
|
378
|
+
const node_set = new Set(childNodes);
|
|
379
|
+
let nextNode = el.firstChild;
|
|
380
|
+
for (let view of childNodes) {
|
|
381
|
+
if (view == null)
|
|
382
|
+
continue;
|
|
383
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
384
|
+
while (true) {
|
|
385
|
+
if (!nextNode) {
|
|
386
|
+
el.appendChild(view);
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
if (nextNode == view) {
|
|
390
|
+
nextNode = nextNode.nextSibling;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
if (node_set.has(nextNode)) {
|
|
395
|
+
el.insertBefore(view, nextNode);
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
const nn = nextNode.nextSibling;
|
|
400
|
+
el.removeChild(nextNode);
|
|
401
|
+
nextNode = nn;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
if (nextNode && nextNode.nodeName === '#text') {
|
|
408
|
+
const str = String(view);
|
|
409
|
+
if (nextNode.nodeValue !== str)
|
|
410
|
+
nextNode.nodeValue = str;
|
|
411
|
+
nextNode = nextNode.nextSibling;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
415
|
+
el.insertBefore(textNode, nextNode);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
494
418
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
;
|
|
500
|
-
"use strict";
|
|
501
|
-
var $;
|
|
502
|
-
(function ($_1) {
|
|
503
|
-
let $$;
|
|
504
|
-
(function ($$) {
|
|
505
|
-
let $;
|
|
506
|
-
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
507
|
-
$_1.$mol_object_field = Symbol('$mol_object_field');
|
|
508
|
-
class $mol_object extends $mol_object2 {
|
|
509
|
-
static make(config) {
|
|
510
|
-
return super.create(obj => {
|
|
511
|
-
for (let key in config)
|
|
512
|
-
obj[key] = config[key];
|
|
513
|
-
});
|
|
419
|
+
while (nextNode) {
|
|
420
|
+
const currNode = nextNode;
|
|
421
|
+
nextNode = currNode.nextSibling;
|
|
422
|
+
el.removeChild(currNode);
|
|
514
423
|
}
|
|
515
424
|
}
|
|
516
|
-
|
|
425
|
+
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
517
426
|
})($ || ($ = {}));
|
|
518
427
|
|
|
519
428
|
;
|
|
520
429
|
"use strict";
|
|
521
|
-
var $;
|
|
522
|
-
(function ($) {
|
|
523
|
-
function $mol_guid(length = 8, exists = () => false) {
|
|
524
|
-
for (;;) {
|
|
525
|
-
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
526
|
-
if (exists(id))
|
|
527
|
-
continue;
|
|
528
|
-
return id;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
$.$mol_guid = $mol_guid;
|
|
532
|
-
})($ || ($ = {}));
|
|
533
430
|
|
|
534
431
|
;
|
|
535
432
|
"use strict";
|
|
536
433
|
var $;
|
|
537
434
|
(function ($) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
(
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
data = [];
|
|
558
|
-
static get [Symbol.species]() {
|
|
559
|
-
return Array;
|
|
560
|
-
}
|
|
561
|
-
sub_from = 0;
|
|
562
|
-
get sub_list() {
|
|
563
|
-
const res = [];
|
|
564
|
-
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
565
|
-
res.push(this.data[i]);
|
|
435
|
+
$.$mol_jsx_prefix = '';
|
|
436
|
+
$.$mol_jsx_crumbs = '';
|
|
437
|
+
$.$mol_jsx_booked = null;
|
|
438
|
+
$.$mol_jsx_document = {
|
|
439
|
+
getElementById: () => null,
|
|
440
|
+
createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
|
|
441
|
+
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
442
|
+
};
|
|
443
|
+
$.$mol_jsx_frag = '';
|
|
444
|
+
function $mol_jsx(Elem, props, ...childNodes) {
|
|
445
|
+
const id = props && props.id || '';
|
|
446
|
+
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
447
|
+
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
448
|
+
if (Elem && $.$mol_jsx_booked) {
|
|
449
|
+
if ($.$mol_jsx_booked.has(id)) {
|
|
450
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
$.$mol_jsx_booked.add(id);
|
|
566
454
|
}
|
|
567
|
-
return res;
|
|
568
|
-
}
|
|
569
|
-
get sub_empty() {
|
|
570
|
-
return this.sub_from === this.data.length;
|
|
571
455
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
456
|
+
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
457
|
+
if ($.$mol_jsx_prefix) {
|
|
458
|
+
const prefix_ext = $.$mol_jsx_prefix;
|
|
459
|
+
const booked_ext = $.$mol_jsx_booked;
|
|
460
|
+
const crumbs_ext = $.$mol_jsx_crumbs;
|
|
461
|
+
for (const field in props) {
|
|
462
|
+
const func = props[field];
|
|
463
|
+
if (typeof func !== 'function')
|
|
464
|
+
continue;
|
|
465
|
+
const wrapper = function (...args) {
|
|
466
|
+
const prefix = $.$mol_jsx_prefix;
|
|
467
|
+
const booked = $.$mol_jsx_booked;
|
|
468
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
469
|
+
try {
|
|
470
|
+
$.$mol_jsx_prefix = prefix_ext;
|
|
471
|
+
$.$mol_jsx_booked = booked_ext;
|
|
472
|
+
$.$mol_jsx_crumbs = crumbs_ext;
|
|
473
|
+
return func.call(this, ...args);
|
|
474
|
+
}
|
|
475
|
+
finally {
|
|
476
|
+
$.$mol_jsx_prefix = prefix;
|
|
477
|
+
$.$mol_jsx_booked = booked;
|
|
478
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
$mol_func_name_from(wrapper, func);
|
|
482
|
+
props[field] = wrapper;
|
|
483
|
+
}
|
|
576
484
|
}
|
|
577
|
-
|
|
578
|
-
if (
|
|
579
|
-
|
|
485
|
+
if (typeof Elem !== 'string') {
|
|
486
|
+
if ('prototype' in Elem) {
|
|
487
|
+
const view = node && node[String(Elem)] || new Elem;
|
|
488
|
+
Object.assign(view, props);
|
|
489
|
+
view[Symbol.toStringTag] = guid;
|
|
490
|
+
view.childNodes = childNodes;
|
|
491
|
+
if (!view.ownerDocument)
|
|
492
|
+
view.ownerDocument = $.$mol_jsx_document;
|
|
493
|
+
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
494
|
+
node = view.valueOf();
|
|
495
|
+
node[String(Elem)] = view;
|
|
496
|
+
return node;
|
|
580
497
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
498
|
+
else {
|
|
499
|
+
const prefix = $.$mol_jsx_prefix;
|
|
500
|
+
const booked = $.$mol_jsx_booked;
|
|
501
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
502
|
+
try {
|
|
503
|
+
$.$mol_jsx_prefix = guid;
|
|
504
|
+
$.$mol_jsx_booked = new Set;
|
|
505
|
+
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
506
|
+
return Elem(props, ...childNodes);
|
|
507
|
+
}
|
|
508
|
+
finally {
|
|
509
|
+
$.$mol_jsx_prefix = prefix;
|
|
510
|
+
$.$mol_jsx_booked = booked;
|
|
511
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
512
|
+
}
|
|
584
513
|
}
|
|
585
|
-
this.data.length = end;
|
|
586
|
-
if (end === this.sub_from)
|
|
587
|
-
this.reap();
|
|
588
|
-
}
|
|
589
|
-
reap() { }
|
|
590
|
-
promote() {
|
|
591
|
-
$mol_wire_auto()?.track_next(this);
|
|
592
514
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
515
|
+
if (!node) {
|
|
516
|
+
node = Elem
|
|
517
|
+
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
518
|
+
: $.$mol_jsx_document.createDocumentFragment();
|
|
597
519
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
520
|
+
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
521
|
+
if (!Elem)
|
|
522
|
+
return node;
|
|
523
|
+
if (guid)
|
|
524
|
+
node.id = guid;
|
|
525
|
+
for (const key in props) {
|
|
526
|
+
if (key === 'id')
|
|
527
|
+
continue;
|
|
528
|
+
if (typeof props[key] === 'string') {
|
|
529
|
+
if (typeof node[key] === 'string')
|
|
530
|
+
node[key] = props[key];
|
|
531
|
+
node.setAttribute(key, props[key]);
|
|
532
|
+
}
|
|
533
|
+
else if (props[key] &&
|
|
534
|
+
typeof props[key] === 'object' &&
|
|
535
|
+
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
536
|
+
if (typeof node[key] === 'object') {
|
|
537
|
+
Object.assign(node[key], props[key]);
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
node[key] = props[key];
|
|
602
543
|
}
|
|
603
544
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
this.data[to_pos] = peer;
|
|
608
|
-
this.data[to_pos + 1] = self_pos;
|
|
609
|
-
peer.peer_repos(self_pos, to_pos);
|
|
610
|
-
}
|
|
611
|
-
peer_repos(peer_pos, self_pos) {
|
|
612
|
-
this.data[peer_pos + 1] = self_pos;
|
|
613
|
-
}
|
|
545
|
+
if ($.$mol_jsx_crumbs)
|
|
546
|
+
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
547
|
+
return node;
|
|
614
548
|
}
|
|
615
|
-
$.$
|
|
549
|
+
$.$mol_jsx = $mol_jsx;
|
|
616
550
|
})($ || ($ = {}));
|
|
617
551
|
|
|
618
552
|
;
|
|
619
553
|
"use strict";
|
|
554
|
+
var $;
|
|
555
|
+
(function ($) {
|
|
556
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
557
|
+
function $mol_ambient(overrides) {
|
|
558
|
+
return Object.setPrototypeOf(overrides, this || $);
|
|
559
|
+
}
|
|
560
|
+
$.$mol_ambient = $mol_ambient;
|
|
561
|
+
})($ || ($ = {}));
|
|
620
562
|
|
|
621
563
|
;
|
|
622
564
|
"use strict";
|
|
623
565
|
var $;
|
|
624
566
|
(function ($) {
|
|
625
|
-
|
|
626
|
-
function $
|
|
627
|
-
|
|
567
|
+
const instances = new WeakSet();
|
|
568
|
+
function $mol_delegate(proto, target) {
|
|
569
|
+
const proxy = new Proxy(proto, {
|
|
570
|
+
get: (_, field) => {
|
|
571
|
+
const obj = target();
|
|
572
|
+
let val = Reflect.get(obj, field);
|
|
573
|
+
if (typeof val === 'function') {
|
|
574
|
+
val = val.bind(obj);
|
|
575
|
+
}
|
|
576
|
+
return val;
|
|
577
|
+
},
|
|
578
|
+
has: (_, field) => Reflect.has(target(), field),
|
|
579
|
+
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
580
|
+
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
581
|
+
ownKeys: () => Reflect.ownKeys(target()),
|
|
582
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
583
|
+
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
584
|
+
isExtensible: () => Reflect.isExtensible(target()),
|
|
585
|
+
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
586
|
+
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
587
|
+
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
588
|
+
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
589
|
+
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
590
|
+
});
|
|
591
|
+
instances.add(proxy);
|
|
592
|
+
return proxy;
|
|
628
593
|
}
|
|
629
|
-
$.$
|
|
630
|
-
|
|
594
|
+
$.$mol_delegate = $mol_delegate;
|
|
595
|
+
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
596
|
+
value: (obj) => instances.has(obj),
|
|
597
|
+
});
|
|
631
598
|
})($ || ($ = {}));
|
|
632
599
|
|
|
633
600
|
;
|
|
634
601
|
"use strict";
|
|
635
602
|
var $;
|
|
636
603
|
(function ($) {
|
|
637
|
-
|
|
638
|
-
function $
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
[
|
|
647
|
-
return
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
});
|
|
604
|
+
$.$mol_owning_map = new WeakMap();
|
|
605
|
+
function $mol_owning_allow(having) {
|
|
606
|
+
try {
|
|
607
|
+
if (!having)
|
|
608
|
+
return false;
|
|
609
|
+
if (typeof having !== 'object' && typeof having !== 'function')
|
|
610
|
+
return false;
|
|
611
|
+
if (having instanceof $mol_delegate)
|
|
612
|
+
return false;
|
|
613
|
+
if (typeof having['destructor'] !== 'function')
|
|
614
|
+
return false;
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
catch {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
654
620
|
}
|
|
655
|
-
$
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
return null;
|
|
659
|
-
if (!val)
|
|
660
|
-
return null;
|
|
661
|
-
if ($.$mol_dev_format_head in val) {
|
|
662
|
-
try {
|
|
663
|
-
return val[$.$mol_dev_format_head]();
|
|
664
|
-
}
|
|
665
|
-
catch (error) {
|
|
666
|
-
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
if (typeof val === 'function') {
|
|
670
|
-
return $mol_dev_format_native(val);
|
|
671
|
-
}
|
|
672
|
-
if (val instanceof Error) {
|
|
673
|
-
return $.$mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
|
674
|
-
}
|
|
675
|
-
if (val instanceof Promise) {
|
|
676
|
-
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
|
677
|
-
}
|
|
678
|
-
if (Symbol.toStringTag in val) {
|
|
679
|
-
return $mol_dev_format_native(val);
|
|
680
|
-
}
|
|
681
|
-
return null;
|
|
682
|
-
},
|
|
683
|
-
hasBody: (val, config = false) => {
|
|
684
|
-
if (config)
|
|
685
|
-
return false;
|
|
686
|
-
if (!val)
|
|
687
|
-
return false;
|
|
688
|
-
if (val[$.$mol_dev_format_body])
|
|
689
|
-
return true;
|
|
690
|
-
return false;
|
|
691
|
-
},
|
|
692
|
-
body: (val, config = false) => {
|
|
693
|
-
if (config)
|
|
694
|
-
return null;
|
|
695
|
-
if (!val)
|
|
696
|
-
return null;
|
|
697
|
-
if ($.$mol_dev_format_body in val) {
|
|
698
|
-
try {
|
|
699
|
-
return val[$.$mol_dev_format_body]();
|
|
700
|
-
}
|
|
701
|
-
catch (error) {
|
|
702
|
-
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
703
|
-
}
|
|
704
|
-
}
|
|
621
|
+
$.$mol_owning_allow = $mol_owning_allow;
|
|
622
|
+
function $mol_owning_get(having, Owner) {
|
|
623
|
+
if (!$mol_owning_allow(having))
|
|
705
624
|
return null;
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
},
|
|
717
|
-
];
|
|
625
|
+
while (true) {
|
|
626
|
+
const owner = $.$mol_owning_map.get(having);
|
|
627
|
+
if (!owner)
|
|
628
|
+
return owner;
|
|
629
|
+
if (!Owner)
|
|
630
|
+
return owner;
|
|
631
|
+
if (owner instanceof Owner)
|
|
632
|
+
return owner;
|
|
633
|
+
having = owner;
|
|
634
|
+
}
|
|
718
635
|
}
|
|
719
|
-
$.$
|
|
720
|
-
function $
|
|
721
|
-
if (
|
|
722
|
-
return
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
object: obj,
|
|
727
|
-
config: false,
|
|
728
|
-
},
|
|
729
|
-
];
|
|
636
|
+
$.$mol_owning_get = $mol_owning_get;
|
|
637
|
+
function $mol_owning_check(owner, having) {
|
|
638
|
+
if (!$mol_owning_allow(having))
|
|
639
|
+
return false;
|
|
640
|
+
if ($.$mol_owning_map.get(having) !== owner)
|
|
641
|
+
return false;
|
|
642
|
+
return true;
|
|
730
643
|
}
|
|
731
|
-
$.$
|
|
732
|
-
function $
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
style: styles.join(' ; '),
|
|
740
|
-
},
|
|
741
|
-
...content,
|
|
742
|
-
];
|
|
644
|
+
$.$mol_owning_check = $mol_owning_check;
|
|
645
|
+
function $mol_owning_catch(owner, having) {
|
|
646
|
+
if (!$mol_owning_allow(having))
|
|
647
|
+
return false;
|
|
648
|
+
if ($.$mol_owning_map.get(having))
|
|
649
|
+
return false;
|
|
650
|
+
$.$mol_owning_map.set(having, owner);
|
|
651
|
+
return true;
|
|
743
652
|
}
|
|
744
|
-
$.$
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
'color': 'magenta',
|
|
754
|
-
});
|
|
755
|
-
$.$mol_dev_format_strong = $.$mol_dev_format_span.bind(null, {
|
|
756
|
-
'font-weight': 'bold',
|
|
757
|
-
});
|
|
758
|
-
$.$mol_dev_format_string = $.$mol_dev_format_span.bind(null, {
|
|
759
|
-
'color': 'green',
|
|
760
|
-
});
|
|
761
|
-
$.$mol_dev_format_shade = $.$mol_dev_format_span.bind(null, {
|
|
762
|
-
'color': 'gray',
|
|
763
|
-
});
|
|
764
|
-
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
765
|
-
'margin-left': '13px'
|
|
766
|
-
});
|
|
767
|
-
class Stack extends Array {
|
|
768
|
-
toString() {
|
|
769
|
-
return this.join('\n');
|
|
770
|
-
}
|
|
653
|
+
$.$mol_owning_catch = $mol_owning_catch;
|
|
654
|
+
})($ || ($ = {}));
|
|
655
|
+
|
|
656
|
+
;
|
|
657
|
+
"use strict";
|
|
658
|
+
var $;
|
|
659
|
+
(function ($) {
|
|
660
|
+
function $mol_fail_hidden(error) {
|
|
661
|
+
throw error;
|
|
771
662
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
663
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
664
|
+
})($ || ($ = {}));
|
|
665
|
+
|
|
666
|
+
;
|
|
667
|
+
"use strict";
|
|
668
|
+
|
|
669
|
+
;
|
|
670
|
+
"use strict";
|
|
671
|
+
var $;
|
|
672
|
+
(function ($) {
|
|
673
|
+
$.$mol_key_handle = Symbol.for('$mol_key_handle');
|
|
674
|
+
$.$mol_key_store = new WeakMap();
|
|
675
|
+
})($ || ($ = {}));
|
|
676
|
+
|
|
677
|
+
;
|
|
678
|
+
"use strict";
|
|
679
|
+
var $;
|
|
680
|
+
(function ($) {
|
|
681
|
+
if (!Symbol.dispose)
|
|
682
|
+
Symbol.dispose = Symbol('Symbol.dispose');
|
|
683
|
+
class $mol_object2 {
|
|
684
|
+
static $ = $;
|
|
782
685
|
[Symbol.toStringTag];
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
this.method = '';
|
|
790
|
-
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
791
|
-
this.eval = call.getEvalOrigin() ?? '';
|
|
792
|
-
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
793
|
-
this.object = call.getThis();
|
|
794
|
-
this.offset = call.getPosition();
|
|
795
|
-
const flags = [];
|
|
796
|
-
if (call.isAsync())
|
|
797
|
-
flags.push('async');
|
|
798
|
-
if (call.isConstructor())
|
|
799
|
-
flags.push('constructor');
|
|
800
|
-
if (call.isEval())
|
|
801
|
-
flags.push('eval');
|
|
802
|
-
if (call.isNative())
|
|
803
|
-
flags.push('native');
|
|
804
|
-
if (call.isPromiseAll())
|
|
805
|
-
flags.push('PromiseAll');
|
|
806
|
-
if (call.isToplevel())
|
|
807
|
-
flags.push('top');
|
|
808
|
-
this.flags = flags;
|
|
809
|
-
const type = this.type ? this.type + '.' : '';
|
|
810
|
-
const func = this.function || '<anon>';
|
|
811
|
-
const method = this.method ? ' [' + this.method + '] ' : '';
|
|
812
|
-
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
|
686
|
+
[$mol_ambient_ref] = null;
|
|
687
|
+
get $() {
|
|
688
|
+
if (this[$mol_ambient_ref])
|
|
689
|
+
return this[$mol_ambient_ref];
|
|
690
|
+
const owner = $mol_owning_get(this);
|
|
691
|
+
return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
|
|
813
692
|
}
|
|
814
|
-
|
|
693
|
+
set $(next) {
|
|
694
|
+
if (this[$mol_ambient_ref])
|
|
695
|
+
$mol_fail_hidden(new Error('Context already defined'));
|
|
696
|
+
this[$mol_ambient_ref] = next;
|
|
697
|
+
}
|
|
698
|
+
static create(init) {
|
|
699
|
+
const obj = new this;
|
|
700
|
+
if (init)
|
|
701
|
+
init(obj);
|
|
702
|
+
return obj;
|
|
703
|
+
}
|
|
704
|
+
static [Symbol.toPrimitive]() {
|
|
815
705
|
return this.toString();
|
|
816
706
|
}
|
|
817
|
-
toString() {
|
|
818
|
-
|
|
819
|
-
const label = this[Symbol.toStringTag];
|
|
820
|
-
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
|
821
|
-
return `\tat ${object}${label} (${source})`;
|
|
707
|
+
static toString() {
|
|
708
|
+
return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
|
|
822
709
|
}
|
|
823
|
-
|
|
824
|
-
return
|
|
825
|
-
|
|
826
|
-
|
|
710
|
+
static toJSON() {
|
|
711
|
+
return this.toString();
|
|
712
|
+
}
|
|
713
|
+
static [$mol_key_handle]() {
|
|
714
|
+
return this.toString();
|
|
715
|
+
}
|
|
716
|
+
destructor() { }
|
|
717
|
+
static destructor() { }
|
|
718
|
+
[Symbol.dispose]() {
|
|
719
|
+
this.destructor();
|
|
720
|
+
}
|
|
721
|
+
toString() {
|
|
722
|
+
return this[Symbol.toStringTag] || this.constructor.name + '<>';
|
|
827
723
|
}
|
|
828
724
|
}
|
|
829
|
-
|
|
725
|
+
$.$mol_object2 = $mol_object2;
|
|
830
726
|
})($ || ($ = {}));
|
|
831
727
|
|
|
832
728
|
;
|
|
833
729
|
"use strict";
|
|
834
730
|
var $;
|
|
835
|
-
(function ($) {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
res.push(this.data[i]);
|
|
848
|
-
}
|
|
849
|
-
return res;
|
|
731
|
+
(function ($_1) {
|
|
732
|
+
let $$;
|
|
733
|
+
(function ($$) {
|
|
734
|
+
let $;
|
|
735
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
736
|
+
$_1.$mol_object_field = Symbol('$mol_object_field');
|
|
737
|
+
class $mol_object extends $mol_object2 {
|
|
738
|
+
static make(config) {
|
|
739
|
+
return super.create(obj => {
|
|
740
|
+
for (let key in config)
|
|
741
|
+
obj[key] = config[key];
|
|
742
|
+
});
|
|
850
743
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
744
|
+
}
|
|
745
|
+
$_1.$mol_object = $mol_object;
|
|
746
|
+
})($ || ($ = {}));
|
|
747
|
+
|
|
748
|
+
;
|
|
749
|
+
"use strict";
|
|
750
|
+
var $;
|
|
751
|
+
(function ($) {
|
|
752
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
753
|
+
for (;;) {
|
|
754
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
755
|
+
if (exists(id))
|
|
756
|
+
continue;
|
|
757
|
+
return id;
|
|
856
758
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
759
|
+
}
|
|
760
|
+
$.$mol_guid = $mol_guid;
|
|
761
|
+
})($ || ($ = {}));
|
|
762
|
+
|
|
763
|
+
;
|
|
764
|
+
"use strict";
|
|
765
|
+
var $;
|
|
766
|
+
(function ($) {
|
|
767
|
+
let $mol_wire_cursor;
|
|
768
|
+
(function ($mol_wire_cursor) {
|
|
769
|
+
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
770
|
+
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
771
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
772
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
773
|
+
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
774
|
+
})($ || ($ = {}));
|
|
775
|
+
|
|
776
|
+
;
|
|
777
|
+
"use strict";
|
|
778
|
+
var $;
|
|
779
|
+
(function ($) {
|
|
780
|
+
class $mol_wire_pub extends Object {
|
|
781
|
+
constructor(id = `$mol_wire_pub:${$mol_guid()}`) {
|
|
782
|
+
super();
|
|
783
|
+
this[Symbol.toStringTag] = id;
|
|
862
784
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
const next = this.data[this.cursor];
|
|
868
|
-
if (pub === undefined)
|
|
869
|
-
return next ?? null;
|
|
870
|
-
if (next === pub) {
|
|
871
|
-
this.cursor += 2;
|
|
872
|
-
return next;
|
|
873
|
-
}
|
|
874
|
-
if (next) {
|
|
875
|
-
if (this.sub_from < this.data.length) {
|
|
876
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
877
|
-
}
|
|
878
|
-
this.peer_move(this.cursor, this.sub_from);
|
|
879
|
-
this.sub_from += 2;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
else {
|
|
883
|
-
if (pub === undefined)
|
|
884
|
-
return null;
|
|
885
|
-
if (this.sub_from < this.data.length) {
|
|
886
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
887
|
-
}
|
|
888
|
-
this.sub_from += 2;
|
|
889
|
-
}
|
|
890
|
-
this.data[this.cursor] = pub;
|
|
891
|
-
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
892
|
-
this.cursor += 2;
|
|
893
|
-
return pub;
|
|
785
|
+
[Symbol.toStringTag];
|
|
786
|
+
data = [];
|
|
787
|
+
static get [Symbol.species]() {
|
|
788
|
+
return Array;
|
|
894
789
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
901
|
-
const pub = this.data[cursor];
|
|
902
|
-
pub.fresh();
|
|
790
|
+
sub_from = 0;
|
|
791
|
+
get sub_list() {
|
|
792
|
+
const res = [];
|
|
793
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
794
|
+
res.push(this.data[i]);
|
|
903
795
|
}
|
|
904
|
-
|
|
796
|
+
return res;
|
|
905
797
|
}
|
|
906
|
-
|
|
907
|
-
this.
|
|
908
|
-
this.data[sub_pos + 1] = undefined;
|
|
798
|
+
get sub_empty() {
|
|
799
|
+
return this.sub_from === this.data.length;
|
|
909
800
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
sub.pub_off(pos);
|
|
915
|
-
}
|
|
916
|
-
this.data.length = this.sub_from;
|
|
917
|
-
this.cursor = this.pub_from;
|
|
918
|
-
this.track_cut();
|
|
919
|
-
this.cursor = $mol_wire_cursor.stale;
|
|
801
|
+
sub_on(sub, pub_pos) {
|
|
802
|
+
const pos = this.data.length;
|
|
803
|
+
this.data.push(sub, pub_pos);
|
|
804
|
+
return pos;
|
|
920
805
|
}
|
|
921
|
-
|
|
922
|
-
if (
|
|
923
|
-
$mol_fail(new Error(
|
|
806
|
+
sub_off(sub_pos) {
|
|
807
|
+
if (!(sub_pos < this.data.length)) {
|
|
808
|
+
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
924
809
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
pub?.sub_off(this.data[cursor + 1]);
|
|
929
|
-
end -= 2;
|
|
930
|
-
if (this.sub_from <= end)
|
|
931
|
-
this.peer_move(end, cursor);
|
|
810
|
+
const end = this.data.length - 2;
|
|
811
|
+
if (sub_pos !== end) {
|
|
812
|
+
this.peer_move(end, sub_pos);
|
|
932
813
|
}
|
|
933
814
|
this.data.length = end;
|
|
934
|
-
|
|
815
|
+
if (end === this.sub_from)
|
|
816
|
+
this.reap();
|
|
817
|
+
}
|
|
818
|
+
reap() { }
|
|
819
|
+
promote() {
|
|
820
|
+
$mol_wire_auto()?.track_next(this);
|
|
935
821
|
}
|
|
822
|
+
fresh() { }
|
|
936
823
|
complete() { }
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
940
|
-
const pub = this.data[cursor];
|
|
941
|
-
if (pub?.incompleted)
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
945
|
-
const pub = this.data[cursor];
|
|
946
|
-
pub?.complete();
|
|
947
|
-
}
|
|
824
|
+
get incompleted() {
|
|
825
|
+
return false;
|
|
948
826
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
this.cursor = quant;
|
|
955
|
-
this.emit($mol_wire_cursor.doubt);
|
|
827
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
828
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
829
|
+
;
|
|
830
|
+
this.data[i].absorb(quant, this.data[i + 1]);
|
|
831
|
+
}
|
|
956
832
|
}
|
|
957
|
-
|
|
958
|
-
|
|
833
|
+
peer_move(from_pos, to_pos) {
|
|
834
|
+
const peer = this.data[from_pos];
|
|
835
|
+
const self_pos = this.data[from_pos + 1];
|
|
836
|
+
this.data[to_pos] = peer;
|
|
837
|
+
this.data[to_pos + 1] = self_pos;
|
|
838
|
+
peer.peer_repos(self_pos, to_pos);
|
|
959
839
|
}
|
|
960
|
-
|
|
961
|
-
|
|
840
|
+
peer_repos(peer_pos, self_pos) {
|
|
841
|
+
this.data[peer_pos + 1] = self_pos;
|
|
962
842
|
}
|
|
963
843
|
}
|
|
964
|
-
$.$
|
|
844
|
+
$.$mol_wire_pub = $mol_wire_pub;
|
|
965
845
|
})($ || ($ = {}));
|
|
966
846
|
|
|
967
847
|
;
|
|
968
848
|
"use strict";
|
|
969
|
-
var $;
|
|
970
|
-
(function ($) {
|
|
971
|
-
class $mol_after_tick extends $mol_object2 {
|
|
972
|
-
task;
|
|
973
|
-
static promise = null;
|
|
974
|
-
cancelled = false;
|
|
975
|
-
constructor(task) {
|
|
976
|
-
super();
|
|
977
|
-
this.task = task;
|
|
978
|
-
if (!$mol_after_tick.promise)
|
|
979
|
-
$mol_after_tick.promise = Promise.resolve().then(() => {
|
|
980
|
-
$mol_after_tick.promise = null;
|
|
981
|
-
});
|
|
982
|
-
$mol_after_tick.promise.then(() => {
|
|
983
|
-
if (this.cancelled)
|
|
984
|
-
return;
|
|
985
|
-
task();
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
destructor() {
|
|
989
|
-
this.cancelled = true;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
$.$mol_after_tick = $mol_after_tick;
|
|
993
|
-
})($ || ($ = {}));
|
|
994
849
|
|
|
995
850
|
;
|
|
996
851
|
"use strict";
|
|
997
852
|
var $;
|
|
998
853
|
(function ($) {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}
|
|
1003
|
-
catch {
|
|
1004
|
-
return false;
|
|
1005
|
-
}
|
|
854
|
+
$.$mol_wire_auto_sub = null;
|
|
855
|
+
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
856
|
+
return $.$mol_wire_auto_sub = next;
|
|
1006
857
|
}
|
|
1007
|
-
$.$
|
|
858
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
859
|
+
$.$mol_wire_affected = [];
|
|
1008
860
|
})($ || ($ = {}));
|
|
1009
861
|
|
|
1010
862
|
;
|
|
1011
863
|
"use strict";
|
|
1012
864
|
var $;
|
|
1013
865
|
(function ($) {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
return;
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
finally {
|
|
1030
|
-
$mol_wire_fiber.plan_task = null;
|
|
1031
|
-
}
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
static sync() {
|
|
1035
|
-
while (this.planning.size) {
|
|
1036
|
-
for (const fiber of this.planning) {
|
|
1037
|
-
this.planning.delete(fiber);
|
|
1038
|
-
if (fiber.cursor >= 0)
|
|
1039
|
-
continue;
|
|
1040
|
-
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1041
|
-
continue;
|
|
1042
|
-
fiber.fresh();
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
while (this.reaping.size) {
|
|
1046
|
-
const fibers = this.reaping;
|
|
1047
|
-
this.reaping = new Set;
|
|
1048
|
-
for (const fiber of fibers) {
|
|
1049
|
-
if (!fiber.sub_empty)
|
|
1050
|
-
continue;
|
|
1051
|
-
fiber.destructor();
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
cache = undefined;
|
|
1056
|
-
get args() {
|
|
1057
|
-
return this.data.slice(0, this.pub_from);
|
|
1058
|
-
}
|
|
1059
|
-
result() {
|
|
1060
|
-
if ($mol_promise_like(this.cache))
|
|
1061
|
-
return;
|
|
1062
|
-
if (this.cache instanceof Error)
|
|
1063
|
-
return;
|
|
1064
|
-
return this.cache;
|
|
1065
|
-
}
|
|
1066
|
-
get incompleted() {
|
|
1067
|
-
return $mol_promise_like(this.cache);
|
|
1068
|
-
}
|
|
1069
|
-
field() {
|
|
1070
|
-
return this.task.name + '()';
|
|
1071
|
-
}
|
|
1072
|
-
constructor(id, task, host, args) {
|
|
1073
|
-
super(id);
|
|
1074
|
-
this.task = task;
|
|
1075
|
-
this.host = host;
|
|
1076
|
-
if (args)
|
|
1077
|
-
this.data.push(...args);
|
|
1078
|
-
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
1079
|
-
}
|
|
1080
|
-
plan() {
|
|
1081
|
-
$mol_wire_fiber.planning.add(this);
|
|
1082
|
-
$mol_wire_fiber.plan();
|
|
1083
|
-
return this;
|
|
1084
|
-
}
|
|
1085
|
-
reap() {
|
|
1086
|
-
$mol_wire_fiber.reaping.add(this);
|
|
1087
|
-
$mol_wire_fiber.plan();
|
|
1088
|
-
}
|
|
1089
|
-
toString() {
|
|
1090
|
-
return this[Symbol.toStringTag];
|
|
1091
|
-
}
|
|
1092
|
-
toJSON() {
|
|
1093
|
-
return this[Symbol.toStringTag];
|
|
1094
|
-
}
|
|
1095
|
-
[$mol_dev_format_head]() {
|
|
1096
|
-
const cursor = {
|
|
1097
|
-
[$mol_wire_cursor.stale]: '🔴',
|
|
1098
|
-
[$mol_wire_cursor.doubt]: '🟡',
|
|
1099
|
-
[$mol_wire_cursor.fresh]: '🟢',
|
|
1100
|
-
[$mol_wire_cursor.final]: '🔵',
|
|
1101
|
-
}[this.cursor] ?? this.cursor.toString();
|
|
1102
|
-
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
1103
|
-
? $mol_dev_format_shade(cursor)
|
|
1104
|
-
: $mol_dev_format_shade(this[Symbol.toStringTag], cursor), $mol_dev_format_auto(this.cache));
|
|
1105
|
-
}
|
|
1106
|
-
[$mol_dev_format_body]() { return null; }
|
|
1107
|
-
get $() {
|
|
1108
|
-
return (this.host ?? this.task)['$'];
|
|
1109
|
-
}
|
|
1110
|
-
emit(quant = $mol_wire_cursor.stale) {
|
|
1111
|
-
if (this.sub_empty)
|
|
1112
|
-
this.plan();
|
|
1113
|
-
else
|
|
1114
|
-
super.emit(quant);
|
|
1115
|
-
}
|
|
1116
|
-
fresh() {
|
|
1117
|
-
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1118
|
-
return;
|
|
1119
|
-
if (this.cursor === $mol_wire_cursor.final)
|
|
1120
|
-
return;
|
|
1121
|
-
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1122
|
-
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1123
|
-
;
|
|
1124
|
-
this.data[i]?.fresh();
|
|
1125
|
-
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1126
|
-
break check;
|
|
1127
|
-
}
|
|
1128
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
const bu = this.track_on();
|
|
1132
|
-
let result;
|
|
1133
|
-
try {
|
|
1134
|
-
switch (this.pub_from) {
|
|
1135
|
-
case 0:
|
|
1136
|
-
result = this.task.call(this.host);
|
|
1137
|
-
break;
|
|
1138
|
-
case 1:
|
|
1139
|
-
result = this.task.call(this.host, this.data[0]);
|
|
1140
|
-
break;
|
|
1141
|
-
default:
|
|
1142
|
-
result = this.task.call(this.host, ...this.args);
|
|
1143
|
-
break;
|
|
1144
|
-
}
|
|
1145
|
-
if ($mol_promise_like(result)) {
|
|
1146
|
-
if (wrappers.has(result)) {
|
|
1147
|
-
result = wrappers.get(result).then(a => a);
|
|
1148
|
-
}
|
|
1149
|
-
else {
|
|
1150
|
-
const put = (res) => {
|
|
1151
|
-
if (this.cache === result)
|
|
1152
|
-
this.put(res);
|
|
1153
|
-
return res;
|
|
1154
|
-
};
|
|
1155
|
-
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1156
|
-
wrappers.set(result, result);
|
|
1157
|
-
const error = new Error(`Promise in ${this}`);
|
|
1158
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
866
|
+
$['devtoolsFormatters'] ||= [];
|
|
867
|
+
function $mol_dev_format_register(config) {
|
|
868
|
+
$['devtoolsFormatters'].push(config);
|
|
869
|
+
}
|
|
870
|
+
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
871
|
+
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
872
|
+
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
873
|
+
function $mol_dev_format_button(label, click) {
|
|
874
|
+
return $mol_dev_format_auto({
|
|
875
|
+
[$.$mol_dev_format_head]() {
|
|
876
|
+
return $.$mol_dev_format_span({ color: 'cornflowerblue' }, label);
|
|
877
|
+
},
|
|
878
|
+
[$.$mol_dev_format_body]() {
|
|
879
|
+
Promise.resolve().then(click);
|
|
880
|
+
return $.$mol_dev_format_span({});
|
|
1161
881
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
$mol_dev_format_register({
|
|
885
|
+
header: (val, config = false) => {
|
|
886
|
+
if (config)
|
|
887
|
+
return null;
|
|
888
|
+
if (!val)
|
|
889
|
+
return null;
|
|
890
|
+
if ($.$mol_dev_format_head in val) {
|
|
891
|
+
try {
|
|
892
|
+
return val[$.$mol_dev_format_head]();
|
|
1168
893
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
result = wrappers.get(result);
|
|
1172
|
-
}
|
|
1173
|
-
else {
|
|
1174
|
-
const put = (v) => {
|
|
1175
|
-
if (this.cache === result)
|
|
1176
|
-
this.absorb();
|
|
1177
|
-
return v;
|
|
1178
|
-
};
|
|
1179
|
-
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1180
|
-
const error = new Error(`Promise in ${this}`);
|
|
1181
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1182
|
-
}
|
|
894
|
+
catch (error) {
|
|
895
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
1183
896
|
}
|
|
1184
897
|
}
|
|
1185
|
-
if (
|
|
1186
|
-
|
|
898
|
+
if (typeof val === 'function') {
|
|
899
|
+
return $mol_dev_format_native(val);
|
|
1187
900
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
return this;
|
|
1191
|
-
}
|
|
1192
|
-
refresh() {
|
|
1193
|
-
this.cursor = $mol_wire_cursor.stale;
|
|
1194
|
-
this.fresh();
|
|
1195
|
-
}
|
|
1196
|
-
sync() {
|
|
1197
|
-
if (!$mol_wire_fiber.warm) {
|
|
1198
|
-
return this.result();
|
|
901
|
+
if (val instanceof Error) {
|
|
902
|
+
return $.$mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
|
1199
903
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
if (this.cache instanceof Error) {
|
|
1203
|
-
return $mol_fail_hidden(this.cache);
|
|
904
|
+
if (val instanceof Promise) {
|
|
905
|
+
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
|
1204
906
|
}
|
|
1205
|
-
if (
|
|
1206
|
-
return $
|
|
907
|
+
if (Symbol.toStringTag in val) {
|
|
908
|
+
return $mol_dev_format_native(val);
|
|
1207
909
|
}
|
|
1208
|
-
return
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
910
|
+
return null;
|
|
911
|
+
},
|
|
912
|
+
hasBody: (val, config = false) => {
|
|
913
|
+
if (config)
|
|
914
|
+
return false;
|
|
915
|
+
if (!val)
|
|
916
|
+
return false;
|
|
917
|
+
if (val[$.$mol_dev_format_body])
|
|
918
|
+
return true;
|
|
919
|
+
return false;
|
|
920
|
+
},
|
|
921
|
+
body: (val, config = false) => {
|
|
922
|
+
if (config)
|
|
923
|
+
return null;
|
|
924
|
+
if (!val)
|
|
925
|
+
return null;
|
|
926
|
+
if ($.$mol_dev_format_body in val) {
|
|
927
|
+
try {
|
|
928
|
+
return val[$.$mol_dev_format_body]();
|
|
1215
929
|
}
|
|
1216
|
-
|
|
1217
|
-
return
|
|
1218
|
-
await Promise.race([this.cache, this.step()]);
|
|
1219
|
-
if (!$mol_promise_like(this.cache))
|
|
1220
|
-
return this.cache;
|
|
1221
|
-
if (this.cursor === $mol_wire_cursor.final) {
|
|
1222
|
-
await new Promise(() => { });
|
|
930
|
+
catch (error) {
|
|
931
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
1223
932
|
}
|
|
1224
933
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
return
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
sub.absorb = () => {
|
|
1239
|
-
done(null);
|
|
1240
|
-
setTimeout(() => sub.destructor());
|
|
1241
|
-
};
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
destructor() {
|
|
1245
|
-
super.destructor();
|
|
1246
|
-
$mol_wire_fiber.planning.delete(this);
|
|
1247
|
-
if (!$mol_owning_check(this, this.cache))
|
|
1248
|
-
return;
|
|
1249
|
-
try {
|
|
1250
|
-
this.cache.destructor();
|
|
1251
|
-
}
|
|
1252
|
-
catch (result) {
|
|
1253
|
-
if ($mol_promise_like(result)) {
|
|
1254
|
-
const error = new Error(`Promise in ${this}.destructor()`);
|
|
1255
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1256
|
-
}
|
|
1257
|
-
$mol_fail_hidden(result);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1262
|
-
})($ || ($ = {}));
|
|
1263
|
-
|
|
1264
|
-
;
|
|
1265
|
-
"use strict";
|
|
1266
|
-
var $;
|
|
1267
|
-
(function ($) {
|
|
1268
|
-
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
1269
|
-
function $mol_key(value) {
|
|
1270
|
-
primitives: {
|
|
1271
|
-
if (typeof value === 'bigint')
|
|
1272
|
-
return value.toString() + 'n';
|
|
1273
|
-
if (typeof value === 'symbol')
|
|
1274
|
-
return `Symbol(${value.description})`;
|
|
1275
|
-
if (!value)
|
|
1276
|
-
return JSON.stringify(value);
|
|
1277
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1278
|
-
return JSON.stringify(value);
|
|
1279
|
-
}
|
|
1280
|
-
caching: {
|
|
1281
|
-
let key = $mol_key_store.get(value);
|
|
1282
|
-
if (key)
|
|
1283
|
-
return key;
|
|
1284
|
-
}
|
|
1285
|
-
objects: {
|
|
1286
|
-
if (value instanceof TypedArray) {
|
|
1287
|
-
return `${value[Symbol.toStringTag]}([${[...value].map(v => $mol_key(v))}])`;
|
|
1288
|
-
}
|
|
1289
|
-
if (Array.isArray(value))
|
|
1290
|
-
return `[${value.map(v => $mol_key(v))}]`;
|
|
1291
|
-
if (value instanceof RegExp)
|
|
1292
|
-
return value.toString();
|
|
1293
|
-
if (value instanceof Date)
|
|
1294
|
-
return `Date(${value.valueOf()})`;
|
|
1295
|
-
}
|
|
1296
|
-
structures: {
|
|
1297
|
-
const proto = Reflect.getPrototypeOf(value);
|
|
1298
|
-
if (!proto || !Reflect.getPrototypeOf(proto)) {
|
|
1299
|
-
return `{${Object.entries(value).map(([k, v]) => JSON.stringify(k) + ':' + $mol_key(v))}}`;
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
handlers: {
|
|
1303
|
-
if ($mol_key_handle in value) {
|
|
1304
|
-
return value[$mol_key_handle]();
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
containers: {
|
|
1308
|
-
const key = JSON.stringify('#' + $mol_guid());
|
|
1309
|
-
$mol_key_store.set(value, key);
|
|
1310
|
-
return key;
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
$.$mol_key = $mol_key;
|
|
1314
|
-
})($ || ($ = {}));
|
|
1315
|
-
|
|
1316
|
-
;
|
|
1317
|
-
"use strict";
|
|
1318
|
-
var $;
|
|
1319
|
-
(function ($) {
|
|
1320
|
-
class $mol_after_frame extends $mol_object2 {
|
|
1321
|
-
task;
|
|
1322
|
-
static _promise = null;
|
|
1323
|
-
static get promise() {
|
|
1324
|
-
if (this._promise)
|
|
1325
|
-
return this._promise;
|
|
1326
|
-
return this._promise = new Promise(done => {
|
|
1327
|
-
const complete = () => {
|
|
1328
|
-
this._promise = null;
|
|
1329
|
-
done();
|
|
1330
|
-
};
|
|
1331
|
-
if (typeof requestAnimationFrame === 'function') {
|
|
1332
|
-
requestAnimationFrame(complete);
|
|
1333
|
-
}
|
|
1334
|
-
else {
|
|
1335
|
-
setTimeout(complete, 16);
|
|
1336
|
-
}
|
|
1337
|
-
});
|
|
1338
|
-
}
|
|
1339
|
-
cancelled = false;
|
|
1340
|
-
promise;
|
|
1341
|
-
constructor(task) {
|
|
1342
|
-
super();
|
|
1343
|
-
this.task = task;
|
|
1344
|
-
this.promise = $mol_after_frame.promise.then(() => {
|
|
1345
|
-
if (this.cancelled)
|
|
1346
|
-
return;
|
|
1347
|
-
task();
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
destructor() {
|
|
1351
|
-
this.cancelled = true;
|
|
1352
|
-
}
|
|
934
|
+
return null;
|
|
935
|
+
},
|
|
936
|
+
});
|
|
937
|
+
function $mol_dev_format_native(obj) {
|
|
938
|
+
if (typeof obj === 'undefined')
|
|
939
|
+
return $.$mol_dev_format_shade('undefined');
|
|
940
|
+
return [
|
|
941
|
+
'object',
|
|
942
|
+
{
|
|
943
|
+
object: obj,
|
|
944
|
+
config: true,
|
|
945
|
+
},
|
|
946
|
+
];
|
|
1353
947
|
}
|
|
1354
|
-
$.$
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
;
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
if (left === null)
|
|
1366
|
-
return false;
|
|
1367
|
-
if (right === null)
|
|
1368
|
-
return false;
|
|
1369
|
-
if (typeof left !== 'object')
|
|
1370
|
-
return false;
|
|
1371
|
-
if (typeof right !== 'object')
|
|
1372
|
-
return false;
|
|
1373
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
1374
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
1375
|
-
if (left_proto !== right_proto)
|
|
1376
|
-
return false;
|
|
1377
|
-
if (left instanceof Boolean)
|
|
1378
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1379
|
-
if (left instanceof Number)
|
|
1380
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1381
|
-
if (left instanceof String)
|
|
1382
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1383
|
-
if (left instanceof Date)
|
|
1384
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1385
|
-
if (left instanceof RegExp)
|
|
1386
|
-
return left.source === right.source && left.flags === right.flags;
|
|
1387
|
-
if (left instanceof Error)
|
|
1388
|
-
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
1389
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
1390
|
-
if (left_cache) {
|
|
1391
|
-
const right_cache = left_cache.get(right);
|
|
1392
|
-
if (typeof right_cache === 'boolean')
|
|
1393
|
-
return right_cache;
|
|
1394
|
-
}
|
|
1395
|
-
else {
|
|
1396
|
-
left_cache = new WeakMap();
|
|
1397
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
1398
|
-
}
|
|
1399
|
-
left_cache.set(right, true);
|
|
1400
|
-
let result;
|
|
1401
|
-
try {
|
|
1402
|
-
if (!left_proto)
|
|
1403
|
-
result = compare_pojo(left, right);
|
|
1404
|
-
else if (!Reflect.getPrototypeOf(left_proto))
|
|
1405
|
-
result = compare_pojo(left, right);
|
|
1406
|
-
else if (Symbol.toPrimitive in left)
|
|
1407
|
-
result = compare_primitive(left, right);
|
|
1408
|
-
else if (Array.isArray(left))
|
|
1409
|
-
result = compare_array(left, right);
|
|
1410
|
-
else if (left instanceof Set)
|
|
1411
|
-
result = compare_set(left, right);
|
|
1412
|
-
else if (left instanceof Map)
|
|
1413
|
-
result = compare_map(left, right);
|
|
1414
|
-
else if (ArrayBuffer.isView(left))
|
|
1415
|
-
result = compare_buffer(left, right);
|
|
1416
|
-
else if (Symbol.iterator in left)
|
|
1417
|
-
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
1418
|
-
else
|
|
1419
|
-
result = false;
|
|
1420
|
-
}
|
|
1421
|
-
finally {
|
|
1422
|
-
left_cache.set(right, result);
|
|
1423
|
-
}
|
|
1424
|
-
return result;
|
|
948
|
+
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
949
|
+
function $mol_dev_format_auto(obj) {
|
|
950
|
+
if (obj == null)
|
|
951
|
+
return $.$mol_dev_format_shade(String(obj));
|
|
952
|
+
return [
|
|
953
|
+
'object',
|
|
954
|
+
{
|
|
955
|
+
object: obj,
|
|
956
|
+
config: false,
|
|
957
|
+
},
|
|
958
|
+
];
|
|
1425
959
|
}
|
|
1426
|
-
$.$
|
|
1427
|
-
function
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
960
|
+
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
961
|
+
function $mol_dev_format_element(element, style, ...content) {
|
|
962
|
+
const styles = [];
|
|
963
|
+
for (let key in style)
|
|
964
|
+
styles.push(`${key} : ${style[key]}`);
|
|
965
|
+
return [
|
|
966
|
+
element,
|
|
967
|
+
{
|
|
968
|
+
style: styles.join(' ; '),
|
|
969
|
+
},
|
|
970
|
+
...content,
|
|
971
|
+
];
|
|
1436
972
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
973
|
+
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
974
|
+
$.$mol_dev_format_span = $mol_dev_format_element.bind(null, 'span');
|
|
975
|
+
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
976
|
+
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
977
|
+
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
978
|
+
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
979
|
+
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
980
|
+
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
981
|
+
$.$mol_dev_format_accent = $.$mol_dev_format_span.bind(null, {
|
|
982
|
+
'color': 'magenta',
|
|
983
|
+
});
|
|
984
|
+
$.$mol_dev_format_strong = $.$mol_dev_format_span.bind(null, {
|
|
985
|
+
'font-weight': 'bold',
|
|
986
|
+
});
|
|
987
|
+
$.$mol_dev_format_string = $.$mol_dev_format_span.bind(null, {
|
|
988
|
+
'color': 'green',
|
|
989
|
+
});
|
|
990
|
+
$.$mol_dev_format_shade = $.$mol_dev_format_span.bind(null, {
|
|
991
|
+
'color': 'gray',
|
|
992
|
+
});
|
|
993
|
+
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
994
|
+
'margin-left': '13px'
|
|
995
|
+
});
|
|
996
|
+
class Stack extends Array {
|
|
997
|
+
toString() {
|
|
998
|
+
return this.join('\n');
|
|
1446
999
|
}
|
|
1447
|
-
return true;
|
|
1448
1000
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1001
|
+
class Call extends Object {
|
|
1002
|
+
type;
|
|
1003
|
+
function;
|
|
1004
|
+
method;
|
|
1005
|
+
eval;
|
|
1006
|
+
source;
|
|
1007
|
+
offset;
|
|
1008
|
+
pos;
|
|
1009
|
+
object;
|
|
1010
|
+
flags;
|
|
1011
|
+
[Symbol.toStringTag];
|
|
1012
|
+
constructor(call) {
|
|
1013
|
+
super();
|
|
1014
|
+
this.type = call.getTypeName() ?? '';
|
|
1015
|
+
this.function = call.getFunctionName() ?? '';
|
|
1016
|
+
this.method = call.getMethodName() ?? '';
|
|
1017
|
+
if (this.method === this.function)
|
|
1018
|
+
this.method = '';
|
|
1019
|
+
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
1020
|
+
this.eval = call.getEvalOrigin() ?? '';
|
|
1021
|
+
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
1022
|
+
this.object = call.getThis();
|
|
1023
|
+
this.offset = call.getPosition();
|
|
1024
|
+
const flags = [];
|
|
1025
|
+
if (call.isAsync())
|
|
1026
|
+
flags.push('async');
|
|
1027
|
+
if (call.isConstructor())
|
|
1028
|
+
flags.push('constructor');
|
|
1029
|
+
if (call.isEval())
|
|
1030
|
+
flags.push('eval');
|
|
1031
|
+
if (call.isNative())
|
|
1032
|
+
flags.push('native');
|
|
1033
|
+
if (call.isPromiseAll())
|
|
1034
|
+
flags.push('PromiseAll');
|
|
1035
|
+
if (call.isToplevel())
|
|
1036
|
+
flags.push('top');
|
|
1037
|
+
this.flags = flags;
|
|
1038
|
+
const type = this.type ? this.type + '.' : '';
|
|
1039
|
+
const func = this.function || '<anon>';
|
|
1040
|
+
const method = this.method ? ' [' + this.method + '] ' : '';
|
|
1041
|
+
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
|
1459
1042
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
function compare_set(left, right) {
|
|
1463
|
-
if (left.size !== right.size)
|
|
1464
|
-
return false;
|
|
1465
|
-
return compare_iterator(left.values(), right.values());
|
|
1466
|
-
}
|
|
1467
|
-
function compare_map(left, right) {
|
|
1468
|
-
if (left.size !== right.size)
|
|
1469
|
-
return false;
|
|
1470
|
-
return compare_iterator(left.keys(), right.keys())
|
|
1471
|
-
&& compare_iterator(left.values(), right.values());
|
|
1472
|
-
}
|
|
1473
|
-
function compare_pojo(left, right) {
|
|
1474
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
1475
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
1476
|
-
if (!compare_array(left_keys, right_keys))
|
|
1477
|
-
return false;
|
|
1478
|
-
for (let key of left_keys) {
|
|
1479
|
-
if (!$mol_compare_deep(left[key], right[key]))
|
|
1480
|
-
return false;
|
|
1043
|
+
[Symbol.toPrimitive]() {
|
|
1044
|
+
return this.toString();
|
|
1481
1045
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1046
|
+
toString() {
|
|
1047
|
+
const object = this.object || '';
|
|
1048
|
+
const label = this[Symbol.toStringTag];
|
|
1049
|
+
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
|
1050
|
+
return `\tat ${object}${label} (${source})`;
|
|
1051
|
+
}
|
|
1052
|
+
[$.$mol_dev_format_head]() {
|
|
1053
|
+
return $.$mol_dev_format_div({}, $mol_dev_format_native(this), $.$mol_dev_format_shade(' '), ...this.object ? [
|
|
1054
|
+
$mol_dev_format_native(this.object),
|
|
1055
|
+
] : [], ...this.method ? [$.$mol_dev_format_shade(' ', ' [', this.method, ']')] : [], $.$mol_dev_format_shade(' ', this.flags.join(', ')));
|
|
1489
1056
|
}
|
|
1490
|
-
return true;
|
|
1491
|
-
}
|
|
1492
|
-
function compare_primitive(left, right) {
|
|
1493
|
-
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
1494
|
-
}
|
|
1495
|
-
})($ || ($ = {}));
|
|
1496
|
-
|
|
1497
|
-
;
|
|
1498
|
-
"use strict";
|
|
1499
|
-
var $;
|
|
1500
|
-
(function ($) {
|
|
1501
|
-
function $mol_log3_area_lazy(event) {
|
|
1502
|
-
const self = this.$;
|
|
1503
|
-
const stack = self.$mol_log3_stack;
|
|
1504
|
-
const deep = stack.length;
|
|
1505
|
-
let logged = false;
|
|
1506
|
-
stack.push(() => {
|
|
1507
|
-
logged = true;
|
|
1508
|
-
self.$mol_log3_area.call(self, event);
|
|
1509
|
-
});
|
|
1510
|
-
return () => {
|
|
1511
|
-
if (logged)
|
|
1512
|
-
self.console.groupEnd();
|
|
1513
|
-
if (stack.length > deep)
|
|
1514
|
-
stack.length = deep;
|
|
1515
|
-
};
|
|
1516
1057
|
}
|
|
1517
|
-
|
|
1518
|
-
$.$mol_log3_stack = [];
|
|
1058
|
+
Error.prepareStackTrace ??= (error, stack) => new Stack(...stack.map(call => new Call(call)));
|
|
1519
1059
|
})($ || ($ = {}));
|
|
1520
1060
|
|
|
1521
|
-
;
|
|
1522
|
-
"use strict";
|
|
1523
|
-
|
|
1524
1061
|
;
|
|
1525
1062
|
"use strict";
|
|
1526
1063
|
var $;
|
|
1527
1064
|
(function ($) {
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1065
|
+
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
1066
|
+
pub_from = 0;
|
|
1067
|
+
cursor = $mol_wire_cursor.stale;
|
|
1068
|
+
get temp() {
|
|
1069
|
+
return false;
|
|
1070
|
+
}
|
|
1071
|
+
get pub_list() {
|
|
1072
|
+
const res = [];
|
|
1073
|
+
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
1074
|
+
for (let i = this.pub_from; i < max; i += 2) {
|
|
1075
|
+
if (this.data[i])
|
|
1076
|
+
res.push(this.data[i]);
|
|
1537
1077
|
}
|
|
1538
|
-
|
|
1539
|
-
this.console[level](tpl.trim(), style, ...[].concat(...chunks));
|
|
1540
|
-
const self = this;
|
|
1541
|
-
return () => self.console.groupEnd();
|
|
1542
|
-
};
|
|
1543
|
-
}
|
|
1544
|
-
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
1545
|
-
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
1546
|
-
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
1547
|
-
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
1548
|
-
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
1549
|
-
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
1550
|
-
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
1551
|
-
})($ || ($ = {}));
|
|
1552
|
-
|
|
1553
|
-
;
|
|
1554
|
-
"use strict";
|
|
1555
|
-
var $;
|
|
1556
|
-
(function ($) {
|
|
1557
|
-
class $mol_wire_task extends $mol_wire_fiber {
|
|
1558
|
-
static getter(task) {
|
|
1559
|
-
return function $mol_wire_task_get(host, args) {
|
|
1560
|
-
const sub = $mol_wire_auto();
|
|
1561
|
-
const existen = sub?.track_next();
|
|
1562
|
-
let cause = '';
|
|
1563
|
-
reuse: if (existen) {
|
|
1564
|
-
if (!existen.temp)
|
|
1565
|
-
break reuse;
|
|
1566
|
-
if (existen.task !== task) {
|
|
1567
|
-
cause = 'task';
|
|
1568
|
-
break reuse;
|
|
1569
|
-
}
|
|
1570
|
-
if (existen.host !== host) {
|
|
1571
|
-
cause = 'host';
|
|
1572
|
-
break reuse;
|
|
1573
|
-
}
|
|
1574
|
-
if (!$mol_compare_deep(existen.args, args)) {
|
|
1575
|
-
cause = 'args';
|
|
1576
|
-
break reuse;
|
|
1577
|
-
}
|
|
1578
|
-
return existen;
|
|
1579
|
-
}
|
|
1580
|
-
const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
|
|
1581
|
-
const next = new $mol_wire_task(key, task, host, args);
|
|
1582
|
-
if (existen?.temp) {
|
|
1583
|
-
$$.$mol_log3_warn({
|
|
1584
|
-
place: '$mol_wire_task',
|
|
1585
|
-
message: `Different ${cause} on restart`,
|
|
1586
|
-
sub,
|
|
1587
|
-
prev: existen,
|
|
1588
|
-
next,
|
|
1589
|
-
hint: 'Maybe required additional memoization',
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
return next;
|
|
1593
|
-
};
|
|
1078
|
+
return res;
|
|
1594
1079
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1080
|
+
track_on() {
|
|
1081
|
+
this.cursor = this.pub_from;
|
|
1082
|
+
const sub = $mol_wire_auto();
|
|
1083
|
+
$mol_wire_auto(this);
|
|
1084
|
+
return sub;
|
|
1597
1085
|
}
|
|
1598
|
-
|
|
1599
|
-
if (
|
|
1600
|
-
|
|
1601
|
-
|
|
1086
|
+
promote() {
|
|
1087
|
+
if (this.cursor >= this.pub_from) {
|
|
1088
|
+
$mol_fail(new Error('Circular subscription'));
|
|
1089
|
+
}
|
|
1090
|
+
super.promote();
|
|
1602
1091
|
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
if (
|
|
1607
|
-
|
|
1608
|
-
if (
|
|
1609
|
-
|
|
1610
|
-
if (
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1092
|
+
track_next(pub) {
|
|
1093
|
+
if (this.cursor < 0)
|
|
1094
|
+
$mol_fail(new Error('Promo to non begun sub'));
|
|
1095
|
+
if (this.cursor < this.sub_from) {
|
|
1096
|
+
const next = this.data[this.cursor];
|
|
1097
|
+
if (pub === undefined)
|
|
1098
|
+
return next ?? null;
|
|
1099
|
+
if (next === pub) {
|
|
1100
|
+
this.cursor += 2;
|
|
1101
|
+
return next;
|
|
1102
|
+
}
|
|
1103
|
+
if (next) {
|
|
1104
|
+
if (this.sub_from < this.data.length) {
|
|
1105
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
1616
1106
|
}
|
|
1107
|
+
this.peer_move(this.cursor, this.sub_from);
|
|
1108
|
+
this.sub_from += 2;
|
|
1617
1109
|
}
|
|
1618
|
-
return next;
|
|
1619
1110
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1111
|
+
else {
|
|
1112
|
+
if (pub === undefined)
|
|
1113
|
+
return null;
|
|
1114
|
+
if (this.sub_from < this.data.length) {
|
|
1115
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
1116
|
+
}
|
|
1117
|
+
this.sub_from += 2;
|
|
1118
|
+
}
|
|
1119
|
+
this.data[this.cursor] = pub;
|
|
1120
|
+
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
1121
|
+
this.cursor += 2;
|
|
1122
|
+
return pub;
|
|
1123
|
+
}
|
|
1124
|
+
track_off(sub) {
|
|
1125
|
+
$mol_wire_auto(sub);
|
|
1126
|
+
if (this.cursor < 0) {
|
|
1127
|
+
$mol_fail(new Error('End of non begun sub'));
|
|
1128
|
+
}
|
|
1129
|
+
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
1130
|
+
const pub = this.data[cursor];
|
|
1131
|
+
pub.fresh();
|
|
1132
|
+
}
|
|
1133
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1134
|
+
}
|
|
1135
|
+
pub_off(sub_pos) {
|
|
1136
|
+
this.data[sub_pos] = undefined;
|
|
1137
|
+
this.data[sub_pos + 1] = undefined;
|
|
1626
1138
|
}
|
|
1627
1139
|
destructor() {
|
|
1628
|
-
|
|
1629
|
-
|
|
1140
|
+
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
1141
|
+
const sub = this.data[cursor];
|
|
1142
|
+
const pos = this.data[cursor + 1];
|
|
1143
|
+
sub.pub_off(pos);
|
|
1144
|
+
}
|
|
1145
|
+
this.data.length = this.sub_from;
|
|
1146
|
+
this.cursor = this.pub_from;
|
|
1147
|
+
this.track_cut();
|
|
1148
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
1630
1149
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
;
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
(
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1150
|
+
track_cut() {
|
|
1151
|
+
if (this.cursor < this.pub_from) {
|
|
1152
|
+
$mol_fail(new Error('Cut of non begun sub'));
|
|
1153
|
+
}
|
|
1154
|
+
let end = this.data.length;
|
|
1155
|
+
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
1156
|
+
const pub = this.data[cursor];
|
|
1157
|
+
pub?.sub_off(this.data[cursor + 1]);
|
|
1158
|
+
end -= 2;
|
|
1159
|
+
if (this.sub_from <= end)
|
|
1160
|
+
this.peer_move(end, cursor);
|
|
1161
|
+
}
|
|
1162
|
+
this.data.length = end;
|
|
1163
|
+
this.sub_from = this.cursor;
|
|
1164
|
+
}
|
|
1165
|
+
complete() { }
|
|
1166
|
+
complete_pubs() {
|
|
1167
|
+
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
1168
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1169
|
+
const pub = this.data[cursor];
|
|
1170
|
+
if (pub?.incompleted)
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1174
|
+
const pub = this.data[cursor];
|
|
1175
|
+
pub?.complete();
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
absorb(quant = $mol_wire_cursor.stale, pos = -1) {
|
|
1179
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
1180
|
+
return;
|
|
1181
|
+
if (this.cursor >= quant)
|
|
1182
|
+
return;
|
|
1183
|
+
this.cursor = quant;
|
|
1184
|
+
this.emit($mol_wire_cursor.doubt);
|
|
1646
1185
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
const fiber = temp(this ?? null, args);
|
|
1650
|
-
return fiber.sync();
|
|
1651
|
-
};
|
|
1652
|
-
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1653
|
-
Object.assign(value, { orig });
|
|
1654
|
-
const descr2 = { ...descr, value };
|
|
1655
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1656
|
-
return descr2;
|
|
1657
|
-
}
|
|
1658
|
-
$.$mol_wire_method = $mol_wire_method;
|
|
1659
|
-
})($ || ($ = {}));
|
|
1660
|
-
|
|
1661
|
-
;
|
|
1662
|
-
"use strict";
|
|
1663
|
-
|
|
1664
|
-
;
|
|
1665
|
-
"use strict";
|
|
1666
|
-
|
|
1667
|
-
;
|
|
1668
|
-
"use strict";
|
|
1669
|
-
var $;
|
|
1670
|
-
(function ($) {
|
|
1671
|
-
const catched = new WeakSet();
|
|
1672
|
-
function $mol_fail_catch(error) {
|
|
1673
|
-
if (typeof error !== 'object')
|
|
1674
|
-
return false;
|
|
1675
|
-
if ($mol_promise_like(error))
|
|
1676
|
-
$mol_fail_hidden(error);
|
|
1677
|
-
if (catched.has(error))
|
|
1678
|
-
return false;
|
|
1679
|
-
catched.add(error);
|
|
1680
|
-
return true;
|
|
1681
|
-
}
|
|
1682
|
-
$.$mol_fail_catch = $mol_fail_catch;
|
|
1683
|
-
})($ || ($ = {}));
|
|
1684
|
-
|
|
1685
|
-
;
|
|
1686
|
-
"use strict";
|
|
1687
|
-
var $;
|
|
1688
|
-
(function ($) {
|
|
1689
|
-
function $mol_try(handler) {
|
|
1690
|
-
try {
|
|
1691
|
-
return handler();
|
|
1186
|
+
[$mol_dev_format_head]() {
|
|
1187
|
+
return $mol_dev_format_native(this);
|
|
1692
1188
|
}
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
return error;
|
|
1189
|
+
get pub_empty() {
|
|
1190
|
+
return this.sub_from === this.pub_from;
|
|
1696
1191
|
}
|
|
1697
1192
|
}
|
|
1698
|
-
$.$
|
|
1193
|
+
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
1699
1194
|
})($ || ($ = {}));
|
|
1700
1195
|
|
|
1701
1196
|
;
|
|
1702
1197
|
"use strict";
|
|
1703
1198
|
var $;
|
|
1704
1199
|
(function ($) {
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1200
|
+
class $mol_after_tick extends $mol_object2 {
|
|
1201
|
+
task;
|
|
1202
|
+
static promise = null;
|
|
1203
|
+
cancelled = false;
|
|
1204
|
+
constructor(task) {
|
|
1205
|
+
super();
|
|
1206
|
+
this.task = task;
|
|
1207
|
+
if (!$mol_after_tick.promise)
|
|
1208
|
+
$mol_after_tick.promise = Promise.resolve().then(() => {
|
|
1209
|
+
$mol_after_tick.promise = null;
|
|
1210
|
+
});
|
|
1211
|
+
$mol_after_tick.promise.then(() => {
|
|
1212
|
+
if (this.cancelled)
|
|
1213
|
+
return;
|
|
1214
|
+
task();
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
destructor() {
|
|
1218
|
+
this.cancelled = true;
|
|
1219
|
+
}
|
|
1718
1220
|
}
|
|
1719
|
-
$.$
|
|
1720
|
-
$.$mol_try = $mol_try_web;
|
|
1721
|
-
self.addEventListener('$mol_try', (event) => {
|
|
1722
|
-
result = handler();
|
|
1723
|
-
}, true);
|
|
1724
|
-
self.addEventListener('error', (event) => {
|
|
1725
|
-
error = event.error;
|
|
1726
|
-
}, true);
|
|
1221
|
+
$.$mol_after_tick = $mol_after_tick;
|
|
1727
1222
|
})($ || ($ = {}));
|
|
1728
1223
|
|
|
1729
1224
|
;
|
|
1730
1225
|
"use strict";
|
|
1731
1226
|
var $;
|
|
1732
1227
|
(function ($) {
|
|
1733
|
-
function $
|
|
1734
|
-
|
|
1735
|
-
return
|
|
1736
|
-
|
|
1228
|
+
function $mol_promise_like(val) {
|
|
1229
|
+
try {
|
|
1230
|
+
return val && typeof val === 'object' && 'then' in val && typeof val.then === 'function';
|
|
1231
|
+
}
|
|
1232
|
+
catch {
|
|
1737
1233
|
return false;
|
|
1738
|
-
|
|
1739
|
-
return true;
|
|
1234
|
+
}
|
|
1740
1235
|
}
|
|
1741
|
-
$.$
|
|
1236
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
1742
1237
|
})($ || ($ = {}));
|
|
1743
1238
|
|
|
1744
1239
|
;
|
|
1745
1240
|
"use strict";
|
|
1746
1241
|
var $;
|
|
1747
1242
|
(function ($) {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
(
|
|
1758
|
-
|
|
1243
|
+
const wrappers = new WeakMap();
|
|
1244
|
+
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
1245
|
+
task;
|
|
1246
|
+
host;
|
|
1247
|
+
static warm = true;
|
|
1248
|
+
static planning = new Set();
|
|
1249
|
+
static reaping = new Set();
|
|
1250
|
+
static plan_task = null;
|
|
1251
|
+
static plan() {
|
|
1252
|
+
if (this.plan_task)
|
|
1253
|
+
return;
|
|
1254
|
+
this.plan_task = new $mol_after_tick(() => {
|
|
1255
|
+
try {
|
|
1256
|
+
this.sync();
|
|
1257
|
+
}
|
|
1258
|
+
finally {
|
|
1259
|
+
$mol_wire_fiber.plan_task = null;
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1759
1262
|
}
|
|
1760
|
-
static
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1263
|
+
static sync() {
|
|
1264
|
+
while (this.planning.size) {
|
|
1265
|
+
for (const fiber of this.planning) {
|
|
1266
|
+
this.planning.delete(fiber);
|
|
1267
|
+
if (fiber.cursor >= 0)
|
|
1268
|
+
continue;
|
|
1269
|
+
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1270
|
+
continue;
|
|
1271
|
+
fiber.fresh();
|
|
1272
|
+
}
|
|
1769
1273
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1274
|
+
while (this.reaping.size) {
|
|
1275
|
+
const fibers = this.reaping;
|
|
1276
|
+
this.reaping = new Set;
|
|
1277
|
+
for (const fiber of fibers) {
|
|
1278
|
+
if (!fiber.sub_empty)
|
|
1279
|
+
continue;
|
|
1280
|
+
fiber.destructor();
|
|
1281
|
+
}
|
|
1772
1282
|
}
|
|
1773
|
-
const id = prefix + ('.' + task.name) + ('<' + key_str.replace(/^"|"$/g, "'") + '>');
|
|
1774
|
-
const fiber = new $mol_wire_atom(id, task, host, [key]);
|
|
1775
|
-
dict.set(key_str, fiber);
|
|
1776
|
-
return fiber;
|
|
1777
1283
|
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1284
|
+
cache = undefined;
|
|
1285
|
+
get args() {
|
|
1286
|
+
return this.data.slice(0, this.pub_from);
|
|
1287
|
+
}
|
|
1288
|
+
result() {
|
|
1289
|
+
if ($mol_promise_like(this.cache))
|
|
1290
|
+
return;
|
|
1291
|
+
if (this.cache instanceof Error)
|
|
1292
|
+
return;
|
|
1293
|
+
return this.cache;
|
|
1294
|
+
}
|
|
1295
|
+
get incompleted() {
|
|
1296
|
+
return $mol_promise_like(this.cache);
|
|
1297
|
+
}
|
|
1298
|
+
field() {
|
|
1299
|
+
return this.task.name + '()';
|
|
1300
|
+
}
|
|
1301
|
+
constructor(id, task, host, args) {
|
|
1302
|
+
super(id);
|
|
1303
|
+
this.task = task;
|
|
1304
|
+
this.host = host;
|
|
1305
|
+
if (args)
|
|
1306
|
+
this.data.push(...args);
|
|
1307
|
+
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
1308
|
+
}
|
|
1309
|
+
plan() {
|
|
1310
|
+
$mol_wire_fiber.planning.add(this);
|
|
1311
|
+
$mol_wire_fiber.plan();
|
|
1312
|
+
return this;
|
|
1313
|
+
}
|
|
1314
|
+
reap() {
|
|
1315
|
+
$mol_wire_fiber.reaping.add(this);
|
|
1316
|
+
$mol_wire_fiber.plan();
|
|
1317
|
+
}
|
|
1318
|
+
toString() {
|
|
1319
|
+
return this[Symbol.toStringTag];
|
|
1320
|
+
}
|
|
1321
|
+
toJSON() {
|
|
1322
|
+
return this[Symbol.toStringTag];
|
|
1323
|
+
}
|
|
1324
|
+
[$mol_dev_format_head]() {
|
|
1325
|
+
const cursor = {
|
|
1326
|
+
[$mol_wire_cursor.stale]: '🔴',
|
|
1327
|
+
[$mol_wire_cursor.doubt]: '🟡',
|
|
1328
|
+
[$mol_wire_cursor.fresh]: '🟢',
|
|
1329
|
+
[$mol_wire_cursor.final]: '🔵',
|
|
1330
|
+
}[this.cursor] ?? this.cursor.toString();
|
|
1331
|
+
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
1332
|
+
? $mol_dev_format_shade(cursor)
|
|
1333
|
+
: $mol_dev_format_shade(this[Symbol.toStringTag], cursor), $mol_dev_format_auto(this.cache));
|
|
1334
|
+
}
|
|
1335
|
+
[$mol_dev_format_body]() { return null; }
|
|
1336
|
+
get $() {
|
|
1337
|
+
return (this.host ?? this.task)['$'];
|
|
1338
|
+
}
|
|
1339
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
1340
|
+
if (this.sub_empty)
|
|
1341
|
+
this.plan();
|
|
1342
|
+
else
|
|
1343
|
+
super.emit(quant);
|
|
1344
|
+
}
|
|
1345
|
+
fresh() {
|
|
1346
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1347
|
+
return;
|
|
1348
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
1349
|
+
return;
|
|
1350
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1351
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1352
|
+
;
|
|
1353
|
+
this.data[i]?.fresh();
|
|
1354
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1355
|
+
break check;
|
|
1789
1356
|
}
|
|
1357
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1358
|
+
return;
|
|
1790
1359
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1360
|
+
const bu = this.track_on();
|
|
1361
|
+
let result;
|
|
1362
|
+
try {
|
|
1363
|
+
switch (this.pub_from) {
|
|
1364
|
+
case 0:
|
|
1365
|
+
result = this.task.call(this.host);
|
|
1366
|
+
break;
|
|
1367
|
+
case 1:
|
|
1368
|
+
result = this.task.call(this.host, this.data[0]);
|
|
1369
|
+
break;
|
|
1370
|
+
default:
|
|
1371
|
+
result = this.task.call(this.host, ...this.args);
|
|
1372
|
+
break;
|
|
1373
|
+
}
|
|
1374
|
+
if ($mol_promise_like(result)) {
|
|
1375
|
+
if (wrappers.has(result)) {
|
|
1376
|
+
result = wrappers.get(result).then(a => a);
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
const put = (res) => {
|
|
1380
|
+
if (this.cache === result)
|
|
1381
|
+
this.put(res);
|
|
1382
|
+
return res;
|
|
1383
|
+
};
|
|
1384
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1385
|
+
wrappers.set(result, result);
|
|
1386
|
+
const error = new Error(`Promise in ${this}`);
|
|
1387
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1388
|
+
}
|
|
1803
1389
|
}
|
|
1804
1390
|
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
return this.sync();
|
|
1809
|
-
}
|
|
1810
|
-
channel() {
|
|
1811
|
-
return Object.assign((next) => {
|
|
1812
|
-
if (next !== undefined)
|
|
1813
|
-
return this.resync([...this.args, next]);
|
|
1814
|
-
if (!$mol_wire_fiber.warm)
|
|
1815
|
-
return this.result();
|
|
1816
|
-
if ($mol_wire_auto()?.temp) {
|
|
1817
|
-
return this.once();
|
|
1391
|
+
catch (error) {
|
|
1392
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
1393
|
+
result = error;
|
|
1818
1394
|
}
|
|
1819
1395
|
else {
|
|
1820
|
-
|
|
1396
|
+
result = new Error(String(error), { cause: error });
|
|
1821
1397
|
}
|
|
1822
|
-
|
|
1398
|
+
if ($mol_promise_like(result)) {
|
|
1399
|
+
if (wrappers.has(result)) {
|
|
1400
|
+
result = wrappers.get(result);
|
|
1401
|
+
}
|
|
1402
|
+
else {
|
|
1403
|
+
const put = (v) => {
|
|
1404
|
+
if (this.cache === result)
|
|
1405
|
+
this.absorb();
|
|
1406
|
+
return v;
|
|
1407
|
+
};
|
|
1408
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1409
|
+
const error = new Error(`Promise in ${this}`);
|
|
1410
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
if (!$mol_promise_like(result)) {
|
|
1415
|
+
this.track_cut();
|
|
1416
|
+
}
|
|
1417
|
+
this.track_off(bu);
|
|
1418
|
+
this.put(result);
|
|
1419
|
+
return this;
|
|
1823
1420
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1421
|
+
refresh() {
|
|
1422
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
1423
|
+
this.fresh();
|
|
1424
|
+
}
|
|
1425
|
+
sync() {
|
|
1426
|
+
if (!$mol_wire_fiber.warm) {
|
|
1427
|
+
return this.result();
|
|
1829
1428
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
hint: 'Check for $mol_key(key) is not changed',
|
|
1838
|
-
});
|
|
1839
|
-
map.delete(key);
|
|
1429
|
+
this.promote();
|
|
1430
|
+
this.fresh();
|
|
1431
|
+
if (this.cache instanceof Error) {
|
|
1432
|
+
return $mol_fail_hidden(this.cache);
|
|
1433
|
+
}
|
|
1434
|
+
if ($mol_promise_like(this.cache)) {
|
|
1435
|
+
return $mol_fail_hidden(this.cache);
|
|
1840
1436
|
}
|
|
1437
|
+
return this.cache;
|
|
1841
1438
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
break update;
|
|
1848
|
-
}
|
|
1849
|
-
catch (error) {
|
|
1850
|
-
$mol_fail_log(error);
|
|
1851
|
-
}
|
|
1852
|
-
if ($mol_owning_check(this, prev)) {
|
|
1853
|
-
prev.destructor();
|
|
1439
|
+
async async_raw() {
|
|
1440
|
+
while (true) {
|
|
1441
|
+
this.fresh();
|
|
1442
|
+
if (this.cache instanceof Error) {
|
|
1443
|
+
$mol_fail_hidden(this.cache);
|
|
1854
1444
|
}
|
|
1855
|
-
if (
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
}
|
|
1445
|
+
if (!$mol_promise_like(this.cache))
|
|
1446
|
+
return this.cache;
|
|
1447
|
+
await Promise.race([this.cache, this.step()]);
|
|
1448
|
+
if (!$mol_promise_like(this.cache))
|
|
1449
|
+
return this.cache;
|
|
1450
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
1451
|
+
await new Promise(() => { });
|
|
1862
1452
|
}
|
|
1863
|
-
if (!this.sub_empty)
|
|
1864
|
-
this.emit();
|
|
1865
1453
|
}
|
|
1866
|
-
this.cache = next;
|
|
1867
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1868
|
-
if ($mol_promise_like(next))
|
|
1869
|
-
return next;
|
|
1870
|
-
this.complete_pubs();
|
|
1871
|
-
return next;
|
|
1872
1454
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
$mol_wire_method
|
|
1879
|
-
], $mol_wire_atom.prototype, "once", null);
|
|
1880
|
-
$.$mol_wire_atom = $mol_wire_atom;
|
|
1881
|
-
})($ || ($ = {}));
|
|
1882
|
-
|
|
1883
|
-
;
|
|
1884
|
-
"use strict";
|
|
1885
|
-
var $;
|
|
1886
|
-
(function ($) {
|
|
1887
|
-
function $mol_wire_solo(host, field, descr) {
|
|
1888
|
-
if (!descr)
|
|
1889
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1890
|
-
const orig = descr?.value ?? host[field];
|
|
1891
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1892
|
-
if (typeof sup[field] === 'function') {
|
|
1893
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1455
|
+
async() {
|
|
1456
|
+
const promise = this.async_raw();
|
|
1457
|
+
if (!promise.destructor)
|
|
1458
|
+
promise.destructor = () => this.destructor();
|
|
1459
|
+
return promise;
|
|
1894
1460
|
}
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
return atom.sync();
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
return atom.resync(args);
|
|
1910
|
-
}
|
|
1911
|
-
};
|
|
1912
|
-
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1913
|
-
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1914
|
-
Object.assign(descr2.value, { orig });
|
|
1915
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1916
|
-
return descr2;
|
|
1917
|
-
}
|
|
1918
|
-
$.$mol_wire_solo = $mol_wire_solo;
|
|
1919
|
-
})($ || ($ = {}));
|
|
1920
|
-
|
|
1921
|
-
;
|
|
1922
|
-
"use strict";
|
|
1923
|
-
var $;
|
|
1924
|
-
(function ($) {
|
|
1925
|
-
function $mol_wire_plex(host, field, descr) {
|
|
1926
|
-
if (!descr)
|
|
1927
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1928
|
-
const orig = descr?.value ?? host[field];
|
|
1929
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1930
|
-
if (typeof sup[field] === 'function') {
|
|
1931
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1461
|
+
step() {
|
|
1462
|
+
return new Promise(done => {
|
|
1463
|
+
const sub = new $mol_wire_pub_sub;
|
|
1464
|
+
const prev = sub.track_on();
|
|
1465
|
+
sub.track_next(this);
|
|
1466
|
+
sub.track_off(prev);
|
|
1467
|
+
sub.absorb = () => {
|
|
1468
|
+
done(null);
|
|
1469
|
+
setTimeout(() => sub.destructor());
|
|
1470
|
+
};
|
|
1471
|
+
});
|
|
1932
1472
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
}
|
|
1473
|
+
destructor() {
|
|
1474
|
+
super.destructor();
|
|
1475
|
+
$mol_wire_fiber.planning.delete(this);
|
|
1476
|
+
if (!$mol_owning_check(this, this.cache))
|
|
1477
|
+
return;
|
|
1478
|
+
try {
|
|
1479
|
+
this.cache.destructor();
|
|
1480
|
+
}
|
|
1481
|
+
catch (result) {
|
|
1482
|
+
if ($mol_promise_like(result)) {
|
|
1483
|
+
const error = new Error(`Promise in ${this}.destructor()`);
|
|
1484
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1946
1485
|
}
|
|
1947
|
-
|
|
1486
|
+
$mol_fail_hidden(result);
|
|
1948
1487
|
}
|
|
1949
|
-
}
|
|
1950
|
-
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
1951
|
-
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
1952
|
-
Object.assign(descr2.value, { orig });
|
|
1953
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1954
|
-
return descr2;
|
|
1488
|
+
}
|
|
1955
1489
|
}
|
|
1956
|
-
$.$
|
|
1957
|
-
})($ || ($ = {}));
|
|
1958
|
-
|
|
1959
|
-
;
|
|
1960
|
-
"use strict";
|
|
1961
|
-
var $;
|
|
1962
|
-
(function ($) {
|
|
1963
|
-
$.$mol_mem = $mol_wire_solo;
|
|
1964
|
-
$.$mol_mem_key = $mol_wire_plex;
|
|
1965
|
-
})($ || ($ = {}));
|
|
1966
|
-
|
|
1967
|
-
;
|
|
1968
|
-
"use strict";
|
|
1969
|
-
var $;
|
|
1970
|
-
(function ($) {
|
|
1971
|
-
$.$mol_action = $mol_wire_method;
|
|
1490
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1972
1491
|
})($ || ($ = {}));
|
|
1973
1492
|
|
|
1974
1493
|
;
|
|
1975
1494
|
"use strict";
|
|
1976
1495
|
var $;
|
|
1977
1496
|
(function ($) {
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
if (
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
return;
|
|
1990
|
-
const history = $mol_dom.history;
|
|
1991
|
-
history.replaceState(history.state, $mol_dom.document.title, next);
|
|
1992
|
-
});
|
|
1993
|
-
}
|
|
1994
|
-
if ($mol_dom.parent && ($mol_dom.parent !== $mol_dom.self)) {
|
|
1995
|
-
$mol_dom.parent.postMessage(['hashchange', next], '*');
|
|
1996
|
-
}
|
|
1997
|
-
return next;
|
|
1998
|
-
}
|
|
1999
|
-
static href_normal() {
|
|
2000
|
-
return this.link({});
|
|
2001
|
-
}
|
|
2002
|
-
static href_absolute() {
|
|
2003
|
-
return new URL(this.href(), $mol_dom.location.href).toString();
|
|
1497
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
1498
|
+
function $mol_key(value) {
|
|
1499
|
+
primitives: {
|
|
1500
|
+
if (typeof value === 'bigint')
|
|
1501
|
+
return value.toString() + 'n';
|
|
1502
|
+
if (typeof value === 'symbol')
|
|
1503
|
+
return `Symbol(${value.description})`;
|
|
1504
|
+
if (!value)
|
|
1505
|
+
return JSON.stringify(value);
|
|
1506
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1507
|
+
return JSON.stringify(value);
|
|
2004
1508
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
chunks.forEach(chunk => {
|
|
2010
|
-
if (!chunk)
|
|
2011
|
-
return;
|
|
2012
|
-
var vals = chunk.split('=').map(decodeURIComponent);
|
|
2013
|
-
params[vals.shift()] = vals.join('=');
|
|
2014
|
-
});
|
|
2015
|
-
return params;
|
|
1509
|
+
caching: {
|
|
1510
|
+
let key = $mol_key_store.get(value);
|
|
1511
|
+
if (key)
|
|
1512
|
+
return key;
|
|
2016
1513
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
for (const key in dict) {
|
|
2021
|
-
if (except.indexOf(key) >= 0)
|
|
2022
|
-
break;
|
|
2023
|
-
cut[key] = dict[key];
|
|
1514
|
+
objects: {
|
|
1515
|
+
if (value instanceof TypedArray) {
|
|
1516
|
+
return `${value[Symbol.toStringTag]}([${[...value].map(v => $mol_key(v))}])`;
|
|
2024
1517
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
}
|
|
2032
|
-
static link(next) {
|
|
2033
|
-
return this.make_link({
|
|
2034
|
-
...this.dict_cut(Object.keys(next)),
|
|
2035
|
-
...next,
|
|
2036
|
-
});
|
|
1518
|
+
if (Array.isArray(value))
|
|
1519
|
+
return `[${value.map(v => $mol_key(v))}]`;
|
|
1520
|
+
if (value instanceof RegExp)
|
|
1521
|
+
return value.toString();
|
|
1522
|
+
if (value instanceof Date)
|
|
1523
|
+
return `Date(${value.valueOf()})`;
|
|
2037
1524
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
for (let key in next) {
|
|
2043
|
-
if (null == next[key])
|
|
2044
|
-
continue;
|
|
2045
|
-
const val = next[key];
|
|
2046
|
-
chunks.push([key].concat(val ? [val] : []).map(this.encode).join('='));
|
|
1525
|
+
structures: {
|
|
1526
|
+
const proto = Reflect.getPrototypeOf(value);
|
|
1527
|
+
if (!proto || !Reflect.getPrototypeOf(proto)) {
|
|
1528
|
+
return `{${Object.entries(value).map(([k, v]) => JSON.stringify(k) + ':' + $mol_key(v))}}`;
|
|
2047
1529
|
}
|
|
2048
|
-
return new URL('#' + this.prolog + chunks.join(this.separator), this.href_absolute()).toString();
|
|
2049
|
-
}
|
|
2050
|
-
static commit() {
|
|
2051
|
-
$mol_dom.history.pushState($mol_dom.history.state, $mol_dom.document.title, this.href());
|
|
2052
|
-
}
|
|
2053
|
-
static go(next) {
|
|
2054
|
-
$mol_dom.location.href = this.link(next);
|
|
2055
|
-
}
|
|
2056
|
-
static encode(str) {
|
|
2057
|
-
return encodeURIComponent(str).replace(/\(/g, '%28').replace(/\)/g, '%29');
|
|
2058
1530
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
}
|
|
2063
|
-
value(key, next) {
|
|
2064
|
-
return this.constructor.value(this.prefix + key, next);
|
|
2065
|
-
}
|
|
2066
|
-
sub(postfix) {
|
|
2067
|
-
return new this.constructor(this.prefix + postfix + '.');
|
|
2068
|
-
}
|
|
2069
|
-
link(next) {
|
|
2070
|
-
var prefix = this.prefix;
|
|
2071
|
-
var dict = {};
|
|
2072
|
-
for (var key in next) {
|
|
2073
|
-
dict[prefix + key] = next[key];
|
|
1531
|
+
handlers: {
|
|
1532
|
+
if ($mol_key_handle in value) {
|
|
1533
|
+
return value[$mol_key_handle]();
|
|
2074
1534
|
}
|
|
2075
|
-
|
|
1535
|
+
}
|
|
1536
|
+
containers: {
|
|
1537
|
+
const key = JSON.stringify('#' + $mol_guid());
|
|
1538
|
+
$mol_key_store.set(value, key);
|
|
1539
|
+
return key;
|
|
2076
1540
|
}
|
|
2077
1541
|
}
|
|
2078
|
-
|
|
2079
|
-
$mol_mem
|
|
2080
|
-
], $mol_state_arg, "href", null);
|
|
2081
|
-
__decorate([
|
|
2082
|
-
$mol_mem
|
|
2083
|
-
], $mol_state_arg, "href_normal", null);
|
|
2084
|
-
__decorate([
|
|
2085
|
-
$mol_mem
|
|
2086
|
-
], $mol_state_arg, "href_absolute", null);
|
|
2087
|
-
__decorate([
|
|
2088
|
-
$mol_mem
|
|
2089
|
-
], $mol_state_arg, "dict", null);
|
|
2090
|
-
__decorate([
|
|
2091
|
-
$mol_mem_key
|
|
2092
|
-
], $mol_state_arg, "dict_cut", null);
|
|
2093
|
-
__decorate([
|
|
2094
|
-
$mol_mem_key
|
|
2095
|
-
], $mol_state_arg, "value", null);
|
|
2096
|
-
__decorate([
|
|
2097
|
-
$mol_mem_key
|
|
2098
|
-
], $mol_state_arg, "make_link", null);
|
|
2099
|
-
__decorate([
|
|
2100
|
-
$mol_action
|
|
2101
|
-
], $mol_state_arg, "commit", null);
|
|
2102
|
-
__decorate([
|
|
2103
|
-
$mol_action
|
|
2104
|
-
], $mol_state_arg, "go", null);
|
|
2105
|
-
$.$mol_state_arg = $mol_state_arg;
|
|
2106
|
-
function $mol_state_arg_change() {
|
|
2107
|
-
$mol_state_arg.href($mol_dom.location.href);
|
|
2108
|
-
}
|
|
2109
|
-
self.addEventListener('hashchange', $mol_state_arg_change);
|
|
1542
|
+
$.$mol_key = $mol_key;
|
|
2110
1543
|
})($ || ($ = {}));
|
|
2111
1544
|
|
|
2112
1545
|
;
|
|
2113
1546
|
"use strict";
|
|
2114
1547
|
var $;
|
|
2115
1548
|
(function ($) {
|
|
2116
|
-
class $
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
return
|
|
1549
|
+
class $mol_after_frame extends $mol_object2 {
|
|
1550
|
+
task;
|
|
1551
|
+
static _promise = null;
|
|
1552
|
+
static get promise() {
|
|
1553
|
+
if (this._promise)
|
|
1554
|
+
return this._promise;
|
|
1555
|
+
return this._promise = new Promise(done => {
|
|
1556
|
+
const complete = () => {
|
|
1557
|
+
this._promise = null;
|
|
1558
|
+
done();
|
|
1559
|
+
};
|
|
1560
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
1561
|
+
requestAnimationFrame(complete);
|
|
1562
|
+
}
|
|
1563
|
+
else {
|
|
1564
|
+
setTimeout(complete, 16);
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
cancelled = false;
|
|
1569
|
+
promise;
|
|
1570
|
+
constructor(task) {
|
|
1571
|
+
super();
|
|
1572
|
+
this.task = task;
|
|
1573
|
+
this.promise = $mol_after_frame.promise.then(() => {
|
|
1574
|
+
if (this.cancelled)
|
|
1575
|
+
return;
|
|
1576
|
+
task();
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
destructor() {
|
|
1580
|
+
this.cancelled = true;
|
|
2123
1581
|
}
|
|
2124
1582
|
}
|
|
2125
|
-
|
|
2126
|
-
$mol_mem_key
|
|
2127
|
-
], $mol_media, "match", null);
|
|
2128
|
-
$.$mol_media = $mol_media;
|
|
1583
|
+
$.$mol_after_frame = $mol_after_frame;
|
|
2129
1584
|
})($ || ($ = {}));
|
|
2130
1585
|
|
|
2131
1586
|
;
|
|
2132
1587
|
"use strict";
|
|
2133
1588
|
var $;
|
|
2134
1589
|
(function ($) {
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
if (
|
|
2138
|
-
|
|
2139
|
-
if (
|
|
2140
|
-
|
|
1590
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
1591
|
+
function $mol_compare_deep(left, right) {
|
|
1592
|
+
if (Object.is(left, right))
|
|
1593
|
+
return true;
|
|
1594
|
+
if (left === null)
|
|
1595
|
+
return false;
|
|
1596
|
+
if (right === null)
|
|
1597
|
+
return false;
|
|
1598
|
+
if (typeof left !== 'object')
|
|
1599
|
+
return false;
|
|
1600
|
+
if (typeof right !== 'object')
|
|
1601
|
+
return false;
|
|
1602
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
1603
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
1604
|
+
if (left_proto !== right_proto)
|
|
1605
|
+
return false;
|
|
1606
|
+
if (left instanceof Boolean)
|
|
1607
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
1608
|
+
if (left instanceof Number)
|
|
1609
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
1610
|
+
if (left instanceof String)
|
|
1611
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
1612
|
+
if (left instanceof Date)
|
|
1613
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
1614
|
+
if (left instanceof RegExp)
|
|
1615
|
+
return left.source === right.source && left.flags === right.flags;
|
|
1616
|
+
if (left instanceof Error)
|
|
1617
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
1618
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
1619
|
+
if (left_cache) {
|
|
1620
|
+
const right_cache = left_cache.get(right);
|
|
1621
|
+
if (typeof right_cache === 'boolean')
|
|
1622
|
+
return right_cache;
|
|
2141
1623
|
}
|
|
2142
|
-
|
|
1624
|
+
else {
|
|
1625
|
+
left_cache = new WeakMap();
|
|
1626
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
1627
|
+
}
|
|
1628
|
+
left_cache.set(right, true);
|
|
1629
|
+
let result;
|
|
1630
|
+
try {
|
|
1631
|
+
if (!left_proto)
|
|
1632
|
+
result = compare_pojo(left, right);
|
|
1633
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
1634
|
+
result = compare_pojo(left, right);
|
|
1635
|
+
else if (Symbol.toPrimitive in left)
|
|
1636
|
+
result = compare_primitive(left, right);
|
|
1637
|
+
else if (Array.isArray(left))
|
|
1638
|
+
result = compare_array(left, right);
|
|
1639
|
+
else if (left instanceof Set)
|
|
1640
|
+
result = compare_set(left, right);
|
|
1641
|
+
else if (left instanceof Map)
|
|
1642
|
+
result = compare_map(left, right);
|
|
1643
|
+
else if (ArrayBuffer.isView(left))
|
|
1644
|
+
result = compare_buffer(left, right);
|
|
1645
|
+
else if (Symbol.iterator in left)
|
|
1646
|
+
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
1647
|
+
else
|
|
1648
|
+
result = false;
|
|
1649
|
+
}
|
|
1650
|
+
finally {
|
|
1651
|
+
left_cache.set(right, result);
|
|
1652
|
+
}
|
|
1653
|
+
return result;
|
|
1654
|
+
}
|
|
1655
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
1656
|
+
function compare_array(left, right) {
|
|
1657
|
+
const len = left.length;
|
|
1658
|
+
if (len !== right.length)
|
|
1659
|
+
return false;
|
|
1660
|
+
for (let i = 0; i < len; ++i) {
|
|
1661
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
1662
|
+
return false;
|
|
1663
|
+
}
|
|
1664
|
+
return true;
|
|
1665
|
+
}
|
|
1666
|
+
function compare_buffer(left, right) {
|
|
1667
|
+
const len = left.byteLength;
|
|
1668
|
+
if (len !== right.byteLength)
|
|
1669
|
+
return false;
|
|
1670
|
+
if (left instanceof DataView)
|
|
1671
|
+
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, right.byteOffset, right.byteLength));
|
|
1672
|
+
for (let i = 0; i < len; ++i) {
|
|
1673
|
+
if (left[i] !== right[i])
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
return true;
|
|
1677
|
+
}
|
|
1678
|
+
function compare_iterator(left, right) {
|
|
1679
|
+
while (true) {
|
|
1680
|
+
const left_next = left.next();
|
|
1681
|
+
const right_next = right.next();
|
|
1682
|
+
if (left_next.done !== right_next.done)
|
|
1683
|
+
return false;
|
|
1684
|
+
if (left_next.done)
|
|
1685
|
+
break;
|
|
1686
|
+
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
1687
|
+
return false;
|
|
1688
|
+
}
|
|
1689
|
+
return true;
|
|
1690
|
+
}
|
|
1691
|
+
function compare_set(left, right) {
|
|
1692
|
+
if (left.size !== right.size)
|
|
1693
|
+
return false;
|
|
1694
|
+
return compare_iterator(left.values(), right.values());
|
|
1695
|
+
}
|
|
1696
|
+
function compare_map(left, right) {
|
|
1697
|
+
if (left.size !== right.size)
|
|
1698
|
+
return false;
|
|
1699
|
+
return compare_iterator(left.keys(), right.keys())
|
|
1700
|
+
&& compare_iterator(left.values(), right.values());
|
|
2143
1701
|
}
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
(function ($) {
|
|
2153
|
-
$.$mol_mem_persist = $mol_wire_solid;
|
|
2154
|
-
})($ || ($ = {}));
|
|
2155
|
-
|
|
2156
|
-
;
|
|
2157
|
-
"use strict";
|
|
2158
|
-
var $;
|
|
2159
|
-
(function ($) {
|
|
2160
|
-
function $mol_wire_probe(task, def) {
|
|
2161
|
-
const warm = $mol_wire_fiber.warm;
|
|
2162
|
-
try {
|
|
2163
|
-
$mol_wire_fiber.warm = false;
|
|
2164
|
-
const res = task();
|
|
2165
|
-
if (res === undefined)
|
|
2166
|
-
return def;
|
|
2167
|
-
return res;
|
|
1702
|
+
function compare_pojo(left, right) {
|
|
1703
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
1704
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
1705
|
+
if (!compare_array(left_keys, right_keys))
|
|
1706
|
+
return false;
|
|
1707
|
+
for (let key of left_keys) {
|
|
1708
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1709
|
+
return false;
|
|
2168
1710
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
1711
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
1712
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
1713
|
+
if (!compare_array(left_syms, right_syms))
|
|
1714
|
+
return false;
|
|
1715
|
+
for (let key of left_syms) {
|
|
1716
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1717
|
+
return false;
|
|
2171
1718
|
}
|
|
1719
|
+
return true;
|
|
1720
|
+
}
|
|
1721
|
+
function compare_primitive(left, right) {
|
|
1722
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
2172
1723
|
}
|
|
2173
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
2174
|
-
})($ || ($ = {}));
|
|
2175
|
-
|
|
2176
|
-
;
|
|
2177
|
-
"use strict";
|
|
2178
|
-
var $;
|
|
2179
|
-
(function ($) {
|
|
2180
|
-
$.$mol_mem_cached = $mol_wire_probe;
|
|
2181
1724
|
})($ || ($ = {}));
|
|
2182
1725
|
|
|
2183
1726
|
;
|
|
2184
1727
|
"use strict";
|
|
2185
1728
|
var $;
|
|
2186
1729
|
(function ($) {
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
}
|
|
2196
|
-
const getters = new WeakMap();
|
|
2197
|
-
function get_prop(host, field) {
|
|
2198
|
-
let props = getters.get(host);
|
|
2199
|
-
let get_val = props?.[field];
|
|
2200
|
-
if (get_val)
|
|
2201
|
-
return get_val;
|
|
2202
|
-
get_val = (next) => {
|
|
2203
|
-
if (next !== undefined)
|
|
2204
|
-
host[field] = next;
|
|
2205
|
-
return host[field];
|
|
2206
|
-
};
|
|
2207
|
-
Object.defineProperty(get_val, 'name', { value: field });
|
|
2208
|
-
if (!props) {
|
|
2209
|
-
props = {};
|
|
2210
|
-
getters.set(host, props);
|
|
2211
|
-
}
|
|
2212
|
-
props[field] = get_val;
|
|
2213
|
-
return get_val;
|
|
2214
|
-
}
|
|
2215
|
-
function $mol_wire_sync(obj) {
|
|
2216
|
-
return new Proxy(obj, {
|
|
2217
|
-
get(obj, field) {
|
|
2218
|
-
let val = obj[field];
|
|
2219
|
-
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
2220
|
-
if (typeof val !== 'function')
|
|
2221
|
-
return temp(obj, []).sync();
|
|
2222
|
-
return function $mol_wire_sync(...args) {
|
|
2223
|
-
const fiber = temp(obj, args);
|
|
2224
|
-
return fiber.sync();
|
|
2225
|
-
};
|
|
2226
|
-
},
|
|
2227
|
-
set(obj, field, next) {
|
|
2228
|
-
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
2229
|
-
temp(obj, [next]).sync();
|
|
2230
|
-
return true;
|
|
2231
|
-
},
|
|
2232
|
-
construct(obj, args) {
|
|
2233
|
-
const temp = $mol_wire_task.getter(factory(obj));
|
|
2234
|
-
return temp(obj, args).sync();
|
|
2235
|
-
},
|
|
2236
|
-
apply(obj, self, args) {
|
|
2237
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2238
|
-
return temp(self, args).sync();
|
|
2239
|
-
},
|
|
1730
|
+
function $mol_log3_area_lazy(event) {
|
|
1731
|
+
const self = this.$;
|
|
1732
|
+
const stack = self.$mol_log3_stack;
|
|
1733
|
+
const deep = stack.length;
|
|
1734
|
+
let logged = false;
|
|
1735
|
+
stack.push(() => {
|
|
1736
|
+
logged = true;
|
|
1737
|
+
self.$mol_log3_area.call(self, event);
|
|
2240
1738
|
});
|
|
1739
|
+
return () => {
|
|
1740
|
+
if (logged)
|
|
1741
|
+
self.console.groupEnd();
|
|
1742
|
+
if (stack.length > deep)
|
|
1743
|
+
stack.length = deep;
|
|
1744
|
+
};
|
|
2241
1745
|
}
|
|
2242
|
-
$.$
|
|
1746
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1747
|
+
$.$mol_log3_stack = [];
|
|
2243
1748
|
})($ || ($ = {}));
|
|
2244
1749
|
|
|
2245
1750
|
;
|
|
2246
1751
|
"use strict";
|
|
2247
|
-
var $;
|
|
2248
|
-
(function ($) {
|
|
2249
|
-
function $mol_wait_user_async() {
|
|
2250
|
-
return new Promise(done => $mol_dom.addEventListener('click', function onclick() {
|
|
2251
|
-
$mol_dom.removeEventListener('click', onclick);
|
|
2252
|
-
done(null);
|
|
2253
|
-
}));
|
|
2254
|
-
}
|
|
2255
|
-
$.$mol_wait_user_async = $mol_wait_user_async;
|
|
2256
|
-
function $mol_wait_user() {
|
|
2257
|
-
return this.$mol_wire_sync(this).$mol_wait_user_async();
|
|
2258
|
-
}
|
|
2259
|
-
$.$mol_wait_user = $mol_wait_user;
|
|
2260
|
-
})($ || ($ = {}));
|
|
2261
1752
|
|
|
2262
1753
|
;
|
|
2263
1754
|
"use strict";
|
|
2264
1755
|
var $;
|
|
2265
1756
|
(function ($) {
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
static persisted(next, cache) {
|
|
2276
|
-
$mol_mem_persist();
|
|
2277
|
-
if (cache)
|
|
2278
|
-
return Boolean(next);
|
|
2279
|
-
const native = this.native();
|
|
2280
|
-
if (next && !$mol_mem_cached(() => this.persisted())) {
|
|
2281
|
-
this.$.$mol_wait_user_async()
|
|
2282
|
-
.then(() => native.persist())
|
|
2283
|
-
.then(actual => {
|
|
2284
|
-
setTimeout(() => this.persisted(actual, 'cache'), 5000);
|
|
2285
|
-
if (actual)
|
|
2286
|
-
this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
|
|
2287
|
-
else
|
|
2288
|
-
this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
|
|
2289
|
-
});
|
|
1757
|
+
function $mol_log3_web_make(level, color) {
|
|
1758
|
+
return function $mol_log3_logger(event) {
|
|
1759
|
+
const pending = this.$mol_log3_stack.pop();
|
|
1760
|
+
if (pending)
|
|
1761
|
+
pending();
|
|
1762
|
+
let tpl = '%c';
|
|
1763
|
+
const chunks = Object.entries(event);
|
|
1764
|
+
for (let i = 0; i < chunks.length; ++i) {
|
|
1765
|
+
tpl += (typeof chunks[i][1] === 'string') ? '%s: %s\n' : '%s: %o\n';
|
|
2290
1766
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
return
|
|
2295
|
-
}
|
|
2296
|
-
static dir() {
|
|
2297
|
-
return $mol_wire_sync(this.native()).getDirectory();
|
|
2298
|
-
}
|
|
1767
|
+
const style = `color:${color};font-weight:bolder`;
|
|
1768
|
+
this.console[level](tpl.trim(), style, ...[].concat(...chunks));
|
|
1769
|
+
const self = this;
|
|
1770
|
+
return () => self.console.groupEnd();
|
|
1771
|
+
};
|
|
2299
1772
|
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
$.$
|
|
1773
|
+
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
1774
|
+
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
1775
|
+
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
1776
|
+
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
1777
|
+
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
1778
|
+
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
1779
|
+
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
2307
1780
|
})($ || ($ = {}));
|
|
2308
1781
|
|
|
2309
1782
|
;
|
|
2310
1783
|
"use strict";
|
|
2311
1784
|
var $;
|
|
2312
1785
|
(function ($) {
|
|
2313
|
-
class $
|
|
2314
|
-
static
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
|
|
1786
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
1787
|
+
static getter(task) {
|
|
1788
|
+
return function $mol_wire_task_get(host, args) {
|
|
1789
|
+
const sub = $mol_wire_auto();
|
|
1790
|
+
const existen = sub?.track_next();
|
|
1791
|
+
let cause = '';
|
|
1792
|
+
reuse: if (existen) {
|
|
1793
|
+
if (!existen.temp)
|
|
1794
|
+
break reuse;
|
|
1795
|
+
if (existen.task !== task) {
|
|
1796
|
+
cause = 'task';
|
|
1797
|
+
break reuse;
|
|
1798
|
+
}
|
|
1799
|
+
if (existen.host !== host) {
|
|
1800
|
+
cause = 'host';
|
|
1801
|
+
break reuse;
|
|
1802
|
+
}
|
|
1803
|
+
if (!$mol_compare_deep(existen.args, args)) {
|
|
1804
|
+
cause = 'args';
|
|
1805
|
+
break reuse;
|
|
1806
|
+
}
|
|
1807
|
+
return existen;
|
|
1808
|
+
}
|
|
1809
|
+
const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
|
|
1810
|
+
const next = new $mol_wire_task(key, task, host, args);
|
|
1811
|
+
if (existen?.temp) {
|
|
1812
|
+
$$.$mol_log3_warn({
|
|
1813
|
+
place: '$mol_wire_task',
|
|
1814
|
+
message: `Different ${cause} on restart`,
|
|
1815
|
+
sub,
|
|
1816
|
+
prev: existen,
|
|
1817
|
+
next,
|
|
1818
|
+
hint: 'Maybe required additional memoization',
|
|
1819
|
+
});
|
|
2338
1820
|
}
|
|
1821
|
+
return next;
|
|
2339
1822
|
};
|
|
2340
1823
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
1824
|
+
get temp() {
|
|
1825
|
+
return true;
|
|
1826
|
+
}
|
|
1827
|
+
complete() {
|
|
1828
|
+
if ($mol_promise_like(this.cache))
|
|
1829
|
+
return;
|
|
1830
|
+
this.destructor();
|
|
1831
|
+
}
|
|
1832
|
+
put(next) {
|
|
1833
|
+
const prev = this.cache;
|
|
1834
|
+
this.cache = next;
|
|
1835
|
+
if ($mol_promise_like(next)) {
|
|
1836
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1837
|
+
if (next !== prev)
|
|
1838
|
+
this.emit();
|
|
1839
|
+
if ($mol_owning_catch(this, next)) {
|
|
1840
|
+
try {
|
|
1841
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1842
|
+
}
|
|
1843
|
+
catch {
|
|
1844
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
return next;
|
|
2352
1848
|
}
|
|
1849
|
+
this.cursor = $mol_wire_cursor.final;
|
|
1850
|
+
if (this.sub_empty)
|
|
1851
|
+
this.destructor();
|
|
1852
|
+
else if (next !== prev)
|
|
1853
|
+
this.emit();
|
|
2353
1854
|
return next;
|
|
2354
1855
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
1856
|
+
destructor() {
|
|
1857
|
+
super.destructor();
|
|
1858
|
+
this.cursor = $mol_wire_cursor.final;
|
|
2358
1859
|
}
|
|
2359
1860
|
}
|
|
2360
|
-
|
|
2361
|
-
$mol_mem
|
|
2362
|
-
], $mol_state_local, "changes", null);
|
|
2363
|
-
__decorate([
|
|
2364
|
-
$mol_mem_key
|
|
2365
|
-
], $mol_state_local, "value", null);
|
|
2366
|
-
$.$mol_state_local = $mol_state_local;
|
|
1861
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
2367
1862
|
})($ || ($ = {}));
|
|
2368
1863
|
|
|
2369
1864
|
;
|
|
2370
1865
|
"use strict";
|
|
2371
1866
|
var $;
|
|
2372
1867
|
(function ($) {
|
|
2373
|
-
|
|
1868
|
+
function $mol_wire_method(host, field, descr) {
|
|
1869
|
+
if (!descr)
|
|
1870
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1871
|
+
const orig = descr?.value ?? host[field];
|
|
1872
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1873
|
+
if (typeof sup[field] === 'function') {
|
|
1874
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1875
|
+
}
|
|
1876
|
+
const temp = $mol_wire_task.getter(orig);
|
|
1877
|
+
const value = function (...args) {
|
|
1878
|
+
const fiber = temp(this ?? null, args);
|
|
1879
|
+
return fiber.sync();
|
|
1880
|
+
};
|
|
1881
|
+
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1882
|
+
Object.assign(value, { orig });
|
|
1883
|
+
const descr2 = { ...descr, value };
|
|
1884
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1885
|
+
return descr2;
|
|
1886
|
+
}
|
|
1887
|
+
$.$mol_wire_method = $mol_wire_method;
|
|
2374
1888
|
})($ || ($ = {}));
|
|
2375
1889
|
|
|
2376
1890
|
;
|
|
2377
1891
|
"use strict";
|
|
2378
|
-
var $;
|
|
2379
|
-
(function ($) {
|
|
2380
|
-
function parse(theme) {
|
|
2381
|
-
if (theme === 'true')
|
|
2382
|
-
return true;
|
|
2383
|
-
if (theme === 'false')
|
|
2384
|
-
return false;
|
|
2385
|
-
return null;
|
|
2386
|
-
}
|
|
2387
|
-
function $mol_lights(next) {
|
|
2388
|
-
const arg = parse(this.$mol_state_arg.value('mol_lights'));
|
|
2389
|
-
const base = this.$mol_media.match('(prefers-color-scheme: light)');
|
|
2390
|
-
if (next === undefined) {
|
|
2391
|
-
return arg ?? this.$mol_state_local.value('$mol_lights') ?? base;
|
|
2392
|
-
}
|
|
2393
|
-
else {
|
|
2394
|
-
if (arg === null) {
|
|
2395
|
-
this.$mol_state_local.value('$mol_lights', next === base ? null : next);
|
|
2396
|
-
}
|
|
2397
|
-
else {
|
|
2398
|
-
this.$mol_state_arg.value('mol_lights', String(next));
|
|
2399
|
-
}
|
|
2400
|
-
return next;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
$.$mol_lights = $mol_lights;
|
|
2404
|
-
})($ || ($ = {}));
|
|
2405
1892
|
|
|
2406
1893
|
;
|
|
2407
1894
|
"use strict";
|
|
2408
|
-
var $;
|
|
2409
|
-
(function ($) {
|
|
2410
|
-
$.$mol_theme = $mol_style_prop('mol_theme', [
|
|
2411
|
-
'back',
|
|
2412
|
-
'hover',
|
|
2413
|
-
'card',
|
|
2414
|
-
'current',
|
|
2415
|
-
'special',
|
|
2416
|
-
'text',
|
|
2417
|
-
'control',
|
|
2418
|
-
'shade',
|
|
2419
|
-
'line',
|
|
2420
|
-
'focus',
|
|
2421
|
-
'field',
|
|
2422
|
-
'image',
|
|
2423
|
-
'spirit',
|
|
2424
|
-
]);
|
|
2425
|
-
})($ || ($ = {}));
|
|
2426
1895
|
|
|
2427
1896
|
;
|
|
2428
1897
|
"use strict";
|
|
2429
1898
|
var $;
|
|
2430
1899
|
(function ($) {
|
|
2431
|
-
|
|
1900
|
+
const catched = new WeakSet();
|
|
1901
|
+
function $mol_fail_catch(error) {
|
|
1902
|
+
if (typeof error !== 'object')
|
|
1903
|
+
return false;
|
|
1904
|
+
if ($mol_promise_like(error))
|
|
1905
|
+
$mol_fail_hidden(error);
|
|
1906
|
+
if (catched.has(error))
|
|
1907
|
+
return false;
|
|
1908
|
+
catched.add(error);
|
|
1909
|
+
return true;
|
|
1910
|
+
}
|
|
1911
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
2432
1912
|
})($ || ($ = {}));
|
|
2433
1913
|
|
|
2434
1914
|
;
|
|
2435
1915
|
"use strict";
|
|
2436
1916
|
var $;
|
|
2437
1917
|
(function ($) {
|
|
2438
|
-
|
|
1918
|
+
function $mol_try(handler) {
|
|
1919
|
+
try {
|
|
1920
|
+
return handler();
|
|
1921
|
+
}
|
|
1922
|
+
catch (error) {
|
|
1923
|
+
console.error(error);
|
|
1924
|
+
return error;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
$.$mol_try = $mol_try;
|
|
2439
1928
|
})($ || ($ = {}));
|
|
2440
1929
|
|
|
2441
1930
|
;
|
|
2442
1931
|
"use strict";
|
|
2443
1932
|
var $;
|
|
2444
1933
|
(function ($) {
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
'
|
|
2453
|
-
|
|
1934
|
+
let error;
|
|
1935
|
+
let result;
|
|
1936
|
+
let handler;
|
|
1937
|
+
function $mol_try_web(handler2) {
|
|
1938
|
+
handler = handler2;
|
|
1939
|
+
error = undefined;
|
|
1940
|
+
result = undefined;
|
|
1941
|
+
window.dispatchEvent(new Event('$mol_try'));
|
|
1942
|
+
const error2 = error;
|
|
1943
|
+
const result2 = result;
|
|
1944
|
+
error = undefined;
|
|
1945
|
+
result = undefined;
|
|
1946
|
+
return error2 || result2;
|
|
1947
|
+
}
|
|
1948
|
+
$.$mol_try_web = $mol_try_web;
|
|
1949
|
+
$.$mol_try = $mol_try_web;
|
|
1950
|
+
self.addEventListener('$mol_try', (event) => {
|
|
1951
|
+
result = handler();
|
|
1952
|
+
}, true);
|
|
1953
|
+
self.addEventListener('error', (event) => {
|
|
1954
|
+
error = event.error;
|
|
1955
|
+
}, true);
|
|
2454
1956
|
})($ || ($ = {}));
|
|
2455
1957
|
|
|
2456
1958
|
;
|
|
2457
1959
|
"use strict";
|
|
2458
1960
|
var $;
|
|
2459
1961
|
(function ($) {
|
|
2460
|
-
$
|
|
1962
|
+
function $mol_fail_log(error) {
|
|
1963
|
+
if ($mol_promise_like(error))
|
|
1964
|
+
return false;
|
|
1965
|
+
if (!$mol_fail_catch(error))
|
|
1966
|
+
return false;
|
|
1967
|
+
$mol_try(() => { $mol_fail_hidden(error); });
|
|
1968
|
+
return true;
|
|
1969
|
+
}
|
|
1970
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
2461
1971
|
})($ || ($ = {}));
|
|
2462
1972
|
|
|
2463
1973
|
;
|
|
2464
1974
|
"use strict";
|
|
2465
1975
|
var $;
|
|
2466
1976
|
(function ($) {
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
if (
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
1977
|
+
class $mol_wire_atom extends $mol_wire_fiber {
|
|
1978
|
+
static solo(host, task) {
|
|
1979
|
+
const field = task.name + '()';
|
|
1980
|
+
const existen = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1981
|
+
if (existen)
|
|
1982
|
+
return existen;
|
|
1983
|
+
const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
|
|
1984
|
+
const key = prefix + ('.' + task.name + '<>');
|
|
1985
|
+
const fiber = new $mol_wire_atom(key, task, host, []);
|
|
1986
|
+
(host ?? task)[field] = fiber;
|
|
1987
|
+
return fiber;
|
|
1988
|
+
}
|
|
1989
|
+
static plex(host, task, key) {
|
|
1990
|
+
const field = task.name + '()';
|
|
1991
|
+
let dict = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
|
|
1992
|
+
const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
|
|
1993
|
+
const key_str = $mol_key(key);
|
|
1994
|
+
if (dict) {
|
|
1995
|
+
const existen = dict.get(key_str);
|
|
1996
|
+
if (existen)
|
|
1997
|
+
return existen;
|
|
1998
|
+
}
|
|
1999
|
+
else {
|
|
2000
|
+
dict = (host ?? task)[field] = new Map();
|
|
2001
|
+
}
|
|
2002
|
+
const id = prefix + ('.' + task.name) + ('<' + key_str.replace(/^"|"$/g, "'") + '>');
|
|
2003
|
+
const fiber = new $mol_wire_atom(id, task, host, [key]);
|
|
2004
|
+
dict.set(key_str, fiber);
|
|
2005
|
+
return fiber;
|
|
2006
|
+
}
|
|
2007
|
+
static watching = new Set();
|
|
2008
|
+
static watcher = null;
|
|
2009
|
+
static watch() {
|
|
2010
|
+
$mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
|
|
2011
|
+
for (const atom of $mol_wire_atom.watching) {
|
|
2012
|
+
if (atom.cursor === $mol_wire_cursor.final) {
|
|
2013
|
+
$mol_wire_atom.watching.delete(atom);
|
|
2014
|
+
}
|
|
2015
|
+
else {
|
|
2016
|
+
atom.cursor = $mol_wire_cursor.stale;
|
|
2017
|
+
atom.fresh();
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
watch() {
|
|
2022
|
+
if (!$mol_wire_atom.watcher) {
|
|
2023
|
+
$mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
|
|
2024
|
+
}
|
|
2025
|
+
$mol_wire_atom.watching.add(this);
|
|
2026
|
+
}
|
|
2027
|
+
resync(args) {
|
|
2028
|
+
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
2029
|
+
const pub = this.data[cursor];
|
|
2030
|
+
if (pub && pub instanceof $mol_wire_task) {
|
|
2031
|
+
pub.destructor();
|
|
2494
2032
|
}
|
|
2495
2033
|
}
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2034
|
+
return this.put(this.task.call(this.host, ...args));
|
|
2035
|
+
}
|
|
2036
|
+
once() {
|
|
2037
|
+
return this.sync();
|
|
2038
|
+
}
|
|
2039
|
+
channel() {
|
|
2040
|
+
return Object.assign((next) => {
|
|
2041
|
+
if (next !== undefined)
|
|
2042
|
+
return this.resync([...this.args, next]);
|
|
2043
|
+
if (!$mol_wire_fiber.warm)
|
|
2044
|
+
return this.result();
|
|
2045
|
+
if ($mol_wire_auto()?.temp) {
|
|
2046
|
+
return this.once();
|
|
2502
2047
|
}
|
|
2503
2048
|
else {
|
|
2504
|
-
|
|
2505
|
-
el.insertBefore(textNode, nextNode);
|
|
2049
|
+
return this.sync();
|
|
2506
2050
|
}
|
|
2051
|
+
}, { atom: this });
|
|
2052
|
+
}
|
|
2053
|
+
destructor() {
|
|
2054
|
+
super.destructor();
|
|
2055
|
+
if (this.pub_from === 0) {
|
|
2056
|
+
;
|
|
2057
|
+
(this.host ?? this.task)[this.field()] = null;
|
|
2058
|
+
}
|
|
2059
|
+
else {
|
|
2060
|
+
const key = $mol_key(this.args[0]);
|
|
2061
|
+
const map = (this.host ?? this.task)[this.field()];
|
|
2062
|
+
if (!map.has(key))
|
|
2063
|
+
this.$.$mol_log3_warn({
|
|
2064
|
+
place: this,
|
|
2065
|
+
message: 'Absent key on destruction',
|
|
2066
|
+
hint: 'Check for $mol_key(key) is not changed',
|
|
2067
|
+
});
|
|
2068
|
+
map.delete(key);
|
|
2507
2069
|
}
|
|
2508
2070
|
}
|
|
2509
|
-
|
|
2510
|
-
const
|
|
2511
|
-
|
|
2512
|
-
|
|
2071
|
+
put(next) {
|
|
2072
|
+
const prev = this.cache;
|
|
2073
|
+
update: if (next !== prev) {
|
|
2074
|
+
try {
|
|
2075
|
+
if ($mol_compare_deep(prev, next))
|
|
2076
|
+
break update;
|
|
2077
|
+
}
|
|
2078
|
+
catch (error) {
|
|
2079
|
+
$mol_fail_log(error);
|
|
2080
|
+
}
|
|
2081
|
+
if ($mol_owning_check(this, prev)) {
|
|
2082
|
+
prev.destructor();
|
|
2083
|
+
}
|
|
2084
|
+
if ($mol_owning_catch(this, next)) {
|
|
2085
|
+
try {
|
|
2086
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
2087
|
+
}
|
|
2088
|
+
catch {
|
|
2089
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
if (!this.sub_empty)
|
|
2093
|
+
this.emit();
|
|
2094
|
+
}
|
|
2095
|
+
this.cache = next;
|
|
2096
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
2097
|
+
if ($mol_promise_like(next))
|
|
2098
|
+
return next;
|
|
2099
|
+
this.complete_pubs();
|
|
2100
|
+
return next;
|
|
2513
2101
|
}
|
|
2514
2102
|
}
|
|
2515
|
-
|
|
2103
|
+
__decorate([
|
|
2104
|
+
$mol_wire_method
|
|
2105
|
+
], $mol_wire_atom.prototype, "resync", null);
|
|
2106
|
+
__decorate([
|
|
2107
|
+
$mol_wire_method
|
|
2108
|
+
], $mol_wire_atom.prototype, "once", null);
|
|
2109
|
+
$.$mol_wire_atom = $mol_wire_atom;
|
|
2516
2110
|
})($ || ($ = {}));
|
|
2517
2111
|
|
|
2518
|
-
;
|
|
2519
|
-
"use strict";
|
|
2520
|
-
|
|
2521
2112
|
;
|
|
2522
2113
|
"use strict";
|
|
2523
2114
|
var $;
|
|
2524
2115
|
(function ($) {
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
};
|
|
2533
|
-
$.$mol_jsx_frag = '';
|
|
2534
|
-
function $mol_jsx(Elem, props, ...childNodes) {
|
|
2535
|
-
const id = props && props.id || '';
|
|
2536
|
-
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
2537
|
-
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
2538
|
-
if (Elem && $.$mol_jsx_booked) {
|
|
2539
|
-
if ($.$mol_jsx_booked.has(id)) {
|
|
2540
|
-
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
2541
|
-
}
|
|
2542
|
-
else {
|
|
2543
|
-
$.$mol_jsx_booked.add(id);
|
|
2544
|
-
}
|
|
2116
|
+
function $mol_wire_solo(host, field, descr) {
|
|
2117
|
+
if (!descr)
|
|
2118
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
2119
|
+
const orig = descr?.value ?? host[field];
|
|
2120
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
2121
|
+
if (typeof sup[field] === 'function') {
|
|
2122
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
2545
2123
|
}
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
const wrapper = function (...args) {
|
|
2556
|
-
const prefix = $.$mol_jsx_prefix;
|
|
2557
|
-
const booked = $.$mol_jsx_booked;
|
|
2558
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
2559
|
-
try {
|
|
2560
|
-
$.$mol_jsx_prefix = prefix_ext;
|
|
2561
|
-
$.$mol_jsx_booked = booked_ext;
|
|
2562
|
-
$.$mol_jsx_crumbs = crumbs_ext;
|
|
2563
|
-
return func.call(this, ...args);
|
|
2124
|
+
const descr2 = {
|
|
2125
|
+
...descr,
|
|
2126
|
+
value: function (...args) {
|
|
2127
|
+
let atom = $mol_wire_atom.solo(this, orig);
|
|
2128
|
+
if ((args.length === 0) || (args[0] === undefined)) {
|
|
2129
|
+
if (!$mol_wire_fiber.warm)
|
|
2130
|
+
return atom.result();
|
|
2131
|
+
if ($mol_wire_auto()?.temp) {
|
|
2132
|
+
return atom.once();
|
|
2564
2133
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
$.$mol_jsx_booked = booked;
|
|
2568
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
2134
|
+
else {
|
|
2135
|
+
return atom.sync();
|
|
2569
2136
|
}
|
|
2570
|
-
};
|
|
2571
|
-
$mol_func_name_from(wrapper, func);
|
|
2572
|
-
props[field] = wrapper;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
if (typeof Elem !== 'string') {
|
|
2576
|
-
if ('prototype' in Elem) {
|
|
2577
|
-
const view = node && node[String(Elem)] || new Elem;
|
|
2578
|
-
Object.assign(view, props);
|
|
2579
|
-
view[Symbol.toStringTag] = guid;
|
|
2580
|
-
view.childNodes = childNodes;
|
|
2581
|
-
if (!view.ownerDocument)
|
|
2582
|
-
view.ownerDocument = $.$mol_jsx_document;
|
|
2583
|
-
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
2584
|
-
node = view.valueOf();
|
|
2585
|
-
node[String(Elem)] = view;
|
|
2586
|
-
return node;
|
|
2587
|
-
}
|
|
2588
|
-
else {
|
|
2589
|
-
const prefix = $.$mol_jsx_prefix;
|
|
2590
|
-
const booked = $.$mol_jsx_booked;
|
|
2591
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
2592
|
-
try {
|
|
2593
|
-
$.$mol_jsx_prefix = guid;
|
|
2594
|
-
$.$mol_jsx_booked = new Set;
|
|
2595
|
-
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
2596
|
-
return Elem(props, ...childNodes);
|
|
2597
|
-
}
|
|
2598
|
-
finally {
|
|
2599
|
-
$.$mol_jsx_prefix = prefix;
|
|
2600
|
-
$.$mol_jsx_booked = booked;
|
|
2601
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
2602
2137
|
}
|
|
2138
|
+
return atom.resync(args);
|
|
2603
2139
|
}
|
|
2140
|
+
};
|
|
2141
|
+
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
2142
|
+
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
2143
|
+
Object.assign(descr2.value, { orig });
|
|
2144
|
+
Reflect.defineProperty(host, field, descr2);
|
|
2145
|
+
return descr2;
|
|
2146
|
+
}
|
|
2147
|
+
$.$mol_wire_solo = $mol_wire_solo;
|
|
2148
|
+
})($ || ($ = {}));
|
|
2149
|
+
|
|
2150
|
+
;
|
|
2151
|
+
"use strict";
|
|
2152
|
+
var $;
|
|
2153
|
+
(function ($) {
|
|
2154
|
+
function $mol_wire_plex(host, field, descr) {
|
|
2155
|
+
if (!descr)
|
|
2156
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
2157
|
+
const orig = descr?.value ?? host[field];
|
|
2158
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
2159
|
+
if (typeof sup[field] === 'function') {
|
|
2160
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
2604
2161
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
if (typeof props[key] === 'string') {
|
|
2619
|
-
if (typeof node[key] === 'string')
|
|
2620
|
-
node[key] = props[key];
|
|
2621
|
-
node.setAttribute(key, props[key]);
|
|
2622
|
-
}
|
|
2623
|
-
else if (props[key] &&
|
|
2624
|
-
typeof props[key] === 'object' &&
|
|
2625
|
-
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
2626
|
-
if (typeof node[key] === 'object') {
|
|
2627
|
-
Object.assign(node[key], props[key]);
|
|
2628
|
-
continue;
|
|
2162
|
+
const descr2 = {
|
|
2163
|
+
...descr,
|
|
2164
|
+
value: function (...args) {
|
|
2165
|
+
let atom = $mol_wire_atom.plex(this, orig, args[0]);
|
|
2166
|
+
if ((args.length === 1) || (args[1] === undefined)) {
|
|
2167
|
+
if (!$mol_wire_fiber.warm)
|
|
2168
|
+
return atom.result();
|
|
2169
|
+
if ($mol_wire_auto()?.temp) {
|
|
2170
|
+
return atom.once();
|
|
2171
|
+
}
|
|
2172
|
+
else {
|
|
2173
|
+
return atom.sync();
|
|
2174
|
+
}
|
|
2629
2175
|
}
|
|
2176
|
+
return atom.resync(args);
|
|
2630
2177
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
return node;
|
|
2178
|
+
};
|
|
2179
|
+
Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
|
|
2180
|
+
Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
|
|
2181
|
+
Object.assign(descr2.value, { orig });
|
|
2182
|
+
Reflect.defineProperty(host, field, descr2);
|
|
2183
|
+
return descr2;
|
|
2638
2184
|
}
|
|
2639
|
-
$.$
|
|
2185
|
+
$.$mol_wire_plex = $mol_wire_plex;
|
|
2186
|
+
})($ || ($ = {}));
|
|
2187
|
+
|
|
2188
|
+
;
|
|
2189
|
+
"use strict";
|
|
2190
|
+
var $;
|
|
2191
|
+
(function ($) {
|
|
2192
|
+
$.$mol_mem = $mol_wire_solo;
|
|
2193
|
+
$.$mol_mem_key = $mol_wire_plex;
|
|
2640
2194
|
})($ || ($ = {}));
|
|
2641
2195
|
|
|
2642
2196
|
;
|
|
@@ -2968,6 +2522,26 @@ var $;
|
|
|
2968
2522
|
$.$mol_dom_qname = $mol_dom_qname;
|
|
2969
2523
|
})($ || ($ = {}));
|
|
2970
2524
|
|
|
2525
|
+
;
|
|
2526
|
+
"use strict";
|
|
2527
|
+
var $;
|
|
2528
|
+
(function ($) {
|
|
2529
|
+
function $mol_wire_probe(task, def) {
|
|
2530
|
+
const warm = $mol_wire_fiber.warm;
|
|
2531
|
+
try {
|
|
2532
|
+
$mol_wire_fiber.warm = false;
|
|
2533
|
+
const res = task();
|
|
2534
|
+
if (res === undefined)
|
|
2535
|
+
return def;
|
|
2536
|
+
return res;
|
|
2537
|
+
}
|
|
2538
|
+
finally {
|
|
2539
|
+
$mol_wire_fiber.warm = warm;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
2543
|
+
})($ || ($ = {}));
|
|
2544
|
+
|
|
2971
2545
|
;
|
|
2972
2546
|
"use strict";
|
|
2973
2547
|
var $;
|
|
@@ -2998,6 +2572,24 @@ var $;
|
|
|
2998
2572
|
$.$mol_const = $mol_const;
|
|
2999
2573
|
})($ || ($ = {}));
|
|
3000
2574
|
|
|
2575
|
+
;
|
|
2576
|
+
"use strict";
|
|
2577
|
+
var $;
|
|
2578
|
+
(function ($) {
|
|
2579
|
+
function $mol_wire_solid() {
|
|
2580
|
+
let current = $mol_wire_auto();
|
|
2581
|
+
if (current.temp)
|
|
2582
|
+
current = current.host;
|
|
2583
|
+
if (current.reap !== nothing) {
|
|
2584
|
+
current?.sub_on(sub, sub.data.length);
|
|
2585
|
+
}
|
|
2586
|
+
current.reap = nothing;
|
|
2587
|
+
}
|
|
2588
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
2589
|
+
const nothing = () => { };
|
|
2590
|
+
const sub = new $mol_wire_pub_sub;
|
|
2591
|
+
})($ || ($ = {}));
|
|
2592
|
+
|
|
3001
2593
|
;
|
|
3002
2594
|
"use strict";
|
|
3003
2595
|
var $;
|
|
@@ -4747,6 +4339,13 @@ var $;
|
|
|
4747
4339
|
($mol_mem(($.$mol_list.prototype), "view_window_shift"));
|
|
4748
4340
|
|
|
4749
4341
|
|
|
4342
|
+
;
|
|
4343
|
+
"use strict";
|
|
4344
|
+
var $;
|
|
4345
|
+
(function ($) {
|
|
4346
|
+
$.$mol_mem_cached = $mol_wire_probe;
|
|
4347
|
+
})($ || ($ = {}));
|
|
4348
|
+
|
|
4750
4349
|
;
|
|
4751
4350
|
"use strict";
|
|
4752
4351
|
var $;
|
|
@@ -5497,6 +5096,68 @@ var $;
|
|
|
5497
5096
|
$.$mol_html_encode = $mol_html_encode;
|
|
5498
5097
|
})($ || ($ = {}));
|
|
5499
5098
|
|
|
5099
|
+
;
|
|
5100
|
+
"use strict";
|
|
5101
|
+
var $;
|
|
5102
|
+
(function ($) {
|
|
5103
|
+
const factories = new WeakMap();
|
|
5104
|
+
function factory(val) {
|
|
5105
|
+
let make = factories.get(val);
|
|
5106
|
+
if (make)
|
|
5107
|
+
return make;
|
|
5108
|
+
make = $mol_func_name_from((...args) => new val(...args), val);
|
|
5109
|
+
factories.set(val, make);
|
|
5110
|
+
return make;
|
|
5111
|
+
}
|
|
5112
|
+
const getters = new WeakMap();
|
|
5113
|
+
function get_prop(host, field) {
|
|
5114
|
+
let props = getters.get(host);
|
|
5115
|
+
let get_val = props?.[field];
|
|
5116
|
+
if (get_val)
|
|
5117
|
+
return get_val;
|
|
5118
|
+
get_val = (next) => {
|
|
5119
|
+
if (next !== undefined)
|
|
5120
|
+
host[field] = next;
|
|
5121
|
+
return host[field];
|
|
5122
|
+
};
|
|
5123
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
|
5124
|
+
if (!props) {
|
|
5125
|
+
props = {};
|
|
5126
|
+
getters.set(host, props);
|
|
5127
|
+
}
|
|
5128
|
+
props[field] = get_val;
|
|
5129
|
+
return get_val;
|
|
5130
|
+
}
|
|
5131
|
+
function $mol_wire_sync(obj) {
|
|
5132
|
+
return new Proxy(obj, {
|
|
5133
|
+
get(obj, field) {
|
|
5134
|
+
let val = obj[field];
|
|
5135
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
5136
|
+
if (typeof val !== 'function')
|
|
5137
|
+
return temp(obj, []).sync();
|
|
5138
|
+
return function $mol_wire_sync(...args) {
|
|
5139
|
+
const fiber = temp(obj, args);
|
|
5140
|
+
return fiber.sync();
|
|
5141
|
+
};
|
|
5142
|
+
},
|
|
5143
|
+
set(obj, field, next) {
|
|
5144
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
5145
|
+
temp(obj, [next]).sync();
|
|
5146
|
+
return true;
|
|
5147
|
+
},
|
|
5148
|
+
construct(obj, args) {
|
|
5149
|
+
const temp = $mol_wire_task.getter(factory(obj));
|
|
5150
|
+
return temp(obj, args).sync();
|
|
5151
|
+
},
|
|
5152
|
+
apply(obj, self, args) {
|
|
5153
|
+
const temp = $mol_wire_task.getter(obj);
|
|
5154
|
+
return temp(self, args).sync();
|
|
5155
|
+
},
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5158
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
5159
|
+
})($ || ($ = {}));
|
|
5160
|
+
|
|
5500
5161
|
;
|
|
5501
5162
|
"use strict";
|
|
5502
5163
|
|
|
@@ -5535,6 +5196,151 @@ var $;
|
|
|
5535
5196
|
})($$ = $.$$ || ($.$$ = {}));
|
|
5536
5197
|
})($ || ($ = {}));
|
|
5537
5198
|
|
|
5199
|
+
;
|
|
5200
|
+
"use strict";
|
|
5201
|
+
var $;
|
|
5202
|
+
(function ($) {
|
|
5203
|
+
$.$mol_mem_persist = $mol_wire_solid;
|
|
5204
|
+
})($ || ($ = {}));
|
|
5205
|
+
|
|
5206
|
+
;
|
|
5207
|
+
"use strict";
|
|
5208
|
+
var $;
|
|
5209
|
+
(function ($) {
|
|
5210
|
+
function $mol_wait_user_async() {
|
|
5211
|
+
return new Promise(done => $mol_dom.addEventListener('click', function onclick() {
|
|
5212
|
+
$mol_dom.removeEventListener('click', onclick);
|
|
5213
|
+
done(null);
|
|
5214
|
+
}));
|
|
5215
|
+
}
|
|
5216
|
+
$.$mol_wait_user_async = $mol_wait_user_async;
|
|
5217
|
+
function $mol_wait_user() {
|
|
5218
|
+
return this.$mol_wire_sync(this).$mol_wait_user_async();
|
|
5219
|
+
}
|
|
5220
|
+
$.$mol_wait_user = $mol_wait_user;
|
|
5221
|
+
})($ || ($ = {}));
|
|
5222
|
+
|
|
5223
|
+
;
|
|
5224
|
+
"use strict";
|
|
5225
|
+
var $;
|
|
5226
|
+
(function ($) {
|
|
5227
|
+
class $mol_storage extends $mol_object2 {
|
|
5228
|
+
static native() {
|
|
5229
|
+
return this.$.$mol_dom_context.navigator.storage ?? {
|
|
5230
|
+
persisted: async () => false,
|
|
5231
|
+
persist: async () => false,
|
|
5232
|
+
estimate: async () => ({}),
|
|
5233
|
+
getDirectory: async () => null,
|
|
5234
|
+
};
|
|
5235
|
+
}
|
|
5236
|
+
static persisted(next, cache) {
|
|
5237
|
+
$mol_mem_persist();
|
|
5238
|
+
if (cache)
|
|
5239
|
+
return Boolean(next);
|
|
5240
|
+
const native = this.native();
|
|
5241
|
+
if (next && !$mol_mem_cached(() => this.persisted())) {
|
|
5242
|
+
this.$.$mol_wait_user_async()
|
|
5243
|
+
.then(() => native.persist())
|
|
5244
|
+
.then(actual => {
|
|
5245
|
+
setTimeout(() => this.persisted(actual, 'cache'), 5000);
|
|
5246
|
+
if (actual)
|
|
5247
|
+
this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
|
|
5248
|
+
else
|
|
5249
|
+
this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
|
|
5250
|
+
});
|
|
5251
|
+
}
|
|
5252
|
+
return next ?? $mol_wire_sync(native).persisted();
|
|
5253
|
+
}
|
|
5254
|
+
static estimate() {
|
|
5255
|
+
return $mol_wire_sync(this.native() ?? {}).estimate();
|
|
5256
|
+
}
|
|
5257
|
+
static dir() {
|
|
5258
|
+
return $mol_wire_sync(this.native()).getDirectory();
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
__decorate([
|
|
5262
|
+
$mol_mem
|
|
5263
|
+
], $mol_storage, "native", null);
|
|
5264
|
+
__decorate([
|
|
5265
|
+
$mol_mem
|
|
5266
|
+
], $mol_storage, "persisted", null);
|
|
5267
|
+
$.$mol_storage = $mol_storage;
|
|
5268
|
+
})($ || ($ = {}));
|
|
5269
|
+
|
|
5270
|
+
;
|
|
5271
|
+
"use strict";
|
|
5272
|
+
var $;
|
|
5273
|
+
(function ($) {
|
|
5274
|
+
class $mol_state_local extends $mol_object {
|
|
5275
|
+
static 'native()';
|
|
5276
|
+
static native() {
|
|
5277
|
+
if (this['native()'])
|
|
5278
|
+
return this['native()'];
|
|
5279
|
+
check: try {
|
|
5280
|
+
const native = $mol_dom_context.localStorage;
|
|
5281
|
+
if (!native)
|
|
5282
|
+
break check;
|
|
5283
|
+
native.setItem('', '');
|
|
5284
|
+
native.removeItem('');
|
|
5285
|
+
return this['native()'] = native;
|
|
5286
|
+
}
|
|
5287
|
+
catch (error) {
|
|
5288
|
+
console.warn(error);
|
|
5289
|
+
}
|
|
5290
|
+
return this['native()'] = {
|
|
5291
|
+
getItem(key) {
|
|
5292
|
+
return this[':' + key];
|
|
5293
|
+
},
|
|
5294
|
+
setItem(key, value) {
|
|
5295
|
+
this[':' + key] = value;
|
|
5296
|
+
},
|
|
5297
|
+
removeItem(key) {
|
|
5298
|
+
this[':' + key] = void 0;
|
|
5299
|
+
}
|
|
5300
|
+
};
|
|
5301
|
+
}
|
|
5302
|
+
static changes(next) { return next; }
|
|
5303
|
+
static value(key, next) {
|
|
5304
|
+
this.changes();
|
|
5305
|
+
if (next === void 0)
|
|
5306
|
+
return JSON.parse(this.native().getItem(key) || 'null');
|
|
5307
|
+
if (next === null) {
|
|
5308
|
+
this.native().removeItem(key);
|
|
5309
|
+
}
|
|
5310
|
+
else {
|
|
5311
|
+
this.native().setItem(key, JSON.stringify(next));
|
|
5312
|
+
this.$.$mol_storage.persisted(true);
|
|
5313
|
+
}
|
|
5314
|
+
return next;
|
|
5315
|
+
}
|
|
5316
|
+
prefix() { return ''; }
|
|
5317
|
+
value(key, next) {
|
|
5318
|
+
return $mol_state_local.value(this.prefix() + '.' + key, next);
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
__decorate([
|
|
5322
|
+
$mol_mem
|
|
5323
|
+
], $mol_state_local, "changes", null);
|
|
5324
|
+
__decorate([
|
|
5325
|
+
$mol_mem_key
|
|
5326
|
+
], $mol_state_local, "value", null);
|
|
5327
|
+
$.$mol_state_local = $mol_state_local;
|
|
5328
|
+
})($ || ($ = {}));
|
|
5329
|
+
|
|
5330
|
+
;
|
|
5331
|
+
"use strict";
|
|
5332
|
+
var $;
|
|
5333
|
+
(function ($) {
|
|
5334
|
+
self.addEventListener('storage', event => $.$mol_state_local.changes(event));
|
|
5335
|
+
})($ || ($ = {}));
|
|
5336
|
+
|
|
5337
|
+
;
|
|
5338
|
+
"use strict";
|
|
5339
|
+
var $;
|
|
5340
|
+
(function ($) {
|
|
5341
|
+
$.$mol_action = $mol_wire_method;
|
|
5342
|
+
})($ || ($ = {}));
|
|
5343
|
+
|
|
5538
5344
|
;
|
|
5539
5345
|
"use strict";
|
|
5540
5346
|
var $;
|