@nil-/xit 0.1.5 → 0.1.6

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/assets/index.js CHANGED
@@ -1,3789 +1,4 @@
1
- var U = (t) => {
2
- throw TypeError(t);
3
- };
4
- var L = (t, e, r) => e.has(t) || U("Cannot " + r);
5
- var w = (t, e, r) => (L(t, e, "read from private field"), r ? r.call(t) : e.get(t)), B = (t, e, r) => e.has(t) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), T = (t, e, r, s) => (L(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r), j = (t, e, r) => (L(t, e, "access private method"), r);
6
- const PUBLIC_VERSION = "5";
7
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
8
- const TEMPLATE_USE_IMPORT_NODE = 2, DEV = !1;
9
- var is_array = Array.isArray, array_from = Array.from, define_property = Object.defineProperty, get_descriptor = Object.getOwnPropertyDescriptor;
10
- const noop$1 = () => {
11
- };
12
- function is_promise(t) {
13
- return typeof (t == null ? void 0 : t.then) == "function";
14
- }
15
- function run_all(t) {
16
- for (var e = 0; e < t.length; e++)
17
- t[e]();
18
- }
19
- const DERIVED = 2, EFFECT = 4, RENDER_EFFECT = 8, BLOCK_EFFECT = 16, BRANCH_EFFECT = 32, ROOT_EFFECT = 64, UNOWNED = 128, DISCONNECTED = 256, CLEAN = 512, DIRTY = 1024, MAYBE_DIRTY = 2048, INERT = 4096, DESTROYED = 8192, EFFECT_RAN = 16384, EFFECT_TRANSPARENT = 32768, HEAD_EFFECT = 1 << 18, EFFECT_HAS_DERIVED = 1 << 19;
20
- function equals(t) {
21
- return t === this.v;
22
- }
23
- function safe_not_equal(t, e) {
24
- return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
25
- }
26
- function safe_equals(t) {
27
- return !safe_not_equal(t, this.v);
28
- }
29
- function effect_update_depth_exceeded() {
30
- throw new Error("effect_update_depth_exceeded");
31
- }
32
- function state_unsafe_local_read() {
33
- throw new Error("state_unsafe_local_read");
34
- }
35
- function source(t) {
36
- return {
37
- f: 0,
38
- // TODO ideally we could skip this altogether, but it causes type errors
39
- v: t,
40
- reactions: null,
41
- equals,
42
- version: 0
43
- };
44
- }
45
- // @__NO_SIDE_EFFECTS__
46
- function mutable_source(t, e = !1) {
47
- var s;
48
- const r = source(t);
49
- return e || (r.equals = safe_equals), component_context !== null && component_context.l !== null && ((s = component_context.l).s ?? (s.s = [])).push(r), r;
50
- }
51
- function internal_set(t, e) {
52
- return t.equals(e) || (t.v = e, t.version = increment_version(), mark_reactions(t, DIRTY), is_runes() && active_effect !== null && active_effect.f & CLEAN && !(active_effect.f & BRANCH_EFFECT) && (new_deps !== null && new_deps.includes(t) ? (set_signal_status(active_effect, DIRTY), schedule_effect(active_effect)) : untracked_writes === null ? set_untracked_writes([t]) : untracked_writes.push(t))), e;
53
- }
54
- function mark_reactions(t, e) {
55
- var r = t.reactions;
56
- if (r !== null)
57
- for (var s = is_runes(), u = r.length, o = 0; o < u; o++) {
58
- var n = r[o], a = n.f;
59
- a & DIRTY || !s && n === active_effect || (set_signal_status(n, e), a & (CLEAN | UNOWNED) && (a & DERIVED ? mark_reactions(
60
- /** @type {Derived} */
61
- n,
62
- MAYBE_DIRTY
63
- ) : schedule_effect(
64
- /** @type {Effect} */
65
- n
66
- )));
67
- }
68
- }
69
- // @__NO_SIDE_EFFECTS__
70
- function derived(t) {
71
- var e = DERIVED | DIRTY;
72
- active_effect === null ? e |= UNOWNED : active_effect.f |= EFFECT_HAS_DERIVED;
73
- const r = {
74
- children: null,
75
- ctx: component_context,
76
- deps: null,
77
- equals,
78
- f: e,
79
- fn: t,
80
- reactions: null,
81
- v: (
82
- /** @type {V} */
83
- null
84
- ),
85
- version: 0,
86
- parent: active_effect
87
- };
88
- if (active_reaction !== null && active_reaction.f & DERIVED) {
89
- var s = (
90
- /** @type {Derived} */
91
- active_reaction
92
- );
93
- (s.children ?? (s.children = [])).push(r);
94
- }
95
- return r;
96
- }
97
- function destroy_derived_children(t) {
98
- var e = t.children;
99
- if (e !== null) {
100
- t.children = null;
101
- for (var r = 0; r < e.length; r += 1) {
102
- var s = e[r];
103
- s.f & DERIVED ? destroy_derived(
104
- /** @type {Derived} */
105
- s
106
- ) : destroy_effect(
107
- /** @type {Effect} */
108
- s
109
- );
110
- }
111
- }
112
- }
113
- function execute_derived(t) {
114
- var e, r = active_effect;
115
- set_active_effect(t.parent);
116
- try {
117
- destroy_derived_children(t), e = update_reaction(t);
118
- } finally {
119
- set_active_effect(r);
120
- }
121
- return e;
122
- }
123
- function update_derived(t) {
124
- var e = execute_derived(t), r = (skip_reaction || t.f & UNOWNED) && t.deps !== null ? MAYBE_DIRTY : CLEAN;
125
- set_signal_status(t, r), t.equals(e) || (t.v = e, t.version = increment_version());
126
- }
127
- function destroy_derived(t) {
128
- destroy_derived_children(t), remove_reactions(t, 0), set_signal_status(t, DESTROYED), t.v = t.children = t.deps = t.ctx = t.reactions = null;
129
- }
130
- function push_effect(t, e) {
131
- var r = e.last;
132
- r === null ? e.last = e.first = t : (r.next = t, t.prev = r, e.last = t);
133
- }
134
- function create_effect(t, e, r, s = !0) {
135
- var u = (t & ROOT_EFFECT) !== 0, o = active_effect, n = {
136
- ctx: component_context,
137
- deps: null,
138
- deriveds: null,
139
- nodes_start: null,
140
- nodes_end: null,
141
- f: t | DIRTY,
142
- first: null,
143
- fn: e,
144
- last: null,
145
- next: null,
146
- parent: u ? null : o,
147
- prev: null,
148
- teardown: null,
149
- transitions: null,
150
- version: 0
151
- };
152
- if (r) {
153
- var a = is_flushing_effect;
154
- try {
155
- set_is_flushing_effect(!0), update_effect(n), n.f |= EFFECT_RAN;
156
- } catch (c) {
157
- throw destroy_effect(n), c;
158
- } finally {
159
- set_is_flushing_effect(a);
160
- }
161
- } else e !== null && schedule_effect(n);
162
- var f = r && n.deps === null && n.first === null && n.nodes_start === null && n.teardown === null && (n.f & EFFECT_HAS_DERIVED) === 0;
163
- if (!f && !u && s && (o !== null && push_effect(n, o), active_reaction !== null && active_reaction.f & DERIVED)) {
164
- var i = (
165
- /** @type {Derived} */
166
- active_reaction
167
- );
168
- (i.children ?? (i.children = [])).push(n);
169
- }
170
- return n;
171
- }
172
- function effect_root(t) {
173
- const e = create_effect(ROOT_EFFECT, t, !0);
174
- return () => {
175
- destroy_effect(e);
176
- };
177
- }
178
- function effect(t) {
179
- return create_effect(EFFECT, t, !1);
180
- }
181
- function template_effect(t) {
182
- return block(t);
183
- }
184
- function block(t, e = 0) {
185
- return create_effect(RENDER_EFFECT | BLOCK_EFFECT | e, t, !0);
186
- }
187
- function branch(t, e = !0) {
188
- return create_effect(RENDER_EFFECT | BRANCH_EFFECT, t, !0, e);
189
- }
190
- function execute_effect_teardown(t) {
191
- var e = t.teardown;
192
- if (e !== null) {
193
- const r = active_reaction;
194
- set_active_reaction(null);
195
- try {
196
- e.call(null);
197
- } finally {
198
- set_active_reaction(r);
199
- }
200
- }
201
- }
202
- function destroy_effect_deriveds(t) {
203
- var e = t.deriveds;
204
- if (e !== null) {
205
- t.deriveds = null;
206
- for (var r = 0; r < e.length; r += 1)
207
- destroy_derived(e[r]);
208
- }
209
- }
210
- function destroy_effect_children(t, e = !1) {
211
- var r = t.first;
212
- for (t.first = t.last = null; r !== null; ) {
213
- var s = r.next;
214
- destroy_effect(r, e), r = s;
215
- }
216
- }
217
- function destroy_block_effect_children(t) {
218
- for (var e = t.first; e !== null; ) {
219
- var r = e.next;
220
- e.f & BRANCH_EFFECT || destroy_effect(e), e = r;
221
- }
222
- }
223
- function destroy_effect(t, e = !0) {
224
- var r = !1;
225
- if ((e || t.f & HEAD_EFFECT) && t.nodes_start !== null) {
226
- for (var s = t.nodes_start, u = t.nodes_end; s !== null; ) {
227
- var o = s === u ? null : (
228
- /** @type {TemplateNode} */
229
- /* @__PURE__ */ get_next_sibling(s)
230
- );
231
- s.remove(), s = o;
232
- }
233
- r = !0;
234
- }
235
- destroy_effect_deriveds(t), destroy_effect_children(t, e && !r), remove_reactions(t, 0), set_signal_status(t, DESTROYED);
236
- var n = t.transitions;
237
- if (n !== null)
238
- for (const f of n)
239
- f.stop();
240
- execute_effect_teardown(t);
241
- var a = t.parent;
242
- a !== null && a.first !== null && unlink_effect(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.parent = t.fn = t.nodes_start = t.nodes_end = null;
243
- }
244
- function unlink_effect(t) {
245
- var e = t.parent, r = t.prev, s = t.next;
246
- r !== null && (r.next = s), s !== null && (s.prev = r), e !== null && (e.first === t && (e.first = s), e.last === t && (e.last = r));
247
- }
248
- function pause_effect(t, e) {
249
- var r = [];
250
- pause_children(t, r, !0), run_out_transitions(r, () => {
251
- destroy_effect(t), e && e();
252
- });
253
- }
254
- function run_out_transitions(t, e) {
255
- var r = t.length;
256
- if (r > 0) {
257
- var s = () => --r || e();
258
- for (var u of t)
259
- u.out(s);
260
- } else
261
- e();
262
- }
263
- function pause_children(t, e, r) {
264
- if (!(t.f & INERT)) {
265
- if (t.f ^= INERT, t.transitions !== null)
266
- for (const n of t.transitions)
267
- (n.is_global || r) && e.push(n);
268
- for (var s = t.first; s !== null; ) {
269
- var u = s.next, o = (s.f & EFFECT_TRANSPARENT) !== 0 || (s.f & BRANCH_EFFECT) !== 0;
270
- pause_children(s, e, o ? r : !1), s = u;
271
- }
272
- }
273
- }
274
- function resume_effect(t) {
275
- resume_children(t, !0);
276
- }
277
- function resume_children(t, e) {
278
- if (t.f & INERT) {
279
- t.f ^= INERT, check_dirtiness(t) && update_effect(t);
280
- for (var r = t.first; r !== null; ) {
281
- var s = r.next, u = (r.f & EFFECT_TRANSPARENT) !== 0 || (r.f & BRANCH_EFFECT) !== 0;
282
- resume_children(r, u ? e : !1), r = s;
283
- }
284
- if (t.transitions !== null)
285
- for (const o of t.transitions)
286
- (o.is_global || e) && o.in();
287
- }
288
- }
289
- let is_micro_task_queued$1 = !1, current_queued_micro_tasks = [];
290
- function process_micro_tasks() {
291
- is_micro_task_queued$1 = !1;
292
- const t = current_queued_micro_tasks.slice();
293
- current_queued_micro_tasks = [], run_all(t);
294
- }
295
- function queue_micro_task(t) {
296
- is_micro_task_queued$1 || (is_micro_task_queued$1 = !0, queueMicrotask(process_micro_tasks)), current_queued_micro_tasks.push(t);
297
- }
298
- function flush_tasks() {
299
- is_micro_task_queued$1 && process_micro_tasks();
300
- }
301
- const FLUSH_MICROTASK = 0, FLUSH_SYNC = 1;
302
- let scheduler_mode = FLUSH_MICROTASK, is_micro_task_queued = !1, is_flushing_effect = !1;
303
- function set_is_flushing_effect(t) {
304
- is_flushing_effect = t;
305
- }
306
- let queued_root_effects = [], flush_count = 0, dev_effect_stack = [], active_reaction = null;
307
- function set_active_reaction(t) {
308
- active_reaction = t;
309
- }
310
- let active_effect = null;
311
- function set_active_effect(t) {
312
- active_effect = t;
313
- }
314
- let derived_sources = null, new_deps = null, skipped_deps = 0, untracked_writes = null;
315
- function set_untracked_writes(t) {
316
- untracked_writes = t;
317
- }
318
- let current_version = 0, skip_reaction = !1, component_context = null;
319
- function set_component_context(t) {
320
- component_context = t;
321
- }
322
- function increment_version() {
323
- return ++current_version;
324
- }
325
- function is_runes() {
326
- return component_context !== null && component_context.l === null;
327
- }
328
- function check_dirtiness(t) {
329
- var n, a;
330
- var e = t.f;
331
- if (e & DIRTY)
332
- return !0;
333
- if (e & MAYBE_DIRTY) {
334
- var r = t.deps, s = (e & UNOWNED) !== 0;
335
- if (r !== null) {
336
- var u;
337
- if (e & DISCONNECTED) {
338
- for (u = 0; u < r.length; u++)
339
- ((n = r[u]).reactions ?? (n.reactions = [])).push(t);
340
- t.f ^= DISCONNECTED;
341
- }
342
- for (u = 0; u < r.length; u++) {
343
- var o = r[u];
344
- if (check_dirtiness(
345
- /** @type {Derived} */
346
- o
347
- ) && update_derived(
348
- /** @type {Derived} */
349
- o
350
- ), s && active_effect !== null && !skip_reaction && !((a = o == null ? void 0 : o.reactions) != null && a.includes(t)) && (o.reactions ?? (o.reactions = [])).push(t), o.version > t.version)
351
- return !0;
352
- }
353
- }
354
- s || set_signal_status(t, CLEAN);
355
- }
356
- return !1;
357
- }
358
- function handle_error(t, e, r) {
359
- throw t;
360
- }
361
- function update_reaction(t) {
362
- var d;
363
- var e = new_deps, r = skipped_deps, s = untracked_writes, u = active_reaction, o = skip_reaction, n = derived_sources, a = component_context, f = t.f;
364
- new_deps = /** @type {null | Value[]} */
365
- null, skipped_deps = 0, untracked_writes = null, active_reaction = f & (BRANCH_EFFECT | ROOT_EFFECT) ? null : t, skip_reaction = !is_flushing_effect && (f & UNOWNED) !== 0, derived_sources = null, component_context = t.ctx;
366
- try {
367
- var i = (
368
- /** @type {Function} */
369
- (0, t.fn)()
370
- ), c = t.deps;
371
- if (new_deps !== null) {
372
- var l;
373
- if (remove_reactions(t, skipped_deps), c !== null && skipped_deps > 0)
374
- for (c.length = skipped_deps + new_deps.length, l = 0; l < new_deps.length; l++)
375
- c[skipped_deps + l] = new_deps[l];
376
- else
377
- t.deps = c = new_deps;
378
- if (!skip_reaction)
379
- for (l = skipped_deps; l < c.length; l++)
380
- ((d = c[l]).reactions ?? (d.reactions = [])).push(t);
381
- } else c !== null && skipped_deps < c.length && (remove_reactions(t, skipped_deps), c.length = skipped_deps);
382
- return i;
383
- } finally {
384
- new_deps = e, skipped_deps = r, untracked_writes = s, active_reaction = u, skip_reaction = o, derived_sources = n, component_context = a;
385
- }
386
- }
387
- function remove_reaction(t, e) {
388
- let r = e.reactions;
389
- if (r !== null) {
390
- var s = r.indexOf(t);
391
- if (s !== -1) {
392
- var u = r.length - 1;
393
- u === 0 ? r = e.reactions = null : (r[s] = r[u], r.pop());
394
- }
395
- }
396
- r === null && e.f & DERIVED && // Destroying a child effect while updating a parent effect can cause a dependency to appear
397
- // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
398
- // allows us to skip the expensive work of disconnecting and immediately reconnecting it
399
- (new_deps === null || !new_deps.includes(e)) && (set_signal_status(e, MAYBE_DIRTY), e.f & (UNOWNED | DISCONNECTED) || (e.f ^= DISCONNECTED), remove_reactions(
400
- /** @type {Derived} **/
401
- e,
402
- 0
403
- ));
404
- }
405
- function remove_reactions(t, e) {
406
- var r = t.deps;
407
- if (r !== null)
408
- for (var s = e; s < r.length; s++)
409
- remove_reaction(t, r[s]);
410
- }
411
- function update_effect(t) {
412
- var e = t.f;
413
- if (!(e & DESTROYED)) {
414
- set_signal_status(t, CLEAN);
415
- var r = active_effect;
416
- active_effect = t;
417
- try {
418
- destroy_effect_deriveds(t), e & BLOCK_EFFECT ? destroy_block_effect_children(t) : destroy_effect_children(t), execute_effect_teardown(t);
419
- var s = update_reaction(t);
420
- t.teardown = typeof s == "function" ? s : null, t.version = current_version;
421
- } catch (u) {
422
- handle_error(
423
- /** @type {Error} */
424
- u
425
- );
426
- } finally {
427
- active_effect = r;
428
- }
429
- }
430
- }
431
- function infinite_loop_guard() {
432
- flush_count > 1e3 && (flush_count = 0, effect_update_depth_exceeded()), flush_count++;
433
- }
434
- function flush_queued_root_effects(t) {
435
- var e = t.length;
436
- if (e !== 0) {
437
- infinite_loop_guard();
438
- var r = is_flushing_effect;
439
- is_flushing_effect = !0;
440
- try {
441
- for (var s = 0; s < e; s++) {
442
- var u = t[s];
443
- u.f & CLEAN || (u.f ^= CLEAN);
444
- var o = [];
445
- process_effects(u, o), flush_queued_effects(o);
446
- }
447
- } finally {
448
- is_flushing_effect = r;
449
- }
450
- }
451
- }
452
- function flush_queued_effects(t) {
453
- var e = t.length;
454
- if (e !== 0)
455
- for (var r = 0; r < e; r++) {
456
- var s = t[r];
457
- !(s.f & (DESTROYED | INERT)) && check_dirtiness(s) && (update_effect(s), s.deps === null && s.first === null && s.nodes_start === null && (s.teardown === null ? unlink_effect(s) : s.fn = null));
458
- }
459
- }
460
- function process_deferred() {
461
- if (is_micro_task_queued = !1, flush_count > 1001)
462
- return;
463
- const t = queued_root_effects;
464
- queued_root_effects = [], flush_queued_root_effects(t), is_micro_task_queued || (flush_count = 0);
465
- }
466
- function schedule_effect(t) {
467
- scheduler_mode === FLUSH_MICROTASK && (is_micro_task_queued || (is_micro_task_queued = !0, queueMicrotask(process_deferred)));
468
- for (var e = t; e.parent !== null; ) {
469
- e = e.parent;
470
- var r = e.f;
471
- if (r & (ROOT_EFFECT | BRANCH_EFFECT)) {
472
- if (!(r & CLEAN)) return;
473
- e.f ^= CLEAN;
474
- }
475
- }
476
- queued_root_effects.push(e);
477
- }
478
- function process_effects(t, e) {
479
- var r = t.first, s = [];
480
- e: for (; r !== null; ) {
481
- var u = r.f, o = (u & BRANCH_EFFECT) !== 0, n = o && (u & CLEAN) !== 0;
482
- if (!n && !(u & INERT))
483
- if (u & RENDER_EFFECT) {
484
- o ? r.f ^= CLEAN : check_dirtiness(r) && update_effect(r);
485
- var a = r.first;
486
- if (a !== null) {
487
- r = a;
488
- continue;
489
- }
490
- } else u & EFFECT && s.push(r);
491
- var f = r.next;
492
- if (f === null) {
493
- let l = r.parent;
494
- for (; l !== null; ) {
495
- if (t === l)
496
- break e;
497
- var i = l.next;
498
- if (i !== null) {
499
- r = i;
500
- continue e;
501
- }
502
- l = l.parent;
503
- }
504
- }
505
- r = f;
506
- }
507
- for (var c = 0; c < s.length; c++)
508
- a = s[c], e.push(a), process_effects(a, e);
509
- }
510
- function flush_sync(t) {
511
- var e = scheduler_mode, r = queued_root_effects;
512
- try {
513
- infinite_loop_guard();
514
- const u = [];
515
- scheduler_mode = FLUSH_SYNC, queued_root_effects = u, is_micro_task_queued = !1, flush_queued_root_effects(r);
516
- var s = t == null ? void 0 : t();
517
- return flush_tasks(), (queued_root_effects.length > 0 || u.length > 0) && flush_sync(), flush_count = 0, s;
518
- } finally {
519
- scheduler_mode = e, queued_root_effects = r;
520
- }
521
- }
522
- function get$1(t) {
523
- var a;
524
- var e = t.f, r = (e & DERIVED) !== 0;
525
- if (r && e & DESTROYED) {
526
- var s = execute_derived(
527
- /** @type {Derived} */
528
- t
529
- );
530
- return destroy_derived(
531
- /** @type {Derived} */
532
- t
533
- ), s;
534
- }
535
- if (active_reaction !== null) {
536
- derived_sources !== null && derived_sources.includes(t) && state_unsafe_local_read();
537
- var u = active_reaction.deps;
538
- new_deps === null && u !== null && u[skipped_deps] === t ? skipped_deps++ : new_deps === null ? new_deps = [t] : new_deps.push(t), untracked_writes !== null && active_effect !== null && active_effect.f & CLEAN && !(active_effect.f & BRANCH_EFFECT) && untracked_writes.includes(t) && (set_signal_status(active_effect, DIRTY), schedule_effect(active_effect));
539
- } else if (r && /** @type {Derived} */
540
- t.deps === null) {
541
- var o = (
542
- /** @type {Derived} */
543
- t
544
- ), n = o.parent;
545
- n !== null && !((a = n.deriveds) != null && a.includes(o)) && (n.deriveds ?? (n.deriveds = [])).push(o);
546
- }
547
- return r && (o = /** @type {Derived} */
548
- t, check_dirtiness(o) && update_derived(o)), t.v;
549
- }
550
- function untrack(t) {
551
- const e = active_reaction;
552
- try {
553
- return active_reaction = null, t();
554
- } finally {
555
- active_reaction = e;
556
- }
557
- }
558
- const STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
559
- function set_signal_status(t, e) {
560
- t.f = t.f & STATUS_MASK | e;
561
- }
562
- function push(t, e = !1, r) {
563
- component_context = {
564
- p: component_context,
565
- c: null,
566
- e: null,
567
- m: !1,
568
- s: t,
569
- x: null,
570
- l: null
571
- }, e || (component_context.l = {
572
- s: null,
573
- u: null,
574
- r1: [],
575
- r2: source(!1)
576
- });
577
- }
578
- function pop(t) {
579
- const e = component_context;
580
- if (e !== null) {
581
- const n = e.e;
582
- if (n !== null) {
583
- var r = active_effect, s = active_reaction;
584
- e.e = null;
585
- try {
586
- for (var u = 0; u < n.length; u++) {
587
- var o = n[u];
588
- set_active_effect(o.effect), set_active_reaction(o.reaction), effect(o.fn);
589
- }
590
- } finally {
591
- set_active_effect(r), set_active_reaction(s);
592
- }
593
- }
594
- component_context = e.p, e.m = !0;
595
- }
596
- return (
597
- /** @type {T} */
598
- {}
599
- );
600
- }
601
- var $window, first_child_getter, next_sibling_getter;
602
- function init_operations() {
603
- if ($window === void 0) {
604
- $window = window;
605
- var t = Element.prototype, e = Node.prototype;
606
- first_child_getter = get_descriptor(e, "firstChild").get, next_sibling_getter = get_descriptor(e, "nextSibling").get, t.__click = void 0, t.__className = "", t.__attributes = null, t.__e = void 0, Text.prototype.__t = void 0;
607
- }
608
- }
609
- function create_text(t = "") {
610
- return document.createTextNode(t);
611
- }
612
- // @__NO_SIDE_EFFECTS__
613
- function get_first_child(t) {
614
- return first_child_getter.call(t);
615
- }
616
- // @__NO_SIDE_EFFECTS__
617
- function get_next_sibling(t) {
618
- return next_sibling_getter.call(t);
619
- }
620
- function child(t) {
621
- return /* @__PURE__ */ get_first_child(t);
622
- }
623
- function first_child(t, e) {
624
- {
625
- var r = (
626
- /** @type {DocumentFragment} */
627
- /* @__PURE__ */ get_first_child(
628
- /** @type {Node} */
629
- t
630
- )
631
- );
632
- return r instanceof Comment && r.data === "" ? /* @__PURE__ */ get_next_sibling(r) : r;
633
- }
634
- }
635
- const all_registered_events = /* @__PURE__ */ new Set(), root_event_handles = /* @__PURE__ */ new Set();
636
- function handle_event_propagation(t) {
637
- var _;
638
- var e = this, r = (
639
- /** @type {Node} */
640
- e.ownerDocument
641
- ), s = t.type, u = ((_ = t.composedPath) == null ? void 0 : _.call(t)) || [], o = (
642
- /** @type {null | Element} */
643
- u[0] || t.target
644
- ), n = 0, a = t.__root;
645
- if (a) {
646
- var f = u.indexOf(a);
647
- if (f !== -1 && (e === document || e === /** @type {any} */
648
- window)) {
649
- t.__root = e;
650
- return;
651
- }
652
- var i = u.indexOf(e);
653
- if (i === -1)
654
- return;
655
- f <= i && (n = f);
656
- }
657
- if (o = /** @type {Element} */
658
- u[n] || t.target, o !== e) {
659
- define_property(t, "currentTarget", {
660
- configurable: !0,
661
- get() {
662
- return o || r;
663
- }
664
- });
665
- var c = active_reaction, l = active_effect;
666
- set_active_reaction(null), set_active_effect(null);
667
- try {
668
- for (var d, h = []; o !== null; ) {
669
- var p = o.assignedSlot || o.parentNode || /** @type {any} */
670
- o.host || null;
671
- try {
672
- var v = o["__" + s];
673
- if (v !== void 0 && !/** @type {any} */
674
- o.disabled)
675
- if (is_array(v)) {
676
- var [g, ...m] = v;
677
- g.apply(o, [t, ...m]);
678
- } else
679
- v.call(o, t);
680
- } catch (y) {
681
- d ? h.push(y) : d = y;
682
- }
683
- if (t.cancelBubble || p === e || p === null)
684
- break;
685
- o = p;
686
- }
687
- if (d) {
688
- for (let y of h)
689
- queueMicrotask(() => {
690
- throw y;
691
- });
692
- throw d;
693
- }
694
- } finally {
695
- t.__root = e, delete t.currentTarget, set_active_reaction(c), set_active_effect(l);
696
- }
697
- }
698
- }
699
- function create_fragment_from_html(t) {
700
- var e = document.createElement("template");
701
- return e.innerHTML = t, e.content;
702
- }
703
- function assign_nodes(t, e) {
704
- var r = (
705
- /** @type {Effect} */
706
- active_effect
707
- );
708
- r.nodes_start === null && (r.nodes_start = t, r.nodes_end = e);
709
- }
710
- // @__NO_SIDE_EFFECTS__
711
- function template(t, e) {
712
- var r = (e & TEMPLATE_USE_IMPORT_NODE) !== 0, s, u = !t.startsWith("<!>");
713
- return () => {
714
- s === void 0 && (s = create_fragment_from_html(u ? t : "<!>" + t), s = /** @type {Node} */
715
- /* @__PURE__ */ get_first_child(s));
716
- var o = (
717
- /** @type {TemplateNode} */
718
- r ? document.importNode(s, !0) : s.cloneNode(!0)
719
- );
720
- return assign_nodes(o, o), o;
721
- };
722
- }
723
- function comment() {
724
- var t = document.createDocumentFragment(), e = document.createComment(""), r = create_text();
725
- return t.append(e, r), assign_nodes(e, r), t;
726
- }
727
- function append(t, e) {
728
- t !== null && t.before(
729
- /** @type {Node} */
730
- e
731
- );
732
- }
733
- const PASSIVE_EVENTS = ["touchstart", "touchmove"];
734
- function is_passive_event(t) {
735
- return PASSIVE_EVENTS.includes(t);
736
- }
737
- function set_text(t, e) {
738
- var r = e == null ? "" : typeof e == "object" ? e + "" : e;
739
- r !== (t.__t ?? (t.__t = t.nodeValue)) && (t.__t = r, t.nodeValue = r == null ? "" : r + "");
740
- }
741
- function mount(t, e) {
742
- return _mount(t, e);
743
- }
744
- const document_listeners = /* @__PURE__ */ new Map();
745
- function _mount(t, { target: e, anchor: r, props: s = {}, events: u, context: o, intro: n = !0 }) {
746
- init_operations();
747
- var a = /* @__PURE__ */ new Set(), f = (l) => {
748
- for (var d = 0; d < l.length; d++) {
749
- var h = l[d];
750
- if (!a.has(h)) {
751
- a.add(h);
752
- var p = is_passive_event(h);
753
- e.addEventListener(h, handle_event_propagation, { passive: p });
754
- var v = document_listeners.get(h);
755
- v === void 0 ? (document.addEventListener(h, handle_event_propagation, { passive: p }), document_listeners.set(h, 1)) : document_listeners.set(h, v + 1);
756
- }
757
- }
758
- };
759
- f(array_from(all_registered_events)), root_event_handles.add(f);
760
- var i = void 0, c = effect_root(() => {
761
- var l = r ?? e.appendChild(create_text());
762
- return branch(() => {
763
- if (o) {
764
- push({});
765
- var d = (
766
- /** @type {ComponentContext} */
767
- component_context
768
- );
769
- d.c = o;
770
- }
771
- u && (s.$$events = u), i = t(l, s) || {}, o && pop();
772
- }), () => {
773
- var p;
774
- for (var d of a) {
775
- e.removeEventListener(d, handle_event_propagation);
776
- var h = (
777
- /** @type {number} */
778
- document_listeners.get(d)
779
- );
780
- --h === 0 ? (document.removeEventListener(d, handle_event_propagation), document_listeners.delete(d)) : document_listeners.set(d, h);
781
- }
782
- root_event_handles.delete(f), mounted_components.delete(i), l !== r && ((p = l.parentNode) == null || p.removeChild(l));
783
- };
784
- });
785
- return mounted_components.set(i, c), i;
786
- }
787
- let mounted_components = /* @__PURE__ */ new WeakMap();
788
- function unmount(t) {
789
- const e = mounted_components.get(t);
790
- e && e();
791
- }
792
- const PENDING = 0, THEN = 1, CATCH = 2;
793
- function await_block(t, e, r, s, u) {
794
- var o = t, n = is_runes(), a = component_context, f, i, c, l, d = (n ? source : mutable_source)(
795
- /** @type {V} */
796
- void 0
797
- ), h = (n ? source : mutable_source)(void 0), p = !1;
798
- function v(m, _) {
799
- p = !0, _ && (set_active_effect(g), set_active_reaction(g), set_component_context(a)), m === PENDING && r && (i ? resume_effect(i) : i = branch(() => r(o))), m === THEN && s && (c ? resume_effect(c) : c = branch(() => s(o, d))), m === CATCH && u && (l ? resume_effect(l) : l = branch(() => u(o, h))), m !== PENDING && i && pause_effect(i, () => i = null), m !== THEN && c && pause_effect(c, () => c = null), m !== CATCH && l && pause_effect(l, () => l = null), _ && (set_component_context(null), set_active_reaction(null), set_active_effect(null), flush_sync());
800
- }
801
- var g = block(() => {
802
- if (f !== (f = e())) {
803
- if (is_promise(f)) {
804
- var m = f;
805
- p = !1, m.then(
806
- (_) => {
807
- m === f && (internal_set(d, _), v(THEN, !0));
808
- },
809
- (_) => {
810
- m === f && (internal_set(h, _), v(CATCH, !0));
811
- }
812
- ), queue_micro_task(() => {
813
- p || v(PENDING, !0);
814
- });
815
- } else
816
- internal_set(d, f), v(THEN, !1);
817
- return () => f = null;
818
- }
819
- });
820
- }
821
- function action(t, e, r) {
822
- effect(() => {
823
- var s = untrack(() => e(t, r == null ? void 0 : r()) || {});
824
- if (s != null && s.destroy)
825
- return () => (
826
- /** @type {Function} */
827
- s.destroy()
828
- );
829
- });
830
- }
831
- function subscribe_to_store(t, e, r) {
832
- if (t == null)
833
- return e(void 0), noop$1;
834
- const s = t.subscribe(
835
- e,
836
- // @ts-expect-error
837
- r
838
- );
839
- return s.unsubscribe ? () => s.unsubscribe() : s;
840
- }
841
- var I, W, S, C, D, M, $, k, V;
842
- let Service$1 = (V = class {
843
- constructor({ host: e, port: r }) {
844
- B(this, I);
845
- B(this, S);
846
- // 0 idle, 1 has connected, 2 keep reconnecting, 3 stopped
847
- B(this, C);
848
- B(this, D);
849
- B(this, M);
850
- B(this, $);
851
- B(this, k);
852
- T(this, $, `${e ?? "localhost"}${r != null ? `:${r}` : ""}`), T(this, S, 0), T(this, C, null), T(this, D, null), T(this, M, null), T(this, k, null);
853
- }
854
- on_message(e) {
855
- T(this, M, e);
856
- }
857
- on_connect(e) {
858
- T(this, C, e);
859
- }
860
- on_disconnect(e) {
861
- T(this, D, e);
862
- }
863
- // non-blocking (run is blocking in c++)
864
- // calling it again should not do anything
865
- start() {
866
- w(this, k) == null && w(this, S) !== 1 && w(this, S) !== 3 && (T(this, k, new WebSocket(`ws://${w(this, $)}`)), w(this, k).binaryType = "arraybuffer", w(this, k).onopen = () => {
867
- T(this, S, 1), w(this, C) && w(this, C).call(this, w(this, $));
868
- }, w(this, k).onclose = () => {
869
- w(this, S) === 1 && (w(this, D) && w(this, D).call(this, w(this, $)), T(this, S, 2), j(this, I, W).call(this));
870
- }, w(this, k).onerror = () => {
871
- w(this, S) !== 1 && w(this, S) !== 3 && (T(this, S, 2), j(this, I, W).call(this));
872
- }, w(this, k).onmessage = (e) => {
873
- w(this, M) && w(this, M).call(this, w(this, $), new Uint8Array(e.data));
874
- });
875
- }
876
- stop() {
877
- T(this, S, 3), w(this, k) != null && (w(this, k).close(), T(this, k, null));
878
- }
879
- restart() {
880
- T(this, S, 0);
881
- }
882
- publish(e) {
883
- w(this, k) != null && w(this, S) == 1 && w(this, k).send(e);
884
- }
885
- send(e, r) {
886
- e === w(this, $) && this.publish(r);
887
- }
888
- }, I = new WeakSet(), W = function() {
889
- w(this, k) != null && (w(this, k).close(), T(this, k, null)), setTimeout(() => this.start(), 1e3);
890
- }, S = new WeakMap(), C = new WeakMap(), D = new WeakMap(), M = new WeakMap(), $ = new WeakMap(), k = new WeakMap(), V);
891
- const header = (t) => {
892
- const e = new Uint8Array(4);
893
- return new DataView(e.buffer).setUint32(0, t, !1), e;
894
- }, concat = (t) => {
895
- const e = new Uint8Array(t.reduce((s, u) => s + u.length, 0));
896
- let r = 0;
897
- for (const s of t)
898
- e.set(s, r), r += s.length;
899
- return e;
900
- }, test_connection = async (t) => new Promise((e, r) => {
901
- const s = new Service$1(t), u = setTimeout(() => {
902
- s.stop(), r("connection failed... stopping");
903
- }, 2500);
904
- s.on_connect(() => {
905
- console.log("connection tested... proceeding"), clearTimeout(u), s.stop(), e();
906
- }), s.start();
907
- }), service_fetch = async (t, e, r) => new Promise((s, u) => {
908
- const o = new Service$1(t), n = setTimeout(() => {
909
- o.stop(), u("timed out, cancelled");
910
- }, 2500);
911
- o.on_connect(() => o.publish(e)), o.on_message((a, f) => {
912
- const i = new DataView(f.buffer).getUint32(0, !1), c = f.slice(4), l = r(i, c);
913
- l != null && (clearTimeout(n), o.stop(), s(l));
914
- }), o.start();
915
- }), service_publish = (t, e) => {
916
- const r = new Service$1(t), s = setTimeout(() => {
917
- r.stop();
918
- }, 2500);
919
- r.on_connect(() => {
920
- clearTimeout(s), r.publish(e), r.stop();
921
- }), r.start();
922
- };
923
- function WorkerWrapper(t) {
924
- return new Worker(
925
- "/assets/bundler.js",
926
- {
927
- name: t == null ? void 0 : t.name
928
- }
929
- );
930
- }
931
- var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
932
- function getDefaultExportFromCjs(t) {
933
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
934
- }
935
- var indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise = asPromise$1;
936
- function asPromise$1(t, e) {
937
- for (var r = new Array(arguments.length - 1), s = 0, u = 2, o = !0; u < arguments.length; )
938
- r[s++] = arguments[u++];
939
- return new Promise(function(a, f) {
940
- r[s] = function(c) {
941
- if (o)
942
- if (o = !1, c)
943
- f(c);
944
- else {
945
- for (var l = new Array(arguments.length - 1), d = 0; d < l.length; )
946
- l[d++] = arguments[d];
947
- a.apply(null, l);
948
- }
949
- };
950
- try {
951
- t.apply(e || null, r);
952
- } catch (i) {
953
- o && (o = !1, f(i));
954
- }
955
- });
956
- }
957
- var base64$1 = {};
958
- (function(t) {
959
- var e = t;
960
- e.length = function(a) {
961
- var f = a.length;
962
- if (!f)
963
- return 0;
964
- for (var i = 0; --f % 4 > 1 && a.charAt(f) === "="; )
965
- ++i;
966
- return Math.ceil(a.length * 3) / 4 - i;
967
- };
968
- for (var r = new Array(64), s = new Array(123), u = 0; u < 64; )
969
- s[r[u] = u < 26 ? u + 65 : u < 52 ? u + 71 : u < 62 ? u - 4 : u - 59 | 43] = u++;
970
- e.encode = function(a, f, i) {
971
- for (var c = null, l = [], d = 0, h = 0, p; f < i; ) {
972
- var v = a[f++];
973
- switch (h) {
974
- case 0:
975
- l[d++] = r[v >> 2], p = (v & 3) << 4, h = 1;
976
- break;
977
- case 1:
978
- l[d++] = r[p | v >> 4], p = (v & 15) << 2, h = 2;
979
- break;
980
- case 2:
981
- l[d++] = r[p | v >> 6], l[d++] = r[v & 63], h = 0;
982
- break;
983
- }
984
- d > 8191 && ((c || (c = [])).push(String.fromCharCode.apply(String, l)), d = 0);
985
- }
986
- return h && (l[d++] = r[p], l[d++] = 61, h === 1 && (l[d++] = 61)), c ? (d && c.push(String.fromCharCode.apply(String, l.slice(0, d))), c.join("")) : String.fromCharCode.apply(String, l.slice(0, d));
987
- };
988
- var o = "invalid encoding";
989
- e.decode = function(a, f, i) {
990
- for (var c = i, l = 0, d, h = 0; h < a.length; ) {
991
- var p = a.charCodeAt(h++);
992
- if (p === 61 && l > 1)
993
- break;
994
- if ((p = s[p]) === void 0)
995
- throw Error(o);
996
- switch (l) {
997
- case 0:
998
- d = p, l = 1;
999
- break;
1000
- case 1:
1001
- f[i++] = d << 2 | (p & 48) >> 4, d = p, l = 2;
1002
- break;
1003
- case 2:
1004
- f[i++] = (d & 15) << 4 | (p & 60) >> 2, d = p, l = 3;
1005
- break;
1006
- case 3:
1007
- f[i++] = (d & 3) << 6 | p, l = 0;
1008
- break;
1009
- }
1010
- }
1011
- if (l === 1)
1012
- throw Error(o);
1013
- return i - c;
1014
- }, e.test = function(a) {
1015
- return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a);
1016
- };
1017
- })(base64$1);
1018
- var eventemitter = EventEmitter;
1019
- function EventEmitter() {
1020
- this._listeners = {};
1021
- }
1022
- EventEmitter.prototype.on = function(e, r, s) {
1023
- return (this._listeners[e] || (this._listeners[e] = [])).push({
1024
- fn: r,
1025
- ctx: s || this
1026
- }), this;
1027
- };
1028
- EventEmitter.prototype.off = function(e, r) {
1029
- if (e === void 0)
1030
- this._listeners = {};
1031
- else if (r === void 0)
1032
- this._listeners[e] = [];
1033
- else
1034
- for (var s = this._listeners[e], u = 0; u < s.length; )
1035
- s[u].fn === r ? s.splice(u, 1) : ++u;
1036
- return this;
1037
- };
1038
- EventEmitter.prototype.emit = function(e) {
1039
- var r = this._listeners[e];
1040
- if (r) {
1041
- for (var s = [], u = 1; u < arguments.length; )
1042
- s.push(arguments[u++]);
1043
- for (u = 0; u < r.length; )
1044
- r[u].fn.apply(r[u++].ctx, s);
1045
- }
1046
- return this;
1047
- };
1048
- var float = factory(factory);
1049
- function factory(t) {
1050
- return typeof Float32Array < "u" ? function() {
1051
- var e = new Float32Array([-0]), r = new Uint8Array(e.buffer), s = r[3] === 128;
1052
- function u(f, i, c) {
1053
- e[0] = f, i[c] = r[0], i[c + 1] = r[1], i[c + 2] = r[2], i[c + 3] = r[3];
1054
- }
1055
- function o(f, i, c) {
1056
- e[0] = f, i[c] = r[3], i[c + 1] = r[2], i[c + 2] = r[1], i[c + 3] = r[0];
1057
- }
1058
- t.writeFloatLE = s ? u : o, t.writeFloatBE = s ? o : u;
1059
- function n(f, i) {
1060
- return r[0] = f[i], r[1] = f[i + 1], r[2] = f[i + 2], r[3] = f[i + 3], e[0];
1061
- }
1062
- function a(f, i) {
1063
- return r[3] = f[i], r[2] = f[i + 1], r[1] = f[i + 2], r[0] = f[i + 3], e[0];
1064
- }
1065
- t.readFloatLE = s ? n : a, t.readFloatBE = s ? a : n;
1066
- }() : function() {
1067
- function e(s, u, o, n) {
1068
- var a = u < 0 ? 1 : 0;
1069
- if (a && (u = -u), u === 0)
1070
- s(1 / u > 0 ? (
1071
- /* positive */
1072
- 0
1073
- ) : (
1074
- /* negative 0 */
1075
- 2147483648
1076
- ), o, n);
1077
- else if (isNaN(u))
1078
- s(2143289344, o, n);
1079
- else if (u > 34028234663852886e22)
1080
- s((a << 31 | 2139095040) >>> 0, o, n);
1081
- else if (u < 11754943508222875e-54)
1082
- s((a << 31 | Math.round(u / 1401298464324817e-60)) >>> 0, o, n);
1083
- else {
1084
- var f = Math.floor(Math.log(u) / Math.LN2), i = Math.round(u * Math.pow(2, -f) * 8388608) & 8388607;
1085
- s((a << 31 | f + 127 << 23 | i) >>> 0, o, n);
1086
- }
1087
- }
1088
- t.writeFloatLE = e.bind(null, writeUintLE), t.writeFloatBE = e.bind(null, writeUintBE);
1089
- function r(s, u, o) {
1090
- var n = s(u, o), a = (n >> 31) * 2 + 1, f = n >>> 23 & 255, i = n & 8388607;
1091
- return f === 255 ? i ? NaN : a * (1 / 0) : f === 0 ? a * 1401298464324817e-60 * i : a * Math.pow(2, f - 150) * (i + 8388608);
1092
- }
1093
- t.readFloatLE = r.bind(null, readUintLE), t.readFloatBE = r.bind(null, readUintBE);
1094
- }(), typeof Float64Array < "u" ? function() {
1095
- var e = new Float64Array([-0]), r = new Uint8Array(e.buffer), s = r[7] === 128;
1096
- function u(f, i, c) {
1097
- e[0] = f, i[c] = r[0], i[c + 1] = r[1], i[c + 2] = r[2], i[c + 3] = r[3], i[c + 4] = r[4], i[c + 5] = r[5], i[c + 6] = r[6], i[c + 7] = r[7];
1098
- }
1099
- function o(f, i, c) {
1100
- e[0] = f, i[c] = r[7], i[c + 1] = r[6], i[c + 2] = r[5], i[c + 3] = r[4], i[c + 4] = r[3], i[c + 5] = r[2], i[c + 6] = r[1], i[c + 7] = r[0];
1101
- }
1102
- t.writeDoubleLE = s ? u : o, t.writeDoubleBE = s ? o : u;
1103
- function n(f, i) {
1104
- return r[0] = f[i], r[1] = f[i + 1], r[2] = f[i + 2], r[3] = f[i + 3], r[4] = f[i + 4], r[5] = f[i + 5], r[6] = f[i + 6], r[7] = f[i + 7], e[0];
1105
- }
1106
- function a(f, i) {
1107
- return r[7] = f[i], r[6] = f[i + 1], r[5] = f[i + 2], r[4] = f[i + 3], r[3] = f[i + 4], r[2] = f[i + 5], r[1] = f[i + 6], r[0] = f[i + 7], e[0];
1108
- }
1109
- t.readDoubleLE = s ? n : a, t.readDoubleBE = s ? a : n;
1110
- }() : function() {
1111
- function e(s, u, o, n, a, f) {
1112
- var i = n < 0 ? 1 : 0;
1113
- if (i && (n = -n), n === 0)
1114
- s(0, a, f + u), s(1 / n > 0 ? (
1115
- /* positive */
1116
- 0
1117
- ) : (
1118
- /* negative 0 */
1119
- 2147483648
1120
- ), a, f + o);
1121
- else if (isNaN(n))
1122
- s(0, a, f + u), s(2146959360, a, f + o);
1123
- else if (n > 17976931348623157e292)
1124
- s(0, a, f + u), s((i << 31 | 2146435072) >>> 0, a, f + o);
1125
- else {
1126
- var c;
1127
- if (n < 22250738585072014e-324)
1128
- c = n / 5e-324, s(c >>> 0, a, f + u), s((i << 31 | c / 4294967296) >>> 0, a, f + o);
1129
- else {
1130
- var l = Math.floor(Math.log(n) / Math.LN2);
1131
- l === 1024 && (l = 1023), c = n * Math.pow(2, -l), s(c * 4503599627370496 >>> 0, a, f + u), s((i << 31 | l + 1023 << 20 | c * 1048576 & 1048575) >>> 0, a, f + o);
1132
- }
1133
- }
1134
- }
1135
- t.writeDoubleLE = e.bind(null, writeUintLE, 0, 4), t.writeDoubleBE = e.bind(null, writeUintBE, 4, 0);
1136
- function r(s, u, o, n, a) {
1137
- var f = s(n, a + u), i = s(n, a + o), c = (i >> 31) * 2 + 1, l = i >>> 20 & 2047, d = 4294967296 * (i & 1048575) + f;
1138
- return l === 2047 ? d ? NaN : c * (1 / 0) : l === 0 ? c * 5e-324 * d : c * Math.pow(2, l - 1075) * (d + 4503599627370496);
1139
- }
1140
- t.readDoubleLE = r.bind(null, readUintLE, 0, 4), t.readDoubleBE = r.bind(null, readUintBE, 4, 0);
1141
- }(), t;
1142
- }
1143
- function writeUintLE(t, e, r) {
1144
- e[r] = t & 255, e[r + 1] = t >>> 8 & 255, e[r + 2] = t >>> 16 & 255, e[r + 3] = t >>> 24;
1145
- }
1146
- function writeUintBE(t, e, r) {
1147
- e[r] = t >>> 24, e[r + 1] = t >>> 16 & 255, e[r + 2] = t >>> 8 & 255, e[r + 3] = t & 255;
1148
- }
1149
- function readUintLE(t, e) {
1150
- return (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0;
1151
- }
1152
- function readUintBE(t, e) {
1153
- return (t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]) >>> 0;
1154
- }
1155
- var inquire_1 = inquire$1;
1156
- function inquire$1(moduleName) {
1157
- try {
1158
- var mod = eval("quire".replace(/^/, "re"))(moduleName);
1159
- if (mod && (mod.length || Object.keys(mod).length))
1160
- return mod;
1161
- } catch (t) {
1162
- }
1163
- return null;
1164
- }
1165
- var utf8$2 = {};
1166
- (function(t) {
1167
- var e = t;
1168
- e.length = function(s) {
1169
- for (var u = 0, o = 0, n = 0; n < s.length; ++n)
1170
- o = s.charCodeAt(n), o < 128 ? u += 1 : o < 2048 ? u += 2 : (o & 64512) === 55296 && (s.charCodeAt(n + 1) & 64512) === 56320 ? (++n, u += 4) : u += 3;
1171
- return u;
1172
- }, e.read = function(s, u, o) {
1173
- var n = o - u;
1174
- if (n < 1)
1175
- return "";
1176
- for (var a = null, f = [], i = 0, c; u < o; )
1177
- c = s[u++], c < 128 ? f[i++] = c : c > 191 && c < 224 ? f[i++] = (c & 31) << 6 | s[u++] & 63 : c > 239 && c < 365 ? (c = ((c & 7) << 18 | (s[u++] & 63) << 12 | (s[u++] & 63) << 6 | s[u++] & 63) - 65536, f[i++] = 55296 + (c >> 10), f[i++] = 56320 + (c & 1023)) : f[i++] = (c & 15) << 12 | (s[u++] & 63) << 6 | s[u++] & 63, i > 8191 && ((a || (a = [])).push(String.fromCharCode.apply(String, f)), i = 0);
1178
- return a ? (i && a.push(String.fromCharCode.apply(String, f.slice(0, i))), a.join("")) : String.fromCharCode.apply(String, f.slice(0, i));
1179
- }, e.write = function(s, u, o) {
1180
- for (var n = o, a, f, i = 0; i < s.length; ++i)
1181
- a = s.charCodeAt(i), a < 128 ? u[o++] = a : a < 2048 ? (u[o++] = a >> 6 | 192, u[o++] = a & 63 | 128) : (a & 64512) === 55296 && ((f = s.charCodeAt(i + 1)) & 64512) === 56320 ? (a = 65536 + ((a & 1023) << 10) + (f & 1023), ++i, u[o++] = a >> 18 | 240, u[o++] = a >> 12 & 63 | 128, u[o++] = a >> 6 & 63 | 128, u[o++] = a & 63 | 128) : (u[o++] = a >> 12 | 224, u[o++] = a >> 6 & 63 | 128, u[o++] = a & 63 | 128);
1182
- return o - n;
1183
- };
1184
- })(utf8$2);
1185
- var pool_1 = pool;
1186
- function pool(t, e, r) {
1187
- var s = r || 8192, u = s >>> 1, o = null, n = s;
1188
- return function(f) {
1189
- if (f < 1 || f > u)
1190
- return t(f);
1191
- n + f > s && (o = t(s), n = 0);
1192
- var i = e.call(o, n, n += f);
1193
- return n & 7 && (n = (n | 7) + 1), i;
1194
- };
1195
- }
1196
- var longbits, hasRequiredLongbits;
1197
- function requireLongbits() {
1198
- if (hasRequiredLongbits) return longbits;
1199
- hasRequiredLongbits = 1, longbits = e;
1200
- var t = requireMinimal();
1201
- function e(o, n) {
1202
- this.lo = o >>> 0, this.hi = n >>> 0;
1203
- }
1204
- var r = e.zero = new e(0, 0);
1205
- r.toNumber = function() {
1206
- return 0;
1207
- }, r.zzEncode = r.zzDecode = function() {
1208
- return this;
1209
- }, r.length = function() {
1210
- return 1;
1211
- };
1212
- var s = e.zeroHash = "\0\0\0\0\0\0\0\0";
1213
- e.fromNumber = function(n) {
1214
- if (n === 0)
1215
- return r;
1216
- var a = n < 0;
1217
- a && (n = -n);
1218
- var f = n >>> 0, i = (n - f) / 4294967296 >>> 0;
1219
- return a && (i = ~i >>> 0, f = ~f >>> 0, ++f > 4294967295 && (f = 0, ++i > 4294967295 && (i = 0))), new e(f, i);
1220
- }, e.from = function(n) {
1221
- if (typeof n == "number")
1222
- return e.fromNumber(n);
1223
- if (t.isString(n))
1224
- if (t.Long)
1225
- n = t.Long.fromString(n);
1226
- else
1227
- return e.fromNumber(parseInt(n, 10));
1228
- return n.low || n.high ? new e(n.low >>> 0, n.high >>> 0) : r;
1229
- }, e.prototype.toNumber = function(n) {
1230
- if (!n && this.hi >>> 31) {
1231
- var a = ~this.lo + 1 >>> 0, f = ~this.hi >>> 0;
1232
- return a || (f = f + 1 >>> 0), -(a + f * 4294967296);
1233
- }
1234
- return this.lo + this.hi * 4294967296;
1235
- }, e.prototype.toLong = function(n) {
1236
- return t.Long ? new t.Long(this.lo | 0, this.hi | 0, !!n) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!n };
1237
- };
1238
- var u = String.prototype.charCodeAt;
1239
- return e.fromHash = function(n) {
1240
- return n === s ? r : new e(
1241
- (u.call(n, 0) | u.call(n, 1) << 8 | u.call(n, 2) << 16 | u.call(n, 3) << 24) >>> 0,
1242
- (u.call(n, 4) | u.call(n, 5) << 8 | u.call(n, 6) << 16 | u.call(n, 7) << 24) >>> 0
1243
- );
1244
- }, e.prototype.toHash = function() {
1245
- return String.fromCharCode(
1246
- this.lo & 255,
1247
- this.lo >>> 8 & 255,
1248
- this.lo >>> 16 & 255,
1249
- this.lo >>> 24,
1250
- this.hi & 255,
1251
- this.hi >>> 8 & 255,
1252
- this.hi >>> 16 & 255,
1253
- this.hi >>> 24
1254
- );
1255
- }, e.prototype.zzEncode = function() {
1256
- var n = this.hi >> 31;
1257
- return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ n) >>> 0, this.lo = (this.lo << 1 ^ n) >>> 0, this;
1258
- }, e.prototype.zzDecode = function() {
1259
- var n = -(this.lo & 1);
1260
- return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ n) >>> 0, this.hi = (this.hi >>> 1 ^ n) >>> 0, this;
1261
- }, e.prototype.length = function() {
1262
- var n = this.lo, a = (this.lo >>> 28 | this.hi << 4) >>> 0, f = this.hi >>> 24;
1263
- return f === 0 ? a === 0 ? n < 16384 ? n < 128 ? 1 : 2 : n < 2097152 ? 3 : 4 : a < 16384 ? a < 128 ? 5 : 6 : a < 2097152 ? 7 : 8 : f < 128 ? 9 : 10;
1264
- }, longbits;
1265
- }
1266
- var hasRequiredMinimal;
1267
- function requireMinimal() {
1268
- return hasRequiredMinimal || (hasRequiredMinimal = 1, function(t) {
1269
- var e = t;
1270
- e.asPromise = aspromise, e.base64 = base64$1, e.EventEmitter = eventemitter, e.float = float, e.inquire = inquire_1, e.utf8 = utf8$2, e.pool = pool_1, e.LongBits = requireLongbits(), e.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), e.global = e.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || commonjsGlobal, e.emptyArray = Object.freeze ? Object.freeze([]) : (
1271
- /* istanbul ignore next */
1272
- []
1273
- ), e.emptyObject = Object.freeze ? Object.freeze({}) : (
1274
- /* istanbul ignore next */
1275
- {}
1276
- ), e.isInteger = Number.isInteger || /* istanbul ignore next */
1277
- function(o) {
1278
- return typeof o == "number" && isFinite(o) && Math.floor(o) === o;
1279
- }, e.isString = function(o) {
1280
- return typeof o == "string" || o instanceof String;
1281
- }, e.isObject = function(o) {
1282
- return o && typeof o == "object";
1283
- }, e.isset = /**
1284
- * Checks if a property on a message is considered to be present.
1285
- * @param {Object} obj Plain object or message instance
1286
- * @param {string} prop Property name
1287
- * @returns {boolean} `true` if considered to be present, otherwise `false`
1288
- */
1289
- e.isSet = function(o, n) {
1290
- var a = o[n];
1291
- return a != null && o.hasOwnProperty(n) ? typeof a != "object" || (Array.isArray(a) ? a.length : Object.keys(a).length) > 0 : !1;
1292
- }, e.Buffer = function() {
1293
- try {
1294
- var u = e.inquire("buffer").Buffer;
1295
- return u.prototype.utf8Write ? u : (
1296
- /* istanbul ignore next */
1297
- null
1298
- );
1299
- } catch {
1300
- return null;
1301
- }
1302
- }(), e._Buffer_from = null, e._Buffer_allocUnsafe = null, e.newBuffer = function(o) {
1303
- return typeof o == "number" ? e.Buffer ? e._Buffer_allocUnsafe(o) : new e.Array(o) : e.Buffer ? e._Buffer_from(o) : typeof Uint8Array > "u" ? o : new Uint8Array(o);
1304
- }, e.Array = typeof Uint8Array < "u" ? Uint8Array : Array, e.Long = /* istanbul ignore next */
1305
- e.global.dcodeIO && /* istanbul ignore next */
1306
- e.global.dcodeIO.Long || /* istanbul ignore next */
1307
- e.global.Long || e.inquire("long"), e.key2Re = /^true|false|0|1$/, e.key32Re = /^-?(?:0|[1-9][0-9]*)$/, e.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, e.longToHash = function(o) {
1308
- return o ? e.LongBits.from(o).toHash() : e.LongBits.zeroHash;
1309
- }, e.longFromHash = function(o, n) {
1310
- var a = e.LongBits.fromHash(o);
1311
- return e.Long ? e.Long.fromBits(a.lo, a.hi, n) : a.toNumber(!!n);
1312
- };
1313
- function r(u, o, n) {
1314
- for (var a = Object.keys(o), f = 0; f < a.length; ++f)
1315
- (u[a[f]] === void 0 || !n) && (u[a[f]] = o[a[f]]);
1316
- return u;
1317
- }
1318
- e.merge = r, e.lcFirst = function(o) {
1319
- return o.charAt(0).toLowerCase() + o.substring(1);
1320
- };
1321
- function s(u) {
1322
- function o(n, a) {
1323
- if (!(this instanceof o))
1324
- return new o(n, a);
1325
- Object.defineProperty(this, "message", { get: function() {
1326
- return n;
1327
- } }), Error.captureStackTrace ? Error.captureStackTrace(this, o) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), a && r(this, a);
1328
- }
1329
- return o.prototype = Object.create(Error.prototype, {
1330
- constructor: {
1331
- value: o,
1332
- writable: !0,
1333
- enumerable: !1,
1334
- configurable: !0
1335
- },
1336
- name: {
1337
- get: function() {
1338
- return u;
1339
- },
1340
- set: void 0,
1341
- enumerable: !1,
1342
- // configurable: false would accurately preserve the behavior of
1343
- // the original, but I'm guessing that was not intentional.
1344
- // For an actual error subclass, this property would
1345
- // be configurable.
1346
- configurable: !0
1347
- },
1348
- toString: {
1349
- value: function() {
1350
- return this.name + ": " + this.message;
1351
- },
1352
- writable: !0,
1353
- enumerable: !1,
1354
- configurable: !0
1355
- }
1356
- }), o;
1357
- }
1358
- e.newError = s, e.ProtocolError = s("ProtocolError"), e.oneOfGetter = function(o) {
1359
- for (var n = {}, a = 0; a < o.length; ++a)
1360
- n[o[a]] = 1;
1361
- return function() {
1362
- for (var f = Object.keys(this), i = f.length - 1; i > -1; --i)
1363
- if (n[f[i]] === 1 && this[f[i]] !== void 0 && this[f[i]] !== null)
1364
- return f[i];
1365
- };
1366
- }, e.oneOfSetter = function(o) {
1367
- return function(n) {
1368
- for (var a = 0; a < o.length; ++a)
1369
- o[a] !== n && delete this[o[a]];
1370
- };
1371
- }, e.toJSONOptions = {
1372
- longs: String,
1373
- enums: String,
1374
- bytes: String,
1375
- json: !0
1376
- }, e._configure = function() {
1377
- var u = e.Buffer;
1378
- if (!u) {
1379
- e._Buffer_from = e._Buffer_allocUnsafe = null;
1380
- return;
1381
- }
1382
- e._Buffer_from = u.from !== Uint8Array.from && u.from || /* istanbul ignore next */
1383
- function(n, a) {
1384
- return new u(n, a);
1385
- }, e._Buffer_allocUnsafe = u.allocUnsafe || /* istanbul ignore next */
1386
- function(n) {
1387
- return new u(n);
1388
- };
1389
- };
1390
- }(minimal)), minimal;
1391
- }
1392
- var writer = Writer$1, util$6 = requireMinimal(), BufferWriter$1, LongBits$1 = util$6.LongBits, base64 = util$6.base64, utf8$1 = util$6.utf8;
1393
- function Op(t, e, r) {
1394
- this.fn = t, this.len = e, this.next = void 0, this.val = r;
1395
- }
1396
- function noop() {
1397
- }
1398
- function State(t) {
1399
- this.head = t.head, this.tail = t.tail, this.len = t.len, this.next = t.states;
1400
- }
1401
- function Writer$1() {
1402
- this.len = 0, this.head = new Op(noop, 0, 0), this.tail = this.head, this.states = null;
1403
- }
1404
- var create$1 = function t() {
1405
- return util$6.Buffer ? function() {
1406
- return (Writer$1.create = function() {
1407
- return new BufferWriter$1();
1408
- })();
1409
- } : function() {
1410
- return new Writer$1();
1411
- };
1412
- };
1413
- Writer$1.create = create$1();
1414
- Writer$1.alloc = function t(e) {
1415
- return new util$6.Array(e);
1416
- };
1417
- util$6.Array !== Array && (Writer$1.alloc = util$6.pool(Writer$1.alloc, util$6.Array.prototype.subarray));
1418
- Writer$1.prototype._push = function t(e, r, s) {
1419
- return this.tail = this.tail.next = new Op(e, r, s), this.len += r, this;
1420
- };
1421
- function writeByte(t, e, r) {
1422
- e[r] = t & 255;
1423
- }
1424
- function writeVarint32(t, e, r) {
1425
- for (; t > 127; )
1426
- e[r++] = t & 127 | 128, t >>>= 7;
1427
- e[r] = t;
1428
- }
1429
- function VarintOp(t, e) {
1430
- this.len = t, this.next = void 0, this.val = e;
1431
- }
1432
- VarintOp.prototype = Object.create(Op.prototype);
1433
- VarintOp.prototype.fn = writeVarint32;
1434
- Writer$1.prototype.uint32 = function t(e) {
1435
- return this.len += (this.tail = this.tail.next = new VarintOp(
1436
- (e = e >>> 0) < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5,
1437
- e
1438
- )).len, this;
1439
- };
1440
- Writer$1.prototype.int32 = function t(e) {
1441
- return e < 0 ? this._push(writeVarint64, 10, LongBits$1.fromNumber(e)) : this.uint32(e);
1442
- };
1443
- Writer$1.prototype.sint32 = function t(e) {
1444
- return this.uint32((e << 1 ^ e >> 31) >>> 0);
1445
- };
1446
- function writeVarint64(t, e, r) {
1447
- for (; t.hi; )
1448
- e[r++] = t.lo & 127 | 128, t.lo = (t.lo >>> 7 | t.hi << 25) >>> 0, t.hi >>>= 7;
1449
- for (; t.lo > 127; )
1450
- e[r++] = t.lo & 127 | 128, t.lo = t.lo >>> 7;
1451
- e[r++] = t.lo;
1452
- }
1453
- Writer$1.prototype.uint64 = function t(e) {
1454
- var r = LongBits$1.from(e);
1455
- return this._push(writeVarint64, r.length(), r);
1456
- };
1457
- Writer$1.prototype.int64 = Writer$1.prototype.uint64;
1458
- Writer$1.prototype.sint64 = function t(e) {
1459
- var r = LongBits$1.from(e).zzEncode();
1460
- return this._push(writeVarint64, r.length(), r);
1461
- };
1462
- Writer$1.prototype.bool = function t(e) {
1463
- return this._push(writeByte, 1, e ? 1 : 0);
1464
- };
1465
- function writeFixed32(t, e, r) {
1466
- e[r] = t & 255, e[r + 1] = t >>> 8 & 255, e[r + 2] = t >>> 16 & 255, e[r + 3] = t >>> 24;
1467
- }
1468
- Writer$1.prototype.fixed32 = function t(e) {
1469
- return this._push(writeFixed32, 4, e >>> 0);
1470
- };
1471
- Writer$1.prototype.sfixed32 = Writer$1.prototype.fixed32;
1472
- Writer$1.prototype.fixed64 = function t(e) {
1473
- var r = LongBits$1.from(e);
1474
- return this._push(writeFixed32, 4, r.lo)._push(writeFixed32, 4, r.hi);
1475
- };
1476
- Writer$1.prototype.sfixed64 = Writer$1.prototype.fixed64;
1477
- Writer$1.prototype.float = function t(e) {
1478
- return this._push(util$6.float.writeFloatLE, 4, e);
1479
- };
1480
- Writer$1.prototype.double = function t(e) {
1481
- return this._push(util$6.float.writeDoubleLE, 8, e);
1482
- };
1483
- var writeBytes = util$6.Array.prototype.set ? function t(e, r, s) {
1484
- r.set(e, s);
1485
- } : function t(e, r, s) {
1486
- for (var u = 0; u < e.length; ++u)
1487
- r[s + u] = e[u];
1488
- };
1489
- Writer$1.prototype.bytes = function t(e) {
1490
- var r = e.length >>> 0;
1491
- if (!r)
1492
- return this._push(writeByte, 1, 0);
1493
- if (util$6.isString(e)) {
1494
- var s = Writer$1.alloc(r = base64.length(e));
1495
- base64.decode(e, s, 0), e = s;
1496
- }
1497
- return this.uint32(r)._push(writeBytes, r, e);
1498
- };
1499
- Writer$1.prototype.string = function t(e) {
1500
- var r = utf8$1.length(e);
1501
- return r ? this.uint32(r)._push(utf8$1.write, r, e) : this._push(writeByte, 1, 0);
1502
- };
1503
- Writer$1.prototype.fork = function t() {
1504
- return this.states = new State(this), this.head = this.tail = new Op(noop, 0, 0), this.len = 0, this;
1505
- };
1506
- Writer$1.prototype.reset = function t() {
1507
- return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new Op(noop, 0, 0), this.len = 0), this;
1508
- };
1509
- Writer$1.prototype.ldelim = function t() {
1510
- var e = this.head, r = this.tail, s = this.len;
1511
- return this.reset().uint32(s), s && (this.tail.next = e.next, this.tail = r, this.len += s), this;
1512
- };
1513
- Writer$1.prototype.finish = function t() {
1514
- for (var e = this.head.next, r = this.constructor.alloc(this.len), s = 0; e; )
1515
- e.fn(e.val, r, s), s += e.len, e = e.next;
1516
- return r;
1517
- };
1518
- Writer$1._configure = function(t) {
1519
- BufferWriter$1 = t, Writer$1.create = create$1(), BufferWriter$1._configure();
1520
- };
1521
- var writer_buffer = BufferWriter, Writer = writer;
1522
- (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
1523
- var util$5 = requireMinimal();
1524
- function BufferWriter() {
1525
- Writer.call(this);
1526
- }
1527
- BufferWriter._configure = function() {
1528
- BufferWriter.alloc = util$5._Buffer_allocUnsafe, BufferWriter.writeBytesBuffer = util$5.Buffer && util$5.Buffer.prototype instanceof Uint8Array && util$5.Buffer.prototype.set.name === "set" ? function(e, r, s) {
1529
- r.set(e, s);
1530
- } : function(e, r, s) {
1531
- if (e.copy)
1532
- e.copy(r, s, 0, e.length);
1533
- else for (var u = 0; u < e.length; )
1534
- r[s++] = e[u++];
1535
- };
1536
- };
1537
- BufferWriter.prototype.bytes = function t(e) {
1538
- util$5.isString(e) && (e = util$5._Buffer_from(e, "base64"));
1539
- var r = e.length >>> 0;
1540
- return this.uint32(r), r && this._push(BufferWriter.writeBytesBuffer, r, e), this;
1541
- };
1542
- function writeStringBuffer(t, e, r) {
1543
- t.length < 40 ? util$5.utf8.write(t, e, r) : e.utf8Write ? e.utf8Write(t, r) : e.write(t, r);
1544
- }
1545
- BufferWriter.prototype.string = function t(e) {
1546
- var r = util$5.Buffer.byteLength(e);
1547
- return this.uint32(r), r && this._push(writeStringBuffer, r, e), this;
1548
- };
1549
- BufferWriter._configure();
1550
- var reader = Reader$1, util$4 = requireMinimal(), BufferReader$1, LongBits = util$4.LongBits, utf8 = util$4.utf8;
1551
- function indexOutOfRange(t, e) {
1552
- return RangeError("index out of range: " + t.pos + " + " + (e || 1) + " > " + t.len);
1553
- }
1554
- function Reader$1(t) {
1555
- this.buf = t, this.pos = 0, this.len = t.length;
1556
- }
1557
- var create_array = typeof Uint8Array < "u" ? function t(e) {
1558
- if (e instanceof Uint8Array || Array.isArray(e))
1559
- return new Reader$1(e);
1560
- throw Error("illegal buffer");
1561
- } : function t(e) {
1562
- if (Array.isArray(e))
1563
- return new Reader$1(e);
1564
- throw Error("illegal buffer");
1565
- }, create = function t() {
1566
- return util$4.Buffer ? function(r) {
1567
- return (Reader$1.create = function(u) {
1568
- return util$4.Buffer.isBuffer(u) ? new BufferReader$1(u) : create_array(u);
1569
- })(r);
1570
- } : create_array;
1571
- };
1572
- Reader$1.create = create();
1573
- Reader$1.prototype._slice = util$4.Array.prototype.subarray || /* istanbul ignore next */
1574
- util$4.Array.prototype.slice;
1575
- Reader$1.prototype.uint32 = /* @__PURE__ */ function t() {
1576
- var e = 4294967295;
1577
- return function() {
1578
- if (e = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (e = (e | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (e = (e | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (e = (e | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (e = (e | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return e;
1579
- if ((this.pos += 5) > this.len)
1580
- throw this.pos = this.len, indexOutOfRange(this, 10);
1581
- return e;
1582
- };
1583
- }();
1584
- Reader$1.prototype.int32 = function t() {
1585
- return this.uint32() | 0;
1586
- };
1587
- Reader$1.prototype.sint32 = function t() {
1588
- var e = this.uint32();
1589
- return e >>> 1 ^ -(e & 1) | 0;
1590
- };
1591
- function readLongVarint() {
1592
- var t = new LongBits(0, 0), e = 0;
1593
- if (this.len - this.pos > 4) {
1594
- for (; e < 4; ++e)
1595
- if (t.lo = (t.lo | (this.buf[this.pos] & 127) << e * 7) >>> 0, this.buf[this.pos++] < 128)
1596
- return t;
1597
- if (t.lo = (t.lo | (this.buf[this.pos] & 127) << 28) >>> 0, t.hi = (t.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
1598
- return t;
1599
- e = 0;
1600
- } else {
1601
- for (; e < 3; ++e) {
1602
- if (this.pos >= this.len)
1603
- throw indexOutOfRange(this);
1604
- if (t.lo = (t.lo | (this.buf[this.pos] & 127) << e * 7) >>> 0, this.buf[this.pos++] < 128)
1605
- return t;
1606
- }
1607
- return t.lo = (t.lo | (this.buf[this.pos++] & 127) << e * 7) >>> 0, t;
1608
- }
1609
- if (this.len - this.pos > 4) {
1610
- for (; e < 5; ++e)
1611
- if (t.hi = (t.hi | (this.buf[this.pos] & 127) << e * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1612
- return t;
1613
- } else
1614
- for (; e < 5; ++e) {
1615
- if (this.pos >= this.len)
1616
- throw indexOutOfRange(this);
1617
- if (t.hi = (t.hi | (this.buf[this.pos] & 127) << e * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1618
- return t;
1619
- }
1620
- throw Error("invalid varint encoding");
1621
- }
1622
- Reader$1.prototype.bool = function t() {
1623
- return this.uint32() !== 0;
1624
- };
1625
- function readFixed32_end(t, e) {
1626
- return (t[e - 4] | t[e - 3] << 8 | t[e - 2] << 16 | t[e - 1] << 24) >>> 0;
1627
- }
1628
- Reader$1.prototype.fixed32 = function t() {
1629
- if (this.pos + 4 > this.len)
1630
- throw indexOutOfRange(this, 4);
1631
- return readFixed32_end(this.buf, this.pos += 4);
1632
- };
1633
- Reader$1.prototype.sfixed32 = function t() {
1634
- if (this.pos + 4 > this.len)
1635
- throw indexOutOfRange(this, 4);
1636
- return readFixed32_end(this.buf, this.pos += 4) | 0;
1637
- };
1638
- function readFixed64() {
1639
- if (this.pos + 8 > this.len)
1640
- throw indexOutOfRange(this, 8);
1641
- return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
1642
- }
1643
- Reader$1.prototype.float = function t() {
1644
- if (this.pos + 4 > this.len)
1645
- throw indexOutOfRange(this, 4);
1646
- var e = util$4.float.readFloatLE(this.buf, this.pos);
1647
- return this.pos += 4, e;
1648
- };
1649
- Reader$1.prototype.double = function t() {
1650
- if (this.pos + 8 > this.len)
1651
- throw indexOutOfRange(this, 4);
1652
- var e = util$4.float.readDoubleLE(this.buf, this.pos);
1653
- return this.pos += 8, e;
1654
- };
1655
- Reader$1.prototype.bytes = function t() {
1656
- var e = this.uint32(), r = this.pos, s = this.pos + e;
1657
- if (s > this.len)
1658
- throw indexOutOfRange(this, e);
1659
- if (this.pos += e, Array.isArray(this.buf))
1660
- return this.buf.slice(r, s);
1661
- if (r === s) {
1662
- var u = util$4.Buffer;
1663
- return u ? u.alloc(0) : new this.buf.constructor(0);
1664
- }
1665
- return this._slice.call(this.buf, r, s);
1666
- };
1667
- Reader$1.prototype.string = function t() {
1668
- var e = this.bytes();
1669
- return utf8.read(e, 0, e.length);
1670
- };
1671
- Reader$1.prototype.skip = function t(e) {
1672
- if (typeof e == "number") {
1673
- if (this.pos + e > this.len)
1674
- throw indexOutOfRange(this, e);
1675
- this.pos += e;
1676
- } else
1677
- do
1678
- if (this.pos >= this.len)
1679
- throw indexOutOfRange(this);
1680
- while (this.buf[this.pos++] & 128);
1681
- return this;
1682
- };
1683
- Reader$1.prototype.skipType = function(t) {
1684
- switch (t) {
1685
- case 0:
1686
- this.skip();
1687
- break;
1688
- case 1:
1689
- this.skip(8);
1690
- break;
1691
- case 2:
1692
- this.skip(this.uint32());
1693
- break;
1694
- case 3:
1695
- for (; (t = this.uint32() & 7) !== 4; )
1696
- this.skipType(t);
1697
- break;
1698
- case 5:
1699
- this.skip(4);
1700
- break;
1701
- default:
1702
- throw Error("invalid wire type " + t + " at offset " + this.pos);
1703
- }
1704
- return this;
1705
- };
1706
- Reader$1._configure = function(t) {
1707
- BufferReader$1 = t, Reader$1.create = create(), BufferReader$1._configure();
1708
- var e = util$4.Long ? "toLong" : (
1709
- /* istanbul ignore next */
1710
- "toNumber"
1711
- );
1712
- util$4.merge(Reader$1.prototype, {
1713
- int64: function() {
1714
- return readLongVarint.call(this)[e](!1);
1715
- },
1716
- uint64: function() {
1717
- return readLongVarint.call(this)[e](!0);
1718
- },
1719
- sint64: function() {
1720
- return readLongVarint.call(this).zzDecode()[e](!1);
1721
- },
1722
- fixed64: function() {
1723
- return readFixed64.call(this)[e](!0);
1724
- },
1725
- sfixed64: function() {
1726
- return readFixed64.call(this)[e](!1);
1727
- }
1728
- });
1729
- };
1730
- var reader_buffer = BufferReader, Reader = reader;
1731
- (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
1732
- var util$3 = requireMinimal();
1733
- function BufferReader(t) {
1734
- Reader.call(this, t);
1735
- }
1736
- BufferReader._configure = function() {
1737
- util$3.Buffer && (BufferReader.prototype._slice = util$3.Buffer.prototype.slice);
1738
- };
1739
- BufferReader.prototype.string = function t() {
1740
- var e = this.uint32();
1741
- return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + e, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + e, this.len));
1742
- };
1743
- BufferReader._configure();
1744
- var rpc = {}, service$1 = Service, util$2 = requireMinimal();
1745
- (Service.prototype = Object.create(util$2.EventEmitter.prototype)).constructor = Service;
1746
- function Service(t, e, r) {
1747
- if (typeof t != "function")
1748
- throw TypeError("rpcImpl must be a function");
1749
- util$2.EventEmitter.call(this), this.rpcImpl = t, this.requestDelimited = !!e, this.responseDelimited = !!r;
1750
- }
1751
- Service.prototype.rpcCall = function t(e, r, s, u, o) {
1752
- if (!u)
1753
- throw TypeError("request must be specified");
1754
- var n = this;
1755
- if (!o)
1756
- return util$2.asPromise(t, n, e, r, s, u);
1757
- if (!n.rpcImpl) {
1758
- setTimeout(function() {
1759
- o(Error("already ended"));
1760
- }, 0);
1761
- return;
1762
- }
1763
- try {
1764
- return n.rpcImpl(
1765
- e,
1766
- r[n.requestDelimited ? "encodeDelimited" : "encode"](u).finish(),
1767
- function(f, i) {
1768
- if (f)
1769
- return n.emit("error", f, e), o(f);
1770
- if (i === null) {
1771
- n.end(
1772
- /* endedByRPC */
1773
- !0
1774
- );
1775
- return;
1776
- }
1777
- if (!(i instanceof s))
1778
- try {
1779
- i = s[n.responseDelimited ? "decodeDelimited" : "decode"](i);
1780
- } catch (c) {
1781
- return n.emit("error", c, e), o(c);
1782
- }
1783
- return n.emit("data", i, e), o(null, i);
1784
- }
1785
- );
1786
- } catch (a) {
1787
- n.emit("error", a, e), setTimeout(function() {
1788
- o(a);
1789
- }, 0);
1790
- return;
1791
- }
1792
- };
1793
- Service.prototype.end = function t(e) {
1794
- return this.rpcImpl && (e || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
1795
- };
1796
- (function(t) {
1797
- var e = t;
1798
- e.Service = service$1;
1799
- })(rpc);
1800
- var roots = {};
1801
- (function(t) {
1802
- var e = t;
1803
- e.build = "minimal", e.Writer = writer, e.BufferWriter = writer_buffer, e.Reader = reader, e.BufferReader = reader_buffer, e.util = requireMinimal(), e.rpc = rpc, e.roots = roots, e.configure = r;
1804
- function r() {
1805
- e.util._configure(), e.Writer._configure(e.BufferWriter), e.Reader._configure(e.BufferReader);
1806
- }
1807
- r();
1808
- })(indexMinimal);
1809
- var util$1 = { exports: {} }, codegen_1 = codegen;
1810
- function codegen(t, e) {
1811
- typeof t == "string" && (e = t, t = void 0);
1812
- var r = [];
1813
- function s(o) {
1814
- if (typeof o != "string") {
1815
- var n = u();
1816
- if (codegen.verbose && console.log("codegen: " + n), n = "return " + n, o) {
1817
- for (var a = Object.keys(o), f = new Array(a.length + 1), i = new Array(a.length), c = 0; c < a.length; )
1818
- f[c] = a[c], i[c] = o[a[c++]];
1819
- return f[c] = n, Function.apply(null, f).apply(null, i);
1820
- }
1821
- return Function(n)();
1822
- }
1823
- for (var l = new Array(arguments.length - 1), d = 0; d < l.length; )
1824
- l[d] = arguments[++d];
1825
- if (d = 0, o = o.replace(/%([%dfijs])/g, function(p, v) {
1826
- var g = l[d++];
1827
- switch (v) {
1828
- case "d":
1829
- case "f":
1830
- return String(Number(g));
1831
- case "i":
1832
- return String(Math.floor(g));
1833
- case "j":
1834
- return JSON.stringify(g);
1835
- case "s":
1836
- return String(g);
1837
- }
1838
- return "%";
1839
- }), d !== l.length)
1840
- throw Error("parameter count mismatch");
1841
- return r.push(o), s;
1842
- }
1843
- function u(o) {
1844
- return "function " + (o || e || "") + "(" + (t && t.join(",") || "") + `){
1845
- ` + r.join(`
1846
- `) + `
1847
- }`;
1848
- }
1849
- return s.toString = u, s;
1850
- }
1851
- codegen.verbose = !1;
1852
- var fetch_1 = fetch, asPromise = aspromise, inquire = inquire_1, fs = inquire("fs");
1853
- function fetch(t, e, r) {
1854
- return typeof e == "function" ? (r = e, e = {}) : e || (e = {}), r ? !e.xhr && fs && fs.readFile ? fs.readFile(t, function(u, o) {
1855
- return u && typeof XMLHttpRequest < "u" ? fetch.xhr(t, e, r) : u ? r(u) : r(null, e.binary ? o : o.toString("utf8"));
1856
- }) : fetch.xhr(t, e, r) : asPromise(fetch, this, t, e);
1857
- }
1858
- fetch.xhr = function t(e, r, s) {
1859
- var u = new XMLHttpRequest();
1860
- u.onreadystatechange = function() {
1861
- if (u.readyState === 4) {
1862
- if (u.status !== 0 && u.status !== 200)
1863
- return s(Error("status " + u.status));
1864
- if (r.binary) {
1865
- var n = u.response;
1866
- if (!n) {
1867
- n = [];
1868
- for (var a = 0; a < u.responseText.length; ++a)
1869
- n.push(u.responseText.charCodeAt(a) & 255);
1870
- }
1871
- return s(null, typeof Uint8Array < "u" ? new Uint8Array(n) : n);
1872
- }
1873
- return s(null, u.responseText);
1874
- }
1875
- }, r.binary && ("overrideMimeType" in u && u.overrideMimeType("text/plain; charset=x-user-defined"), u.responseType = "arraybuffer"), u.open("GET", e), u.send();
1876
- };
1877
- var path = {};
1878
- (function(t) {
1879
- var e = t, r = (
1880
- /**
1881
- * Tests if the specified path is absolute.
1882
- * @param {string} path Path to test
1883
- * @returns {boolean} `true` if path is absolute
1884
- */
1885
- e.isAbsolute = function(o) {
1886
- return /^(?:\/|\w+:)/.test(o);
1887
- }
1888
- ), s = (
1889
- /**
1890
- * Normalizes the specified path.
1891
- * @param {string} path Path to normalize
1892
- * @returns {string} Normalized path
1893
- */
1894
- e.normalize = function(o) {
1895
- o = o.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
1896
- var n = o.split("/"), a = r(o), f = "";
1897
- a && (f = n.shift() + "/");
1898
- for (var i = 0; i < n.length; )
1899
- n[i] === ".." ? i > 0 && n[i - 1] !== ".." ? n.splice(--i, 2) : a ? n.splice(i, 1) : ++i : n[i] === "." ? n.splice(i, 1) : ++i;
1900
- return f + n.join("/");
1901
- }
1902
- );
1903
- e.resolve = function(o, n, a) {
1904
- return a || (n = s(n)), r(n) ? n : (a || (o = s(o)), (o = o.replace(/(?:\/|^)[^/]+$/, "")).length ? s(o + "/" + n) : n);
1905
- };
1906
- })(path);
1907
- var types = {}, hasRequiredTypes;
1908
- function requireTypes() {
1909
- return hasRequiredTypes || (hasRequiredTypes = 1, function(t) {
1910
- var e = t, r = requireUtil(), s = [
1911
- "double",
1912
- // 0
1913
- "float",
1914
- // 1
1915
- "int32",
1916
- // 2
1917
- "uint32",
1918
- // 3
1919
- "sint32",
1920
- // 4
1921
- "fixed32",
1922
- // 5
1923
- "sfixed32",
1924
- // 6
1925
- "int64",
1926
- // 7
1927
- "uint64",
1928
- // 8
1929
- "sint64",
1930
- // 9
1931
- "fixed64",
1932
- // 10
1933
- "sfixed64",
1934
- // 11
1935
- "bool",
1936
- // 12
1937
- "string",
1938
- // 13
1939
- "bytes"
1940
- // 14
1941
- ];
1942
- function u(o, n) {
1943
- var a = 0, f = {};
1944
- for (n |= 0; a < o.length; ) f[s[a + n]] = o[a++];
1945
- return f;
1946
- }
1947
- e.basic = u([
1948
- /* double */
1949
- 1,
1950
- /* float */
1951
- 5,
1952
- /* int32 */
1953
- 0,
1954
- /* uint32 */
1955
- 0,
1956
- /* sint32 */
1957
- 0,
1958
- /* fixed32 */
1959
- 5,
1960
- /* sfixed32 */
1961
- 5,
1962
- /* int64 */
1963
- 0,
1964
- /* uint64 */
1965
- 0,
1966
- /* sint64 */
1967
- 0,
1968
- /* fixed64 */
1969
- 1,
1970
- /* sfixed64 */
1971
- 1,
1972
- /* bool */
1973
- 0,
1974
- /* string */
1975
- 2,
1976
- /* bytes */
1977
- 2
1978
- ]), e.defaults = u([
1979
- /* double */
1980
- 0,
1981
- /* float */
1982
- 0,
1983
- /* int32 */
1984
- 0,
1985
- /* uint32 */
1986
- 0,
1987
- /* sint32 */
1988
- 0,
1989
- /* fixed32 */
1990
- 0,
1991
- /* sfixed32 */
1992
- 0,
1993
- /* int64 */
1994
- 0,
1995
- /* uint64 */
1996
- 0,
1997
- /* sint64 */
1998
- 0,
1999
- /* fixed64 */
2000
- 0,
2001
- /* sfixed64 */
2002
- 0,
2003
- /* bool */
2004
- !1,
2005
- /* string */
2006
- "",
2007
- /* bytes */
2008
- r.emptyArray,
2009
- /* message */
2010
- null
2011
- ]), e.long = u([
2012
- /* int64 */
2013
- 0,
2014
- /* uint64 */
2015
- 0,
2016
- /* sint64 */
2017
- 0,
2018
- /* fixed64 */
2019
- 1,
2020
- /* sfixed64 */
2021
- 1
2022
- ], 7), e.mapKey = u([
2023
- /* int32 */
2024
- 0,
2025
- /* uint32 */
2026
- 0,
2027
- /* sint32 */
2028
- 0,
2029
- /* fixed32 */
2030
- 5,
2031
- /* sfixed32 */
2032
- 5,
2033
- /* int64 */
2034
- 0,
2035
- /* uint64 */
2036
- 0,
2037
- /* sint64 */
2038
- 0,
2039
- /* fixed64 */
2040
- 1,
2041
- /* sfixed64 */
2042
- 1,
2043
- /* bool */
2044
- 0,
2045
- /* string */
2046
- 2
2047
- ], 2), e.packed = u([
2048
- /* double */
2049
- 1,
2050
- /* float */
2051
- 5,
2052
- /* int32 */
2053
- 0,
2054
- /* uint32 */
2055
- 0,
2056
- /* sint32 */
2057
- 0,
2058
- /* fixed32 */
2059
- 5,
2060
- /* sfixed32 */
2061
- 5,
2062
- /* int64 */
2063
- 0,
2064
- /* uint64 */
2065
- 0,
2066
- /* sint64 */
2067
- 0,
2068
- /* fixed64 */
2069
- 1,
2070
- /* sfixed64 */
2071
- 1,
2072
- /* bool */
2073
- 0
2074
- ]);
2075
- }(types)), types;
2076
- }
2077
- var field, hasRequiredField;
2078
- function requireField() {
2079
- if (hasRequiredField) return field;
2080
- hasRequiredField = 1, field = n;
2081
- var t = requireObject();
2082
- ((n.prototype = Object.create(t.prototype)).constructor = n).className = "Field";
2083
- var e = require_enum(), r = requireTypes(), s = requireUtil(), u, o = /^required|optional|repeated$/;
2084
- n.fromJSON = function(f, i) {
2085
- return new n(f, i.id, i.type, i.rule, i.extend, i.options, i.comment);
2086
- };
2087
- function n(a, f, i, c, l, d, h) {
2088
- if (s.isObject(c) ? (h = l, d = c, c = l = void 0) : s.isObject(l) && (h = d, d = l, l = void 0), t.call(this, a, d), !s.isInteger(f) || f < 0)
2089
- throw TypeError("id must be a non-negative integer");
2090
- if (!s.isString(i))
2091
- throw TypeError("type must be a string");
2092
- if (c !== void 0 && !o.test(c = c.toString().toLowerCase()))
2093
- throw TypeError("rule must be a string rule");
2094
- if (l !== void 0 && !s.isString(l))
2095
- throw TypeError("extend must be a string");
2096
- c === "proto3_optional" && (c = "optional"), this.rule = c && c !== "optional" ? c : void 0, this.type = i, this.id = f, this.extend = l || void 0, this.required = c === "required", this.optional = !this.required, this.repeated = c === "repeated", this.map = !1, this.message = null, this.partOf = null, this.typeDefault = null, this.defaultValue = null, this.long = s.Long ? r.long[i] !== void 0 : (
2097
- /* istanbul ignore next */
2098
- !1
2099
- ), this.bytes = i === "bytes", this.resolvedType = null, this.extensionField = null, this.declaringField = null, this._packed = null, this.comment = h;
2100
- }
2101
- return Object.defineProperty(n.prototype, "packed", {
2102
- get: function() {
2103
- return this._packed === null && (this._packed = this.getOption("packed") !== !1), this._packed;
2104
- }
2105
- }), n.prototype.setOption = function(f, i, c) {
2106
- return f === "packed" && (this._packed = null), t.prototype.setOption.call(this, f, i, c);
2107
- }, n.prototype.toJSON = function(f) {
2108
- var i = f ? !!f.keepComments : !1;
2109
- return s.toObject([
2110
- "rule",
2111
- this.rule !== "optional" && this.rule || void 0,
2112
- "type",
2113
- this.type,
2114
- "id",
2115
- this.id,
2116
- "extend",
2117
- this.extend,
2118
- "options",
2119
- this.options,
2120
- "comment",
2121
- i ? this.comment : void 0
2122
- ]);
2123
- }, n.prototype.resolve = function() {
2124
- if (this.resolved)
2125
- return this;
2126
- if ((this.typeDefault = r.defaults[this.type]) === void 0 ? (this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type), this.resolvedType instanceof u ? this.typeDefault = null : this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]) : this.options && this.options.proto3_optional && (this.typeDefault = null), this.options && this.options.default != null && (this.typeDefault = this.options.default, this.resolvedType instanceof e && typeof this.typeDefault == "string" && (this.typeDefault = this.resolvedType.values[this.typeDefault])), this.options && ((this.options.packed === !0 || this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof e)) && delete this.options.packed, Object.keys(this.options).length || (this.options = void 0)), this.long)
2127
- this.typeDefault = s.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"), Object.freeze && Object.freeze(this.typeDefault);
2128
- else if (this.bytes && typeof this.typeDefault == "string") {
2129
- var f;
2130
- s.base64.test(this.typeDefault) ? s.base64.decode(this.typeDefault, f = s.newBuffer(s.base64.length(this.typeDefault)), 0) : s.utf8.write(this.typeDefault, f = s.newBuffer(s.utf8.length(this.typeDefault)), 0), this.typeDefault = f;
2131
- }
2132
- return this.map ? this.defaultValue = s.emptyObject : this.repeated ? this.defaultValue = s.emptyArray : this.defaultValue = this.typeDefault, this.parent instanceof u && (this.parent.ctor.prototype[this.name] = this.defaultValue), t.prototype.resolve.call(this);
2133
- }, n.d = function(f, i, c, l) {
2134
- return typeof i == "function" ? i = s.decorateType(i).name : i && typeof i == "object" && (i = s.decorateEnum(i).name), function(h, p) {
2135
- s.decorateType(h.constructor).add(new n(p, f, i, c, { default: l }));
2136
- };
2137
- }, n._configure = function(f) {
2138
- u = f;
2139
- }, field;
2140
- }
2141
- var oneof, hasRequiredOneof;
2142
- function requireOneof() {
2143
- if (hasRequiredOneof) return oneof;
2144
- hasRequiredOneof = 1, oneof = s;
2145
- var t = requireObject();
2146
- ((s.prototype = Object.create(t.prototype)).constructor = s).className = "OneOf";
2147
- var e = requireField(), r = requireUtil();
2148
- function s(o, n, a, f) {
2149
- if (Array.isArray(n) || (a = n, n = void 0), t.call(this, o, a), !(n === void 0 || Array.isArray(n)))
2150
- throw TypeError("fieldNames must be an Array");
2151
- this.oneof = n || [], this.fieldsArray = [], this.comment = f;
2152
- }
2153
- s.fromJSON = function(n, a) {
2154
- return new s(n, a.oneof, a.options, a.comment);
2155
- }, s.prototype.toJSON = function(n) {
2156
- var a = n ? !!n.keepComments : !1;
2157
- return r.toObject([
2158
- "options",
2159
- this.options,
2160
- "oneof",
2161
- this.oneof,
2162
- "comment",
2163
- a ? this.comment : void 0
2164
- ]);
2165
- };
2166
- function u(o) {
2167
- if (o.parent)
2168
- for (var n = 0; n < o.fieldsArray.length; ++n)
2169
- o.fieldsArray[n].parent || o.parent.add(o.fieldsArray[n]);
2170
- }
2171
- return s.prototype.add = function(n) {
2172
- if (!(n instanceof e))
2173
- throw TypeError("field must be a Field");
2174
- return n.parent && n.parent !== this.parent && n.parent.remove(n), this.oneof.push(n.name), this.fieldsArray.push(n), n.partOf = this, u(this), this;
2175
- }, s.prototype.remove = function(n) {
2176
- if (!(n instanceof e))
2177
- throw TypeError("field must be a Field");
2178
- var a = this.fieldsArray.indexOf(n);
2179
- if (a < 0)
2180
- throw Error(n + " is not a member of " + this);
2181
- return this.fieldsArray.splice(a, 1), a = this.oneof.indexOf(n.name), a > -1 && this.oneof.splice(a, 1), n.partOf = null, this;
2182
- }, s.prototype.onAdd = function(n) {
2183
- t.prototype.onAdd.call(this, n);
2184
- for (var a = this, f = 0; f < this.oneof.length; ++f) {
2185
- var i = n.get(this.oneof[f]);
2186
- i && !i.partOf && (i.partOf = a, a.fieldsArray.push(i));
2187
- }
2188
- u(this);
2189
- }, s.prototype.onRemove = function(n) {
2190
- for (var a = 0, f; a < this.fieldsArray.length; ++a)
2191
- (f = this.fieldsArray[a]).parent && f.parent.remove(f);
2192
- t.prototype.onRemove.call(this, n);
2193
- }, s.d = function() {
2194
- for (var n = new Array(arguments.length), a = 0; a < arguments.length; )
2195
- n[a] = arguments[a++];
2196
- return function(i, c) {
2197
- r.decorateType(i.constructor).add(new s(c, n)), Object.defineProperty(i, c, {
2198
- get: r.oneOfGetter(n),
2199
- set: r.oneOfSetter(n)
2200
- });
2201
- };
2202
- }, oneof;
2203
- }
2204
- var namespace, hasRequiredNamespace;
2205
- function requireNamespace() {
2206
- if (hasRequiredNamespace) return namespace;
2207
- hasRequiredNamespace = 1, namespace = f;
2208
- var t = requireObject();
2209
- ((f.prototype = Object.create(t.prototype)).constructor = f).className = "Namespace";
2210
- var e = requireField(), r = requireUtil(), s = requireOneof(), u, o, n;
2211
- f.fromJSON = function(l, d) {
2212
- return new f(l, d.options).addJSON(d.nested);
2213
- };
2214
- function a(c, l) {
2215
- if (c && c.length) {
2216
- for (var d = {}, h = 0; h < c.length; ++h)
2217
- d[c[h].name] = c[h].toJSON(l);
2218
- return d;
2219
- }
2220
- }
2221
- f.arrayToJSON = a, f.isReservedId = function(l, d) {
2222
- if (l) {
2223
- for (var h = 0; h < l.length; ++h)
2224
- if (typeof l[h] != "string" && l[h][0] <= d && l[h][1] > d)
2225
- return !0;
2226
- }
2227
- return !1;
2228
- }, f.isReservedName = function(l, d) {
2229
- if (l) {
2230
- for (var h = 0; h < l.length; ++h)
2231
- if (l[h] === d)
2232
- return !0;
2233
- }
2234
- return !1;
2235
- };
2236
- function f(c, l) {
2237
- t.call(this, c, l), this.nested = void 0, this._nestedArray = null;
2238
- }
2239
- function i(c) {
2240
- return c._nestedArray = null, c;
2241
- }
2242
- return Object.defineProperty(f.prototype, "nestedArray", {
2243
- get: function() {
2244
- return this._nestedArray || (this._nestedArray = r.toArray(this.nested));
2245
- }
2246
- }), f.prototype.toJSON = function(l) {
2247
- return r.toObject([
2248
- "options",
2249
- this.options,
2250
- "nested",
2251
- a(this.nestedArray, l)
2252
- ]);
2253
- }, f.prototype.addJSON = function(l) {
2254
- var d = this;
2255
- if (l)
2256
- for (var h = Object.keys(l), p = 0, v; p < h.length; ++p)
2257
- v = l[h[p]], d.add(
2258
- // most to least likely
2259
- (v.fields !== void 0 ? u.fromJSON : v.values !== void 0 ? n.fromJSON : v.methods !== void 0 ? o.fromJSON : v.id !== void 0 ? e.fromJSON : f.fromJSON)(h[p], v)
2260
- );
2261
- return this;
2262
- }, f.prototype.get = function(l) {
2263
- return this.nested && this.nested[l] || null;
2264
- }, f.prototype.getEnum = function(l) {
2265
- if (this.nested && this.nested[l] instanceof n)
2266
- return this.nested[l].values;
2267
- throw Error("no such enum: " + l);
2268
- }, f.prototype.add = function(l) {
2269
- if (!(l instanceof e && l.extend !== void 0 || l instanceof u || l instanceof s || l instanceof n || l instanceof o || l instanceof f))
2270
- throw TypeError("object must be a valid nested object");
2271
- if (!this.nested)
2272
- this.nested = {};
2273
- else {
2274
- var d = this.get(l.name);
2275
- if (d)
2276
- if (d instanceof f && l instanceof f && !(d instanceof u || d instanceof o)) {
2277
- for (var h = d.nestedArray, p = 0; p < h.length; ++p)
2278
- l.add(h[p]);
2279
- this.remove(d), this.nested || (this.nested = {}), l.setOptions(d.options, !0);
2280
- } else
2281
- throw Error("duplicate name '" + l.name + "' in " + this);
2282
- }
2283
- return this.nested[l.name] = l, l.onAdd(this), i(this);
2284
- }, f.prototype.remove = function(l) {
2285
- if (!(l instanceof t))
2286
- throw TypeError("object must be a ReflectionObject");
2287
- if (l.parent !== this)
2288
- throw Error(l + " is not a member of " + this);
2289
- return delete this.nested[l.name], Object.keys(this.nested).length || (this.nested = void 0), l.onRemove(this), i(this);
2290
- }, f.prototype.define = function(l, d) {
2291
- if (r.isString(l))
2292
- l = l.split(".");
2293
- else if (!Array.isArray(l))
2294
- throw TypeError("illegal path");
2295
- if (l && l.length && l[0] === "")
2296
- throw Error("path must be relative");
2297
- for (var h = this; l.length > 0; ) {
2298
- var p = l.shift();
2299
- if (h.nested && h.nested[p]) {
2300
- if (h = h.nested[p], !(h instanceof f))
2301
- throw Error("path conflicts with non-namespace objects");
2302
- } else
2303
- h.add(h = new f(p));
2304
- }
2305
- return d && h.addJSON(d), h;
2306
- }, f.prototype.resolveAll = function() {
2307
- for (var l = this.nestedArray, d = 0; d < l.length; )
2308
- l[d] instanceof f ? l[d++].resolveAll() : l[d++].resolve();
2309
- return this.resolve();
2310
- }, f.prototype.lookup = function(l, d, h) {
2311
- if (typeof d == "boolean" ? (h = d, d = void 0) : d && !Array.isArray(d) && (d = [d]), r.isString(l) && l.length) {
2312
- if (l === ".")
2313
- return this.root;
2314
- l = l.split(".");
2315
- } else if (!l.length)
2316
- return this;
2317
- if (l[0] === "")
2318
- return this.root.lookup(l.slice(1), d);
2319
- var p = this.get(l[0]);
2320
- if (p) {
2321
- if (l.length === 1) {
2322
- if (!d || d.indexOf(p.constructor) > -1)
2323
- return p;
2324
- } else if (p instanceof f && (p = p.lookup(l.slice(1), d, !0)))
2325
- return p;
2326
- } else
2327
- for (var v = 0; v < this.nestedArray.length; ++v)
2328
- if (this._nestedArray[v] instanceof f && (p = this._nestedArray[v].lookup(l, d, !0)))
2329
- return p;
2330
- return this.parent === null || h ? null : this.parent.lookup(l, d);
2331
- }, f.prototype.lookupType = function(l) {
2332
- var d = this.lookup(l, [u]);
2333
- if (!d)
2334
- throw Error("no such type: " + l);
2335
- return d;
2336
- }, f.prototype.lookupEnum = function(l) {
2337
- var d = this.lookup(l, [n]);
2338
- if (!d)
2339
- throw Error("no such Enum '" + l + "' in " + this);
2340
- return d;
2341
- }, f.prototype.lookupTypeOrEnum = function(l) {
2342
- var d = this.lookup(l, [u, n]);
2343
- if (!d)
2344
- throw Error("no such Type or Enum '" + l + "' in " + this);
2345
- return d;
2346
- }, f.prototype.lookupService = function(l) {
2347
- var d = this.lookup(l, [o]);
2348
- if (!d)
2349
- throw Error("no such Service '" + l + "' in " + this);
2350
- return d;
2351
- }, f._configure = function(c, l, d) {
2352
- u = c, o = l, n = d;
2353
- }, namespace;
2354
- }
2355
- var mapfield, hasRequiredMapfield;
2356
- function requireMapfield() {
2357
- if (hasRequiredMapfield) return mapfield;
2358
- hasRequiredMapfield = 1, mapfield = s;
2359
- var t = requireField();
2360
- ((s.prototype = Object.create(t.prototype)).constructor = s).className = "MapField";
2361
- var e = requireTypes(), r = requireUtil();
2362
- function s(u, o, n, a, f, i) {
2363
- if (t.call(this, u, o, a, void 0, void 0, f, i), !r.isString(n))
2364
- throw TypeError("keyType must be a string");
2365
- this.keyType = n, this.resolvedKeyType = null, this.map = !0;
2366
- }
2367
- return s.fromJSON = function(o, n) {
2368
- return new s(o, n.id, n.keyType, n.type, n.options, n.comment);
2369
- }, s.prototype.toJSON = function(o) {
2370
- var n = o ? !!o.keepComments : !1;
2371
- return r.toObject([
2372
- "keyType",
2373
- this.keyType,
2374
- "type",
2375
- this.type,
2376
- "id",
2377
- this.id,
2378
- "extend",
2379
- this.extend,
2380
- "options",
2381
- this.options,
2382
- "comment",
2383
- n ? this.comment : void 0
2384
- ]);
2385
- }, s.prototype.resolve = function() {
2386
- if (this.resolved)
2387
- return this;
2388
- if (e.mapKey[this.keyType] === void 0)
2389
- throw Error("invalid key type: " + this.keyType);
2390
- return t.prototype.resolve.call(this);
2391
- }, s.d = function(o, n, a) {
2392
- return typeof a == "function" ? a = r.decorateType(a).name : a && typeof a == "object" && (a = r.decorateEnum(a).name), function(i, c) {
2393
- r.decorateType(i.constructor).add(new s(c, o, n, a));
2394
- };
2395
- }, mapfield;
2396
- }
2397
- var method, hasRequiredMethod;
2398
- function requireMethod() {
2399
- if (hasRequiredMethod) return method;
2400
- hasRequiredMethod = 1, method = r;
2401
- var t = requireObject();
2402
- ((r.prototype = Object.create(t.prototype)).constructor = r).className = "Method";
2403
- var e = requireUtil();
2404
- function r(s, u, o, n, a, f, i, c, l) {
2405
- if (e.isObject(a) ? (i = a, a = f = void 0) : e.isObject(f) && (i = f, f = void 0), !(u === void 0 || e.isString(u)))
2406
- throw TypeError("type must be a string");
2407
- if (!e.isString(o))
2408
- throw TypeError("requestType must be a string");
2409
- if (!e.isString(n))
2410
- throw TypeError("responseType must be a string");
2411
- t.call(this, s, i), this.type = u || "rpc", this.requestType = o, this.requestStream = a ? !0 : void 0, this.responseType = n, this.responseStream = f ? !0 : void 0, this.resolvedRequestType = null, this.resolvedResponseType = null, this.comment = c, this.parsedOptions = l;
2412
- }
2413
- return r.fromJSON = function(u, o) {
2414
- return new r(u, o.type, o.requestType, o.responseType, o.requestStream, o.responseStream, o.options, o.comment, o.parsedOptions);
2415
- }, r.prototype.toJSON = function(u) {
2416
- var o = u ? !!u.keepComments : !1;
2417
- return e.toObject([
2418
- "type",
2419
- this.type !== "rpc" && /* istanbul ignore next */
2420
- this.type || void 0,
2421
- "requestType",
2422
- this.requestType,
2423
- "requestStream",
2424
- this.requestStream,
2425
- "responseType",
2426
- this.responseType,
2427
- "responseStream",
2428
- this.responseStream,
2429
- "options",
2430
- this.options,
2431
- "comment",
2432
- o ? this.comment : void 0,
2433
- "parsedOptions",
2434
- this.parsedOptions
2435
- ]);
2436
- }, r.prototype.resolve = function() {
2437
- return this.resolved ? this : (this.resolvedRequestType = this.parent.lookupType(this.requestType), this.resolvedResponseType = this.parent.lookupType(this.responseType), t.prototype.resolve.call(this));
2438
- }, method;
2439
- }
2440
- var service, hasRequiredService;
2441
- function requireService() {
2442
- if (hasRequiredService) return service;
2443
- hasRequiredService = 1, service = u;
2444
- var t = requireNamespace();
2445
- ((u.prototype = Object.create(t.prototype)).constructor = u).className = "Service";
2446
- var e = requireMethod(), r = requireUtil(), s = rpc;
2447
- function u(n, a) {
2448
- t.call(this, n, a), this.methods = {}, this._methodsArray = null;
2449
- }
2450
- u.fromJSON = function(a, f) {
2451
- var i = new u(a, f.options);
2452
- if (f.methods)
2453
- for (var c = Object.keys(f.methods), l = 0; l < c.length; ++l)
2454
- i.add(e.fromJSON(c[l], f.methods[c[l]]));
2455
- return f.nested && i.addJSON(f.nested), i.comment = f.comment, i;
2456
- }, u.prototype.toJSON = function(a) {
2457
- var f = t.prototype.toJSON.call(this, a), i = a ? !!a.keepComments : !1;
2458
- return r.toObject([
2459
- "options",
2460
- f && f.options || void 0,
2461
- "methods",
2462
- t.arrayToJSON(this.methodsArray, a) || /* istanbul ignore next */
2463
- {},
2464
- "nested",
2465
- f && f.nested || void 0,
2466
- "comment",
2467
- i ? this.comment : void 0
2468
- ]);
2469
- }, Object.defineProperty(u.prototype, "methodsArray", {
2470
- get: function() {
2471
- return this._methodsArray || (this._methodsArray = r.toArray(this.methods));
2472
- }
2473
- });
2474
- function o(n) {
2475
- return n._methodsArray = null, n;
2476
- }
2477
- return u.prototype.get = function(a) {
2478
- return this.methods[a] || t.prototype.get.call(this, a);
2479
- }, u.prototype.resolveAll = function() {
2480
- for (var a = this.methodsArray, f = 0; f < a.length; ++f)
2481
- a[f].resolve();
2482
- return t.prototype.resolve.call(this);
2483
- }, u.prototype.add = function(a) {
2484
- if (this.get(a.name))
2485
- throw Error("duplicate name '" + a.name + "' in " + this);
2486
- return a instanceof e ? (this.methods[a.name] = a, a.parent = this, o(this)) : t.prototype.add.call(this, a);
2487
- }, u.prototype.remove = function(a) {
2488
- if (a instanceof e) {
2489
- if (this.methods[a.name] !== a)
2490
- throw Error(a + " is not a member of " + this);
2491
- return delete this.methods[a.name], a.parent = null, o(this);
2492
- }
2493
- return t.prototype.remove.call(this, a);
2494
- }, u.prototype.create = function(a, f, i) {
2495
- for (var c = new s.Service(a, f, i), l = 0, d; l < /* initializes */
2496
- this.methodsArray.length; ++l) {
2497
- var h = r.lcFirst((d = this._methodsArray[l]).resolve().name).replace(/[^$\w_]/g, "");
2498
- c[h] = r.codegen(["r", "c"], r.isReserved(h) ? h + "_" : h)("return this.rpcCall(m,q,s,r,c)")({
2499
- m: d,
2500
- q: d.resolvedRequestType.ctor,
2501
- s: d.resolvedResponseType.ctor
2502
- });
2503
- }
2504
- return c;
2505
- }, service;
2506
- }
2507
- var message$1 = Message, util = requireMinimal();
2508
- function Message(t) {
2509
- if (t)
2510
- for (var e = Object.keys(t), r = 0; r < e.length; ++r)
2511
- this[e[r]] = t[e[r]];
2512
- }
2513
- Message.create = function t(e) {
2514
- return this.$type.create(e);
2515
- };
2516
- Message.encode = function t(e, r) {
2517
- return this.$type.encode(e, r);
2518
- };
2519
- Message.encodeDelimited = function t(e, r) {
2520
- return this.$type.encodeDelimited(e, r);
2521
- };
2522
- Message.decode = function t(e) {
2523
- return this.$type.decode(e);
2524
- };
2525
- Message.decodeDelimited = function t(e) {
2526
- return this.$type.decodeDelimited(e);
2527
- };
2528
- Message.verify = function t(e) {
2529
- return this.$type.verify(e);
2530
- };
2531
- Message.fromObject = function t(e) {
2532
- return this.$type.fromObject(e);
2533
- };
2534
- Message.toObject = function t(e, r) {
2535
- return this.$type.toObject(e, r);
2536
- };
2537
- Message.prototype.toJSON = function t() {
2538
- return this.$type.toObject(this, util.toJSONOptions);
2539
- };
2540
- var decoder_1, hasRequiredDecoder;
2541
- function requireDecoder() {
2542
- if (hasRequiredDecoder) return decoder_1;
2543
- hasRequiredDecoder = 1, decoder_1 = u;
2544
- var t = require_enum(), e = requireTypes(), r = requireUtil();
2545
- function s(o) {
2546
- return "missing required '" + o.name + "'";
2547
- }
2548
- function u(o) {
2549
- var n = r.codegen(["r", "l"], o.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (o.fieldsArray.filter(function(d) {
2550
- return d.map;
2551
- }).length ? ",k,value" : ""))("while(r.pos<c){")("var t=r.uint32()");
2552
- o.group && n("if((t&7)===4)")("break"), n("switch(t>>>3){");
2553
- for (var a = 0; a < /* initializes */
2554
- o.fieldsArray.length; ++a) {
2555
- var f = o._fieldsArray[a].resolve(), i = f.resolvedType instanceof t ? "int32" : f.type, c = "m" + r.safeProp(f.name);
2556
- n("case %i: {", f.id), f.map ? (n("if(%s===util.emptyObject)", c)("%s={}", c)("var c2 = r.uint32()+r.pos"), e.defaults[f.keyType] !== void 0 ? n("k=%j", e.defaults[f.keyType]) : n("k=null"), e.defaults[i] !== void 0 ? n("value=%j", e.defaults[i]) : n("value=null"), n("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break", f.keyType)("case 2:"), e.basic[i] === void 0 ? n("value=types[%i].decode(r,r.uint32())", a) : n("value=r.%s()", i), n("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"), e.long[f.keyType] !== void 0 ? n('%s[typeof k==="object"?util.longToHash(k):k]=value', c) : n("%s[k]=value", c)) : f.repeated ? (n("if(!(%s&&%s.length))", c, c)("%s=[]", c), e.packed[i] !== void 0 && n("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", c, i)("}else"), e.basic[i] === void 0 ? n(f.resolvedType.group ? "%s.push(types[%i].decode(r))" : "%s.push(types[%i].decode(r,r.uint32()))", c, a) : n("%s.push(r.%s())", c, i)) : e.basic[i] === void 0 ? n(f.resolvedType.group ? "%s=types[%i].decode(r)" : "%s=types[%i].decode(r,r.uint32())", c, a) : n("%s=r.%s()", c, i), n("break")("}");
2557
- }
2558
- for (n("default:")("r.skipType(t&7)")("break")("}")("}"), a = 0; a < o._fieldsArray.length; ++a) {
2559
- var l = o._fieldsArray[a];
2560
- l.required && n("if(!m.hasOwnProperty(%j))", l.name)("throw util.ProtocolError(%j,{instance:m})", s(l));
2561
- }
2562
- return n("return m");
2563
- }
2564
- return decoder_1;
2565
- }
2566
- var verifier_1, hasRequiredVerifier;
2567
- function requireVerifier() {
2568
- if (hasRequiredVerifier) return verifier_1;
2569
- hasRequiredVerifier = 1, verifier_1 = o;
2570
- var t = require_enum(), e = requireUtil();
2571
- function r(n, a) {
2572
- return n.name + ": " + a + (n.repeated && a !== "array" ? "[]" : n.map && a !== "object" ? "{k:" + n.keyType + "}" : "") + " expected";
2573
- }
2574
- function s(n, a, f, i) {
2575
- if (a.resolvedType)
2576
- if (a.resolvedType instanceof t) {
2577
- n("switch(%s){", i)("default:")("return%j", r(a, "enum value"));
2578
- for (var c = Object.keys(a.resolvedType.values), l = 0; l < c.length; ++l) n("case %i:", a.resolvedType.values[c[l]]);
2579
- n("break")("}");
2580
- } else
2581
- n("{")("var e=types[%i].verify(%s);", f, i)("if(e)")("return%j+e", a.name + ".")("}");
2582
- else
2583
- switch (a.type) {
2584
- case "int32":
2585
- case "uint32":
2586
- case "sint32":
2587
- case "fixed32":
2588
- case "sfixed32":
2589
- n("if(!util.isInteger(%s))", i)("return%j", r(a, "integer"));
2590
- break;
2591
- case "int64":
2592
- case "uint64":
2593
- case "sint64":
2594
- case "fixed64":
2595
- case "sfixed64":
2596
- n("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", i, i, i, i)("return%j", r(a, "integer|Long"));
2597
- break;
2598
- case "float":
2599
- case "double":
2600
- n('if(typeof %s!=="number")', i)("return%j", r(a, "number"));
2601
- break;
2602
- case "bool":
2603
- n('if(typeof %s!=="boolean")', i)("return%j", r(a, "boolean"));
2604
- break;
2605
- case "string":
2606
- n("if(!util.isString(%s))", i)("return%j", r(a, "string"));
2607
- break;
2608
- case "bytes":
2609
- n('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', i, i, i)("return%j", r(a, "buffer"));
2610
- break;
2611
- }
2612
- return n;
2613
- }
2614
- function u(n, a, f) {
2615
- switch (a.keyType) {
2616
- case "int32":
2617
- case "uint32":
2618
- case "sint32":
2619
- case "fixed32":
2620
- case "sfixed32":
2621
- n("if(!util.key32Re.test(%s))", f)("return%j", r(a, "integer key"));
2622
- break;
2623
- case "int64":
2624
- case "uint64":
2625
- case "sint64":
2626
- case "fixed64":
2627
- case "sfixed64":
2628
- n("if(!util.key64Re.test(%s))", f)("return%j", r(a, "integer|Long key"));
2629
- break;
2630
- case "bool":
2631
- n("if(!util.key2Re.test(%s))", f)("return%j", r(a, "boolean key"));
2632
- break;
2633
- }
2634
- return n;
2635
- }
2636
- function o(n) {
2637
- var a = e.codegen(["m"], n.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected"), f = n.oneofsArray, i = {};
2638
- f.length && a("var p={}");
2639
- for (var c = 0; c < /* initializes */
2640
- n.fieldsArray.length; ++c) {
2641
- var l = n._fieldsArray[c].resolve(), d = "m" + e.safeProp(l.name);
2642
- if (l.optional && a("if(%s!=null&&m.hasOwnProperty(%j)){", d, l.name), l.map)
2643
- a("if(!util.isObject(%s))", d)("return%j", r(l, "object"))("var k=Object.keys(%s)", d)("for(var i=0;i<k.length;++i){"), u(a, l, "k[i]"), s(a, l, c, d + "[k[i]]")("}");
2644
- else if (l.repeated)
2645
- a("if(!Array.isArray(%s))", d)("return%j", r(l, "array"))("for(var i=0;i<%s.length;++i){", d), s(a, l, c, d + "[i]")("}");
2646
- else {
2647
- if (l.partOf) {
2648
- var h = e.safeProp(l.partOf.name);
2649
- i[l.partOf.name] === 1 && a("if(p%s===1)", h)("return%j", l.partOf.name + ": multiple values"), i[l.partOf.name] = 1, a("p%s=1", h);
2650
- }
2651
- s(a, l, c, d);
2652
- }
2653
- l.optional && a("}");
2654
- }
2655
- return a("return null");
2656
- }
2657
- return verifier_1;
2658
- }
2659
- var converter = {}, hasRequiredConverter;
2660
- function requireConverter() {
2661
- return hasRequiredConverter || (hasRequiredConverter = 1, function(t) {
2662
- var e = t, r = require_enum(), s = requireUtil();
2663
- function u(n, a, f, i) {
2664
- var c = !1;
2665
- if (a.resolvedType)
2666
- if (a.resolvedType instanceof r) {
2667
- n("switch(d%s){", i);
2668
- for (var l = a.resolvedType.values, d = Object.keys(l), h = 0; h < d.length; ++h)
2669
- l[d[h]] === a.typeDefault && !c && (n("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}', i, i, i), a.repeated || n("break"), c = !0), n("case%j:", d[h])("case %i:", l[d[h]])("m%s=%j", i, l[d[h]])("break");
2670
- n("}");
2671
- } else n('if(typeof d%s!=="object")', i)("throw TypeError(%j)", a.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", i, f, i);
2672
- else {
2673
- var p = !1;
2674
- switch (a.type) {
2675
- case "double":
2676
- case "float":
2677
- n("m%s=Number(d%s)", i, i);
2678
- break;
2679
- case "uint32":
2680
- case "fixed32":
2681
- n("m%s=d%s>>>0", i, i);
2682
- break;
2683
- case "int32":
2684
- case "sint32":
2685
- case "sfixed32":
2686
- n("m%s=d%s|0", i, i);
2687
- break;
2688
- case "uint64":
2689
- p = !0;
2690
- case "int64":
2691
- case "sint64":
2692
- case "fixed64":
2693
- case "sfixed64":
2694
- n("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", i, i, p)('else if(typeof d%s==="string")', i)("m%s=parseInt(d%s,10)", i, i)('else if(typeof d%s==="number")', i)("m%s=d%s", i, i)('else if(typeof d%s==="object")', i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", i, i, i, p ? "true" : "");
2695
- break;
2696
- case "bytes":
2697
- n('if(typeof d%s==="string")', i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", i, i, i)("else if(d%s.length >= 0)", i)("m%s=d%s", i, i);
2698
- break;
2699
- case "string":
2700
- n("m%s=String(d%s)", i, i);
2701
- break;
2702
- case "bool":
2703
- n("m%s=Boolean(d%s)", i, i);
2704
- break;
2705
- }
2706
- }
2707
- return n;
2708
- }
2709
- e.fromObject = function(a) {
2710
- var f = a.fieldsArray, i = s.codegen(["d"], a.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
2711
- if (!f.length) return i("return new this.ctor");
2712
- i("var m=new this.ctor");
2713
- for (var c = 0; c < f.length; ++c) {
2714
- var l = f[c].resolve(), d = s.safeProp(l.name);
2715
- l.map ? (i("if(d%s){", d)('if(typeof d%s!=="object")', d)("throw TypeError(%j)", l.fullName + ": object expected")("m%s={}", d)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", d), u(
2716
- i,
2717
- l,
2718
- /* not sorted */
2719
- c,
2720
- d + "[ks[i]]"
2721
- )("}")("}")) : l.repeated ? (i("if(d%s){", d)("if(!Array.isArray(d%s))", d)("throw TypeError(%j)", l.fullName + ": array expected")("m%s=[]", d)("for(var i=0;i<d%s.length;++i){", d), u(
2722
- i,
2723
- l,
2724
- /* not sorted */
2725
- c,
2726
- d + "[i]"
2727
- )("}")("}")) : (l.resolvedType instanceof r || i("if(d%s!=null){", d), u(
2728
- i,
2729
- l,
2730
- /* not sorted */
2731
- c,
2732
- d
2733
- ), l.resolvedType instanceof r || i("}"));
2734
- }
2735
- return i("return m");
2736
- };
2737
- function o(n, a, f, i) {
2738
- if (a.resolvedType)
2739
- a.resolvedType instanceof r ? n("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", i, f, i, i, f, i, i) : n("d%s=types[%i].toObject(m%s,o)", i, f, i);
2740
- else {
2741
- var c = !1;
2742
- switch (a.type) {
2743
- case "double":
2744
- case "float":
2745
- n("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", i, i, i, i);
2746
- break;
2747
- case "uint64":
2748
- c = !0;
2749
- case "int64":
2750
- case "sint64":
2751
- case "fixed64":
2752
- case "sfixed64":
2753
- n('if(typeof m%s==="number")', i)("d%s=o.longs===String?String(m%s):m%s", i, i, i)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", i, i, i, i, c ? "true" : "", i);
2754
- break;
2755
- case "bytes":
2756
- n("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", i, i, i, i, i);
2757
- break;
2758
- default:
2759
- n("d%s=m%s", i, i);
2760
- break;
2761
- }
2762
- }
2763
- return n;
2764
- }
2765
- e.toObject = function(a) {
2766
- var f = a.fieldsArray.slice().sort(s.compareFieldsById);
2767
- if (!f.length)
2768
- return s.codegen()("return {}");
2769
- for (var i = s.codegen(["m", "o"], a.name + "$toObject")("if(!o)")("o={}")("var d={}"), c = [], l = [], d = [], h = 0; h < f.length; ++h)
2770
- f[h].partOf || (f[h].resolve().repeated ? c : f[h].map ? l : d).push(f[h]);
2771
- if (c.length) {
2772
- for (i("if(o.arrays||o.defaults){"), h = 0; h < c.length; ++h) i("d%s=[]", s.safeProp(c[h].name));
2773
- i("}");
2774
- }
2775
- if (l.length) {
2776
- for (i("if(o.objects||o.defaults){"), h = 0; h < l.length; ++h) i("d%s={}", s.safeProp(l[h].name));
2777
- i("}");
2778
- }
2779
- if (d.length) {
2780
- for (i("if(o.defaults){"), h = 0; h < d.length; ++h) {
2781
- var p = d[h], v = s.safeProp(p.name);
2782
- if (p.resolvedType instanceof r) i("d%s=o.enums===String?%j:%j", v, p.resolvedType.valuesById[p.typeDefault], p.typeDefault);
2783
- else if (p.long) i("if(util.Long){")("var n=new util.Long(%i,%i,%j)", p.typeDefault.low, p.typeDefault.high, p.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", v)("}else")("d%s=o.longs===String?%j:%i", v, p.typeDefault.toString(), p.typeDefault.toNumber());
2784
- else if (p.bytes) {
2785
- var g = "[" + Array.prototype.slice.call(p.typeDefault).join(",") + "]";
2786
- i("if(o.bytes===String)d%s=%j", v, String.fromCharCode.apply(String, p.typeDefault))("else{")("d%s=%s", v, g)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", v, v)("}");
2787
- } else i("d%s=%j", v, p.typeDefault);
2788
- }
2789
- i("}");
2790
- }
2791
- var m = !1;
2792
- for (h = 0; h < f.length; ++h) {
2793
- var p = f[h], _ = a._fieldsArray.indexOf(p), v = s.safeProp(p.name);
2794
- p.map ? (m || (m = !0, i("var ks2")), i("if(m%s&&(ks2=Object.keys(m%s)).length){", v, v)("d%s={}", v)("for(var j=0;j<ks2.length;++j){"), o(
2795
- i,
2796
- p,
2797
- /* sorted */
2798
- _,
2799
- v + "[ks2[j]]"
2800
- )("}")) : p.repeated ? (i("if(m%s&&m%s.length){", v, v)("d%s=[]", v)("for(var j=0;j<m%s.length;++j){", v), o(
2801
- i,
2802
- p,
2803
- /* sorted */
2804
- _,
2805
- v + "[j]"
2806
- )("}")) : (i("if(m%s!=null&&m.hasOwnProperty(%j)){", v, p.name), o(
2807
- i,
2808
- p,
2809
- /* sorted */
2810
- _,
2811
- v
2812
- ), p.partOf && i("if(o.oneofs)")("d%s=%j", s.safeProp(p.partOf.name), p.name)), i("}");
2813
- }
2814
- return i("return d");
2815
- };
2816
- }(converter)), converter;
2817
- }
2818
- var wrappers = {};
2819
- (function(t) {
2820
- var e = t, r = message$1;
2821
- e[".google.protobuf.Any"] = {
2822
- fromObject: function(s) {
2823
- if (s && s["@type"]) {
2824
- var u = s["@type"].substring(s["@type"].lastIndexOf("/") + 1), o = this.lookup(u);
2825
- if (o) {
2826
- var n = s["@type"].charAt(0) === "." ? s["@type"].slice(1) : s["@type"];
2827
- return n.indexOf("/") === -1 && (n = "/" + n), this.create({
2828
- type_url: n,
2829
- value: o.encode(o.fromObject(s)).finish()
2830
- });
2831
- }
2832
- }
2833
- return this.fromObject(s);
2834
- },
2835
- toObject: function(s, u) {
2836
- var o = "type.googleapis.com/", n = "", a = "";
2837
- if (u && u.json && s.type_url && s.value) {
2838
- a = s.type_url.substring(s.type_url.lastIndexOf("/") + 1), n = s.type_url.substring(0, s.type_url.lastIndexOf("/") + 1);
2839
- var f = this.lookup(a);
2840
- f && (s = f.decode(s.value));
2841
- }
2842
- if (!(s instanceof this.ctor) && s instanceof r) {
2843
- var i = s.$type.toObject(s, u), c = s.$type.fullName[0] === "." ? s.$type.fullName.slice(1) : s.$type.fullName;
2844
- return n === "" && (n = o), a = n + c, i["@type"] = a, i;
2845
- }
2846
- return this.toObject(s, u);
2847
- }
2848
- };
2849
- })(wrappers);
2850
- var type, hasRequiredType;
2851
- function requireType() {
2852
- if (hasRequiredType) return type;
2853
- hasRequiredType = 1, type = v;
2854
- var t = requireNamespace();
2855
- ((v.prototype = Object.create(t.prototype)).constructor = v).className = "Type";
2856
- var e = require_enum(), r = requireOneof(), s = requireField(), u = requireMapfield(), o = requireService(), n = message$1, a = reader, f = writer, i = requireUtil(), c = requireEncoder(), l = requireDecoder(), d = requireVerifier(), h = requireConverter(), p = wrappers;
2857
- function v(m, _) {
2858
- t.call(this, m, _), this.fields = {}, this.oneofs = void 0, this.extensions = void 0, this.reserved = void 0, this.group = void 0, this._fieldsById = null, this._fieldsArray = null, this._oneofsArray = null, this._ctor = null;
2859
- }
2860
- Object.defineProperties(v.prototype, {
2861
- /**
2862
- * Message fields by id.
2863
- * @name Type#fieldsById
2864
- * @type {Object.<number,Field>}
2865
- * @readonly
2866
- */
2867
- fieldsById: {
2868
- get: function() {
2869
- if (this._fieldsById)
2870
- return this._fieldsById;
2871
- this._fieldsById = {};
2872
- for (var m = Object.keys(this.fields), _ = 0; _ < m.length; ++_) {
2873
- var y = this.fields[m[_]], b = y.id;
2874
- if (this._fieldsById[b])
2875
- throw Error("duplicate id " + b + " in " + this);
2876
- this._fieldsById[b] = y;
2877
- }
2878
- return this._fieldsById;
2879
- }
2880
- },
2881
- /**
2882
- * Fields of this message as an array for iteration.
2883
- * @name Type#fieldsArray
2884
- * @type {Field[]}
2885
- * @readonly
2886
- */
2887
- fieldsArray: {
2888
- get: function() {
2889
- return this._fieldsArray || (this._fieldsArray = i.toArray(this.fields));
2890
- }
2891
- },
2892
- /**
2893
- * Oneofs of this message as an array for iteration.
2894
- * @name Type#oneofsArray
2895
- * @type {OneOf[]}
2896
- * @readonly
2897
- */
2898
- oneofsArray: {
2899
- get: function() {
2900
- return this._oneofsArray || (this._oneofsArray = i.toArray(this.oneofs));
2901
- }
2902
- },
2903
- /**
2904
- * The registered constructor, if any registered, otherwise a generic constructor.
2905
- * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.
2906
- * @name Type#ctor
2907
- * @type {Constructor<{}>}
2908
- */
2909
- ctor: {
2910
- get: function() {
2911
- return this._ctor || (this.ctor = v.generateConstructor(this)());
2912
- },
2913
- set: function(m) {
2914
- var _ = m.prototype;
2915
- _ instanceof n || ((m.prototype = new n()).constructor = m, i.merge(m.prototype, _)), m.$type = m.prototype.$type = this, i.merge(m, n, !0), this._ctor = m;
2916
- for (var y = 0; y < /* initializes */
2917
- this.fieldsArray.length; ++y)
2918
- this._fieldsArray[y].resolve();
2919
- var b = {};
2920
- for (y = 0; y < /* initializes */
2921
- this.oneofsArray.length; ++y)
2922
- b[this._oneofsArray[y].resolve().name] = {
2923
- get: i.oneOfGetter(this._oneofsArray[y].oneof),
2924
- set: i.oneOfSetter(this._oneofsArray[y].oneof)
2925
- };
2926
- y && Object.defineProperties(m.prototype, b);
2927
- }
2928
- }
2929
- }), v.generateConstructor = function(_) {
2930
- for (var y = i.codegen(["p"], _.name), b = 0, O; b < _.fieldsArray.length; ++b)
2931
- (O = _._fieldsArray[b]).map ? y("this%s={}", i.safeProp(O.name)) : O.repeated && y("this%s=[]", i.safeProp(O.name));
2932
- return y("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]");
2933
- };
2934
- function g(m) {
2935
- return m._fieldsById = m._fieldsArray = m._oneofsArray = null, delete m.encode, delete m.decode, delete m.verify, m;
2936
- }
2937
- return v.fromJSON = function(_, y) {
2938
- var b = new v(_, y.options);
2939
- b.extensions = y.extensions, b.reserved = y.reserved;
2940
- for (var O = Object.keys(y.fields), E = 0; E < O.length; ++E)
2941
- b.add(
2942
- (typeof y.fields[O[E]].keyType < "u" ? u.fromJSON : s.fromJSON)(O[E], y.fields[O[E]])
2943
- );
2944
- if (y.oneofs)
2945
- for (O = Object.keys(y.oneofs), E = 0; E < O.length; ++E)
2946
- b.add(r.fromJSON(O[E], y.oneofs[O[E]]));
2947
- if (y.nested)
2948
- for (O = Object.keys(y.nested), E = 0; E < O.length; ++E) {
2949
- var x = y.nested[O[E]];
2950
- b.add(
2951
- // most to least likely
2952
- (x.id !== void 0 ? s.fromJSON : x.fields !== void 0 ? v.fromJSON : x.values !== void 0 ? e.fromJSON : x.methods !== void 0 ? o.fromJSON : t.fromJSON)(O[E], x)
2953
- );
2954
- }
2955
- return y.extensions && y.extensions.length && (b.extensions = y.extensions), y.reserved && y.reserved.length && (b.reserved = y.reserved), y.group && (b.group = !0), y.comment && (b.comment = y.comment), b;
2956
- }, v.prototype.toJSON = function(_) {
2957
- var y = t.prototype.toJSON.call(this, _), b = _ ? !!_.keepComments : !1;
2958
- return i.toObject([
2959
- "options",
2960
- y && y.options || void 0,
2961
- "oneofs",
2962
- t.arrayToJSON(this.oneofsArray, _),
2963
- "fields",
2964
- t.arrayToJSON(this.fieldsArray.filter(function(O) {
2965
- return !O.declaringField;
2966
- }), _) || {},
2967
- "extensions",
2968
- this.extensions && this.extensions.length ? this.extensions : void 0,
2969
- "reserved",
2970
- this.reserved && this.reserved.length ? this.reserved : void 0,
2971
- "group",
2972
- this.group || void 0,
2973
- "nested",
2974
- y && y.nested || void 0,
2975
- "comment",
2976
- b ? this.comment : void 0
2977
- ]);
2978
- }, v.prototype.resolveAll = function() {
2979
- for (var _ = this.fieldsArray, y = 0; y < _.length; )
2980
- _[y++].resolve();
2981
- var b = this.oneofsArray;
2982
- for (y = 0; y < b.length; )
2983
- b[y++].resolve();
2984
- return t.prototype.resolveAll.call(this);
2985
- }, v.prototype.get = function(_) {
2986
- return this.fields[_] || this.oneofs && this.oneofs[_] || this.nested && this.nested[_] || null;
2987
- }, v.prototype.add = function(_) {
2988
- if (this.get(_.name))
2989
- throw Error("duplicate name '" + _.name + "' in " + this);
2990
- if (_ instanceof s && _.extend === void 0) {
2991
- if (this._fieldsById ? (
2992
- /* istanbul ignore next */
2993
- this._fieldsById[_.id]
2994
- ) : this.fieldsById[_.id])
2995
- throw Error("duplicate id " + _.id + " in " + this);
2996
- if (this.isReservedId(_.id))
2997
- throw Error("id " + _.id + " is reserved in " + this);
2998
- if (this.isReservedName(_.name))
2999
- throw Error("name '" + _.name + "' is reserved in " + this);
3000
- return _.parent && _.parent.remove(_), this.fields[_.name] = _, _.message = this, _.onAdd(this), g(this);
3001
- }
3002
- return _ instanceof r ? (this.oneofs || (this.oneofs = {}), this.oneofs[_.name] = _, _.onAdd(this), g(this)) : t.prototype.add.call(this, _);
3003
- }, v.prototype.remove = function(_) {
3004
- if (_ instanceof s && _.extend === void 0) {
3005
- if (!this.fields || this.fields[_.name] !== _)
3006
- throw Error(_ + " is not a member of " + this);
3007
- return delete this.fields[_.name], _.parent = null, _.onRemove(this), g(this);
3008
- }
3009
- if (_ instanceof r) {
3010
- if (!this.oneofs || this.oneofs[_.name] !== _)
3011
- throw Error(_ + " is not a member of " + this);
3012
- return delete this.oneofs[_.name], _.parent = null, _.onRemove(this), g(this);
3013
- }
3014
- return t.prototype.remove.call(this, _);
3015
- }, v.prototype.isReservedId = function(_) {
3016
- return t.isReservedId(this.reserved, _);
3017
- }, v.prototype.isReservedName = function(_) {
3018
- return t.isReservedName(this.reserved, _);
3019
- }, v.prototype.create = function(_) {
3020
- return new this.ctor(_);
3021
- }, v.prototype.setup = function() {
3022
- for (var _ = this.fullName, y = [], b = 0; b < /* initializes */
3023
- this.fieldsArray.length; ++b)
3024
- y.push(this._fieldsArray[b].resolve().resolvedType);
3025
- this.encode = c(this)({
3026
- Writer: f,
3027
- types: y,
3028
- util: i
3029
- }), this.decode = l(this)({
3030
- Reader: a,
3031
- types: y,
3032
- util: i
3033
- }), this.verify = d(this)({
3034
- types: y,
3035
- util: i
3036
- }), this.fromObject = h.fromObject(this)({
3037
- types: y,
3038
- util: i
3039
- }), this.toObject = h.toObject(this)({
3040
- types: y,
3041
- util: i
3042
- });
3043
- var O = p[_];
3044
- if (O) {
3045
- var E = Object.create(this);
3046
- E.fromObject = this.fromObject, this.fromObject = O.fromObject.bind(E), E.toObject = this.toObject, this.toObject = O.toObject.bind(E);
3047
- }
3048
- return this;
3049
- }, v.prototype.encode = function(_, y) {
3050
- return this.setup().encode(_, y);
3051
- }, v.prototype.encodeDelimited = function(_, y) {
3052
- return this.encode(_, y && y.len ? y.fork() : y).ldelim();
3053
- }, v.prototype.decode = function(_, y) {
3054
- return this.setup().decode(_, y);
3055
- }, v.prototype.decodeDelimited = function(_) {
3056
- return _ instanceof a || (_ = a.create(_)), this.decode(_, _.uint32());
3057
- }, v.prototype.verify = function(_) {
3058
- return this.setup().verify(_);
3059
- }, v.prototype.fromObject = function(_) {
3060
- return this.setup().fromObject(_);
3061
- }, v.prototype.toObject = function(_, y) {
3062
- return this.setup().toObject(_, y);
3063
- }, v.d = function(_) {
3064
- return function(b) {
3065
- i.decorateType(b, _);
3066
- };
3067
- }, type;
3068
- }
3069
- var root, hasRequiredRoot;
3070
- function requireRoot() {
3071
- if (hasRequiredRoot) return root;
3072
- hasRequiredRoot = 1, root = f;
3073
- var t = requireNamespace();
3074
- ((f.prototype = Object.create(t.prototype)).constructor = f).className = "Root";
3075
- var e = requireField(), r = require_enum(), s = requireOneof(), u = requireUtil(), o, n, a;
3076
- function f(d) {
3077
- t.call(this, "", d), this.deferred = [], this.files = [];
3078
- }
3079
- f.fromJSON = function(h, p) {
3080
- return p || (p = new f()), h.options && p.setOptions(h.options), p.addJSON(h.nested);
3081
- }, f.prototype.resolvePath = u.path.resolve, f.prototype.fetch = u.fetch;
3082
- function i() {
3083
- }
3084
- f.prototype.load = function d(h, p, v) {
3085
- typeof p == "function" && (v = p, p = void 0);
3086
- var g = this;
3087
- if (!v)
3088
- return u.asPromise(d, g, h, p);
3089
- var m = v === i;
3090
- function _(R, q) {
3091
- if (v) {
3092
- if (m)
3093
- throw R;
3094
- var A = v;
3095
- v = null, A(R, q);
3096
- }
3097
- }
3098
- function y(R) {
3099
- var q = R.lastIndexOf("google/protobuf/");
3100
- if (q > -1) {
3101
- var A = R.substring(q);
3102
- if (A in a) return A;
3103
- }
3104
- return null;
3105
- }
3106
- function b(R, q) {
3107
- try {
3108
- if (u.isString(q) && q.charAt(0) === "{" && (q = JSON.parse(q)), !u.isString(q))
3109
- g.setOptions(q.options).addJSON(q.nested);
3110
- else {
3111
- n.filename = R;
3112
- var A = n(q, g, p), F, N = 0;
3113
- if (A.imports)
3114
- for (; N < A.imports.length; ++N)
3115
- (F = y(A.imports[N]) || g.resolvePath(R, A.imports[N])) && O(F);
3116
- if (A.weakImports)
3117
- for (N = 0; N < A.weakImports.length; ++N)
3118
- (F = y(A.weakImports[N]) || g.resolvePath(R, A.weakImports[N])) && O(F, !0);
3119
- }
3120
- } catch (J) {
3121
- _(J);
3122
- }
3123
- !m && !E && _(null, g);
3124
- }
3125
- function O(R, q) {
3126
- if (R = y(R) || R, !(g.files.indexOf(R) > -1)) {
3127
- if (g.files.push(R), R in a) {
3128
- m ? b(R, a[R]) : (++E, setTimeout(function() {
3129
- --E, b(R, a[R]);
3130
- }));
3131
- return;
3132
- }
3133
- if (m) {
3134
- var A;
3135
- try {
3136
- A = u.fs.readFileSync(R).toString("utf8");
3137
- } catch (F) {
3138
- q || _(F);
3139
- return;
3140
- }
3141
- b(R, A);
3142
- } else
3143
- ++E, g.fetch(R, function(F, N) {
3144
- if (--E, !!v) {
3145
- if (F) {
3146
- q ? E || _(null, g) : _(F);
3147
- return;
3148
- }
3149
- b(R, N);
3150
- }
3151
- });
3152
- }
3153
- }
3154
- var E = 0;
3155
- u.isString(h) && (h = [h]);
3156
- for (var x = 0, P; x < h.length; ++x)
3157
- (P = g.resolvePath("", h[x])) && O(P);
3158
- if (m)
3159
- return g;
3160
- E || _(null, g);
3161
- }, f.prototype.loadSync = function(h, p) {
3162
- if (!u.isNode)
3163
- throw Error("not supported");
3164
- return this.load(h, p, i);
3165
- }, f.prototype.resolveAll = function() {
3166
- if (this.deferred.length)
3167
- throw Error("unresolvable extensions: " + this.deferred.map(function(h) {
3168
- return "'extend " + h.extend + "' in " + h.parent.fullName;
3169
- }).join(", "));
3170
- return t.prototype.resolveAll.call(this);
3171
- };
3172
- var c = /^[A-Z]/;
3173
- function l(d, h) {
3174
- var p = h.parent.lookup(h.extend);
3175
- if (p) {
3176
- var v = new e(h.fullName, h.id, h.type, h.rule, void 0, h.options);
3177
- return p.get(v.name) || (v.declaringField = h, h.extensionField = v, p.add(v)), !0;
3178
- }
3179
- return !1;
3180
- }
3181
- return f.prototype._handleAdd = function(h) {
3182
- if (h instanceof e)
3183
- /* an extension field (implies not part of a oneof) */
3184
- h.extend !== void 0 && /* not already handled */
3185
- !h.extensionField && (l(this, h) || this.deferred.push(h));
3186
- else if (h instanceof r)
3187
- c.test(h.name) && (h.parent[h.name] = h.values);
3188
- else if (!(h instanceof s)) {
3189
- if (h instanceof o)
3190
- for (var p = 0; p < this.deferred.length; )
3191
- l(this, this.deferred[p]) ? this.deferred.splice(p, 1) : ++p;
3192
- for (var v = 0; v < /* initializes */
3193
- h.nestedArray.length; ++v)
3194
- this._handleAdd(h._nestedArray[v]);
3195
- c.test(h.name) && (h.parent[h.name] = h);
3196
- }
3197
- }, f.prototype._handleRemove = function(h) {
3198
- if (h instanceof e) {
3199
- if (
3200
- /* an extension field */
3201
- h.extend !== void 0
3202
- )
3203
- if (
3204
- /* already handled */
3205
- h.extensionField
3206
- )
3207
- h.extensionField.parent.remove(h.extensionField), h.extensionField = null;
3208
- else {
3209
- var p = this.deferred.indexOf(h);
3210
- p > -1 && this.deferred.splice(p, 1);
3211
- }
3212
- } else if (h instanceof r)
3213
- c.test(h.name) && delete h.parent[h.name];
3214
- else if (h instanceof t) {
3215
- for (var v = 0; v < /* initializes */
3216
- h.nestedArray.length; ++v)
3217
- this._handleRemove(h._nestedArray[v]);
3218
- c.test(h.name) && delete h.parent[h.name];
3219
- }
3220
- }, f._configure = function(d, h, p) {
3221
- o = d, n = h, a = p;
3222
- }, root;
3223
- }
3224
- var hasRequiredUtil;
3225
- function requireUtil() {
3226
- if (hasRequiredUtil) return util$1.exports;
3227
- hasRequiredUtil = 1;
3228
- var t = util$1.exports = requireMinimal(), e = roots, r, s;
3229
- t.codegen = codegen_1, t.fetch = fetch_1, t.path = path, t.fs = t.inquire("fs"), t.toArray = function(i) {
3230
- if (i) {
3231
- for (var c = Object.keys(i), l = new Array(c.length), d = 0; d < c.length; )
3232
- l[d] = i[c[d++]];
3233
- return l;
3234
- }
3235
- return [];
3236
- }, t.toObject = function(i) {
3237
- for (var c = {}, l = 0; l < i.length; ) {
3238
- var d = i[l++], h = i[l++];
3239
- h !== void 0 && (c[d] = h);
3240
- }
3241
- return c;
3242
- };
3243
- var u = /\\/g, o = /"/g;
3244
- t.isReserved = function(i) {
3245
- return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(i);
3246
- }, t.safeProp = function(i) {
3247
- return !/^[$\w_]+$/.test(i) || t.isReserved(i) ? '["' + i.replace(u, "\\\\").replace(o, '\\"') + '"]' : "." + i;
3248
- }, t.ucFirst = function(i) {
3249
- return i.charAt(0).toUpperCase() + i.substring(1);
3250
- };
3251
- var n = /_([a-z])/g;
3252
- t.camelCase = function(i) {
3253
- return i.substring(0, 1) + i.substring(1).replace(n, function(c, l) {
3254
- return l.toUpperCase();
3255
- });
3256
- }, t.compareFieldsById = function(i, c) {
3257
- return i.id - c.id;
3258
- }, t.decorateType = function(i, c) {
3259
- if (i.$type)
3260
- return c && i.$type.name !== c && (t.decorateRoot.remove(i.$type), i.$type.name = c, t.decorateRoot.add(i.$type)), i.$type;
3261
- r || (r = requireType());
3262
- var l = new r(c || i.name);
3263
- return t.decorateRoot.add(l), l.ctor = i, Object.defineProperty(i, "$type", { value: l, enumerable: !1 }), Object.defineProperty(i.prototype, "$type", { value: l, enumerable: !1 }), l;
3264
- };
3265
- var a = 0;
3266
- return t.decorateEnum = function(i) {
3267
- if (i.$type)
3268
- return i.$type;
3269
- s || (s = require_enum());
3270
- var c = new s("Enum" + a++, i);
3271
- return t.decorateRoot.add(c), Object.defineProperty(i, "$type", { value: c, enumerable: !1 }), c;
3272
- }, t.setProperty = function(i, c, l) {
3273
- function d(h, p, v) {
3274
- var g = p.shift();
3275
- if (g === "__proto__" || g === "prototype")
3276
- return h;
3277
- if (p.length > 0)
3278
- h[g] = d(h[g] || {}, p, v);
3279
- else {
3280
- var m = h[g];
3281
- m && (v = [].concat(m).concat(v)), h[g] = v;
3282
- }
3283
- return h;
3284
- }
3285
- if (typeof i != "object")
3286
- throw TypeError("dst must be an object");
3287
- if (!c)
3288
- throw TypeError("path must be specified");
3289
- return c = c.split("."), d(i, c, l);
3290
- }, Object.defineProperty(t, "decorateRoot", {
3291
- get: function() {
3292
- return e.decorated || (e.decorated = new (requireRoot())());
3293
- }
3294
- }), util$1.exports;
3295
- }
3296
- var object, hasRequiredObject;
3297
- function requireObject() {
3298
- if (hasRequiredObject) return object;
3299
- hasRequiredObject = 1, object = r, r.className = "ReflectionObject";
3300
- var t = requireUtil(), e;
3301
- function r(s, u) {
3302
- if (!t.isString(s))
3303
- throw TypeError("name must be a string");
3304
- if (u && !t.isObject(u))
3305
- throw TypeError("options must be an object");
3306
- this.options = u, this.parsedOptions = null, this.name = s, this.parent = null, this.resolved = !1, this.comment = null, this.filename = null;
3307
- }
3308
- return Object.defineProperties(r.prototype, {
3309
- /**
3310
- * Reference to the root namespace.
3311
- * @name ReflectionObject#root
3312
- * @type {Root}
3313
- * @readonly
3314
- */
3315
- root: {
3316
- get: function() {
3317
- for (var s = this; s.parent !== null; )
3318
- s = s.parent;
3319
- return s;
3320
- }
3321
- },
3322
- /**
3323
- * Full name including leading dot.
3324
- * @name ReflectionObject#fullName
3325
- * @type {string}
3326
- * @readonly
3327
- */
3328
- fullName: {
3329
- get: function() {
3330
- for (var s = [this.name], u = this.parent; u; )
3331
- s.unshift(u.name), u = u.parent;
3332
- return s.join(".");
3333
- }
3334
- }
3335
- }), r.prototype.toJSON = /* istanbul ignore next */
3336
- function() {
3337
- throw Error();
3338
- }, r.prototype.onAdd = function(u) {
3339
- this.parent && this.parent !== u && this.parent.remove(this), this.parent = u, this.resolved = !1;
3340
- var o = u.root;
3341
- o instanceof e && o._handleAdd(this);
3342
- }, r.prototype.onRemove = function(u) {
3343
- var o = u.root;
3344
- o instanceof e && o._handleRemove(this), this.parent = null, this.resolved = !1;
3345
- }, r.prototype.resolve = function() {
3346
- return this.resolved ? this : (this.root instanceof e && (this.resolved = !0), this);
3347
- }, r.prototype.getOption = function(u) {
3348
- if (this.options)
3349
- return this.options[u];
3350
- }, r.prototype.setOption = function(u, o, n) {
3351
- return (!n || !this.options || this.options[u] === void 0) && ((this.options || (this.options = {}))[u] = o), this;
3352
- }, r.prototype.setParsedOption = function(u, o, n) {
3353
- this.parsedOptions || (this.parsedOptions = []);
3354
- var a = this.parsedOptions;
3355
- if (n) {
3356
- var f = a.find(function(l) {
3357
- return Object.prototype.hasOwnProperty.call(l, u);
3358
- });
3359
- if (f) {
3360
- var i = f[u];
3361
- t.setProperty(i, n, o);
3362
- } else
3363
- f = {}, f[u] = t.setProperty({}, n, o), a.push(f);
3364
- } else {
3365
- var c = {};
3366
- c[u] = o, a.push(c);
3367
- }
3368
- return this;
3369
- }, r.prototype.setOptions = function(u, o) {
3370
- if (u)
3371
- for (var n = Object.keys(u), a = 0; a < n.length; ++a)
3372
- this.setOption(n[a], u[n[a]], o);
3373
- return this;
3374
- }, r.prototype.toString = function() {
3375
- var u = this.constructor.className, o = this.fullName;
3376
- return o.length ? u + " " + o : u;
3377
- }, r._configure = function(s) {
3378
- e = s;
3379
- }, object;
3380
- }
3381
- var _enum, hasRequired_enum;
3382
- function require_enum() {
3383
- if (hasRequired_enum) return _enum;
3384
- hasRequired_enum = 1, _enum = s;
3385
- var t = requireObject();
3386
- ((s.prototype = Object.create(t.prototype)).constructor = s).className = "Enum";
3387
- var e = requireNamespace(), r = requireUtil();
3388
- function s(u, o, n, a, f, i) {
3389
- if (t.call(this, u, n), o && typeof o != "object")
3390
- throw TypeError("values must be an object");
3391
- if (this.valuesById = {}, this.values = Object.create(this.valuesById), this.comment = a, this.comments = f || {}, this.valuesOptions = i, this.reserved = void 0, o)
3392
- for (var c = Object.keys(o), l = 0; l < c.length; ++l)
3393
- typeof o[c[l]] == "number" && (this.valuesById[this.values[c[l]] = o[c[l]]] = c[l]);
3394
- }
3395
- return s.fromJSON = function(o, n) {
3396
- var a = new s(o, n.values, n.options, n.comment, n.comments);
3397
- return a.reserved = n.reserved, a;
3398
- }, s.prototype.toJSON = function(o) {
3399
- var n = o ? !!o.keepComments : !1;
3400
- return r.toObject([
3401
- "options",
3402
- this.options,
3403
- "valuesOptions",
3404
- this.valuesOptions,
3405
- "values",
3406
- this.values,
3407
- "reserved",
3408
- this.reserved && this.reserved.length ? this.reserved : void 0,
3409
- "comment",
3410
- n ? this.comment : void 0,
3411
- "comments",
3412
- n ? this.comments : void 0
3413
- ]);
3414
- }, s.prototype.add = function(o, n, a, f) {
3415
- if (!r.isString(o))
3416
- throw TypeError("name must be a string");
3417
- if (!r.isInteger(n))
3418
- throw TypeError("id must be an integer");
3419
- if (this.values[o] !== void 0)
3420
- throw Error("duplicate name '" + o + "' in " + this);
3421
- if (this.isReservedId(n))
3422
- throw Error("id " + n + " is reserved in " + this);
3423
- if (this.isReservedName(o))
3424
- throw Error("name '" + o + "' is reserved in " + this);
3425
- if (this.valuesById[n] !== void 0) {
3426
- if (!(this.options && this.options.allow_alias))
3427
- throw Error("duplicate id " + n + " in " + this);
3428
- this.values[o] = n;
3429
- } else
3430
- this.valuesById[this.values[o] = n] = o;
3431
- return f && (this.valuesOptions === void 0 && (this.valuesOptions = {}), this.valuesOptions[o] = f || null), this.comments[o] = a || null, this;
3432
- }, s.prototype.remove = function(o) {
3433
- if (!r.isString(o))
3434
- throw TypeError("name must be a string");
3435
- var n = this.values[o];
3436
- if (n == null)
3437
- throw Error("name '" + o + "' does not exist in " + this);
3438
- return delete this.valuesById[n], delete this.values[o], delete this.comments[o], this.valuesOptions && delete this.valuesOptions[o], this;
3439
- }, s.prototype.isReservedId = function(o) {
3440
- return e.isReservedId(this.reserved, o);
3441
- }, s.prototype.isReservedName = function(o) {
3442
- return e.isReservedName(this.reserved, o);
3443
- }, _enum;
3444
- }
3445
- var encoder_1, hasRequiredEncoder;
3446
- function requireEncoder() {
3447
- if (hasRequiredEncoder) return encoder_1;
3448
- hasRequiredEncoder = 1, encoder_1 = u;
3449
- var t = require_enum(), e = requireTypes(), r = requireUtil();
3450
- function s(o, n, a, f) {
3451
- return n.resolvedType.group ? o("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", a, f, (n.id << 3 | 3) >>> 0, (n.id << 3 | 4) >>> 0) : o("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", a, f, (n.id << 3 | 2) >>> 0);
3452
- }
3453
- function u(o) {
3454
- for (var n = r.codegen(["m", "w"], o.name + "$encode")("if(!w)")("w=Writer.create()"), a, f, i = (
3455
- /* initializes */
3456
- o.fieldsArray.slice().sort(r.compareFieldsById)
3457
- ), a = 0; a < i.length; ++a) {
3458
- var c = i[a].resolve(), l = o._fieldsArray.indexOf(c), d = c.resolvedType instanceof t ? "int32" : c.type, h = e.basic[d];
3459
- f = "m" + r.safeProp(c.name), c.map ? (n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", f, c.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (c.id << 3 | 2) >>> 0, 8 | e.mapKey[c.keyType], c.keyType), h === void 0 ? n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", l, f) : n(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | h, d, f), n("}")("}")) : c.repeated ? (n("if(%s!=null&&%s.length){", f, f), c.packed && e.packed[d] !== void 0 ? n("w.uint32(%i).fork()", (c.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", f)("w.%s(%s[i])", d, f)("w.ldelim()") : (n("for(var i=0;i<%s.length;++i)", f), h === void 0 ? s(n, c, l, f + "[i]") : n("w.uint32(%i).%s(%s[i])", (c.id << 3 | h) >>> 0, d, f)), n("}")) : (c.optional && n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", f, c.name), h === void 0 ? s(n, c, l, f) : n("w.uint32(%i).%s(%s)", (c.id << 3 | h) >>> 0, d, f));
3460
- }
3461
- return n("return w");
3462
- }
3463
- return encoder_1;
3464
- }
3465
- var protobuf = indexLight.exports = indexMinimal;
3466
- protobuf.build = "light";
3467
- function load(t, e, r) {
3468
- return typeof e == "function" ? (r = e, e = new protobuf.Root()) : e || (e = new protobuf.Root()), e.load(t, r);
3469
- }
3470
- protobuf.load = load;
3471
- function loadSync(t, e) {
3472
- return e || (e = new protobuf.Root()), e.loadSync(t);
3473
- }
3474
- protobuf.loadSync = loadSync;
3475
- protobuf.encoder = requireEncoder();
3476
- protobuf.decoder = requireDecoder();
3477
- protobuf.verifier = requireVerifier();
3478
- protobuf.converter = requireConverter();
3479
- protobuf.ReflectionObject = requireObject();
3480
- protobuf.Namespace = requireNamespace();
3481
- protobuf.Root = requireRoot();
3482
- protobuf.Enum = require_enum();
3483
- protobuf.Type = requireType();
3484
- protobuf.Field = requireField();
3485
- protobuf.OneOf = requireOneof();
3486
- protobuf.MapField = requireMapfield();
3487
- protobuf.Service = requireService();
3488
- protobuf.Method = requireMethod();
3489
- protobuf.Message = message$1;
3490
- protobuf.wrappers = wrappers;
3491
- protobuf.types = requireTypes();
3492
- protobuf.util = requireUtil();
3493
- protobuf.ReflectionObject._configure(protobuf.Root);
3494
- protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
3495
- protobuf.Root._configure(protobuf.Type);
3496
- protobuf.Field._configure(protobuf.Type);
3497
- var indexLightExports = indexLight.exports, light = indexLightExports;
3498
- const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data = { options: { syntax: "proto3", optimize_for: "LITE_RUNTIME" }, nested: { nil: { nested: { xit: { nested: { proto: { nested: { MessageType: { values: { MessageType_FrameRequest: 0, MessageType_FrameResponse: 1, MessageType_FrameCache: 2, MessageType_ValueRequest: 3, MessageType_ValueResponse: 4, MessageType_ValueUpdate: 5, MessageType_SignalRequest: 6, MessageType_SignalResponse: 7, MessageType_SignalNotify: 8, MessageType_FileRequest: 9, MessageType_FileResponse: 10 } }, FrameRequest: { fields: { id: { type: "string", id: 1 } } }, FrameResponse: { oneofs: { value: { oneof: ["file", "content"] } }, fields: { id: { type: "string", id: 1 }, file: { type: "string", id: 2 }, content: { type: "string", id: 3 } } }, Value: { oneofs: { value: { oneof: ["value_boolean", "value_number", "value_double", "value_string", "value_buffer"] } }, fields: { id: { type: "string", id: 1 }, value_boolean: { type: "bool", id: 2 }, value_number: { type: "int64", id: 3 }, value_double: { type: "double", id: 4 }, value_string: { type: "string", id: 5 }, value_buffer: { type: "bytes", id: 6 } } }, ValueRequest: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, ValueResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, values: { rule: "repeated", type: "Value", id: 3 } } }, ValueUpdate: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, value: { type: "Value", id: 3 } } }, SignalRequest: { fields: { id: { type: "string", id: 1 } } }, Signal: { oneofs: { _type: { oneof: ["type"] } }, fields: { id: { type: "string", id: 1 }, type: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, SignalResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signals: { rule: "repeated", type: "Signal", id: 3 } } }, SignalNotify: { oneofs: { _tag: { oneof: ["tag"] }, arg: { oneof: ["arg_boolean", "arg_number", "arg_double", "arg_string", "arg_buffer"] } }, fields: { frame_id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signal_id: { type: "string", id: 3 }, arg_boolean: { type: "bool", id: 4 }, arg_number: { type: "int64", id: 5 }, arg_double: { type: "double", id: 6 }, arg_string: { type: "string", id: 7 }, arg_buffer: { type: "bytes", id: 8 } } }, FileRequest: { fields: { target: { type: "string", id: 1 } } }, FileResponse: { fields: { target: { type: "string", id: 1 }, content: { type: "string", id: 2 }, metadata: { type: "bytes", id: 3 } } }, FileInfo: { fields: { target: { type: "string", id: 1 }, metadata: { type: "bytes", id: 2 } } }, FrameCache: { fields: { id: { type: "string", id: 1 }, content: { type: "string", id: 2 }, files: { rule: "repeated", type: "FileInfo", id: 3 } } } } } } } } } } }, nil_xit_proto = protobufjs.Root.fromJSON(proto_data).lookup(
3499
- "nil.xit.proto"
3500
- ), bundle = async (t) => new Promise((e, r) => {
3501
- const s = new WorkerWrapper();
3502
- s.postMessage({ type: "init", host: t.host, id: t.id, cdn_url: t.cdn_url }), s.addEventListener("message", async (u) => {
3503
- if (u.data.ok) {
3504
- if (u.data.files) {
3505
- const o = concat([
3506
- header(nil_xit_proto.MessageType.MessageType_FrameCache),
3507
- nil_xit_proto.FrameCache.encode({
3508
- id: t.id,
3509
- content: u.data.code,
3510
- files: u.data.files
3511
- }).finish()
3512
- ]);
3513
- service_publish({ host: t.host }, o);
3514
- }
3515
- e(
3516
- await import(
3517
- /* @vite-ignore */
3518
- "data:text/javascript;base64," + btoa(unescape(encodeURIComponent(u.data.code)))
3519
- )
3520
- );
3521
- } else
3522
- r(u.data.err);
3523
- s.terminate();
3524
- });
3525
- }), subscriber_queue = [];
3526
- function writable(t, e = noop$1) {
3527
- let r = null;
3528
- const s = /* @__PURE__ */ new Set();
3529
- function u(a) {
3530
- if (safe_not_equal(t, a) && (t = a, r)) {
3531
- const f = !subscriber_queue.length;
3532
- for (const i of s)
3533
- i[1](), subscriber_queue.push(i, t);
3534
- if (f) {
3535
- for (let i = 0; i < subscriber_queue.length; i += 2)
3536
- subscriber_queue[i][0](subscriber_queue[i + 1]);
3537
- subscriber_queue.length = 0;
3538
- }
3539
- }
3540
- }
3541
- function o(a) {
3542
- u(a(
3543
- /** @type {T} */
3544
- t
3545
- ));
3546
- }
3547
- function n(a, f = noop$1) {
3548
- const i = [a, f];
3549
- return s.add(i), s.size === 1 && (r = e(u, o) || noop$1), a(
3550
- /** @type {T} */
3551
- t
3552
- ), () => {
3553
- s.delete(i), s.size === 0 && r && (r(), r = null);
3554
- };
3555
- }
3556
- return { set: u, update: o, subscribe: n };
3557
- }
3558
- function get(t) {
3559
- let e;
3560
- return subscribe_to_store(t, (r) => e = r)(), e;
3561
- }
3562
- const make_values = async ({
3563
- id: t,
3564
- tag: e,
3565
- host: r,
3566
- service: s
3567
- }) => {
3568
- const u = await service_fetch(
3569
- { host: r },
3570
- concat([
3571
- header(nil_xit_proto.MessageType.MessageType_ValueRequest),
3572
- nil_xit_proto.ValueRequest.encode({ id: t, tag: e }).finish()
3573
- ]),
3574
- (n, a) => {
3575
- if (n === nil_xit_proto.MessageType.MessageType_ValueResponse) {
3576
- const f = nil_xit_proto.ValueResponse.decode(a);
3577
- if (f.id === t && e === f.tag)
3578
- return f.values;
3579
- }
3580
- }
3581
- ), o = {
3582
- value_boolean: /* @__PURE__ */ new Map(),
3583
- value_double: /* @__PURE__ */ new Map(),
3584
- value_number: /* @__PURE__ */ new Map(),
3585
- value_string: /* @__PURE__ */ new Map(),
3586
- value_buffer: /* @__PURE__ */ new Map()
3587
- };
3588
- for (const n of u) {
3589
- const a = n.id, f = n.value, i = writable(n[f]);
3590
- i.subscribe((c) => {
3591
- const l = { id: a, [f]: c, value: f }, d = { id: t, tag: e, value: l };
3592
- s.publish(
3593
- concat([
3594
- header(nil_xit_proto.MessageType.MessageType_ValueUpdate),
3595
- nil_xit_proto.ValueUpdate.encode(d).finish()
3596
- ])
3597
- );
3598
- }), o[f].set(a, i);
3599
- }
3600
- return s.on_message((n, a) => {
3601
- var c;
3602
- const f = new DataView(a.buffer).getUint32(0, !1), i = a.slice(4);
3603
- if (f === nil_xit_proto.MessageType.MessageType_ValueUpdate) {
3604
- const l = nil_xit_proto.ValueUpdate.decode(i);
3605
- if (l.id === t && e === l.tag) {
3606
- const d = l.value.value, h = (c = o[d]) == null ? void 0 : c.get(l.value.id);
3607
- h == null || h.set(message.value[d]);
3608
- }
3609
- }
3610
- }), o;
3611
- }, make_signals = async ({
3612
- id: t,
3613
- tag: e,
3614
- host: r,
3615
- service: s
3616
- }) => {
3617
- const u = await service_fetch(
3618
- { host: r },
3619
- concat([
3620
- header(nil_xit_proto.MessageType.MessageType_SignalRequest),
3621
- nil_xit_proto.SignalRequest.encode({ id: t }).finish()
3622
- ]),
3623
- (n, a) => {
3624
- if (n === nil_xit_proto.MessageType.MessageType_SignalResponse) {
3625
- const f = nil_xit_proto.SignalResponse.decode(a);
3626
- if (f.id === t)
3627
- return f.signals;
3628
- }
3629
- }
3630
- ), o = {
3631
- arg_none: /* @__PURE__ */ new Map(),
3632
- arg_boolean: /* @__PURE__ */ new Map(),
3633
- arg_double: /* @__PURE__ */ new Map(),
3634
- arg_number: /* @__PURE__ */ new Map(),
3635
- arg_string: /* @__PURE__ */ new Map(),
3636
- arg_buffer: /* @__PURE__ */ new Map()
3637
- };
3638
- for (const { id: n, type: a } of u)
3639
- a == null ? o.arg_none.set(n, () => {
3640
- const f = { frame_id: t, signal_id: n, tag: e };
3641
- s.publish(
3642
- concat([
3643
- header(nil_xit_proto.MessageType.MessageType_SignalNotify),
3644
- nil_xit_proto.SignalNotify.encode(f).finish()
3645
- ])
3646
- );
3647
- }) : o[a].set(n, (f) => {
3648
- const i = { frame_id: t, signal_id: n, tag: e, [a]: f };
3649
- s.publish(
3650
- concat([
3651
- header(nil_xit_proto.MessageType.MessageType_SignalNotify),
3652
- nil_xit_proto.SignalNotify.encode(i).finish()
3653
- ])
3654
- );
3655
- });
3656
- return o;
3657
- }, create_context = (t, e, r) => ({
3658
- values: {
3659
- boolean: (s, u) => t.value_boolean.get(s) ?? writable(u),
3660
- double: (s, u) => t.value_double.get(s) ?? writable(u),
3661
- string: (s, u) => t.value_string.get(s) ?? writable(u),
3662
- number: (s, u) => t.value_number.get(s) ?? writable(u),
3663
- buffer: (s, u) => t.value_buffer.get(s) ?? writable(u),
3664
- json: (s, u, o) => {
3665
- const n = t.value_buffer.get(s) ?? writable(o.encode(u));
3666
- let a = t.value_buffer.has(s) ? o.decode(get(n)) : u;
3667
- return {
3668
- set: (f) => {
3669
- a = f, n.set(o.encode(a));
3670
- },
3671
- subscribe: (f) => n.subscribe((i) => f(a)),
3672
- update: (f) => {
3673
- n.update((i) => (a = f(i), o.encode(a)));
3674
- }
3675
- };
3676
- }
3677
- },
3678
- signals: {
3679
- none: (s) => e.arg_none.get(s) ?? (() => {
3680
- }),
3681
- boolean: (s) => e.arg_boolean.get(s) ?? ((u) => {
3682
- }),
3683
- double: (s) => e.arg_double.get(s) ?? ((u) => {
3684
- }),
3685
- number: (s) => e.arg_number.get(s) ?? ((u) => {
3686
- }),
3687
- string: (s) => e.arg_string.get(s) ?? ((u) => {
3688
- }),
3689
- buffer: (s) => e.arg_buffer.get(s) ?? ((u) => {
3690
- }),
3691
- json: (s, u) => {
3692
- const o = e.arg_buffer.get(s) ?? ((n) => {
3693
- });
3694
- return (n) => o(u(n));
3695
- }
3696
- },
3697
- loader: r
3698
- }), create_app = async (t, e, r, s, u) => {
3699
- await test_connection({ host: t });
3700
- const o = new Service$1({ host: t }), [n, a, { action: f }] = await Promise.all([
3701
- make_values({ id: e, tag: r, host: t, service: o }),
3702
- make_signals({ id: e, tag: r, host: t, service: o }),
3703
- bundle({ host: t, cdn_url: s, id: e })
3704
- ]);
3705
- return (i) => {
3706
- const c = /* @__PURE__ */ new Map();
3707
- c.set("nil.xit", create_context(n, a, u));
3708
- const { destroy: l } = f(i, c);
3709
- return o.start(), {
3710
- destroy: () => {
3711
- o.stop(), l();
3712
- }
3713
- };
3714
- };
3715
- };
3716
- var root_1 = /* @__PURE__ */ template('<div style="display: contents"></div>'), root_2 = /* @__PURE__ */ template("<div> </div>"), root_3 = /* @__PURE__ */ template("<div> </div>");
3717
- function Client(t, e) {
3718
- push(e, !0);
3719
- var r = comment(), s = first_child(r);
3720
- await_block(
3721
- s,
3722
- () => create_app(e.host, e.frame, e.tag ?? null, e.cdn_url, e.loader),
3723
- (u) => {
3724
- var o = root_3(), n = child(o);
3725
- template_effect(() => set_text(n, `Loading ${(e.tag ? `${e.frame}-${e.tag}` : e.frame) ?? ""}...`)), append(u, o);
3726
- },
3727
- (u, o) => {
3728
- var n = root_1();
3729
- action(n, (a) => get$1(o)(a)), append(u, n);
3730
- },
3731
- (u, o) => {
3732
- var n = root_2(), a = child(n);
3733
- template_effect(() => set_text(a, (console.log(get$1(o)), "Something went wrong..."))), append(u, n);
3734
- }
3735
- ), append(t, r), pop();
3736
- }
3737
- function Component(t, e) {
3738
- push(e, !0);
3739
- const r = (u) => {
3740
- const o = {
3741
- one: (n, a) => r([{ frame: n, tag: a }]),
3742
- all: (n) => r(n)
3743
- };
3744
- return (n) => {
3745
- n.style.display = "contents";
3746
- const a = u.map(({ frame: f, tag: i }) => mount(Client, {
3747
- target: n,
3748
- props: {
3749
- loader: o,
3750
- host: e.data.server,
3751
- frame: f,
3752
- tag: i,
3753
- cdn_url: e.data.cdn_url
3754
- }
3755
- }));
3756
- return {
3757
- destroy: () => a.forEach((f) => unmount(f))
3758
- };
3759
- };
3760
- };
3761
- var s = /* @__PURE__ */ derived(() => ({
3762
- one: (u, o) => r([{ frame: u, tag: o }]),
3763
- all: (u) => r(u)
3764
- }));
3765
- Client(t, {
3766
- get loader() {
3767
- return get$1(s);
3768
- },
3769
- get host() {
3770
- return e.data.server;
3771
- },
3772
- get frame() {
3773
- return e.data.frame;
3774
- },
3775
- get tag() {
3776
- return e.data.tag;
3777
- },
3778
- get cdn_url() {
3779
- return e.data.cdn_url;
3780
- }
3781
- }), pop();
3782
- }
3783
- const create_component = (t, e) => {
3784
- const r = mount(Component, { target: t, props: { data: { ...e } } });
3785
- return () => unmount(r);
3786
- };
1
+ import { bT as r } from "./index2.js";
3787
2
  export {
3788
- create_component
3
+ r as create_component
3789
4
  };