@braze/web-sdk 5.1.1 → 5.2.0

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.
Files changed (76) hide show
  1. package/index.d.ts +14 -8
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +18 -18
  5. package/shared-lib/indexed-db-adapter.js +32 -32
  6. package/shared-lib/logger.js +2 -2
  7. package/shared-lib/supported-options.js +22 -21
  8. package/src/InAppMessage/display/html-message-to-html.js +38 -35
  9. package/src/InAppMessage/display/in-app-message-to-html.js +2 -2
  10. package/src/InAppMessage/display/modal-utils.js +2 -2
  11. package/src/InAppMessage/in-app-message-factory.js +21 -19
  12. package/src/InAppMessage/in-app-message-manager.js +58 -78
  13. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  14. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  15. package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
  16. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  17. package/src/InAppMessage/models/control-message.js +4 -2
  18. package/src/InAppMessage/models/full-screen-message.js +5 -2
  19. package/src/InAppMessage/models/html-message.js +6 -4
  20. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  21. package/src/InAppMessage/models/in-app-message.js +51 -46
  22. package/src/InAppMessage/models/modal-message.js +5 -2
  23. package/src/InAppMessage/models/slide-up-message.js +33 -8
  24. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  25. package/src/InAppMessage/ui/show-in-app-message.js +28 -34
  26. package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
  27. package/src/Push/push-manager-factory.js +3 -3
  28. package/src/Push/push-manager.js +118 -110
  29. package/src/Push/utils/push-utils.js +4 -4
  30. package/src/User/user-manager.js +4 -4
  31. package/src/User/user.js +17 -17
  32. package/src/common/base-feed.js +1 -1
  33. package/src/common/feed-display.js +12 -12
  34. package/src/l10n/l10n-manager-factory.js +1 -1
  35. package/src/l10n/l10n-manager.js +4 -4
  36. package/src/managers/auth-manager.js +26 -26
  37. package/src/managers/braze-instance.js +59 -52
  38. package/src/managers/device-manager.js +15 -15
  39. package/src/managers/network-manager.js +98 -93
  40. package/src/managers/server-config-manager.js +9 -9
  41. package/src/managers/storage-manager.js +99 -96
  42. package/src/managers/utils.js +6 -0
  43. package/src/models/backend-errors.js +5 -5
  44. package/src/models/braze-event.js +20 -12
  45. package/src/models/device.js +3 -3
  46. package/src/models/identifier.js +33 -19
  47. package/src/models/push-token.js +4 -4
  48. package/src/models/server-config.js +6 -6
  49. package/src/request-controller.js +76 -73
  50. package/src/triggers/models/custom-event-data.js +2 -2
  51. package/src/triggers/models/custom-event-property-data.js +4 -4
  52. package/src/triggers/models/filter-set.js +5 -5
  53. package/src/triggers/models/filter.js +6 -6
  54. package/src/triggers/models/in-app-message-click-data.js +1 -1
  55. package/src/triggers/models/purchase-data.js +2 -2
  56. package/src/triggers/models/purchase-property-data.js +4 -4
  57. package/src/triggers/models/push-click-data.js +1 -1
  58. package/src/triggers/models/trigger-condition.js +41 -41
  59. package/src/triggers/models/trigger-events.js +1 -1
  60. package/src/triggers/models/trigger.js +36 -36
  61. package/src/triggers/triggers-provider-factory.js +1 -1
  62. package/src/triggers/triggers-provider.js +71 -82
  63. package/src/ui/js/attach-css.js +2 -2
  64. package/src/ui/js/load-font-awesome.js +1 -1
  65. package/src/util/base-device-parser.js +1 -1
  66. package/src/util/braze-actions.js +4 -4
  67. package/src/util/browser-detector.js +9 -8
  68. package/src/util/client-hints-parser.js +1 -1
  69. package/src/util/component-utils.js +2 -2
  70. package/src/util/device-constants.js +2 -2
  71. package/src/util/key-codes.js +1 -1
  72. package/src/util/net.js +1 -1
  73. package/src/util/request-header-utils.js +6 -6
  74. package/src/util/user-agent-parser.js +5 -5
  75. package/src/util/validation-utils.js +2 -0
  76. package/src/util/window-utils.js +3 -3
