mol_jsx_lib 0.0.838 → 0.0.840
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 +196 -194
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +1448 -1443
- package/node.js.map +1 -1
- package/node.mjs +1448 -1443
- package/node.test.js +1856 -1851
- package/node.test.js.map +1 -1
- package/package.json +17 -17
- package/web.js +1 -1
- package/web.js.map +1 -1
- package/web.mjs +1 -1
package/node.mjs
CHANGED
|
@@ -51,131 +51,348 @@ var $;
|
|
|
51
51
|
"use strict";
|
|
52
52
|
var $;
|
|
53
53
|
(function ($) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
let $mol_wire_cursor;
|
|
55
|
+
(function ($mol_wire_cursor) {
|
|
56
|
+
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
57
|
+
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
58
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
59
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
60
|
+
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
58
61
|
})($ || ($ = {}));
|
|
59
62
|
|
|
60
63
|
;
|
|
61
64
|
"use strict";
|
|
62
65
|
var $;
|
|
63
66
|
(function ($) {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
class $mol_wire_pub extends Object {
|
|
68
|
+
data = [];
|
|
69
|
+
static get [Symbol.species]() {
|
|
70
|
+
return Array;
|
|
71
|
+
}
|
|
72
|
+
sub_from = 0;
|
|
73
|
+
get sub_list() {
|
|
74
|
+
const res = [];
|
|
75
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
76
|
+
res.push(this.data[i]);
|
|
77
|
+
}
|
|
78
|
+
return res;
|
|
79
|
+
}
|
|
80
|
+
get sub_empty() {
|
|
81
|
+
return this.sub_from === this.data.length;
|
|
82
|
+
}
|
|
83
|
+
sub_on(sub, pub_pos) {
|
|
84
|
+
const pos = this.data.length;
|
|
85
|
+
this.data.push(sub, pub_pos);
|
|
86
|
+
return pos;
|
|
87
|
+
}
|
|
88
|
+
sub_off(sub_pos) {
|
|
89
|
+
if (!(sub_pos < this.data.length)) {
|
|
90
|
+
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
91
|
+
}
|
|
92
|
+
const end = this.data.length - 2;
|
|
93
|
+
if (sub_pos !== end) {
|
|
94
|
+
this.peer_move(end, sub_pos);
|
|
95
|
+
}
|
|
96
|
+
this.data.pop();
|
|
97
|
+
this.data.pop();
|
|
98
|
+
if (this.data.length === this.sub_from)
|
|
99
|
+
this.reap();
|
|
100
|
+
}
|
|
101
|
+
reap() { }
|
|
102
|
+
promote() {
|
|
103
|
+
$mol_wire_auto()?.track_next(this);
|
|
104
|
+
}
|
|
105
|
+
fresh() { }
|
|
106
|
+
complete() { }
|
|
107
|
+
get incompleted() {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
111
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
112
|
+
;
|
|
113
|
+
this.data[i].absorb(quant);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
peer_move(from_pos, to_pos) {
|
|
117
|
+
const peer = this.data[from_pos];
|
|
118
|
+
const self_pos = this.data[from_pos + 1];
|
|
119
|
+
this.data[to_pos] = peer;
|
|
120
|
+
this.data[to_pos + 1] = self_pos;
|
|
121
|
+
peer.peer_repos(self_pos, to_pos);
|
|
122
|
+
}
|
|
123
|
+
peer_repos(peer_pos, self_pos) {
|
|
124
|
+
this.data[peer_pos + 1] = self_pos;
|
|
125
|
+
}
|
|
66
126
|
}
|
|
67
|
-
$.$
|
|
127
|
+
$.$mol_wire_pub = $mol_wire_pub;
|
|
68
128
|
})($ || ($ = {}));
|
|
69
129
|
|
|
70
130
|
;
|
|
71
131
|
"use strict";
|
|
72
|
-
var $;
|
|
73
|
-
(function ($) {
|
|
74
|
-
const catched = new WeakMap();
|
|
75
|
-
function $mol_fail_catch(error) {
|
|
76
|
-
if (typeof error !== 'object')
|
|
77
|
-
return false;
|
|
78
|
-
if ($mol_promise_like(error))
|
|
79
|
-
$mol_fail_hidden(error);
|
|
80
|
-
if (catched.get(error))
|
|
81
|
-
return false;
|
|
82
|
-
catched.set(error, true);
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
$.$mol_fail_catch = $mol_fail_catch;
|
|
86
|
-
})($ || ($ = {}));
|
|
87
132
|
|
|
88
133
|
;
|
|
89
134
|
"use strict";
|
|
90
135
|
var $;
|
|
91
136
|
(function ($) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!$mol_fail_catch(error))
|
|
96
|
-
return false;
|
|
97
|
-
console.error(error);
|
|
98
|
-
return true;
|
|
137
|
+
$.$mol_wire_auto_sub = null;
|
|
138
|
+
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
139
|
+
return $.$mol_wire_auto_sub = next;
|
|
99
140
|
}
|
|
100
|
-
$.$
|
|
141
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
142
|
+
$.$mol_wire_affected = [];
|
|
101
143
|
})($ || ($ = {}));
|
|
102
144
|
|
|
103
145
|
;
|
|
104
146
|
"use strict";
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (parent === dir) {
|
|
122
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
147
|
+
var $;
|
|
148
|
+
(function ($) {
|
|
149
|
+
$['devtoolsFormatters'] ||= [];
|
|
150
|
+
function $mol_dev_format_register(config) {
|
|
151
|
+
$['devtoolsFormatters'].push(config);
|
|
152
|
+
}
|
|
153
|
+
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
154
|
+
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
155
|
+
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
156
|
+
$mol_dev_format_register({
|
|
157
|
+
header: (val, config = false) => {
|
|
158
|
+
if (config)
|
|
159
|
+
return null;
|
|
160
|
+
if (!val)
|
|
161
|
+
return null;
|
|
162
|
+
if ($.$mol_dev_format_head in val) {
|
|
123
163
|
try {
|
|
124
|
-
|
|
164
|
+
return val[$.$mol_dev_format_head]();
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
125
168
|
}
|
|
126
|
-
catch { }
|
|
127
|
-
break;
|
|
128
169
|
}
|
|
129
|
-
|
|
130
|
-
|
|
170
|
+
if (typeof val === 'function') {
|
|
171
|
+
return $mol_dev_format_native(val);
|
|
172
|
+
}
|
|
173
|
+
if (Symbol.toStringTag in val) {
|
|
174
|
+
return $mol_dev_format_native(val);
|
|
131
175
|
}
|
|
132
|
-
}
|
|
133
|
-
try {
|
|
134
|
-
return target.require(name);
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
$.$mol_fail_log(error);
|
|
138
176
|
return null;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
(function ($) {
|
|
154
|
-
function $mol_log3_area_lazy(event) {
|
|
155
|
-
const self = this;
|
|
156
|
-
const stack = self.$mol_log3_stack;
|
|
157
|
-
const deep = stack.length;
|
|
158
|
-
let logged = false;
|
|
159
|
-
stack.push(() => {
|
|
160
|
-
logged = true;
|
|
161
|
-
self.$mol_log3_area.call(self, event);
|
|
162
|
-
});
|
|
163
|
-
return () => {
|
|
164
|
-
if (logged)
|
|
165
|
-
self.console.groupEnd();
|
|
166
|
-
if (stack.length > deep)
|
|
167
|
-
stack.length = deep;
|
|
168
|
-
};
|
|
177
|
+
},
|
|
178
|
+
hasBody: val => val[$.$mol_dev_format_body],
|
|
179
|
+
body: val => val[$.$mol_dev_format_body](),
|
|
180
|
+
});
|
|
181
|
+
function $mol_dev_format_native(obj) {
|
|
182
|
+
if (typeof obj === 'undefined')
|
|
183
|
+
return $.$mol_dev_format_shade('undefined');
|
|
184
|
+
return [
|
|
185
|
+
'object',
|
|
186
|
+
{
|
|
187
|
+
object: obj,
|
|
188
|
+
config: true,
|
|
189
|
+
},
|
|
190
|
+
];
|
|
169
191
|
}
|
|
170
|
-
$.$
|
|
171
|
-
|
|
192
|
+
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
193
|
+
function $mol_dev_format_auto(obj) {
|
|
194
|
+
if (obj == null)
|
|
195
|
+
return $.$mol_dev_format_shade(String(obj));
|
|
196
|
+
return [
|
|
197
|
+
'object',
|
|
198
|
+
{
|
|
199
|
+
object: obj,
|
|
200
|
+
config: false,
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
205
|
+
function $mol_dev_format_element(element, style, ...content) {
|
|
206
|
+
const styles = [];
|
|
207
|
+
for (let key in style)
|
|
208
|
+
styles.push(`${key} : ${style[key]}`);
|
|
209
|
+
return [
|
|
210
|
+
element,
|
|
211
|
+
{
|
|
212
|
+
style: styles.join(' ; '),
|
|
213
|
+
},
|
|
214
|
+
...content,
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
218
|
+
function $mol_dev_format_span(style, ...content) {
|
|
219
|
+
return $mol_dev_format_element('span', {
|
|
220
|
+
...style,
|
|
221
|
+
}, ...content);
|
|
222
|
+
}
|
|
223
|
+
$.$mol_dev_format_span = $mol_dev_format_span;
|
|
224
|
+
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
225
|
+
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
226
|
+
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
227
|
+
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
228
|
+
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
229
|
+
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
230
|
+
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
231
|
+
'color': 'magenta',
|
|
232
|
+
});
|
|
233
|
+
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
234
|
+
'font-weight': 'bold',
|
|
235
|
+
});
|
|
236
|
+
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
237
|
+
'color': 'green',
|
|
238
|
+
});
|
|
239
|
+
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
240
|
+
'color': 'gray',
|
|
241
|
+
});
|
|
242
|
+
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
243
|
+
'margin-left': '13px'
|
|
244
|
+
});
|
|
172
245
|
})($ || ($ = {}));
|
|
173
246
|
|
|
174
247
|
;
|
|
175
248
|
"use strict";
|
|
176
249
|
var $;
|
|
177
250
|
(function ($) {
|
|
178
|
-
|
|
251
|
+
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
252
|
+
pub_from = 0;
|
|
253
|
+
cursor = $mol_wire_cursor.stale;
|
|
254
|
+
get temp() {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
get pub_list() {
|
|
258
|
+
const res = [];
|
|
259
|
+
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
260
|
+
for (let i = this.pub_from; i < max; i += 2) {
|
|
261
|
+
if (this.data[i])
|
|
262
|
+
res.push(this.data[i]);
|
|
263
|
+
}
|
|
264
|
+
return res;
|
|
265
|
+
}
|
|
266
|
+
track_on() {
|
|
267
|
+
this.cursor = this.pub_from;
|
|
268
|
+
const sub = $mol_wire_auto();
|
|
269
|
+
$mol_wire_auto(this);
|
|
270
|
+
return sub;
|
|
271
|
+
}
|
|
272
|
+
promote() {
|
|
273
|
+
if (this.cursor >= this.pub_from) {
|
|
274
|
+
$mol_fail(new Error('Circular subscription'));
|
|
275
|
+
}
|
|
276
|
+
super.promote();
|
|
277
|
+
}
|
|
278
|
+
track_next(pub) {
|
|
279
|
+
if (this.cursor < 0)
|
|
280
|
+
$mol_fail(new Error('Promo to non begun sub'));
|
|
281
|
+
if (this.cursor < this.sub_from) {
|
|
282
|
+
const next = this.data[this.cursor];
|
|
283
|
+
if (pub === undefined)
|
|
284
|
+
return next ?? null;
|
|
285
|
+
if (next === pub) {
|
|
286
|
+
this.cursor += 2;
|
|
287
|
+
return next;
|
|
288
|
+
}
|
|
289
|
+
if (next) {
|
|
290
|
+
if (this.sub_from < this.data.length) {
|
|
291
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
292
|
+
}
|
|
293
|
+
this.peer_move(this.cursor, this.sub_from);
|
|
294
|
+
this.sub_from += 2;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
if (pub === undefined)
|
|
299
|
+
return null;
|
|
300
|
+
if (this.sub_from < this.data.length) {
|
|
301
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
302
|
+
}
|
|
303
|
+
this.sub_from += 2;
|
|
304
|
+
}
|
|
305
|
+
this.data[this.cursor] = pub;
|
|
306
|
+
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
307
|
+
this.cursor += 2;
|
|
308
|
+
return pub;
|
|
309
|
+
}
|
|
310
|
+
track_off(sub) {
|
|
311
|
+
$mol_wire_auto(sub);
|
|
312
|
+
if (this.cursor < 0) {
|
|
313
|
+
$mol_fail(new Error('End of non begun sub'));
|
|
314
|
+
}
|
|
315
|
+
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
316
|
+
const pub = this.data[cursor];
|
|
317
|
+
pub.fresh();
|
|
318
|
+
}
|
|
319
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
320
|
+
}
|
|
321
|
+
pub_off(sub_pos) {
|
|
322
|
+
this.data[sub_pos] = undefined;
|
|
323
|
+
this.data[sub_pos + 1] = undefined;
|
|
324
|
+
}
|
|
325
|
+
destructor() {
|
|
326
|
+
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
327
|
+
const sub = this.data[cursor];
|
|
328
|
+
const pos = this.data[cursor + 1];
|
|
329
|
+
sub.pub_off(pos);
|
|
330
|
+
this.data.pop();
|
|
331
|
+
this.data.pop();
|
|
332
|
+
}
|
|
333
|
+
this.cursor = this.pub_from;
|
|
334
|
+
this.track_cut();
|
|
335
|
+
this.cursor = $mol_wire_cursor.final;
|
|
336
|
+
}
|
|
337
|
+
track_cut() {
|
|
338
|
+
if (this.cursor < this.pub_from) {
|
|
339
|
+
$mol_fail(new Error('Cut of non begun sub'));
|
|
340
|
+
}
|
|
341
|
+
let tail = 0;
|
|
342
|
+
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
343
|
+
const pub = this.data[cursor];
|
|
344
|
+
pub?.sub_off(this.data[cursor + 1]);
|
|
345
|
+
if (this.sub_from < this.data.length) {
|
|
346
|
+
this.peer_move(this.data.length - 2, cursor);
|
|
347
|
+
this.data.pop();
|
|
348
|
+
this.data.pop();
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
++tail;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
for (; tail; --tail) {
|
|
355
|
+
this.data.pop();
|
|
356
|
+
this.data.pop();
|
|
357
|
+
}
|
|
358
|
+
this.sub_from = this.cursor;
|
|
359
|
+
}
|
|
360
|
+
complete() { }
|
|
361
|
+
complete_pubs() {
|
|
362
|
+
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
363
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
364
|
+
const pub = this.data[cursor];
|
|
365
|
+
if (pub?.incompleted)
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
369
|
+
const pub = this.data[cursor];
|
|
370
|
+
pub?.complete();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
absorb(quant = $mol_wire_cursor.stale) {
|
|
374
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
375
|
+
return;
|
|
376
|
+
if (this.cursor >= quant)
|
|
377
|
+
return;
|
|
378
|
+
this.cursor = quant;
|
|
379
|
+
this.emit($mol_wire_cursor.doubt);
|
|
380
|
+
}
|
|
381
|
+
[$mol_dev_format_head]() {
|
|
382
|
+
return $mol_dev_format_native(this);
|
|
383
|
+
}
|
|
384
|
+
get pub_empty() {
|
|
385
|
+
return this.sub_from === this.pub_from;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
389
|
+
})($ || ($ = {}));
|
|
390
|
+
|
|
391
|
+
;
|
|
392
|
+
"use strict";
|
|
393
|
+
var $;
|
|
394
|
+
(function ($) {
|
|
395
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
179
396
|
function $mol_ambient(overrides) {
|
|
180
397
|
return Object.setPrototypeOf(overrides, this || $);
|
|
181
398
|
}
|
|
@@ -275,6 +492,16 @@ var $;
|
|
|
275
492
|
$.$mol_owning_catch = $mol_owning_catch;
|
|
276
493
|
})($ || ($ = {}));
|
|
277
494
|
|
|
495
|
+
;
|
|
496
|
+
"use strict";
|
|
497
|
+
var $;
|
|
498
|
+
(function ($) {
|
|
499
|
+
function $mol_fail_hidden(error) {
|
|
500
|
+
throw error;
|
|
501
|
+
}
|
|
502
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
503
|
+
})($ || ($ = {}));
|
|
504
|
+
|
|
278
505
|
;
|
|
279
506
|
"use strict";
|
|
280
507
|
|
|
@@ -357,1358 +584,1362 @@ var $;
|
|
|
357
584
|
"use strict";
|
|
358
585
|
var $;
|
|
359
586
|
(function ($) {
|
|
360
|
-
class $
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
length;
|
|
366
|
-
constructor(uri, source, row, col, length) {
|
|
587
|
+
class $mol_after_timeout extends $mol_object2 {
|
|
588
|
+
delay;
|
|
589
|
+
task;
|
|
590
|
+
id;
|
|
591
|
+
constructor(delay, task) {
|
|
367
592
|
super();
|
|
368
|
-
this.
|
|
369
|
-
this.
|
|
370
|
-
this.
|
|
371
|
-
this.col = col;
|
|
372
|
-
this.length = length;
|
|
373
|
-
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
374
|
-
}
|
|
375
|
-
static unknown = $mol_span.begin('?');
|
|
376
|
-
static begin(uri, source = '') {
|
|
377
|
-
return new $mol_span(uri, source, 1, 1, 0);
|
|
378
|
-
}
|
|
379
|
-
static end(uri, source) {
|
|
380
|
-
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
381
|
-
}
|
|
382
|
-
static entire(uri, source) {
|
|
383
|
-
return new $mol_span(uri, source, 1, 1, source.length);
|
|
384
|
-
}
|
|
385
|
-
toString() {
|
|
386
|
-
return this[Symbol.toStringTag];
|
|
387
|
-
}
|
|
388
|
-
toJSON() {
|
|
389
|
-
return {
|
|
390
|
-
uri: this.uri,
|
|
391
|
-
row: this.row,
|
|
392
|
-
col: this.col,
|
|
393
|
-
length: this.length
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
error(message, Class = Error) {
|
|
397
|
-
return new Class(`${message} (${this})`);
|
|
398
|
-
}
|
|
399
|
-
span(row, col, length) {
|
|
400
|
-
return new $mol_span(this.uri, this.source, row, col, length);
|
|
401
|
-
}
|
|
402
|
-
after(length = 0) {
|
|
403
|
-
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
593
|
+
this.delay = delay;
|
|
594
|
+
this.task = task;
|
|
595
|
+
this.id = setTimeout(task, delay);
|
|
404
596
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (begin < 0)
|
|
408
|
-
begin += len;
|
|
409
|
-
if (end < 0)
|
|
410
|
-
end += len;
|
|
411
|
-
if (begin < 0 || begin > len)
|
|
412
|
-
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
413
|
-
if (end < 0 || end > len)
|
|
414
|
-
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
415
|
-
if (end < begin)
|
|
416
|
-
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
417
|
-
return this.span(this.row, this.col + begin, end - begin);
|
|
597
|
+
destructor() {
|
|
598
|
+
clearTimeout(this.id);
|
|
418
599
|
}
|
|
419
600
|
}
|
|
420
|
-
$.$
|
|
601
|
+
$.$mol_after_timeout = $mol_after_timeout;
|
|
421
602
|
})($ || ($ = {}));
|
|
422
603
|
|
|
423
604
|
;
|
|
424
605
|
"use strict";
|
|
425
606
|
var $;
|
|
426
607
|
(function ($) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
prefix = "\t";
|
|
433
|
-
}
|
|
434
|
-
output.push(tree.type);
|
|
435
|
-
if (tree.kids.length == 1) {
|
|
436
|
-
output.push(' ');
|
|
437
|
-
dump(tree.kids[0], prefix);
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
output.push("\n");
|
|
441
|
-
}
|
|
442
|
-
else if (tree.value.length || prefix.length) {
|
|
443
|
-
output.push("\\" + tree.value + "\n");
|
|
444
|
-
}
|
|
445
|
-
for (const kid of tree.kids) {
|
|
446
|
-
output.push(prefix);
|
|
447
|
-
dump(kid, prefix + "\t");
|
|
448
|
-
}
|
|
608
|
+
class $mol_after_frame extends $mol_after_timeout {
|
|
609
|
+
task;
|
|
610
|
+
constructor(task) {
|
|
611
|
+
super(16, task);
|
|
612
|
+
this.task = task;
|
|
449
613
|
}
|
|
450
|
-
dump(tree);
|
|
451
|
-
return output.join('');
|
|
452
614
|
}
|
|
453
|
-
$.$
|
|
615
|
+
$.$mol_after_frame = $mol_after_frame;
|
|
454
616
|
})($ || ($ = {}));
|
|
455
617
|
|
|
456
618
|
;
|
|
457
619
|
"use strict";
|
|
458
620
|
var $;
|
|
459
621
|
(function ($) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
622
|
+
function $mol_promise_like(val) {
|
|
623
|
+
return val && typeof val === 'object' && 'then' in val && typeof val.then === 'function';
|
|
624
|
+
}
|
|
625
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
626
|
+
})($ || ($ = {}));
|
|
627
|
+
|
|
628
|
+
;
|
|
629
|
+
"use strict";
|
|
630
|
+
var $;
|
|
631
|
+
(function ($) {
|
|
632
|
+
const handled = new WeakSet();
|
|
633
|
+
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
634
|
+
task;
|
|
635
|
+
host;
|
|
636
|
+
static warm = true;
|
|
637
|
+
static planning = new Set();
|
|
638
|
+
static reaping = new Set();
|
|
639
|
+
static plan_task = null;
|
|
640
|
+
static plan() {
|
|
641
|
+
if (this.plan_task)
|
|
642
|
+
return;
|
|
643
|
+
this.plan_task = new $mol_after_frame(() => {
|
|
644
|
+
try {
|
|
645
|
+
this.sync();
|
|
646
|
+
}
|
|
647
|
+
finally {
|
|
648
|
+
$mol_wire_fiber.plan_task = null;
|
|
649
|
+
}
|
|
650
|
+
});
|
|
478
651
|
}
|
|
479
|
-
static
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
652
|
+
static sync() {
|
|
653
|
+
while (this.planning.size) {
|
|
654
|
+
for (const fiber of this.planning) {
|
|
655
|
+
this.planning.delete(fiber);
|
|
656
|
+
if (fiber.cursor >= 0)
|
|
657
|
+
continue;
|
|
658
|
+
if (fiber.cursor === $mol_wire_cursor.final)
|
|
659
|
+
continue;
|
|
660
|
+
fiber.fresh();
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
while (this.reaping.size) {
|
|
664
|
+
const fibers = this.reaping;
|
|
665
|
+
this.reaping = new Set;
|
|
666
|
+
for (const fiber of fibers) {
|
|
667
|
+
if (!fiber.sub_empty)
|
|
668
|
+
continue;
|
|
669
|
+
fiber.destructor();
|
|
670
|
+
}
|
|
489
671
|
}
|
|
490
|
-
return new $mol_tree2('', value, kids, span);
|
|
491
672
|
}
|
|
492
|
-
|
|
493
|
-
|
|
673
|
+
[Symbol.toStringTag];
|
|
674
|
+
cache = undefined;
|
|
675
|
+
get args() {
|
|
676
|
+
return this.data.slice(0, this.pub_from);
|
|
494
677
|
}
|
|
495
|
-
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
678
|
+
result() {
|
|
679
|
+
if ($mol_promise_like(this.cache))
|
|
680
|
+
return;
|
|
681
|
+
if (this.cache instanceof Error)
|
|
682
|
+
return;
|
|
683
|
+
return this.cache;
|
|
500
684
|
}
|
|
501
|
-
|
|
502
|
-
return $
|
|
685
|
+
get incompleted() {
|
|
686
|
+
return $mol_promise_like(this.cache);
|
|
503
687
|
}
|
|
504
|
-
|
|
505
|
-
return
|
|
688
|
+
field() {
|
|
689
|
+
return this.task.name + '<>';
|
|
506
690
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
691
|
+
constructor(id, task, host, args) {
|
|
692
|
+
super();
|
|
693
|
+
this.task = task;
|
|
694
|
+
this.host = host;
|
|
695
|
+
if (args)
|
|
696
|
+
this.data.push(...args);
|
|
697
|
+
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
698
|
+
this[Symbol.toStringTag] = id;
|
|
515
699
|
}
|
|
516
|
-
|
|
517
|
-
|
|
700
|
+
plan() {
|
|
701
|
+
$mol_wire_fiber.planning.add(this);
|
|
702
|
+
$mol_wire_fiber.plan();
|
|
703
|
+
}
|
|
704
|
+
reap() {
|
|
705
|
+
$mol_wire_fiber.reaping.add(this);
|
|
706
|
+
$mol_wire_fiber.plan();
|
|
518
707
|
}
|
|
519
708
|
toString() {
|
|
520
|
-
return
|
|
709
|
+
return this[Symbol.toStringTag];
|
|
521
710
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
711
|
+
toJSON() {
|
|
712
|
+
return this[Symbol.toStringTag];
|
|
713
|
+
}
|
|
714
|
+
[$mol_dev_format_head]() {
|
|
715
|
+
const cursor = {
|
|
716
|
+
[$mol_wire_cursor.stale]: '🔴',
|
|
717
|
+
[$mol_wire_cursor.doubt]: '🟡',
|
|
718
|
+
[$mol_wire_cursor.fresh]: '🟢',
|
|
719
|
+
[$mol_wire_cursor.final]: '🔵',
|
|
720
|
+
}[this.cursor] ?? this.cursor.toString();
|
|
721
|
+
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
722
|
+
? $mol_dev_format_auto({
|
|
723
|
+
[$mol_dev_format_head]: () => $mol_dev_format_shade(cursor),
|
|
724
|
+
[$mol_dev_format_body]: () => $mol_dev_format_native(this),
|
|
725
|
+
})
|
|
726
|
+
: $mol_dev_format_shade($mol_dev_format_native(this), cursor), $mol_dev_format_auto(this.cache));
|
|
727
|
+
}
|
|
728
|
+
get $() {
|
|
729
|
+
return (this.host ?? this.task)['$'];
|
|
730
|
+
}
|
|
731
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
732
|
+
if (this.sub_empty)
|
|
733
|
+
this.plan();
|
|
734
|
+
else
|
|
735
|
+
super.emit(quant);
|
|
736
|
+
}
|
|
737
|
+
fresh() {
|
|
738
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
739
|
+
return;
|
|
740
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
741
|
+
return;
|
|
742
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
743
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
744
|
+
;
|
|
745
|
+
this.data[i]?.fresh();
|
|
746
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
747
|
+
break check;
|
|
536
748
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
else if (typeof type === 'number') {
|
|
540
|
-
const sub = this.kids.slice();
|
|
541
|
-
sub[type] = (sub[type] || this.list([]))
|
|
542
|
-
.insert(value, ...path.slice(1));
|
|
543
|
-
return this.clone(sub.filter(Boolean));
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
547
|
-
.map(item => item.insert(value, ...path.slice(1)))
|
|
548
|
-
.filter(Boolean);
|
|
549
|
-
return this.clone(kids);
|
|
749
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
750
|
+
return;
|
|
550
751
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
default: next.push(...item.kids);
|
|
573
|
-
}
|
|
752
|
+
const bu = this.track_on();
|
|
753
|
+
let result;
|
|
754
|
+
try {
|
|
755
|
+
switch (this.pub_from) {
|
|
756
|
+
case 0:
|
|
757
|
+
result = this.task.call(this.host);
|
|
758
|
+
break;
|
|
759
|
+
case 1:
|
|
760
|
+
result = this.task.call(this.host, this.data[0]);
|
|
761
|
+
break;
|
|
762
|
+
default:
|
|
763
|
+
result = this.task.call(this.host, ...this.args);
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
767
|
+
const put = (res) => {
|
|
768
|
+
if (this.cache === result)
|
|
769
|
+
this.put(res);
|
|
770
|
+
return res;
|
|
771
|
+
};
|
|
772
|
+
result = result.then(put, put);
|
|
574
773
|
}
|
|
575
774
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
const sub = this.kids.filter(item => {
|
|
580
|
-
var found = item.select(...path);
|
|
581
|
-
if (value === undefined) {
|
|
582
|
-
return Boolean(found.kids.length);
|
|
775
|
+
catch (error) {
|
|
776
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
777
|
+
result = error;
|
|
583
778
|
}
|
|
584
779
|
else {
|
|
585
|
-
|
|
780
|
+
result = new Error(String(error), { cause: error });
|
|
781
|
+
}
|
|
782
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
783
|
+
result = result.finally(() => {
|
|
784
|
+
if (this.cache === result)
|
|
785
|
+
this.absorb();
|
|
786
|
+
});
|
|
586
787
|
}
|
|
587
|
-
});
|
|
588
|
-
return this.clone(sub);
|
|
589
|
-
}
|
|
590
|
-
hack_self(belt, context = {}) {
|
|
591
|
-
let handle = belt[this.type] || belt[''];
|
|
592
|
-
if (!handle || handle === Object.prototype[this.type]) {
|
|
593
|
-
handle = (input, belt, context) => [
|
|
594
|
-
input.clone(input.hack(belt, context), context.span)
|
|
595
|
-
];
|
|
596
788
|
}
|
|
597
|
-
|
|
598
|
-
|
|
789
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
790
|
+
result = Object.assign(result, {
|
|
791
|
+
destructor: result['destructor'] ?? (() => { })
|
|
792
|
+
});
|
|
793
|
+
handled.add(result);
|
|
794
|
+
const error = new Error(`Promise in ${this}`);
|
|
795
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
599
796
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
$mol_fail_hidden(error);
|
|
797
|
+
if (!$mol_promise_like(result)) {
|
|
798
|
+
this.track_cut();
|
|
603
799
|
}
|
|
800
|
+
this.track_off(bu);
|
|
801
|
+
this.put(result);
|
|
604
802
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
error(message, Class = Error) {
|
|
609
|
-
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
$.$mol_tree2 = $mol_tree2;
|
|
613
|
-
class $mol_tree2_empty extends $mol_tree2 {
|
|
614
|
-
constructor() {
|
|
615
|
-
super('', '', [], $mol_span.unknown);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
619
|
-
})($ || ($ = {}));
|
|
620
|
-
|
|
621
|
-
;
|
|
622
|
-
"use strict";
|
|
623
|
-
var $;
|
|
624
|
-
(function ($) {
|
|
625
|
-
class $mol_error_syntax extends SyntaxError {
|
|
626
|
-
reason;
|
|
627
|
-
line;
|
|
628
|
-
span;
|
|
629
|
-
constructor(reason, line, span) {
|
|
630
|
-
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
631
|
-
this.reason = reason;
|
|
632
|
-
this.line = line;
|
|
633
|
-
this.span = span;
|
|
803
|
+
refresh() {
|
|
804
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
805
|
+
this.fresh();
|
|
634
806
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
;
|
|
640
|
-
"use strict";
|
|
641
|
-
var $;
|
|
642
|
-
(function ($) {
|
|
643
|
-
function $mol_tree2_from_string(str, uri = '?') {
|
|
644
|
-
const span = $mol_span.entire(uri, str);
|
|
645
|
-
var root = $mol_tree2.list([], span);
|
|
646
|
-
var stack = [root];
|
|
647
|
-
var pos = 0, row = 0, min_indent = 0;
|
|
648
|
-
while (str.length > pos) {
|
|
649
|
-
var indent = 0;
|
|
650
|
-
var line_start = pos;
|
|
651
|
-
row++;
|
|
652
|
-
while (str.length > pos && str[pos] == '\t') {
|
|
653
|
-
indent++;
|
|
654
|
-
pos++;
|
|
807
|
+
sync() {
|
|
808
|
+
if (!$mol_wire_fiber.warm) {
|
|
809
|
+
return this.result();
|
|
655
810
|
}
|
|
656
|
-
|
|
657
|
-
|
|
811
|
+
this.promote();
|
|
812
|
+
this.fresh();
|
|
813
|
+
if (this.cache instanceof Error) {
|
|
814
|
+
return $mol_fail_hidden(this.cache);
|
|
658
815
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
const sp = span.span(row, 1, pos - line_start);
|
|
662
|
-
while (str.length > pos && str[pos] != '\n') {
|
|
663
|
-
pos++;
|
|
664
|
-
}
|
|
665
|
-
if (indent < 0) {
|
|
666
|
-
if (str.length > pos) {
|
|
667
|
-
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
else {
|
|
671
|
-
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
672
|
-
}
|
|
816
|
+
if ($mol_promise_like(this.cache)) {
|
|
817
|
+
return $mol_fail_hidden(this.cache);
|
|
673
818
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
if (pos > error_start) {
|
|
682
|
-
let line_end = str.indexOf('\n', pos);
|
|
683
|
-
if (line_end === -1)
|
|
684
|
-
line_end = str.length;
|
|
685
|
-
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
686
|
-
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
687
|
-
}
|
|
688
|
-
var type_start = pos;
|
|
689
|
-
while (str.length > pos &&
|
|
690
|
-
str[pos] != '\\' &&
|
|
691
|
-
str[pos] != ' ' &&
|
|
692
|
-
str[pos] != '\t' &&
|
|
693
|
-
str[pos] != '\n') {
|
|
694
|
-
pos++;
|
|
695
|
-
}
|
|
696
|
-
if (pos > type_start) {
|
|
697
|
-
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
698
|
-
const parent_kids = parent.kids;
|
|
699
|
-
parent_kids.push(next);
|
|
700
|
-
parent = next;
|
|
701
|
-
}
|
|
702
|
-
if (str.length > pos && str[pos] == ' ') {
|
|
703
|
-
pos++;
|
|
819
|
+
return this.cache;
|
|
820
|
+
}
|
|
821
|
+
async async() {
|
|
822
|
+
while (true) {
|
|
823
|
+
this.fresh();
|
|
824
|
+
if (this.cache instanceof Error) {
|
|
825
|
+
$mol_fail_hidden(this.cache);
|
|
704
826
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
827
|
+
if (!$mol_promise_like(this.cache))
|
|
828
|
+
return this.cache;
|
|
829
|
+
await Promise.race([this.cache, this.step()]);
|
|
830
|
+
if (!$mol_promise_like(this.cache))
|
|
831
|
+
return this.cache;
|
|
832
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
833
|
+
await new Promise(() => { });
|
|
710
834
|
}
|
|
711
|
-
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
712
|
-
const parent_kids = parent.kids;
|
|
713
|
-
parent_kids.push(next);
|
|
714
|
-
parent = next;
|
|
715
|
-
}
|
|
716
|
-
if (str.length === pos && stack.length > 0) {
|
|
717
|
-
const sp = span.span(row, pos - line_start + 1, 1);
|
|
718
|
-
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
719
835
|
}
|
|
720
|
-
stack.push(parent);
|
|
721
|
-
pos++;
|
|
722
836
|
}
|
|
723
|
-
|
|
837
|
+
step() {
|
|
838
|
+
return new Promise(done => {
|
|
839
|
+
const sub = new $mol_wire_pub_sub;
|
|
840
|
+
const prev = sub.track_on();
|
|
841
|
+
sub.track_next(this);
|
|
842
|
+
sub.track_off(prev);
|
|
843
|
+
sub.absorb = () => {
|
|
844
|
+
done(null);
|
|
845
|
+
sub.destructor();
|
|
846
|
+
};
|
|
847
|
+
});
|
|
848
|
+
}
|
|
724
849
|
}
|
|
725
|
-
$.$
|
|
850
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
726
851
|
})($ || ($ = {}));
|
|
727
852
|
|
|
728
853
|
;
|
|
729
854
|
"use strict";
|
|
730
855
|
var $;
|
|
731
856
|
(function ($) {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
857
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
858
|
+
function $mol_compare_deep(left, right) {
|
|
859
|
+
if (Object.is(left, right))
|
|
860
|
+
return true;
|
|
861
|
+
if (left === null)
|
|
862
|
+
return false;
|
|
863
|
+
if (right === null)
|
|
864
|
+
return false;
|
|
865
|
+
if (typeof left !== 'object')
|
|
866
|
+
return false;
|
|
867
|
+
if (typeof right !== 'object')
|
|
868
|
+
return false;
|
|
869
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
870
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
871
|
+
if (left_proto !== right_proto)
|
|
872
|
+
return false;
|
|
873
|
+
if (left instanceof Boolean)
|
|
874
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
875
|
+
if (left instanceof Number)
|
|
876
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
877
|
+
if (left instanceof String)
|
|
878
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
879
|
+
if (left instanceof Date)
|
|
880
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
881
|
+
if (left instanceof RegExp)
|
|
882
|
+
return left.source === right.source && left.flags === right.flags;
|
|
883
|
+
if (left instanceof Error)
|
|
884
|
+
return left.message === right.message && left.stack === right.stack;
|
|
885
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
886
|
+
if (left_cache) {
|
|
887
|
+
const right_cache = left_cache.get(right);
|
|
888
|
+
if (typeof right_cache === 'boolean')
|
|
889
|
+
return right_cache;
|
|
735
890
|
}
|
|
736
|
-
|
|
737
|
-
|
|
891
|
+
else {
|
|
892
|
+
left_cache = new WeakMap([[right, true]]);
|
|
893
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
738
894
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
895
|
+
let result;
|
|
896
|
+
try {
|
|
897
|
+
if (!left_proto)
|
|
898
|
+
result = compare_pojo(left, right);
|
|
899
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
900
|
+
result = compare_pojo(left, right);
|
|
901
|
+
else if (Symbol.toPrimitive in left)
|
|
902
|
+
result = compare_primitive(left, right);
|
|
903
|
+
else if (Array.isArray(left))
|
|
904
|
+
result = compare_array(left, right);
|
|
905
|
+
else if (left instanceof Set)
|
|
906
|
+
result = compare_set(left, right);
|
|
907
|
+
else if (left instanceof Map)
|
|
908
|
+
result = compare_map(left, right);
|
|
909
|
+
else if (ArrayBuffer.isView(left))
|
|
910
|
+
result = compare_buffer(left, right);
|
|
911
|
+
else if (Symbol.iterator in left)
|
|
912
|
+
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
913
|
+
else
|
|
914
|
+
result = false;
|
|
742
915
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
916
|
+
finally {
|
|
917
|
+
left_cache.set(right, result);
|
|
746
918
|
}
|
|
747
|
-
|
|
748
|
-
|
|
919
|
+
return result;
|
|
920
|
+
}
|
|
921
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
922
|
+
function compare_array(left, right) {
|
|
923
|
+
const len = left.length;
|
|
924
|
+
if (len !== right.length)
|
|
925
|
+
return false;
|
|
926
|
+
for (let i = 0; i < len; ++i) {
|
|
927
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
928
|
+
return false;
|
|
749
929
|
}
|
|
750
|
-
|
|
751
|
-
|
|
930
|
+
return true;
|
|
931
|
+
}
|
|
932
|
+
function compare_buffer(left, right) {
|
|
933
|
+
const len = left.byteLength;
|
|
934
|
+
if (len !== right.byteLength)
|
|
935
|
+
return false;
|
|
936
|
+
if (left instanceof DataView)
|
|
937
|
+
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
|
|
938
|
+
for (let i = 0; i < len; ++i) {
|
|
939
|
+
if (left[i] !== right[i])
|
|
940
|
+
return false;
|
|
752
941
|
}
|
|
753
|
-
|
|
754
|
-
|
|
942
|
+
return true;
|
|
943
|
+
}
|
|
944
|
+
function compare_iterator(left, right) {
|
|
945
|
+
while (true) {
|
|
946
|
+
const left_next = left.next();
|
|
947
|
+
const right_next = right.next();
|
|
948
|
+
if (left_next.done !== right_next.done)
|
|
949
|
+
return false;
|
|
950
|
+
if (left_next.done)
|
|
951
|
+
break;
|
|
952
|
+
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
953
|
+
return false;
|
|
755
954
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
955
|
+
return true;
|
|
956
|
+
}
|
|
957
|
+
function compare_set(left, right) {
|
|
958
|
+
if (left.size !== right.size)
|
|
959
|
+
return false;
|
|
960
|
+
return compare_iterator(left.values(), right.values());
|
|
961
|
+
}
|
|
962
|
+
function compare_map(left, right) {
|
|
963
|
+
if (left.size !== right.size)
|
|
964
|
+
return false;
|
|
965
|
+
return compare_iterator(left.keys(), right.keys())
|
|
966
|
+
&& compare_iterator(left.values(), right.values());
|
|
967
|
+
}
|
|
968
|
+
function compare_pojo(left, right) {
|
|
969
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
970
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
971
|
+
if (!compare_array(left_keys, right_keys))
|
|
972
|
+
return false;
|
|
973
|
+
for (let key of left_keys) {
|
|
974
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
975
|
+
return false;
|
|
759
976
|
}
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
768
|
-
}
|
|
769
|
-
else {
|
|
770
|
-
sub.push($mol_tree2.data(key, [subsub], span));
|
|
771
|
-
}
|
|
977
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
978
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
979
|
+
if (!compare_array(left_syms, right_syms))
|
|
980
|
+
return false;
|
|
981
|
+
for (let key of left_syms) {
|
|
982
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
983
|
+
return false;
|
|
772
984
|
}
|
|
773
|
-
return
|
|
985
|
+
return true;
|
|
774
986
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
;
|
|
779
|
-
"use strict";
|
|
780
|
-
var $;
|
|
781
|
-
(function ($) {
|
|
782
|
-
class $mol_term_color {
|
|
783
|
-
static reset = this.ansi(0, 0);
|
|
784
|
-
static bold = this.ansi(1, 22);
|
|
785
|
-
static italic = this.ansi(3, 23);
|
|
786
|
-
static underline = this.ansi(4, 24);
|
|
787
|
-
static inverse = this.ansi(7, 27);
|
|
788
|
-
static hidden = this.ansi(8, 28);
|
|
789
|
-
static strike = this.ansi(9, 29);
|
|
790
|
-
static gray = this.ansi(90, 39);
|
|
791
|
-
static red = this.ansi(91, 39);
|
|
792
|
-
static green = this.ansi(92, 39);
|
|
793
|
-
static yellow = this.ansi(93, 39);
|
|
794
|
-
static blue = this.ansi(94, 39);
|
|
795
|
-
static magenta = this.ansi(95, 39);
|
|
796
|
-
static cyan = this.ansi(96, 39);
|
|
797
|
-
static Gray = (str) => this.inverse(this.gray(str));
|
|
798
|
-
static Red = (str) => this.inverse(this.red(str));
|
|
799
|
-
static Green = (str) => this.inverse(this.green(str));
|
|
800
|
-
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
801
|
-
static Blue = (str) => this.inverse(this.blue(str));
|
|
802
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
803
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
804
|
-
static ansi(open, close) {
|
|
805
|
-
if (typeof process === 'undefined')
|
|
806
|
-
return String;
|
|
807
|
-
if (!process.stdout.isTTY)
|
|
808
|
-
return String;
|
|
809
|
-
const prefix = `\x1b[${open}m`;
|
|
810
|
-
const postfix = `\x1b[${close}m`;
|
|
811
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
812
|
-
return function colorer(str) {
|
|
813
|
-
str = String(str);
|
|
814
|
-
if (str === '')
|
|
815
|
-
return str;
|
|
816
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
817
|
-
return prefix + suffix + postfix;
|
|
818
|
-
};
|
|
819
|
-
}
|
|
987
|
+
function compare_primitive(left, right) {
|
|
988
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
820
989
|
}
|
|
821
|
-
$.$mol_term_color = $mol_term_color;
|
|
822
990
|
})($ || ($ = {}));
|
|
823
991
|
|
|
824
992
|
;
|
|
825
993
|
"use strict";
|
|
826
994
|
var $;
|
|
827
995
|
(function ($) {
|
|
828
|
-
function $
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
996
|
+
function $mol_log3_area_lazy(event) {
|
|
997
|
+
const self = this;
|
|
998
|
+
const stack = self.$mol_log3_stack;
|
|
999
|
+
const deep = stack.length;
|
|
1000
|
+
let logged = false;
|
|
1001
|
+
stack.push(() => {
|
|
1002
|
+
logged = true;
|
|
1003
|
+
self.$mol_log3_area.call(self, event);
|
|
1004
|
+
});
|
|
1005
|
+
return () => {
|
|
1006
|
+
if (logged)
|
|
1007
|
+
self.console.groupEnd();
|
|
1008
|
+
if (stack.length > deep)
|
|
1009
|
+
stack.length = deep;
|
|
838
1010
|
};
|
|
839
1011
|
}
|
|
840
|
-
$.$
|
|
841
|
-
$.$
|
|
842
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
843
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
844
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
845
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
846
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1012
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1013
|
+
$.$mol_log3_stack = [];
|
|
847
1014
|
})($ || ($ = {}));
|
|
848
1015
|
|
|
849
1016
|
;
|
|
850
1017
|
"use strict";
|
|
851
1018
|
var $;
|
|
852
1019
|
(function ($) {
|
|
853
|
-
|
|
854
|
-
|
|
1020
|
+
class $mol_span extends $mol_object2 {
|
|
1021
|
+
uri;
|
|
1022
|
+
source;
|
|
1023
|
+
row;
|
|
1024
|
+
col;
|
|
1025
|
+
length;
|
|
1026
|
+
constructor(uri, source, row, col, length) {
|
|
1027
|
+
super();
|
|
1028
|
+
this.uri = uri;
|
|
1029
|
+
this.source = source;
|
|
1030
|
+
this.row = row;
|
|
1031
|
+
this.col = col;
|
|
1032
|
+
this.length = length;
|
|
1033
|
+
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
1034
|
+
}
|
|
1035
|
+
static unknown = $mol_span.begin('?');
|
|
1036
|
+
static begin(uri, source = '') {
|
|
1037
|
+
return new $mol_span(uri, source, 1, 1, 0);
|
|
1038
|
+
}
|
|
1039
|
+
static end(uri, source) {
|
|
1040
|
+
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1041
|
+
}
|
|
1042
|
+
static entire(uri, source) {
|
|
1043
|
+
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1044
|
+
}
|
|
1045
|
+
toString() {
|
|
1046
|
+
return this[Symbol.toStringTag];
|
|
1047
|
+
}
|
|
1048
|
+
toJSON() {
|
|
1049
|
+
return {
|
|
1050
|
+
uri: this.uri,
|
|
1051
|
+
row: this.row,
|
|
1052
|
+
col: this.col,
|
|
1053
|
+
length: this.length
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
error(message, Class = Error) {
|
|
1057
|
+
return new Class(`${message} (${this})`);
|
|
1058
|
+
}
|
|
1059
|
+
span(row, col, length) {
|
|
1060
|
+
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1061
|
+
}
|
|
1062
|
+
after(length = 0) {
|
|
1063
|
+
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
1064
|
+
}
|
|
1065
|
+
slice(begin, end = -1) {
|
|
1066
|
+
let len = this.length;
|
|
1067
|
+
if (begin < 0)
|
|
1068
|
+
begin += len;
|
|
1069
|
+
if (end < 0)
|
|
1070
|
+
end += len;
|
|
1071
|
+
if (begin < 0 || begin > len)
|
|
1072
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1073
|
+
if (end < 0 || end > len)
|
|
1074
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1075
|
+
if (end < begin)
|
|
1076
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1077
|
+
return this.span(this.row, this.col + begin, end - begin);
|
|
1078
|
+
}
|
|
855
1079
|
}
|
|
856
|
-
$.$
|
|
1080
|
+
$.$mol_span = $mol_span;
|
|
857
1081
|
})($ || ($ = {}));
|
|
858
1082
|
|
|
859
1083
|
;
|
|
860
1084
|
"use strict";
|
|
861
1085
|
var $;
|
|
862
1086
|
(function ($) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1087
|
+
function $mol_tree2_to_string(tree) {
|
|
1088
|
+
let output = [];
|
|
1089
|
+
function dump(tree, prefix = '') {
|
|
1090
|
+
if (tree.type.length) {
|
|
1091
|
+
if (!prefix.length) {
|
|
1092
|
+
prefix = "\t";
|
|
1093
|
+
}
|
|
1094
|
+
output.push(tree.type);
|
|
1095
|
+
if (tree.kids.length == 1) {
|
|
1096
|
+
output.push(' ');
|
|
1097
|
+
dump(tree.kids[0], prefix);
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
output.push("\n");
|
|
1101
|
+
}
|
|
1102
|
+
else if (tree.value.length || prefix.length) {
|
|
1103
|
+
output.push("\\" + tree.value + "\n");
|
|
1104
|
+
}
|
|
1105
|
+
for (const kid of tree.kids) {
|
|
1106
|
+
output.push(prefix);
|
|
1107
|
+
dump(kid, prefix + "\t");
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
dump(tree);
|
|
1111
|
+
return output.join('');
|
|
1112
|
+
}
|
|
1113
|
+
$.$mol_tree2_to_string = $mol_tree2_to_string;
|
|
866
1114
|
})($ || ($ = {}));
|
|
867
1115
|
|
|
868
1116
|
;
|
|
869
1117
|
"use strict";
|
|
870
1118
|
var $;
|
|
871
1119
|
(function ($) {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
env: this.$mol_env(),
|
|
885
|
-
});
|
|
886
|
-
if (res.status || res.error) {
|
|
887
|
-
return $mol_fail(res.error || new Error(res.stderr.toString(), { cause: res.stdout }));
|
|
1120
|
+
class $mol_tree2 extends Object {
|
|
1121
|
+
type;
|
|
1122
|
+
value;
|
|
1123
|
+
kids;
|
|
1124
|
+
span;
|
|
1125
|
+
constructor(type, value, kids, span) {
|
|
1126
|
+
super();
|
|
1127
|
+
this.type = type;
|
|
1128
|
+
this.value = value;
|
|
1129
|
+
this.kids = kids;
|
|
1130
|
+
this.span = span;
|
|
1131
|
+
this[Symbol.toStringTag] = type || '\\' + value;
|
|
888
1132
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
;
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
;
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
(
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1133
|
+
static list(kids, span = $mol_span.unknown) {
|
|
1134
|
+
return new $mol_tree2('', '', kids, span);
|
|
1135
|
+
}
|
|
1136
|
+
list(kids) {
|
|
1137
|
+
return $mol_tree2.list(kids, this.span);
|
|
1138
|
+
}
|
|
1139
|
+
static data(value, kids = [], span = $mol_span.unknown) {
|
|
1140
|
+
const chunks = value.split('\n');
|
|
1141
|
+
if (chunks.length > 1) {
|
|
1142
|
+
let kid_span = span.span(span.row, span.col, 0);
|
|
1143
|
+
const data = chunks.map(chunk => {
|
|
1144
|
+
kid_span = kid_span.after(chunk.length);
|
|
1145
|
+
return new $mol_tree2('', chunk, [], kid_span);
|
|
1146
|
+
});
|
|
1147
|
+
kids = [...data, ...kids];
|
|
1148
|
+
value = '';
|
|
1149
|
+
}
|
|
1150
|
+
return new $mol_tree2('', value, kids, span);
|
|
1151
|
+
}
|
|
1152
|
+
data(value, kids = []) {
|
|
1153
|
+
return $mol_tree2.data(value, kids, this.span);
|
|
1154
|
+
}
|
|
1155
|
+
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1156
|
+
if (/[ \n\t\\]/.test(type)) {
|
|
1157
|
+
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1158
|
+
}
|
|
1159
|
+
return new $mol_tree2(type, '', kids, span);
|
|
1160
|
+
}
|
|
1161
|
+
struct(type, kids = []) {
|
|
1162
|
+
return $mol_tree2.struct(type, kids, this.span);
|
|
1163
|
+
}
|
|
1164
|
+
clone(kids, span = this.span) {
|
|
1165
|
+
return new $mol_tree2(this.type, this.value, kids, span);
|
|
1166
|
+
}
|
|
1167
|
+
text() {
|
|
1168
|
+
var values = [];
|
|
1169
|
+
for (var kid of this.kids) {
|
|
1170
|
+
if (kid.type)
|
|
1171
|
+
continue;
|
|
1172
|
+
values.push(kid.value);
|
|
1173
|
+
}
|
|
1174
|
+
return this.value + values.join('\n');
|
|
1175
|
+
}
|
|
1176
|
+
static fromString(str, uri = 'unknown') {
|
|
1177
|
+
return $$.$mol_tree2_from_string(str, uri);
|
|
1178
|
+
}
|
|
1179
|
+
toString() {
|
|
1180
|
+
return $$.$mol_tree2_to_string(this);
|
|
1181
|
+
}
|
|
1182
|
+
insert(value, ...path) {
|
|
1183
|
+
if (path.length === 0)
|
|
1184
|
+
return value;
|
|
1185
|
+
const type = path[0];
|
|
1186
|
+
if (typeof type === 'string') {
|
|
1187
|
+
let replaced = false;
|
|
1188
|
+
const sub = this.kids.map((item, index) => {
|
|
1189
|
+
if (item.type !== type)
|
|
1190
|
+
return item;
|
|
1191
|
+
replaced = true;
|
|
1192
|
+
return item.insert(value, ...path.slice(1));
|
|
1193
|
+
}).filter(Boolean);
|
|
1194
|
+
if (!replaced && value) {
|
|
1195
|
+
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
1196
|
+
}
|
|
1197
|
+
return this.clone(sub);
|
|
1198
|
+
}
|
|
1199
|
+
else if (typeof type === 'number') {
|
|
1200
|
+
const sub = this.kids.slice();
|
|
1201
|
+
sub[type] = (sub[type] || this.list([]))
|
|
1202
|
+
.insert(value, ...path.slice(1));
|
|
1203
|
+
return this.clone(sub.filter(Boolean));
|
|
1204
|
+
}
|
|
1205
|
+
else {
|
|
1206
|
+
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
1207
|
+
.map(item => item.insert(value, ...path.slice(1)))
|
|
1208
|
+
.filter(Boolean);
|
|
1209
|
+
return this.clone(kids);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
select(...path) {
|
|
1213
|
+
let next = [this];
|
|
1214
|
+
for (const type of path) {
|
|
1215
|
+
if (!next.length)
|
|
1216
|
+
break;
|
|
1217
|
+
const prev = next;
|
|
1218
|
+
next = [];
|
|
1219
|
+
for (var item of prev) {
|
|
1220
|
+
switch (typeof (type)) {
|
|
1221
|
+
case 'string':
|
|
1222
|
+
for (var child of item.kids) {
|
|
1223
|
+
if (child.type == type) {
|
|
1224
|
+
next.push(child);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
926
1227
|
break;
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}
|
|
1228
|
+
case 'number':
|
|
1229
|
+
if (type < item.kids.length)
|
|
1230
|
+
next.push(item.kids[type]);
|
|
1231
|
+
break;
|
|
1232
|
+
default: next.push(...item.kids);
|
|
933
1233
|
}
|
|
934
1234
|
}
|
|
935
1235
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1236
|
+
return this.list(next);
|
|
1237
|
+
}
|
|
1238
|
+
filter(path, value) {
|
|
1239
|
+
const sub = this.kids.filter(item => {
|
|
1240
|
+
var found = item.select(...path);
|
|
1241
|
+
if (value === undefined) {
|
|
1242
|
+
return Boolean(found.kids.length);
|
|
942
1243
|
}
|
|
943
1244
|
else {
|
|
944
|
-
|
|
945
|
-
el.insertBefore(textNode, nextNode);
|
|
1245
|
+
return found.kids.some(child => child.value == value);
|
|
946
1246
|
}
|
|
1247
|
+
});
|
|
1248
|
+
return this.clone(sub);
|
|
1249
|
+
}
|
|
1250
|
+
hack_self(belt, context = {}) {
|
|
1251
|
+
let handle = belt[this.type] || belt[''];
|
|
1252
|
+
if (!handle || handle === Object.prototype[this.type]) {
|
|
1253
|
+
handle = (input, belt, context) => [
|
|
1254
|
+
input.clone(input.hack(belt, context), context.span)
|
|
1255
|
+
];
|
|
1256
|
+
}
|
|
1257
|
+
try {
|
|
1258
|
+
return handle(this, belt, context);
|
|
1259
|
+
}
|
|
1260
|
+
catch (error) {
|
|
1261
|
+
error.message += `\n${this.clone([])}${this.span}`;
|
|
1262
|
+
$mol_fail_hidden(error);
|
|
947
1263
|
}
|
|
948
1264
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1265
|
+
hack(belt, context = {}) {
|
|
1266
|
+
return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
|
|
1267
|
+
}
|
|
1268
|
+
error(message, Class = Error) {
|
|
1269
|
+
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
953
1270
|
}
|
|
954
1271
|
}
|
|
955
|
-
$.$
|
|
1272
|
+
$.$mol_tree2 = $mol_tree2;
|
|
1273
|
+
class $mol_tree2_empty extends $mol_tree2 {
|
|
1274
|
+
constructor() {
|
|
1275
|
+
super('', '', [], $mol_span.unknown);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
956
1279
|
})($ || ($ = {}));
|
|
957
1280
|
|
|
958
1281
|
;
|
|
959
1282
|
"use strict";
|
|
1283
|
+
var $;
|
|
1284
|
+
(function ($) {
|
|
1285
|
+
class $mol_error_syntax extends SyntaxError {
|
|
1286
|
+
reason;
|
|
1287
|
+
line;
|
|
1288
|
+
span;
|
|
1289
|
+
constructor(reason, line, span) {
|
|
1290
|
+
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
1291
|
+
this.reason = reason;
|
|
1292
|
+
this.line = line;
|
|
1293
|
+
this.span = span;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
$.$mol_error_syntax = $mol_error_syntax;
|
|
1297
|
+
})($ || ($ = {}));
|
|
960
1298
|
|
|
961
1299
|
;
|
|
962
1300
|
"use strict";
|
|
963
1301
|
var $;
|
|
964
1302
|
(function ($) {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
978
|
-
if (Elem && $.$mol_jsx_booked) {
|
|
979
|
-
if ($.$mol_jsx_booked.has(id)) {
|
|
980
|
-
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
1303
|
+
function $mol_tree2_from_string(str, uri = '?') {
|
|
1304
|
+
const span = $mol_span.entire(uri, str);
|
|
1305
|
+
var root = $mol_tree2.list([], span);
|
|
1306
|
+
var stack = [root];
|
|
1307
|
+
var pos = 0, row = 0, min_indent = 0;
|
|
1308
|
+
while (str.length > pos) {
|
|
1309
|
+
var indent = 0;
|
|
1310
|
+
var line_start = pos;
|
|
1311
|
+
row++;
|
|
1312
|
+
while (str.length > pos && str[pos] == '\t') {
|
|
1313
|
+
indent++;
|
|
1314
|
+
pos++;
|
|
981
1315
|
}
|
|
982
|
-
|
|
983
|
-
|
|
1316
|
+
if (!root.kids.length) {
|
|
1317
|
+
min_indent = indent;
|
|
984
1318
|
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
continue;
|
|
995
|
-
const wrapper = function (...args) {
|
|
996
|
-
const prefix = $.$mol_jsx_prefix;
|
|
997
|
-
const booked = $.$mol_jsx_booked;
|
|
998
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
999
|
-
try {
|
|
1000
|
-
$.$mol_jsx_prefix = prefix_ext;
|
|
1001
|
-
$.$mol_jsx_booked = booked_ext;
|
|
1002
|
-
$.$mol_jsx_crumbs = crumbs_ext;
|
|
1003
|
-
return func.call(this, ...args);
|
|
1004
|
-
}
|
|
1005
|
-
finally {
|
|
1006
|
-
$.$mol_jsx_prefix = prefix;
|
|
1007
|
-
$.$mol_jsx_booked = booked;
|
|
1008
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
1319
|
+
indent -= min_indent;
|
|
1320
|
+
if (indent < 0 || indent >= stack.length) {
|
|
1321
|
+
const sp = span.span(row, 1, pos - line_start);
|
|
1322
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1323
|
+
pos++;
|
|
1324
|
+
}
|
|
1325
|
+
if (indent < 0) {
|
|
1326
|
+
if (str.length > pos) {
|
|
1327
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
1009
1328
|
}
|
|
1010
|
-
};
|
|
1011
|
-
$mol_func_name_from(wrapper, func);
|
|
1012
|
-
props[field] = wrapper;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
if (typeof Elem !== 'string') {
|
|
1016
|
-
if ('prototype' in Elem) {
|
|
1017
|
-
const view = node && node[String(Elem)] || new Elem;
|
|
1018
|
-
Object.assign(view, props);
|
|
1019
|
-
view[Symbol.toStringTag] = guid;
|
|
1020
|
-
view.childNodes = childNodes;
|
|
1021
|
-
if (!view.ownerDocument)
|
|
1022
|
-
view.ownerDocument = $.$mol_jsx_document;
|
|
1023
|
-
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1024
|
-
node = view.valueOf();
|
|
1025
|
-
node[String(Elem)] = view;
|
|
1026
|
-
return node;
|
|
1027
|
-
}
|
|
1028
|
-
else {
|
|
1029
|
-
const prefix = $.$mol_jsx_prefix;
|
|
1030
|
-
const booked = $.$mol_jsx_booked;
|
|
1031
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
1032
|
-
try {
|
|
1033
|
-
$.$mol_jsx_prefix = guid;
|
|
1034
|
-
$.$mol_jsx_booked = new Set;
|
|
1035
|
-
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1036
|
-
return Elem(props, ...childNodes);
|
|
1037
1329
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
$.$mol_jsx_booked = booked;
|
|
1041
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
1330
|
+
else {
|
|
1331
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
1042
1332
|
}
|
|
1043
1333
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1334
|
+
stack.length = indent + 1;
|
|
1335
|
+
var parent = stack[indent];
|
|
1336
|
+
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1337
|
+
var error_start = pos;
|
|
1338
|
+
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1339
|
+
pos++;
|
|
1340
|
+
}
|
|
1341
|
+
if (pos > error_start) {
|
|
1342
|
+
let line_end = str.indexOf('\n', pos);
|
|
1343
|
+
if (line_end === -1)
|
|
1344
|
+
line_end = str.length;
|
|
1345
|
+
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1346
|
+
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1347
|
+
}
|
|
1348
|
+
var type_start = pos;
|
|
1349
|
+
while (str.length > pos &&
|
|
1350
|
+
str[pos] != '\\' &&
|
|
1351
|
+
str[pos] != ' ' &&
|
|
1352
|
+
str[pos] != '\t' &&
|
|
1353
|
+
str[pos] != '\n') {
|
|
1354
|
+
pos++;
|
|
1355
|
+
}
|
|
1356
|
+
if (pos > type_start) {
|
|
1357
|
+
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
1358
|
+
const parent_kids = parent.kids;
|
|
1359
|
+
parent_kids.push(next);
|
|
1360
|
+
parent = next;
|
|
1361
|
+
}
|
|
1362
|
+
if (str.length > pos && str[pos] == ' ') {
|
|
1363
|
+
pos++;
|
|
1364
|
+
}
|
|
1062
1365
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
Object.assign(node[key], props[key]);
|
|
1068
|
-
continue;
|
|
1366
|
+
if (str.length > pos && str[pos] == '\\') {
|
|
1367
|
+
var data_start = pos;
|
|
1368
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1369
|
+
pos++;
|
|
1069
1370
|
}
|
|
1371
|
+
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
1372
|
+
const parent_kids = parent.kids;
|
|
1373
|
+
parent_kids.push(next);
|
|
1374
|
+
parent = next;
|
|
1070
1375
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1376
|
+
if (str.length === pos && stack.length > 0) {
|
|
1377
|
+
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1378
|
+
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
1073
1379
|
}
|
|
1380
|
+
stack.push(parent);
|
|
1381
|
+
pos++;
|
|
1074
1382
|
}
|
|
1075
|
-
|
|
1076
|
-
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
1077
|
-
return node;
|
|
1383
|
+
return root;
|
|
1078
1384
|
}
|
|
1079
|
-
$.$
|
|
1385
|
+
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
1080
1386
|
})($ || ($ = {}));
|
|
1081
1387
|
|
|
1082
1388
|
;
|
|
1083
1389
|
"use strict";
|
|
1084
1390
|
var $;
|
|
1085
1391
|
(function ($) {
|
|
1086
|
-
function $
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
$mol_jsx_document = next;
|
|
1090
|
-
return action();
|
|
1091
|
-
}
|
|
1092
|
-
finally {
|
|
1093
|
-
$mol_jsx_document = prev;
|
|
1392
|
+
function $mol_tree2_from_json(json, span = $mol_span.unknown) {
|
|
1393
|
+
if (typeof json === 'boolean' || typeof json === 'number' || json === null) {
|
|
1394
|
+
return new $mol_tree2(String(json), '', [], span);
|
|
1094
1395
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
})($ || ($ = {}));
|
|
1098
|
-
|
|
1099
|
-
;
|
|
1100
|
-
"use strict";
|
|
1101
|
-
var $;
|
|
1102
|
-
(function ($) {
|
|
1103
|
-
let $mol_wire_cursor;
|
|
1104
|
-
(function ($mol_wire_cursor) {
|
|
1105
|
-
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
1106
|
-
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
1107
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
1108
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
1109
|
-
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
1110
|
-
})($ || ($ = {}));
|
|
1111
|
-
|
|
1112
|
-
;
|
|
1113
|
-
"use strict";
|
|
1114
|
-
var $;
|
|
1115
|
-
(function ($) {
|
|
1116
|
-
class $mol_wire_pub extends Object {
|
|
1117
|
-
data = [];
|
|
1118
|
-
static get [Symbol.species]() {
|
|
1119
|
-
return Array;
|
|
1396
|
+
if (typeof json === 'string') {
|
|
1397
|
+
return $mol_tree2.data(json, [], span);
|
|
1120
1398
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
1125
|
-
res.push(this.data[i]);
|
|
1126
|
-
}
|
|
1127
|
-
return res;
|
|
1399
|
+
if (Array.isArray(json)) {
|
|
1400
|
+
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
1401
|
+
return new $mol_tree2('/', '', sub, span);
|
|
1128
1402
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1403
|
+
if (ArrayBuffer.isView(json)) {
|
|
1404
|
+
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1405
|
+
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
1131
1406
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
this.data.push(sub, pub_pos);
|
|
1135
|
-
return pos;
|
|
1407
|
+
if (json instanceof Date) {
|
|
1408
|
+
return new $mol_tree2('', json.toISOString(), [], span);
|
|
1136
1409
|
}
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
1140
|
-
}
|
|
1141
|
-
const end = this.data.length - 2;
|
|
1142
|
-
if (sub_pos !== end) {
|
|
1143
|
-
this.peer_move(end, sub_pos);
|
|
1144
|
-
}
|
|
1145
|
-
this.data.pop();
|
|
1146
|
-
this.data.pop();
|
|
1147
|
-
if (this.data.length === this.sub_from)
|
|
1148
|
-
this.reap();
|
|
1410
|
+
if (typeof json.toJSON === 'function') {
|
|
1411
|
+
return $mol_tree2_from_json(json.toJSON());
|
|
1149
1412
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
$mol_wire_auto()?.track_next(this);
|
|
1413
|
+
if (json.toString !== Object.prototype.toString) {
|
|
1414
|
+
return $mol_tree2.data(json.toString(), [], span);
|
|
1153
1415
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
return false;
|
|
1416
|
+
if (json instanceof Error) {
|
|
1417
|
+
const { name, message, stack } = json;
|
|
1418
|
+
json = { ...json, name, message, stack };
|
|
1158
1419
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1420
|
+
const sub = [];
|
|
1421
|
+
for (var key in json) {
|
|
1422
|
+
const val = json[key];
|
|
1423
|
+
if (val === undefined)
|
|
1424
|
+
continue;
|
|
1425
|
+
const subsub = $mol_tree2_from_json(val, span);
|
|
1426
|
+
if (/^[^\n\t\\ ]+$/.test(key)) {
|
|
1427
|
+
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
sub.push($mol_tree2.data(key, [subsub], span));
|
|
1163
1431
|
}
|
|
1164
1432
|
}
|
|
1165
|
-
|
|
1166
|
-
const peer = this.data[from_pos];
|
|
1167
|
-
const self_pos = this.data[from_pos + 1];
|
|
1168
|
-
this.data[to_pos] = peer;
|
|
1169
|
-
this.data[to_pos + 1] = self_pos;
|
|
1170
|
-
peer.peer_repos(self_pos, to_pos);
|
|
1171
|
-
}
|
|
1172
|
-
peer_repos(peer_pos, self_pos) {
|
|
1173
|
-
this.data[peer_pos + 1] = self_pos;
|
|
1174
|
-
}
|
|
1433
|
+
return new $mol_tree2('*', '', sub, span);
|
|
1175
1434
|
}
|
|
1176
|
-
$.$
|
|
1435
|
+
$.$mol_tree2_from_json = $mol_tree2_from_json;
|
|
1177
1436
|
})($ || ($ = {}));
|
|
1178
1437
|
|
|
1179
|
-
;
|
|
1180
|
-
"use strict";
|
|
1181
|
-
|
|
1182
1438
|
;
|
|
1183
1439
|
"use strict";
|
|
1184
1440
|
var $;
|
|
1185
1441
|
(function ($) {
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1442
|
+
class $mol_term_color {
|
|
1443
|
+
static reset = this.ansi(0, 0);
|
|
1444
|
+
static bold = this.ansi(1, 22);
|
|
1445
|
+
static italic = this.ansi(3, 23);
|
|
1446
|
+
static underline = this.ansi(4, 24);
|
|
1447
|
+
static inverse = this.ansi(7, 27);
|
|
1448
|
+
static hidden = this.ansi(8, 28);
|
|
1449
|
+
static strike = this.ansi(9, 29);
|
|
1450
|
+
static gray = this.ansi(90, 39);
|
|
1451
|
+
static red = this.ansi(91, 39);
|
|
1452
|
+
static green = this.ansi(92, 39);
|
|
1453
|
+
static yellow = this.ansi(93, 39);
|
|
1454
|
+
static blue = this.ansi(94, 39);
|
|
1455
|
+
static magenta = this.ansi(95, 39);
|
|
1456
|
+
static cyan = this.ansi(96, 39);
|
|
1457
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
1458
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
1459
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
1460
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1461
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
1462
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1463
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1464
|
+
static ansi(open, close) {
|
|
1465
|
+
if (typeof process === 'undefined')
|
|
1466
|
+
return String;
|
|
1467
|
+
if (!process.stdout.isTTY)
|
|
1468
|
+
return String;
|
|
1469
|
+
const prefix = `\x1b[${open}m`;
|
|
1470
|
+
const postfix = `\x1b[${close}m`;
|
|
1471
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1472
|
+
return function colorer(str) {
|
|
1473
|
+
str = String(str);
|
|
1474
|
+
if (str === '')
|
|
1475
|
+
return str;
|
|
1476
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
1477
|
+
return prefix + suffix + postfix;
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1189
1480
|
}
|
|
1190
|
-
$.$
|
|
1191
|
-
$.$mol_wire_affected = [];
|
|
1481
|
+
$.$mol_term_color = $mol_term_color;
|
|
1192
1482
|
})($ || ($ = {}));
|
|
1193
1483
|
|
|
1194
1484
|
;
|
|
1195
1485
|
"use strict";
|
|
1196
1486
|
var $;
|
|
1197
1487
|
(function ($) {
|
|
1198
|
-
$
|
|
1199
|
-
|
|
1200
|
-
|
|
1488
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
1489
|
+
return function $mol_log3_logger(event) {
|
|
1490
|
+
if (!event.time)
|
|
1491
|
+
event = { time: new Date().toISOString(), ...event };
|
|
1492
|
+
let tree = this.$mol_tree2_from_json(event);
|
|
1493
|
+
tree = tree.struct(type, tree.kids);
|
|
1494
|
+
let str = color(tree.toString());
|
|
1495
|
+
this.console[level](str);
|
|
1496
|
+
const self = this;
|
|
1497
|
+
return () => self.console.groupEnd();
|
|
1498
|
+
};
|
|
1201
1499
|
}
|
|
1202
|
-
$.$
|
|
1203
|
-
$.$
|
|
1204
|
-
$.$
|
|
1205
|
-
$
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1500
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1501
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1502
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1503
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1504
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1505
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1506
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1507
|
+
})($ || ($ = {}));
|
|
1508
|
+
|
|
1509
|
+
;
|
|
1510
|
+
"use strict";
|
|
1511
|
+
var $;
|
|
1512
|
+
(function ($) {
|
|
1513
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
1514
|
+
static getter(task) {
|
|
1515
|
+
return function $mol_wire_task_get(host, args) {
|
|
1516
|
+
const sub = $mol_wire_auto();
|
|
1517
|
+
const existen = sub?.track_next();
|
|
1518
|
+
reuse: if (existen) {
|
|
1519
|
+
if (!existen.temp)
|
|
1520
|
+
break reuse;
|
|
1521
|
+
if (existen.host !== host)
|
|
1522
|
+
break reuse;
|
|
1523
|
+
if (existen.task !== task)
|
|
1524
|
+
break reuse;
|
|
1525
|
+
if (!$mol_compare_deep(existen.args, args))
|
|
1526
|
+
break reuse;
|
|
1527
|
+
return existen;
|
|
1214
1528
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1529
|
+
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}<#>`, task, host, args);
|
|
1530
|
+
if (existen?.temp) {
|
|
1531
|
+
$$.$mol_log3_warn({
|
|
1532
|
+
place: '$mol_wire_task',
|
|
1533
|
+
message: `Non idempotency`,
|
|
1534
|
+
existen,
|
|
1535
|
+
next,
|
|
1536
|
+
hint: 'Ignore it',
|
|
1537
|
+
});
|
|
1217
1538
|
}
|
|
1539
|
+
return next;
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
get temp() {
|
|
1543
|
+
return true;
|
|
1544
|
+
}
|
|
1545
|
+
complete() {
|
|
1546
|
+
if ($mol_promise_like(this.cache))
|
|
1547
|
+
return;
|
|
1548
|
+
this.destructor();
|
|
1549
|
+
}
|
|
1550
|
+
put(next) {
|
|
1551
|
+
const prev = this.cache;
|
|
1552
|
+
this.cache = next;
|
|
1553
|
+
if ($mol_promise_like(next)) {
|
|
1554
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1555
|
+
if (next !== prev)
|
|
1556
|
+
this.emit();
|
|
1557
|
+
return next;
|
|
1218
1558
|
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
if (
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
},
|
|
1227
|
-
hasBody: val => val[$.$mol_dev_format_body],
|
|
1228
|
-
body: val => val[$.$mol_dev_format_body](),
|
|
1229
|
-
});
|
|
1230
|
-
function $mol_dev_format_native(obj) {
|
|
1231
|
-
if (typeof obj === 'undefined')
|
|
1232
|
-
return $.$mol_dev_format_shade('undefined');
|
|
1233
|
-
return [
|
|
1234
|
-
'object',
|
|
1235
|
-
{
|
|
1236
|
-
object: obj,
|
|
1237
|
-
config: true,
|
|
1238
|
-
},
|
|
1239
|
-
];
|
|
1559
|
+
this.cursor = $mol_wire_cursor.final;
|
|
1560
|
+
if (this.sub_empty)
|
|
1561
|
+
this.destructor();
|
|
1562
|
+
else if (next !== prev)
|
|
1563
|
+
this.emit();
|
|
1564
|
+
return next;
|
|
1565
|
+
}
|
|
1240
1566
|
}
|
|
1241
|
-
$.$
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1567
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
1568
|
+
})($ || ($ = {}));
|
|
1569
|
+
|
|
1570
|
+
;
|
|
1571
|
+
"use strict";
|
|
1572
|
+
var $;
|
|
1573
|
+
(function ($) {
|
|
1574
|
+
function $mol_wire_sync(obj) {
|
|
1575
|
+
return new Proxy(obj, {
|
|
1576
|
+
get(obj, field) {
|
|
1577
|
+
const val = obj[field];
|
|
1578
|
+
if (typeof val !== 'function')
|
|
1579
|
+
return val;
|
|
1580
|
+
const temp = $mol_wire_task.getter(val);
|
|
1581
|
+
return function $mol_wire_sync(...args) {
|
|
1582
|
+
const fiber = temp(obj, args);
|
|
1583
|
+
return fiber.sync();
|
|
1584
|
+
};
|
|
1250
1585
|
},
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
const styles = [];
|
|
1256
|
-
for (let key in style)
|
|
1257
|
-
styles.push(`${key} : ${style[key]}`);
|
|
1258
|
-
return [
|
|
1259
|
-
element,
|
|
1260
|
-
{
|
|
1261
|
-
style: styles.join(' ; '),
|
|
1586
|
+
apply(obj, self, args) {
|
|
1587
|
+
const temp = $mol_wire_task.getter(obj);
|
|
1588
|
+
const fiber = temp(self, args);
|
|
1589
|
+
return fiber.sync();
|
|
1262
1590
|
},
|
|
1263
|
-
|
|
1264
|
-
];
|
|
1265
|
-
}
|
|
1266
|
-
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
1267
|
-
function $mol_dev_format_span(style, ...content) {
|
|
1268
|
-
return $mol_dev_format_element('span', {
|
|
1269
|
-
...style,
|
|
1270
|
-
}, ...content);
|
|
1591
|
+
});
|
|
1271
1592
|
}
|
|
1272
|
-
$.$
|
|
1273
|
-
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
1274
|
-
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
1275
|
-
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
1276
|
-
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
1277
|
-
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
1278
|
-
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
1279
|
-
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
1280
|
-
'color': 'magenta',
|
|
1281
|
-
});
|
|
1282
|
-
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
1283
|
-
'font-weight': 'bold',
|
|
1284
|
-
});
|
|
1285
|
-
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
1286
|
-
'color': 'green',
|
|
1287
|
-
});
|
|
1288
|
-
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
1289
|
-
'color': 'gray',
|
|
1290
|
-
});
|
|
1291
|
-
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
1292
|
-
'margin-left': '13px'
|
|
1293
|
-
});
|
|
1593
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1294
1594
|
})($ || ($ = {}));
|
|
1295
1595
|
|
|
1296
1596
|
;
|
|
1297
1597
|
"use strict";
|
|
1298
1598
|
var $;
|
|
1299
1599
|
(function ($) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1600
|
+
const catched = new WeakMap();
|
|
1601
|
+
function $mol_fail_catch(error) {
|
|
1602
|
+
if (typeof error !== 'object')
|
|
1603
|
+
return false;
|
|
1604
|
+
if ($mol_promise_like(error))
|
|
1605
|
+
$mol_fail_hidden(error);
|
|
1606
|
+
if (catched.get(error))
|
|
1607
|
+
return false;
|
|
1608
|
+
catched.set(error, true);
|
|
1609
|
+
return true;
|
|
1306
1610
|
}
|
|
1307
|
-
$.$
|
|
1611
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
1308
1612
|
})($ || ($ = {}));
|
|
1309
1613
|
|
|
1310
1614
|
;
|
|
1311
1615
|
"use strict";
|
|
1312
1616
|
var $;
|
|
1313
1617
|
(function ($) {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
cursor = $mol_wire_cursor.stale;
|
|
1317
|
-
get temp() {
|
|
1618
|
+
function $mol_fail_log(error) {
|
|
1619
|
+
if ($mol_promise_like(error))
|
|
1318
1620
|
return false;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
this.cursor += 2;
|
|
1350
|
-
return next;
|
|
1351
|
-
}
|
|
1352
|
-
if (next) {
|
|
1353
|
-
if (this.sub_from < this.data.length) {
|
|
1354
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
1355
|
-
}
|
|
1356
|
-
this.peer_move(this.cursor, this.sub_from);
|
|
1357
|
-
this.sub_from += 2;
|
|
1621
|
+
if (!$mol_fail_catch(error))
|
|
1622
|
+
return false;
|
|
1623
|
+
console.error(error);
|
|
1624
|
+
return true;
|
|
1625
|
+
}
|
|
1626
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
1627
|
+
})($ || ($ = {}));
|
|
1628
|
+
|
|
1629
|
+
;
|
|
1630
|
+
"use strict";
|
|
1631
|
+
var $node = new Proxy({ require }, {
|
|
1632
|
+
get(target, name, wrapper) {
|
|
1633
|
+
if (target[name])
|
|
1634
|
+
return target[name];
|
|
1635
|
+
const mod = target.require('module');
|
|
1636
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
1637
|
+
return target.require(name);
|
|
1638
|
+
if (name[0] === '.')
|
|
1639
|
+
return target.require(name);
|
|
1640
|
+
const path = target.require('path');
|
|
1641
|
+
const fs = target.require('fs');
|
|
1642
|
+
let dir = path.resolve('.');
|
|
1643
|
+
const suffix = `./node_modules/${name}`;
|
|
1644
|
+
const $$ = $;
|
|
1645
|
+
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
1646
|
+
const parent = path.resolve(dir, '..');
|
|
1647
|
+
if (parent === dir) {
|
|
1648
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1649
|
+
try {
|
|
1650
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1358
1651
|
}
|
|
1652
|
+
catch { }
|
|
1653
|
+
break;
|
|
1359
1654
|
}
|
|
1360
1655
|
else {
|
|
1361
|
-
|
|
1362
|
-
return null;
|
|
1363
|
-
if (this.sub_from < this.data.length) {
|
|
1364
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
1365
|
-
}
|
|
1366
|
-
this.sub_from += 2;
|
|
1367
|
-
}
|
|
1368
|
-
this.data[this.cursor] = pub;
|
|
1369
|
-
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
1370
|
-
this.cursor += 2;
|
|
1371
|
-
return pub;
|
|
1372
|
-
}
|
|
1373
|
-
track_off(sub) {
|
|
1374
|
-
$mol_wire_auto(sub);
|
|
1375
|
-
if (this.cursor < 0) {
|
|
1376
|
-
$mol_fail(new Error('End of non begun sub'));
|
|
1377
|
-
}
|
|
1378
|
-
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
1379
|
-
const pub = this.data[cursor];
|
|
1380
|
-
pub.fresh();
|
|
1381
|
-
}
|
|
1382
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1383
|
-
}
|
|
1384
|
-
pub_off(sub_pos) {
|
|
1385
|
-
this.data[sub_pos] = undefined;
|
|
1386
|
-
this.data[sub_pos + 1] = undefined;
|
|
1387
|
-
}
|
|
1388
|
-
destructor() {
|
|
1389
|
-
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
1390
|
-
const sub = this.data[cursor];
|
|
1391
|
-
const pos = this.data[cursor + 1];
|
|
1392
|
-
sub.pub_off(pos);
|
|
1393
|
-
this.data.pop();
|
|
1394
|
-
this.data.pop();
|
|
1656
|
+
dir = parent;
|
|
1395
1657
|
}
|
|
1396
|
-
this.cursor = this.pub_from;
|
|
1397
|
-
this.track_cut();
|
|
1398
|
-
this.cursor = $mol_wire_cursor.final;
|
|
1399
1658
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
$mol_fail(new Error('Cut of non begun sub'));
|
|
1403
|
-
}
|
|
1404
|
-
let tail = 0;
|
|
1405
|
-
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
1406
|
-
const pub = this.data[cursor];
|
|
1407
|
-
pub?.sub_off(this.data[cursor + 1]);
|
|
1408
|
-
if (this.sub_from < this.data.length) {
|
|
1409
|
-
this.peer_move(this.data.length - 2, cursor);
|
|
1410
|
-
this.data.pop();
|
|
1411
|
-
this.data.pop();
|
|
1412
|
-
}
|
|
1413
|
-
else {
|
|
1414
|
-
++tail;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
for (; tail; --tail) {
|
|
1418
|
-
this.data.pop();
|
|
1419
|
-
this.data.pop();
|
|
1420
|
-
}
|
|
1421
|
-
this.sub_from = this.cursor;
|
|
1659
|
+
try {
|
|
1660
|
+
return $.$mol_wire_sync(target).require(name);
|
|
1422
1661
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1427
|
-
const pub = this.data[cursor];
|
|
1428
|
-
if (pub?.incompleted)
|
|
1429
|
-
return;
|
|
1430
|
-
}
|
|
1431
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1432
|
-
const pub = this.data[cursor];
|
|
1433
|
-
pub?.complete();
|
|
1662
|
+
catch (error) {
|
|
1663
|
+
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
1664
|
+
return importSync(name);
|
|
1434
1665
|
}
|
|
1666
|
+
$.$mol_fail_log(error);
|
|
1667
|
+
return null;
|
|
1435
1668
|
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1669
|
+
},
|
|
1670
|
+
set(target, name, value) {
|
|
1671
|
+
target[name] = value;
|
|
1672
|
+
return true;
|
|
1673
|
+
},
|
|
1674
|
+
});
|
|
1675
|
+
const importAsync = async (uri) => import(uri);
|
|
1676
|
+
const importSync = $.$mol_wire_sync(importAsync);
|
|
1677
|
+
require = (req => Object.assign(function require(name) {
|
|
1678
|
+
return $node[name];
|
|
1679
|
+
}, req))(require);
|
|
1680
|
+
|
|
1681
|
+
;
|
|
1682
|
+
"use strict";
|
|
1683
|
+
var $;
|
|
1684
|
+
(function ($) {
|
|
1685
|
+
function $mol_env() {
|
|
1686
|
+
return {};
|
|
1450
1687
|
}
|
|
1451
|
-
$.$
|
|
1688
|
+
$.$mol_env = $mol_env;
|
|
1452
1689
|
})($ || ($ = {}));
|
|
1453
1690
|
|
|
1454
1691
|
;
|
|
1455
1692
|
"use strict";
|
|
1456
1693
|
var $;
|
|
1457
1694
|
(function ($) {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
id;
|
|
1462
|
-
constructor(delay, task) {
|
|
1463
|
-
super();
|
|
1464
|
-
this.delay = delay;
|
|
1465
|
-
this.task = task;
|
|
1466
|
-
this.id = setTimeout(task, delay);
|
|
1467
|
-
}
|
|
1468
|
-
destructor() {
|
|
1469
|
-
clearTimeout(this.id);
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
$.$mol_after_timeout = $mol_after_timeout;
|
|
1695
|
+
$.$mol_env = function $mol_env() {
|
|
1696
|
+
return this.process.env;
|
|
1697
|
+
};
|
|
1473
1698
|
})($ || ($ = {}));
|
|
1474
1699
|
|
|
1475
1700
|
;
|
|
1476
1701
|
"use strict";
|
|
1477
1702
|
var $;
|
|
1478
1703
|
(function ($) {
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1704
|
+
function $mol_exec(dir, command, ...args) {
|
|
1705
|
+
let [app, ...args0] = command.split(' ');
|
|
1706
|
+
args = [...args0, ...args];
|
|
1707
|
+
this.$mol_log3_come({
|
|
1708
|
+
place: '$mol_exec',
|
|
1709
|
+
dir: $node.path.relative('', dir),
|
|
1710
|
+
message: 'Run',
|
|
1711
|
+
command: `${app} ${args.join(' ')}`,
|
|
1712
|
+
});
|
|
1713
|
+
var res = $node['child_process'].spawnSync(app, args, {
|
|
1714
|
+
cwd: $node.path.resolve(dir),
|
|
1715
|
+
shell: true,
|
|
1716
|
+
env: this.$mol_env(),
|
|
1717
|
+
});
|
|
1718
|
+
if (res.status || res.error) {
|
|
1719
|
+
return $mol_fail(res.error || new Error(res.stderr.toString(), { cause: res.stdout }));
|
|
1484
1720
|
}
|
|
1721
|
+
if (!res.stdout)
|
|
1722
|
+
res.stdout = Buffer.from([]);
|
|
1723
|
+
return res;
|
|
1485
1724
|
}
|
|
1486
|
-
$.$
|
|
1725
|
+
$.$mol_exec = $mol_exec;
|
|
1487
1726
|
})($ || ($ = {}));
|
|
1488
1727
|
|
|
1489
1728
|
;
|
|
1490
1729
|
"use strict";
|
|
1491
1730
|
var $;
|
|
1492
1731
|
(function ($) {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
static sync() {
|
|
1514
|
-
while (this.planning.size) {
|
|
1515
|
-
for (const fiber of this.planning) {
|
|
1516
|
-
this.planning.delete(fiber);
|
|
1517
|
-
if (fiber.cursor >= 0)
|
|
1518
|
-
continue;
|
|
1519
|
-
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1520
|
-
continue;
|
|
1521
|
-
fiber.fresh();
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
while (this.reaping.size) {
|
|
1525
|
-
const fibers = this.reaping;
|
|
1526
|
-
this.reaping = new Set;
|
|
1527
|
-
for (const fiber of fibers) {
|
|
1528
|
-
if (!fiber.sub_empty)
|
|
1529
|
-
continue;
|
|
1530
|
-
fiber.destructor();
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
[Symbol.toStringTag];
|
|
1535
|
-
cache = undefined;
|
|
1536
|
-
get args() {
|
|
1537
|
-
return this.data.slice(0, this.pub_from);
|
|
1538
|
-
}
|
|
1539
|
-
result() {
|
|
1540
|
-
if ($mol_promise_like(this.cache))
|
|
1541
|
-
return;
|
|
1542
|
-
if (this.cache instanceof Error)
|
|
1543
|
-
return;
|
|
1544
|
-
return this.cache;
|
|
1545
|
-
}
|
|
1546
|
-
get incompleted() {
|
|
1547
|
-
return $mol_promise_like(this.cache);
|
|
1548
|
-
}
|
|
1549
|
-
field() {
|
|
1550
|
-
return this.task.name + '<>';
|
|
1551
|
-
}
|
|
1552
|
-
constructor(id, task, host, args) {
|
|
1553
|
-
super();
|
|
1554
|
-
this.task = task;
|
|
1555
|
-
this.host = host;
|
|
1556
|
-
if (args)
|
|
1557
|
-
this.data.push(...args);
|
|
1558
|
-
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
1559
|
-
this[Symbol.toStringTag] = id;
|
|
1560
|
-
}
|
|
1561
|
-
plan() {
|
|
1562
|
-
$mol_wire_fiber.planning.add(this);
|
|
1563
|
-
$mol_wire_fiber.plan();
|
|
1564
|
-
}
|
|
1565
|
-
reap() {
|
|
1566
|
-
$mol_wire_fiber.reaping.add(this);
|
|
1567
|
-
$mol_wire_fiber.plan();
|
|
1568
|
-
}
|
|
1569
|
-
toString() {
|
|
1570
|
-
return this[Symbol.toStringTag];
|
|
1571
|
-
}
|
|
1572
|
-
toJSON() {
|
|
1573
|
-
return this[Symbol.toStringTag];
|
|
1574
|
-
}
|
|
1575
|
-
[$mol_dev_format_head]() {
|
|
1576
|
-
const cursor = {
|
|
1577
|
-
[$mol_wire_cursor.stale]: '🔴',
|
|
1578
|
-
[$mol_wire_cursor.doubt]: '🟡',
|
|
1579
|
-
[$mol_wire_cursor.fresh]: '🟢',
|
|
1580
|
-
[$mol_wire_cursor.final]: '🔵',
|
|
1581
|
-
}[this.cursor] ?? this.cursor.toString();
|
|
1582
|
-
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
1583
|
-
? $mol_dev_format_auto({
|
|
1584
|
-
[$mol_dev_format_head]: () => $mol_dev_format_shade(cursor),
|
|
1585
|
-
[$mol_dev_format_body]: () => $mol_dev_format_native(this),
|
|
1586
|
-
})
|
|
1587
|
-
: $mol_dev_format_shade($mol_dev_format_native(this), cursor), $mol_dev_format_auto(this.cache));
|
|
1588
|
-
}
|
|
1589
|
-
get $() {
|
|
1590
|
-
return (this.host ?? this.task)['$'];
|
|
1591
|
-
}
|
|
1592
|
-
emit(quant = $mol_wire_cursor.stale) {
|
|
1593
|
-
if (this.sub_empty)
|
|
1594
|
-
this.plan();
|
|
1595
|
-
else
|
|
1596
|
-
super.emit(quant);
|
|
1597
|
-
}
|
|
1598
|
-
fresh() {
|
|
1599
|
-
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1600
|
-
return;
|
|
1601
|
-
if (this.cursor === $mol_wire_cursor.final)
|
|
1602
|
-
return;
|
|
1603
|
-
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1604
|
-
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1605
|
-
;
|
|
1606
|
-
this.data[i]?.fresh();
|
|
1607
|
-
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1608
|
-
break check;
|
|
1609
|
-
}
|
|
1610
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1611
|
-
return;
|
|
1612
|
-
}
|
|
1613
|
-
const bu = this.track_on();
|
|
1614
|
-
let result;
|
|
1615
|
-
try {
|
|
1616
|
-
switch (this.pub_from) {
|
|
1617
|
-
case 0:
|
|
1618
|
-
result = this.task.call(this.host);
|
|
1619
|
-
break;
|
|
1620
|
-
case 1:
|
|
1621
|
-
result = this.task.call(this.host, this.data[0]);
|
|
1732
|
+
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
1733
|
+
})($ || ($ = {}));
|
|
1734
|
+
|
|
1735
|
+
;
|
|
1736
|
+
"use strict";
|
|
1737
|
+
var $;
|
|
1738
|
+
(function ($) {
|
|
1739
|
+
function $mol_dom_render_children(el, childNodes) {
|
|
1740
|
+
const node_set = new Set(childNodes);
|
|
1741
|
+
let nextNode = el.firstChild;
|
|
1742
|
+
for (let view of childNodes) {
|
|
1743
|
+
if (view == null)
|
|
1744
|
+
continue;
|
|
1745
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
1746
|
+
while (true) {
|
|
1747
|
+
if (!nextNode) {
|
|
1748
|
+
el.appendChild(view);
|
|
1622
1749
|
break;
|
|
1623
|
-
|
|
1624
|
-
|
|
1750
|
+
}
|
|
1751
|
+
if (nextNode == view) {
|
|
1752
|
+
nextNode = nextNode.nextSibling;
|
|
1625
1753
|
break;
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
if (node_set.has(nextNode)) {
|
|
1757
|
+
el.insertBefore(view, nextNode);
|
|
1758
|
+
break;
|
|
1759
|
+
}
|
|
1760
|
+
else {
|
|
1761
|
+
const nn = nextNode.nextSibling;
|
|
1762
|
+
el.removeChild(nextNode);
|
|
1763
|
+
nextNode = nn;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1634
1766
|
}
|
|
1635
1767
|
}
|
|
1636
|
-
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1768
|
+
else {
|
|
1769
|
+
if (nextNode && nextNode.nodeName === '#text') {
|
|
1770
|
+
const str = String(view);
|
|
1771
|
+
if (nextNode.nodeValue !== str)
|
|
1772
|
+
nextNode.nodeValue = str;
|
|
1773
|
+
nextNode = nextNode.nextSibling;
|
|
1639
1774
|
}
|
|
1640
1775
|
else {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1644
|
-
result = result.finally(() => {
|
|
1645
|
-
if (this.cache === result)
|
|
1646
|
-
this.absorb();
|
|
1647
|
-
});
|
|
1776
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
1777
|
+
el.insertBefore(textNode, nextNode);
|
|
1648
1778
|
}
|
|
1649
1779
|
}
|
|
1650
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1651
|
-
result = Object.assign(result, {
|
|
1652
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1653
|
-
});
|
|
1654
|
-
handled.add(result);
|
|
1655
|
-
const error = new Error();
|
|
1656
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1657
|
-
}
|
|
1658
|
-
if (!$mol_promise_like(result)) {
|
|
1659
|
-
this.track_cut();
|
|
1660
|
-
}
|
|
1661
|
-
this.track_off(bu);
|
|
1662
|
-
this.put(result);
|
|
1663
1780
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1781
|
+
while (nextNode) {
|
|
1782
|
+
const currNode = nextNode;
|
|
1783
|
+
nextNode = currNode.nextSibling;
|
|
1784
|
+
el.removeChild(currNode);
|
|
1667
1785
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1786
|
+
}
|
|
1787
|
+
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
1788
|
+
})($ || ($ = {}));
|
|
1789
|
+
|
|
1790
|
+
;
|
|
1791
|
+
"use strict";
|
|
1792
|
+
|
|
1793
|
+
;
|
|
1794
|
+
"use strict";
|
|
1795
|
+
var $;
|
|
1796
|
+
(function ($) {
|
|
1797
|
+
$.$mol_jsx_prefix = '';
|
|
1798
|
+
$.$mol_jsx_crumbs = '';
|
|
1799
|
+
$.$mol_jsx_booked = null;
|
|
1800
|
+
$.$mol_jsx_document = {
|
|
1801
|
+
getElementById: () => null,
|
|
1802
|
+
createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
|
|
1803
|
+
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
1804
|
+
};
|
|
1805
|
+
$.$mol_jsx_frag = '';
|
|
1806
|
+
function $mol_jsx(Elem, props, ...childNodes) {
|
|
1807
|
+
const id = props && props.id || '';
|
|
1808
|
+
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
1809
|
+
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
1810
|
+
if (Elem && $.$mol_jsx_booked) {
|
|
1811
|
+
if ($.$mol_jsx_booked.has(id)) {
|
|
1812
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
1671
1813
|
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
if (this.cache instanceof Error) {
|
|
1675
|
-
return $mol_fail_hidden(this.cache);
|
|
1814
|
+
else {
|
|
1815
|
+
$.$mol_jsx_booked.add(id);
|
|
1676
1816
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1817
|
+
}
|
|
1818
|
+
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
1819
|
+
if ($.$mol_jsx_prefix) {
|
|
1820
|
+
const prefix_ext = $.$mol_jsx_prefix;
|
|
1821
|
+
const booked_ext = $.$mol_jsx_booked;
|
|
1822
|
+
const crumbs_ext = $.$mol_jsx_crumbs;
|
|
1823
|
+
for (const field in props) {
|
|
1824
|
+
const func = props[field];
|
|
1825
|
+
if (typeof func !== 'function')
|
|
1826
|
+
continue;
|
|
1827
|
+
const wrapper = function (...args) {
|
|
1828
|
+
const prefix = $.$mol_jsx_prefix;
|
|
1829
|
+
const booked = $.$mol_jsx_booked;
|
|
1830
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
1831
|
+
try {
|
|
1832
|
+
$.$mol_jsx_prefix = prefix_ext;
|
|
1833
|
+
$.$mol_jsx_booked = booked_ext;
|
|
1834
|
+
$.$mol_jsx_crumbs = crumbs_ext;
|
|
1835
|
+
return func.call(this, ...args);
|
|
1836
|
+
}
|
|
1837
|
+
finally {
|
|
1838
|
+
$.$mol_jsx_prefix = prefix;
|
|
1839
|
+
$.$mol_jsx_booked = booked;
|
|
1840
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
1841
|
+
}
|
|
1842
|
+
};
|
|
1843
|
+
$mol_func_name_from(wrapper, func);
|
|
1844
|
+
props[field] = wrapper;
|
|
1679
1845
|
}
|
|
1680
|
-
return this.cache;
|
|
1681
1846
|
}
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1847
|
+
if (typeof Elem !== 'string') {
|
|
1848
|
+
if ('prototype' in Elem) {
|
|
1849
|
+
const view = node && node[String(Elem)] || new Elem;
|
|
1850
|
+
Object.assign(view, props);
|
|
1851
|
+
view[Symbol.toStringTag] = guid;
|
|
1852
|
+
view.childNodes = childNodes;
|
|
1853
|
+
if (!view.ownerDocument)
|
|
1854
|
+
view.ownerDocument = $.$mol_jsx_document;
|
|
1855
|
+
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1856
|
+
node = view.valueOf();
|
|
1857
|
+
node[String(Elem)] = view;
|
|
1858
|
+
return node;
|
|
1859
|
+
}
|
|
1860
|
+
else {
|
|
1861
|
+
const prefix = $.$mol_jsx_prefix;
|
|
1862
|
+
const booked = $.$mol_jsx_booked;
|
|
1863
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
1864
|
+
try {
|
|
1865
|
+
$.$mol_jsx_prefix = guid;
|
|
1866
|
+
$.$mol_jsx_booked = new Set;
|
|
1867
|
+
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1868
|
+
return Elem(props, ...childNodes);
|
|
1687
1869
|
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
return this.cache;
|
|
1693
|
-
if (this.cursor === $mol_wire_cursor.final) {
|
|
1694
|
-
await new Promise(() => { });
|
|
1870
|
+
finally {
|
|
1871
|
+
$.$mol_jsx_prefix = prefix;
|
|
1872
|
+
$.$mol_jsx_booked = booked;
|
|
1873
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
1695
1874
|
}
|
|
1696
1875
|
}
|
|
1697
1876
|
}
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1877
|
+
if (!node) {
|
|
1878
|
+
node = Elem
|
|
1879
|
+
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
1880
|
+
: $.$mol_jsx_document.createDocumentFragment();
|
|
1881
|
+
}
|
|
1882
|
+
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
1883
|
+
if (!Elem)
|
|
1884
|
+
return node;
|
|
1885
|
+
if (guid)
|
|
1886
|
+
node.id = guid;
|
|
1887
|
+
for (const key in props) {
|
|
1888
|
+
if (key === 'id')
|
|
1889
|
+
continue;
|
|
1890
|
+
if (typeof props[key] === 'string') {
|
|
1891
|
+
if (typeof node[key] === 'string')
|
|
1892
|
+
node[key] = props[key];
|
|
1893
|
+
node.setAttribute(key, props[key]);
|
|
1894
|
+
}
|
|
1895
|
+
else if (props[key] &&
|
|
1896
|
+
typeof props[key] === 'object' &&
|
|
1897
|
+
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
1898
|
+
if (typeof node[key] === 'object') {
|
|
1899
|
+
Object.assign(node[key], props[key]);
|
|
1900
|
+
continue;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
else {
|
|
1904
|
+
node[key] = props[key];
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
if ($.$mol_jsx_crumbs)
|
|
1908
|
+
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
1909
|
+
return node;
|
|
1910
|
+
}
|
|
1911
|
+
$.$mol_jsx = $mol_jsx;
|
|
1912
|
+
})($ || ($ = {}));
|
|
1913
|
+
|
|
1914
|
+
;
|
|
1915
|
+
"use strict";
|
|
1916
|
+
var $;
|
|
1917
|
+
(function ($) {
|
|
1918
|
+
function $mol_jsx_attach(next, action) {
|
|
1919
|
+
const prev = $mol_jsx_document;
|
|
1920
|
+
try {
|
|
1921
|
+
$mol_jsx_document = next;
|
|
1922
|
+
return action();
|
|
1923
|
+
}
|
|
1924
|
+
finally {
|
|
1925
|
+
$mol_jsx_document = prev;
|
|
1709
1926
|
}
|
|
1710
1927
|
}
|
|
1711
|
-
$.$
|
|
1928
|
+
$.$mol_jsx_attach = $mol_jsx_attach;
|
|
1929
|
+
})($ || ($ = {}));
|
|
1930
|
+
|
|
1931
|
+
;
|
|
1932
|
+
"use strict";
|
|
1933
|
+
var $;
|
|
1934
|
+
(function ($) {
|
|
1935
|
+
function $mol_const(value) {
|
|
1936
|
+
const getter = (() => value);
|
|
1937
|
+
getter['()'] = value;
|
|
1938
|
+
getter[Symbol.toStringTag] = value;
|
|
1939
|
+
getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
|
|
1940
|
+
return getter;
|
|
1941
|
+
}
|
|
1942
|
+
$.$mol_const = $mol_const;
|
|
1712
1943
|
})($ || ($ = {}));
|
|
1713
1944
|
|
|
1714
1945
|
;
|
|
@@ -1773,206 +2004,6 @@ var $;
|
|
|
1773
2004
|
$.$mol_key = $mol_key;
|
|
1774
2005
|
})($ || ($ = {}));
|
|
1775
2006
|
|
|
1776
|
-
;
|
|
1777
|
-
"use strict";
|
|
1778
|
-
var $;
|
|
1779
|
-
(function ($) {
|
|
1780
|
-
$.$mol_compare_deep_cache = new WeakMap();
|
|
1781
|
-
function $mol_compare_deep(left, right) {
|
|
1782
|
-
if (Object.is(left, right))
|
|
1783
|
-
return true;
|
|
1784
|
-
if (left === null)
|
|
1785
|
-
return false;
|
|
1786
|
-
if (right === null)
|
|
1787
|
-
return false;
|
|
1788
|
-
if (typeof left !== 'object')
|
|
1789
|
-
return false;
|
|
1790
|
-
if (typeof right !== 'object')
|
|
1791
|
-
return false;
|
|
1792
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
1793
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
1794
|
-
if (left_proto !== right_proto)
|
|
1795
|
-
return false;
|
|
1796
|
-
if (left instanceof Boolean)
|
|
1797
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1798
|
-
if (left instanceof Number)
|
|
1799
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1800
|
-
if (left instanceof String)
|
|
1801
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1802
|
-
if (left instanceof Date)
|
|
1803
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1804
|
-
if (left instanceof RegExp)
|
|
1805
|
-
return left.source === right.source && left.flags === right.flags;
|
|
1806
|
-
if (left instanceof Error)
|
|
1807
|
-
return left.message === right.message && left.stack === right.stack;
|
|
1808
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
1809
|
-
if (left_cache) {
|
|
1810
|
-
const right_cache = left_cache.get(right);
|
|
1811
|
-
if (typeof right_cache === 'boolean')
|
|
1812
|
-
return right_cache;
|
|
1813
|
-
}
|
|
1814
|
-
else {
|
|
1815
|
-
left_cache = new WeakMap([[right, true]]);
|
|
1816
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
1817
|
-
}
|
|
1818
|
-
let result;
|
|
1819
|
-
try {
|
|
1820
|
-
if (!left_proto)
|
|
1821
|
-
result = compare_pojo(left, right);
|
|
1822
|
-
else if (!Reflect.getPrototypeOf(left_proto))
|
|
1823
|
-
result = compare_pojo(left, right);
|
|
1824
|
-
else if (Symbol.toPrimitive in left)
|
|
1825
|
-
result = compare_primitive(left, right);
|
|
1826
|
-
else if (Array.isArray(left))
|
|
1827
|
-
result = compare_array(left, right);
|
|
1828
|
-
else if (left instanceof Set)
|
|
1829
|
-
result = compare_set(left, right);
|
|
1830
|
-
else if (left instanceof Map)
|
|
1831
|
-
result = compare_map(left, right);
|
|
1832
|
-
else if (ArrayBuffer.isView(left))
|
|
1833
|
-
result = compare_buffer(left, right);
|
|
1834
|
-
else if (Symbol.iterator in left)
|
|
1835
|
-
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
1836
|
-
else
|
|
1837
|
-
result = false;
|
|
1838
|
-
}
|
|
1839
|
-
finally {
|
|
1840
|
-
left_cache.set(right, result);
|
|
1841
|
-
}
|
|
1842
|
-
return result;
|
|
1843
|
-
}
|
|
1844
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
1845
|
-
function compare_array(left, right) {
|
|
1846
|
-
const len = left.length;
|
|
1847
|
-
if (len !== right.length)
|
|
1848
|
-
return false;
|
|
1849
|
-
for (let i = 0; i < len; ++i) {
|
|
1850
|
-
if (!$mol_compare_deep(left[i], right[i]))
|
|
1851
|
-
return false;
|
|
1852
|
-
}
|
|
1853
|
-
return true;
|
|
1854
|
-
}
|
|
1855
|
-
function compare_buffer(left, right) {
|
|
1856
|
-
const len = left.byteLength;
|
|
1857
|
-
if (len !== right.byteLength)
|
|
1858
|
-
return false;
|
|
1859
|
-
if (left instanceof DataView)
|
|
1860
|
-
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
|
|
1861
|
-
for (let i = 0; i < len; ++i) {
|
|
1862
|
-
if (left[i] !== right[i])
|
|
1863
|
-
return false;
|
|
1864
|
-
}
|
|
1865
|
-
return true;
|
|
1866
|
-
}
|
|
1867
|
-
function compare_iterator(left, right) {
|
|
1868
|
-
while (true) {
|
|
1869
|
-
const left_next = left.next();
|
|
1870
|
-
const right_next = right.next();
|
|
1871
|
-
if (left_next.done !== right_next.done)
|
|
1872
|
-
return false;
|
|
1873
|
-
if (left_next.done)
|
|
1874
|
-
break;
|
|
1875
|
-
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
1876
|
-
return false;
|
|
1877
|
-
}
|
|
1878
|
-
return true;
|
|
1879
|
-
}
|
|
1880
|
-
function compare_set(left, right) {
|
|
1881
|
-
if (left.size !== right.size)
|
|
1882
|
-
return false;
|
|
1883
|
-
return compare_iterator(left.values(), right.values());
|
|
1884
|
-
}
|
|
1885
|
-
function compare_map(left, right) {
|
|
1886
|
-
if (left.size !== right.size)
|
|
1887
|
-
return false;
|
|
1888
|
-
return compare_iterator(left.keys(), right.keys())
|
|
1889
|
-
&& compare_iterator(left.values(), right.values());
|
|
1890
|
-
}
|
|
1891
|
-
function compare_pojo(left, right) {
|
|
1892
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
1893
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
1894
|
-
if (!compare_array(left_keys, right_keys))
|
|
1895
|
-
return false;
|
|
1896
|
-
for (let key of left_keys) {
|
|
1897
|
-
if (!$mol_compare_deep(left[key], right[key]))
|
|
1898
|
-
return false;
|
|
1899
|
-
}
|
|
1900
|
-
const left_syms = Object.getOwnPropertySymbols(left);
|
|
1901
|
-
const right_syms = Object.getOwnPropertySymbols(right);
|
|
1902
|
-
if (!compare_array(left_syms, right_syms))
|
|
1903
|
-
return false;
|
|
1904
|
-
for (let key of left_syms) {
|
|
1905
|
-
if (!$mol_compare_deep(left[key], right[key]))
|
|
1906
|
-
return false;
|
|
1907
|
-
}
|
|
1908
|
-
return true;
|
|
1909
|
-
}
|
|
1910
|
-
function compare_primitive(left, right) {
|
|
1911
|
-
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
1912
|
-
}
|
|
1913
|
-
})($ || ($ = {}));
|
|
1914
|
-
|
|
1915
|
-
;
|
|
1916
|
-
"use strict";
|
|
1917
|
-
var $;
|
|
1918
|
-
(function ($) {
|
|
1919
|
-
class $mol_wire_task extends $mol_wire_fiber {
|
|
1920
|
-
static getter(task) {
|
|
1921
|
-
return function $mol_wire_task_get(host, args) {
|
|
1922
|
-
const sub = $mol_wire_auto();
|
|
1923
|
-
const existen = sub?.track_next();
|
|
1924
|
-
reuse: if (existen) {
|
|
1925
|
-
if (!existen.temp)
|
|
1926
|
-
break reuse;
|
|
1927
|
-
if (existen.host !== host)
|
|
1928
|
-
break reuse;
|
|
1929
|
-
if (existen.task !== task)
|
|
1930
|
-
break reuse;
|
|
1931
|
-
if (!$mol_compare_deep(existen.args, args))
|
|
1932
|
-
break reuse;
|
|
1933
|
-
return existen;
|
|
1934
|
-
}
|
|
1935
|
-
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}<#>`, task, host, args);
|
|
1936
|
-
if (existen?.temp) {
|
|
1937
|
-
$$.$mol_log3_warn({
|
|
1938
|
-
place: '$mol_wire_task',
|
|
1939
|
-
message: `Non idempotency`,
|
|
1940
|
-
existen,
|
|
1941
|
-
next,
|
|
1942
|
-
hint: 'Ignore it',
|
|
1943
|
-
});
|
|
1944
|
-
}
|
|
1945
|
-
return next;
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
get temp() {
|
|
1949
|
-
return true;
|
|
1950
|
-
}
|
|
1951
|
-
complete() {
|
|
1952
|
-
if ($mol_promise_like(this.cache))
|
|
1953
|
-
return;
|
|
1954
|
-
this.destructor();
|
|
1955
|
-
}
|
|
1956
|
-
put(next) {
|
|
1957
|
-
const prev = this.cache;
|
|
1958
|
-
this.cache = next;
|
|
1959
|
-
if ($mol_promise_like(next)) {
|
|
1960
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1961
|
-
if (next !== prev)
|
|
1962
|
-
this.emit();
|
|
1963
|
-
return next;
|
|
1964
|
-
}
|
|
1965
|
-
this.cursor = $mol_wire_cursor.final;
|
|
1966
|
-
if (this.sub_empty)
|
|
1967
|
-
this.destructor();
|
|
1968
|
-
else if (next !== prev)
|
|
1969
|
-
this.emit();
|
|
1970
|
-
return next;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
$.$mol_wire_task = $mol_wire_task;
|
|
1974
|
-
})($ || ($ = {}));
|
|
1975
|
-
|
|
1976
2007
|
;
|
|
1977
2008
|
"use strict";
|
|
1978
2009
|
var $;
|
|
@@ -2349,32 +2380,6 @@ var $;
|
|
|
2349
2380
|
$.$mol_wire_watch = $mol_wire_watch;
|
|
2350
2381
|
})($ || ($ = {}));
|
|
2351
2382
|
|
|
2352
|
-
;
|
|
2353
|
-
"use strict";
|
|
2354
|
-
var $;
|
|
2355
|
-
(function ($) {
|
|
2356
|
-
function $mol_wire_sync(obj) {
|
|
2357
|
-
return new Proxy(obj, {
|
|
2358
|
-
get(obj, field) {
|
|
2359
|
-
const val = obj[field];
|
|
2360
|
-
if (typeof val !== 'function')
|
|
2361
|
-
return val;
|
|
2362
|
-
const temp = $mol_wire_task.getter(val);
|
|
2363
|
-
return function $mol_wire_sync(...args) {
|
|
2364
|
-
const fiber = temp(obj, args);
|
|
2365
|
-
return fiber.sync();
|
|
2366
|
-
};
|
|
2367
|
-
},
|
|
2368
|
-
apply(obj, self, args) {
|
|
2369
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2370
|
-
const fiber = temp(self, args);
|
|
2371
|
-
return fiber.sync();
|
|
2372
|
-
},
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
2376
|
-
})($ || ($ = {}));
|
|
2377
|
-
|
|
2378
2383
|
;
|
|
2379
2384
|
"use strict";
|
|
2380
2385
|
var $;
|