image-salon-sdk 1.0.8 → 1.0.10
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/README.md +5 -3
- package/dist/api/file-service.d.ts +1 -0
- package/dist/grpc/factory.d.ts +3 -2
- package/dist/image-salon-sdk.js +717 -614
- package/dist/image-salon-sdk.umd.cjs +5 -5
- package/dist/image-salon.d.ts +11 -1
- package/dist/style.css +1 -1
- package/dist/types/image-salon-types.d.ts +2 -2
- package/dist/utils/file-type-mapper.d.ts +1 -0
- package/dist/utils/helper-function.d.ts +2 -0
- package/dist/utils/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/image-salon-sdk.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import './style.css';
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var Tt = Object.defineProperty;
|
|
3
|
+
var Xe = (i) => {
|
|
4
4
|
throw TypeError(i);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
var U = (i, e, t) =>
|
|
8
|
-
var d = (i, e, t) => (
|
|
9
|
-
function
|
|
6
|
+
var Ot = (i, e, t) => e in i ? Tt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
7
|
+
var U = (i, e, t) => Ot(i, typeof e != "symbol" ? e + "" : e, t), Ge = (i, e, t) => e.has(i) || Xe("Cannot " + t);
|
|
8
|
+
var d = (i, e, t) => (Ge(i, e, "read from private field"), t ? t.call(i) : e.get(i)), L = (i, e, t) => e.has(i) ? Xe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), w = (i, e, t, n) => (Ge(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t);
|
|
9
|
+
function j(i, e, t) {
|
|
10
10
|
let n = document.createElement(i);
|
|
11
11
|
return n.className += e, t && t.appendChild(n), n;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
class
|
|
13
|
+
var Y;
|
|
14
|
+
class Ft {
|
|
15
15
|
constructor() {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
L(this, Y);
|
|
17
|
+
w(this, Y, document.createElementNS(
|
|
18
18
|
"http://www.w3.org/2000/svg",
|
|
19
19
|
"svg"
|
|
20
|
-
)), d(this,
|
|
20
|
+
)), d(this, Y).setAttribute("viewBox", "25 25 50 50"), d(this, Y).classList.add("loader-svg");
|
|
21
21
|
const e = document.createElementNS(
|
|
22
22
|
"http://www.w3.org/2000/svg",
|
|
23
23
|
"circle"
|
|
24
24
|
);
|
|
25
|
-
e.setAttribute("r", "20"), e.setAttribute("cy", "50"), e.setAttribute("cx", "50"), e.classList.add("loader-circle"), d(this,
|
|
25
|
+
e.setAttribute("r", "20"), e.setAttribute("cy", "50"), e.setAttribute("cx", "50"), e.classList.add("loader-circle"), d(this, Y).appendChild(e);
|
|
26
26
|
}
|
|
27
27
|
show(e) {
|
|
28
|
-
e.appendChild(d(this,
|
|
28
|
+
e.appendChild(d(this, Y));
|
|
29
29
|
}
|
|
30
30
|
hide() {
|
|
31
|
-
d(this,
|
|
31
|
+
d(this, Y).remove();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
class
|
|
34
|
+
Y = new WeakMap();
|
|
35
|
+
const Je = new Ft(), Re = document.body;
|
|
36
|
+
class Bt {
|
|
37
37
|
constructor() {
|
|
38
38
|
U(this, "main");
|
|
39
39
|
U(this, "dialogHeader");
|
|
@@ -43,20 +43,20 @@ class Nt {
|
|
|
43
43
|
U(this, "cancelButton");
|
|
44
44
|
U(this, "confirmCallback");
|
|
45
45
|
U(this, "cancelCallback");
|
|
46
|
-
this.main =
|
|
46
|
+
this.main = j("div"), this.dialogHeader = j("div"), this.dialogBody = j("div"), this.dialogFooter = j("div"), this.confirmButton = document.createElement("button"), this.cancelButton = document.createElement("button"), this.confirmCallback = void 0, this.cancelCallback = void 0;
|
|
47
47
|
}
|
|
48
48
|
show(e) {
|
|
49
|
-
this.main =
|
|
50
|
-
const t =
|
|
51
|
-
return this.dialogHeader =
|
|
49
|
+
this.main = j("div", "dialog", Re);
|
|
50
|
+
const t = j("div", "dialog-content", this.main);
|
|
51
|
+
return this.dialogHeader = j("div", "dialog-header", t), this.dialogBody = j("div", "dialog-body", t), this.dialogFooter = j("div", "dialog-footer", t), this.confirmButton = j(
|
|
52
52
|
"button",
|
|
53
53
|
"dialog-btn confirm",
|
|
54
54
|
this.dialogFooter
|
|
55
|
-
), this.confirmButton.disabled = !0, this.cancelButton =
|
|
55
|
+
), this.confirmButton.type = "button", this.confirmButton.disabled = !0, this.cancelButton = j(
|
|
56
56
|
"button",
|
|
57
57
|
"dialog-btn cancel",
|
|
58
58
|
this.dialogFooter
|
|
59
|
-
), typeof e.title == "string" ? this.dialogHeader.innerHTML = e.title : (this.dialogHeader.innerHTML = "", this.dialogHeader.appendChild(e.title)), typeof e.content == "string" ? this.dialogBody.innerHTML = e.content : (this.dialogBody.innerHTML = "", this.dialogBody.appendChild(e.content)), this.confirmButton.textContent = e.confirmButtonText || "Upload", this.cancelButton.textContent = e.cancelButtonText || "Cancel",
|
|
59
|
+
), this.cancelButton.type = "button", typeof e.title == "string" ? this.dialogHeader.innerHTML = e.title : (this.dialogHeader.innerHTML = "", this.dialogHeader.appendChild(e.title)), typeof e.content == "string" ? this.dialogBody.innerHTML = e.content : (this.dialogBody.innerHTML = "", this.dialogBody.appendChild(e.content)), this.confirmButton.textContent = e.confirmButtonText || "Upload", this.cancelButton.textContent = e.cancelButtonText || "Cancel", Re.classList.add("dialog-visible"), new Promise((n) => {
|
|
60
60
|
const r = (s) => () => {
|
|
61
61
|
this.hide(), n(s === "confirm");
|
|
62
62
|
};
|
|
@@ -64,7 +64,7 @@ class Nt {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
hide() {
|
|
67
|
-
|
|
67
|
+
Re.classList.remove("dialog-visible"), this.main.remove();
|
|
68
68
|
}
|
|
69
69
|
updateUploadBtnText(e) {
|
|
70
70
|
this.confirmButton && (this.confirmButton.textContent = e);
|
|
@@ -73,35 +73,43 @@ class Nt {
|
|
|
73
73
|
this.confirmButton && (this.confirmButton.disabled = e);
|
|
74
74
|
}
|
|
75
75
|
updateUploadBtn(e) {
|
|
76
|
-
e ? (
|
|
76
|
+
e ? (Je.show(this.confirmButton), this.disableConfirmButton(!0)) : (Je.hide(), this.disableConfirmButton(!1));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
function
|
|
79
|
+
const P = new Bt();
|
|
80
|
+
function W(i, e) {
|
|
81
81
|
const t = document.createElement("div");
|
|
82
82
|
return i && t.classList.add(i), e && (t.id = e), t;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function te(i, e, t) {
|
|
85
85
|
const n = document.createElement("p");
|
|
86
|
-
return e && n.classList.add(e), i && (n.textContent = i), n;
|
|
86
|
+
return e && n.classList.add(e), t && (n.id = t), i && (n.textContent = i), n;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function At(i, e) {
|
|
89
89
|
const t = document.createElement("span");
|
|
90
90
|
return t.classList.add(e), t.textContent = i, t;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Ne(i, e, t, n) {
|
|
93
93
|
const r = document.createElement("img");
|
|
94
94
|
return e && r.classList.add(e), r.src = i, r;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Dt(i, e, t) {
|
|
97
|
+
const n = document.createElement("video"), r = document.createElement("source");
|
|
98
|
+
return n.classList.add(e), r.src = i, n.appendChild(r), n;
|
|
99
|
+
}
|
|
100
|
+
function Ut(i, e, t) {
|
|
101
|
+
const n = document.createElement("audio"), r = document.createElement("source");
|
|
102
|
+
return n.classList.add(e), n.controls = !0, r.src = i, n.appendChild(r), n;
|
|
103
|
+
}
|
|
104
|
+
function ke(i, e, t, n, r) {
|
|
97
105
|
const s = document.createElement("button");
|
|
98
106
|
return e && s.classList.add(e), t && (s.id = t), i && (s.textContent = i), r && (s.innerHTML = r), s.disabled = n, s;
|
|
99
107
|
}
|
|
100
|
-
function
|
|
108
|
+
function Lt(i) {
|
|
101
109
|
const e = document.createElement("input");
|
|
102
110
|
return e.type = i, e;
|
|
103
111
|
}
|
|
104
|
-
function
|
|
112
|
+
function ot(i) {
|
|
105
113
|
let e = typeof i;
|
|
106
114
|
if (e == "object") {
|
|
107
115
|
if (Array.isArray(i))
|
|
@@ -111,20 +119,20 @@ function tt(i) {
|
|
|
111
119
|
}
|
|
112
120
|
return e;
|
|
113
121
|
}
|
|
114
|
-
function
|
|
122
|
+
function Rt(i) {
|
|
115
123
|
return i !== null && typeof i == "object" && !Array.isArray(i);
|
|
116
124
|
}
|
|
117
|
-
let
|
|
118
|
-
for (let i = 0; i <
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
function
|
|
125
|
+
let Q = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), Le = [];
|
|
126
|
+
for (let i = 0; i < Q.length; i++)
|
|
127
|
+
Le[Q[i].charCodeAt(0)] = i;
|
|
128
|
+
Le[45] = Q.indexOf("+");
|
|
129
|
+
Le[95] = Q.indexOf("/");
|
|
130
|
+
function lt(i) {
|
|
123
131
|
let e = i.length * 3 / 4;
|
|
124
132
|
i[i.length - 2] == "=" ? e -= 2 : i[i.length - 1] == "=" && (e -= 1);
|
|
125
133
|
let t = new Uint8Array(e), n = 0, r = 0, s, a = 0;
|
|
126
134
|
for (let o = 0; o < i.length; o++) {
|
|
127
|
-
if (s =
|
|
135
|
+
if (s = Le[i.charCodeAt(o)], s === void 0)
|
|
128
136
|
switch (i[o]) {
|
|
129
137
|
case "=":
|
|
130
138
|
r = 0;
|
|
@@ -156,23 +164,23 @@ function nt(i) {
|
|
|
156
164
|
throw Error("invalid base64 string.");
|
|
157
165
|
return t.subarray(0, n);
|
|
158
166
|
}
|
|
159
|
-
function
|
|
167
|
+
function ct(i) {
|
|
160
168
|
let e = "", t = 0, n, r = 0;
|
|
161
169
|
for (let s = 0; s < i.length; s++)
|
|
162
170
|
switch (n = i[s], t) {
|
|
163
171
|
case 0:
|
|
164
|
-
e +=
|
|
172
|
+
e += Q[n >> 2], r = (n & 3) << 4, t = 1;
|
|
165
173
|
break;
|
|
166
174
|
case 1:
|
|
167
|
-
e +=
|
|
175
|
+
e += Q[r | n >> 4], r = (n & 15) << 2, t = 2;
|
|
168
176
|
break;
|
|
169
177
|
case 2:
|
|
170
|
-
e +=
|
|
178
|
+
e += Q[r | n >> 6], e += Q[n & 63], t = 0;
|
|
171
179
|
break;
|
|
172
180
|
}
|
|
173
|
-
return t && (e +=
|
|
181
|
+
return t && (e += Q[r], e += "=", t == 1 && (e += "=")), e;
|
|
174
182
|
}
|
|
175
|
-
var
|
|
183
|
+
var k;
|
|
176
184
|
(function(i) {
|
|
177
185
|
i.symbol = Symbol.for("protobuf-ts/unknown"), i.onRead = (t, n, r, s, a) => {
|
|
178
186
|
(e(n) ? n[i.symbol] : n[i.symbol] = []).push({ no: r, wireType: s, data: a });
|
|
@@ -187,15 +195,15 @@ var N;
|
|
|
187
195
|
return [];
|
|
188
196
|
}, i.last = (t, n) => i.list(t, n).slice(-1)[0];
|
|
189
197
|
const e = (t) => t && Array.isArray(t[i.symbol]);
|
|
190
|
-
})(
|
|
191
|
-
function
|
|
198
|
+
})(k || (k = {}));
|
|
199
|
+
function _t(i, e) {
|
|
192
200
|
return Object.assign(Object.assign({}, i), e);
|
|
193
201
|
}
|
|
194
202
|
var m;
|
|
195
203
|
(function(i) {
|
|
196
204
|
i[i.Varint = 0] = "Varint", i[i.Bit64 = 1] = "Bit64", i[i.LengthDelimited = 2] = "LengthDelimited", i[i.StartGroup = 3] = "StartGroup", i[i.EndGroup = 4] = "EndGroup", i[i.Bit32 = 5] = "Bit32";
|
|
197
205
|
})(m || (m = {}));
|
|
198
|
-
function
|
|
206
|
+
function xt() {
|
|
199
207
|
let i = 0, e = 0;
|
|
200
208
|
for (let n = 0; n < 28; n += 7) {
|
|
201
209
|
let r = this.buf[this.pos++];
|
|
@@ -212,7 +220,7 @@ function Ot() {
|
|
|
212
220
|
}
|
|
213
221
|
throw new Error("invalid varint");
|
|
214
222
|
}
|
|
215
|
-
function
|
|
223
|
+
function _e(i, e, t) {
|
|
216
224
|
for (let s = 0; s < 28; s = s + 7) {
|
|
217
225
|
const a = i >>> s, o = !(!(a >>> 7) && e == 0), l = (o ? a | 128 : a) & 255;
|
|
218
226
|
if (t.push(l), !o)
|
|
@@ -228,26 +236,26 @@ function Be(i, e, t) {
|
|
|
228
236
|
t.push(e >>> 31 & 1);
|
|
229
237
|
}
|
|
230
238
|
}
|
|
231
|
-
const
|
|
232
|
-
function
|
|
239
|
+
const Be = 65536 * 65536;
|
|
240
|
+
function ut(i) {
|
|
233
241
|
let e = i[0] == "-";
|
|
234
242
|
e && (i = i.slice(1));
|
|
235
243
|
const t = 1e6;
|
|
236
244
|
let n = 0, r = 0;
|
|
237
245
|
function s(a, o) {
|
|
238
246
|
const l = Number(i.slice(a, o));
|
|
239
|
-
r *= t, n = n * t + l, n >=
|
|
247
|
+
r *= t, n = n * t + l, n >= Be && (r = r + (n / Be | 0), n = n % Be);
|
|
240
248
|
}
|
|
241
249
|
return s(-24, -18), s(-18, -12), s(-12, -6), s(-6), [e, n, r];
|
|
242
250
|
}
|
|
243
|
-
function
|
|
251
|
+
function Me(i, e) {
|
|
244
252
|
if (e >>> 0 <= 2097151)
|
|
245
|
-
return "" + (
|
|
253
|
+
return "" + (Be * e + (i >>> 0));
|
|
246
254
|
let t = i & 16777215, n = (i >>> 24 | e << 8) >>> 0 & 16777215, r = e >> 16 & 65535, s = t + n * 6777216 + r * 6710656, a = n + r * 8147497, o = r * 2, l = 1e7;
|
|
247
255
|
s >= l && (a += Math.floor(s / l), s %= l), a >= l && (o += Math.floor(a / l), a %= l);
|
|
248
256
|
function c(h, p) {
|
|
249
|
-
let
|
|
250
|
-
return p ? "0000000".slice(
|
|
257
|
+
let y = h ? String(h) : "";
|
|
258
|
+
return p ? "0000000".slice(y.length) + y : y;
|
|
251
259
|
}
|
|
252
260
|
return c(
|
|
253
261
|
o,
|
|
@@ -265,7 +273,7 @@ function Ue(i, e) {
|
|
|
265
273
|
1
|
|
266
274
|
);
|
|
267
275
|
}
|
|
268
|
-
function
|
|
276
|
+
function He(i, e) {
|
|
269
277
|
if (i >= 0) {
|
|
270
278
|
for (; i > 127; )
|
|
271
279
|
e.push(i & 127 | 128), i = i >>> 7;
|
|
@@ -276,7 +284,7 @@ function Pe(i, e) {
|
|
|
276
284
|
e.push(1);
|
|
277
285
|
}
|
|
278
286
|
}
|
|
279
|
-
function
|
|
287
|
+
function Ct() {
|
|
280
288
|
let i = this.buf[this.pos++], e = i & 127;
|
|
281
289
|
if (!(i & 128))
|
|
282
290
|
return this.assertBounds(), e;
|
|
@@ -293,10 +301,10 @@ function Bt() {
|
|
|
293
301
|
throw new Error("invalid varint");
|
|
294
302
|
return this.assertBounds(), e >>> 0;
|
|
295
303
|
}
|
|
296
|
-
let
|
|
297
|
-
function
|
|
304
|
+
let I;
|
|
305
|
+
function St() {
|
|
298
306
|
const i = new DataView(new ArrayBuffer(8));
|
|
299
|
-
|
|
307
|
+
I = globalThis.BigInt !== void 0 && typeof i.getBigInt64 == "function" && typeof i.getBigUint64 == "function" && typeof i.setBigInt64 == "function" && typeof i.setBigUint64 == "function" ? {
|
|
300
308
|
MIN: BigInt("-9223372036854775808"),
|
|
301
309
|
MAX: BigInt("9223372036854775807"),
|
|
302
310
|
UMIN: BigInt("0"),
|
|
@@ -305,13 +313,13 @@ function Ft() {
|
|
|
305
313
|
V: i
|
|
306
314
|
} : void 0;
|
|
307
315
|
}
|
|
308
|
-
|
|
309
|
-
function
|
|
316
|
+
St();
|
|
317
|
+
function ht(i) {
|
|
310
318
|
if (!i)
|
|
311
319
|
throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
|
|
312
320
|
}
|
|
313
|
-
const
|
|
314
|
-
class
|
|
321
|
+
const dt = /^-?[0-9]+$/, Ae = 4294967296, Ee = 2147483648;
|
|
322
|
+
class ft {
|
|
315
323
|
/**
|
|
316
324
|
* Create a new instance with the given bits.
|
|
317
325
|
*/
|
|
@@ -328,46 +336,46 @@ class ot {
|
|
|
328
336
|
* Convert to a native number.
|
|
329
337
|
*/
|
|
330
338
|
toNumber() {
|
|
331
|
-
let e = this.hi *
|
|
339
|
+
let e = this.hi * Ae + (this.lo >>> 0);
|
|
332
340
|
if (!Number.isSafeInteger(e))
|
|
333
341
|
throw new Error("cannot convert to safe number");
|
|
334
342
|
return e;
|
|
335
343
|
}
|
|
336
344
|
}
|
|
337
|
-
class R extends
|
|
345
|
+
class R extends ft {
|
|
338
346
|
/**
|
|
339
347
|
* Create instance from a `string`, `number` or `bigint`.
|
|
340
348
|
*/
|
|
341
349
|
static from(e) {
|
|
342
|
-
if (
|
|
350
|
+
if (I)
|
|
343
351
|
switch (typeof e) {
|
|
344
352
|
case "string":
|
|
345
353
|
if (e == "0")
|
|
346
354
|
return this.ZERO;
|
|
347
355
|
if (e == "")
|
|
348
356
|
throw new Error("string is no integer");
|
|
349
|
-
e =
|
|
357
|
+
e = I.C(e);
|
|
350
358
|
case "number":
|
|
351
359
|
if (e === 0)
|
|
352
360
|
return this.ZERO;
|
|
353
|
-
e =
|
|
361
|
+
e = I.C(e);
|
|
354
362
|
case "bigint":
|
|
355
363
|
if (!e)
|
|
356
364
|
return this.ZERO;
|
|
357
|
-
if (e <
|
|
365
|
+
if (e < I.UMIN)
|
|
358
366
|
throw new Error("signed value for ulong");
|
|
359
|
-
if (e >
|
|
367
|
+
if (e > I.UMAX)
|
|
360
368
|
throw new Error("ulong too large");
|
|
361
|
-
return
|
|
369
|
+
return I.V.setBigUint64(0, e, !0), new R(I.V.getInt32(0, !0), I.V.getInt32(4, !0));
|
|
362
370
|
}
|
|
363
371
|
else
|
|
364
372
|
switch (typeof e) {
|
|
365
373
|
case "string":
|
|
366
374
|
if (e == "0")
|
|
367
375
|
return this.ZERO;
|
|
368
|
-
if (e = e.trim(), !
|
|
376
|
+
if (e = e.trim(), !dt.test(e))
|
|
369
377
|
throw new Error("string is no integer");
|
|
370
|
-
let [t, n, r] =
|
|
378
|
+
let [t, n, r] = ut(e);
|
|
371
379
|
if (t)
|
|
372
380
|
throw new Error("signed value for ulong");
|
|
373
381
|
return new R(n, r);
|
|
@@ -378,7 +386,7 @@ class R extends ot {
|
|
|
378
386
|
throw new Error("number is no integer");
|
|
379
387
|
if (e < 0)
|
|
380
388
|
throw new Error("signed value for ulong");
|
|
381
|
-
return new R(e, e /
|
|
389
|
+
return new R(e, e / Ae);
|
|
382
390
|
}
|
|
383
391
|
throw new Error("unknown value " + typeof e);
|
|
384
392
|
}
|
|
@@ -386,63 +394,63 @@ class R extends ot {
|
|
|
386
394
|
* Convert to decimal string.
|
|
387
395
|
*/
|
|
388
396
|
toString() {
|
|
389
|
-
return
|
|
397
|
+
return I ? this.toBigInt().toString() : Me(this.lo, this.hi);
|
|
390
398
|
}
|
|
391
399
|
/**
|
|
392
400
|
* Convert to native bigint.
|
|
393
401
|
*/
|
|
394
402
|
toBigInt() {
|
|
395
|
-
return
|
|
403
|
+
return ht(I), I.V.setInt32(0, this.lo, !0), I.V.setInt32(4, this.hi, !0), I.V.getBigUint64(0, !0);
|
|
396
404
|
}
|
|
397
405
|
}
|
|
398
406
|
R.ZERO = new R(0, 0);
|
|
399
|
-
class
|
|
407
|
+
class B extends ft {
|
|
400
408
|
/**
|
|
401
409
|
* Create instance from a `string`, `number` or `bigint`.
|
|
402
410
|
*/
|
|
403
411
|
static from(e) {
|
|
404
|
-
if (
|
|
412
|
+
if (I)
|
|
405
413
|
switch (typeof e) {
|
|
406
414
|
case "string":
|
|
407
415
|
if (e == "0")
|
|
408
416
|
return this.ZERO;
|
|
409
417
|
if (e == "")
|
|
410
418
|
throw new Error("string is no integer");
|
|
411
|
-
e =
|
|
419
|
+
e = I.C(e);
|
|
412
420
|
case "number":
|
|
413
421
|
if (e === 0)
|
|
414
422
|
return this.ZERO;
|
|
415
|
-
e =
|
|
423
|
+
e = I.C(e);
|
|
416
424
|
case "bigint":
|
|
417
425
|
if (!e)
|
|
418
426
|
return this.ZERO;
|
|
419
|
-
if (e <
|
|
427
|
+
if (e < I.MIN)
|
|
420
428
|
throw new Error("signed long too small");
|
|
421
|
-
if (e >
|
|
429
|
+
if (e > I.MAX)
|
|
422
430
|
throw new Error("signed long too large");
|
|
423
|
-
return
|
|
431
|
+
return I.V.setBigInt64(0, e, !0), new B(I.V.getInt32(0, !0), I.V.getInt32(4, !0));
|
|
424
432
|
}
|
|
425
433
|
else
|
|
426
434
|
switch (typeof e) {
|
|
427
435
|
case "string":
|
|
428
436
|
if (e == "0")
|
|
429
437
|
return this.ZERO;
|
|
430
|
-
if (e = e.trim(), !
|
|
438
|
+
if (e = e.trim(), !dt.test(e))
|
|
431
439
|
throw new Error("string is no integer");
|
|
432
|
-
let [t, n, r] =
|
|
440
|
+
let [t, n, r] = ut(e);
|
|
433
441
|
if (t) {
|
|
434
|
-
if (r >
|
|
442
|
+
if (r > Ee || r == Ee && n != 0)
|
|
435
443
|
throw new Error("signed long too small");
|
|
436
|
-
} else if (r >=
|
|
444
|
+
} else if (r >= Ee)
|
|
437
445
|
throw new Error("signed long too large");
|
|
438
|
-
let s = new
|
|
446
|
+
let s = new B(n, r);
|
|
439
447
|
return t ? s.negate() : s;
|
|
440
448
|
case "number":
|
|
441
449
|
if (e == 0)
|
|
442
450
|
return this.ZERO;
|
|
443
451
|
if (!Number.isSafeInteger(e))
|
|
444
452
|
throw new Error("number is no integer");
|
|
445
|
-
return e > 0 ? new
|
|
453
|
+
return e > 0 ? new B(e, e / Ae) : new B(-e, -e / Ae).negate();
|
|
446
454
|
}
|
|
447
455
|
throw new Error("unknown value " + typeof e);
|
|
448
456
|
}
|
|
@@ -450,7 +458,7 @@ class A extends ot {
|
|
|
450
458
|
* Do we have a minus sign?
|
|
451
459
|
*/
|
|
452
460
|
isNegative() {
|
|
453
|
-
return (this.hi &
|
|
461
|
+
return (this.hi & Ee) !== 0;
|
|
454
462
|
}
|
|
455
463
|
/**
|
|
456
464
|
* Negate two's complement.
|
|
@@ -458,38 +466,38 @@ class A extends ot {
|
|
|
458
466
|
*/
|
|
459
467
|
negate() {
|
|
460
468
|
let e = ~this.hi, t = this.lo;
|
|
461
|
-
return t ? t = ~t + 1 : e += 1, new
|
|
469
|
+
return t ? t = ~t + 1 : e += 1, new B(t, e);
|
|
462
470
|
}
|
|
463
471
|
/**
|
|
464
472
|
* Convert to decimal string.
|
|
465
473
|
*/
|
|
466
474
|
toString() {
|
|
467
|
-
if (
|
|
475
|
+
if (I)
|
|
468
476
|
return this.toBigInt().toString();
|
|
469
477
|
if (this.isNegative()) {
|
|
470
478
|
let e = this.negate();
|
|
471
|
-
return "-" +
|
|
479
|
+
return "-" + Me(e.lo, e.hi);
|
|
472
480
|
}
|
|
473
|
-
return
|
|
481
|
+
return Me(this.lo, this.hi);
|
|
474
482
|
}
|
|
475
483
|
/**
|
|
476
484
|
* Convert to native bigint.
|
|
477
485
|
*/
|
|
478
486
|
toBigInt() {
|
|
479
|
-
return
|
|
487
|
+
return ht(I), I.V.setInt32(0, this.lo, !0), I.V.setInt32(4, this.hi, !0), I.V.getBigInt64(0, !0);
|
|
480
488
|
}
|
|
481
489
|
}
|
|
482
|
-
|
|
483
|
-
const
|
|
490
|
+
B.ZERO = new B(0, 0);
|
|
491
|
+
const Ze = {
|
|
484
492
|
readUnknownField: !0,
|
|
485
|
-
readerFactory: (i) => new
|
|
493
|
+
readerFactory: (i) => new Mt(i)
|
|
486
494
|
};
|
|
487
|
-
function
|
|
488
|
-
return i ? Object.assign(Object.assign({},
|
|
495
|
+
function vt(i) {
|
|
496
|
+
return i ? Object.assign(Object.assign({}, Ze), i) : Ze;
|
|
489
497
|
}
|
|
490
|
-
class
|
|
498
|
+
class Mt {
|
|
491
499
|
constructor(e, t) {
|
|
492
|
-
this.varint64 =
|
|
500
|
+
this.varint64 = xt, this.uint32 = Ct, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength), this.textDecoder = t ?? new TextDecoder("utf-8", {
|
|
493
501
|
fatal: !0,
|
|
494
502
|
ignoreBOM: !0
|
|
495
503
|
});
|
|
@@ -557,7 +565,7 @@ class Dt {
|
|
|
557
565
|
* Read a `int64` field, a signed 64-bit varint.
|
|
558
566
|
*/
|
|
559
567
|
int64() {
|
|
560
|
-
return new
|
|
568
|
+
return new B(...this.varint64());
|
|
561
569
|
}
|
|
562
570
|
/**
|
|
563
571
|
* Read a `uint64` field, an unsigned 64-bit varint.
|
|
@@ -570,7 +578,7 @@ class Dt {
|
|
|
570
578
|
*/
|
|
571
579
|
sint64() {
|
|
572
580
|
let [e, t] = this.varint64(), n = -(e & 1);
|
|
573
|
-
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, new
|
|
581
|
+
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, new B(e, t);
|
|
574
582
|
}
|
|
575
583
|
/**
|
|
576
584
|
* Read a `bool` field, a variant.
|
|
@@ -601,7 +609,7 @@ class Dt {
|
|
|
601
609
|
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
|
602
610
|
*/
|
|
603
611
|
sfixed64() {
|
|
604
|
-
return new
|
|
612
|
+
return new B(this.sfixed32(), this.sfixed32());
|
|
605
613
|
}
|
|
606
614
|
/**
|
|
607
615
|
* Read a `float` field, 32-bit floating point number.
|
|
@@ -633,33 +641,33 @@ function b(i, e) {
|
|
|
633
641
|
if (!i)
|
|
634
642
|
throw new Error(e);
|
|
635
643
|
}
|
|
636
|
-
const
|
|
637
|
-
function
|
|
644
|
+
const Vt = 34028234663852886e22, $t = -34028234663852886e22, jt = 4294967295, Pt = 2147483647, Wt = -2147483648;
|
|
645
|
+
function be(i) {
|
|
638
646
|
if (typeof i != "number")
|
|
639
647
|
throw new Error("invalid int 32: " + typeof i);
|
|
640
|
-
if (!Number.isInteger(i) || i >
|
|
648
|
+
if (!Number.isInteger(i) || i > Pt || i < Wt)
|
|
641
649
|
throw new Error("invalid int 32: " + i);
|
|
642
650
|
}
|
|
643
|
-
function
|
|
651
|
+
function De(i) {
|
|
644
652
|
if (typeof i != "number")
|
|
645
653
|
throw new Error("invalid uint 32: " + typeof i);
|
|
646
|
-
if (!Number.isInteger(i) || i >
|
|
654
|
+
if (!Number.isInteger(i) || i > jt || i < 0)
|
|
647
655
|
throw new Error("invalid uint 32: " + i);
|
|
648
656
|
}
|
|
649
|
-
function
|
|
657
|
+
function Pe(i) {
|
|
650
658
|
if (typeof i != "number")
|
|
651
659
|
throw new Error("invalid float 32: " + typeof i);
|
|
652
|
-
if (Number.isFinite(i) && (i >
|
|
660
|
+
if (Number.isFinite(i) && (i > Vt || i < $t))
|
|
653
661
|
throw new Error("invalid float 32: " + i);
|
|
654
662
|
}
|
|
655
|
-
const
|
|
663
|
+
const Ye = {
|
|
656
664
|
writeUnknownFields: !0,
|
|
657
|
-
writerFactory: () => new
|
|
665
|
+
writerFactory: () => new Kt()
|
|
658
666
|
};
|
|
659
|
-
function
|
|
660
|
-
return i ? Object.assign(Object.assign({},
|
|
667
|
+
function qt(i) {
|
|
668
|
+
return i ? Object.assign(Object.assign({}, Ye), i) : Ye;
|
|
661
669
|
}
|
|
662
|
-
class
|
|
670
|
+
class Kt {
|
|
663
671
|
constructor(e) {
|
|
664
672
|
this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
|
|
665
673
|
}
|
|
@@ -715,7 +723,7 @@ class Ct {
|
|
|
715
723
|
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
716
724
|
*/
|
|
717
725
|
uint32(e) {
|
|
718
|
-
for (
|
|
726
|
+
for (De(e); e > 127; )
|
|
719
727
|
this.buf.push(e & 127 | 128), e = e >>> 7;
|
|
720
728
|
return this.buf.push(e), this;
|
|
721
729
|
}
|
|
@@ -723,7 +731,7 @@ class Ct {
|
|
|
723
731
|
* Write a `int32` value, a signed 32 bit varint.
|
|
724
732
|
*/
|
|
725
733
|
int32(e) {
|
|
726
|
-
return
|
|
734
|
+
return be(e), He(e, this.buf), this;
|
|
727
735
|
}
|
|
728
736
|
/**
|
|
729
737
|
* Write a `bool` value, a variant.
|
|
@@ -748,7 +756,7 @@ class Ct {
|
|
|
748
756
|
* Write a `float` value, 32-bit floating point number.
|
|
749
757
|
*/
|
|
750
758
|
float(e) {
|
|
751
|
-
|
|
759
|
+
Pe(e);
|
|
752
760
|
let t = new Uint8Array(4);
|
|
753
761
|
return new DataView(t.buffer).setFloat32(0, e, !0), this.raw(t);
|
|
754
762
|
}
|
|
@@ -763,7 +771,7 @@ class Ct {
|
|
|
763
771
|
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
764
772
|
*/
|
|
765
773
|
fixed32(e) {
|
|
766
|
-
|
|
774
|
+
De(e);
|
|
767
775
|
let t = new Uint8Array(4);
|
|
768
776
|
return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
|
|
769
777
|
}
|
|
@@ -771,7 +779,7 @@ class Ct {
|
|
|
771
779
|
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
772
780
|
*/
|
|
773
781
|
sfixed32(e) {
|
|
774
|
-
|
|
782
|
+
be(e);
|
|
775
783
|
let t = new Uint8Array(4);
|
|
776
784
|
return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
|
|
777
785
|
}
|
|
@@ -779,13 +787,13 @@ class Ct {
|
|
|
779
787
|
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
780
788
|
*/
|
|
781
789
|
sint32(e) {
|
|
782
|
-
return
|
|
790
|
+
return be(e), e = (e << 1 ^ e >> 31) >>> 0, He(e, this.buf), this;
|
|
783
791
|
}
|
|
784
792
|
/**
|
|
785
793
|
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
786
794
|
*/
|
|
787
795
|
sfixed64(e) {
|
|
788
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer), r =
|
|
796
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), r = B.from(e);
|
|
789
797
|
return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
|
|
790
798
|
}
|
|
791
799
|
/**
|
|
@@ -799,45 +807,45 @@ class Ct {
|
|
|
799
807
|
* Write a `int64` value, a signed 64-bit varint.
|
|
800
808
|
*/
|
|
801
809
|
int64(e) {
|
|
802
|
-
let t =
|
|
803
|
-
return
|
|
810
|
+
let t = B.from(e);
|
|
811
|
+
return _e(t.lo, t.hi, this.buf), this;
|
|
804
812
|
}
|
|
805
813
|
/**
|
|
806
814
|
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
807
815
|
*/
|
|
808
816
|
sint64(e) {
|
|
809
|
-
let t =
|
|
810
|
-
return
|
|
817
|
+
let t = B.from(e), n = t.hi >> 31, r = t.lo << 1 ^ n, s = (t.hi << 1 | t.lo >>> 31) ^ n;
|
|
818
|
+
return _e(r, s, this.buf), this;
|
|
811
819
|
}
|
|
812
820
|
/**
|
|
813
821
|
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
814
822
|
*/
|
|
815
823
|
uint64(e) {
|
|
816
824
|
let t = R.from(e);
|
|
817
|
-
return
|
|
825
|
+
return _e(t.lo, t.hi, this.buf), this;
|
|
818
826
|
}
|
|
819
827
|
}
|
|
820
|
-
const
|
|
828
|
+
const ze = {
|
|
821
829
|
emitDefaultValues: !1,
|
|
822
830
|
enumAsInteger: !1,
|
|
823
831
|
useProtoFieldName: !1,
|
|
824
832
|
prettySpaces: 0
|
|
825
|
-
},
|
|
833
|
+
}, Qe = {
|
|
826
834
|
ignoreUnknownFields: !1
|
|
827
835
|
};
|
|
828
|
-
function
|
|
829
|
-
return i ? Object.assign(Object.assign({},
|
|
836
|
+
function Xt(i) {
|
|
837
|
+
return i ? Object.assign(Object.assign({}, Qe), i) : Qe;
|
|
830
838
|
}
|
|
831
|
-
function
|
|
832
|
-
return i ? Object.assign(Object.assign({},
|
|
839
|
+
function Gt(i) {
|
|
840
|
+
return i ? Object.assign(Object.assign({}, ze), i) : ze;
|
|
833
841
|
}
|
|
834
|
-
function
|
|
842
|
+
function Jt(i, e) {
|
|
835
843
|
var t, n;
|
|
836
844
|
let r = Object.assign(Object.assign({}, i), e);
|
|
837
845
|
return r.typeRegistry = [...(t = i == null ? void 0 : i.typeRegistry) !== null && t !== void 0 ? t : [], ...(n = e == null ? void 0 : e.typeRegistry) !== null && n !== void 0 ? n : []], r;
|
|
838
846
|
}
|
|
839
|
-
const
|
|
840
|
-
function
|
|
847
|
+
const mt = Symbol.for("protobuf-ts/message-type");
|
|
848
|
+
function Ve(i) {
|
|
841
849
|
let e = !1;
|
|
842
850
|
const t = [];
|
|
843
851
|
for (let n = 0; n < i.length; n++) {
|
|
@@ -850,19 +858,19 @@ var u;
|
|
|
850
858
|
(function(i) {
|
|
851
859
|
i[i.DOUBLE = 1] = "DOUBLE", i[i.FLOAT = 2] = "FLOAT", i[i.INT64 = 3] = "INT64", i[i.UINT64 = 4] = "UINT64", i[i.INT32 = 5] = "INT32", i[i.FIXED64 = 6] = "FIXED64", i[i.FIXED32 = 7] = "FIXED32", i[i.BOOL = 8] = "BOOL", i[i.STRING = 9] = "STRING", i[i.BYTES = 12] = "BYTES", i[i.UINT32 = 13] = "UINT32", i[i.SFIXED32 = 15] = "SFIXED32", i[i.SFIXED64 = 16] = "SFIXED64", i[i.SINT32 = 17] = "SINT32", i[i.SINT64 = 18] = "SINT64";
|
|
852
860
|
})(u || (u = {}));
|
|
853
|
-
var
|
|
861
|
+
var H;
|
|
854
862
|
(function(i) {
|
|
855
863
|
i[i.BIGINT = 0] = "BIGINT", i[i.STRING = 1] = "STRING", i[i.NUMBER = 2] = "NUMBER";
|
|
856
|
-
})(
|
|
857
|
-
var
|
|
864
|
+
})(H || (H = {}));
|
|
865
|
+
var Ue;
|
|
858
866
|
(function(i) {
|
|
859
867
|
i[i.NO = 0] = "NO", i[i.PACKED = 1] = "PACKED", i[i.UNPACKED = 2] = "UNPACKED";
|
|
860
|
-
})(
|
|
861
|
-
function
|
|
868
|
+
})(Ue || (Ue = {}));
|
|
869
|
+
function Ht(i) {
|
|
862
870
|
var e, t, n, r;
|
|
863
|
-
return i.localName = (e = i.localName) !== null && e !== void 0 ? e :
|
|
871
|
+
return i.localName = (e = i.localName) !== null && e !== void 0 ? e : Ve(i.name), i.jsonName = (t = i.jsonName) !== null && t !== void 0 ? t : Ve(i.name), i.repeat = (n = i.repeat) !== null && n !== void 0 ? n : Ue.NO, i.opt = (r = i.opt) !== null && r !== void 0 ? r : i.repeat || i.oneof ? !1 : i.kind == "message", i;
|
|
864
872
|
}
|
|
865
|
-
function
|
|
873
|
+
function Zt(i) {
|
|
866
874
|
if (typeof i != "object" || i === null || !i.hasOwnProperty("oneofKind"))
|
|
867
875
|
return !1;
|
|
868
876
|
switch (typeof i.oneofKind) {
|
|
@@ -874,7 +882,7 @@ function jt(i) {
|
|
|
874
882
|
return !1;
|
|
875
883
|
}
|
|
876
884
|
}
|
|
877
|
-
class
|
|
885
|
+
class Yt {
|
|
878
886
|
constructor(e) {
|
|
879
887
|
var t;
|
|
880
888
|
this.fields = (t = e.fields) !== null && t !== void 0 ? t : [];
|
|
@@ -934,7 +942,7 @@ class Pt {
|
|
|
934
942
|
return !0;
|
|
935
943
|
for (const a of s.oneofs) {
|
|
936
944
|
const o = e[a];
|
|
937
|
-
if (!
|
|
945
|
+
if (!Zt(o))
|
|
938
946
|
return !1;
|
|
939
947
|
if (o.oneofKind === void 0)
|
|
940
948
|
continue;
|
|
@@ -1002,9 +1010,9 @@ class Pt {
|
|
|
1002
1010
|
case u.SFIXED64:
|
|
1003
1011
|
case u.SINT64:
|
|
1004
1012
|
switch (n) {
|
|
1005
|
-
case
|
|
1013
|
+
case H.BIGINT:
|
|
1006
1014
|
return r == "bigint";
|
|
1007
|
-
case
|
|
1015
|
+
case H.NUMBER:
|
|
1008
1016
|
return r == "number" && !isNaN(e);
|
|
1009
1017
|
default:
|
|
1010
1018
|
return r == "string";
|
|
@@ -1046,21 +1054,21 @@ class Pt {
|
|
|
1046
1054
|
case u.BOOL:
|
|
1047
1055
|
return this.scalars(r.slice(0, n).map((s) => s == "true" ? !0 : s == "false" ? !1 : s), t, n);
|
|
1048
1056
|
default:
|
|
1049
|
-
return this.scalars(r, t, n,
|
|
1057
|
+
return this.scalars(r, t, n, H.STRING);
|
|
1050
1058
|
}
|
|
1051
1059
|
}
|
|
1052
1060
|
}
|
|
1053
|
-
function
|
|
1061
|
+
function K(i, e) {
|
|
1054
1062
|
switch (e) {
|
|
1055
|
-
case
|
|
1063
|
+
case H.BIGINT:
|
|
1056
1064
|
return i.toBigInt();
|
|
1057
|
-
case
|
|
1065
|
+
case H.NUMBER:
|
|
1058
1066
|
return i.toNumber();
|
|
1059
1067
|
default:
|
|
1060
1068
|
return i.toString();
|
|
1061
1069
|
}
|
|
1062
1070
|
}
|
|
1063
|
-
class
|
|
1071
|
+
class zt {
|
|
1064
1072
|
constructor(e) {
|
|
1065
1073
|
this.info = e;
|
|
1066
1074
|
}
|
|
@@ -1076,7 +1084,7 @@ class Wt {
|
|
|
1076
1084
|
// Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
|
|
1077
1085
|
assert(e, t, n) {
|
|
1078
1086
|
if (!e) {
|
|
1079
|
-
let r =
|
|
1087
|
+
let r = ot(n);
|
|
1080
1088
|
throw (r == "number" || r == "boolean") && (r = n.toString()), new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`);
|
|
1081
1089
|
}
|
|
1082
1090
|
}
|
|
@@ -1114,26 +1122,26 @@ class Wt {
|
|
|
1114
1122
|
if (o.kind == "map") {
|
|
1115
1123
|
if (a === null)
|
|
1116
1124
|
continue;
|
|
1117
|
-
this.assert(
|
|
1125
|
+
this.assert(Rt(a), o.name, a);
|
|
1118
1126
|
const h = c[l];
|
|
1119
|
-
for (const [p,
|
|
1120
|
-
this.assert(
|
|
1121
|
-
let
|
|
1127
|
+
for (const [p, y] of Object.entries(a)) {
|
|
1128
|
+
this.assert(y !== null, o.name + " map value", null);
|
|
1129
|
+
let A;
|
|
1122
1130
|
switch (o.V.kind) {
|
|
1123
1131
|
case "message":
|
|
1124
|
-
|
|
1132
|
+
A = o.V.T().internalJsonRead(y, n);
|
|
1125
1133
|
break;
|
|
1126
1134
|
case "enum":
|
|
1127
|
-
if (
|
|
1135
|
+
if (A = this.enum(o.V.T(), y, o.name, n.ignoreUnknownFields), A === !1)
|
|
1128
1136
|
continue;
|
|
1129
1137
|
break;
|
|
1130
1138
|
case "scalar":
|
|
1131
|
-
|
|
1139
|
+
A = this.scalar(y, o.V.T, o.V.L, o.name);
|
|
1132
1140
|
break;
|
|
1133
1141
|
}
|
|
1134
|
-
this.assert(
|
|
1142
|
+
this.assert(A !== void 0, o.name + " map value", y);
|
|
1135
1143
|
let F = p;
|
|
1136
|
-
o.K == u.BOOL && (F = F == "true" ? !0 : F == "false" ? !1 : F), F = this.scalar(F, o.K,
|
|
1144
|
+
o.K == u.BOOL && (F = F == "true" ? !0 : F == "false" ? !1 : F), F = this.scalar(F, o.K, H.STRING, o.name).toString(), h[F] = A;
|
|
1137
1145
|
}
|
|
1138
1146
|
} else if (o.repeat) {
|
|
1139
1147
|
if (a === null)
|
|
@@ -1142,20 +1150,20 @@ class Wt {
|
|
|
1142
1150
|
const h = c[l];
|
|
1143
1151
|
for (const p of a) {
|
|
1144
1152
|
this.assert(p !== null, o.name, null);
|
|
1145
|
-
let
|
|
1153
|
+
let y;
|
|
1146
1154
|
switch (o.kind) {
|
|
1147
1155
|
case "message":
|
|
1148
|
-
|
|
1156
|
+
y = o.T().internalJsonRead(p, n);
|
|
1149
1157
|
break;
|
|
1150
1158
|
case "enum":
|
|
1151
|
-
if (
|
|
1159
|
+
if (y = this.enum(o.T(), p, o.name, n.ignoreUnknownFields), y === !1)
|
|
1152
1160
|
continue;
|
|
1153
1161
|
break;
|
|
1154
1162
|
case "scalar":
|
|
1155
|
-
|
|
1163
|
+
y = this.scalar(p, o.T, o.L, o.name);
|
|
1156
1164
|
break;
|
|
1157
1165
|
}
|
|
1158
|
-
this.assert(
|
|
1166
|
+
this.assert(y !== void 0, o.name, a), h.push(y);
|
|
1159
1167
|
}
|
|
1160
1168
|
} else
|
|
1161
1169
|
switch (o.kind) {
|
|
@@ -1230,7 +1238,7 @@ class Wt {
|
|
|
1230
1238
|
s = "too large or small";
|
|
1231
1239
|
break;
|
|
1232
1240
|
}
|
|
1233
|
-
return t == u.FLOAT &&
|
|
1241
|
+
return t == u.FLOAT && Pe(a), a;
|
|
1234
1242
|
case u.INT32:
|
|
1235
1243
|
case u.FIXED32:
|
|
1236
1244
|
case u.SFIXED32:
|
|
@@ -1241,22 +1249,22 @@ class Wt {
|
|
|
1241
1249
|
let o;
|
|
1242
1250
|
if (typeof e == "number" ? o = e : e === "" ? s = "empty string" : typeof e == "string" && (e.trim().length !== e.length ? s = "extra whitespace" : o = Number(e)), o === void 0)
|
|
1243
1251
|
break;
|
|
1244
|
-
return t == u.UINT32 ?
|
|
1252
|
+
return t == u.UINT32 ? De(o) : be(o), o;
|
|
1245
1253
|
case u.INT64:
|
|
1246
1254
|
case u.SFIXED64:
|
|
1247
1255
|
case u.SINT64:
|
|
1248
1256
|
if (e === null)
|
|
1249
|
-
return
|
|
1257
|
+
return K(B.ZERO, n);
|
|
1250
1258
|
if (typeof e != "number" && typeof e != "string")
|
|
1251
1259
|
break;
|
|
1252
|
-
return
|
|
1260
|
+
return K(B.from(e), n);
|
|
1253
1261
|
case u.FIXED64:
|
|
1254
1262
|
case u.UINT64:
|
|
1255
1263
|
if (e === null)
|
|
1256
|
-
return
|
|
1264
|
+
return K(R.ZERO, n);
|
|
1257
1265
|
if (typeof e != "number" && typeof e != "string")
|
|
1258
1266
|
break;
|
|
1259
|
-
return
|
|
1267
|
+
return K(R.from(e), n);
|
|
1260
1268
|
case u.BOOL:
|
|
1261
1269
|
if (e === null)
|
|
1262
1270
|
return !1;
|
|
@@ -1282,7 +1290,7 @@ class Wt {
|
|
|
1282
1290
|
return new Uint8Array(0);
|
|
1283
1291
|
if (typeof e != "string")
|
|
1284
1292
|
break;
|
|
1285
|
-
return
|
|
1293
|
+
return lt(e);
|
|
1286
1294
|
}
|
|
1287
1295
|
} catch (a) {
|
|
1288
1296
|
s = a.message;
|
|
@@ -1290,7 +1298,7 @@ class Wt {
|
|
|
1290
1298
|
this.assert(!1, r + (s ? " - " + s : ""), e);
|
|
1291
1299
|
}
|
|
1292
1300
|
}
|
|
1293
|
-
class
|
|
1301
|
+
class Qt {
|
|
1294
1302
|
constructor(e) {
|
|
1295
1303
|
var t;
|
|
1296
1304
|
this.fields = (t = e.fields) !== null && t !== void 0 ? t : [];
|
|
@@ -1411,12 +1419,12 @@ class qt {
|
|
|
1411
1419
|
case u.INT32:
|
|
1412
1420
|
case u.SFIXED32:
|
|
1413
1421
|
case u.SINT32:
|
|
1414
|
-
return t === 0 ? a ? 0 : void 0 : (
|
|
1422
|
+
return t === 0 ? a ? 0 : void 0 : (be(t), t);
|
|
1415
1423
|
case u.FIXED32:
|
|
1416
1424
|
case u.UINT32:
|
|
1417
|
-
return t === 0 ? a ? 0 : void 0 : (
|
|
1425
|
+
return t === 0 ? a ? 0 : void 0 : (De(t), t);
|
|
1418
1426
|
case u.FLOAT:
|
|
1419
|
-
|
|
1427
|
+
Pe(t);
|
|
1420
1428
|
case u.DOUBLE:
|
|
1421
1429
|
return t === 0 ? a ? 0 : void 0 : (b(typeof t == "number"), Number.isNaN(t) ? "NaN" : t === Number.POSITIVE_INFINITY ? "Infinity" : t === Number.NEGATIVE_INFINITY ? "-Infinity" : t);
|
|
1422
1430
|
case u.STRING:
|
|
@@ -1432,24 +1440,24 @@ class qt {
|
|
|
1432
1440
|
case u.SFIXED64:
|
|
1433
1441
|
case u.SINT64:
|
|
1434
1442
|
b(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
|
|
1435
|
-
let l =
|
|
1443
|
+
let l = B.from(t);
|
|
1436
1444
|
return l.isZero() && !a ? void 0 : l.toString();
|
|
1437
1445
|
case u.BYTES:
|
|
1438
|
-
return b(t instanceof Uint8Array), t.byteLength ?
|
|
1446
|
+
return b(t instanceof Uint8Array), t.byteLength ? ct(t) : a ? "" : void 0;
|
|
1439
1447
|
}
|
|
1440
1448
|
}
|
|
1441
1449
|
}
|
|
1442
|
-
function
|
|
1450
|
+
function $e(i, e = H.STRING) {
|
|
1443
1451
|
switch (i) {
|
|
1444
1452
|
case u.BOOL:
|
|
1445
1453
|
return !1;
|
|
1446
1454
|
case u.UINT64:
|
|
1447
1455
|
case u.FIXED64:
|
|
1448
|
-
return
|
|
1456
|
+
return K(R.ZERO, e);
|
|
1449
1457
|
case u.INT64:
|
|
1450
1458
|
case u.SFIXED64:
|
|
1451
1459
|
case u.SINT64:
|
|
1452
|
-
return
|
|
1460
|
+
return K(B.ZERO, e);
|
|
1453
1461
|
case u.DOUBLE:
|
|
1454
1462
|
case u.FLOAT:
|
|
1455
1463
|
return 0;
|
|
@@ -1461,7 +1469,7 @@ function xe(i, e = X.STRING) {
|
|
|
1461
1469
|
return 0;
|
|
1462
1470
|
}
|
|
1463
1471
|
}
|
|
1464
|
-
class
|
|
1472
|
+
class en {
|
|
1465
1473
|
constructor(e) {
|
|
1466
1474
|
this.info = e;
|
|
1467
1475
|
}
|
|
@@ -1487,11 +1495,11 @@ class Kt {
|
|
|
1487
1495
|
for (; e.pos < s; ) {
|
|
1488
1496
|
const [a, o] = e.tag(), l = this.fieldNoToField.get(a);
|
|
1489
1497
|
if (!l) {
|
|
1490
|
-
let
|
|
1491
|
-
if (
|
|
1498
|
+
let y = n.readUnknownField;
|
|
1499
|
+
if (y == "throw")
|
|
1492
1500
|
throw new Error(`Unknown field ${a} (wire type ${o}) for ${this.info.typeName}`);
|
|
1493
|
-
let
|
|
1494
|
-
|
|
1501
|
+
let A = e.skip(o);
|
|
1502
|
+
y !== !1 && (y === !0 ? k.onRead : y)(this.info.typeName, t, a, o, A);
|
|
1495
1503
|
continue;
|
|
1496
1504
|
}
|
|
1497
1505
|
let c = t, h = l.repeat, p = l.localName;
|
|
@@ -1500,28 +1508,28 @@ class Kt {
|
|
|
1500
1508
|
})), l.kind) {
|
|
1501
1509
|
case "scalar":
|
|
1502
1510
|
case "enum":
|
|
1503
|
-
let
|
|
1511
|
+
let y = l.kind == "enum" ? u.INT32 : l.T, A = l.kind == "scalar" ? l.L : void 0;
|
|
1504
1512
|
if (h) {
|
|
1505
1513
|
let O = c[p];
|
|
1506
|
-
if (o == m.LengthDelimited &&
|
|
1507
|
-
let
|
|
1508
|
-
for (; e.pos <
|
|
1509
|
-
O.push(this.scalar(e,
|
|
1514
|
+
if (o == m.LengthDelimited && y != u.STRING && y != u.BYTES) {
|
|
1515
|
+
let $ = e.uint32() + e.pos;
|
|
1516
|
+
for (; e.pos < $; )
|
|
1517
|
+
O.push(this.scalar(e, y, A));
|
|
1510
1518
|
} else
|
|
1511
|
-
O.push(this.scalar(e,
|
|
1519
|
+
O.push(this.scalar(e, y, A));
|
|
1512
1520
|
} else
|
|
1513
|
-
c[p] = this.scalar(e,
|
|
1521
|
+
c[p] = this.scalar(e, y, A);
|
|
1514
1522
|
break;
|
|
1515
1523
|
case "message":
|
|
1516
1524
|
if (h) {
|
|
1517
|
-
let O = c[p],
|
|
1518
|
-
O.push(
|
|
1525
|
+
let O = c[p], $ = l.T().internalBinaryRead(e, e.uint32(), n);
|
|
1526
|
+
O.push($);
|
|
1519
1527
|
} else
|
|
1520
1528
|
c[p] = l.T().internalBinaryRead(e, e.uint32(), n, c[p]);
|
|
1521
1529
|
break;
|
|
1522
1530
|
case "map":
|
|
1523
|
-
let [F,
|
|
1524
|
-
c[p][F] =
|
|
1531
|
+
let [F, ee] = this.mapEntry(l, e, n);
|
|
1532
|
+
c[p][F] = ee;
|
|
1525
1533
|
break;
|
|
1526
1534
|
}
|
|
1527
1535
|
}
|
|
@@ -1535,7 +1543,7 @@ class Kt {
|
|
|
1535
1543
|
let [l, c] = t.tag();
|
|
1536
1544
|
switch (l) {
|
|
1537
1545
|
case 1:
|
|
1538
|
-
e.K == u.BOOL ? a = t.bool().toString() : a = this.scalar(t, e.K,
|
|
1546
|
+
e.K == u.BOOL ? a = t.bool().toString() : a = this.scalar(t, e.K, H.STRING);
|
|
1539
1547
|
break;
|
|
1540
1548
|
case 2:
|
|
1541
1549
|
switch (e.V.kind) {
|
|
@@ -1555,13 +1563,13 @@ class Kt {
|
|
|
1555
1563
|
}
|
|
1556
1564
|
}
|
|
1557
1565
|
if (a === void 0) {
|
|
1558
|
-
let l =
|
|
1566
|
+
let l = $e(e.K);
|
|
1559
1567
|
a = e.K == u.BOOL ? l.toString() : l;
|
|
1560
1568
|
}
|
|
1561
1569
|
if (o === void 0)
|
|
1562
1570
|
switch (e.V.kind) {
|
|
1563
1571
|
case "scalar":
|
|
1564
|
-
o =
|
|
1572
|
+
o = $e(e.V.T, e.V.L);
|
|
1565
1573
|
break;
|
|
1566
1574
|
case "enum":
|
|
1567
1575
|
o = 0;
|
|
@@ -1585,11 +1593,11 @@ class Kt {
|
|
|
1585
1593
|
case u.FLOAT:
|
|
1586
1594
|
return e.float();
|
|
1587
1595
|
case u.INT64:
|
|
1588
|
-
return
|
|
1596
|
+
return K(e.int64(), n);
|
|
1589
1597
|
case u.UINT64:
|
|
1590
|
-
return
|
|
1598
|
+
return K(e.uint64(), n);
|
|
1591
1599
|
case u.FIXED64:
|
|
1592
|
-
return
|
|
1600
|
+
return K(e.fixed64(), n);
|
|
1593
1601
|
case u.FIXED32:
|
|
1594
1602
|
return e.fixed32();
|
|
1595
1603
|
case u.BYTES:
|
|
@@ -1599,15 +1607,15 @@ class Kt {
|
|
|
1599
1607
|
case u.SFIXED32:
|
|
1600
1608
|
return e.sfixed32();
|
|
1601
1609
|
case u.SFIXED64:
|
|
1602
|
-
return
|
|
1610
|
+
return K(e.sfixed64(), n);
|
|
1603
1611
|
case u.SINT32:
|
|
1604
1612
|
return e.sint32();
|
|
1605
1613
|
case u.SINT64:
|
|
1606
|
-
return
|
|
1614
|
+
return K(e.sint64(), n);
|
|
1607
1615
|
}
|
|
1608
1616
|
}
|
|
1609
1617
|
}
|
|
1610
|
-
class
|
|
1618
|
+
class tn {
|
|
1611
1619
|
constructor(e) {
|
|
1612
1620
|
this.info = e;
|
|
1613
1621
|
}
|
|
@@ -1636,7 +1644,7 @@ class Xt {
|
|
|
1636
1644
|
case "enum":
|
|
1637
1645
|
let h = s.kind == "enum" ? u.INT32 : s.T;
|
|
1638
1646
|
if (l)
|
|
1639
|
-
if (b(Array.isArray(a)), l ==
|
|
1647
|
+
if (b(Array.isArray(a)), l == Ue.PACKED)
|
|
1640
1648
|
this.packed(t, h, s.no, a);
|
|
1641
1649
|
else
|
|
1642
1650
|
for (const p of a)
|
|
@@ -1653,13 +1661,13 @@ class Xt {
|
|
|
1653
1661
|
break;
|
|
1654
1662
|
case "map":
|
|
1655
1663
|
b(typeof a == "object" && a !== null);
|
|
1656
|
-
for (const [p,
|
|
1657
|
-
this.mapEntry(t, n, s, p,
|
|
1664
|
+
for (const [p, y] of Object.entries(a))
|
|
1665
|
+
this.mapEntry(t, n, s, p, y);
|
|
1658
1666
|
break;
|
|
1659
1667
|
}
|
|
1660
1668
|
}
|
|
1661
1669
|
let r = n.writeUnknownFields;
|
|
1662
|
-
r !== !1 && (r === !0 ?
|
|
1670
|
+
r !== !1 && (r === !0 ? k.onWrite : r)(this.info.typeName, e, t);
|
|
1663
1671
|
}
|
|
1664
1672
|
mapEntry(e, t, n, r, s) {
|
|
1665
1673
|
e.tag(n.no, m.LengthDelimited), e.fork();
|
|
@@ -1743,7 +1751,7 @@ class Xt {
|
|
|
1743
1751
|
n = m.Bit32, r = "float";
|
|
1744
1752
|
break;
|
|
1745
1753
|
case u.INT64:
|
|
1746
|
-
a = s ||
|
|
1754
|
+
a = s || B.from(t).isZero(), r = "int64";
|
|
1747
1755
|
break;
|
|
1748
1756
|
case u.UINT64:
|
|
1749
1757
|
a = s || R.from(t).isZero(), r = "uint64";
|
|
@@ -1761,20 +1769,20 @@ class Xt {
|
|
|
1761
1769
|
n = m.Bit32, r = "sfixed32";
|
|
1762
1770
|
break;
|
|
1763
1771
|
case u.SFIXED64:
|
|
1764
|
-
a = s ||
|
|
1772
|
+
a = s || B.from(t).isZero(), n = m.Bit64, r = "sfixed64";
|
|
1765
1773
|
break;
|
|
1766
1774
|
case u.SINT32:
|
|
1767
1775
|
r = "sint32";
|
|
1768
1776
|
break;
|
|
1769
1777
|
case u.SINT64:
|
|
1770
|
-
a = s ||
|
|
1778
|
+
a = s || B.from(t).isZero(), r = "sint64";
|
|
1771
1779
|
break;
|
|
1772
1780
|
}
|
|
1773
1781
|
return [n, r, s || a];
|
|
1774
1782
|
}
|
|
1775
1783
|
}
|
|
1776
|
-
function
|
|
1777
|
-
const e = i.messagePrototype ? Object.create(i.messagePrototype) : Object.defineProperty({},
|
|
1784
|
+
function nn(i) {
|
|
1785
|
+
const e = i.messagePrototype ? Object.create(i.messagePrototype) : Object.defineProperty({}, mt, { value: i });
|
|
1778
1786
|
for (let t of i.fields) {
|
|
1779
1787
|
let n = t.localName;
|
|
1780
1788
|
if (!t.opt)
|
|
@@ -1785,7 +1793,7 @@ function Gt(i) {
|
|
|
1785
1793
|
else
|
|
1786
1794
|
switch (t.kind) {
|
|
1787
1795
|
case "scalar":
|
|
1788
|
-
e[n] =
|
|
1796
|
+
e[n] = $e(t.T, t.L);
|
|
1789
1797
|
break;
|
|
1790
1798
|
case "enum":
|
|
1791
1799
|
e[n] = 0;
|
|
@@ -1797,7 +1805,7 @@ function Gt(i) {
|
|
|
1797
1805
|
}
|
|
1798
1806
|
return e;
|
|
1799
1807
|
}
|
|
1800
|
-
function
|
|
1808
|
+
function _(i, e, t) {
|
|
1801
1809
|
let n, r = t, s;
|
|
1802
1810
|
for (let a of i.fields) {
|
|
1803
1811
|
let o = a.localName;
|
|
@@ -1843,7 +1851,7 @@ function x(i, e, t) {
|
|
|
1843
1851
|
}
|
|
1844
1852
|
}
|
|
1845
1853
|
}
|
|
1846
|
-
function
|
|
1854
|
+
function rn(i, e, t) {
|
|
1847
1855
|
if (e === t)
|
|
1848
1856
|
return !0;
|
|
1849
1857
|
if (!e || !t)
|
|
@@ -1854,24 +1862,24 @@ function Jt(i, e, t) {
|
|
|
1854
1862
|
case "enum":
|
|
1855
1863
|
case "scalar":
|
|
1856
1864
|
let o = n.kind == "enum" ? u.INT32 : n.T;
|
|
1857
|
-
if (!(n.repeat ?
|
|
1865
|
+
if (!(n.repeat ? et(o, s, a) : pt(o, s, a)))
|
|
1858
1866
|
return !1;
|
|
1859
1867
|
break;
|
|
1860
1868
|
case "map":
|
|
1861
|
-
if (!(n.V.kind == "message" ?
|
|
1869
|
+
if (!(n.V.kind == "message" ? tt(n.V.T(), Ie(s), Ie(a)) : et(n.V.kind == "enum" ? u.INT32 : n.V.T, Ie(s), Ie(a))))
|
|
1862
1870
|
return !1;
|
|
1863
1871
|
break;
|
|
1864
1872
|
case "message":
|
|
1865
1873
|
let l = n.T();
|
|
1866
|
-
if (!(n.repeat ?
|
|
1874
|
+
if (!(n.repeat ? tt(l, s, a) : l.equals(s, a)))
|
|
1867
1875
|
return !1;
|
|
1868
1876
|
break;
|
|
1869
1877
|
}
|
|
1870
1878
|
}
|
|
1871
1879
|
return !0;
|
|
1872
1880
|
}
|
|
1873
|
-
const
|
|
1874
|
-
function
|
|
1881
|
+
const Ie = Object.values;
|
|
1882
|
+
function pt(i, e, t) {
|
|
1875
1883
|
if (e === t)
|
|
1876
1884
|
return !0;
|
|
1877
1885
|
if (i !== u.BYTES)
|
|
@@ -1884,15 +1892,15 @@ function ct(i, e, t) {
|
|
|
1884
1892
|
return !1;
|
|
1885
1893
|
return !0;
|
|
1886
1894
|
}
|
|
1887
|
-
function
|
|
1895
|
+
function et(i, e, t) {
|
|
1888
1896
|
if (e.length !== t.length)
|
|
1889
1897
|
return !1;
|
|
1890
1898
|
for (let n = 0; n < e.length; n++)
|
|
1891
|
-
if (!
|
|
1899
|
+
if (!pt(i, e[n], t[n]))
|
|
1892
1900
|
return !1;
|
|
1893
1901
|
return !0;
|
|
1894
1902
|
}
|
|
1895
|
-
function
|
|
1903
|
+
function tt(i, e, t) {
|
|
1896
1904
|
if (e.length !== t.length)
|
|
1897
1905
|
return !1;
|
|
1898
1906
|
for (let n = 0; n < e.length; n++)
|
|
@@ -1900,14 +1908,14 @@ function Je(i, e, t) {
|
|
|
1900
1908
|
return !1;
|
|
1901
1909
|
return !0;
|
|
1902
1910
|
}
|
|
1903
|
-
const
|
|
1904
|
-
class
|
|
1911
|
+
const sn = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
|
|
1912
|
+
class v {
|
|
1905
1913
|
constructor(e, t, n) {
|
|
1906
|
-
this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(
|
|
1914
|
+
this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(Ht), this.options = n ?? {}, this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, sn), { [mt]: { value: this } })), this.refTypeCheck = new Yt(this), this.refJsonReader = new zt(this), this.refJsonWriter = new Qt(this), this.refBinReader = new en(this), this.refBinWriter = new tn(this);
|
|
1907
1915
|
}
|
|
1908
1916
|
create(e) {
|
|
1909
|
-
let t =
|
|
1910
|
-
return e !== void 0 &&
|
|
1917
|
+
let t = nn(this);
|
|
1918
|
+
return e !== void 0 && _(this, t, e), t;
|
|
1911
1919
|
}
|
|
1912
1920
|
/**
|
|
1913
1921
|
* Clone the message.
|
|
@@ -1916,7 +1924,7 @@ class C {
|
|
|
1916
1924
|
*/
|
|
1917
1925
|
clone(e) {
|
|
1918
1926
|
let t = this.create();
|
|
1919
|
-
return
|
|
1927
|
+
return _(this, t, e), t;
|
|
1920
1928
|
}
|
|
1921
1929
|
/**
|
|
1922
1930
|
* Determines whether two message of the same type have the same field values.
|
|
@@ -1925,7 +1933,7 @@ class C {
|
|
|
1925
1933
|
* Will also return true if both messages are `undefined`.
|
|
1926
1934
|
*/
|
|
1927
1935
|
equals(e, t) {
|
|
1928
|
-
return
|
|
1936
|
+
return rn(this, e, t);
|
|
1929
1937
|
}
|
|
1930
1938
|
/**
|
|
1931
1939
|
* Is the given value assignable to our message type
|
|
@@ -1945,20 +1953,20 @@ class C {
|
|
|
1945
1953
|
* Copy partial data into the target message.
|
|
1946
1954
|
*/
|
|
1947
1955
|
mergePartial(e, t) {
|
|
1948
|
-
|
|
1956
|
+
_(this, e, t);
|
|
1949
1957
|
}
|
|
1950
1958
|
/**
|
|
1951
1959
|
* Create a new message from binary format.
|
|
1952
1960
|
*/
|
|
1953
1961
|
fromBinary(e, t) {
|
|
1954
|
-
let n =
|
|
1962
|
+
let n = vt(t);
|
|
1955
1963
|
return this.internalBinaryRead(n.readerFactory(e), e.byteLength, n);
|
|
1956
1964
|
}
|
|
1957
1965
|
/**
|
|
1958
1966
|
* Read a new message from a JSON value.
|
|
1959
1967
|
*/
|
|
1960
1968
|
fromJson(e, t) {
|
|
1961
|
-
return this.internalJsonRead(e,
|
|
1969
|
+
return this.internalJsonRead(e, Xt(t));
|
|
1962
1970
|
}
|
|
1963
1971
|
/**
|
|
1964
1972
|
* Read a new message from a JSON string.
|
|
@@ -1972,7 +1980,7 @@ class C {
|
|
|
1972
1980
|
* Write the message to canonical JSON value.
|
|
1973
1981
|
*/
|
|
1974
1982
|
toJson(e, t) {
|
|
1975
|
-
return this.internalJsonWrite(e,
|
|
1983
|
+
return this.internalJsonWrite(e, Gt(t));
|
|
1976
1984
|
}
|
|
1977
1985
|
/**
|
|
1978
1986
|
* Convert the message to canonical JSON string.
|
|
@@ -1987,7 +1995,7 @@ class C {
|
|
|
1987
1995
|
* Write the message to binary format.
|
|
1988
1996
|
*/
|
|
1989
1997
|
toBinary(e, t) {
|
|
1990
|
-
let n =
|
|
1998
|
+
let n = qt(t);
|
|
1991
1999
|
return this.internalBinaryWrite(e, n.writerFactory(), n).finish();
|
|
1992
2000
|
}
|
|
1993
2001
|
/**
|
|
@@ -2003,7 +2011,7 @@ class C {
|
|
|
2003
2011
|
let r = n ?? this.create();
|
|
2004
2012
|
return this.refJsonReader.read(e, r, t), r;
|
|
2005
2013
|
}
|
|
2006
|
-
throw new Error(`Unable to parse message ${this.typeName} from JSON ${
|
|
2014
|
+
throw new Error(`Unable to parse message ${this.typeName} from JSON ${ot(e)}.`);
|
|
2007
2015
|
}
|
|
2008
2016
|
/**
|
|
2009
2017
|
* This is an internal method. If you just want to write a message
|
|
@@ -2037,17 +2045,17 @@ class C {
|
|
|
2037
2045
|
return this.refBinReader.read(e, s, n, t), s;
|
|
2038
2046
|
}
|
|
2039
2047
|
}
|
|
2040
|
-
function
|
|
2048
|
+
function an(i, e) {
|
|
2041
2049
|
var t, n, r;
|
|
2042
2050
|
let s = i;
|
|
2043
|
-
return s.service = e, s.localName = (t = s.localName) !== null && t !== void 0 ? t :
|
|
2051
|
+
return s.service = e, s.localName = (t = s.localName) !== null && t !== void 0 ? t : Ve(s.name), s.serverStreaming = !!s.serverStreaming, s.clientStreaming = !!s.clientStreaming, s.options = (n = s.options) !== null && n !== void 0 ? n : {}, s.idempotency = (r = s.idempotency) !== null && r !== void 0 ? r : void 0, s;
|
|
2044
2052
|
}
|
|
2045
|
-
class
|
|
2053
|
+
class We {
|
|
2046
2054
|
constructor(e, t, n) {
|
|
2047
|
-
this.typeName = e, this.methods = t.map((r) =>
|
|
2055
|
+
this.typeName = e, this.methods = t.map((r) => an(r, this)), this.options = n ?? {};
|
|
2048
2056
|
}
|
|
2049
2057
|
}
|
|
2050
|
-
class
|
|
2058
|
+
class E extends Error {
|
|
2051
2059
|
constructor(e, t = "UNKNOWN", n) {
|
|
2052
2060
|
super(e), this.name = "RpcError", Object.setPrototypeOf(this, new.target.prototype), this.code = t, this.meta = n ?? {};
|
|
2053
2061
|
}
|
|
@@ -2064,22 +2072,22 @@ class k extends Error {
|
|
|
2064
2072
|
`);
|
|
2065
2073
|
}
|
|
2066
2074
|
}
|
|
2067
|
-
function
|
|
2075
|
+
function on(i, e) {
|
|
2068
2076
|
if (!e)
|
|
2069
2077
|
return i;
|
|
2070
2078
|
let t = {};
|
|
2071
|
-
|
|
2079
|
+
Te(i, t), Te(e, t);
|
|
2072
2080
|
for (let n of Object.keys(e)) {
|
|
2073
2081
|
let r = e[n];
|
|
2074
2082
|
switch (n) {
|
|
2075
2083
|
case "jsonOptions":
|
|
2076
|
-
t.jsonOptions =
|
|
2084
|
+
t.jsonOptions = Jt(i.jsonOptions, t.jsonOptions);
|
|
2077
2085
|
break;
|
|
2078
2086
|
case "binaryOptions":
|
|
2079
|
-
t.binaryOptions =
|
|
2087
|
+
t.binaryOptions = _t(i.binaryOptions, t.binaryOptions);
|
|
2080
2088
|
break;
|
|
2081
2089
|
case "meta":
|
|
2082
|
-
t.meta = {},
|
|
2090
|
+
t.meta = {}, Te(i.meta, t.meta), Te(e.meta, t.meta);
|
|
2083
2091
|
break;
|
|
2084
2092
|
case "interceptors":
|
|
2085
2093
|
t.interceptors = i.interceptors ? i.interceptors.concat(r) : r.concat();
|
|
@@ -2088,18 +2096,18 @@ function Yt(i, e) {
|
|
|
2088
2096
|
}
|
|
2089
2097
|
return t;
|
|
2090
2098
|
}
|
|
2091
|
-
function
|
|
2099
|
+
function Te(i, e) {
|
|
2092
2100
|
if (!i)
|
|
2093
2101
|
return;
|
|
2094
2102
|
let t = e;
|
|
2095
2103
|
for (let [n, r] of Object.entries(i))
|
|
2096
2104
|
r instanceof Date ? t[n] = new Date(r.getTime()) : Array.isArray(r) ? t[n] = r.concat() : t[n] = r;
|
|
2097
2105
|
}
|
|
2098
|
-
var
|
|
2106
|
+
var M;
|
|
2099
2107
|
(function(i) {
|
|
2100
2108
|
i[i.PENDING = 0] = "PENDING", i[i.REJECTED = 1] = "REJECTED", i[i.RESOLVED = 2] = "RESOLVED";
|
|
2101
|
-
})(
|
|
2102
|
-
class
|
|
2109
|
+
})(M || (M = {}));
|
|
2110
|
+
class ne {
|
|
2103
2111
|
/**
|
|
2104
2112
|
* @param preventUnhandledRejectionWarning - prevents the warning
|
|
2105
2113
|
* "Unhandled Promise rejection" by adding a noop rejection handler.
|
|
@@ -2113,7 +2121,7 @@ class z {
|
|
|
2113
2121
|
* others.
|
|
2114
2122
|
*/
|
|
2115
2123
|
constructor(e = !0) {
|
|
2116
|
-
this._state =
|
|
2124
|
+
this._state = M.PENDING, this._promise = new Promise((t, n) => {
|
|
2117
2125
|
this._resolve = t, this._reject = n;
|
|
2118
2126
|
}), e && this._promise.catch((t) => {
|
|
2119
2127
|
});
|
|
@@ -2134,32 +2142,32 @@ class z {
|
|
|
2134
2142
|
* Resolve the promise. Throws if the promise is already resolved or rejected.
|
|
2135
2143
|
*/
|
|
2136
2144
|
resolve(e) {
|
|
2137
|
-
if (this.state !==
|
|
2138
|
-
throw new Error(`cannot resolve ${
|
|
2139
|
-
this._resolve(e), this._state =
|
|
2145
|
+
if (this.state !== M.PENDING)
|
|
2146
|
+
throw new Error(`cannot resolve ${M[this.state].toLowerCase()}`);
|
|
2147
|
+
this._resolve(e), this._state = M.RESOLVED;
|
|
2140
2148
|
}
|
|
2141
2149
|
/**
|
|
2142
2150
|
* Reject the promise. Throws if the promise is already resolved or rejected.
|
|
2143
2151
|
*/
|
|
2144
2152
|
reject(e) {
|
|
2145
|
-
if (this.state !==
|
|
2146
|
-
throw new Error(`cannot reject ${
|
|
2147
|
-
this._reject(e), this._state =
|
|
2153
|
+
if (this.state !== M.PENDING)
|
|
2154
|
+
throw new Error(`cannot reject ${M[this.state].toLowerCase()}`);
|
|
2155
|
+
this._reject(e), this._state = M.REJECTED;
|
|
2148
2156
|
}
|
|
2149
2157
|
/**
|
|
2150
2158
|
* Resolve the promise. Ignore if not pending.
|
|
2151
2159
|
*/
|
|
2152
2160
|
resolvePending(e) {
|
|
2153
|
-
this._state ===
|
|
2161
|
+
this._state === M.PENDING && this.resolve(e);
|
|
2154
2162
|
}
|
|
2155
2163
|
/**
|
|
2156
2164
|
* Reject the promise. Ignore if not pending.
|
|
2157
2165
|
*/
|
|
2158
2166
|
rejectPending(e) {
|
|
2159
|
-
this._state ===
|
|
2167
|
+
this._state === M.PENDING && this.reject(e);
|
|
2160
2168
|
}
|
|
2161
2169
|
}
|
|
2162
|
-
class
|
|
2170
|
+
class ln {
|
|
2163
2171
|
constructor() {
|
|
2164
2172
|
this._lis = {
|
|
2165
2173
|
nxt: [],
|
|
@@ -2250,7 +2258,7 @@ class zt {
|
|
|
2250
2258
|
let e = this._itState;
|
|
2251
2259
|
b(e, "bad state"), b(!e.p, "iterator contract broken");
|
|
2252
2260
|
let t = e.q.shift();
|
|
2253
|
-
return t ? "value" in t ? Promise.resolve(t) : Promise.reject(t) : (e.p = new
|
|
2261
|
+
return t ? "value" in t ? Promise.resolve(t) : Promise.reject(t) : (e.p = new ne(), e.p.promise);
|
|
2254
2262
|
}
|
|
2255
2263
|
};
|
|
2256
2264
|
}
|
|
@@ -2261,12 +2269,12 @@ class zt {
|
|
|
2261
2269
|
if (t)
|
|
2262
2270
|
if (t.p) {
|
|
2263
2271
|
const n = t.p;
|
|
2264
|
-
b(n.state ==
|
|
2272
|
+
b(n.state == M.PENDING, "iterator contract broken"), "value" in e ? n.resolve(e) : n.reject(e), delete t.p;
|
|
2265
2273
|
} else
|
|
2266
2274
|
t.q.push(e);
|
|
2267
2275
|
}
|
|
2268
2276
|
}
|
|
2269
|
-
var
|
|
2277
|
+
var cn = function(i, e, t, n) {
|
|
2270
2278
|
function r(s) {
|
|
2271
2279
|
return s instanceof t ? s : new t(function(a) {
|
|
2272
2280
|
a(s);
|
|
@@ -2293,7 +2301,7 @@ var Qt = function(i, e, t, n) {
|
|
|
2293
2301
|
c((n = n.apply(i, e || [])).next());
|
|
2294
2302
|
});
|
|
2295
2303
|
};
|
|
2296
|
-
class
|
|
2304
|
+
class un {
|
|
2297
2305
|
constructor(e, t, n, r, s, a, o) {
|
|
2298
2306
|
this.method = e, this.requestHeaders = t, this.request = n, this.headers = r, this.response = s, this.status = a, this.trailers = o;
|
|
2299
2307
|
}
|
|
@@ -2305,7 +2313,7 @@ class en {
|
|
|
2305
2313
|
return this.promiseFinished().then((n) => e ? Promise.resolve(e(n)) : n, (n) => t ? Promise.resolve(t(n)) : Promise.reject(n));
|
|
2306
2314
|
}
|
|
2307
2315
|
promiseFinished() {
|
|
2308
|
-
return
|
|
2316
|
+
return cn(this, void 0, void 0, function* () {
|
|
2309
2317
|
let [e, t, n, r] = yield Promise.all([this.headers, this.response, this.status, this.trailers]);
|
|
2310
2318
|
return {
|
|
2311
2319
|
method: this.method,
|
|
@@ -2319,7 +2327,7 @@ class en {
|
|
|
2319
2327
|
});
|
|
2320
2328
|
}
|
|
2321
2329
|
}
|
|
2322
|
-
var
|
|
2330
|
+
var hn = function(i, e, t, n) {
|
|
2323
2331
|
function r(s) {
|
|
2324
2332
|
return s instanceof t ? s : new t(function(a) {
|
|
2325
2333
|
a(s);
|
|
@@ -2346,7 +2354,7 @@ var tn = function(i, e, t, n) {
|
|
|
2346
2354
|
c((n = n.apply(i, e || [])).next());
|
|
2347
2355
|
});
|
|
2348
2356
|
};
|
|
2349
|
-
class
|
|
2357
|
+
class dn {
|
|
2350
2358
|
constructor(e, t, n, r, s, a, o) {
|
|
2351
2359
|
this.method = e, this.requestHeaders = t, this.request = n, this.headers = r, this.responses = s, this.status = a, this.trailers = o;
|
|
2352
2360
|
}
|
|
@@ -2360,7 +2368,7 @@ class nn {
|
|
|
2360
2368
|
return this.promiseFinished().then((n) => e ? Promise.resolve(e(n)) : n, (n) => t ? Promise.resolve(t(n)) : Promise.reject(n));
|
|
2361
2369
|
}
|
|
2362
2370
|
promiseFinished() {
|
|
2363
|
-
return
|
|
2371
|
+
return hn(this, void 0, void 0, function* () {
|
|
2364
2372
|
let [e, t, n] = yield Promise.all([this.headers, this.status, this.trailers]);
|
|
2365
2373
|
return {
|
|
2366
2374
|
method: this.method,
|
|
@@ -2373,7 +2381,7 @@ class nn {
|
|
|
2373
2381
|
});
|
|
2374
2382
|
}
|
|
2375
2383
|
}
|
|
2376
|
-
function
|
|
2384
|
+
function se(i, e, t, n, r) {
|
|
2377
2385
|
var s;
|
|
2378
2386
|
{
|
|
2379
2387
|
let a = (o, l, c) => e.unary(o, l, c);
|
|
@@ -2388,7 +2396,7 @@ var f;
|
|
|
2388
2396
|
(function(i) {
|
|
2389
2397
|
i[i.OK = 0] = "OK", i[i.CANCELLED = 1] = "CANCELLED", i[i.UNKNOWN = 2] = "UNKNOWN", i[i.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", i[i.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", i[i.NOT_FOUND = 5] = "NOT_FOUND", i[i.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", i[i.PERMISSION_DENIED = 7] = "PERMISSION_DENIED", i[i.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", i[i.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED", i[i.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", i[i.ABORTED = 10] = "ABORTED", i[i.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", i[i.UNIMPLEMENTED = 12] = "UNIMPLEMENTED", i[i.INTERNAL = 13] = "INTERNAL", i[i.UNAVAILABLE = 14] = "UNAVAILABLE", i[i.DATA_LOSS = 15] = "DATA_LOSS";
|
|
2390
2398
|
})(f || (f = {}));
|
|
2391
|
-
var
|
|
2399
|
+
var fn = function(i, e, t, n) {
|
|
2392
2400
|
function r(s) {
|
|
2393
2401
|
return s instanceof t ? s : new t(function(a) {
|
|
2394
2402
|
a(s);
|
|
@@ -2415,7 +2423,7 @@ var rn = function(i, e, t, n) {
|
|
|
2415
2423
|
c((n = n.apply(i, e || [])).next());
|
|
2416
2424
|
});
|
|
2417
2425
|
};
|
|
2418
|
-
function
|
|
2426
|
+
function nt(i, e, t, n, r) {
|
|
2419
2427
|
if (n)
|
|
2420
2428
|
for (let [s, a] of Object.entries(n))
|
|
2421
2429
|
if (typeof a == "string")
|
|
@@ -2425,24 +2433,24 @@ function He(i, e, t, n, r) {
|
|
|
2425
2433
|
i.append(s, o);
|
|
2426
2434
|
if (i.set("Content-Type", e === "text" ? "application/grpc-web-text" : "application/grpc-web+proto"), e == "text" && i.set("Accept", "application/grpc-web-text"), i.set("X-Grpc-Web", "1"), typeof t == "number") {
|
|
2427
2435
|
if (t <= 0)
|
|
2428
|
-
throw new
|
|
2436
|
+
throw new E(`timeout ${t} ms exceeded`, f[f.DEADLINE_EXCEEDED]);
|
|
2429
2437
|
i.set("grpc-timeout", `${t}m`);
|
|
2430
2438
|
} else if (t) {
|
|
2431
2439
|
const s = t.getTime(), a = Date.now();
|
|
2432
2440
|
if (s <= a)
|
|
2433
|
-
throw new
|
|
2441
|
+
throw new E(`deadline ${t} exceeded`, f[f.DEADLINE_EXCEEDED]);
|
|
2434
2442
|
i.set("grpc-timeout", `${s - a}m`);
|
|
2435
2443
|
}
|
|
2436
2444
|
return i;
|
|
2437
2445
|
}
|
|
2438
|
-
function
|
|
2446
|
+
function it(i, e) {
|
|
2439
2447
|
let t = new Uint8Array(5 + i.length);
|
|
2440
|
-
t[0] =
|
|
2448
|
+
t[0] = X.DATA;
|
|
2441
2449
|
for (let n = i.length, r = 4; r > 0; r--)
|
|
2442
2450
|
t[r] = n % 256, n >>>= 8;
|
|
2443
|
-
return t.set(i, 5), e === "binary" ? t :
|
|
2451
|
+
return t.set(i, 5), e === "binary" ? t : ct(t);
|
|
2444
2452
|
}
|
|
2445
|
-
function
|
|
2453
|
+
function je(i, e, t) {
|
|
2446
2454
|
if (arguments.length === 1) {
|
|
2447
2455
|
let l = i, c;
|
|
2448
2456
|
try {
|
|
@@ -2453,25 +2461,25 @@ function _e(i, e, t) {
|
|
|
2453
2461
|
case "error":
|
|
2454
2462
|
case "opaque":
|
|
2455
2463
|
case "opaqueredirect":
|
|
2456
|
-
throw new
|
|
2464
|
+
throw new E(`fetch response type ${l.type}`, f[f.UNKNOWN]);
|
|
2457
2465
|
}
|
|
2458
|
-
return
|
|
2466
|
+
return je(bn(l.headers), l.status, l.statusText);
|
|
2459
2467
|
}
|
|
2460
|
-
let n = i, r = e >= 200 && e < 300, s =
|
|
2461
|
-
return (a === void 0 || a === f.OK) && !r && (a =
|
|
2468
|
+
let n = i, r = e >= 200 && e < 300, s = bt(n), [a, o] = gt(n);
|
|
2469
|
+
return (a === void 0 || a === f.OK) && !r && (a = wn(e), o = t), [a, o, s];
|
|
2462
2470
|
}
|
|
2463
|
-
function
|
|
2464
|
-
let e =
|
|
2471
|
+
function rt(i) {
|
|
2472
|
+
let e = gn(i), [t, n] = gt(e), r = bt(e);
|
|
2465
2473
|
return [t ?? f.OK, n, r];
|
|
2466
2474
|
}
|
|
2467
|
-
var
|
|
2475
|
+
var X;
|
|
2468
2476
|
(function(i) {
|
|
2469
2477
|
i[i.DATA = 0] = "DATA", i[i.TRAILER = 128] = "TRAILER";
|
|
2470
|
-
})(
|
|
2471
|
-
function
|
|
2472
|
-
return
|
|
2473
|
-
let n, r = "", s = new Uint8Array(0), a =
|
|
2474
|
-
if (
|
|
2478
|
+
})(X || (X = {}));
|
|
2479
|
+
function st(i, e, t) {
|
|
2480
|
+
return fn(this, void 0, void 0, function* () {
|
|
2481
|
+
let n, r = "", s = new Uint8Array(0), a = pn(e);
|
|
2482
|
+
if (mn(i)) {
|
|
2475
2483
|
let o = i.getReader();
|
|
2476
2484
|
n = {
|
|
2477
2485
|
next: () => o.read()
|
|
@@ -2487,15 +2495,15 @@ function ze(i, e, t) {
|
|
|
2487
2495
|
let l = r.length - r.length % 4;
|
|
2488
2496
|
if (l === 0)
|
|
2489
2497
|
continue;
|
|
2490
|
-
s =
|
|
2498
|
+
s = at(s, lt(r.substring(0, l))), r = r.substring(l);
|
|
2491
2499
|
} else
|
|
2492
|
-
s =
|
|
2493
|
-
for (; s.length >= 5 && s[0] ===
|
|
2500
|
+
s = at(s, o.value);
|
|
2501
|
+
for (; s.length >= 5 && s[0] === X.DATA; ) {
|
|
2494
2502
|
let l = 0;
|
|
2495
2503
|
for (let c = 1; c < 5; c++)
|
|
2496
2504
|
l = (l << 8) + s[c];
|
|
2497
2505
|
if (s.length - 5 >= l)
|
|
2498
|
-
t(
|
|
2506
|
+
t(X.DATA, s.subarray(5, 5 + l)), s = s.subarray(5 + l);
|
|
2499
2507
|
else
|
|
2500
2508
|
break;
|
|
2501
2509
|
}
|
|
@@ -2503,20 +2511,20 @@ function ze(i, e, t) {
|
|
|
2503
2511
|
if (o.done) {
|
|
2504
2512
|
if (s.length === 0)
|
|
2505
2513
|
break;
|
|
2506
|
-
if (s[0] !==
|
|
2507
|
-
throw new
|
|
2508
|
-
t(
|
|
2514
|
+
if (s[0] !== X.TRAILER || s.length < 5)
|
|
2515
|
+
throw new E("premature EOF", f[f.DATA_LOSS]);
|
|
2516
|
+
t(X.TRAILER, s.subarray(5));
|
|
2509
2517
|
break;
|
|
2510
2518
|
}
|
|
2511
2519
|
}
|
|
2512
2520
|
});
|
|
2513
2521
|
}
|
|
2514
|
-
const
|
|
2515
|
-
function
|
|
2522
|
+
const mn = (i) => typeof i.getReader == "function";
|
|
2523
|
+
function at(i, e) {
|
|
2516
2524
|
let t = new Uint8Array(i.length + e.length);
|
|
2517
2525
|
return t.set(i), t.set(e, i.length), t;
|
|
2518
2526
|
}
|
|
2519
|
-
function
|
|
2527
|
+
function pn(i) {
|
|
2520
2528
|
switch (i) {
|
|
2521
2529
|
case "application/grpc-web-text":
|
|
2522
2530
|
case "application/grpc-web-text+proto":
|
|
@@ -2526,12 +2534,12 @@ function an(i) {
|
|
|
2526
2534
|
return "binary";
|
|
2527
2535
|
case void 0:
|
|
2528
2536
|
case null:
|
|
2529
|
-
throw new
|
|
2537
|
+
throw new E("missing response content type", f[f.INTERNAL]);
|
|
2530
2538
|
default:
|
|
2531
|
-
throw new
|
|
2539
|
+
throw new E("unexpected response content type: " + i, f[f.INTERNAL]);
|
|
2532
2540
|
}
|
|
2533
2541
|
}
|
|
2534
|
-
function
|
|
2542
|
+
function gt(i) {
|
|
2535
2543
|
let e, t, n = i["grpc-message"];
|
|
2536
2544
|
if (n !== void 0) {
|
|
2537
2545
|
if (Array.isArray(n))
|
|
@@ -2547,7 +2555,7 @@ function ut(i) {
|
|
|
2547
2555
|
}
|
|
2548
2556
|
return [e, t];
|
|
2549
2557
|
}
|
|
2550
|
-
function
|
|
2558
|
+
function bt(i) {
|
|
2551
2559
|
let e = {};
|
|
2552
2560
|
for (let [t, n] of Object.entries(i))
|
|
2553
2561
|
switch (t) {
|
|
@@ -2560,7 +2568,7 @@ function ht(i) {
|
|
|
2560
2568
|
}
|
|
2561
2569
|
return e;
|
|
2562
2570
|
}
|
|
2563
|
-
function
|
|
2571
|
+
function gn(i) {
|
|
2564
2572
|
let e = {};
|
|
2565
2573
|
for (let t of String.fromCharCode.apply(String, i).trim().split(`\r
|
|
2566
2574
|
`)) {
|
|
@@ -2574,14 +2582,14 @@ function on(i) {
|
|
|
2574
2582
|
}
|
|
2575
2583
|
return e;
|
|
2576
2584
|
}
|
|
2577
|
-
function
|
|
2585
|
+
function bn(i) {
|
|
2578
2586
|
let e = {};
|
|
2579
2587
|
return i.forEach((t, n) => {
|
|
2580
2588
|
let r = e[n];
|
|
2581
2589
|
typeof r == "string" ? e[n] = [r, t] : Array.isArray(r) ? r.push(t) : e[n] = t;
|
|
2582
2590
|
}), e;
|
|
2583
2591
|
}
|
|
2584
|
-
function
|
|
2592
|
+
function wn(i) {
|
|
2585
2593
|
switch (i) {
|
|
2586
2594
|
case 200:
|
|
2587
2595
|
return f.OK;
|
|
@@ -2613,12 +2621,12 @@ function cn(i) {
|
|
|
2613
2621
|
return f.UNKNOWN;
|
|
2614
2622
|
}
|
|
2615
2623
|
}
|
|
2616
|
-
class
|
|
2624
|
+
class yn {
|
|
2617
2625
|
constructor(e) {
|
|
2618
2626
|
this.defaultOptions = e;
|
|
2619
2627
|
}
|
|
2620
2628
|
mergeOptions(e) {
|
|
2621
|
-
return
|
|
2629
|
+
return on(this.defaultOptions, e);
|
|
2622
2630
|
}
|
|
2623
2631
|
/**
|
|
2624
2632
|
* Create an URI for a gRPC web call.
|
|
@@ -2641,115 +2649,115 @@ class un {
|
|
|
2641
2649
|
return n.endsWith("/") && (n = n.substring(0, n.length - 1)), `${n}/${e.service.typeName}/${e.name}`;
|
|
2642
2650
|
}
|
|
2643
2651
|
clientStreaming(e) {
|
|
2644
|
-
const t = new
|
|
2652
|
+
const t = new E("Client streaming is not supported by grpc-web", f[f.UNIMPLEMENTED]);
|
|
2645
2653
|
throw t.methodName = e.name, t.serviceName = e.service.typeName, t;
|
|
2646
2654
|
}
|
|
2647
2655
|
duplex(e) {
|
|
2648
|
-
const t = new
|
|
2656
|
+
const t = new E("Duplex streaming is not supported by grpc-web", f[f.UNIMPLEMENTED]);
|
|
2649
2657
|
throw t.methodName = e.name, t.serviceName = e.service.typeName, t;
|
|
2650
2658
|
}
|
|
2651
2659
|
serverStreaming(e, t, n) {
|
|
2652
2660
|
var r, s, a, o;
|
|
2653
|
-
let l = n, c = (r = l.format) !== null && r !== void 0 ? r : "text", h = (s = l.fetchInit) !== null && s !== void 0 ? s : {}, p = this.makeUrl(e, l),
|
|
2661
|
+
let l = n, c = (r = l.format) !== null && r !== void 0 ? r : "text", h = (s = l.fetchInit) !== null && s !== void 0 ? s : {}, p = this.makeUrl(e, l), y = e.I.toBinary(t, l.binaryOptions), A = new ne(), F = new ln(), ee = !0, O, $ = new ne(), G, ae = new ne();
|
|
2654
2662
|
return globalThis.fetch(p, Object.assign(Object.assign({}, h), {
|
|
2655
2663
|
method: "POST",
|
|
2656
|
-
headers:
|
|
2657
|
-
body:
|
|
2664
|
+
headers: nt(new globalThis.Headers(), c, l.timeout, l.meta),
|
|
2665
|
+
body: it(y, c),
|
|
2658
2666
|
signal: (a = n.abort) !== null && a !== void 0 ? a : null
|
|
2659
2667
|
// node-fetch@3.0.0-beta.9 rejects `undefined`
|
|
2660
|
-
})).then((
|
|
2661
|
-
let [g,
|
|
2662
|
-
if (
|
|
2663
|
-
throw new
|
|
2668
|
+
})).then((N) => {
|
|
2669
|
+
let [g, D, S] = je(N);
|
|
2670
|
+
if (A.resolve(S), g != null && g !== f.OK)
|
|
2671
|
+
throw new E(D ?? f[g], f[g], S);
|
|
2664
2672
|
return g != null && (O = {
|
|
2665
2673
|
code: f[g],
|
|
2666
|
-
detail:
|
|
2667
|
-
}),
|
|
2668
|
-
}).then((
|
|
2669
|
-
if (!
|
|
2670
|
-
throw new
|
|
2671
|
-
return
|
|
2674
|
+
detail: D ?? f[g]
|
|
2675
|
+
}), N;
|
|
2676
|
+
}).then((N) => {
|
|
2677
|
+
if (!N.body)
|
|
2678
|
+
throw new E("missing response body", f[f.INTERNAL]);
|
|
2679
|
+
return st(N.body, N.headers.get("content-type"), (g, D) => {
|
|
2672
2680
|
switch (g) {
|
|
2673
|
-
case
|
|
2674
|
-
F.notifyMessage(e.O.fromBinary(
|
|
2681
|
+
case X.DATA:
|
|
2682
|
+
F.notifyMessage(e.O.fromBinary(D, l.binaryOptions)), ee = !1;
|
|
2675
2683
|
break;
|
|
2676
|
-
case
|
|
2677
|
-
let
|
|
2678
|
-
[
|
|
2679
|
-
code: f[
|
|
2680
|
-
detail:
|
|
2684
|
+
case X.TRAILER:
|
|
2685
|
+
let S, Z;
|
|
2686
|
+
[S, Z, G] = rt(D), O = {
|
|
2687
|
+
code: f[S],
|
|
2688
|
+
detail: Z ?? f[S]
|
|
2681
2689
|
};
|
|
2682
2690
|
break;
|
|
2683
2691
|
}
|
|
2684
2692
|
});
|
|
2685
2693
|
}).then(() => {
|
|
2686
|
-
if (!
|
|
2687
|
-
throw new
|
|
2694
|
+
if (!G && !ee)
|
|
2695
|
+
throw new E("missing trailers", f[f.DATA_LOSS]);
|
|
2688
2696
|
if (!O)
|
|
2689
|
-
throw new
|
|
2697
|
+
throw new E("missing status", f[f.INTERNAL]);
|
|
2690
2698
|
if (O.code !== "OK")
|
|
2691
|
-
throw new
|
|
2692
|
-
F.notifyComplete(),
|
|
2693
|
-
}).catch((
|
|
2699
|
+
throw new E(O.detail, O.code, G);
|
|
2700
|
+
F.notifyComplete(), $.resolve(O), ae.resolve(G || {});
|
|
2701
|
+
}).catch((N) => {
|
|
2694
2702
|
let g;
|
|
2695
|
-
|
|
2696
|
-
}), new
|
|
2703
|
+
N instanceof E ? g = N : N instanceof Error && N.name === "AbortError" ? g = new E(N.message, f[f.CANCELLED]) : g = new E(N instanceof Error ? N.message : "" + N, f[f.INTERNAL]), g.methodName = e.name, g.serviceName = e.service.typeName, A.rejectPending(g), F.notifyError(g), $.rejectPending(g), ae.rejectPending(g);
|
|
2704
|
+
}), new dn(e, (o = l.meta) !== null && o !== void 0 ? o : {}, t, A.promise, F, $.promise, ae.promise);
|
|
2697
2705
|
}
|
|
2698
2706
|
unary(e, t, n) {
|
|
2699
2707
|
var r, s, a, o;
|
|
2700
|
-
let l = n, c = (r = l.format) !== null && r !== void 0 ? r : "text", h = (s = l.fetchInit) !== null && s !== void 0 ? s : {}, p = this.makeUrl(e, l),
|
|
2708
|
+
let l = n, c = (r = l.format) !== null && r !== void 0 ? r : "text", h = (s = l.fetchInit) !== null && s !== void 0 ? s : {}, p = this.makeUrl(e, l), y = e.I.toBinary(t, l.binaryOptions), A = new ne(), F, ee = new ne(), O, $ = new ne(), G, ae = new ne();
|
|
2701
2709
|
return globalThis.fetch(p, Object.assign(Object.assign({}, h), {
|
|
2702
2710
|
method: "POST",
|
|
2703
|
-
headers:
|
|
2704
|
-
body:
|
|
2711
|
+
headers: nt(new globalThis.Headers(), c, l.timeout, l.meta),
|
|
2712
|
+
body: it(y, c),
|
|
2705
2713
|
signal: (a = n.abort) !== null && a !== void 0 ? a : null
|
|
2706
2714
|
// node-fetch@3.0.0-beta.9 rejects `undefined`
|
|
2707
|
-
})).then((
|
|
2708
|
-
let [g,
|
|
2709
|
-
if (
|
|
2710
|
-
throw new
|
|
2715
|
+
})).then((N) => {
|
|
2716
|
+
let [g, D, S] = je(N);
|
|
2717
|
+
if (A.resolve(S), g != null && g !== f.OK)
|
|
2718
|
+
throw new E(D ?? f[g], f[g], S);
|
|
2711
2719
|
return g != null && (O = {
|
|
2712
2720
|
code: f[g],
|
|
2713
|
-
detail:
|
|
2714
|
-
}),
|
|
2715
|
-
}).then((
|
|
2716
|
-
if (!
|
|
2717
|
-
throw new
|
|
2718
|
-
return
|
|
2721
|
+
detail: D ?? f[g]
|
|
2722
|
+
}), N;
|
|
2723
|
+
}).then((N) => {
|
|
2724
|
+
if (!N.body)
|
|
2725
|
+
throw new E("missing response body", f[f.INTERNAL]);
|
|
2726
|
+
return st(N.body, N.headers.get("content-type"), (g, D) => {
|
|
2719
2727
|
switch (g) {
|
|
2720
|
-
case
|
|
2728
|
+
case X.DATA:
|
|
2721
2729
|
if (F)
|
|
2722
|
-
throw new
|
|
2723
|
-
F = e.O.fromBinary(
|
|
2730
|
+
throw new E("unary call received 2nd message", f[f.DATA_LOSS]);
|
|
2731
|
+
F = e.O.fromBinary(D, l.binaryOptions);
|
|
2724
2732
|
break;
|
|
2725
|
-
case
|
|
2726
|
-
let
|
|
2727
|
-
[
|
|
2728
|
-
code: f[
|
|
2729
|
-
detail:
|
|
2733
|
+
case X.TRAILER:
|
|
2734
|
+
let S, Z;
|
|
2735
|
+
[S, Z, G] = rt(D), O = {
|
|
2736
|
+
code: f[S],
|
|
2737
|
+
detail: Z ?? f[S]
|
|
2730
2738
|
};
|
|
2731
2739
|
break;
|
|
2732
2740
|
}
|
|
2733
2741
|
});
|
|
2734
2742
|
}).then(() => {
|
|
2735
|
-
if (!
|
|
2736
|
-
throw new
|
|
2743
|
+
if (!G && F)
|
|
2744
|
+
throw new E("missing trailers", f[f.DATA_LOSS]);
|
|
2737
2745
|
if (!O)
|
|
2738
|
-
throw new
|
|
2746
|
+
throw new E("missing status", f[f.INTERNAL]);
|
|
2739
2747
|
if (!F && O.code === "OK")
|
|
2740
|
-
throw new
|
|
2748
|
+
throw new E("expected error status", f[f.DATA_LOSS]);
|
|
2741
2749
|
if (!F)
|
|
2742
|
-
throw new
|
|
2743
|
-
if (
|
|
2744
|
-
throw new
|
|
2745
|
-
|
|
2746
|
-
}).catch((
|
|
2750
|
+
throw new E(O.detail, O.code, G);
|
|
2751
|
+
if (ee.resolve(F), O.code !== "OK")
|
|
2752
|
+
throw new E(O.detail, O.code, G);
|
|
2753
|
+
$.resolve(O), ae.resolve(G || {});
|
|
2754
|
+
}).catch((N) => {
|
|
2747
2755
|
let g;
|
|
2748
|
-
|
|
2749
|
-
}), new
|
|
2756
|
+
N instanceof E ? g = N : N instanceof Error && N.name === "AbortError" ? g = new E(N.message, f[f.CANCELLED]) : g = new E(N instanceof Error ? N.message : "" + N, f[f.INTERNAL]), g.methodName = e.name, g.serviceName = e.service.typeName, A.rejectPending(g), ee.rejectPending(g), $.rejectPending(g), ae.rejectPending(g);
|
|
2757
|
+
}), new un(e, (o = l.meta) !== null && o !== void 0 ? o : {}, t, A.promise, ee.promise, $.promise, ae.promise);
|
|
2750
2758
|
}
|
|
2751
2759
|
}
|
|
2752
|
-
class
|
|
2760
|
+
class Nn extends v {
|
|
2753
2761
|
constructor() {
|
|
2754
2762
|
super("com.hamropatro.grpc.cms.CreateFolderRequest", [
|
|
2755
2763
|
{
|
|
@@ -2777,7 +2785,7 @@ class hn extends C {
|
|
|
2777
2785
|
}
|
|
2778
2786
|
create(e) {
|
|
2779
2787
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2780
|
-
return t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 &&
|
|
2788
|
+
return t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 && _(this, t, e), t;
|
|
2781
2789
|
}
|
|
2782
2790
|
internalBinaryRead(e, t, n, r) {
|
|
2783
2791
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -2801,7 +2809,7 @@ class hn extends C {
|
|
|
2801
2809
|
if (c === "throw")
|
|
2802
2810
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
2803
2811
|
let h = e.skip(l);
|
|
2804
|
-
c !== !1 && (c === !0 ?
|
|
2812
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
2805
2813
|
}
|
|
2806
2814
|
}
|
|
2807
2815
|
return s;
|
|
@@ -2809,11 +2817,11 @@ class hn extends C {
|
|
|
2809
2817
|
internalBinaryWrite(e, t, n) {
|
|
2810
2818
|
e.name !== "" && t.tag(1, m.LengthDelimited).string(e.name), e.nestedFolderName !== "" && t.tag(2, m.LengthDelimited).string(e.nestedFolderName), e.createdBy !== "" && t.tag(3, m.LengthDelimited).string(e.createdBy);
|
|
2811
2819
|
let r = n.writeUnknownFields;
|
|
2812
|
-
return r !== !1 && (r == !0 ?
|
|
2820
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
2813
2821
|
}
|
|
2814
2822
|
}
|
|
2815
|
-
const
|
|
2816
|
-
class
|
|
2823
|
+
const wt = new Nn();
|
|
2824
|
+
class kn extends v {
|
|
2817
2825
|
constructor() {
|
|
2818
2826
|
super("com.hamropatro.grpc.cms.GetAllFoldersRequest", [
|
|
2819
2827
|
{
|
|
@@ -2834,7 +2842,7 @@ class fn extends C {
|
|
|
2834
2842
|
}
|
|
2835
2843
|
create(e) {
|
|
2836
2844
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2837
|
-
return t.cursor = "", t.limit = 0, e !== void 0 &&
|
|
2845
|
+
return t.cursor = "", t.limit = 0, e !== void 0 && _(this, t, e), t;
|
|
2838
2846
|
}
|
|
2839
2847
|
internalBinaryRead(e, t, n, r) {
|
|
2840
2848
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -2854,7 +2862,7 @@ class fn extends C {
|
|
|
2854
2862
|
if (c === "throw")
|
|
2855
2863
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
2856
2864
|
let h = e.skip(l);
|
|
2857
|
-
c !== !1 && (c === !0 ?
|
|
2865
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
2858
2866
|
}
|
|
2859
2867
|
}
|
|
2860
2868
|
return s;
|
|
@@ -2862,14 +2870,14 @@ class fn extends C {
|
|
|
2862
2870
|
internalBinaryWrite(e, t, n) {
|
|
2863
2871
|
e.cursor !== "" && t.tag(1, m.LengthDelimited).string(e.cursor), e.limit !== 0 && t.tag(2, m.Varint).int32(e.limit);
|
|
2864
2872
|
let r = n.writeUnknownFields;
|
|
2865
|
-
return r !== !1 && (r == !0 ?
|
|
2873
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
2866
2874
|
}
|
|
2867
2875
|
}
|
|
2868
|
-
const
|
|
2869
|
-
class
|
|
2876
|
+
const En = new kn();
|
|
2877
|
+
class In extends v {
|
|
2870
2878
|
constructor() {
|
|
2871
2879
|
super("com.hamropatro.grpc.cms.GetAllFoldersResponse", [
|
|
2872
|
-
{ no: 1, name: "folder", kind: "message", repeat: 1, T: () =>
|
|
2880
|
+
{ no: 1, name: "folder", kind: "message", repeat: 1, T: () => fe },
|
|
2873
2881
|
{
|
|
2874
2882
|
no: 2,
|
|
2875
2883
|
name: "next_cursor",
|
|
@@ -2888,7 +2896,7 @@ class mn extends C {
|
|
|
2888
2896
|
}
|
|
2889
2897
|
create(e) {
|
|
2890
2898
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2891
|
-
return t.folder = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 &&
|
|
2899
|
+
return t.folder = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 && _(this, t, e), t;
|
|
2892
2900
|
}
|
|
2893
2901
|
internalBinaryRead(e, t, n, r) {
|
|
2894
2902
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -2897,7 +2905,7 @@ class mn extends C {
|
|
|
2897
2905
|
switch (o) {
|
|
2898
2906
|
case /* repeated com.hamropatro.grpc.cms.Folder folder */
|
|
2899
2907
|
1:
|
|
2900
|
-
s.folder.push(
|
|
2908
|
+
s.folder.push(fe.internalBinaryRead(e, e.uint32(), n));
|
|
2901
2909
|
break;
|
|
2902
2910
|
case /* string next_cursor */
|
|
2903
2911
|
2:
|
|
@@ -2912,21 +2920,21 @@ class mn extends C {
|
|
|
2912
2920
|
if (c === "throw")
|
|
2913
2921
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
2914
2922
|
let h = e.skip(l);
|
|
2915
|
-
c !== !1 && (c === !0 ?
|
|
2923
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
2916
2924
|
}
|
|
2917
2925
|
}
|
|
2918
2926
|
return s;
|
|
2919
2927
|
}
|
|
2920
2928
|
internalBinaryWrite(e, t, n) {
|
|
2921
2929
|
for (let s = 0; s < e.folder.length; s++)
|
|
2922
|
-
|
|
2930
|
+
fe.internalBinaryWrite(e.folder[s], t.tag(1, m.LengthDelimited).fork(), n).join();
|
|
2923
2931
|
e.nextCursor !== "" && t.tag(2, m.LengthDelimited).string(e.nextCursor), e.hasMore !== !1 && t.tag(3, m.Varint).bool(e.hasMore);
|
|
2924
2932
|
let r = n.writeUnknownFields;
|
|
2925
|
-
return r !== !1 && (r == !0 ?
|
|
2933
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
2926
2934
|
}
|
|
2927
2935
|
}
|
|
2928
|
-
const
|
|
2929
|
-
class
|
|
2936
|
+
const Tn = new In();
|
|
2937
|
+
class On extends v {
|
|
2930
2938
|
constructor() {
|
|
2931
2939
|
super("com.hamropatro.grpc.cms.Folder", [
|
|
2932
2940
|
{
|
|
@@ -2961,7 +2969,7 @@ class gn extends C {
|
|
|
2961
2969
|
}
|
|
2962
2970
|
create(e) {
|
|
2963
2971
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2964
|
-
return t.key = "", t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 &&
|
|
2972
|
+
return t.key = "", t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 && _(this, t, e), t;
|
|
2965
2973
|
}
|
|
2966
2974
|
internalBinaryRead(e, t, n, r) {
|
|
2967
2975
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -2989,7 +2997,7 @@ class gn extends C {
|
|
|
2989
2997
|
if (c === "throw")
|
|
2990
2998
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
2991
2999
|
let h = e.skip(l);
|
|
2992
|
-
c !== !1 && (c === !0 ?
|
|
3000
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
2993
3001
|
}
|
|
2994
3002
|
}
|
|
2995
3003
|
return s;
|
|
@@ -2997,19 +3005,19 @@ class gn extends C {
|
|
|
2997
3005
|
internalBinaryWrite(e, t, n) {
|
|
2998
3006
|
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.name !== "" && t.tag(2, m.LengthDelimited).string(e.name), e.nestedFolderName !== "" && t.tag(3, m.LengthDelimited).string(e.nestedFolderName), e.createdBy !== "" && t.tag(4, m.LengthDelimited).string(e.createdBy);
|
|
2999
3007
|
let r = n.writeUnknownFields;
|
|
3000
|
-
return r !== !1 && (r == !0 ?
|
|
3008
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3001
3009
|
}
|
|
3002
3010
|
}
|
|
3003
|
-
const
|
|
3004
|
-
{ name: "createFolder", options: {}, I:
|
|
3005
|
-
{ name: "getFolders", options: {}, I:
|
|
3006
|
-
{ name: "updateFolder", options: {}, I:
|
|
3011
|
+
const fe = new On(), xe = new We("com.hamropatro.grpc.cms.FolderService", [
|
|
3012
|
+
{ name: "createFolder", options: {}, I: wt, O: fe },
|
|
3013
|
+
{ name: "getFolders", options: {}, I: En, O: Tn },
|
|
3014
|
+
{ name: "updateFolder", options: {}, I: fe, O: fe }
|
|
3007
3015
|
]);
|
|
3008
|
-
class
|
|
3016
|
+
class Fn {
|
|
3009
3017
|
constructor(e) {
|
|
3010
|
-
U(this, "typeName",
|
|
3011
|
-
U(this, "methods",
|
|
3012
|
-
U(this, "options",
|
|
3018
|
+
U(this, "typeName", xe.typeName);
|
|
3019
|
+
U(this, "methods", xe.methods);
|
|
3020
|
+
U(this, "options", xe.options);
|
|
3013
3021
|
this._transport = e;
|
|
3014
3022
|
}
|
|
3015
3023
|
/**
|
|
@@ -3017,25 +3025,25 @@ class bn {
|
|
|
3017
3025
|
*/
|
|
3018
3026
|
createFolder(e, t) {
|
|
3019
3027
|
const n = this.methods[0], r = this._transport.mergeOptions(t);
|
|
3020
|
-
return
|
|
3028
|
+
return se("unary", this._transport, n, r, e);
|
|
3021
3029
|
}
|
|
3022
3030
|
/**
|
|
3023
3031
|
* @generated from protobuf rpc: getFolders(com.hamropatro.grpc.cms.GetAllFoldersRequest) returns (com.hamropatro.grpc.cms.GetAllFoldersResponse);
|
|
3024
3032
|
*/
|
|
3025
3033
|
getFolders(e, t) {
|
|
3026
3034
|
const n = this.methods[1], r = this._transport.mergeOptions(t);
|
|
3027
|
-
return
|
|
3035
|
+
return se("unary", this._transport, n, r, e);
|
|
3028
3036
|
}
|
|
3029
3037
|
/**
|
|
3030
3038
|
* @generated from protobuf rpc: updateFolder(com.hamropatro.grpc.cms.Folder) returns (com.hamropatro.grpc.cms.Folder);
|
|
3031
3039
|
*/
|
|
3032
3040
|
updateFolder(e, t) {
|
|
3033
3041
|
const n = this.methods[2], r = this._transport.mergeOptions(t);
|
|
3034
|
-
return
|
|
3042
|
+
return se("unary", this._transport, n, r, e);
|
|
3035
3043
|
}
|
|
3036
3044
|
}
|
|
3037
|
-
var
|
|
3038
|
-
class
|
|
3045
|
+
var qe = /* @__PURE__ */ ((i) => (i[i.IMAGE = 0] = "IMAGE", i[i.AUDIO = 1] = "AUDIO", i[i.VIDEO = 2] = "VIDEO", i[i.ALL = 3] = "ALL", i))(qe || {});
|
|
3046
|
+
class Bn extends v {
|
|
3039
3047
|
constructor() {
|
|
3040
3048
|
super("com.hamropatro.grpc.cms.CreateFileRequest", [
|
|
3041
3049
|
{
|
|
@@ -3066,12 +3074,12 @@ class wn extends C {
|
|
|
3066
3074
|
T: 9
|
|
3067
3075
|
/*ScalarType.STRING*/
|
|
3068
3076
|
},
|
|
3069
|
-
{ no: 5, name: "type", kind: "enum", T: () => ["com.hamropatro.grpc.cms.FileType",
|
|
3077
|
+
{ no: 5, name: "type", kind: "enum", T: () => ["com.hamropatro.grpc.cms.FileType", qe] }
|
|
3070
3078
|
]);
|
|
3071
3079
|
}
|
|
3072
3080
|
create(e) {
|
|
3073
3081
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3074
|
-
return t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.type = 0, e !== void 0 &&
|
|
3082
|
+
return t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.type = 0, e !== void 0 && _(this, t, e), t;
|
|
3075
3083
|
}
|
|
3076
3084
|
internalBinaryRead(e, t, n, r) {
|
|
3077
3085
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3103,7 +3111,7 @@ class wn extends C {
|
|
|
3103
3111
|
if (c === "throw")
|
|
3104
3112
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3105
3113
|
let h = e.skip(l);
|
|
3106
|
-
c !== !1 && (c === !0 ?
|
|
3114
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3107
3115
|
}
|
|
3108
3116
|
}
|
|
3109
3117
|
return s;
|
|
@@ -3111,11 +3119,11 @@ class wn extends C {
|
|
|
3111
3119
|
internalBinaryWrite(e, t, n) {
|
|
3112
3120
|
e.name !== "" && t.tag(1, m.LengthDelimited).string(e.name), e.folderName !== "" && t.tag(2, m.LengthDelimited).string(e.folderName), e.nestedFolderName !== "" && t.tag(3, m.LengthDelimited).string(e.nestedFolderName), e.url !== "" && t.tag(4, m.LengthDelimited).string(e.url), e.type !== 0 && t.tag(5, m.Varint).int32(e.type);
|
|
3113
3121
|
let r = n.writeUnknownFields;
|
|
3114
|
-
return r !== !1 && (r == !0 ?
|
|
3122
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3115
3123
|
}
|
|
3116
3124
|
}
|
|
3117
|
-
const
|
|
3118
|
-
class
|
|
3125
|
+
const yt = new Bn();
|
|
3126
|
+
class An extends v {
|
|
3119
3127
|
constructor() {
|
|
3120
3128
|
super("com.hamropatro.grpc.cms.File", [
|
|
3121
3129
|
{
|
|
@@ -3167,13 +3175,13 @@ class yn extends C {
|
|
|
3167
3175
|
T: 9
|
|
3168
3176
|
/*ScalarType.STRING*/
|
|
3169
3177
|
},
|
|
3170
|
-
{ no: 8, name: "type", kind: "enum", T: () => ["com.hamropatro.grpc.cms.FileType",
|
|
3171
|
-
{ no: 9, name: "metadata", kind: "message", T: () =>
|
|
3178
|
+
{ no: 8, name: "type", kind: "enum", T: () => ["com.hamropatro.grpc.cms.FileType", qe] },
|
|
3179
|
+
{ no: 9, name: "metadata", kind: "message", T: () => Ce }
|
|
3172
3180
|
]);
|
|
3173
3181
|
}
|
|
3174
3182
|
create(e) {
|
|
3175
3183
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3176
|
-
return t.key = "", t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.thumborUrl = "", t.proxyUrl = "", t.type = 0, e !== void 0 &&
|
|
3184
|
+
return t.key = "", t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.thumborUrl = "", t.proxyUrl = "", t.type = 0, e !== void 0 && _(this, t, e), t;
|
|
3177
3185
|
}
|
|
3178
3186
|
internalBinaryRead(e, t, n, r) {
|
|
3179
3187
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3214,26 +3222,26 @@ class yn extends C {
|
|
|
3214
3222
|
break;
|
|
3215
3223
|
case /* com.hamropatro.grpc.cms.FileMetadata metadata */
|
|
3216
3224
|
9:
|
|
3217
|
-
s.metadata =
|
|
3225
|
+
s.metadata = Ce.internalBinaryRead(e, e.uint32(), n, s.metadata);
|
|
3218
3226
|
break;
|
|
3219
3227
|
default:
|
|
3220
3228
|
let c = n.readUnknownField;
|
|
3221
3229
|
if (c === "throw")
|
|
3222
3230
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3223
3231
|
let h = e.skip(l);
|
|
3224
|
-
c !== !1 && (c === !0 ?
|
|
3232
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3225
3233
|
}
|
|
3226
3234
|
}
|
|
3227
3235
|
return s;
|
|
3228
3236
|
}
|
|
3229
3237
|
internalBinaryWrite(e, t, n) {
|
|
3230
|
-
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.name !== "" && t.tag(2, m.LengthDelimited).string(e.name), e.folderName !== "" && t.tag(3, m.LengthDelimited).string(e.folderName), e.nestedFolderName !== "" && t.tag(4, m.LengthDelimited).string(e.nestedFolderName), e.url !== "" && t.tag(5, m.LengthDelimited).string(e.url), e.thumborUrl !== "" && t.tag(6, m.LengthDelimited).string(e.thumborUrl), e.proxyUrl !== "" && t.tag(7, m.LengthDelimited).string(e.proxyUrl), e.type !== 0 && t.tag(8, m.Varint).int32(e.type), e.metadata &&
|
|
3238
|
+
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.name !== "" && t.tag(2, m.LengthDelimited).string(e.name), e.folderName !== "" && t.tag(3, m.LengthDelimited).string(e.folderName), e.nestedFolderName !== "" && t.tag(4, m.LengthDelimited).string(e.nestedFolderName), e.url !== "" && t.tag(5, m.LengthDelimited).string(e.url), e.thumborUrl !== "" && t.tag(6, m.LengthDelimited).string(e.thumborUrl), e.proxyUrl !== "" && t.tag(7, m.LengthDelimited).string(e.proxyUrl), e.type !== 0 && t.tag(8, m.Varint).int32(e.type), e.metadata && Ce.internalBinaryWrite(e.metadata, t.tag(9, m.LengthDelimited).fork(), n).join();
|
|
3231
3239
|
let r = n.writeUnknownFields;
|
|
3232
|
-
return r !== !1 && (r == !0 ?
|
|
3240
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3233
3241
|
}
|
|
3234
3242
|
}
|
|
3235
|
-
const
|
|
3236
|
-
class
|
|
3243
|
+
const me = new An();
|
|
3244
|
+
class Dn extends v {
|
|
3237
3245
|
constructor() {
|
|
3238
3246
|
super("com.hamropatro.grpc.cms.FileMetadata", [
|
|
3239
3247
|
{
|
|
@@ -3268,7 +3276,7 @@ class Nn extends C {
|
|
|
3268
3276
|
}
|
|
3269
3277
|
create(e) {
|
|
3270
3278
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3271
|
-
return t.height = 0, t.width = 0, t.backgroundColor = "", t.aspectRatio = 0, e !== void 0 &&
|
|
3279
|
+
return t.height = 0, t.width = 0, t.backgroundColor = "", t.aspectRatio = 0, e !== void 0 && _(this, t, e), t;
|
|
3272
3280
|
}
|
|
3273
3281
|
internalBinaryRead(e, t, n, r) {
|
|
3274
3282
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3296,7 +3304,7 @@ class Nn extends C {
|
|
|
3296
3304
|
if (c === "throw")
|
|
3297
3305
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3298
3306
|
let h = e.skip(l);
|
|
3299
|
-
c !== !1 && (c === !0 ?
|
|
3307
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3300
3308
|
}
|
|
3301
3309
|
}
|
|
3302
3310
|
return s;
|
|
@@ -3304,11 +3312,11 @@ class Nn extends C {
|
|
|
3304
3312
|
internalBinaryWrite(e, t, n) {
|
|
3305
3313
|
e.height !== 0 && t.tag(1, m.Varint).int32(e.height), e.width !== 0 && t.tag(2, m.Varint).int32(e.width), e.backgroundColor !== "" && t.tag(3, m.LengthDelimited).string(e.backgroundColor), e.aspectRatio !== 0 && t.tag(4, m.Bit64).double(e.aspectRatio);
|
|
3306
3314
|
let r = n.writeUnknownFields;
|
|
3307
|
-
return r !== !1 && (r == !0 ?
|
|
3315
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3308
3316
|
}
|
|
3309
3317
|
}
|
|
3310
|
-
const
|
|
3311
|
-
class
|
|
3318
|
+
const Ce = new Dn();
|
|
3319
|
+
class Un extends v {
|
|
3312
3320
|
constructor() {
|
|
3313
3321
|
super("com.hamropatro.grpc.cms.DeleteFileRequest", [
|
|
3314
3322
|
{
|
|
@@ -3322,7 +3330,7 @@ class kn extends C {
|
|
|
3322
3330
|
}
|
|
3323
3331
|
create(e) {
|
|
3324
3332
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3325
|
-
return t.key = "", e !== void 0 &&
|
|
3333
|
+
return t.key = "", e !== void 0 && _(this, t, e), t;
|
|
3326
3334
|
}
|
|
3327
3335
|
internalBinaryRead(e, t, n, r) {
|
|
3328
3336
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3338,7 +3346,7 @@ class kn extends C {
|
|
|
3338
3346
|
if (c === "throw")
|
|
3339
3347
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3340
3348
|
let h = e.skip(l);
|
|
3341
|
-
c !== !1 && (c === !0 ?
|
|
3349
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3342
3350
|
}
|
|
3343
3351
|
}
|
|
3344
3352
|
return s;
|
|
@@ -3346,11 +3354,11 @@ class kn extends C {
|
|
|
3346
3354
|
internalBinaryWrite(e, t, n) {
|
|
3347
3355
|
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key);
|
|
3348
3356
|
let r = n.writeUnknownFields;
|
|
3349
|
-
return r !== !1 && (r == !0 ?
|
|
3357
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3350
3358
|
}
|
|
3351
3359
|
}
|
|
3352
|
-
const
|
|
3353
|
-
class
|
|
3360
|
+
const Ln = new Un();
|
|
3361
|
+
class Rn extends v {
|
|
3354
3362
|
constructor() {
|
|
3355
3363
|
super("com.hamropatro.grpc.cms.DeleteFileResponse", [
|
|
3356
3364
|
{
|
|
@@ -3364,7 +3372,7 @@ class In extends C {
|
|
|
3364
3372
|
}
|
|
3365
3373
|
create(e) {
|
|
3366
3374
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3367
|
-
return t.isDeleted = !1, e !== void 0 &&
|
|
3375
|
+
return t.isDeleted = !1, e !== void 0 && _(this, t, e), t;
|
|
3368
3376
|
}
|
|
3369
3377
|
internalBinaryRead(e, t, n, r) {
|
|
3370
3378
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3380,7 +3388,7 @@ class In extends C {
|
|
|
3380
3388
|
if (c === "throw")
|
|
3381
3389
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3382
3390
|
let h = e.skip(l);
|
|
3383
|
-
c !== !1 && (c === !0 ?
|
|
3391
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3384
3392
|
}
|
|
3385
3393
|
}
|
|
3386
3394
|
return s;
|
|
@@ -3388,11 +3396,11 @@ class In extends C {
|
|
|
3388
3396
|
internalBinaryWrite(e, t, n) {
|
|
3389
3397
|
e.isDeleted !== !1 && t.tag(1, m.Varint).bool(e.isDeleted);
|
|
3390
3398
|
let r = n.writeUnknownFields;
|
|
3391
|
-
return r !== !1 && (r == !0 ?
|
|
3399
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3392
3400
|
}
|
|
3393
3401
|
}
|
|
3394
|
-
const
|
|
3395
|
-
class
|
|
3402
|
+
const _n = new Rn();
|
|
3403
|
+
class xn extends v {
|
|
3396
3404
|
constructor() {
|
|
3397
3405
|
super("com.hamropatro.grpc.cms.GetFilesByFolderRequest", [
|
|
3398
3406
|
{
|
|
@@ -3420,7 +3428,7 @@ class On extends C {
|
|
|
3420
3428
|
}
|
|
3421
3429
|
create(e) {
|
|
3422
3430
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3423
|
-
return t.folderName = "", t.cursor = "", t.limit = 0, e !== void 0 &&
|
|
3431
|
+
return t.folderName = "", t.cursor = "", t.limit = 0, e !== void 0 && _(this, t, e), t;
|
|
3424
3432
|
}
|
|
3425
3433
|
internalBinaryRead(e, t, n, r) {
|
|
3426
3434
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3444,7 +3452,7 @@ class On extends C {
|
|
|
3444
3452
|
if (c === "throw")
|
|
3445
3453
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3446
3454
|
let h = e.skip(l);
|
|
3447
|
-
c !== !1 && (c === !0 ?
|
|
3455
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3448
3456
|
}
|
|
3449
3457
|
}
|
|
3450
3458
|
return s;
|
|
@@ -3452,14 +3460,14 @@ class On extends C {
|
|
|
3452
3460
|
internalBinaryWrite(e, t, n) {
|
|
3453
3461
|
e.folderName !== "" && t.tag(1, m.LengthDelimited).string(e.folderName), e.cursor !== "" && t.tag(2, m.LengthDelimited).string(e.cursor), e.limit !== 0 && t.tag(3, m.Varint).int32(e.limit);
|
|
3454
3462
|
let r = n.writeUnknownFields;
|
|
3455
|
-
return r !== !1 && (r == !0 ?
|
|
3463
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3456
3464
|
}
|
|
3457
3465
|
}
|
|
3458
|
-
const
|
|
3459
|
-
class
|
|
3466
|
+
const Nt = new xn();
|
|
3467
|
+
class Cn extends v {
|
|
3460
3468
|
constructor() {
|
|
3461
3469
|
super("com.hamropatro.grpc.cms.GetFilesByFolderResponse", [
|
|
3462
|
-
{ no: 1, name: "files", kind: "message", repeat: 1, T: () =>
|
|
3470
|
+
{ no: 1, name: "files", kind: "message", repeat: 1, T: () => me },
|
|
3463
3471
|
{
|
|
3464
3472
|
no: 2,
|
|
3465
3473
|
name: "next_cursor",
|
|
@@ -3478,7 +3486,7 @@ class Fn extends C {
|
|
|
3478
3486
|
}
|
|
3479
3487
|
create(e) {
|
|
3480
3488
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3481
|
-
return t.files = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 &&
|
|
3489
|
+
return t.files = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 && _(this, t, e), t;
|
|
3482
3490
|
}
|
|
3483
3491
|
internalBinaryRead(e, t, n, r) {
|
|
3484
3492
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3487,7 +3495,7 @@ class Fn extends C {
|
|
|
3487
3495
|
switch (o) {
|
|
3488
3496
|
case /* repeated com.hamropatro.grpc.cms.File files */
|
|
3489
3497
|
1:
|
|
3490
|
-
s.files.push(
|
|
3498
|
+
s.files.push(me.internalBinaryRead(e, e.uint32(), n));
|
|
3491
3499
|
break;
|
|
3492
3500
|
case /* string next_cursor */
|
|
3493
3501
|
2:
|
|
@@ -3502,30 +3510,30 @@ class Fn extends C {
|
|
|
3502
3510
|
if (c === "throw")
|
|
3503
3511
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3504
3512
|
let h = e.skip(l);
|
|
3505
|
-
c !== !1 && (c === !0 ?
|
|
3513
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3506
3514
|
}
|
|
3507
3515
|
}
|
|
3508
3516
|
return s;
|
|
3509
3517
|
}
|
|
3510
3518
|
internalBinaryWrite(e, t, n) {
|
|
3511
3519
|
for (let s = 0; s < e.files.length; s++)
|
|
3512
|
-
|
|
3520
|
+
me.internalBinaryWrite(e.files[s], t.tag(1, m.LengthDelimited).fork(), n).join();
|
|
3513
3521
|
e.nextCursor !== "" && t.tag(2, m.LengthDelimited).string(e.nextCursor), e.hasMore !== !1 && t.tag(3, m.Varint).bool(e.hasMore);
|
|
3514
3522
|
let r = n.writeUnknownFields;
|
|
3515
|
-
return r !== !1 && (r == !0 ?
|
|
3523
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3516
3524
|
}
|
|
3517
3525
|
}
|
|
3518
|
-
const
|
|
3519
|
-
{ name: "createFile", options: {}, I:
|
|
3520
|
-
{ name: "updateFile", options: {}, I:
|
|
3521
|
-
{ name: "deleteFile", options: {}, I:
|
|
3522
|
-
{ name: "getFilesByFolder", options: {}, I:
|
|
3526
|
+
const Sn = new Cn(), Se = new We("com.hamropatro.grpc.cms.FileService", [
|
|
3527
|
+
{ name: "createFile", options: {}, I: yt, O: me },
|
|
3528
|
+
{ name: "updateFile", options: {}, I: me, O: me },
|
|
3529
|
+
{ name: "deleteFile", options: {}, I: Ln, O: _n },
|
|
3530
|
+
{ name: "getFilesByFolder", options: {}, I: Nt, O: Sn }
|
|
3523
3531
|
]);
|
|
3524
|
-
class
|
|
3532
|
+
class vn {
|
|
3525
3533
|
constructor(e) {
|
|
3526
|
-
U(this, "typeName",
|
|
3527
|
-
U(this, "methods",
|
|
3528
|
-
U(this, "options",
|
|
3534
|
+
U(this, "typeName", Se.typeName);
|
|
3535
|
+
U(this, "methods", Se.methods);
|
|
3536
|
+
U(this, "options", Se.options);
|
|
3529
3537
|
this._transport = e;
|
|
3530
3538
|
}
|
|
3531
3539
|
/**
|
|
@@ -3533,48 +3541,48 @@ class Dn {
|
|
|
3533
3541
|
*/
|
|
3534
3542
|
createFile(e, t) {
|
|
3535
3543
|
const n = this.methods[0], r = this._transport.mergeOptions(t);
|
|
3536
|
-
return
|
|
3544
|
+
return se("unary", this._transport, n, r, e);
|
|
3537
3545
|
}
|
|
3538
3546
|
/**
|
|
3539
3547
|
* @generated from protobuf rpc: updateFile(com.hamropatro.grpc.cms.File) returns (com.hamropatro.grpc.cms.File);
|
|
3540
3548
|
*/
|
|
3541
3549
|
updateFile(e, t) {
|
|
3542
3550
|
const n = this.methods[1], r = this._transport.mergeOptions(t);
|
|
3543
|
-
return
|
|
3551
|
+
return se("unary", this._transport, n, r, e);
|
|
3544
3552
|
}
|
|
3545
3553
|
/**
|
|
3546
3554
|
* @generated from protobuf rpc: deleteFile(com.hamropatro.grpc.cms.DeleteFileRequest) returns (com.hamropatro.grpc.cms.DeleteFileResponse);
|
|
3547
3555
|
*/
|
|
3548
3556
|
deleteFile(e, t) {
|
|
3549
3557
|
const n = this.methods[2], r = this._transport.mergeOptions(t);
|
|
3550
|
-
return
|
|
3558
|
+
return se("unary", this._transport, n, r, e);
|
|
3551
3559
|
}
|
|
3552
3560
|
/**
|
|
3553
3561
|
* @generated from protobuf rpc: getFilesByFolder(com.hamropatro.grpc.cms.GetFilesByFolderRequest) returns (com.hamropatro.grpc.cms.GetFilesByFolderResponse);
|
|
3554
3562
|
*/
|
|
3555
3563
|
getFilesByFolder(e, t) {
|
|
3556
3564
|
const n = this.methods[3], r = this._transport.mergeOptions(t);
|
|
3557
|
-
return
|
|
3565
|
+
return se("unary", this._transport, n, r, e);
|
|
3558
3566
|
}
|
|
3559
3567
|
}
|
|
3560
|
-
class
|
|
3568
|
+
class Mn extends v {
|
|
3561
3569
|
constructor() {
|
|
3562
3570
|
super("com.hamropatro.grpc.cms.ImageUploadRequest", []);
|
|
3563
3571
|
}
|
|
3564
3572
|
create(e) {
|
|
3565
3573
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3566
|
-
return e !== void 0 &&
|
|
3574
|
+
return e !== void 0 && _(this, t, e), t;
|
|
3567
3575
|
}
|
|
3568
3576
|
internalBinaryRead(e, t, n, r) {
|
|
3569
3577
|
return r ?? this.create();
|
|
3570
3578
|
}
|
|
3571
3579
|
internalBinaryWrite(e, t, n) {
|
|
3572
3580
|
let r = n.writeUnknownFields;
|
|
3573
|
-
return r !== !1 && (r == !0 ?
|
|
3581
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3574
3582
|
}
|
|
3575
3583
|
}
|
|
3576
|
-
const
|
|
3577
|
-
class
|
|
3584
|
+
const kt = new Mn();
|
|
3585
|
+
class Vn extends v {
|
|
3578
3586
|
constructor() {
|
|
3579
3587
|
super("com.hamropatro.grpc.cms.ImageUploadResponse", [
|
|
3580
3588
|
{
|
|
@@ -3595,7 +3603,7 @@ class Un extends C {
|
|
|
3595
3603
|
}
|
|
3596
3604
|
create(e) {
|
|
3597
3605
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3598
|
-
return t.key = "", t.url = "", e !== void 0 &&
|
|
3606
|
+
return t.key = "", t.url = "", e !== void 0 && _(this, t, e), t;
|
|
3599
3607
|
}
|
|
3600
3608
|
internalBinaryRead(e, t, n, r) {
|
|
3601
3609
|
let s = r ?? this.create(), a = e.pos + t;
|
|
@@ -3615,7 +3623,7 @@ class Un extends C {
|
|
|
3615
3623
|
if (c === "throw")
|
|
3616
3624
|
throw new globalThis.Error(`Unknown field ${o} (wire type ${l}) for ${this.typeName}`);
|
|
3617
3625
|
let h = e.skip(l);
|
|
3618
|
-
c !== !1 && (c === !0 ?
|
|
3626
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, o, l, h);
|
|
3619
3627
|
}
|
|
3620
3628
|
}
|
|
3621
3629
|
return s;
|
|
@@ -3623,17 +3631,17 @@ class Un extends C {
|
|
|
3623
3631
|
internalBinaryWrite(e, t, n) {
|
|
3624
3632
|
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.url !== "" && t.tag(2, m.LengthDelimited).string(e.url);
|
|
3625
3633
|
let r = n.writeUnknownFields;
|
|
3626
|
-
return r !== !1 && (r == !0 ?
|
|
3634
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3627
3635
|
}
|
|
3628
3636
|
}
|
|
3629
|
-
const
|
|
3630
|
-
{ name: "Upload", options: {}, I:
|
|
3637
|
+
const $n = new Vn(), ve = new We("com.hamropatro.grpc.cms.ImageUploadService", [
|
|
3638
|
+
{ name: "Upload", options: {}, I: kt, O: $n }
|
|
3631
3639
|
]);
|
|
3632
|
-
class
|
|
3640
|
+
class jn {
|
|
3633
3641
|
constructor(e) {
|
|
3634
|
-
U(this, "typeName",
|
|
3635
|
-
U(this, "methods",
|
|
3636
|
-
U(this, "options",
|
|
3642
|
+
U(this, "typeName", ve.typeName);
|
|
3643
|
+
U(this, "methods", ve.methods);
|
|
3644
|
+
U(this, "options", ve.options);
|
|
3637
3645
|
this._transport = e;
|
|
3638
3646
|
}
|
|
3639
3647
|
/**
|
|
@@ -3641,26 +3649,26 @@ class xn {
|
|
|
3641
3649
|
*/
|
|
3642
3650
|
upload(e, t) {
|
|
3643
3651
|
const n = this.methods[0], r = this._transport.mergeOptions(t);
|
|
3644
|
-
return
|
|
3652
|
+
return se("unary", this._transport, n, r, e);
|
|
3645
3653
|
}
|
|
3646
3654
|
}
|
|
3647
|
-
const
|
|
3655
|
+
const Pn = {
|
|
3648
3656
|
baseUrl: "https://hamro-cms-backend-grpc.hamrostack.com"
|
|
3649
|
-
},
|
|
3650
|
-
baseUrl:
|
|
3651
|
-
}),
|
|
3652
|
-
|
|
3653
|
-
const
|
|
3657
|
+
}, Ke = new yn({
|
|
3658
|
+
baseUrl: Pn.baseUrl
|
|
3659
|
+
}), Wn = new Fn(Ke), Oe = wt.create(), Et = new vn(Ke), de = yt.create(), Fe = Nt.create(), qn = new jn(Ke);
|
|
3660
|
+
kt.create();
|
|
3661
|
+
const It = async () => {
|
|
3654
3662
|
try {
|
|
3655
|
-
return await
|
|
3656
|
-
|
|
3663
|
+
return await qn.upload(
|
|
3664
|
+
It
|
|
3657
3665
|
);
|
|
3658
3666
|
} catch (i) {
|
|
3659
3667
|
throw i;
|
|
3660
3668
|
}
|
|
3661
|
-
},
|
|
3669
|
+
}, Kn = async (i, e) => {
|
|
3662
3670
|
try {
|
|
3663
|
-
const t =
|
|
3671
|
+
const t = Xn(i, e), r = (await It()).response.url;
|
|
3664
3672
|
return await fetch(r, {
|
|
3665
3673
|
method: "PUT",
|
|
3666
3674
|
headers: {
|
|
@@ -3672,7 +3680,7 @@ const pt = async () => {
|
|
|
3672
3680
|
} catch (t) {
|
|
3673
3681
|
throw t;
|
|
3674
3682
|
}
|
|
3675
|
-
},
|
|
3683
|
+
}, Xn = (i, e) => {
|
|
3676
3684
|
const t = e.type.split("/")[0];
|
|
3677
3685
|
let n = "";
|
|
3678
3686
|
t === "video" ? n = i == null ? void 0 : i.replace(/^data:video\/\w+;base64,/, "") : t === "image" && (n = i == null ? void 0 : i.replace(/^data:image\/\w+;base64,/, ""));
|
|
@@ -3680,62 +3688,91 @@ const pt = async () => {
|
|
|
3680
3688
|
for (let a = 0; a < r.length; a++)
|
|
3681
3689
|
s[a] = r.charCodeAt(a);
|
|
3682
3690
|
return s;
|
|
3683
|
-
},
|
|
3691
|
+
}, Gn = async (i, e, t) => {
|
|
3684
3692
|
try {
|
|
3685
|
-
return
|
|
3686
|
-
|
|
3693
|
+
return Oe.name = i, Oe.nestedFolderName = e, Oe.createdBy = t, await Wn.createFolder(
|
|
3694
|
+
Oe
|
|
3687
3695
|
);
|
|
3688
3696
|
} catch (n) {
|
|
3689
3697
|
throw n;
|
|
3690
3698
|
}
|
|
3691
|
-
},
|
|
3699
|
+
}, Jn = async (i, e, t, n, r) => {
|
|
3692
3700
|
try {
|
|
3693
|
-
return
|
|
3694
|
-
|
|
3701
|
+
return de.name = i, de.nestedFolderName = e, de.url = t, de.type = n, de.folderName = r, await Et.createFile(
|
|
3702
|
+
de
|
|
3695
3703
|
);
|
|
3696
3704
|
} catch (s) {
|
|
3697
3705
|
throw s;
|
|
3698
3706
|
}
|
|
3707
|
+
}, Hn = async (i, e, t) => {
|
|
3708
|
+
try {
|
|
3709
|
+
return Fe.folderName = i, Fe.cursor = e, Fe.limit = t, await Et.getFilesByFolder(
|
|
3710
|
+
Fe
|
|
3711
|
+
);
|
|
3712
|
+
} catch (n) {
|
|
3713
|
+
throw n;
|
|
3714
|
+
}
|
|
3699
3715
|
};
|
|
3700
|
-
var
|
|
3701
|
-
const
|
|
3702
|
-
|
|
3703
|
-
|
|
3716
|
+
var V = /* @__PURE__ */ ((i) => (i[i.IMAGE = 0] = "IMAGE", i[i.AUDIO = 1] = "AUDIO", i[i.VIDEO = 2] = "VIDEO", i[i.ALL = 3] = "ALL", i))(V || {});
|
|
3717
|
+
const ge = {
|
|
3718
|
+
0: "IMAGE",
|
|
3719
|
+
1: "AUDIO",
|
|
3720
|
+
2: "VIDEO",
|
|
3721
|
+
3: "ALL"
|
|
3722
|
+
}, Zn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='lucide%20lucide-cloud-upload'%3e%3cpath%20d='M4%2014.899A7%207%200%201%201%2015.71%208h1.79a4.5%204.5%200%200%201%202.5%208.242'/%3e%3cpath%20d='M12%2012v9'/%3e%3cpath%20d='m16%2016-4-4-4%204'/%3e%3c/svg%3e", Yn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20preserveAspectRatio='xMidYMid'%20width='200'%20height='200'%20style='shape-rendering:%20auto;%20display:%20block;%20background:%20rgb(255,%20255,%20255);%20--darkreader-inline-bgimage:%20initial;%20--darkreader-inline-bgcolor:%20%231e1e2e;'%20data-darkreader-inline-bgimage=''%20data-darkreader-inline-bgcolor=''%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cg%3e%3ccircle%20stroke-dasharray='164.93361431346415%2056.97787143782138'%20r='35'%20stroke-width='10'%20stroke='%23e15b64'%20fill='none'%20cy='50'%20cx='50'%3e%3canimateTransform%20keyTimes='0;1'%20values='0%2050%2050;360%2050%2050'%20dur='1s'%20repeatCount='indefinite'%20type='rotate'%20attributeName='transform'%3e%3c/animateTransform%3e%3c/circle%3e%3cg%3e%3c/g%3e%3c/g%3e%3c!--%20[ldio]%20generated%20by%20https://loading.io%20--%3e%3c/svg%3e", zn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='lucide%20lucide-cloud-upload'%20%3e%3cpath%20d='M4%2014.899A7%207%200%201%201%2015.71%208h1.79a4.5%204.5%200%200%201%202.5%208.242'%20/%3e%3cpath%20d='M12%2012v9'%20/%3e%3cpath%20d='m16%2016-4-4-4%204'%20/%3e%3c/svg%3e";
|
|
3723
|
+
function Qn(i) {
|
|
3724
|
+
switch (i) {
|
|
3725
|
+
case "image":
|
|
3726
|
+
return ge[V.IMAGE];
|
|
3727
|
+
case "video":
|
|
3728
|
+
return ge[V.VIDEO];
|
|
3729
|
+
case "audio":
|
|
3730
|
+
return ge[V.AUDIO];
|
|
3731
|
+
default:
|
|
3732
|
+
return ge[V.ALL];
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
var oe, pe, le, x, z, q, ce, J, we, T, C, ue, ie, he, ye, re;
|
|
3736
|
+
class ti {
|
|
3704
3737
|
constructor(e) {
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3738
|
+
L(this, oe);
|
|
3739
|
+
L(this, pe);
|
|
3740
|
+
L(this, le);
|
|
3741
|
+
L(this, x);
|
|
3742
|
+
L(this, z);
|
|
3743
|
+
L(this, q);
|
|
3744
|
+
L(this, ce);
|
|
3745
|
+
L(this, J);
|
|
3746
|
+
L(this, we);
|
|
3747
|
+
L(this, T, []);
|
|
3748
|
+
L(this, C, []);
|
|
3749
|
+
L(this, ue);
|
|
3750
|
+
L(this, ie);
|
|
3751
|
+
L(this, he);
|
|
3752
|
+
L(this, ye);
|
|
3753
|
+
L(this, re);
|
|
3754
|
+
w(this, z, null), w(this, J, !1), w(this, ue, !1), w(this, ie, !1), w(this, he, e.folderName), w(this, ye, e.handleUpload.bind(this)), w(this, re, 0);
|
|
3718
3755
|
}
|
|
3719
3756
|
_init() {
|
|
3720
3757
|
!!sessionStorage.getItem("folderCreated") || this.createFolder(d(this, he));
|
|
3721
3758
|
}
|
|
3722
3759
|
create(e) {
|
|
3723
|
-
|
|
3760
|
+
w(this, oe, document.getElementById(
|
|
3724
3761
|
e.imageUploadMainContainerId
|
|
3725
|
-
)),
|
|
3762
|
+
)), w(this, pe, W("browse-container")), w(this, le, W("browse-image-main"));
|
|
3726
3763
|
let t;
|
|
3727
|
-
t =
|
|
3728
|
-
const n =
|
|
3764
|
+
t = Ne(Zn, "upload-btn-icon");
|
|
3765
|
+
const n = At("Upload Medias", "upload-span-text"), r = ke(
|
|
3729
3766
|
"Browser Files",
|
|
3730
3767
|
"browse-image-button"
|
|
3731
3768
|
);
|
|
3732
|
-
return r.addEventListener("click", () => {
|
|
3769
|
+
return r.type = "button", r.addEventListener("click", () => {
|
|
3733
3770
|
this.selectedImageContainer();
|
|
3734
|
-
}), d(this,
|
|
3771
|
+
}), d(this, le) && d(this, le).append(t, n, r), d(this, pe).appendChild(d(this, le)), d(this, oe) && d(this, oe).appendChild(d(this, pe)), d(this, oe);
|
|
3735
3772
|
}
|
|
3736
3773
|
selectedImageContainer() {
|
|
3737
3774
|
var a;
|
|
3738
|
-
const e =
|
|
3775
|
+
const e = ke(
|
|
3739
3776
|
"",
|
|
3740
3777
|
"dialog-modal-close-btn",
|
|
3741
3778
|
"",
|
|
@@ -3757,24 +3794,37 @@ class Kn {
|
|
|
3757
3794
|
</svg>`
|
|
3758
3795
|
);
|
|
3759
3796
|
e.addEventListener("click", () => {
|
|
3760
|
-
|
|
3761
|
-
}),
|
|
3762
|
-
const t =
|
|
3763
|
-
t.append(n, r, s),
|
|
3797
|
+
P.hide(), w(this, T, []), w(this, C, []);
|
|
3798
|
+
}), w(this, ce, `Upload (${(a = d(this, T)) == null ? void 0 : a.length})`);
|
|
3799
|
+
const t = W("browse-container"), n = this.createUploadOptions(), r = this.createBrowseMoreContainer(), s = this.createBrowseImageMain();
|
|
3800
|
+
t.append(n, r, s), P.show({
|
|
3764
3801
|
title: e,
|
|
3765
3802
|
content: t,
|
|
3766
|
-
confirmButtonText: d(this,
|
|
3803
|
+
confirmButtonText: d(this, ce),
|
|
3767
3804
|
onConfirm: () => {
|
|
3768
|
-
d(this,
|
|
3805
|
+
d(this, ye).call(this);
|
|
3769
3806
|
},
|
|
3770
3807
|
onCancel: () => {
|
|
3771
|
-
|
|
3808
|
+
P.hide(), w(this, T, []), w(this, C, []);
|
|
3772
3809
|
}
|
|
3773
|
-
});
|
|
3810
|
+
}), this.fetchFilesFromFolder();
|
|
3811
|
+
}
|
|
3812
|
+
_createAllAndSelectedTab(e) {
|
|
3813
|
+
const t = W("select-options"), n = te("Browse", "select"), r = te(
|
|
3814
|
+
"Selected",
|
|
3815
|
+
"select",
|
|
3816
|
+
"selected-images-tab"
|
|
3817
|
+
);
|
|
3818
|
+
n.classList.add("selected"), [n, r].forEach((a, o) => {
|
|
3819
|
+
a.addEventListener("click", () => {
|
|
3820
|
+
var l;
|
|
3821
|
+
w(this, re, o), (l = document.querySelector(".select.selected")) == null || l.classList.remove("selected"), a.classList.add("selected"), this._updateSelectedImagesContainerUI();
|
|
3822
|
+
});
|
|
3823
|
+
}), t.append(n, r), e.appendChild(t);
|
|
3774
3824
|
}
|
|
3775
3825
|
createUploadOptions() {
|
|
3776
|
-
const e =
|
|
3777
|
-
return
|
|
3826
|
+
const e = W("browse-options"), t = te("From Computer", "options");
|
|
3827
|
+
return te("From URL", "options"), t.classList.add("selected"), [t].forEach((r) => {
|
|
3778
3828
|
r.addEventListener("click", () => {
|
|
3779
3829
|
var s;
|
|
3780
3830
|
(s = document.querySelector(".options.selected")) == null || s.classList.remove("selected"), r.classList.add("selected");
|
|
@@ -3782,93 +3832,132 @@ class Kn {
|
|
|
3782
3832
|
}), e.append(t), e;
|
|
3783
3833
|
}
|
|
3784
3834
|
createBrowseMoreContainer() {
|
|
3785
|
-
const e =
|
|
3786
|
-
|
|
3835
|
+
const e = W("browse-more-btn-container");
|
|
3836
|
+
this._createAllAndSelectedTab(e), w(this, q, ke(
|
|
3837
|
+
"Browse More Medias",
|
|
3787
3838
|
"browse-more-btn"
|
|
3788
|
-
),
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3839
|
+
)), d(this, q).type = "button";
|
|
3840
|
+
const t = Lt("file");
|
|
3841
|
+
t.style.display = "none";
|
|
3842
|
+
const n = Ne(zn);
|
|
3843
|
+
return d(this, q).append(n), d(this, q).addEventListener(
|
|
3844
|
+
"click",
|
|
3845
|
+
() => t.click()
|
|
3846
|
+
), t.addEventListener("change", () => {
|
|
3847
|
+
const r = t.files[0], s = new FileReader();
|
|
3848
|
+
s.readAsDataURL(r), s.onload = async () => {
|
|
3849
|
+
await this.addSelectedImages(s.result, r), t.value = "";
|
|
3795
3850
|
};
|
|
3796
|
-
}), e.appendChild(
|
|
3851
|
+
}), e.appendChild(d(this, q)), e;
|
|
3797
3852
|
}
|
|
3798
3853
|
createBrowseImageMain() {
|
|
3799
3854
|
var t;
|
|
3800
|
-
const e =
|
|
3801
|
-
return
|
|
3802
|
-
`Selected
|
|
3803
|
-
)), d(this,
|
|
3804
|
-
d(this,
|
|
3805
|
-
d(this,
|
|
3855
|
+
const e = W("browse-image-main");
|
|
3856
|
+
return w(this, z, te(
|
|
3857
|
+
`Selected Medias (${(t = d(this, T)) == null ? void 0 : t.length})`
|
|
3858
|
+
)), d(this, z).style.textAlign = "left", d(this, z).style.fontSize = "18px", w(this, x, W("selected-image-container")), this._updateSelectedImagesContainerUI(), e.append(
|
|
3859
|
+
d(this, z),
|
|
3860
|
+
d(this, x)
|
|
3806
3861
|
), e;
|
|
3807
3862
|
}
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
var l;
|
|
3813
|
-
const t = J("selected-image-content"), n = pe("x", "selected-image-btn"), r = fe(e == null ? void 0 : e.url, "selected-image");
|
|
3814
|
-
n.addEventListener("click", () => {
|
|
3815
|
-
if (I(this, T, d(this, T).filter(
|
|
3816
|
-
(c) => (c == null ? void 0 : c.url) !== (e == null ? void 0 : e.url)
|
|
3817
|
-
)), s.remove(), d(this, T).length === 0) {
|
|
3818
|
-
d(this, B).innerHTML = "";
|
|
3819
|
-
const c = ne();
|
|
3820
|
-
c.textContent = "No images selected", d(this, B).style.textAlign = "center", d(this, B).style.width = "auto", d(this, B).appendChild(c);
|
|
3821
|
-
}
|
|
3822
|
-
this._updateDialogContent();
|
|
3823
|
-
});
|
|
3824
|
-
const s = J(
|
|
3825
|
-
"selected-image-wrapper",
|
|
3826
|
-
e == null ? void 0 : e.url
|
|
3827
|
-
);
|
|
3828
|
-
s.classList.add("checked"), r.addEventListener("click", () => {
|
|
3829
|
-
s.classList.contains("checked") ? (s.classList.remove("checked"), I(this, T, d(this, T).filter(
|
|
3830
|
-
(c) => (c == null ? void 0 : c.url) !== (e == null ? void 0 : e.url)
|
|
3831
|
-
))) : (s.classList.add("checked"), d(this, T).push(e)), this._updateDialogContent();
|
|
3832
|
-
}), d(this, Q) ? d(this, B).querySelector(".loader") || (I(this, ae, fe(et, "loader")), d(this, B).style.width = "100%", d(this, B).appendChild(d(this, ae))) : (s.append(r, n), d(this, B).style.width = "100%", d(this, B).appendChild(s));
|
|
3833
|
-
const a = ne(
|
|
3834
|
-
e.name,
|
|
3835
|
-
"selected-image-name"
|
|
3836
|
-
), o = ne(
|
|
3837
|
-
`${(l = e.type) == null ? void 0 : l.split("/")[1]} - ${Math.round(e.size / 1024)}KB`,
|
|
3838
|
-
"selected-image-size"
|
|
3839
|
-
);
|
|
3840
|
-
t.appendChild(r), s.append(
|
|
3841
|
-
t,
|
|
3842
|
-
a,
|
|
3843
|
-
o
|
|
3844
|
-
), d(this, B).style.width = "100%", d(this, B).appendChild(s);
|
|
3845
|
-
});
|
|
3846
|
-
else if (d(this, Q))
|
|
3847
|
-
I(this, ae, fe(et, "loader")), d(this, B).style.width = "100%", d(this, B).appendChild(d(this, ae));
|
|
3848
|
-
else {
|
|
3849
|
-
const e = ne();
|
|
3850
|
-
e.textContent = "No images selected", d(this, B).style.textAlign = "center", d(this, B).style.width = "auto", d(this, B).appendChild(e);
|
|
3851
|
-
}
|
|
3852
|
-
this._updateDialogContent();
|
|
3863
|
+
_renderFetchingSkeletonUI() {
|
|
3864
|
+
for (let e = 0; e < 4; e++) {
|
|
3865
|
+
const t = W("skeleton");
|
|
3866
|
+
t.innerHTML = "", d(this, x).appendChild(t);
|
|
3853
3867
|
}
|
|
3854
3868
|
}
|
|
3869
|
+
_renderEmptyImageContainer() {
|
|
3870
|
+
if (!d(this, ie)) {
|
|
3871
|
+
const e = te();
|
|
3872
|
+
e.textContent = "No media selected", d(this, x).appendChild(e);
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
_renderLoadingUI() {
|
|
3876
|
+
w(this, we, Ne(Yn, "loader")), d(this, x).style.width = "100%", d(this, x).appendChild(d(this, we));
|
|
3877
|
+
}
|
|
3878
|
+
_fileCardBody(e, t = !1) {
|
|
3879
|
+
const n = W("selected-image-content"), r = ke("x", "selected-image-btn");
|
|
3880
|
+
let s;
|
|
3881
|
+
V[e == null ? void 0 : e.fileType] === V.IMAGE && (s = Ne(e == null ? void 0 : e.url, "selected-image")), V[e == null ? void 0 : e.fileType] === V.VIDEO && (s = Dt(e == null ? void 0 : e.url, "uploaded-video")), V[e == null ? void 0 : e.fileType] === V.AUDIO && (s = Ut(e == null ? void 0 : e.url, "uploaded-audio"));
|
|
3882
|
+
const a = W(
|
|
3883
|
+
"selected-image-wrapper",
|
|
3884
|
+
"selected-image-wrapper"
|
|
3885
|
+
);
|
|
3886
|
+
t && a.classList.add("checked");
|
|
3887
|
+
const o = te(
|
|
3888
|
+
e.name,
|
|
3889
|
+
"selected-image-name"
|
|
3890
|
+
), l = te(
|
|
3891
|
+
`${e == null ? void 0 : e.fileType} ${e != null && e.size ? " - " + Math.round((e == null ? void 0 : e.size) / 1024) + "KB" : ""}`,
|
|
3892
|
+
"selected-image-size"
|
|
3893
|
+
);
|
|
3894
|
+
n.appendChild(s), a.append(
|
|
3895
|
+
n,
|
|
3896
|
+
o,
|
|
3897
|
+
l,
|
|
3898
|
+
r
|
|
3899
|
+
), d(this, x).style.width = "100%", d(this, x).appendChild(a), r.addEventListener("click", () => {
|
|
3900
|
+
w(this, T, d(this, T).filter(
|
|
3901
|
+
(c) => (c == null ? void 0 : c.url) !== (e == null ? void 0 : e.url)
|
|
3902
|
+
)), w(this, C, d(this, C).filter(
|
|
3903
|
+
(c) => (c == null ? void 0 : c.url) !== (e == null ? void 0 : e.url)
|
|
3904
|
+
)), a.remove(), this._updateDialogContent();
|
|
3905
|
+
}), s.addEventListener("click", () => {
|
|
3906
|
+
const c = d(this, T).findIndex((p) => p === e), h = d(this, C).findIndex(
|
|
3907
|
+
(p) => p === e
|
|
3908
|
+
);
|
|
3909
|
+
a.classList.contains("checked") ? (a.classList.remove("checked"), c !== -1 && d(this, T).splice(c, 1), d(this, C).push(e)) : (a.classList.add("checked"), d(this, T).push({
|
|
3910
|
+
url: e == null ? void 0 : e.url,
|
|
3911
|
+
name: e == null ? void 0 : e.name,
|
|
3912
|
+
fileType: e == null ? void 0 : e.fileType,
|
|
3913
|
+
size: e == null ? void 0 : e.size
|
|
3914
|
+
}), h !== -1 && d(this, C).splice(h, 1)), this._updateDialogContent(), this._updateSelectedImagesContainerUI();
|
|
3915
|
+
});
|
|
3916
|
+
}
|
|
3917
|
+
_renderFetchedImageCard(e) {
|
|
3918
|
+
this._fileCardBody(e, !1);
|
|
3919
|
+
}
|
|
3920
|
+
_renderSelectedImageCard(e) {
|
|
3921
|
+
this._fileCardBody(e, !0);
|
|
3922
|
+
}
|
|
3923
|
+
_renderFetchedImagesContainerUI() {
|
|
3924
|
+
var e, t;
|
|
3925
|
+
((e = d(this, C)) == null ? void 0 : e.length) > 0 && ((t = d(this, C)) == null || t.forEach((n) => {
|
|
3926
|
+
this._renderFetchedImageCard(n);
|
|
3927
|
+
}));
|
|
3928
|
+
}
|
|
3929
|
+
_renderSelectedImagesContainerUI() {
|
|
3930
|
+
d(this, T).forEach((e) => {
|
|
3931
|
+
this._renderSelectedImageCard(e);
|
|
3932
|
+
});
|
|
3933
|
+
}
|
|
3934
|
+
_updateSelectedImagesContainerUI() {
|
|
3935
|
+
var t, n, r;
|
|
3936
|
+
if (!d(this, x)) return;
|
|
3937
|
+
d(this, x).innerHTML = "", d(this, ie) && this._renderFetchingSkeletonUI(), d(this, ue) && this._renderLoadingUI(), d(this, re) === 0 && ((t = d(this, T)) == null ? void 0 : t.length) === 0 && ((n = d(this, C)) == null ? void 0 : n.length) === 0 || d(this, re) === 1 && ((r = d(this, T)) == null ? void 0 : r.length) === 0 ? (d(this, x).classList.add("no-selected-image-container"), this._renderEmptyImageContainer()) : (d(this, x).classList.remove(
|
|
3938
|
+
"no-selected-image-container"
|
|
3939
|
+
), d(this, re) === 1 ? this._renderSelectedImagesContainerUI() : (this._renderSelectedImagesContainerUI(), this._renderFetchedImagesContainerUI())), this._updateDialogContent();
|
|
3940
|
+
}
|
|
3855
3941
|
_updateDialogContent() {
|
|
3856
|
-
var
|
|
3857
|
-
d(this,
|
|
3942
|
+
var t, n;
|
|
3943
|
+
d(this, z).textContent = `Selected Medias (${d(this, T).length})`, w(this, ce, `Upload (${d(this, T).length})`);
|
|
3944
|
+
const e = document.getElementById("selected-images-tab");
|
|
3945
|
+
e && (e.textContent = `Selected (${(t = d(this, T)) == null ? void 0 : t.length})`), P.updateUploadBtnText(d(this, ce)), P.disableConfirmButton(((n = d(this, T)) == null ? void 0 : n.length) <= 0);
|
|
3858
3946
|
}
|
|
3859
3947
|
async addSelectedImages(e, t) {
|
|
3860
|
-
|
|
3861
|
-
|
|
3948
|
+
var r;
|
|
3949
|
+
w(this, ue, !0), this._updateSelectedImagesContainerUI();
|
|
3950
|
+
const n = await Kn(e, t);
|
|
3862
3951
|
d(this, T).unshift({
|
|
3863
3952
|
url: n,
|
|
3953
|
+
size: t.size,
|
|
3864
3954
|
name: t.name,
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
}), I(this, Q, !1), this.updateSelectedImages();
|
|
3955
|
+
fileType: Qn((r = t.type) == null ? void 0 : r.split("/")[0])
|
|
3956
|
+
}), w(this, ue, !1), this._updateSelectedImagesContainerUI();
|
|
3868
3957
|
}
|
|
3869
3958
|
async createFolder(e, t = 2) {
|
|
3870
3959
|
try {
|
|
3871
|
-
await
|
|
3960
|
+
await Gn(e, "", ""), sessionStorage.setItem("folderCreated", "true");
|
|
3872
3961
|
} catch {
|
|
3873
3962
|
if (t > 1)
|
|
3874
3963
|
this.createFolder(e, --t);
|
|
@@ -3879,29 +3968,43 @@ class Kn {
|
|
|
3879
3968
|
async _upload() {
|
|
3880
3969
|
var t, n;
|
|
3881
3970
|
if (!d(this, T) || d(this, T).length === 0)
|
|
3882
|
-
throw new Error("No
|
|
3883
|
-
|
|
3971
|
+
throw new Error("No medias to upload");
|
|
3972
|
+
w(this, J, !0), d(this, q).disabled = !0, P.updateUploadBtnText(`Uploading (${(t = d(this, T)) == null ? void 0 : t.length})`), P.updateUploadBtn(d(this, J));
|
|
3884
3973
|
let e = [];
|
|
3885
3974
|
try {
|
|
3886
|
-
return await this._uploadImages(e),
|
|
3975
|
+
return await this._uploadImages(e), w(this, J, !1), w(this, T, []), w(this, C, []), P.hide(), d(this, q).disabled = !1, P.updateUploadBtn(d(this, J)), e;
|
|
3887
3976
|
} catch {
|
|
3888
|
-
throw
|
|
3977
|
+
throw w(this, J, !1), d(this, q).disabled = !1, P.updateUploadBtnText(`Upload(${(n = d(this, T)) == null ? void 0 : n.length})`), P.updateUploadBtn(d(this, J)), new Error("something went wrong");
|
|
3889
3978
|
}
|
|
3890
3979
|
}
|
|
3891
3980
|
async _uploadImages(e) {
|
|
3892
3981
|
for (const t of d(this, T)) {
|
|
3893
|
-
const n = await
|
|
3982
|
+
const n = await Jn(
|
|
3894
3983
|
t == null ? void 0 : t.name,
|
|
3895
3984
|
"",
|
|
3896
3985
|
t == null ? void 0 : t.url,
|
|
3897
|
-
|
|
3986
|
+
V[t == null ? void 0 : t.fileType],
|
|
3898
3987
|
d(this, he)
|
|
3899
3988
|
);
|
|
3900
3989
|
e.push(n.response);
|
|
3901
3990
|
}
|
|
3902
3991
|
}
|
|
3992
|
+
async fetchFilesFromFolder() {
|
|
3993
|
+
w(this, ie, !0), this._updateSelectedImagesContainerUI();
|
|
3994
|
+
try {
|
|
3995
|
+
const n = (await Hn(d(this, he), "", 10)).response.files.map((r) => ({
|
|
3996
|
+
url: r.url,
|
|
3997
|
+
name: r.name,
|
|
3998
|
+
fileType: ge[r.type]
|
|
3999
|
+
}));
|
|
4000
|
+
d(this, C).push(...n);
|
|
4001
|
+
} catch {
|
|
4002
|
+
} finally {
|
|
4003
|
+
w(this, ie, !1), this._updateSelectedImagesContainerUI();
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
3903
4006
|
}
|
|
3904
|
-
|
|
4007
|
+
oe = new WeakMap(), pe = new WeakMap(), le = new WeakMap(), x = new WeakMap(), z = new WeakMap(), q = new WeakMap(), ce = new WeakMap(), J = new WeakMap(), we = new WeakMap(), T = new WeakMap(), C = new WeakMap(), ue = new WeakMap(), ie = new WeakMap(), he = new WeakMap(), ye = new WeakMap(), re = new WeakMap();
|
|
3905
4008
|
export {
|
|
3906
|
-
|
|
4009
|
+
ti as default
|
|
3907
4010
|
};
|