@nil-/xit 0.1.6 → 0.1.7

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,4 +1,2899 @@
1
- import { bT as r } from "./index2.js";
1
+ var P = (i) => {
2
+ throw TypeError(i);
3
+ };
4
+ var C = (i, e, n) => e.has(i) || P("Cannot " + n);
5
+ var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n), A = (i, e, n, a) => (C(i, e, "write to private field"), a ? a.call(i, n) : e.set(i, n), n), W = (i, e, n) => (C(i, e, "access private method"), n);
6
+ import "./svelte/internal/disclose-version.js";
7
+ import { b1 as append, bp as template, aZ as mount, a$ as unmount } from "./svelte/index.js";
8
+ import { action } from "./svelte/internal/client.js";
9
+ import { w as writable, g as get } from "./svelte/store.js";
10
+ var root$1 = template('<div style="display: contents"></div>');
11
+ function ActionLoader(i, e) {
12
+ var n = root$1();
13
+ action(n, (a) => e.action(a)), append(i, n);
14
+ }
15
+ var j, I, E, M, D, L, N, $, U;
16
+ let Service$1 = (U = class {
17
+ constructor({ host: e, port: n }) {
18
+ F(this, j);
19
+ F(this, E);
20
+ // 0 idle, 1 has connected, 2 keep reconnecting, 3 stopped
21
+ F(this, M);
22
+ F(this, D);
23
+ F(this, L);
24
+ F(this, N);
25
+ F(this, $);
26
+ A(this, N, `${e ?? "localhost"}${n != null ? `:${n}` : ""}`), A(this, E, 0), A(this, M, null), A(this, D, null), A(this, L, null), A(this, $, null);
27
+ }
28
+ on_message(e) {
29
+ A(this, L, e);
30
+ }
31
+ on_connect(e) {
32
+ A(this, M, e);
33
+ }
34
+ on_disconnect(e) {
35
+ A(this, D, e);
36
+ }
37
+ // non-blocking (run is blocking in c++)
38
+ // calling it again should not do anything
39
+ start() {
40
+ w(this, $) == null && w(this, E) !== 1 && w(this, E) !== 3 && (A(this, $, new WebSocket(`ws://${w(this, N)}`)), w(this, $).binaryType = "arraybuffer", w(this, $).onopen = () => {
41
+ A(this, E, 1), w(this, M) && w(this, M).call(this, w(this, N));
42
+ }, w(this, $).onclose = () => {
43
+ w(this, E) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), A(this, E, 2), W(this, j, I).call(this));
44
+ }, w(this, $).onerror = () => {
45
+ w(this, E) !== 1 && w(this, E) !== 3 && (A(this, E, 2), W(this, j, I).call(this));
46
+ }, w(this, $).onmessage = (e) => {
47
+ w(this, L) && w(this, L).call(this, w(this, N), new Uint8Array(e.data));
48
+ });
49
+ }
50
+ stop() {
51
+ A(this, E, 3), w(this, $) != null && (w(this, $).close(), A(this, $, null));
52
+ }
53
+ restart() {
54
+ A(this, E, 0);
55
+ }
56
+ publish(e) {
57
+ w(this, $) != null && w(this, E) == 1 && w(this, $).send(e);
58
+ }
59
+ send(e, n) {
60
+ e === w(this, N) && this.publish(n);
61
+ }
62
+ }, j = new WeakSet(), I = function() {
63
+ w(this, $) != null && (w(this, $).close(), A(this, $, null)), setTimeout(() => this.start(), 1e3);
64
+ }, E = new WeakMap(), M = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), U);
65
+ const header = (i) => {
66
+ const e = new Uint8Array(4);
67
+ return new DataView(e.buffer).setUint32(0, i, !1), e;
68
+ }, concat = (i) => {
69
+ const e = new Uint8Array(i.reduce((a, f) => a + f.length, 0));
70
+ let n = 0;
71
+ for (const a of i)
72
+ e.set(a, n), n += a.length;
73
+ return e;
74
+ }, test_connection = async (i) => new Promise((e, n) => {
75
+ const a = new Service$1(i), f = setTimeout(() => {
76
+ a.stop(), n("connection failed... stopping");
77
+ }, 2500);
78
+ a.on_connect(() => {
79
+ console.log("connection tested... proceeding"), clearTimeout(f), a.stop(), e();
80
+ }), a.start();
81
+ }), service_fetch = async (i, e, n) => new Promise((a, f) => {
82
+ const u = new Service$1(i), t = setTimeout(() => {
83
+ u.stop(), f("timed out, cancelled");
84
+ }, 2500);
85
+ u.on_connect(() => u.publish(e)), u.on_message((o, s) => {
86
+ const r = new DataView(s.buffer).getUint32(0, !1), l = s.slice(4), d = n(r, l);
87
+ d != null && (clearTimeout(t), u.stop(), a(d));
88
+ }), u.start();
89
+ }), service_publish = (i, e) => {
90
+ const n = new Service$1(i), a = setTimeout(() => {
91
+ n.stop();
92
+ }, 2500);
93
+ n.on_connect(() => {
94
+ clearTimeout(a), n.publish(e), n.stop();
95
+ }), n.start();
96
+ };
97
+ function WorkerWrapper(i) {
98
+ return new Worker(
99
+ "/assets/bundler.js",
100
+ {
101
+ name: i == null ? void 0 : i.name
102
+ }
103
+ );
104
+ }
105
+ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
106
+ function getDefaultExportFromCjs(i) {
107
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
108
+ }
109
+ var indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise = asPromise$1;
110
+ function asPromise$1(i, e) {
111
+ for (var n = new Array(arguments.length - 1), a = 0, f = 2, u = !0; f < arguments.length; )
112
+ n[a++] = arguments[f++];
113
+ return new Promise(function(o, s) {
114
+ n[a] = function(l) {
115
+ if (u)
116
+ if (u = !1, l)
117
+ s(l);
118
+ else {
119
+ for (var d = new Array(arguments.length - 1), h = 0; h < d.length; )
120
+ d[h++] = arguments[h];
121
+ o.apply(null, d);
122
+ }
123
+ };
124
+ try {
125
+ i.apply(e || null, n);
126
+ } catch (r) {
127
+ u && (u = !1, s(r));
128
+ }
129
+ });
130
+ }
131
+ var base64$1 = {};
132
+ (function(i) {
133
+ var e = i;
134
+ e.length = function(o) {
135
+ var s = o.length;
136
+ if (!s)
137
+ return 0;
138
+ for (var r = 0; --s % 4 > 1 && o.charAt(s) === "="; )
139
+ ++r;
140
+ return Math.ceil(o.length * 3) / 4 - r;
141
+ };
142
+ for (var n = new Array(64), a = new Array(123), f = 0; f < 64; )
143
+ a[n[f] = f < 26 ? f + 65 : f < 52 ? f + 71 : f < 62 ? f - 4 : f - 59 | 43] = f++;
144
+ e.encode = function(o, s, r) {
145
+ for (var l = null, d = [], h = 0, c = 0, y; s < r; ) {
146
+ var m = o[s++];
147
+ switch (c) {
148
+ case 0:
149
+ d[h++] = n[m >> 2], y = (m & 3) << 4, c = 1;
150
+ break;
151
+ case 1:
152
+ d[h++] = n[y | m >> 4], y = (m & 15) << 2, c = 2;
153
+ break;
154
+ case 2:
155
+ d[h++] = n[y | m >> 6], d[h++] = n[m & 63], c = 0;
156
+ break;
157
+ }
158
+ h > 8191 && ((l || (l = [])).push(String.fromCharCode.apply(String, d)), h = 0);
159
+ }
160
+ return c && (d[h++] = n[y], d[h++] = 61, c === 1 && (d[h++] = 61)), l ? (h && l.push(String.fromCharCode.apply(String, d.slice(0, h))), l.join("")) : String.fromCharCode.apply(String, d.slice(0, h));
161
+ };
162
+ var u = "invalid encoding";
163
+ e.decode = function(o, s, r) {
164
+ for (var l = r, d = 0, h, c = 0; c < o.length; ) {
165
+ var y = o.charCodeAt(c++);
166
+ if (y === 61 && d > 1)
167
+ break;
168
+ if ((y = a[y]) === void 0)
169
+ throw Error(u);
170
+ switch (d) {
171
+ case 0:
172
+ h = y, d = 1;
173
+ break;
174
+ case 1:
175
+ s[r++] = h << 2 | (y & 48) >> 4, h = y, d = 2;
176
+ break;
177
+ case 2:
178
+ s[r++] = (h & 15) << 4 | (y & 60) >> 2, h = y, d = 3;
179
+ break;
180
+ case 3:
181
+ s[r++] = (h & 3) << 6 | y, d = 0;
182
+ break;
183
+ }
184
+ }
185
+ if (d === 1)
186
+ throw Error(u);
187
+ return r - l;
188
+ }, e.test = function(o) {
189
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
190
+ };
191
+ })(base64$1);
192
+ var eventemitter = EventEmitter;
193
+ function EventEmitter() {
194
+ this._listeners = {};
195
+ }
196
+ EventEmitter.prototype.on = function(e, n, a) {
197
+ return (this._listeners[e] || (this._listeners[e] = [])).push({
198
+ fn: n,
199
+ ctx: a || this
200
+ }), this;
201
+ };
202
+ EventEmitter.prototype.off = function(e, n) {
203
+ if (e === void 0)
204
+ this._listeners = {};
205
+ else if (n === void 0)
206
+ this._listeners[e] = [];
207
+ else
208
+ for (var a = this._listeners[e], f = 0; f < a.length; )
209
+ a[f].fn === n ? a.splice(f, 1) : ++f;
210
+ return this;
211
+ };
212
+ EventEmitter.prototype.emit = function(e) {
213
+ var n = this._listeners[e];
214
+ if (n) {
215
+ for (var a = [], f = 1; f < arguments.length; )
216
+ a.push(arguments[f++]);
217
+ for (f = 0; f < n.length; )
218
+ n[f].fn.apply(n[f++].ctx, a);
219
+ }
220
+ return this;
221
+ };
222
+ var float = factory(factory);
223
+ function factory(i) {
224
+ return typeof Float32Array < "u" ? function() {
225
+ var e = new Float32Array([-0]), n = new Uint8Array(e.buffer), a = n[3] === 128;
226
+ function f(s, r, l) {
227
+ e[0] = s, r[l] = n[0], r[l + 1] = n[1], r[l + 2] = n[2], r[l + 3] = n[3];
228
+ }
229
+ function u(s, r, l) {
230
+ e[0] = s, r[l] = n[3], r[l + 1] = n[2], r[l + 2] = n[1], r[l + 3] = n[0];
231
+ }
232
+ i.writeFloatLE = a ? f : u, i.writeFloatBE = a ? u : f;
233
+ function t(s, r) {
234
+ return n[0] = s[r], n[1] = s[r + 1], n[2] = s[r + 2], n[3] = s[r + 3], e[0];
235
+ }
236
+ function o(s, r) {
237
+ return n[3] = s[r], n[2] = s[r + 1], n[1] = s[r + 2], n[0] = s[r + 3], e[0];
238
+ }
239
+ i.readFloatLE = a ? t : o, i.readFloatBE = a ? o : t;
240
+ }() : function() {
241
+ function e(a, f, u, t) {
242
+ var o = f < 0 ? 1 : 0;
243
+ if (o && (f = -f), f === 0)
244
+ a(1 / f > 0 ? (
245
+ /* positive */
246
+ 0
247
+ ) : (
248
+ /* negative 0 */
249
+ 2147483648
250
+ ), u, t);
251
+ else if (isNaN(f))
252
+ a(2143289344, u, t);
253
+ else if (f > 34028234663852886e22)
254
+ a((o << 31 | 2139095040) >>> 0, u, t);
255
+ else if (f < 11754943508222875e-54)
256
+ a((o << 31 | Math.round(f / 1401298464324817e-60)) >>> 0, u, t);
257
+ else {
258
+ var s = Math.floor(Math.log(f) / Math.LN2), r = Math.round(f * Math.pow(2, -s) * 8388608) & 8388607;
259
+ a((o << 31 | s + 127 << 23 | r) >>> 0, u, t);
260
+ }
261
+ }
262
+ i.writeFloatLE = e.bind(null, writeUintLE), i.writeFloatBE = e.bind(null, writeUintBE);
263
+ function n(a, f, u) {
264
+ var t = a(f, u), o = (t >> 31) * 2 + 1, s = t >>> 23 & 255, r = t & 8388607;
265
+ return s === 255 ? r ? NaN : o * (1 / 0) : s === 0 ? o * 1401298464324817e-60 * r : o * Math.pow(2, s - 150) * (r + 8388608);
266
+ }
267
+ i.readFloatLE = n.bind(null, readUintLE), i.readFloatBE = n.bind(null, readUintBE);
268
+ }(), typeof Float64Array < "u" ? function() {
269
+ var e = new Float64Array([-0]), n = new Uint8Array(e.buffer), a = n[7] === 128;
270
+ function f(s, r, l) {
271
+ e[0] = s, r[l] = n[0], r[l + 1] = n[1], r[l + 2] = n[2], r[l + 3] = n[3], r[l + 4] = n[4], r[l + 5] = n[5], r[l + 6] = n[6], r[l + 7] = n[7];
272
+ }
273
+ function u(s, r, l) {
274
+ e[0] = s, r[l] = n[7], r[l + 1] = n[6], r[l + 2] = n[5], r[l + 3] = n[4], r[l + 4] = n[3], r[l + 5] = n[2], r[l + 6] = n[1], r[l + 7] = n[0];
275
+ }
276
+ i.writeDoubleLE = a ? f : u, i.writeDoubleBE = a ? u : f;
277
+ function t(s, r) {
278
+ return n[0] = s[r], n[1] = s[r + 1], n[2] = s[r + 2], n[3] = s[r + 3], n[4] = s[r + 4], n[5] = s[r + 5], n[6] = s[r + 6], n[7] = s[r + 7], e[0];
279
+ }
280
+ function o(s, r) {
281
+ return n[7] = s[r], n[6] = s[r + 1], n[5] = s[r + 2], n[4] = s[r + 3], n[3] = s[r + 4], n[2] = s[r + 5], n[1] = s[r + 6], n[0] = s[r + 7], e[0];
282
+ }
283
+ i.readDoubleLE = a ? t : o, i.readDoubleBE = a ? o : t;
284
+ }() : function() {
285
+ function e(a, f, u, t, o, s) {
286
+ var r = t < 0 ? 1 : 0;
287
+ if (r && (t = -t), t === 0)
288
+ a(0, o, s + f), a(1 / t > 0 ? (
289
+ /* positive */
290
+ 0
291
+ ) : (
292
+ /* negative 0 */
293
+ 2147483648
294
+ ), o, s + u);
295
+ else if (isNaN(t))
296
+ a(0, o, s + f), a(2146959360, o, s + u);
297
+ else if (t > 17976931348623157e292)
298
+ a(0, o, s + f), a((r << 31 | 2146435072) >>> 0, o, s + u);
299
+ else {
300
+ var l;
301
+ if (t < 22250738585072014e-324)
302
+ l = t / 5e-324, a(l >>> 0, o, s + f), a((r << 31 | l / 4294967296) >>> 0, o, s + u);
303
+ else {
304
+ var d = Math.floor(Math.log(t) / Math.LN2);
305
+ d === 1024 && (d = 1023), l = t * Math.pow(2, -d), a(l * 4503599627370496 >>> 0, o, s + f), a((r << 31 | d + 1023 << 20 | l * 1048576 & 1048575) >>> 0, o, s + u);
306
+ }
307
+ }
308
+ }
309
+ i.writeDoubleLE = e.bind(null, writeUintLE, 0, 4), i.writeDoubleBE = e.bind(null, writeUintBE, 4, 0);
310
+ function n(a, f, u, t, o) {
311
+ var s = a(t, o + f), r = a(t, o + u), l = (r >> 31) * 2 + 1, d = r >>> 20 & 2047, h = 4294967296 * (r & 1048575) + s;
312
+ return d === 2047 ? h ? NaN : l * (1 / 0) : d === 0 ? l * 5e-324 * h : l * Math.pow(2, d - 1075) * (h + 4503599627370496);
313
+ }
314
+ i.readDoubleLE = n.bind(null, readUintLE, 0, 4), i.readDoubleBE = n.bind(null, readUintBE, 4, 0);
315
+ }(), i;
316
+ }
317
+ function writeUintLE(i, e, n) {
318
+ e[n] = i & 255, e[n + 1] = i >>> 8 & 255, e[n + 2] = i >>> 16 & 255, e[n + 3] = i >>> 24;
319
+ }
320
+ function writeUintBE(i, e, n) {
321
+ e[n] = i >>> 24, e[n + 1] = i >>> 16 & 255, e[n + 2] = i >>> 8 & 255, e[n + 3] = i & 255;
322
+ }
323
+ function readUintLE(i, e) {
324
+ return (i[e] | i[e + 1] << 8 | i[e + 2] << 16 | i[e + 3] << 24) >>> 0;
325
+ }
326
+ function readUintBE(i, e) {
327
+ return (i[e] << 24 | i[e + 1] << 16 | i[e + 2] << 8 | i[e + 3]) >>> 0;
328
+ }
329
+ var inquire_1 = inquire$1;
330
+ function inquire$1(moduleName) {
331
+ try {
332
+ var mod = eval("quire".replace(/^/, "re"))(moduleName);
333
+ if (mod && (mod.length || Object.keys(mod).length))
334
+ return mod;
335
+ } catch (i) {
336
+ }
337
+ return null;
338
+ }
339
+ var utf8$2 = {};
340
+ (function(i) {
341
+ var e = i;
342
+ e.length = function(a) {
343
+ for (var f = 0, u = 0, t = 0; t < a.length; ++t)
344
+ u = a.charCodeAt(t), u < 128 ? f += 1 : u < 2048 ? f += 2 : (u & 64512) === 55296 && (a.charCodeAt(t + 1) & 64512) === 56320 ? (++t, f += 4) : f += 3;
345
+ return f;
346
+ }, e.read = function(a, f, u) {
347
+ var t = u - f;
348
+ if (t < 1)
349
+ return "";
350
+ for (var o = null, s = [], r = 0, l; f < u; )
351
+ l = a[f++], l < 128 ? s[r++] = l : l > 191 && l < 224 ? s[r++] = (l & 31) << 6 | a[f++] & 63 : l > 239 && l < 365 ? (l = ((l & 7) << 18 | (a[f++] & 63) << 12 | (a[f++] & 63) << 6 | a[f++] & 63) - 65536, s[r++] = 55296 + (l >> 10), s[r++] = 56320 + (l & 1023)) : s[r++] = (l & 15) << 12 | (a[f++] & 63) << 6 | a[f++] & 63, r > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, s)), r = 0);
352
+ return o ? (r && o.push(String.fromCharCode.apply(String, s.slice(0, r))), o.join("")) : String.fromCharCode.apply(String, s.slice(0, r));
353
+ }, e.write = function(a, f, u) {
354
+ for (var t = u, o, s, r = 0; r < a.length; ++r)
355
+ o = a.charCodeAt(r), o < 128 ? f[u++] = o : o < 2048 ? (f[u++] = o >> 6 | 192, f[u++] = o & 63 | 128) : (o & 64512) === 55296 && ((s = a.charCodeAt(r + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (s & 1023), ++r, f[u++] = o >> 18 | 240, f[u++] = o >> 12 & 63 | 128, f[u++] = o >> 6 & 63 | 128, f[u++] = o & 63 | 128) : (f[u++] = o >> 12 | 224, f[u++] = o >> 6 & 63 | 128, f[u++] = o & 63 | 128);
356
+ return u - t;
357
+ };
358
+ })(utf8$2);
359
+ var pool_1 = pool;
360
+ function pool(i, e, n) {
361
+ var a = n || 8192, f = a >>> 1, u = null, t = a;
362
+ return function(s) {
363
+ if (s < 1 || s > f)
364
+ return i(s);
365
+ t + s > a && (u = i(a), t = 0);
366
+ var r = e.call(u, t, t += s);
367
+ return t & 7 && (t = (t | 7) + 1), r;
368
+ };
369
+ }
370
+ var longbits, hasRequiredLongbits;
371
+ function requireLongbits() {
372
+ if (hasRequiredLongbits) return longbits;
373
+ hasRequiredLongbits = 1, longbits = e;
374
+ var i = requireMinimal();
375
+ function e(u, t) {
376
+ this.lo = u >>> 0, this.hi = t >>> 0;
377
+ }
378
+ var n = e.zero = new e(0, 0);
379
+ n.toNumber = function() {
380
+ return 0;
381
+ }, n.zzEncode = n.zzDecode = function() {
382
+ return this;
383
+ }, n.length = function() {
384
+ return 1;
385
+ };
386
+ var a = e.zeroHash = "\0\0\0\0\0\0\0\0";
387
+ e.fromNumber = function(t) {
388
+ if (t === 0)
389
+ return n;
390
+ var o = t < 0;
391
+ o && (t = -t);
392
+ var s = t >>> 0, r = (t - s) / 4294967296 >>> 0;
393
+ return o && (r = ~r >>> 0, s = ~s >>> 0, ++s > 4294967295 && (s = 0, ++r > 4294967295 && (r = 0))), new e(s, r);
394
+ }, e.from = function(t) {
395
+ if (typeof t == "number")
396
+ return e.fromNumber(t);
397
+ if (i.isString(t))
398
+ if (i.Long)
399
+ t = i.Long.fromString(t);
400
+ else
401
+ return e.fromNumber(parseInt(t, 10));
402
+ return t.low || t.high ? new e(t.low >>> 0, t.high >>> 0) : n;
403
+ }, e.prototype.toNumber = function(t) {
404
+ if (!t && this.hi >>> 31) {
405
+ var o = ~this.lo + 1 >>> 0, s = ~this.hi >>> 0;
406
+ return o || (s = s + 1 >>> 0), -(o + s * 4294967296);
407
+ }
408
+ return this.lo + this.hi * 4294967296;
409
+ }, e.prototype.toLong = function(t) {
410
+ return i.Long ? new i.Long(this.lo | 0, this.hi | 0, !!t) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!t };
411
+ };
412
+ var f = String.prototype.charCodeAt;
413
+ return e.fromHash = function(t) {
414
+ return t === a ? n : new e(
415
+ (f.call(t, 0) | f.call(t, 1) << 8 | f.call(t, 2) << 16 | f.call(t, 3) << 24) >>> 0,
416
+ (f.call(t, 4) | f.call(t, 5) << 8 | f.call(t, 6) << 16 | f.call(t, 7) << 24) >>> 0
417
+ );
418
+ }, e.prototype.toHash = function() {
419
+ return String.fromCharCode(
420
+ this.lo & 255,
421
+ this.lo >>> 8 & 255,
422
+ this.lo >>> 16 & 255,
423
+ this.lo >>> 24,
424
+ this.hi & 255,
425
+ this.hi >>> 8 & 255,
426
+ this.hi >>> 16 & 255,
427
+ this.hi >>> 24
428
+ );
429
+ }, e.prototype.zzEncode = function() {
430
+ var t = this.hi >> 31;
431
+ return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ t) >>> 0, this.lo = (this.lo << 1 ^ t) >>> 0, this;
432
+ }, e.prototype.zzDecode = function() {
433
+ var t = -(this.lo & 1);
434
+ return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ t) >>> 0, this.hi = (this.hi >>> 1 ^ t) >>> 0, this;
435
+ }, e.prototype.length = function() {
436
+ var t = this.lo, o = (this.lo >>> 28 | this.hi << 4) >>> 0, s = this.hi >>> 24;
437
+ return s === 0 ? o === 0 ? t < 16384 ? t < 128 ? 1 : 2 : t < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : s < 128 ? 9 : 10;
438
+ }, longbits;
439
+ }
440
+ var hasRequiredMinimal;
441
+ function requireMinimal() {
442
+ return hasRequiredMinimal || (hasRequiredMinimal = 1, function(i) {
443
+ var e = i;
444
+ 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([]) : (
445
+ /* istanbul ignore next */
446
+ []
447
+ ), e.emptyObject = Object.freeze ? Object.freeze({}) : (
448
+ /* istanbul ignore next */
449
+ {}
450
+ ), e.isInteger = Number.isInteger || /* istanbul ignore next */
451
+ function(u) {
452
+ return typeof u == "number" && isFinite(u) && Math.floor(u) === u;
453
+ }, e.isString = function(u) {
454
+ return typeof u == "string" || u instanceof String;
455
+ }, e.isObject = function(u) {
456
+ return u && typeof u == "object";
457
+ }, e.isset = /**
458
+ * Checks if a property on a message is considered to be present.
459
+ * @param {Object} obj Plain object or message instance
460
+ * @param {string} prop Property name
461
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
462
+ */
463
+ e.isSet = function(u, t) {
464
+ var o = u[t];
465
+ return o != null && u.hasOwnProperty(t) ? typeof o != "object" || (Array.isArray(o) ? o.length : Object.keys(o).length) > 0 : !1;
466
+ }, e.Buffer = function() {
467
+ try {
468
+ var f = e.inquire("buffer").Buffer;
469
+ return f.prototype.utf8Write ? f : (
470
+ /* istanbul ignore next */
471
+ null
472
+ );
473
+ } catch {
474
+ return null;
475
+ }
476
+ }(), e._Buffer_from = null, e._Buffer_allocUnsafe = null, e.newBuffer = function(u) {
477
+ return typeof u == "number" ? e.Buffer ? e._Buffer_allocUnsafe(u) : new e.Array(u) : e.Buffer ? e._Buffer_from(u) : typeof Uint8Array > "u" ? u : new Uint8Array(u);
478
+ }, e.Array = typeof Uint8Array < "u" ? Uint8Array : Array, e.Long = /* istanbul ignore next */
479
+ e.global.dcodeIO && /* istanbul ignore next */
480
+ e.global.dcodeIO.Long || /* istanbul ignore next */
481
+ 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(u) {
482
+ return u ? e.LongBits.from(u).toHash() : e.LongBits.zeroHash;
483
+ }, e.longFromHash = function(u, t) {
484
+ var o = e.LongBits.fromHash(u);
485
+ return e.Long ? e.Long.fromBits(o.lo, o.hi, t) : o.toNumber(!!t);
486
+ };
487
+ function n(f, u, t) {
488
+ for (var o = Object.keys(u), s = 0; s < o.length; ++s)
489
+ (f[o[s]] === void 0 || !t) && (f[o[s]] = u[o[s]]);
490
+ return f;
491
+ }
492
+ e.merge = n, e.lcFirst = function(u) {
493
+ return u.charAt(0).toLowerCase() + u.substring(1);
494
+ };
495
+ function a(f) {
496
+ function u(t, o) {
497
+ if (!(this instanceof u))
498
+ return new u(t, o);
499
+ Object.defineProperty(this, "message", { get: function() {
500
+ return t;
501
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, u) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), o && n(this, o);
502
+ }
503
+ return u.prototype = Object.create(Error.prototype, {
504
+ constructor: {
505
+ value: u,
506
+ writable: !0,
507
+ enumerable: !1,
508
+ configurable: !0
509
+ },
510
+ name: {
511
+ get: function() {
512
+ return f;
513
+ },
514
+ set: void 0,
515
+ enumerable: !1,
516
+ // configurable: false would accurately preserve the behavior of
517
+ // the original, but I'm guessing that was not intentional.
518
+ // For an actual error subclass, this property would
519
+ // be configurable.
520
+ configurable: !0
521
+ },
522
+ toString: {
523
+ value: function() {
524
+ return this.name + ": " + this.message;
525
+ },
526
+ writable: !0,
527
+ enumerable: !1,
528
+ configurable: !0
529
+ }
530
+ }), u;
531
+ }
532
+ e.newError = a, e.ProtocolError = a("ProtocolError"), e.oneOfGetter = function(u) {
533
+ for (var t = {}, o = 0; o < u.length; ++o)
534
+ t[u[o]] = 1;
535
+ return function() {
536
+ for (var s = Object.keys(this), r = s.length - 1; r > -1; --r)
537
+ if (t[s[r]] === 1 && this[s[r]] !== void 0 && this[s[r]] !== null)
538
+ return s[r];
539
+ };
540
+ }, e.oneOfSetter = function(u) {
541
+ return function(t) {
542
+ for (var o = 0; o < u.length; ++o)
543
+ u[o] !== t && delete this[u[o]];
544
+ };
545
+ }, e.toJSONOptions = {
546
+ longs: String,
547
+ enums: String,
548
+ bytes: String,
549
+ json: !0
550
+ }, e._configure = function() {
551
+ var f = e.Buffer;
552
+ if (!f) {
553
+ e._Buffer_from = e._Buffer_allocUnsafe = null;
554
+ return;
555
+ }
556
+ e._Buffer_from = f.from !== Uint8Array.from && f.from || /* istanbul ignore next */
557
+ function(t, o) {
558
+ return new f(t, o);
559
+ }, e._Buffer_allocUnsafe = f.allocUnsafe || /* istanbul ignore next */
560
+ function(t) {
561
+ return new f(t);
562
+ };
563
+ };
564
+ }(minimal)), minimal;
565
+ }
566
+ var writer = Writer$1, util$6 = requireMinimal(), BufferWriter$1, LongBits$1 = util$6.LongBits, base64 = util$6.base64, utf8$1 = util$6.utf8;
567
+ function Op(i, e, n) {
568
+ this.fn = i, this.len = e, this.next = void 0, this.val = n;
569
+ }
570
+ function noop$1() {
571
+ }
572
+ function State(i) {
573
+ this.head = i.head, this.tail = i.tail, this.len = i.len, this.next = i.states;
574
+ }
575
+ function Writer$1() {
576
+ this.len = 0, this.head = new Op(noop$1, 0, 0), this.tail = this.head, this.states = null;
577
+ }
578
+ var create$1 = function i() {
579
+ return util$6.Buffer ? function() {
580
+ return (Writer$1.create = function() {
581
+ return new BufferWriter$1();
582
+ })();
583
+ } : function() {
584
+ return new Writer$1();
585
+ };
586
+ };
587
+ Writer$1.create = create$1();
588
+ Writer$1.alloc = function i(e) {
589
+ return new util$6.Array(e);
590
+ };
591
+ util$6.Array !== Array && (Writer$1.alloc = util$6.pool(Writer$1.alloc, util$6.Array.prototype.subarray));
592
+ Writer$1.prototype._push = function i(e, n, a) {
593
+ return this.tail = this.tail.next = new Op(e, n, a), this.len += n, this;
594
+ };
595
+ function writeByte(i, e, n) {
596
+ e[n] = i & 255;
597
+ }
598
+ function writeVarint32(i, e, n) {
599
+ for (; i > 127; )
600
+ e[n++] = i & 127 | 128, i >>>= 7;
601
+ e[n] = i;
602
+ }
603
+ function VarintOp(i, e) {
604
+ this.len = i, this.next = void 0, this.val = e;
605
+ }
606
+ VarintOp.prototype = Object.create(Op.prototype);
607
+ VarintOp.prototype.fn = writeVarint32;
608
+ Writer$1.prototype.uint32 = function i(e) {
609
+ return this.len += (this.tail = this.tail.next = new VarintOp(
610
+ (e = e >>> 0) < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5,
611
+ e
612
+ )).len, this;
613
+ };
614
+ Writer$1.prototype.int32 = function i(e) {
615
+ return e < 0 ? this._push(writeVarint64, 10, LongBits$1.fromNumber(e)) : this.uint32(e);
616
+ };
617
+ Writer$1.prototype.sint32 = function i(e) {
618
+ return this.uint32((e << 1 ^ e >> 31) >>> 0);
619
+ };
620
+ function writeVarint64(i, e, n) {
621
+ for (; i.hi; )
622
+ e[n++] = i.lo & 127 | 128, i.lo = (i.lo >>> 7 | i.hi << 25) >>> 0, i.hi >>>= 7;
623
+ for (; i.lo > 127; )
624
+ e[n++] = i.lo & 127 | 128, i.lo = i.lo >>> 7;
625
+ e[n++] = i.lo;
626
+ }
627
+ Writer$1.prototype.uint64 = function i(e) {
628
+ var n = LongBits$1.from(e);
629
+ return this._push(writeVarint64, n.length(), n);
630
+ };
631
+ Writer$1.prototype.int64 = Writer$1.prototype.uint64;
632
+ Writer$1.prototype.sint64 = function i(e) {
633
+ var n = LongBits$1.from(e).zzEncode();
634
+ return this._push(writeVarint64, n.length(), n);
635
+ };
636
+ Writer$1.prototype.bool = function i(e) {
637
+ return this._push(writeByte, 1, e ? 1 : 0);
638
+ };
639
+ function writeFixed32(i, e, n) {
640
+ e[n] = i & 255, e[n + 1] = i >>> 8 & 255, e[n + 2] = i >>> 16 & 255, e[n + 3] = i >>> 24;
641
+ }
642
+ Writer$1.prototype.fixed32 = function i(e) {
643
+ return this._push(writeFixed32, 4, e >>> 0);
644
+ };
645
+ Writer$1.prototype.sfixed32 = Writer$1.prototype.fixed32;
646
+ Writer$1.prototype.fixed64 = function i(e) {
647
+ var n = LongBits$1.from(e);
648
+ return this._push(writeFixed32, 4, n.lo)._push(writeFixed32, 4, n.hi);
649
+ };
650
+ Writer$1.prototype.sfixed64 = Writer$1.prototype.fixed64;
651
+ Writer$1.prototype.float = function i(e) {
652
+ return this._push(util$6.float.writeFloatLE, 4, e);
653
+ };
654
+ Writer$1.prototype.double = function i(e) {
655
+ return this._push(util$6.float.writeDoubleLE, 8, e);
656
+ };
657
+ var writeBytes = util$6.Array.prototype.set ? function i(e, n, a) {
658
+ n.set(e, a);
659
+ } : function i(e, n, a) {
660
+ for (var f = 0; f < e.length; ++f)
661
+ n[a + f] = e[f];
662
+ };
663
+ Writer$1.prototype.bytes = function i(e) {
664
+ var n = e.length >>> 0;
665
+ if (!n)
666
+ return this._push(writeByte, 1, 0);
667
+ if (util$6.isString(e)) {
668
+ var a = Writer$1.alloc(n = base64.length(e));
669
+ base64.decode(e, a, 0), e = a;
670
+ }
671
+ return this.uint32(n)._push(writeBytes, n, e);
672
+ };
673
+ Writer$1.prototype.string = function i(e) {
674
+ var n = utf8$1.length(e);
675
+ return n ? this.uint32(n)._push(utf8$1.write, n, e) : this._push(writeByte, 1, 0);
676
+ };
677
+ Writer$1.prototype.fork = function i() {
678
+ return this.states = new State(this), this.head = this.tail = new Op(noop$1, 0, 0), this.len = 0, this;
679
+ };
680
+ Writer$1.prototype.reset = function i() {
681
+ 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$1, 0, 0), this.len = 0), this;
682
+ };
683
+ Writer$1.prototype.ldelim = function i() {
684
+ var e = this.head, n = this.tail, a = this.len;
685
+ return this.reset().uint32(a), a && (this.tail.next = e.next, this.tail = n, this.len += a), this;
686
+ };
687
+ Writer$1.prototype.finish = function i() {
688
+ for (var e = this.head.next, n = this.constructor.alloc(this.len), a = 0; e; )
689
+ e.fn(e.val, n, a), a += e.len, e = e.next;
690
+ return n;
691
+ };
692
+ Writer$1._configure = function(i) {
693
+ BufferWriter$1 = i, Writer$1.create = create$1(), BufferWriter$1._configure();
694
+ };
695
+ var writer_buffer = BufferWriter, Writer = writer;
696
+ (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
697
+ var util$5 = requireMinimal();
698
+ function BufferWriter() {
699
+ Writer.call(this);
700
+ }
701
+ BufferWriter._configure = function() {
702
+ 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, n, a) {
703
+ n.set(e, a);
704
+ } : function(e, n, a) {
705
+ if (e.copy)
706
+ e.copy(n, a, 0, e.length);
707
+ else for (var f = 0; f < e.length; )
708
+ n[a++] = e[f++];
709
+ };
710
+ };
711
+ BufferWriter.prototype.bytes = function i(e) {
712
+ util$5.isString(e) && (e = util$5._Buffer_from(e, "base64"));
713
+ var n = e.length >>> 0;
714
+ return this.uint32(n), n && this._push(BufferWriter.writeBytesBuffer, n, e), this;
715
+ };
716
+ function writeStringBuffer(i, e, n) {
717
+ i.length < 40 ? util$5.utf8.write(i, e, n) : e.utf8Write ? e.utf8Write(i, n) : e.write(i, n);
718
+ }
719
+ BufferWriter.prototype.string = function i(e) {
720
+ var n = util$5.Buffer.byteLength(e);
721
+ return this.uint32(n), n && this._push(writeStringBuffer, n, e), this;
722
+ };
723
+ BufferWriter._configure();
724
+ var reader = Reader$1, util$4 = requireMinimal(), BufferReader$1, LongBits = util$4.LongBits, utf8 = util$4.utf8;
725
+ function indexOutOfRange(i, e) {
726
+ return RangeError("index out of range: " + i.pos + " + " + (e || 1) + " > " + i.len);
727
+ }
728
+ function Reader$1(i) {
729
+ this.buf = i, this.pos = 0, this.len = i.length;
730
+ }
731
+ var create_array = typeof Uint8Array < "u" ? function i(e) {
732
+ if (e instanceof Uint8Array || Array.isArray(e))
733
+ return new Reader$1(e);
734
+ throw Error("illegal buffer");
735
+ } : function i(e) {
736
+ if (Array.isArray(e))
737
+ return new Reader$1(e);
738
+ throw Error("illegal buffer");
739
+ }, create = function i() {
740
+ return util$4.Buffer ? function(n) {
741
+ return (Reader$1.create = function(f) {
742
+ return util$4.Buffer.isBuffer(f) ? new BufferReader$1(f) : create_array(f);
743
+ })(n);
744
+ } : create_array;
745
+ };
746
+ Reader$1.create = create();
747
+ Reader$1.prototype._slice = util$4.Array.prototype.subarray || /* istanbul ignore next */
748
+ util$4.Array.prototype.slice;
749
+ Reader$1.prototype.uint32 = /* @__PURE__ */ function i() {
750
+ var e = 4294967295;
751
+ return function() {
752
+ 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;
753
+ if ((this.pos += 5) > this.len)
754
+ throw this.pos = this.len, indexOutOfRange(this, 10);
755
+ return e;
756
+ };
757
+ }();
758
+ Reader$1.prototype.int32 = function i() {
759
+ return this.uint32() | 0;
760
+ };
761
+ Reader$1.prototype.sint32 = function i() {
762
+ var e = this.uint32();
763
+ return e >>> 1 ^ -(e & 1) | 0;
764
+ };
765
+ function readLongVarint() {
766
+ var i = new LongBits(0, 0), e = 0;
767
+ if (this.len - this.pos > 4) {
768
+ for (; e < 4; ++e)
769
+ if (i.lo = (i.lo | (this.buf[this.pos] & 127) << e * 7) >>> 0, this.buf[this.pos++] < 128)
770
+ return i;
771
+ if (i.lo = (i.lo | (this.buf[this.pos] & 127) << 28) >>> 0, i.hi = (i.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
772
+ return i;
773
+ e = 0;
774
+ } else {
775
+ for (; e < 3; ++e) {
776
+ if (this.pos >= this.len)
777
+ throw indexOutOfRange(this);
778
+ if (i.lo = (i.lo | (this.buf[this.pos] & 127) << e * 7) >>> 0, this.buf[this.pos++] < 128)
779
+ return i;
780
+ }
781
+ return i.lo = (i.lo | (this.buf[this.pos++] & 127) << e * 7) >>> 0, i;
782
+ }
783
+ if (this.len - this.pos > 4) {
784
+ for (; e < 5; ++e)
785
+ if (i.hi = (i.hi | (this.buf[this.pos] & 127) << e * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
786
+ return i;
787
+ } else
788
+ for (; e < 5; ++e) {
789
+ if (this.pos >= this.len)
790
+ throw indexOutOfRange(this);
791
+ if (i.hi = (i.hi | (this.buf[this.pos] & 127) << e * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
792
+ return i;
793
+ }
794
+ throw Error("invalid varint encoding");
795
+ }
796
+ Reader$1.prototype.bool = function i() {
797
+ return this.uint32() !== 0;
798
+ };
799
+ function readFixed32_end(i, e) {
800
+ return (i[e - 4] | i[e - 3] << 8 | i[e - 2] << 16 | i[e - 1] << 24) >>> 0;
801
+ }
802
+ Reader$1.prototype.fixed32 = function i() {
803
+ if (this.pos + 4 > this.len)
804
+ throw indexOutOfRange(this, 4);
805
+ return readFixed32_end(this.buf, this.pos += 4);
806
+ };
807
+ Reader$1.prototype.sfixed32 = function i() {
808
+ if (this.pos + 4 > this.len)
809
+ throw indexOutOfRange(this, 4);
810
+ return readFixed32_end(this.buf, this.pos += 4) | 0;
811
+ };
812
+ function readFixed64() {
813
+ if (this.pos + 8 > this.len)
814
+ throw indexOutOfRange(this, 8);
815
+ return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
816
+ }
817
+ Reader$1.prototype.float = function i() {
818
+ if (this.pos + 4 > this.len)
819
+ throw indexOutOfRange(this, 4);
820
+ var e = util$4.float.readFloatLE(this.buf, this.pos);
821
+ return this.pos += 4, e;
822
+ };
823
+ Reader$1.prototype.double = function i() {
824
+ if (this.pos + 8 > this.len)
825
+ throw indexOutOfRange(this, 4);
826
+ var e = util$4.float.readDoubleLE(this.buf, this.pos);
827
+ return this.pos += 8, e;
828
+ };
829
+ Reader$1.prototype.bytes = function i() {
830
+ var e = this.uint32(), n = this.pos, a = this.pos + e;
831
+ if (a > this.len)
832
+ throw indexOutOfRange(this, e);
833
+ if (this.pos += e, Array.isArray(this.buf))
834
+ return this.buf.slice(n, a);
835
+ if (n === a) {
836
+ var f = util$4.Buffer;
837
+ return f ? f.alloc(0) : new this.buf.constructor(0);
838
+ }
839
+ return this._slice.call(this.buf, n, a);
840
+ };
841
+ Reader$1.prototype.string = function i() {
842
+ var e = this.bytes();
843
+ return utf8.read(e, 0, e.length);
844
+ };
845
+ Reader$1.prototype.skip = function i(e) {
846
+ if (typeof e == "number") {
847
+ if (this.pos + e > this.len)
848
+ throw indexOutOfRange(this, e);
849
+ this.pos += e;
850
+ } else
851
+ do
852
+ if (this.pos >= this.len)
853
+ throw indexOutOfRange(this);
854
+ while (this.buf[this.pos++] & 128);
855
+ return this;
856
+ };
857
+ Reader$1.prototype.skipType = function(i) {
858
+ switch (i) {
859
+ case 0:
860
+ this.skip();
861
+ break;
862
+ case 1:
863
+ this.skip(8);
864
+ break;
865
+ case 2:
866
+ this.skip(this.uint32());
867
+ break;
868
+ case 3:
869
+ for (; (i = this.uint32() & 7) !== 4; )
870
+ this.skipType(i);
871
+ break;
872
+ case 5:
873
+ this.skip(4);
874
+ break;
875
+ default:
876
+ throw Error("invalid wire type " + i + " at offset " + this.pos);
877
+ }
878
+ return this;
879
+ };
880
+ Reader$1._configure = function(i) {
881
+ BufferReader$1 = i, Reader$1.create = create(), BufferReader$1._configure();
882
+ var e = util$4.Long ? "toLong" : (
883
+ /* istanbul ignore next */
884
+ "toNumber"
885
+ );
886
+ util$4.merge(Reader$1.prototype, {
887
+ int64: function() {
888
+ return readLongVarint.call(this)[e](!1);
889
+ },
890
+ uint64: function() {
891
+ return readLongVarint.call(this)[e](!0);
892
+ },
893
+ sint64: function() {
894
+ return readLongVarint.call(this).zzDecode()[e](!1);
895
+ },
896
+ fixed64: function() {
897
+ return readFixed64.call(this)[e](!0);
898
+ },
899
+ sfixed64: function() {
900
+ return readFixed64.call(this)[e](!1);
901
+ }
902
+ });
903
+ };
904
+ var reader_buffer = BufferReader, Reader = reader;
905
+ (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
906
+ var util$3 = requireMinimal();
907
+ function BufferReader(i) {
908
+ Reader.call(this, i);
909
+ }
910
+ BufferReader._configure = function() {
911
+ util$3.Buffer && (BufferReader.prototype._slice = util$3.Buffer.prototype.slice);
912
+ };
913
+ BufferReader.prototype.string = function i() {
914
+ var e = this.uint32();
915
+ 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));
916
+ };
917
+ BufferReader._configure();
918
+ var rpc = {}, service$1 = Service, util$2 = requireMinimal();
919
+ (Service.prototype = Object.create(util$2.EventEmitter.prototype)).constructor = Service;
920
+ function Service(i, e, n) {
921
+ if (typeof i != "function")
922
+ throw TypeError("rpcImpl must be a function");
923
+ util$2.EventEmitter.call(this), this.rpcImpl = i, this.requestDelimited = !!e, this.responseDelimited = !!n;
924
+ }
925
+ Service.prototype.rpcCall = function i(e, n, a, f, u) {
926
+ if (!f)
927
+ throw TypeError("request must be specified");
928
+ var t = this;
929
+ if (!u)
930
+ return util$2.asPromise(i, t, e, n, a, f);
931
+ if (!t.rpcImpl) {
932
+ setTimeout(function() {
933
+ u(Error("already ended"));
934
+ }, 0);
935
+ return;
936
+ }
937
+ try {
938
+ return t.rpcImpl(
939
+ e,
940
+ n[t.requestDelimited ? "encodeDelimited" : "encode"](f).finish(),
941
+ function(s, r) {
942
+ if (s)
943
+ return t.emit("error", s, e), u(s);
944
+ if (r === null) {
945
+ t.end(
946
+ /* endedByRPC */
947
+ !0
948
+ );
949
+ return;
950
+ }
951
+ if (!(r instanceof a))
952
+ try {
953
+ r = a[t.responseDelimited ? "decodeDelimited" : "decode"](r);
954
+ } catch (l) {
955
+ return t.emit("error", l, e), u(l);
956
+ }
957
+ return t.emit("data", r, e), u(null, r);
958
+ }
959
+ );
960
+ } catch (o) {
961
+ t.emit("error", o, e), setTimeout(function() {
962
+ u(o);
963
+ }, 0);
964
+ return;
965
+ }
966
+ };
967
+ Service.prototype.end = function i(e) {
968
+ return this.rpcImpl && (e || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
969
+ };
970
+ (function(i) {
971
+ var e = i;
972
+ e.Service = service$1;
973
+ })(rpc);
974
+ var roots = {};
975
+ (function(i) {
976
+ var e = i;
977
+ 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 = n;
978
+ function n() {
979
+ e.util._configure(), e.Writer._configure(e.BufferWriter), e.Reader._configure(e.BufferReader);
980
+ }
981
+ n();
982
+ })(indexMinimal);
983
+ var util$1 = { exports: {} }, codegen_1 = codegen;
984
+ function codegen(i, e) {
985
+ typeof i == "string" && (e = i, i = void 0);
986
+ var n = [];
987
+ function a(u) {
988
+ if (typeof u != "string") {
989
+ var t = f();
990
+ if (codegen.verbose && console.log("codegen: " + t), t = "return " + t, u) {
991
+ for (var o = Object.keys(u), s = new Array(o.length + 1), r = new Array(o.length), l = 0; l < o.length; )
992
+ s[l] = o[l], r[l] = u[o[l++]];
993
+ return s[l] = t, Function.apply(null, s).apply(null, r);
994
+ }
995
+ return Function(t)();
996
+ }
997
+ for (var d = new Array(arguments.length - 1), h = 0; h < d.length; )
998
+ d[h] = arguments[++h];
999
+ if (h = 0, u = u.replace(/%([%dfijs])/g, function(y, m) {
1000
+ var b = d[h++];
1001
+ switch (m) {
1002
+ case "d":
1003
+ case "f":
1004
+ return String(Number(b));
1005
+ case "i":
1006
+ return String(Math.floor(b));
1007
+ case "j":
1008
+ return JSON.stringify(b);
1009
+ case "s":
1010
+ return String(b);
1011
+ }
1012
+ return "%";
1013
+ }), h !== d.length)
1014
+ throw Error("parameter count mismatch");
1015
+ return n.push(u), a;
1016
+ }
1017
+ function f(u) {
1018
+ return "function " + (u || e || "") + "(" + (i && i.join(",") || "") + `){
1019
+ ` + n.join(`
1020
+ `) + `
1021
+ }`;
1022
+ }
1023
+ return a.toString = f, a;
1024
+ }
1025
+ codegen.verbose = !1;
1026
+ var fetch_1 = fetch, asPromise = aspromise, inquire = inquire_1, fs = inquire("fs");
1027
+ function fetch(i, e, n) {
1028
+ return typeof e == "function" ? (n = e, e = {}) : e || (e = {}), n ? !e.xhr && fs && fs.readFile ? fs.readFile(i, function(f, u) {
1029
+ return f && typeof XMLHttpRequest < "u" ? fetch.xhr(i, e, n) : f ? n(f) : n(null, e.binary ? u : u.toString("utf8"));
1030
+ }) : fetch.xhr(i, e, n) : asPromise(fetch, this, i, e);
1031
+ }
1032
+ fetch.xhr = function i(e, n, a) {
1033
+ var f = new XMLHttpRequest();
1034
+ f.onreadystatechange = function() {
1035
+ if (f.readyState === 4) {
1036
+ if (f.status !== 0 && f.status !== 200)
1037
+ return a(Error("status " + f.status));
1038
+ if (n.binary) {
1039
+ var t = f.response;
1040
+ if (!t) {
1041
+ t = [];
1042
+ for (var o = 0; o < f.responseText.length; ++o)
1043
+ t.push(f.responseText.charCodeAt(o) & 255);
1044
+ }
1045
+ return a(null, typeof Uint8Array < "u" ? new Uint8Array(t) : t);
1046
+ }
1047
+ return a(null, f.responseText);
1048
+ }
1049
+ }, n.binary && ("overrideMimeType" in f && f.overrideMimeType("text/plain; charset=x-user-defined"), f.responseType = "arraybuffer"), f.open("GET", e), f.send();
1050
+ };
1051
+ var path = {};
1052
+ (function(i) {
1053
+ var e = i, n = (
1054
+ /**
1055
+ * Tests if the specified path is absolute.
1056
+ * @param {string} path Path to test
1057
+ * @returns {boolean} `true` if path is absolute
1058
+ */
1059
+ e.isAbsolute = function(u) {
1060
+ return /^(?:\/|\w+:)/.test(u);
1061
+ }
1062
+ ), a = (
1063
+ /**
1064
+ * Normalizes the specified path.
1065
+ * @param {string} path Path to normalize
1066
+ * @returns {string} Normalized path
1067
+ */
1068
+ e.normalize = function(u) {
1069
+ u = u.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
1070
+ var t = u.split("/"), o = n(u), s = "";
1071
+ o && (s = t.shift() + "/");
1072
+ for (var r = 0; r < t.length; )
1073
+ t[r] === ".." ? r > 0 && t[r - 1] !== ".." ? t.splice(--r, 2) : o ? t.splice(r, 1) : ++r : t[r] === "." ? t.splice(r, 1) : ++r;
1074
+ return s + t.join("/");
1075
+ }
1076
+ );
1077
+ e.resolve = function(u, t, o) {
1078
+ return o || (t = a(t)), n(t) ? t : (o || (u = a(u)), (u = u.replace(/(?:\/|^)[^/]+$/, "")).length ? a(u + "/" + t) : t);
1079
+ };
1080
+ })(path);
1081
+ var types = {}, hasRequiredTypes;
1082
+ function requireTypes() {
1083
+ return hasRequiredTypes || (hasRequiredTypes = 1, function(i) {
1084
+ var e = i, n = requireUtil(), a = [
1085
+ "double",
1086
+ // 0
1087
+ "float",
1088
+ // 1
1089
+ "int32",
1090
+ // 2
1091
+ "uint32",
1092
+ // 3
1093
+ "sint32",
1094
+ // 4
1095
+ "fixed32",
1096
+ // 5
1097
+ "sfixed32",
1098
+ // 6
1099
+ "int64",
1100
+ // 7
1101
+ "uint64",
1102
+ // 8
1103
+ "sint64",
1104
+ // 9
1105
+ "fixed64",
1106
+ // 10
1107
+ "sfixed64",
1108
+ // 11
1109
+ "bool",
1110
+ // 12
1111
+ "string",
1112
+ // 13
1113
+ "bytes"
1114
+ // 14
1115
+ ];
1116
+ function f(u, t) {
1117
+ var o = 0, s = {};
1118
+ for (t |= 0; o < u.length; ) s[a[o + t]] = u[o++];
1119
+ return s;
1120
+ }
1121
+ e.basic = f([
1122
+ /* double */
1123
+ 1,
1124
+ /* float */
1125
+ 5,
1126
+ /* int32 */
1127
+ 0,
1128
+ /* uint32 */
1129
+ 0,
1130
+ /* sint32 */
1131
+ 0,
1132
+ /* fixed32 */
1133
+ 5,
1134
+ /* sfixed32 */
1135
+ 5,
1136
+ /* int64 */
1137
+ 0,
1138
+ /* uint64 */
1139
+ 0,
1140
+ /* sint64 */
1141
+ 0,
1142
+ /* fixed64 */
1143
+ 1,
1144
+ /* sfixed64 */
1145
+ 1,
1146
+ /* bool */
1147
+ 0,
1148
+ /* string */
1149
+ 2,
1150
+ /* bytes */
1151
+ 2
1152
+ ]), e.defaults = f([
1153
+ /* double */
1154
+ 0,
1155
+ /* float */
1156
+ 0,
1157
+ /* int32 */
1158
+ 0,
1159
+ /* uint32 */
1160
+ 0,
1161
+ /* sint32 */
1162
+ 0,
1163
+ /* fixed32 */
1164
+ 0,
1165
+ /* sfixed32 */
1166
+ 0,
1167
+ /* int64 */
1168
+ 0,
1169
+ /* uint64 */
1170
+ 0,
1171
+ /* sint64 */
1172
+ 0,
1173
+ /* fixed64 */
1174
+ 0,
1175
+ /* sfixed64 */
1176
+ 0,
1177
+ /* bool */
1178
+ !1,
1179
+ /* string */
1180
+ "",
1181
+ /* bytes */
1182
+ n.emptyArray,
1183
+ /* message */
1184
+ null
1185
+ ]), e.long = f([
1186
+ /* int64 */
1187
+ 0,
1188
+ /* uint64 */
1189
+ 0,
1190
+ /* sint64 */
1191
+ 0,
1192
+ /* fixed64 */
1193
+ 1,
1194
+ /* sfixed64 */
1195
+ 1
1196
+ ], 7), e.mapKey = f([
1197
+ /* int32 */
1198
+ 0,
1199
+ /* uint32 */
1200
+ 0,
1201
+ /* sint32 */
1202
+ 0,
1203
+ /* fixed32 */
1204
+ 5,
1205
+ /* sfixed32 */
1206
+ 5,
1207
+ /* int64 */
1208
+ 0,
1209
+ /* uint64 */
1210
+ 0,
1211
+ /* sint64 */
1212
+ 0,
1213
+ /* fixed64 */
1214
+ 1,
1215
+ /* sfixed64 */
1216
+ 1,
1217
+ /* bool */
1218
+ 0,
1219
+ /* string */
1220
+ 2
1221
+ ], 2), e.packed = f([
1222
+ /* double */
1223
+ 1,
1224
+ /* float */
1225
+ 5,
1226
+ /* int32 */
1227
+ 0,
1228
+ /* uint32 */
1229
+ 0,
1230
+ /* sint32 */
1231
+ 0,
1232
+ /* fixed32 */
1233
+ 5,
1234
+ /* sfixed32 */
1235
+ 5,
1236
+ /* int64 */
1237
+ 0,
1238
+ /* uint64 */
1239
+ 0,
1240
+ /* sint64 */
1241
+ 0,
1242
+ /* fixed64 */
1243
+ 1,
1244
+ /* sfixed64 */
1245
+ 1,
1246
+ /* bool */
1247
+ 0
1248
+ ]);
1249
+ }(types)), types;
1250
+ }
1251
+ var field, hasRequiredField;
1252
+ function requireField() {
1253
+ if (hasRequiredField) return field;
1254
+ hasRequiredField = 1, field = t;
1255
+ var i = requireObject();
1256
+ ((t.prototype = Object.create(i.prototype)).constructor = t).className = "Field";
1257
+ var e = require_enum(), n = requireTypes(), a = requireUtil(), f, u = /^required|optional|repeated$/;
1258
+ t.fromJSON = function(s, r) {
1259
+ return new t(s, r.id, r.type, r.rule, r.extend, r.options, r.comment);
1260
+ };
1261
+ function t(o, s, r, l, d, h, c) {
1262
+ if (a.isObject(l) ? (c = d, h = l, l = d = void 0) : a.isObject(d) && (c = h, h = d, d = void 0), i.call(this, o, h), !a.isInteger(s) || s < 0)
1263
+ throw TypeError("id must be a non-negative integer");
1264
+ if (!a.isString(r))
1265
+ throw TypeError("type must be a string");
1266
+ if (l !== void 0 && !u.test(l = l.toString().toLowerCase()))
1267
+ throw TypeError("rule must be a string rule");
1268
+ if (d !== void 0 && !a.isString(d))
1269
+ throw TypeError("extend must be a string");
1270
+ l === "proto3_optional" && (l = "optional"), this.rule = l && l !== "optional" ? l : void 0, this.type = r, this.id = s, this.extend = d || void 0, this.required = l === "required", this.optional = !this.required, this.repeated = l === "repeated", this.map = !1, this.message = null, this.partOf = null, this.typeDefault = null, this.defaultValue = null, this.long = a.Long ? n.long[r] !== void 0 : (
1271
+ /* istanbul ignore next */
1272
+ !1
1273
+ ), this.bytes = r === "bytes", this.resolvedType = null, this.extensionField = null, this.declaringField = null, this._packed = null, this.comment = c;
1274
+ }
1275
+ return Object.defineProperty(t.prototype, "packed", {
1276
+ get: function() {
1277
+ return this._packed === null && (this._packed = this.getOption("packed") !== !1), this._packed;
1278
+ }
1279
+ }), t.prototype.setOption = function(s, r, l) {
1280
+ return s === "packed" && (this._packed = null), i.prototype.setOption.call(this, s, r, l);
1281
+ }, t.prototype.toJSON = function(s) {
1282
+ var r = s ? !!s.keepComments : !1;
1283
+ return a.toObject([
1284
+ "rule",
1285
+ this.rule !== "optional" && this.rule || void 0,
1286
+ "type",
1287
+ this.type,
1288
+ "id",
1289
+ this.id,
1290
+ "extend",
1291
+ this.extend,
1292
+ "options",
1293
+ this.options,
1294
+ "comment",
1295
+ r ? this.comment : void 0
1296
+ ]);
1297
+ }, t.prototype.resolve = function() {
1298
+ if (this.resolved)
1299
+ return this;
1300
+ if ((this.typeDefault = n.defaults[this.type]) === void 0 ? (this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type), this.resolvedType instanceof f ? 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)
1301
+ this.typeDefault = a.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"), Object.freeze && Object.freeze(this.typeDefault);
1302
+ else if (this.bytes && typeof this.typeDefault == "string") {
1303
+ var s;
1304
+ a.base64.test(this.typeDefault) ? a.base64.decode(this.typeDefault, s = a.newBuffer(a.base64.length(this.typeDefault)), 0) : a.utf8.write(this.typeDefault, s = a.newBuffer(a.utf8.length(this.typeDefault)), 0), this.typeDefault = s;
1305
+ }
1306
+ return this.map ? this.defaultValue = a.emptyObject : this.repeated ? this.defaultValue = a.emptyArray : this.defaultValue = this.typeDefault, this.parent instanceof f && (this.parent.ctor.prototype[this.name] = this.defaultValue), i.prototype.resolve.call(this);
1307
+ }, t.d = function(s, r, l, d) {
1308
+ return typeof r == "function" ? r = a.decorateType(r).name : r && typeof r == "object" && (r = a.decorateEnum(r).name), function(c, y) {
1309
+ a.decorateType(c.constructor).add(new t(y, s, r, l, { default: d }));
1310
+ };
1311
+ }, t._configure = function(s) {
1312
+ f = s;
1313
+ }, field;
1314
+ }
1315
+ var oneof, hasRequiredOneof;
1316
+ function requireOneof() {
1317
+ if (hasRequiredOneof) return oneof;
1318
+ hasRequiredOneof = 1, oneof = a;
1319
+ var i = requireObject();
1320
+ ((a.prototype = Object.create(i.prototype)).constructor = a).className = "OneOf";
1321
+ var e = requireField(), n = requireUtil();
1322
+ function a(u, t, o, s) {
1323
+ if (Array.isArray(t) || (o = t, t = void 0), i.call(this, u, o), !(t === void 0 || Array.isArray(t)))
1324
+ throw TypeError("fieldNames must be an Array");
1325
+ this.oneof = t || [], this.fieldsArray = [], this.comment = s;
1326
+ }
1327
+ a.fromJSON = function(t, o) {
1328
+ return new a(t, o.oneof, o.options, o.comment);
1329
+ }, a.prototype.toJSON = function(t) {
1330
+ var o = t ? !!t.keepComments : !1;
1331
+ return n.toObject([
1332
+ "options",
1333
+ this.options,
1334
+ "oneof",
1335
+ this.oneof,
1336
+ "comment",
1337
+ o ? this.comment : void 0
1338
+ ]);
1339
+ };
1340
+ function f(u) {
1341
+ if (u.parent)
1342
+ for (var t = 0; t < u.fieldsArray.length; ++t)
1343
+ u.fieldsArray[t].parent || u.parent.add(u.fieldsArray[t]);
1344
+ }
1345
+ return a.prototype.add = function(t) {
1346
+ if (!(t instanceof e))
1347
+ throw TypeError("field must be a Field");
1348
+ return t.parent && t.parent !== this.parent && t.parent.remove(t), this.oneof.push(t.name), this.fieldsArray.push(t), t.partOf = this, f(this), this;
1349
+ }, a.prototype.remove = function(t) {
1350
+ if (!(t instanceof e))
1351
+ throw TypeError("field must be a Field");
1352
+ var o = this.fieldsArray.indexOf(t);
1353
+ if (o < 0)
1354
+ throw Error(t + " is not a member of " + this);
1355
+ return this.fieldsArray.splice(o, 1), o = this.oneof.indexOf(t.name), o > -1 && this.oneof.splice(o, 1), t.partOf = null, this;
1356
+ }, a.prototype.onAdd = function(t) {
1357
+ i.prototype.onAdd.call(this, t);
1358
+ for (var o = this, s = 0; s < this.oneof.length; ++s) {
1359
+ var r = t.get(this.oneof[s]);
1360
+ r && !r.partOf && (r.partOf = o, o.fieldsArray.push(r));
1361
+ }
1362
+ f(this);
1363
+ }, a.prototype.onRemove = function(t) {
1364
+ for (var o = 0, s; o < this.fieldsArray.length; ++o)
1365
+ (s = this.fieldsArray[o]).parent && s.parent.remove(s);
1366
+ i.prototype.onRemove.call(this, t);
1367
+ }, a.d = function() {
1368
+ for (var t = new Array(arguments.length), o = 0; o < arguments.length; )
1369
+ t[o] = arguments[o++];
1370
+ return function(r, l) {
1371
+ n.decorateType(r.constructor).add(new a(l, t)), Object.defineProperty(r, l, {
1372
+ get: n.oneOfGetter(t),
1373
+ set: n.oneOfSetter(t)
1374
+ });
1375
+ };
1376
+ }, oneof;
1377
+ }
1378
+ var namespace, hasRequiredNamespace;
1379
+ function requireNamespace() {
1380
+ if (hasRequiredNamespace) return namespace;
1381
+ hasRequiredNamespace = 1, namespace = s;
1382
+ var i = requireObject();
1383
+ ((s.prototype = Object.create(i.prototype)).constructor = s).className = "Namespace";
1384
+ var e = requireField(), n = requireUtil(), a = requireOneof(), f, u, t;
1385
+ s.fromJSON = function(d, h) {
1386
+ return new s(d, h.options).addJSON(h.nested);
1387
+ };
1388
+ function o(l, d) {
1389
+ if (l && l.length) {
1390
+ for (var h = {}, c = 0; c < l.length; ++c)
1391
+ h[l[c].name] = l[c].toJSON(d);
1392
+ return h;
1393
+ }
1394
+ }
1395
+ s.arrayToJSON = o, s.isReservedId = function(d, h) {
1396
+ if (d) {
1397
+ for (var c = 0; c < d.length; ++c)
1398
+ if (typeof d[c] != "string" && d[c][0] <= h && d[c][1] > h)
1399
+ return !0;
1400
+ }
1401
+ return !1;
1402
+ }, s.isReservedName = function(d, h) {
1403
+ if (d) {
1404
+ for (var c = 0; c < d.length; ++c)
1405
+ if (d[c] === h)
1406
+ return !0;
1407
+ }
1408
+ return !1;
1409
+ };
1410
+ function s(l, d) {
1411
+ i.call(this, l, d), this.nested = void 0, this._nestedArray = null;
1412
+ }
1413
+ function r(l) {
1414
+ return l._nestedArray = null, l;
1415
+ }
1416
+ return Object.defineProperty(s.prototype, "nestedArray", {
1417
+ get: function() {
1418
+ return this._nestedArray || (this._nestedArray = n.toArray(this.nested));
1419
+ }
1420
+ }), s.prototype.toJSON = function(d) {
1421
+ return n.toObject([
1422
+ "options",
1423
+ this.options,
1424
+ "nested",
1425
+ o(this.nestedArray, d)
1426
+ ]);
1427
+ }, s.prototype.addJSON = function(d) {
1428
+ var h = this;
1429
+ if (d)
1430
+ for (var c = Object.keys(d), y = 0, m; y < c.length; ++y)
1431
+ m = d[c[y]], h.add(
1432
+ // most to least likely
1433
+ (m.fields !== void 0 ? f.fromJSON : m.values !== void 0 ? t.fromJSON : m.methods !== void 0 ? u.fromJSON : m.id !== void 0 ? e.fromJSON : s.fromJSON)(c[y], m)
1434
+ );
1435
+ return this;
1436
+ }, s.prototype.get = function(d) {
1437
+ return this.nested && this.nested[d] || null;
1438
+ }, s.prototype.getEnum = function(d) {
1439
+ if (this.nested && this.nested[d] instanceof t)
1440
+ return this.nested[d].values;
1441
+ throw Error("no such enum: " + d);
1442
+ }, s.prototype.add = function(d) {
1443
+ if (!(d instanceof e && d.extend !== void 0 || d instanceof f || d instanceof a || d instanceof t || d instanceof u || d instanceof s))
1444
+ throw TypeError("object must be a valid nested object");
1445
+ if (!this.nested)
1446
+ this.nested = {};
1447
+ else {
1448
+ var h = this.get(d.name);
1449
+ if (h)
1450
+ if (h instanceof s && d instanceof s && !(h instanceof f || h instanceof u)) {
1451
+ for (var c = h.nestedArray, y = 0; y < c.length; ++y)
1452
+ d.add(c[y]);
1453
+ this.remove(h), this.nested || (this.nested = {}), d.setOptions(h.options, !0);
1454
+ } else
1455
+ throw Error("duplicate name '" + d.name + "' in " + this);
1456
+ }
1457
+ return this.nested[d.name] = d, d.onAdd(this), r(this);
1458
+ }, s.prototype.remove = function(d) {
1459
+ if (!(d instanceof i))
1460
+ throw TypeError("object must be a ReflectionObject");
1461
+ if (d.parent !== this)
1462
+ throw Error(d + " is not a member of " + this);
1463
+ return delete this.nested[d.name], Object.keys(this.nested).length || (this.nested = void 0), d.onRemove(this), r(this);
1464
+ }, s.prototype.define = function(d, h) {
1465
+ if (n.isString(d))
1466
+ d = d.split(".");
1467
+ else if (!Array.isArray(d))
1468
+ throw TypeError("illegal path");
1469
+ if (d && d.length && d[0] === "")
1470
+ throw Error("path must be relative");
1471
+ for (var c = this; d.length > 0; ) {
1472
+ var y = d.shift();
1473
+ if (c.nested && c.nested[y]) {
1474
+ if (c = c.nested[y], !(c instanceof s))
1475
+ throw Error("path conflicts with non-namespace objects");
1476
+ } else
1477
+ c.add(c = new s(y));
1478
+ }
1479
+ return h && c.addJSON(h), c;
1480
+ }, s.prototype.resolveAll = function() {
1481
+ for (var d = this.nestedArray, h = 0; h < d.length; )
1482
+ d[h] instanceof s ? d[h++].resolveAll() : d[h++].resolve();
1483
+ return this.resolve();
1484
+ }, s.prototype.lookup = function(d, h, c) {
1485
+ if (typeof h == "boolean" ? (c = h, h = void 0) : h && !Array.isArray(h) && (h = [h]), n.isString(d) && d.length) {
1486
+ if (d === ".")
1487
+ return this.root;
1488
+ d = d.split(".");
1489
+ } else if (!d.length)
1490
+ return this;
1491
+ if (d[0] === "")
1492
+ return this.root.lookup(d.slice(1), h);
1493
+ var y = this.get(d[0]);
1494
+ if (y) {
1495
+ if (d.length === 1) {
1496
+ if (!h || h.indexOf(y.constructor) > -1)
1497
+ return y;
1498
+ } else if (y instanceof s && (y = y.lookup(d.slice(1), h, !0)))
1499
+ return y;
1500
+ } else
1501
+ for (var m = 0; m < this.nestedArray.length; ++m)
1502
+ if (this._nestedArray[m] instanceof s && (y = this._nestedArray[m].lookup(d, h, !0)))
1503
+ return y;
1504
+ return this.parent === null || c ? null : this.parent.lookup(d, h);
1505
+ }, s.prototype.lookupType = function(d) {
1506
+ var h = this.lookup(d, [f]);
1507
+ if (!h)
1508
+ throw Error("no such type: " + d);
1509
+ return h;
1510
+ }, s.prototype.lookupEnum = function(d) {
1511
+ var h = this.lookup(d, [t]);
1512
+ if (!h)
1513
+ throw Error("no such Enum '" + d + "' in " + this);
1514
+ return h;
1515
+ }, s.prototype.lookupTypeOrEnum = function(d) {
1516
+ var h = this.lookup(d, [f, t]);
1517
+ if (!h)
1518
+ throw Error("no such Type or Enum '" + d + "' in " + this);
1519
+ return h;
1520
+ }, s.prototype.lookupService = function(d) {
1521
+ var h = this.lookup(d, [u]);
1522
+ if (!h)
1523
+ throw Error("no such Service '" + d + "' in " + this);
1524
+ return h;
1525
+ }, s._configure = function(l, d, h) {
1526
+ f = l, u = d, t = h;
1527
+ }, namespace;
1528
+ }
1529
+ var mapfield, hasRequiredMapfield;
1530
+ function requireMapfield() {
1531
+ if (hasRequiredMapfield) return mapfield;
1532
+ hasRequiredMapfield = 1, mapfield = a;
1533
+ var i = requireField();
1534
+ ((a.prototype = Object.create(i.prototype)).constructor = a).className = "MapField";
1535
+ var e = requireTypes(), n = requireUtil();
1536
+ function a(f, u, t, o, s, r) {
1537
+ if (i.call(this, f, u, o, void 0, void 0, s, r), !n.isString(t))
1538
+ throw TypeError("keyType must be a string");
1539
+ this.keyType = t, this.resolvedKeyType = null, this.map = !0;
1540
+ }
1541
+ return a.fromJSON = function(u, t) {
1542
+ return new a(u, t.id, t.keyType, t.type, t.options, t.comment);
1543
+ }, a.prototype.toJSON = function(u) {
1544
+ var t = u ? !!u.keepComments : !1;
1545
+ return n.toObject([
1546
+ "keyType",
1547
+ this.keyType,
1548
+ "type",
1549
+ this.type,
1550
+ "id",
1551
+ this.id,
1552
+ "extend",
1553
+ this.extend,
1554
+ "options",
1555
+ this.options,
1556
+ "comment",
1557
+ t ? this.comment : void 0
1558
+ ]);
1559
+ }, a.prototype.resolve = function() {
1560
+ if (this.resolved)
1561
+ return this;
1562
+ if (e.mapKey[this.keyType] === void 0)
1563
+ throw Error("invalid key type: " + this.keyType);
1564
+ return i.prototype.resolve.call(this);
1565
+ }, a.d = function(u, t, o) {
1566
+ return typeof o == "function" ? o = n.decorateType(o).name : o && typeof o == "object" && (o = n.decorateEnum(o).name), function(r, l) {
1567
+ n.decorateType(r.constructor).add(new a(l, u, t, o));
1568
+ };
1569
+ }, mapfield;
1570
+ }
1571
+ var method, hasRequiredMethod;
1572
+ function requireMethod() {
1573
+ if (hasRequiredMethod) return method;
1574
+ hasRequiredMethod = 1, method = n;
1575
+ var i = requireObject();
1576
+ ((n.prototype = Object.create(i.prototype)).constructor = n).className = "Method";
1577
+ var e = requireUtil();
1578
+ function n(a, f, u, t, o, s, r, l, d) {
1579
+ if (e.isObject(o) ? (r = o, o = s = void 0) : e.isObject(s) && (r = s, s = void 0), !(f === void 0 || e.isString(f)))
1580
+ throw TypeError("type must be a string");
1581
+ if (!e.isString(u))
1582
+ throw TypeError("requestType must be a string");
1583
+ if (!e.isString(t))
1584
+ throw TypeError("responseType must be a string");
1585
+ i.call(this, a, r), this.type = f || "rpc", this.requestType = u, this.requestStream = o ? !0 : void 0, this.responseType = t, this.responseStream = s ? !0 : void 0, this.resolvedRequestType = null, this.resolvedResponseType = null, this.comment = l, this.parsedOptions = d;
1586
+ }
1587
+ return n.fromJSON = function(f, u) {
1588
+ return new n(f, u.type, u.requestType, u.responseType, u.requestStream, u.responseStream, u.options, u.comment, u.parsedOptions);
1589
+ }, n.prototype.toJSON = function(f) {
1590
+ var u = f ? !!f.keepComments : !1;
1591
+ return e.toObject([
1592
+ "type",
1593
+ this.type !== "rpc" && /* istanbul ignore next */
1594
+ this.type || void 0,
1595
+ "requestType",
1596
+ this.requestType,
1597
+ "requestStream",
1598
+ this.requestStream,
1599
+ "responseType",
1600
+ this.responseType,
1601
+ "responseStream",
1602
+ this.responseStream,
1603
+ "options",
1604
+ this.options,
1605
+ "comment",
1606
+ u ? this.comment : void 0,
1607
+ "parsedOptions",
1608
+ this.parsedOptions
1609
+ ]);
1610
+ }, n.prototype.resolve = function() {
1611
+ return this.resolved ? this : (this.resolvedRequestType = this.parent.lookupType(this.requestType), this.resolvedResponseType = this.parent.lookupType(this.responseType), i.prototype.resolve.call(this));
1612
+ }, method;
1613
+ }
1614
+ var service, hasRequiredService;
1615
+ function requireService() {
1616
+ if (hasRequiredService) return service;
1617
+ hasRequiredService = 1, service = f;
1618
+ var i = requireNamespace();
1619
+ ((f.prototype = Object.create(i.prototype)).constructor = f).className = "Service";
1620
+ var e = requireMethod(), n = requireUtil(), a = rpc;
1621
+ function f(t, o) {
1622
+ i.call(this, t, o), this.methods = {}, this._methodsArray = null;
1623
+ }
1624
+ f.fromJSON = function(o, s) {
1625
+ var r = new f(o, s.options);
1626
+ if (s.methods)
1627
+ for (var l = Object.keys(s.methods), d = 0; d < l.length; ++d)
1628
+ r.add(e.fromJSON(l[d], s.methods[l[d]]));
1629
+ return s.nested && r.addJSON(s.nested), r.comment = s.comment, r;
1630
+ }, f.prototype.toJSON = function(o) {
1631
+ var s = i.prototype.toJSON.call(this, o), r = o ? !!o.keepComments : !1;
1632
+ return n.toObject([
1633
+ "options",
1634
+ s && s.options || void 0,
1635
+ "methods",
1636
+ i.arrayToJSON(this.methodsArray, o) || /* istanbul ignore next */
1637
+ {},
1638
+ "nested",
1639
+ s && s.nested || void 0,
1640
+ "comment",
1641
+ r ? this.comment : void 0
1642
+ ]);
1643
+ }, Object.defineProperty(f.prototype, "methodsArray", {
1644
+ get: function() {
1645
+ return this._methodsArray || (this._methodsArray = n.toArray(this.methods));
1646
+ }
1647
+ });
1648
+ function u(t) {
1649
+ return t._methodsArray = null, t;
1650
+ }
1651
+ return f.prototype.get = function(o) {
1652
+ return this.methods[o] || i.prototype.get.call(this, o);
1653
+ }, f.prototype.resolveAll = function() {
1654
+ for (var o = this.methodsArray, s = 0; s < o.length; ++s)
1655
+ o[s].resolve();
1656
+ return i.prototype.resolve.call(this);
1657
+ }, f.prototype.add = function(o) {
1658
+ if (this.get(o.name))
1659
+ throw Error("duplicate name '" + o.name + "' in " + this);
1660
+ return o instanceof e ? (this.methods[o.name] = o, o.parent = this, u(this)) : i.prototype.add.call(this, o);
1661
+ }, f.prototype.remove = function(o) {
1662
+ if (o instanceof e) {
1663
+ if (this.methods[o.name] !== o)
1664
+ throw Error(o + " is not a member of " + this);
1665
+ return delete this.methods[o.name], o.parent = null, u(this);
1666
+ }
1667
+ return i.prototype.remove.call(this, o);
1668
+ }, f.prototype.create = function(o, s, r) {
1669
+ for (var l = new a.Service(o, s, r), d = 0, h; d < /* initializes */
1670
+ this.methodsArray.length; ++d) {
1671
+ var c = n.lcFirst((h = this._methodsArray[d]).resolve().name).replace(/[^$\w_]/g, "");
1672
+ l[c] = n.codegen(["r", "c"], n.isReserved(c) ? c + "_" : c)("return this.rpcCall(m,q,s,r,c)")({
1673
+ m: h,
1674
+ q: h.resolvedRequestType.ctor,
1675
+ s: h.resolvedResponseType.ctor
1676
+ });
1677
+ }
1678
+ return l;
1679
+ }, service;
1680
+ }
1681
+ var message = Message, util = requireMinimal();
1682
+ function Message(i) {
1683
+ if (i)
1684
+ for (var e = Object.keys(i), n = 0; n < e.length; ++n)
1685
+ this[e[n]] = i[e[n]];
1686
+ }
1687
+ Message.create = function i(e) {
1688
+ return this.$type.create(e);
1689
+ };
1690
+ Message.encode = function i(e, n) {
1691
+ return this.$type.encode(e, n);
1692
+ };
1693
+ Message.encodeDelimited = function i(e, n) {
1694
+ return this.$type.encodeDelimited(e, n);
1695
+ };
1696
+ Message.decode = function i(e) {
1697
+ return this.$type.decode(e);
1698
+ };
1699
+ Message.decodeDelimited = function i(e) {
1700
+ return this.$type.decodeDelimited(e);
1701
+ };
1702
+ Message.verify = function i(e) {
1703
+ return this.$type.verify(e);
1704
+ };
1705
+ Message.fromObject = function i(e) {
1706
+ return this.$type.fromObject(e);
1707
+ };
1708
+ Message.toObject = function i(e, n) {
1709
+ return this.$type.toObject(e, n);
1710
+ };
1711
+ Message.prototype.toJSON = function i() {
1712
+ return this.$type.toObject(this, util.toJSONOptions);
1713
+ };
1714
+ var decoder_1, hasRequiredDecoder;
1715
+ function requireDecoder() {
1716
+ if (hasRequiredDecoder) return decoder_1;
1717
+ hasRequiredDecoder = 1, decoder_1 = f;
1718
+ var i = require_enum(), e = requireTypes(), n = requireUtil();
1719
+ function a(u) {
1720
+ return "missing required '" + u.name + "'";
1721
+ }
1722
+ function f(u) {
1723
+ var t = n.codegen(["r", "l"], u.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (u.fieldsArray.filter(function(h) {
1724
+ return h.map;
1725
+ }).length ? ",k,value" : ""))("while(r.pos<c){")("var t=r.uint32()");
1726
+ u.group && t("if((t&7)===4)")("break"), t("switch(t>>>3){");
1727
+ for (var o = 0; o < /* initializes */
1728
+ u.fieldsArray.length; ++o) {
1729
+ var s = u._fieldsArray[o].resolve(), r = s.resolvedType instanceof i ? "int32" : s.type, l = "m" + n.safeProp(s.name);
1730
+ t("case %i: {", s.id), s.map ? (t("if(%s===util.emptyObject)", l)("%s={}", l)("var c2 = r.uint32()+r.pos"), e.defaults[s.keyType] !== void 0 ? t("k=%j", e.defaults[s.keyType]) : t("k=null"), e.defaults[r] !== void 0 ? t("value=%j", e.defaults[r]) : t("value=null"), t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break", s.keyType)("case 2:"), e.basic[r] === void 0 ? t("value=types[%i].decode(r,r.uint32())", o) : t("value=r.%s()", r), t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"), e.long[s.keyType] !== void 0 ? t('%s[typeof k==="object"?util.longToHash(k):k]=value', l) : t("%s[k]=value", l)) : s.repeated ? (t("if(!(%s&&%s.length))", l, l)("%s=[]", l), e.packed[r] !== void 0 && t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", l, r)("}else"), e.basic[r] === void 0 ? t(s.resolvedType.group ? "%s.push(types[%i].decode(r))" : "%s.push(types[%i].decode(r,r.uint32()))", l, o) : t("%s.push(r.%s())", l, r)) : e.basic[r] === void 0 ? t(s.resolvedType.group ? "%s=types[%i].decode(r)" : "%s=types[%i].decode(r,r.uint32())", l, o) : t("%s=r.%s()", l, r), t("break")("}");
1731
+ }
1732
+ for (t("default:")("r.skipType(t&7)")("break")("}")("}"), o = 0; o < u._fieldsArray.length; ++o) {
1733
+ var d = u._fieldsArray[o];
1734
+ d.required && t("if(!m.hasOwnProperty(%j))", d.name)("throw util.ProtocolError(%j,{instance:m})", a(d));
1735
+ }
1736
+ return t("return m");
1737
+ }
1738
+ return decoder_1;
1739
+ }
1740
+ var verifier_1, hasRequiredVerifier;
1741
+ function requireVerifier() {
1742
+ if (hasRequiredVerifier) return verifier_1;
1743
+ hasRequiredVerifier = 1, verifier_1 = u;
1744
+ var i = require_enum(), e = requireUtil();
1745
+ function n(t, o) {
1746
+ return t.name + ": " + o + (t.repeated && o !== "array" ? "[]" : t.map && o !== "object" ? "{k:" + t.keyType + "}" : "") + " expected";
1747
+ }
1748
+ function a(t, o, s, r) {
1749
+ if (o.resolvedType)
1750
+ if (o.resolvedType instanceof i) {
1751
+ t("switch(%s){", r)("default:")("return%j", n(o, "enum value"));
1752
+ for (var l = Object.keys(o.resolvedType.values), d = 0; d < l.length; ++d) t("case %i:", o.resolvedType.values[l[d]]);
1753
+ t("break")("}");
1754
+ } else
1755
+ t("{")("var e=types[%i].verify(%s);", s, r)("if(e)")("return%j+e", o.name + ".")("}");
1756
+ else
1757
+ switch (o.type) {
1758
+ case "int32":
1759
+ case "uint32":
1760
+ case "sint32":
1761
+ case "fixed32":
1762
+ case "sfixed32":
1763
+ t("if(!util.isInteger(%s))", r)("return%j", n(o, "integer"));
1764
+ break;
1765
+ case "int64":
1766
+ case "uint64":
1767
+ case "sint64":
1768
+ case "fixed64":
1769
+ case "sfixed64":
1770
+ t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", r, r, r, r)("return%j", n(o, "integer|Long"));
1771
+ break;
1772
+ case "float":
1773
+ case "double":
1774
+ t('if(typeof %s!=="number")', r)("return%j", n(o, "number"));
1775
+ break;
1776
+ case "bool":
1777
+ t('if(typeof %s!=="boolean")', r)("return%j", n(o, "boolean"));
1778
+ break;
1779
+ case "string":
1780
+ t("if(!util.isString(%s))", r)("return%j", n(o, "string"));
1781
+ break;
1782
+ case "bytes":
1783
+ t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', r, r, r)("return%j", n(o, "buffer"));
1784
+ break;
1785
+ }
1786
+ return t;
1787
+ }
1788
+ function f(t, o, s) {
1789
+ switch (o.keyType) {
1790
+ case "int32":
1791
+ case "uint32":
1792
+ case "sint32":
1793
+ case "fixed32":
1794
+ case "sfixed32":
1795
+ t("if(!util.key32Re.test(%s))", s)("return%j", n(o, "integer key"));
1796
+ break;
1797
+ case "int64":
1798
+ case "uint64":
1799
+ case "sint64":
1800
+ case "fixed64":
1801
+ case "sfixed64":
1802
+ t("if(!util.key64Re.test(%s))", s)("return%j", n(o, "integer|Long key"));
1803
+ break;
1804
+ case "bool":
1805
+ t("if(!util.key2Re.test(%s))", s)("return%j", n(o, "boolean key"));
1806
+ break;
1807
+ }
1808
+ return t;
1809
+ }
1810
+ function u(t) {
1811
+ var o = e.codegen(["m"], t.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected"), s = t.oneofsArray, r = {};
1812
+ s.length && o("var p={}");
1813
+ for (var l = 0; l < /* initializes */
1814
+ t.fieldsArray.length; ++l) {
1815
+ var d = t._fieldsArray[l].resolve(), h = "m" + e.safeProp(d.name);
1816
+ if (d.optional && o("if(%s!=null&&m.hasOwnProperty(%j)){", h, d.name), d.map)
1817
+ o("if(!util.isObject(%s))", h)("return%j", n(d, "object"))("var k=Object.keys(%s)", h)("for(var i=0;i<k.length;++i){"), f(o, d, "k[i]"), a(o, d, l, h + "[k[i]]")("}");
1818
+ else if (d.repeated)
1819
+ o("if(!Array.isArray(%s))", h)("return%j", n(d, "array"))("for(var i=0;i<%s.length;++i){", h), a(o, d, l, h + "[i]")("}");
1820
+ else {
1821
+ if (d.partOf) {
1822
+ var c = e.safeProp(d.partOf.name);
1823
+ r[d.partOf.name] === 1 && o("if(p%s===1)", c)("return%j", d.partOf.name + ": multiple values"), r[d.partOf.name] = 1, o("p%s=1", c);
1824
+ }
1825
+ a(o, d, l, h);
1826
+ }
1827
+ d.optional && o("}");
1828
+ }
1829
+ return o("return null");
1830
+ }
1831
+ return verifier_1;
1832
+ }
1833
+ var converter = {}, hasRequiredConverter;
1834
+ function requireConverter() {
1835
+ return hasRequiredConverter || (hasRequiredConverter = 1, function(i) {
1836
+ var e = i, n = require_enum(), a = requireUtil();
1837
+ function f(t, o, s, r) {
1838
+ var l = !1;
1839
+ if (o.resolvedType)
1840
+ if (o.resolvedType instanceof n) {
1841
+ t("switch(d%s){", r);
1842
+ for (var d = o.resolvedType.values, h = Object.keys(d), c = 0; c < h.length; ++c)
1843
+ d[h[c]] === o.typeDefault && !l && (t("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}', r, r, r), o.repeated || t("break"), l = !0), t("case%j:", h[c])("case %i:", d[h[c]])("m%s=%j", r, d[h[c]])("break");
1844
+ t("}");
1845
+ } else t('if(typeof d%s!=="object")', r)("throw TypeError(%j)", o.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", r, s, r);
1846
+ else {
1847
+ var y = !1;
1848
+ switch (o.type) {
1849
+ case "double":
1850
+ case "float":
1851
+ t("m%s=Number(d%s)", r, r);
1852
+ break;
1853
+ case "uint32":
1854
+ case "fixed32":
1855
+ t("m%s=d%s>>>0", r, r);
1856
+ break;
1857
+ case "int32":
1858
+ case "sint32":
1859
+ case "sfixed32":
1860
+ t("m%s=d%s|0", r, r);
1861
+ break;
1862
+ case "uint64":
1863
+ y = !0;
1864
+ case "int64":
1865
+ case "sint64":
1866
+ case "fixed64":
1867
+ case "sfixed64":
1868
+ t("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", r, r, y)('else if(typeof d%s==="string")', r)("m%s=parseInt(d%s,10)", r, r)('else if(typeof d%s==="number")', r)("m%s=d%s", r, r)('else if(typeof d%s==="object")', r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", r, r, r, y ? "true" : "");
1869
+ break;
1870
+ case "bytes":
1871
+ t('if(typeof d%s==="string")', r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", r, r, r)("else if(d%s.length >= 0)", r)("m%s=d%s", r, r);
1872
+ break;
1873
+ case "string":
1874
+ t("m%s=String(d%s)", r, r);
1875
+ break;
1876
+ case "bool":
1877
+ t("m%s=Boolean(d%s)", r, r);
1878
+ break;
1879
+ }
1880
+ }
1881
+ return t;
1882
+ }
1883
+ e.fromObject = function(o) {
1884
+ var s = o.fieldsArray, r = a.codegen(["d"], o.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
1885
+ if (!s.length) return r("return new this.ctor");
1886
+ r("var m=new this.ctor");
1887
+ for (var l = 0; l < s.length; ++l) {
1888
+ var d = s[l].resolve(), h = a.safeProp(d.name);
1889
+ d.map ? (r("if(d%s){", h)('if(typeof d%s!=="object")', h)("throw TypeError(%j)", d.fullName + ": object expected")("m%s={}", h)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", h), f(
1890
+ r,
1891
+ d,
1892
+ /* not sorted */
1893
+ l,
1894
+ h + "[ks[i]]"
1895
+ )("}")("}")) : d.repeated ? (r("if(d%s){", h)("if(!Array.isArray(d%s))", h)("throw TypeError(%j)", d.fullName + ": array expected")("m%s=[]", h)("for(var i=0;i<d%s.length;++i){", h), f(
1896
+ r,
1897
+ d,
1898
+ /* not sorted */
1899
+ l,
1900
+ h + "[i]"
1901
+ )("}")("}")) : (d.resolvedType instanceof n || r("if(d%s!=null){", h), f(
1902
+ r,
1903
+ d,
1904
+ /* not sorted */
1905
+ l,
1906
+ h
1907
+ ), d.resolvedType instanceof n || r("}"));
1908
+ }
1909
+ return r("return m");
1910
+ };
1911
+ function u(t, o, s, r) {
1912
+ if (o.resolvedType)
1913
+ o.resolvedType instanceof n ? t("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", r, s, r, r, s, r, r) : t("d%s=types[%i].toObject(m%s,o)", r, s, r);
1914
+ else {
1915
+ var l = !1;
1916
+ switch (o.type) {
1917
+ case "double":
1918
+ case "float":
1919
+ t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", r, r, r, r);
1920
+ break;
1921
+ case "uint64":
1922
+ l = !0;
1923
+ case "int64":
1924
+ case "sint64":
1925
+ case "fixed64":
1926
+ case "sfixed64":
1927
+ t('if(typeof m%s==="number")', r)("d%s=o.longs===String?String(m%s):m%s", r, r, r)("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", r, r, r, r, l ? "true" : "", r);
1928
+ break;
1929
+ case "bytes":
1930
+ t("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", r, r, r, r, r);
1931
+ break;
1932
+ default:
1933
+ t("d%s=m%s", r, r);
1934
+ break;
1935
+ }
1936
+ }
1937
+ return t;
1938
+ }
1939
+ e.toObject = function(o) {
1940
+ var s = o.fieldsArray.slice().sort(a.compareFieldsById);
1941
+ if (!s.length)
1942
+ return a.codegen()("return {}");
1943
+ for (var r = a.codegen(["m", "o"], o.name + "$toObject")("if(!o)")("o={}")("var d={}"), l = [], d = [], h = [], c = 0; c < s.length; ++c)
1944
+ s[c].partOf || (s[c].resolve().repeated ? l : s[c].map ? d : h).push(s[c]);
1945
+ if (l.length) {
1946
+ for (r("if(o.arrays||o.defaults){"), c = 0; c < l.length; ++c) r("d%s=[]", a.safeProp(l[c].name));
1947
+ r("}");
1948
+ }
1949
+ if (d.length) {
1950
+ for (r("if(o.objects||o.defaults){"), c = 0; c < d.length; ++c) r("d%s={}", a.safeProp(d[c].name));
1951
+ r("}");
1952
+ }
1953
+ if (h.length) {
1954
+ for (r("if(o.defaults){"), c = 0; c < h.length; ++c) {
1955
+ var y = h[c], m = a.safeProp(y.name);
1956
+ if (y.resolvedType instanceof n) r("d%s=o.enums===String?%j:%j", m, y.resolvedType.valuesById[y.typeDefault], y.typeDefault);
1957
+ else if (y.long) r("if(util.Long){")("var n=new util.Long(%i,%i,%j)", y.typeDefault.low, y.typeDefault.high, y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", m)("}else")("d%s=o.longs===String?%j:%i", m, y.typeDefault.toString(), y.typeDefault.toNumber());
1958
+ else if (y.bytes) {
1959
+ var b = "[" + Array.prototype.slice.call(y.typeDefault).join(",") + "]";
1960
+ r("if(o.bytes===String)d%s=%j", m, String.fromCharCode.apply(String, y.typeDefault))("else{")("d%s=%s", m, b)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", m, m)("}");
1961
+ } else r("d%s=%j", m, y.typeDefault);
1962
+ }
1963
+ r("}");
1964
+ }
1965
+ var v = !1;
1966
+ for (c = 0; c < s.length; ++c) {
1967
+ var y = s[c], p = o._fieldsArray.indexOf(y), m = a.safeProp(y.name);
1968
+ y.map ? (v || (v = !0, r("var ks2")), r("if(m%s&&(ks2=Object.keys(m%s)).length){", m, m)("d%s={}", m)("for(var j=0;j<ks2.length;++j){"), u(
1969
+ r,
1970
+ y,
1971
+ /* sorted */
1972
+ p,
1973
+ m + "[ks2[j]]"
1974
+ )("}")) : y.repeated ? (r("if(m%s&&m%s.length){", m, m)("d%s=[]", m)("for(var j=0;j<m%s.length;++j){", m), u(
1975
+ r,
1976
+ y,
1977
+ /* sorted */
1978
+ p,
1979
+ m + "[j]"
1980
+ )("}")) : (r("if(m%s!=null&&m.hasOwnProperty(%j)){", m, y.name), u(
1981
+ r,
1982
+ y,
1983
+ /* sorted */
1984
+ p,
1985
+ m
1986
+ ), y.partOf && r("if(o.oneofs)")("d%s=%j", a.safeProp(y.partOf.name), y.name)), r("}");
1987
+ }
1988
+ return r("return d");
1989
+ };
1990
+ }(converter)), converter;
1991
+ }
1992
+ var wrappers = {};
1993
+ (function(i) {
1994
+ var e = i, n = message;
1995
+ e[".google.protobuf.Any"] = {
1996
+ fromObject: function(a) {
1997
+ if (a && a["@type"]) {
1998
+ var f = a["@type"].substring(a["@type"].lastIndexOf("/") + 1), u = this.lookup(f);
1999
+ if (u) {
2000
+ var t = a["@type"].charAt(0) === "." ? a["@type"].slice(1) : a["@type"];
2001
+ return t.indexOf("/") === -1 && (t = "/" + t), this.create({
2002
+ type_url: t,
2003
+ value: u.encode(u.fromObject(a)).finish()
2004
+ });
2005
+ }
2006
+ }
2007
+ return this.fromObject(a);
2008
+ },
2009
+ toObject: function(a, f) {
2010
+ var u = "type.googleapis.com/", t = "", o = "";
2011
+ if (f && f.json && a.type_url && a.value) {
2012
+ o = a.type_url.substring(a.type_url.lastIndexOf("/") + 1), t = a.type_url.substring(0, a.type_url.lastIndexOf("/") + 1);
2013
+ var s = this.lookup(o);
2014
+ s && (a = s.decode(a.value));
2015
+ }
2016
+ if (!(a instanceof this.ctor) && a instanceof n) {
2017
+ var r = a.$type.toObject(a, f), l = a.$type.fullName[0] === "." ? a.$type.fullName.slice(1) : a.$type.fullName;
2018
+ return t === "" && (t = u), o = t + l, r["@type"] = o, r;
2019
+ }
2020
+ return this.toObject(a, f);
2021
+ }
2022
+ };
2023
+ })(wrappers);
2024
+ var type, hasRequiredType;
2025
+ function requireType() {
2026
+ if (hasRequiredType) return type;
2027
+ hasRequiredType = 1, type = m;
2028
+ var i = requireNamespace();
2029
+ ((m.prototype = Object.create(i.prototype)).constructor = m).className = "Type";
2030
+ var e = require_enum(), n = requireOneof(), a = requireField(), f = requireMapfield(), u = requireService(), t = message, o = reader, s = writer, r = requireUtil(), l = requireEncoder(), d = requireDecoder(), h = requireVerifier(), c = requireConverter(), y = wrappers;
2031
+ function m(v, p) {
2032
+ i.call(this, v, p), 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;
2033
+ }
2034
+ Object.defineProperties(m.prototype, {
2035
+ /**
2036
+ * Message fields by id.
2037
+ * @name Type#fieldsById
2038
+ * @type {Object.<number,Field>}
2039
+ * @readonly
2040
+ */
2041
+ fieldsById: {
2042
+ get: function() {
2043
+ if (this._fieldsById)
2044
+ return this._fieldsById;
2045
+ this._fieldsById = {};
2046
+ for (var v = Object.keys(this.fields), p = 0; p < v.length; ++p) {
2047
+ var g = this.fields[v[p]], _ = g.id;
2048
+ if (this._fieldsById[_])
2049
+ throw Error("duplicate id " + _ + " in " + this);
2050
+ this._fieldsById[_] = g;
2051
+ }
2052
+ return this._fieldsById;
2053
+ }
2054
+ },
2055
+ /**
2056
+ * Fields of this message as an array for iteration.
2057
+ * @name Type#fieldsArray
2058
+ * @type {Field[]}
2059
+ * @readonly
2060
+ */
2061
+ fieldsArray: {
2062
+ get: function() {
2063
+ return this._fieldsArray || (this._fieldsArray = r.toArray(this.fields));
2064
+ }
2065
+ },
2066
+ /**
2067
+ * Oneofs of this message as an array for iteration.
2068
+ * @name Type#oneofsArray
2069
+ * @type {OneOf[]}
2070
+ * @readonly
2071
+ */
2072
+ oneofsArray: {
2073
+ get: function() {
2074
+ return this._oneofsArray || (this._oneofsArray = r.toArray(this.oneofs));
2075
+ }
2076
+ },
2077
+ /**
2078
+ * The registered constructor, if any registered, otherwise a generic constructor.
2079
+ * 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.
2080
+ * @name Type#ctor
2081
+ * @type {Constructor<{}>}
2082
+ */
2083
+ ctor: {
2084
+ get: function() {
2085
+ return this._ctor || (this.ctor = m.generateConstructor(this)());
2086
+ },
2087
+ set: function(v) {
2088
+ var p = v.prototype;
2089
+ p instanceof t || ((v.prototype = new t()).constructor = v, r.merge(v.prototype, p)), v.$type = v.prototype.$type = this, r.merge(v, t, !0), this._ctor = v;
2090
+ for (var g = 0; g < /* initializes */
2091
+ this.fieldsArray.length; ++g)
2092
+ this._fieldsArray[g].resolve();
2093
+ var _ = {};
2094
+ for (g = 0; g < /* initializes */
2095
+ this.oneofsArray.length; ++g)
2096
+ _[this._oneofsArray[g].resolve().name] = {
2097
+ get: r.oneOfGetter(this._oneofsArray[g].oneof),
2098
+ set: r.oneOfSetter(this._oneofsArray[g].oneof)
2099
+ };
2100
+ g && Object.defineProperties(v.prototype, _);
2101
+ }
2102
+ }
2103
+ }), m.generateConstructor = function(p) {
2104
+ for (var g = r.codegen(["p"], p.name), _ = 0, R; _ < p.fieldsArray.length; ++_)
2105
+ (R = p._fieldsArray[_]).map ? g("this%s={}", r.safeProp(R.name)) : R.repeated && g("this%s=[]", r.safeProp(R.name));
2106
+ return g("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]]");
2107
+ };
2108
+ function b(v) {
2109
+ return v._fieldsById = v._fieldsArray = v._oneofsArray = null, delete v.encode, delete v.decode, delete v.verify, v;
2110
+ }
2111
+ return m.fromJSON = function(p, g) {
2112
+ var _ = new m(p, g.options);
2113
+ _.extensions = g.extensions, _.reserved = g.reserved;
2114
+ for (var R = Object.keys(g.fields), O = 0; O < R.length; ++O)
2115
+ _.add(
2116
+ (typeof g.fields[R[O]].keyType < "u" ? f.fromJSON : a.fromJSON)(R[O], g.fields[R[O]])
2117
+ );
2118
+ if (g.oneofs)
2119
+ for (R = Object.keys(g.oneofs), O = 0; O < R.length; ++O)
2120
+ _.add(n.fromJSON(R[O], g.oneofs[R[O]]));
2121
+ if (g.nested)
2122
+ for (R = Object.keys(g.nested), O = 0; O < R.length; ++O) {
2123
+ var T = g.nested[R[O]];
2124
+ _.add(
2125
+ // most to least likely
2126
+ (T.id !== void 0 ? a.fromJSON : T.fields !== void 0 ? m.fromJSON : T.values !== void 0 ? e.fromJSON : T.methods !== void 0 ? u.fromJSON : i.fromJSON)(R[O], T)
2127
+ );
2128
+ }
2129
+ return g.extensions && g.extensions.length && (_.extensions = g.extensions), g.reserved && g.reserved.length && (_.reserved = g.reserved), g.group && (_.group = !0), g.comment && (_.comment = g.comment), _;
2130
+ }, m.prototype.toJSON = function(p) {
2131
+ var g = i.prototype.toJSON.call(this, p), _ = p ? !!p.keepComments : !1;
2132
+ return r.toObject([
2133
+ "options",
2134
+ g && g.options || void 0,
2135
+ "oneofs",
2136
+ i.arrayToJSON(this.oneofsArray, p),
2137
+ "fields",
2138
+ i.arrayToJSON(this.fieldsArray.filter(function(R) {
2139
+ return !R.declaringField;
2140
+ }), p) || {},
2141
+ "extensions",
2142
+ this.extensions && this.extensions.length ? this.extensions : void 0,
2143
+ "reserved",
2144
+ this.reserved && this.reserved.length ? this.reserved : void 0,
2145
+ "group",
2146
+ this.group || void 0,
2147
+ "nested",
2148
+ g && g.nested || void 0,
2149
+ "comment",
2150
+ _ ? this.comment : void 0
2151
+ ]);
2152
+ }, m.prototype.resolveAll = function() {
2153
+ for (var p = this.fieldsArray, g = 0; g < p.length; )
2154
+ p[g++].resolve();
2155
+ var _ = this.oneofsArray;
2156
+ for (g = 0; g < _.length; )
2157
+ _[g++].resolve();
2158
+ return i.prototype.resolveAll.call(this);
2159
+ }, m.prototype.get = function(p) {
2160
+ return this.fields[p] || this.oneofs && this.oneofs[p] || this.nested && this.nested[p] || null;
2161
+ }, m.prototype.add = function(p) {
2162
+ if (this.get(p.name))
2163
+ throw Error("duplicate name '" + p.name + "' in " + this);
2164
+ if (p instanceof a && p.extend === void 0) {
2165
+ if (this._fieldsById ? (
2166
+ /* istanbul ignore next */
2167
+ this._fieldsById[p.id]
2168
+ ) : this.fieldsById[p.id])
2169
+ throw Error("duplicate id " + p.id + " in " + this);
2170
+ if (this.isReservedId(p.id))
2171
+ throw Error("id " + p.id + " is reserved in " + this);
2172
+ if (this.isReservedName(p.name))
2173
+ throw Error("name '" + p.name + "' is reserved in " + this);
2174
+ return p.parent && p.parent.remove(p), this.fields[p.name] = p, p.message = this, p.onAdd(this), b(this);
2175
+ }
2176
+ return p instanceof n ? (this.oneofs || (this.oneofs = {}), this.oneofs[p.name] = p, p.onAdd(this), b(this)) : i.prototype.add.call(this, p);
2177
+ }, m.prototype.remove = function(p) {
2178
+ if (p instanceof a && p.extend === void 0) {
2179
+ if (!this.fields || this.fields[p.name] !== p)
2180
+ throw Error(p + " is not a member of " + this);
2181
+ return delete this.fields[p.name], p.parent = null, p.onRemove(this), b(this);
2182
+ }
2183
+ if (p instanceof n) {
2184
+ if (!this.oneofs || this.oneofs[p.name] !== p)
2185
+ throw Error(p + " is not a member of " + this);
2186
+ return delete this.oneofs[p.name], p.parent = null, p.onRemove(this), b(this);
2187
+ }
2188
+ return i.prototype.remove.call(this, p);
2189
+ }, m.prototype.isReservedId = function(p) {
2190
+ return i.isReservedId(this.reserved, p);
2191
+ }, m.prototype.isReservedName = function(p) {
2192
+ return i.isReservedName(this.reserved, p);
2193
+ }, m.prototype.create = function(p) {
2194
+ return new this.ctor(p);
2195
+ }, m.prototype.setup = function() {
2196
+ for (var p = this.fullName, g = [], _ = 0; _ < /* initializes */
2197
+ this.fieldsArray.length; ++_)
2198
+ g.push(this._fieldsArray[_].resolve().resolvedType);
2199
+ this.encode = l(this)({
2200
+ Writer: s,
2201
+ types: g,
2202
+ util: r
2203
+ }), this.decode = d(this)({
2204
+ Reader: o,
2205
+ types: g,
2206
+ util: r
2207
+ }), this.verify = h(this)({
2208
+ types: g,
2209
+ util: r
2210
+ }), this.fromObject = c.fromObject(this)({
2211
+ types: g,
2212
+ util: r
2213
+ }), this.toObject = c.toObject(this)({
2214
+ types: g,
2215
+ util: r
2216
+ });
2217
+ var R = y[p];
2218
+ if (R) {
2219
+ var O = Object.create(this);
2220
+ O.fromObject = this.fromObject, this.fromObject = R.fromObject.bind(O), O.toObject = this.toObject, this.toObject = R.toObject.bind(O);
2221
+ }
2222
+ return this;
2223
+ }, m.prototype.encode = function(p, g) {
2224
+ return this.setup().encode(p, g);
2225
+ }, m.prototype.encodeDelimited = function(p, g) {
2226
+ return this.encode(p, g && g.len ? g.fork() : g).ldelim();
2227
+ }, m.prototype.decode = function(p, g) {
2228
+ return this.setup().decode(p, g);
2229
+ }, m.prototype.decodeDelimited = function(p) {
2230
+ return p instanceof o || (p = o.create(p)), this.decode(p, p.uint32());
2231
+ }, m.prototype.verify = function(p) {
2232
+ return this.setup().verify(p);
2233
+ }, m.prototype.fromObject = function(p) {
2234
+ return this.setup().fromObject(p);
2235
+ }, m.prototype.toObject = function(p, g) {
2236
+ return this.setup().toObject(p, g);
2237
+ }, m.d = function(p) {
2238
+ return function(_) {
2239
+ r.decorateType(_, p);
2240
+ };
2241
+ }, type;
2242
+ }
2243
+ var root, hasRequiredRoot;
2244
+ function requireRoot() {
2245
+ if (hasRequiredRoot) return root;
2246
+ hasRequiredRoot = 1, root = s;
2247
+ var i = requireNamespace();
2248
+ ((s.prototype = Object.create(i.prototype)).constructor = s).className = "Root";
2249
+ var e = requireField(), n = require_enum(), a = requireOneof(), f = requireUtil(), u, t, o;
2250
+ function s(h) {
2251
+ i.call(this, "", h), this.deferred = [], this.files = [];
2252
+ }
2253
+ s.fromJSON = function(c, y) {
2254
+ return y || (y = new s()), c.options && y.setOptions(c.options), y.addJSON(c.nested);
2255
+ }, s.prototype.resolvePath = f.path.resolve, s.prototype.fetch = f.fetch;
2256
+ function r() {
2257
+ }
2258
+ s.prototype.load = function h(c, y, m) {
2259
+ typeof y == "function" && (m = y, y = void 0);
2260
+ var b = this;
2261
+ if (!m)
2262
+ return f.asPromise(h, b, c, y);
2263
+ var v = m === r;
2264
+ function p(q, S) {
2265
+ if (m) {
2266
+ if (v)
2267
+ throw q;
2268
+ var k = m;
2269
+ m = null, k(q, S);
2270
+ }
2271
+ }
2272
+ function g(q) {
2273
+ var S = q.lastIndexOf("google/protobuf/");
2274
+ if (S > -1) {
2275
+ var k = q.substring(S);
2276
+ if (k in o) return k;
2277
+ }
2278
+ return null;
2279
+ }
2280
+ function _(q, S) {
2281
+ try {
2282
+ if (f.isString(S) && S.charAt(0) === "{" && (S = JSON.parse(S)), !f.isString(S))
2283
+ b.setOptions(S.options).addJSON(S.nested);
2284
+ else {
2285
+ t.filename = q;
2286
+ var k = t(S, b, y), B, x = 0;
2287
+ if (k.imports)
2288
+ for (; x < k.imports.length; ++x)
2289
+ (B = g(k.imports[x]) || b.resolvePath(q, k.imports[x])) && R(B);
2290
+ if (k.weakImports)
2291
+ for (x = 0; x < k.weakImports.length; ++x)
2292
+ (B = g(k.weakImports[x]) || b.resolvePath(q, k.weakImports[x])) && R(B, !0);
2293
+ }
2294
+ } catch (V) {
2295
+ p(V);
2296
+ }
2297
+ !v && !O && p(null, b);
2298
+ }
2299
+ function R(q, S) {
2300
+ if (q = g(q) || q, !(b.files.indexOf(q) > -1)) {
2301
+ if (b.files.push(q), q in o) {
2302
+ v ? _(q, o[q]) : (++O, setTimeout(function() {
2303
+ --O, _(q, o[q]);
2304
+ }));
2305
+ return;
2306
+ }
2307
+ if (v) {
2308
+ var k;
2309
+ try {
2310
+ k = f.fs.readFileSync(q).toString("utf8");
2311
+ } catch (B) {
2312
+ S || p(B);
2313
+ return;
2314
+ }
2315
+ _(q, k);
2316
+ } else
2317
+ ++O, b.fetch(q, function(B, x) {
2318
+ if (--O, !!m) {
2319
+ if (B) {
2320
+ S ? O || p(null, b) : p(B);
2321
+ return;
2322
+ }
2323
+ _(q, x);
2324
+ }
2325
+ });
2326
+ }
2327
+ }
2328
+ var O = 0;
2329
+ f.isString(c) && (c = [c]);
2330
+ for (var T = 0, J; T < c.length; ++T)
2331
+ (J = b.resolvePath("", c[T])) && R(J);
2332
+ if (v)
2333
+ return b;
2334
+ O || p(null, b);
2335
+ }, s.prototype.loadSync = function(c, y) {
2336
+ if (!f.isNode)
2337
+ throw Error("not supported");
2338
+ return this.load(c, y, r);
2339
+ }, s.prototype.resolveAll = function() {
2340
+ if (this.deferred.length)
2341
+ throw Error("unresolvable extensions: " + this.deferred.map(function(c) {
2342
+ return "'extend " + c.extend + "' in " + c.parent.fullName;
2343
+ }).join(", "));
2344
+ return i.prototype.resolveAll.call(this);
2345
+ };
2346
+ var l = /^[A-Z]/;
2347
+ function d(h, c) {
2348
+ var y = c.parent.lookup(c.extend);
2349
+ if (y) {
2350
+ var m = new e(c.fullName, c.id, c.type, c.rule, void 0, c.options);
2351
+ return y.get(m.name) || (m.declaringField = c, c.extensionField = m, y.add(m)), !0;
2352
+ }
2353
+ return !1;
2354
+ }
2355
+ return s.prototype._handleAdd = function(c) {
2356
+ if (c instanceof e)
2357
+ /* an extension field (implies not part of a oneof) */
2358
+ c.extend !== void 0 && /* not already handled */
2359
+ !c.extensionField && (d(this, c) || this.deferred.push(c));
2360
+ else if (c instanceof n)
2361
+ l.test(c.name) && (c.parent[c.name] = c.values);
2362
+ else if (!(c instanceof a)) {
2363
+ if (c instanceof u)
2364
+ for (var y = 0; y < this.deferred.length; )
2365
+ d(this, this.deferred[y]) ? this.deferred.splice(y, 1) : ++y;
2366
+ for (var m = 0; m < /* initializes */
2367
+ c.nestedArray.length; ++m)
2368
+ this._handleAdd(c._nestedArray[m]);
2369
+ l.test(c.name) && (c.parent[c.name] = c);
2370
+ }
2371
+ }, s.prototype._handleRemove = function(c) {
2372
+ if (c instanceof e) {
2373
+ if (
2374
+ /* an extension field */
2375
+ c.extend !== void 0
2376
+ )
2377
+ if (
2378
+ /* already handled */
2379
+ c.extensionField
2380
+ )
2381
+ c.extensionField.parent.remove(c.extensionField), c.extensionField = null;
2382
+ else {
2383
+ var y = this.deferred.indexOf(c);
2384
+ y > -1 && this.deferred.splice(y, 1);
2385
+ }
2386
+ } else if (c instanceof n)
2387
+ l.test(c.name) && delete c.parent[c.name];
2388
+ else if (c instanceof i) {
2389
+ for (var m = 0; m < /* initializes */
2390
+ c.nestedArray.length; ++m)
2391
+ this._handleRemove(c._nestedArray[m]);
2392
+ l.test(c.name) && delete c.parent[c.name];
2393
+ }
2394
+ }, s._configure = function(h, c, y) {
2395
+ u = h, t = c, o = y;
2396
+ }, root;
2397
+ }
2398
+ var hasRequiredUtil;
2399
+ function requireUtil() {
2400
+ if (hasRequiredUtil) return util$1.exports;
2401
+ hasRequiredUtil = 1;
2402
+ var i = util$1.exports = requireMinimal(), e = roots, n, a;
2403
+ i.codegen = codegen_1, i.fetch = fetch_1, i.path = path, i.fs = i.inquire("fs"), i.toArray = function(r) {
2404
+ if (r) {
2405
+ for (var l = Object.keys(r), d = new Array(l.length), h = 0; h < l.length; )
2406
+ d[h] = r[l[h++]];
2407
+ return d;
2408
+ }
2409
+ return [];
2410
+ }, i.toObject = function(r) {
2411
+ for (var l = {}, d = 0; d < r.length; ) {
2412
+ var h = r[d++], c = r[d++];
2413
+ c !== void 0 && (l[h] = c);
2414
+ }
2415
+ return l;
2416
+ };
2417
+ var f = /\\/g, u = /"/g;
2418
+ i.isReserved = function(r) {
2419
+ 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(r);
2420
+ }, i.safeProp = function(r) {
2421
+ return !/^[$\w_]+$/.test(r) || i.isReserved(r) ? '["' + r.replace(f, "\\\\").replace(u, '\\"') + '"]' : "." + r;
2422
+ }, i.ucFirst = function(r) {
2423
+ return r.charAt(0).toUpperCase() + r.substring(1);
2424
+ };
2425
+ var t = /_([a-z])/g;
2426
+ i.camelCase = function(r) {
2427
+ return r.substring(0, 1) + r.substring(1).replace(t, function(l, d) {
2428
+ return d.toUpperCase();
2429
+ });
2430
+ }, i.compareFieldsById = function(r, l) {
2431
+ return r.id - l.id;
2432
+ }, i.decorateType = function(r, l) {
2433
+ if (r.$type)
2434
+ return l && r.$type.name !== l && (i.decorateRoot.remove(r.$type), r.$type.name = l, i.decorateRoot.add(r.$type)), r.$type;
2435
+ n || (n = requireType());
2436
+ var d = new n(l || r.name);
2437
+ return i.decorateRoot.add(d), d.ctor = r, Object.defineProperty(r, "$type", { value: d, enumerable: !1 }), Object.defineProperty(r.prototype, "$type", { value: d, enumerable: !1 }), d;
2438
+ };
2439
+ var o = 0;
2440
+ return i.decorateEnum = function(r) {
2441
+ if (r.$type)
2442
+ return r.$type;
2443
+ a || (a = require_enum());
2444
+ var l = new a("Enum" + o++, r);
2445
+ return i.decorateRoot.add(l), Object.defineProperty(r, "$type", { value: l, enumerable: !1 }), l;
2446
+ }, i.setProperty = function(r, l, d) {
2447
+ function h(c, y, m) {
2448
+ var b = y.shift();
2449
+ if (b === "__proto__" || b === "prototype")
2450
+ return c;
2451
+ if (y.length > 0)
2452
+ c[b] = h(c[b] || {}, y, m);
2453
+ else {
2454
+ var v = c[b];
2455
+ v && (m = [].concat(v).concat(m)), c[b] = m;
2456
+ }
2457
+ return c;
2458
+ }
2459
+ if (typeof r != "object")
2460
+ throw TypeError("dst must be an object");
2461
+ if (!l)
2462
+ throw TypeError("path must be specified");
2463
+ return l = l.split("."), h(r, l, d);
2464
+ }, Object.defineProperty(i, "decorateRoot", {
2465
+ get: function() {
2466
+ return e.decorated || (e.decorated = new (requireRoot())());
2467
+ }
2468
+ }), util$1.exports;
2469
+ }
2470
+ var object, hasRequiredObject;
2471
+ function requireObject() {
2472
+ if (hasRequiredObject) return object;
2473
+ hasRequiredObject = 1, object = n, n.className = "ReflectionObject";
2474
+ var i = requireUtil(), e;
2475
+ function n(a, f) {
2476
+ if (!i.isString(a))
2477
+ throw TypeError("name must be a string");
2478
+ if (f && !i.isObject(f))
2479
+ throw TypeError("options must be an object");
2480
+ this.options = f, this.parsedOptions = null, this.name = a, this.parent = null, this.resolved = !1, this.comment = null, this.filename = null;
2481
+ }
2482
+ return Object.defineProperties(n.prototype, {
2483
+ /**
2484
+ * Reference to the root namespace.
2485
+ * @name ReflectionObject#root
2486
+ * @type {Root}
2487
+ * @readonly
2488
+ */
2489
+ root: {
2490
+ get: function() {
2491
+ for (var a = this; a.parent !== null; )
2492
+ a = a.parent;
2493
+ return a;
2494
+ }
2495
+ },
2496
+ /**
2497
+ * Full name including leading dot.
2498
+ * @name ReflectionObject#fullName
2499
+ * @type {string}
2500
+ * @readonly
2501
+ */
2502
+ fullName: {
2503
+ get: function() {
2504
+ for (var a = [this.name], f = this.parent; f; )
2505
+ a.unshift(f.name), f = f.parent;
2506
+ return a.join(".");
2507
+ }
2508
+ }
2509
+ }), n.prototype.toJSON = /* istanbul ignore next */
2510
+ function() {
2511
+ throw Error();
2512
+ }, n.prototype.onAdd = function(f) {
2513
+ this.parent && this.parent !== f && this.parent.remove(this), this.parent = f, this.resolved = !1;
2514
+ var u = f.root;
2515
+ u instanceof e && u._handleAdd(this);
2516
+ }, n.prototype.onRemove = function(f) {
2517
+ var u = f.root;
2518
+ u instanceof e && u._handleRemove(this), this.parent = null, this.resolved = !1;
2519
+ }, n.prototype.resolve = function() {
2520
+ return this.resolved ? this : (this.root instanceof e && (this.resolved = !0), this);
2521
+ }, n.prototype.getOption = function(f) {
2522
+ if (this.options)
2523
+ return this.options[f];
2524
+ }, n.prototype.setOption = function(f, u, t) {
2525
+ return (!t || !this.options || this.options[f] === void 0) && ((this.options || (this.options = {}))[f] = u), this;
2526
+ }, n.prototype.setParsedOption = function(f, u, t) {
2527
+ this.parsedOptions || (this.parsedOptions = []);
2528
+ var o = this.parsedOptions;
2529
+ if (t) {
2530
+ var s = o.find(function(d) {
2531
+ return Object.prototype.hasOwnProperty.call(d, f);
2532
+ });
2533
+ if (s) {
2534
+ var r = s[f];
2535
+ i.setProperty(r, t, u);
2536
+ } else
2537
+ s = {}, s[f] = i.setProperty({}, t, u), o.push(s);
2538
+ } else {
2539
+ var l = {};
2540
+ l[f] = u, o.push(l);
2541
+ }
2542
+ return this;
2543
+ }, n.prototype.setOptions = function(f, u) {
2544
+ if (f)
2545
+ for (var t = Object.keys(f), o = 0; o < t.length; ++o)
2546
+ this.setOption(t[o], f[t[o]], u);
2547
+ return this;
2548
+ }, n.prototype.toString = function() {
2549
+ var f = this.constructor.className, u = this.fullName;
2550
+ return u.length ? f + " " + u : f;
2551
+ }, n._configure = function(a) {
2552
+ e = a;
2553
+ }, object;
2554
+ }
2555
+ var _enum, hasRequired_enum;
2556
+ function require_enum() {
2557
+ if (hasRequired_enum) return _enum;
2558
+ hasRequired_enum = 1, _enum = a;
2559
+ var i = requireObject();
2560
+ ((a.prototype = Object.create(i.prototype)).constructor = a).className = "Enum";
2561
+ var e = requireNamespace(), n = requireUtil();
2562
+ function a(f, u, t, o, s, r) {
2563
+ if (i.call(this, f, t), u && typeof u != "object")
2564
+ throw TypeError("values must be an object");
2565
+ if (this.valuesById = {}, this.values = Object.create(this.valuesById), this.comment = o, this.comments = s || {}, this.valuesOptions = r, this.reserved = void 0, u)
2566
+ for (var l = Object.keys(u), d = 0; d < l.length; ++d)
2567
+ typeof u[l[d]] == "number" && (this.valuesById[this.values[l[d]] = u[l[d]]] = l[d]);
2568
+ }
2569
+ return a.fromJSON = function(u, t) {
2570
+ var o = new a(u, t.values, t.options, t.comment, t.comments);
2571
+ return o.reserved = t.reserved, o;
2572
+ }, a.prototype.toJSON = function(u) {
2573
+ var t = u ? !!u.keepComments : !1;
2574
+ return n.toObject([
2575
+ "options",
2576
+ this.options,
2577
+ "valuesOptions",
2578
+ this.valuesOptions,
2579
+ "values",
2580
+ this.values,
2581
+ "reserved",
2582
+ this.reserved && this.reserved.length ? this.reserved : void 0,
2583
+ "comment",
2584
+ t ? this.comment : void 0,
2585
+ "comments",
2586
+ t ? this.comments : void 0
2587
+ ]);
2588
+ }, a.prototype.add = function(u, t, o, s) {
2589
+ if (!n.isString(u))
2590
+ throw TypeError("name must be a string");
2591
+ if (!n.isInteger(t))
2592
+ throw TypeError("id must be an integer");
2593
+ if (this.values[u] !== void 0)
2594
+ throw Error("duplicate name '" + u + "' in " + this);
2595
+ if (this.isReservedId(t))
2596
+ throw Error("id " + t + " is reserved in " + this);
2597
+ if (this.isReservedName(u))
2598
+ throw Error("name '" + u + "' is reserved in " + this);
2599
+ if (this.valuesById[t] !== void 0) {
2600
+ if (!(this.options && this.options.allow_alias))
2601
+ throw Error("duplicate id " + t + " in " + this);
2602
+ this.values[u] = t;
2603
+ } else
2604
+ this.valuesById[this.values[u] = t] = u;
2605
+ return s && (this.valuesOptions === void 0 && (this.valuesOptions = {}), this.valuesOptions[u] = s || null), this.comments[u] = o || null, this;
2606
+ }, a.prototype.remove = function(u) {
2607
+ if (!n.isString(u))
2608
+ throw TypeError("name must be a string");
2609
+ var t = this.values[u];
2610
+ if (t == null)
2611
+ throw Error("name '" + u + "' does not exist in " + this);
2612
+ return delete this.valuesById[t], delete this.values[u], delete this.comments[u], this.valuesOptions && delete this.valuesOptions[u], this;
2613
+ }, a.prototype.isReservedId = function(u) {
2614
+ return e.isReservedId(this.reserved, u);
2615
+ }, a.prototype.isReservedName = function(u) {
2616
+ return e.isReservedName(this.reserved, u);
2617
+ }, _enum;
2618
+ }
2619
+ var encoder_1, hasRequiredEncoder;
2620
+ function requireEncoder() {
2621
+ if (hasRequiredEncoder) return encoder_1;
2622
+ hasRequiredEncoder = 1, encoder_1 = f;
2623
+ var i = require_enum(), e = requireTypes(), n = requireUtil();
2624
+ function a(u, t, o, s) {
2625
+ return t.resolvedType.group ? u("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", o, s, (t.id << 3 | 3) >>> 0, (t.id << 3 | 4) >>> 0) : u("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", o, s, (t.id << 3 | 2) >>> 0);
2626
+ }
2627
+ function f(u) {
2628
+ for (var t = n.codegen(["m", "w"], u.name + "$encode")("if(!w)")("w=Writer.create()"), o, s, r = (
2629
+ /* initializes */
2630
+ u.fieldsArray.slice().sort(n.compareFieldsById)
2631
+ ), o = 0; o < r.length; ++o) {
2632
+ var l = r[o].resolve(), d = u._fieldsArray.indexOf(l), h = l.resolvedType instanceof i ? "int32" : l.type, c = e.basic[h];
2633
+ s = "m" + n.safeProp(l.name), l.map ? (t("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", s, l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (l.id << 3 | 2) >>> 0, 8 | e.mapKey[l.keyType], l.keyType), c === void 0 ? t("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", d, s) : t(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | c, h, s), t("}")("}")) : l.repeated ? (t("if(%s!=null&&%s.length){", s, s), l.packed && e.packed[h] !== void 0 ? t("w.uint32(%i).fork()", (l.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", s)("w.%s(%s[i])", h, s)("w.ldelim()") : (t("for(var i=0;i<%s.length;++i)", s), c === void 0 ? a(t, l, d, s + "[i]") : t("w.uint32(%i).%s(%s[i])", (l.id << 3 | c) >>> 0, h, s)), t("}")) : (l.optional && t("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", s, l.name), c === void 0 ? a(t, l, d, s) : t("w.uint32(%i).%s(%s)", (l.id << 3 | c) >>> 0, h, s));
2634
+ }
2635
+ return t("return w");
2636
+ }
2637
+ return encoder_1;
2638
+ }
2639
+ var protobuf = indexLight.exports = indexMinimal;
2640
+ protobuf.build = "light";
2641
+ function load(i, e, n) {
2642
+ return typeof e == "function" ? (n = e, e = new protobuf.Root()) : e || (e = new protobuf.Root()), e.load(i, n);
2643
+ }
2644
+ protobuf.load = load;
2645
+ function loadSync(i, e) {
2646
+ return e || (e = new protobuf.Root()), e.loadSync(i);
2647
+ }
2648
+ protobuf.loadSync = loadSync;
2649
+ protobuf.encoder = requireEncoder();
2650
+ protobuf.decoder = requireDecoder();
2651
+ protobuf.verifier = requireVerifier();
2652
+ protobuf.converter = requireConverter();
2653
+ protobuf.ReflectionObject = requireObject();
2654
+ protobuf.Namespace = requireNamespace();
2655
+ protobuf.Root = requireRoot();
2656
+ protobuf.Enum = require_enum();
2657
+ protobuf.Type = requireType();
2658
+ protobuf.Field = requireField();
2659
+ protobuf.OneOf = requireOneof();
2660
+ protobuf.MapField = requireMapfield();
2661
+ protobuf.Service = requireService();
2662
+ protobuf.Method = requireMethod();
2663
+ protobuf.Message = message;
2664
+ protobuf.wrappers = wrappers;
2665
+ protobuf.types = requireTypes();
2666
+ protobuf.util = requireUtil();
2667
+ protobuf.ReflectionObject._configure(protobuf.Root);
2668
+ protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
2669
+ protobuf.Root._configure(protobuf.Type);
2670
+ protobuf.Field._configure(protobuf.Type);
2671
+ var indexLightExports = indexLight.exports, light = indexLightExports;
2672
+ 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(
2673
+ "nil.xit.proto"
2674
+ ), bundle = async (i) => new Promise((e, n) => {
2675
+ const a = new WorkerWrapper();
2676
+ a.postMessage({ type: "init", host: i.host, id: i.id, cdn_url: i.cdn_url }), a.addEventListener("message", async (f) => {
2677
+ if (f.data.ok) {
2678
+ if (f.data.files) {
2679
+ const u = concat([
2680
+ header(nil_xit_proto.MessageType.MessageType_FrameCache),
2681
+ nil_xit_proto.FrameCache.encode({
2682
+ id: i.id,
2683
+ content: f.data.code,
2684
+ files: f.data.files
2685
+ }).finish()
2686
+ ]);
2687
+ service_publish({ host: i.host }, u);
2688
+ }
2689
+ e(
2690
+ await import(
2691
+ /* @vite-ignore */
2692
+ "data:text/javascript;base64," + btoa(unescape(encodeURIComponent(f.data.code)))
2693
+ )
2694
+ );
2695
+ } else
2696
+ n(f.data.err);
2697
+ a.terminate();
2698
+ });
2699
+ }), noop = (i) => {
2700
+ }, make_values = async ({
2701
+ id: i,
2702
+ tag: e,
2703
+ host: n,
2704
+ service: a
2705
+ }) => {
2706
+ const f = await service_fetch(
2707
+ { host: n },
2708
+ concat([
2709
+ header(nil_xit_proto.MessageType.MessageType_ValueRequest),
2710
+ nil_xit_proto.ValueRequest.encode({ id: i, tag: e }).finish()
2711
+ ]),
2712
+ (t, o) => {
2713
+ if (t === nil_xit_proto.MessageType.MessageType_ValueResponse) {
2714
+ const s = nil_xit_proto.ValueResponse.decode(o);
2715
+ if (s.id === i && e === s.tag)
2716
+ return s.values;
2717
+ }
2718
+ }
2719
+ ), u = {
2720
+ value_boolean: /* @__PURE__ */ new Map(),
2721
+ value_double: /* @__PURE__ */ new Map(),
2722
+ value_number: /* @__PURE__ */ new Map(),
2723
+ value_string: /* @__PURE__ */ new Map(),
2724
+ value_buffer: /* @__PURE__ */ new Map()
2725
+ };
2726
+ for (const t of f) {
2727
+ const o = t.id, s = t.value, r = writable(t[s]);
2728
+ r.subscribe((l) => {
2729
+ const d = { id: o, [s]: l, value: s }, h = { id: i, tag: e, value: d };
2730
+ a.publish(
2731
+ concat([
2732
+ header(nil_xit_proto.MessageType.MessageType_ValueUpdate),
2733
+ nil_xit_proto.ValueUpdate.encode(h).finish()
2734
+ ])
2735
+ );
2736
+ }), u[s].set(o, r);
2737
+ }
2738
+ return a.on_message((t, o) => {
2739
+ var l;
2740
+ const s = new DataView(o.buffer).getUint32(0, !1), r = o.slice(4);
2741
+ if (s === nil_xit_proto.MessageType.MessageType_ValueUpdate) {
2742
+ const d = nil_xit_proto.ValueUpdate.decode(r);
2743
+ if (d.id === i && e === d.tag) {
2744
+ const h = d.value.value, c = (l = u[h]) == null ? void 0 : l.get(d.value.id);
2745
+ c == null || c.set(d.value[h]);
2746
+ }
2747
+ }
2748
+ }), u;
2749
+ }, make_signals = async ({
2750
+ id: i,
2751
+ tag: e,
2752
+ host: n,
2753
+ service: a
2754
+ }) => {
2755
+ const f = await service_fetch(
2756
+ { host: n },
2757
+ concat([
2758
+ header(nil_xit_proto.MessageType.MessageType_SignalRequest),
2759
+ nil_xit_proto.SignalRequest.encode({ id: i }).finish()
2760
+ ]),
2761
+ (t, o) => {
2762
+ if (t === nil_xit_proto.MessageType.MessageType_SignalResponse) {
2763
+ const s = nil_xit_proto.SignalResponse.decode(o);
2764
+ if (s.id === i)
2765
+ return s.signals;
2766
+ }
2767
+ }
2768
+ ), u = {
2769
+ arg_none: /* @__PURE__ */ new Map(),
2770
+ arg_boolean: /* @__PURE__ */ new Map(),
2771
+ arg_double: /* @__PURE__ */ new Map(),
2772
+ arg_number: /* @__PURE__ */ new Map(),
2773
+ arg_string: /* @__PURE__ */ new Map(),
2774
+ arg_buffer: /* @__PURE__ */ new Map()
2775
+ };
2776
+ for (const { id: t, type: o } of f)
2777
+ o == null ? u.arg_none.set(t, () => {
2778
+ const s = { frame_id: i, signal_id: t, tag: e };
2779
+ a.publish(
2780
+ concat([
2781
+ header(nil_xit_proto.MessageType.MessageType_SignalNotify),
2782
+ nil_xit_proto.SignalNotify.encode(s).finish()
2783
+ ])
2784
+ );
2785
+ }) : u[o].set(t, (s) => {
2786
+ const r = { frame_id: i, signal_id: t, tag: e, [o]: s };
2787
+ a.publish(
2788
+ concat([
2789
+ header(nil_xit_proto.MessageType.MessageType_SignalNotify),
2790
+ nil_xit_proto.SignalNotify.encode(r).finish()
2791
+ ])
2792
+ );
2793
+ });
2794
+ return u;
2795
+ }, create_context = (i, e, n) => ({
2796
+ values: {
2797
+ boolean: (a, f) => i.value_boolean.get(a) ?? writable(f),
2798
+ double: (a, f) => i.value_double.get(a) ?? writable(f),
2799
+ string: (a, f) => i.value_string.get(a) ?? writable(f),
2800
+ number: (a, f) => i.value_number.get(a) ?? writable(f),
2801
+ buffer: (a, f) => i.value_buffer.get(a) ?? writable(f),
2802
+ json: (a, f, u) => {
2803
+ const t = i.value_buffer.get(a);
2804
+ if (t != null) {
2805
+ let o = u.decode(get(t));
2806
+ return {
2807
+ set: (s) => {
2808
+ o = s, t.set(u.encode(o));
2809
+ },
2810
+ subscribe: (s) => t.subscribe((r) => s(o)),
2811
+ update: (s) => {
2812
+ t.update((r) => (o = s(o), u.encode(o)));
2813
+ }
2814
+ };
2815
+ }
2816
+ return writable(f);
2817
+ }
2818
+ },
2819
+ signals: {
2820
+ none: (a) => e.arg_none.get(a) ?? (() => {
2821
+ }),
2822
+ boolean: (a) => e.arg_boolean.get(a) ?? noop,
2823
+ double: (a) => e.arg_double.get(a) ?? noop,
2824
+ number: (a) => e.arg_number.get(a) ?? noop,
2825
+ string: (a) => e.arg_string.get(a) ?? noop,
2826
+ buffer: (a) => e.arg_buffer.get(a) ?? noop,
2827
+ json: (a, f) => {
2828
+ const u = e.arg_buffer.get(a);
2829
+ return u != null ? (t) => u(f(t)) : noop;
2830
+ }
2831
+ },
2832
+ loader: n
2833
+ }), create_app = async (i, e, n, a, f) => {
2834
+ await test_connection({ host: i });
2835
+ const u = new Service$1({ host: i }), [t, o, { nil_xit_fn: s }] = await Promise.all([
2836
+ make_values({ id: e, tag: n, host: i, service: u }),
2837
+ make_signals({ id: e, tag: n, host: i, service: u }),
2838
+ bundle({ host: i, cdn_url: a, id: e })
2839
+ ]), { action: r } = await s({
2840
+ svelte: () => import("./svelte/index.js").then((l) => l.bT),
2841
+ "svelte/store": () => import("./svelte/store.js").then((l) => l.i),
2842
+ "svelte/animate": () => import("./svelte/animate.js"),
2843
+ "svelte/easing": () => import("./svelte/easing.js"),
2844
+ "svelte/events": () => import("./svelte/events.js"),
2845
+ "svelte/motion": () => import("./svelte/motion.js").then((l) => l.i),
2846
+ "svelte/transition": () => import("./svelte/transition.js"),
2847
+ // @ts-ignore
2848
+ "svelte/internal/disclose-version": () => import("./svelte/internal/disclose-version.js"),
2849
+ // @ts-ignore
2850
+ "svelte/internal/client": () => import("./svelte/internal/client.js")
2851
+ });
2852
+ return (l) => {
2853
+ const d = /* @__PURE__ */ new Map();
2854
+ d.set("nil.xit", create_context(t, o, f));
2855
+ const { destroy: h } = r(l, d);
2856
+ return u.start(), {
2857
+ destroy: () => {
2858
+ u.stop(), h();
2859
+ }
2860
+ };
2861
+ };
2862
+ }, create_action = async (i) => {
2863
+ const e = async (f) => {
2864
+ const u = await Promise.all(
2865
+ f.map((t) => create_action({
2866
+ server: i.server,
2867
+ cdn_url: i.cdn_url,
2868
+ frame: t.frame,
2869
+ tag: t.tag
2870
+ }))
2871
+ );
2872
+ return (t) => {
2873
+ const o = u.map(
2874
+ (s) => mount(ActionLoader, { target: t, props: { action: s } })
2875
+ );
2876
+ return {
2877
+ destroy: () => o.forEach((s) => unmount(s))
2878
+ };
2879
+ };
2880
+ }, n = {
2881
+ one: (f, u) => e([{ frame: f, tag: u }]),
2882
+ all: (f) => e(f)
2883
+ }, a = await create_app(
2884
+ i.server,
2885
+ i.frame,
2886
+ i.tag ?? null,
2887
+ i.cdn_url,
2888
+ n
2889
+ );
2890
+ return (f) => {
2891
+ const u = mount(ActionLoader, { target: f, props: { action: a } });
2892
+ return {
2893
+ destroy: () => unmount(u)
2894
+ };
2895
+ };
2896
+ }, create_component = async (i, e) => (await create_action(e))(i);
2
2897
  export {
3
- r as create_component
2898
+ create_component
4
2899
  };