@@ -10,67 +10,72 @@ import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
10
10
  import { STORAGE_KEYS as o } from "./storage-manager.js";
11
11
  import S from "../util/request-header-utils.js";
12
12
  import { LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT as Kt } from "../common/constants.js";
13
+ import { getAlias as Ht } from "./utils.js";
13
14
  export default class Rt {
14
- constructor(t, e, s, i, r, n, o, a, h, u, l, c) {
15
- (this.hn = t),
15
+ constructor(t, e, s, i, r, n, o, h, a, u, l, c) {
16
+ (this.on = t),
16
17
  (this.u = e),
17
18
  (this.Go = s),
18
19
  (this.wt = i),
19
20
  (this.di = r),
20
21
  (this.yt = n),
21
- (this.an = o),
22
- (this.Ko = a),
23
- (this.Wo = h),
22
+ (this.rn = o),
23
+ (this.Ko = h),
24
+ (this.Wo = a),
24
25
  (this.Vo = u),
25
26
  (this.appVersion = l),
26
- (this.Ra = c),
27
- (this.Ba = (t) => (null == t ? "" : `${t} `)),
28
- (this.hn = t),
27
+ (this.Xh = c),
28
+ (this.Hh = (t) => (null == t ? "" : `${t} `)),
29
+ (this.on = t),
29
30
  (this.u = e),
30
31
  (this.Go = s),
31
32
  (this.wt = i),
32
33
  (this.di = r),
33
34
  (this.yt = n),
34
- (this.an = o),
35
- (this.Ko = a),
36
- (this.Wo = h),
35
+ (this.rn = o),
36
+ (this.Ko = h),
37
+ (this.Wo = a),
37
38
  (this.Vo = u),
38
39
  (this.appVersion = l),
39
- (this.Ra = c),
40
- (this.Xa = ["npm"]);
40
+ (this.Xh = c),
41
+ (this.Yh = ["npm"]);
41
42
  }
42
43
  Ps(t, e = !1, s = !1) {
43
- const i = this.hn.ce(!s),
44
- r = i.Gr(),
45
- n = this.u.j(o.C.Ja);
44
+ const i = this.on.ce(!s),
45
+ r = i.Mr(),
46
+ n = this.u.j(o.C.Ga);
46
47
  ii(n, r) || (t.device = r),
47
- (t.api_key = this.an),
48
+ (t.api_key = this.rn),
48
49
  (t.time = h(new Date().valueOf(), !0));
49
- const a = this.u.j(o.C.Na) || [],
50
- u = this.u.j(o.C.$a) || "";
50
+ const a = this.u.j(o.C.Jh) || [],
51
+ u = this.u.j(o.C.Qh) || "";
51
52
  if (
52
- (this.Xa.length > 0 &&
53
- (!ii(a, this.Xa) || u !== this.di.ki()) &&
54
- (t.sdk_metadata = this.Xa),
53
+ (this.Yh.length > 0 &&
54
+ (!ii(a, this.Yh) || u !== this.di.ki()) &&
55
+ (t.sdk_metadata = this.Yh),
55
56
  (t.sdk_version = this.Wo),
56
57
  this.Vo && (t.sdk_flavor = this.Vo),
57
58
  (t.app_version = this.appVersion),
58
- (t.app_version_code = this.Ra),
59
+ (t.app_version_code = this.Xh),
59
60
  (t.device_id = i.id),
60
61
  e)
61
62
  ) {
62
63
  const e = this.wt.getUserId();
63
64
  null != e && (t.user_id = e);
64
65
  }
66
+ if (!t.user_id && !this.Go.Fh()) {
67
+ const e = Ht(this.u);
68
+ e && (t.alias = e);
69
+ }
65
70
  return t;
66
71
  }
67
72
  Ws(t, e, n) {
68
73
  const o = e.auth_error,
69
- a = e.error;
70
- if (!o && !a) return !0;
74
+ h = e.error;
75
+ if (!o && !h) return !0;
71
76
  if (o) {
72
77
  let e;
73
- this.Go.Gh();
78
+ this.Go.Bh();
74
79
  const s = { errorCode: o.error_code };
75
80
  for (const t of n)
76
81
  j(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]);
@@ -82,55 +87,55 @@ export default class Rt {
82
87
  i
83
88
  ? ((s.reason = i), (e = `due to ${i}`))
84
89
  : (e = `with error code ${o.error_code}.`),
85
- this.Go.fh() ||
90
+ this.Go.Fh() ||
86
91
  (e +=
87
92
  ' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
88
93
  r.error(`SDK Authentication failed ${e}`),
89
- this.Ea(t.events || [], t.attributes || []),
90
- this.Go.yh(s),
94
+ this.Zh(t.events || [], t.attributes || []),
95
+ this.Go.qh(s),
91
96
  !1
92
97
  );
93
98
  }
94
- if (a) {
99
+ if (h) {
95
100
  let n,
96
- o = a;
101
+ o = h;
97
102
  switch (o) {
98
- case qt.Ka:
103
+ case qt.Ra:
99
104
  return (
100
105
  (n = "Received successful response with empty body."),
101
106
  s.q(i.Ms, { e: n }),
102
107
  r.info(n),
103
108
  !1
104
109
  );
105
- case qt.La:
110
+ case qt.Ba:
106
111
  return (
107
112
  (n = "Received successful response with invalid JSON"),
108
113
  s.q(i.Ms, { e: n + ": " + e.response }),
109
114
  r.info(n),
110
115
  !1
111
116
  );
112
- case qt.Pa:
117
+ case qt.Xa:
113
118
  o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Ko}`;
114
119
  break;
115
- case qt.Ua:
120
+ case qt.Na:
116
121
  o =
117
122
  "Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
118
123
  break;
119
- case qt.Ha:
124
+ case qt.$a:
120
125
  o = "No device identifier. Please contact support@braze.com";
121
126
  }
122
127
  r.error("Backend error: " + o);
123
128
  }
124
129
  return !1;
125
130
  }
126
- Wa(t, e, s, i) {
131
+ Ea(t, e, s, i) {
127
132
  return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
128
133
  }
129
- Ya(t, e, s, i, r = !1) {
134
+ Ka(t, e, s, i, r = !1) {
130
135
  const n = [],
131
136
  o = (t) => t || "",
132
- a = o(this.wt.getUserId());
133
- let h = this._r(t, e);
137
+ h = o(this.wt.getUserId());
138
+ let a = this.Zi(t, e);
134
139
  const u = [],
135
140
  l = [];
136
141
  let c,
@@ -138,36 +143,36 @@ export default class Rt {
138
143
  if (s.length > 0) {
139
144
  const t = [];
140
145
  for (const e of s) {
141
- if (((c = e.Gr()), this.Go.fh())) {
142
- if (a && !c.user_id) {
146
+ if (((c = e.Mr()), this.Go.Fh())) {
147
+ if (h && !c.user_id) {
143
148
  d || (d = {}), d.events || (d.events = []), d.events.push(c);
144
149
  continue;
145
150
  }
146
- if (o(c.user_id) !== a) {
151
+ if (o(c.user_id) !== h) {
147
152
  l.push(c);
148
153
  continue;
149
154
  }
150
155
  }
151
156
  t.push(c);
152
157
  }
153
- t.length > 0 && (h.events = t);
158
+ t.length > 0 && (a.events = t);
154
159
  }
155
160
  if (i.length > 0) {
156
161
  const t = [];
157
162
  for (const e of i)
158
- e && (this.Go.fh() && o(e.user_id) !== a ? u.push(e) : t.push(e));
159
- t.length > 0 && (h.attributes = t);
163
+ e && (this.Go.Fh() && o(e.user_id) !== h ? u.push(e) : t.push(e));
164
+ t.length > 0 && (a.attributes = t);
160
165
  }
161
- if ((this.Ea(l, u), (h = this.Ps(h, !0, r)), d)) {
166
+ if ((this.Zh(l, u), (a = this.Ps(a, !0, r)), d)) {
162
167
  d = this.Ps(d, !1, r);
163
- const t = { requestData: d, headers: this._s(d, S.Gs.Qa) };
168
+ const t = { requestData: d, headers: this._s(d, S.Gs.La) };
164
169
  n.push(t);
165
170
  }
166
- if (h && !this.Wa(h.events, h.attributes, t, e)) return d ? n : null;
167
- const f = { requestData: h, headers: this._s(h, S.Gs.Qa) };
171
+ if (a && !this.Ea(a.events, a.attributes, t, e)) return d ? n : null;
172
+ const f = { requestData: a, headers: this._s(a, S.Gs.La) };
168
173
  return n.push(f), n;
169
174
  }
170
- Ea(t, e) {
175
+ Zh(t, e) {
171
176
  if (t) {
172
177
  const e = [];
173
178
  for (const s of t) {
@@ -176,87 +181,87 @@ export default class Rt {
176
181
  }
177
182
  this.u.zo(e);
178
183
  }
179
- if (e) for (const t of e) this.u.Va(t);
184
+ if (e) for (const t of e) this.u.Pa(t);
180
185
  }
181
186
  Zs(t, e) {
182
187
  let s = "HTTP error ";
183
188
  null != t && (s += t + " "), (s += e), r.error(s);
184
189
  }
185
190
  qr(t) {
186
- return s.q(i.Za, { n: t });
191
+ return s.q(i.Ua, { n: t });
187
192
  }
188
- _r(t, e, s) {
193
+ Zi(t, e, s) {
189
194
  const i = {};
190
195
  t && (i.feed = !0), e && (i.triggers = !0);
191
196
  const r = null != s ? s : this.wt.getUserId();
192
- return (
193
- r && (i.user_id = r),
194
- (i.config = { config_time: this.yt.ni() }),
195
- { respond_with: i }
196
- );
197
+ if ((r && (i.user_id = r), !i.user_id && !this.Go.Fh())) {
198
+ const t = Ht(this.u);
199
+ t && (i.alias = t);
200
+ }
201
+ return (i.config = { config_time: this.yt.ni() }), { respond_with: i };
197
202
  }
198
- Xh(t) {
203
+ Ha(t) {
199
204
  const e = new Date().valueOf();
200
205
  let s = Kt.toString();
201
- const i = S.Yh(this.u, t);
206
+ const i = S.Wa(this.u, t);
202
207
  if (-1 !== i) {
203
208
  s = (e - i).toString();
204
209
  }
205
210
  return s;
206
211
  }
207
212
  _s(t, e, s = !1) {
208
- const i = [["X-Braze-Api-Key", this.an]],
209
- r = this.Xh(e);
213
+ const i = [["X-Braze-Api-Key", this.rn]],
214
+ r = this.Ha(e);
210
215
  i.push(["X-Braze-Last-Req-Ms-Ago", r]);
211
- const n = S.Jh(this.u, e).toString();
216
+ const n = S.Ya(this.u, e).toString();
212
217
  i.push(["X-Braze-Req-Attempt", n]);
213
- let a = !1;
218
+ let h = !1;
214
219
  if (
215
220
  (null != t.respond_with &&
216
221
  t.respond_with.triggers &&
217
- (i.push(["X-Braze-TriggersRequest", "true"]), (a = !0)),
222
+ (i.push(["X-Braze-TriggersRequest", "true"]), (h = !0)),
218
223
  null != t.respond_with &&
219
224
  t.respond_with.feed &&
220
- (i.push(["X-Braze-FeedRequest", "true"]), (a = !0)),
225
+ (i.push(["X-Braze-FeedRequest", "true"]), (h = !0)),
221
226
  e === S.Gs.Bs)
222
227
  ) {
223
228
  i.push(["X-Braze-ContentCardsRequest", "true"]);
224
229
  let t = this.u.j(o.C.As);
225
230
  (t && s) || ((t = 0), this.u.k(o.C.As, t)),
226
231
  i.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),
227
- (a = !0);
232
+ (h = !0);
228
233
  }
229
234
  if (
230
235
  (e === S.Gs.qi &&
231
- (i.push(["X-Braze-FeatureFlagsRequest", "true"]), (a = !0)),
232
- a && i.push(["X-Braze-DataRequest", "true"]),
233
- this.Go.fh())
236
+ (i.push(["X-Braze-FeatureFlagsRequest", "true"]), (h = !0)),
237
+ h && i.push(["X-Braze-DataRequest", "true"]),
238
+ this.Go.Fh())
234
239
  ) {
235
- const t = this.Go.wh();
240
+ const t = this.Go.kh();
236
241
  null != t && i.push(["X-Braze-Auth-Signature", t]);
237
242
  }
238
243
  return i;
239
244
  }
240
- Qh(t, e, s, i) {
245
+ Qa(t, e, s, i) {
241
246
  window.setTimeout(() => {
242
- r.info(`Retrying rate limited ${this.Ba(i)}SDK request.`),
247
+ r.info(`Retrying rate limited ${this.Hh(i)}SDK request.`),
243
248
  this.Hs(e, s, i);
244
249
  }, t);
245
250
  }
246
251
  Hs(t, e, s) {
247
- const i = this.Zh();
248
- if (!i.au)
252
+ const i = this.Va();
253
+ if (!i.Za)
249
254
  return (
250
255
  r.info(
251
- `${this.Ba(
256
+ `${this.Hh(
252
257
  s,
253
258
  )}SDK request being rate limited. Request will be retried in ${Math.trunc(
254
- i.du / 1e3,
259
+ i.au / 1e3,
255
260
  )} seconds.`,
256
261
  ),
257
- void this.Qh(i.du, t, e, s)
262
+ void this.Qa(i.au, t, e, s)
258
263
  );
259
- this.u.k(o.C.fu, new Date().valueOf());
264
+ this.u.k(o.C.du, new Date().valueOf());
260
265
  const n = t.device;
261
266
  n && n.os_version instanceof Promise
262
267
  ? n.os_version.then((s) => {
@@ -266,33 +271,33 @@ export default class Rt {
266
271
  }
267
272
  li(t) {
268
273
  var e;
269
- null === (e = this.u) || void 0 === e || e.k(o.C.Ru, t);
274
+ null === (e = this.u) || void 0 === e || e.k(o.C.fu, t);
270
275
  }
271
276
  ui() {
272
277
  var t;
273
- return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ru);
278
+ return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.fu);
274
279
  }
275
- vu(t, e, s, i) {
280
+ Ru(t, e, s, i) {
276
281
  let r = this.ui();
277
282
  (null == r || isNaN(r)) && (r = e);
278
283
  const n = (t - i) / 1e3;
279
284
  return (r = Math.min(r + n / s, e)), r;
280
285
  }
281
- gu(t, e) {
286
+ vu(t, e) {
282
287
  return Math.max(0, (1 - t) * e * 1e3);
283
288
  }
284
- Zh() {
289
+ Va() {
285
290
  var t, e, s;
286
- const i = { au: !0, du: 0 },
287
- r = null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.fu);
291
+ const i = { Za: !0, au: 0 },
292
+ r = null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.du);
288
293
  if (null == r || isNaN(r)) return i;
289
294
  const n = (null === (e = this.yt) || void 0 === e ? void 0 : e.pu()) || -1,
290
- a = (null === (s = this.yt) || void 0 === s ? void 0 : s.qu()) || -1;
291
- if (-1 === n || -1 === a) return i;
292
- const h = new Date().valueOf();
293
- let u = this.vu(h, n, a, r);
295
+ h = (null === (s = this.yt) || void 0 === s ? void 0 : s.gu()) || -1;
296
+ if (-1 === n || -1 === h) return i;
297
+ const a = new Date().valueOf();
298
+ let u = this.Ru(a, n, h, r);
294
299
  return u < 1
295
- ? ((i.au = !1), (i.du = this.gu(u, a)), i)
300
+ ? ((i.Za = !1), (i.au = this.vu(u, h)), i)
296
301
  : ((u = Math.trunc(u) - 1), this.li(u), i);
297
302
  }
298
303
  Xs() {
@@ -302,6 +307,6 @@ export default class Rt {
302
307
  return this.Ko;
303
308
  }
304
309
  addSdkMetadata(t) {
305
- for (const e of t) -1 === this.Xa.indexOf(e) && this.Xa.push(e);
310
+ for (const e of t) -1 === this.Yh.indexOf(e) && this.Yh.push(e);
306
311
  }
307
312
  }
@@ -4,8 +4,8 @@ import Gt from "../models/server-config.js";
4
4
  import s from "../common/event-logger.js";
5
5
  import { EventTypes as i } from "../../shared-lib/index.js";
6
6
  import {
7
- CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as Vt,
8
- CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Ht,
7
+ CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as Jt,
8
+ CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Qt,
9
9
  } from "../common/constants.js";
10
10
  export default class Dt {
11
11
  constructor(t) {
@@ -20,7 +20,7 @@ export default class Dt {
20
20
  ll() {
21
21
  if (null == this.rl) {
22
22
  const t = this.u.j(o.C.hl);
23
- this.rl = null != t ? Gt.En(t) : new Gt();
23
+ this.rl = null != t ? Gt.qn(t) : new Gt();
24
24
  }
25
25
  return this.rl;
26
26
  }
@@ -44,7 +44,7 @@ export default class Dt {
44
44
  t(e.global_request_rate_limit),
45
45
  );
46
46
  let s = !1;
47
- null != i.cl && this.In() !== i.cl && (s = !0);
47
+ null != i.cl && this.Wn() !== i.cl && (s = !0);
48
48
  let r = !1;
49
49
  null != i.ml.enabled && this.ri() !== i.ml.enabled && (r = !0);
50
50
  let n = !1;
@@ -57,7 +57,7 @@ export default class Dt {
57
57
  }
58
58
  }
59
59
  }
60
- Vn(t) {
60
+ _n(t) {
61
61
  const e = this.tl.It(t);
62
62
  return this.sl && this.tl.removeSubscription(this.sl), (this.sl = e), e;
63
63
  }
@@ -79,7 +79,7 @@ export default class Dt {
79
79
  dl() {
80
80
  return this.ll().Cl;
81
81
  }
82
- In() {
82
+ Wn() {
83
83
  return this.ll().cl;
84
84
  }
85
85
  ri() {
@@ -92,12 +92,12 @@ export default class Dt {
92
92
  ci() {
93
93
  if (!this.Is()) return -1;
94
94
  const t = this.ll().ml.rate_limit;
95
- return null == t.capacity ? Vt : t.capacity <= 0 ? -1 : t.capacity;
95
+ return null == t.capacity ? Jt : t.capacity <= 0 ? -1 : t.capacity;
96
96
  }
97
97
  fi() {
98
98
  if (!this.Is()) return -1;
99
99
  const t = this.ll().ml.rate_limit;
100
- return null == t.refill_rate ? Ht : t.refill_rate <= 0 ? -1 : t.refill_rate;
100
+ return null == t.refill_rate ? Qt : t.refill_rate <= 0 ? -1 : t.refill_rate;
101
101
  }
102
102
  Rl() {
103
103
  const t = this.ll().al;
@@ -108,7 +108,7 @@ export default class Dt {
108
108
  const t = this.ll().al;
109
109
  return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
110
110
  }
111
- qu() {
111
+ gu() {
112
112
  if (!this.Rl()) return -1;
113
113
  const t = this.ll().al;
114
114
  return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;