@xpadev-net/niconicomments 0.2.71 → 0.2.73

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 (3) hide show
  1. package/dist/bundle.d.ts +228 -731
  2. package/dist/bundle.js +392 -366
  3. package/package.json +25 -35
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.71
2
+ niconicomments.js v0.2.73
3
3
  (c) 2021 xpadev-net https://xpadev.net
4
4
  Released under the MIT License.
5
5
  */
@@ -133,7 +133,8 @@
133
133
  NotImplementedError: NotImplementedError
134
134
  });
135
135
 
136
- const arrayPush = (array, key, push) => {
136
+ const arrayPush = (_array, key, push) => {
137
+ let array = _array;
137
138
  if (!array) {
138
139
  array = {};
139
140
  }
@@ -152,7 +153,8 @@
152
153
  return true;
153
154
  };
154
155
 
155
- const hex2rgb = (hex) => {
156
+ const hex2rgb = (_hex) => {
157
+ let hex = _hex;
156
158
  if (hex.startsWith("#"))
157
159
  hex = hex.slice(1);
158
160
  if (hex.length === 3)
@@ -163,11 +165,10 @@
163
165
  hex.slice(1, 2) +
164
166
  hex.slice(2, 3) +
165
167
  hex.slice(2, 3);
166
- return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map(function (str) {
167
- return parseInt(str, 16);
168
- });
168
+ return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => Number.parseInt(str, 16));
169
169
  };
170
- const hex2rgba = (hex) => {
170
+ const hex2rgba = (_hex) => {
171
+ let hex = _hex;
171
172
  if (hex.startsWith("#"))
172
173
  hex = hex.slice(1);
173
174
  if (hex.length === 4)
@@ -187,8 +188,8 @@
187
188
  hex.slice(4, 6),
188
189
  ].map((str, index) => {
189
190
  if (index === 3)
190
- return parseInt(str, 16) / 256;
191
- return parseInt(str, 16);
191
+ return Number.parseInt(str, 16) / 256;
192
+ return Number.parseInt(str, 16);
192
193
  });
193
194
  };
194
195
  const getStrokeColor = (comment) => {
@@ -198,7 +199,7 @@
198
199
  if (length === 3 || length === 6) {
199
200
  return `rgba(${hex2rgb(color).join(",")},${config.contextStrokeOpacity})`;
200
201
  }
201
- else if (length === 4 || length === 8) {
202
+ if (length === 4 || length === 8) {
202
203
  return `rgba(${hex2rgba(color).join(",")})`;
203
204
  }
204
205
  }
@@ -207,9 +208,27 @@
207
208
  : config.contextStrokeColor).join(",")},${config.contextStrokeOpacity})`;
208
209
  };
209
210
 
211
+ function _arrayLikeToArray(r, a) {
212
+ (null == a || a > r.length) && (a = r.length);
213
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
214
+ return n;
215
+ }
216
+ function _arrayWithHoles(r) {
217
+ if (Array.isArray(r)) return r;
218
+ }
219
+ function _arrayWithoutHoles(r) {
220
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
221
+ }
222
+ function _assertThisInitialized(e) {
223
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
224
+ return e;
225
+ }
210
226
  function _callSuper(t, o, e) {
211
227
  return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
212
228
  }
229
+ function _classCallCheck(a, n) {
230
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
231
+ }
213
232
  function _construct(t, e, r) {
214
233
  if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
215
234
  var o = [null];
@@ -217,6 +236,91 @@
217
236
  var p = new (t.bind.apply(t, o))();
218
237
  return r && _setPrototypeOf(p, r.prototype), p;
219
238
  }
239
+ function _createClass(e, r, t) {
240
+ return Object.defineProperty(e, "prototype", {
241
+ writable: !1
242
+ }), e;
243
+ }
244
+ function _createForOfIteratorHelper(r, e) {
245
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
246
+ if (!t) {
247
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
248
+ t && (r = t);
249
+ var n = 0,
250
+ F = function () {};
251
+ return {
252
+ s: F,
253
+ n: function () {
254
+ return n >= r.length ? {
255
+ done: !0
256
+ } : {
257
+ done: !1,
258
+ value: r[n++]
259
+ };
260
+ },
261
+ e: function (r) {
262
+ throw r;
263
+ },
264
+ f: F
265
+ };
266
+ }
267
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
268
+ }
269
+ var o,
270
+ a = !0,
271
+ u = !1;
272
+ return {
273
+ s: function () {
274
+ t = t.call(r);
275
+ },
276
+ n: function () {
277
+ var r = t.next();
278
+ return a = r.done, r;
279
+ },
280
+ e: function (r) {
281
+ u = !0, o = r;
282
+ },
283
+ f: function () {
284
+ try {
285
+ a || null == t.return || t.return();
286
+ } finally {
287
+ if (u) throw o;
288
+ }
289
+ }
290
+ };
291
+ }
292
+ function _defineProperty(e, r, t) {
293
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
294
+ value: t,
295
+ enumerable: !0,
296
+ configurable: !0,
297
+ writable: !0
298
+ }) : e[r] = t, e;
299
+ }
300
+ function _getPrototypeOf(t) {
301
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
302
+ return t.__proto__ || Object.getPrototypeOf(t);
303
+ }, _getPrototypeOf(t);
304
+ }
305
+ function _inherits(t, e) {
306
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
307
+ t.prototype = Object.create(e && e.prototype, {
308
+ constructor: {
309
+ value: t,
310
+ writable: !0,
311
+ configurable: !0
312
+ }
313
+ }), Object.defineProperty(t, "prototype", {
314
+ writable: !1
315
+ }), e && _setPrototypeOf(t, e);
316
+ }
317
+ function _isNativeFunction(t) {
318
+ try {
319
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
320
+ } catch (n) {
321
+ return "function" == typeof t;
322
+ }
323
+ }
220
324
  function _isNativeReflectConstruct() {
221
325
  try {
222
326
  var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
@@ -225,6 +329,9 @@
225
329
  return !!t;
226
330
  })();
227
331
  }
332
+ function _iterableToArray(r) {
333
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
334
+ }
228
335
  function _iterableToArrayLimit(r, l) {
229
336
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
230
337
  if (null != t) {
@@ -252,6 +359,12 @@
252
359
  return a;
253
360
  }
254
361
  }
362
+ function _nonIterableRest() {
363
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
364
+ }
365
+ function _nonIterableSpread() {
366
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
367
+ }
255
368
  function ownKeys(e, r) {
256
369
  var t = Object.keys(e);
257
370
  if (Object.getOwnPropertySymbols) {
@@ -273,6 +386,22 @@
273
386
  }
274
387
  return e;
275
388
  }
389
+ function _possibleConstructorReturn(t, e) {
390
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
391
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
392
+ return _assertThisInitialized(t);
393
+ }
394
+ function _setPrototypeOf(t, e) {
395
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
396
+ return t.__proto__ = e, t;
397
+ }, _setPrototypeOf(t, e);
398
+ }
399
+ function _slicedToArray(r, e) {
400
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
401
+ }
402
+ function _toConsumableArray(r) {
403
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
404
+ }
276
405
  function _toPrimitive(t, r) {
277
406
  if ("object" != typeof t || !t) return t;
278
407
  var e = t[Symbol.toPrimitive];
@@ -285,7 +414,7 @@
285
414
  }
286
415
  function _toPropertyKey(t) {
287
416
  var i = _toPrimitive(t, "string");
288
- return "symbol" == typeof i ? i : String(i);
417
+ return "symbol" == typeof i ? i : i + "";
289
418
  }
290
419
  function _typeof(o) {
291
420
  "@babel/helpers - typeof";
@@ -296,207 +425,38 @@
296
425
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
297
426
  }, _typeof(o);
298
427
  }
299
- function _classCallCheck(instance, Constructor) {
300
- if (!(instance instanceof Constructor)) {
301
- throw new TypeError("Cannot call a class as a function");
302
- }
303
- }
304
- function _defineProperties(target, props) {
305
- for (var i = 0; i < props.length; i++) {
306
- var descriptor = props[i];
307
- descriptor.enumerable = descriptor.enumerable || false;
308
- descriptor.configurable = true;
309
- if ("value" in descriptor) descriptor.writable = true;
310
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
311
- }
312
- }
313
- function _createClass(Constructor, protoProps, staticProps) {
314
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
315
- if (staticProps) _defineProperties(Constructor, staticProps);
316
- Object.defineProperty(Constructor, "prototype", {
317
- writable: false
318
- });
319
- return Constructor;
320
- }
321
- function _defineProperty(obj, key, value) {
322
- key = _toPropertyKey(key);
323
- if (key in obj) {
324
- Object.defineProperty(obj, key, {
325
- value: value,
326
- enumerable: true,
327
- configurable: true,
328
- writable: true
329
- });
330
- } else {
331
- obj[key] = value;
428
+ function _unsupportedIterableToArray(r, a) {
429
+ if (r) {
430
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
431
+ var t = {}.toString.call(r).slice(8, -1);
432
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
332
433
  }
333
- return obj;
334
434
  }
335
- function _inherits(subClass, superClass) {
336
- if (typeof superClass !== "function" && superClass !== null) {
337
- throw new TypeError("Super expression must either be null or a function");
338
- }
339
- subClass.prototype = Object.create(superClass && superClass.prototype, {
340
- constructor: {
341
- value: subClass,
342
- writable: true,
343
- configurable: true
344
- }
345
- });
346
- Object.defineProperty(subClass, "prototype", {
347
- writable: false
348
- });
349
- if (superClass) _setPrototypeOf(subClass, superClass);
350
- }
351
- function _getPrototypeOf(o) {
352
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
353
- return o.__proto__ || Object.getPrototypeOf(o);
354
- };
355
- return _getPrototypeOf(o);
356
- }
357
- function _setPrototypeOf(o, p) {
358
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
359
- o.__proto__ = p;
360
- return o;
361
- };
362
- return _setPrototypeOf(o, p);
363
- }
364
- function _isNativeFunction(fn) {
365
- try {
366
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
367
- } catch (e) {
368
- return typeof fn === "function";
369
- }
370
- }
371
- function _wrapNativeSuper(Class) {
372
- var _cache = typeof Map === "function" ? new Map() : undefined;
373
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
374
- if (Class === null || !_isNativeFunction(Class)) return Class;
375
- if (typeof Class !== "function") {
376
- throw new TypeError("Super expression must either be null or a function");
377
- }
378
- if (typeof _cache !== "undefined") {
379
- if (_cache.has(Class)) return _cache.get(Class);
380
- _cache.set(Class, Wrapper);
435
+ function _wrapNativeSuper(t) {
436
+ var r = "function" == typeof Map ? new Map() : void 0;
437
+ return _wrapNativeSuper = function (t) {
438
+ if (null === t || !_isNativeFunction(t)) return t;
439
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
440
+ if (void 0 !== r) {
441
+ if (r.has(t)) return r.get(t);
442
+ r.set(t, Wrapper);
381
443
  }
382
444
  function Wrapper() {
383
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
445
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
384
446
  }
385
- Wrapper.prototype = Object.create(Class.prototype, {
447
+ return Wrapper.prototype = Object.create(t.prototype, {
386
448
  constructor: {
387
449
  value: Wrapper,
388
- enumerable: false,
389
- writable: true,
390
- configurable: true
450
+ enumerable: !1,
451
+ writable: !0,
452
+ configurable: !0
391
453
  }
392
- });
393
- return _setPrototypeOf(Wrapper, Class);
394
- };
395
- return _wrapNativeSuper(Class);
396
- }
397
- function _assertThisInitialized(self) {
398
- if (self === void 0) {
399
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
400
- }
401
- return self;
402
- }
403
- function _possibleConstructorReturn(self, call) {
404
- if (call && (typeof call === "object" || typeof call === "function")) {
405
- return call;
406
- } else if (call !== void 0) {
407
- throw new TypeError("Derived constructors may only return object or undefined");
408
- }
409
- return _assertThisInitialized(self);
410
- }
411
- function _slicedToArray(arr, i) {
412
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
413
- }
414
- function _toConsumableArray(arr) {
415
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
416
- }
417
- function _arrayWithoutHoles(arr) {
418
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
419
- }
420
- function _arrayWithHoles(arr) {
421
- if (Array.isArray(arr)) return arr;
422
- }
423
- function _iterableToArray(iter) {
424
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
425
- }
426
- function _unsupportedIterableToArray(o, minLen) {
427
- if (!o) return;
428
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
429
- var n = Object.prototype.toString.call(o).slice(8, -1);
430
- if (n === "Object" && o.constructor) n = o.constructor.name;
431
- if (n === "Map" || n === "Set") return Array.from(o);
432
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
433
- }
434
- function _arrayLikeToArray(arr, len) {
435
- if (len == null || len > arr.length) len = arr.length;
436
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
437
- return arr2;
438
- }
439
- function _nonIterableSpread() {
440
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
441
- }
442
- function _nonIterableRest() {
443
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
444
- }
445
- function _createForOfIteratorHelper(o, allowArrayLike) {
446
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
447
- if (!it) {
448
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
449
- if (it) o = it;
450
- var i = 0;
451
- var F = function () {};
452
- return {
453
- s: F,
454
- n: function () {
455
- if (i >= o.length) return {
456
- done: true
457
- };
458
- return {
459
- done: false,
460
- value: o[i++]
461
- };
462
- },
463
- e: function (e) {
464
- throw e;
465
- },
466
- f: F
467
- };
468
- }
469
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
470
- }
471
- var normalCompletion = true,
472
- didErr = false,
473
- err;
474
- return {
475
- s: function () {
476
- it = it.call(o);
477
- },
478
- n: function () {
479
- var step = it.next();
480
- normalCompletion = step.done;
481
- return step;
482
- },
483
- e: function (e) {
484
- didErr = true;
485
- err = e;
486
- },
487
- f: function () {
488
- try {
489
- if (!normalCompletion && it.return != null) it.return();
490
- } finally {
491
- if (didErr) throw err;
492
- }
493
- }
494
- };
454
+ }), _setPrototypeOf(Wrapper, t);
455
+ }, _wrapNativeSuper(t);
495
456
  }
496
457
 
497
458
  // src/error/ValiError/ValiError.ts
498
459
  var ValiError = /*#__PURE__*/function (_Error) {
499
- _inherits(ValiError, _Error);
500
460
  /**
501
461
  * Creates a Valibot error with useful information.
502
462
  *
@@ -506,13 +466,14 @@
506
466
  var _this;
507
467
  _classCallCheck(this, ValiError);
508
468
  _this = _callSuper(this, ValiError, [issues[0].message]);
509
- _defineProperty(_assertThisInitialized(_this), "issues", void 0);
469
+ _defineProperty(_this, "issues", void 0);
510
470
  _this.name = "ValiError";
511
471
  _this.issues = issues;
512
472
  return _this;
513
473
  }
474
+ _inherits(ValiError, _Error);
514
475
  return _createClass(ValiError);
515
- }( /*#__PURE__*/_wrapNativeSuper(Error));
476
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
516
477
 
517
478
  // src/utils/actionIssue/actionIssue.ts
518
479
  function actionIssue(context, reference, input, label, received) {
@@ -574,9 +535,9 @@
574
535
  }
575
536
 
576
537
  // src/utils/i18n/i18n.ts
577
- function i18n(context, reference, config, issue) {
538
+ function i18n(schema, context, reference, config, issue) {
578
539
  var _ref3, _ref4, _ref5, _ref6, _context$message;
579
- var message = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_context$message = context.message) !== null && _context$message !== void 0 ? _context$message : getSpecificMessage(reference, issue.lang)) !== null && _ref6 !== void 0 ? _ref6 : context.type === "type" ? getSchemaMessage(issue.lang) : null) !== null && _ref5 !== void 0 ? _ref5 : config === null || config === void 0 ? void 0 : config.message) !== null && _ref4 !== void 0 ? _ref4 : getGlobalMessage(issue.lang)) !== null && _ref3 !== void 0 ? _ref3 : issue.message;
540
+ var message = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_context$message = context.message) !== null && _context$message !== void 0 ? _context$message : getSpecificMessage(reference, issue.lang)) !== null && _ref6 !== void 0 ? _ref6 : schema ? getSchemaMessage(issue.lang) : null) !== null && _ref5 !== void 0 ? _ref5 : config === null || config === void 0 ? void 0 : config.message) !== null && _ref4 !== void 0 ? _ref4 : getGlobalMessage(issue.lang)) !== null && _ref3 !== void 0 ? _ref3 : issue.message;
580
541
  return typeof message === "function" ? message(issue) : message;
581
542
  }
582
543
 
@@ -616,7 +577,7 @@
616
577
  abortPipeEarly: config === null || config === void 0 ? void 0 : config.abortPipeEarly,
617
578
  skipPipe: config === null || config === void 0 ? void 0 : config.skipPipe
618
579
  };
619
- schemaIssue2.message = i18n(issue.context, issue.reference, config, schemaIssue2);
580
+ schemaIssue2.message = i18n(false, issue.context, issue.reference, config, schemaIssue2);
620
581
  return schemaIssue2;
621
582
  }
622
583
 
@@ -692,7 +653,7 @@
692
653
  abortPipeEarly: config === null || config === void 0 ? void 0 : config.abortPipeEarly,
693
654
  skipPipe: config === null || config === void 0 ? void 0 : config.skipPipe
694
655
  };
695
- issue.message = i18n(context, reference, config, issue);
656
+ issue.message = i18n(true, context, reference, config, issue);
696
657
  return {
697
658
  typed: false,
698
659
  output: input,
@@ -986,10 +947,10 @@
986
947
 
987
948
  // src/schemas/number/number.ts
988
949
  function number(arg1, arg2) {
989
- var _defaultArgs35 = defaultArgs(arg1, arg2),
990
- _defaultArgs36 = _slicedToArray(_defaultArgs35, 2),
991
- message = _defaultArgs36[0],
992
- pipe = _defaultArgs36[1];
950
+ var _defaultArgs37 = defaultArgs(arg1, arg2),
951
+ _defaultArgs38 = _slicedToArray(_defaultArgs37, 2),
952
+ message = _defaultArgs38[0],
953
+ pipe = _defaultArgs38[1];
993
954
  return {
994
955
  type: "number",
995
956
  expects: "number",
@@ -1028,29 +989,29 @@
1028
989
  var typed = true;
1029
990
  var issues;
1030
991
  var output = {};
1031
- var _iterator15 = _createForOfIteratorHelper(cachedEntries),
1032
- _step15;
992
+ var _iterator16 = _createForOfIteratorHelper(cachedEntries),
993
+ _step16;
1033
994
  try {
1034
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
1035
- var _step15$value = _slicedToArray(_step15.value, 2),
1036
- _key3 = _step15$value[0],
1037
- schema = _step15$value[1];
1038
- var _value = input[_key3];
995
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
996
+ var _step16$value = _slicedToArray(_step16.value, 2),
997
+ _key = _step16$value[0],
998
+ schema = _step16$value[1];
999
+ var _value = input[_key];
1039
1000
  var _result3 = schema._parse(_value, config);
1040
1001
  if (_result3.issues) {
1041
1002
  var _pathItem3 = {
1042
1003
  type: "object",
1043
1004
  origin: "value",
1044
1005
  input: input,
1045
- key: _key3,
1006
+ key: _key,
1046
1007
  value: _value
1047
1008
  };
1048
- var _iterator17 = _createForOfIteratorHelper(_result3.issues),
1049
- _step17;
1009
+ var _iterator18 = _createForOfIteratorHelper(_result3.issues),
1010
+ _step18;
1050
1011
  try {
1051
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1012
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1052
1013
  var _issues7;
1053
- var _issue2 = _step17.value;
1014
+ var _issue2 = _step18.value;
1054
1015
  if (_issue2.path) {
1055
1016
  _issue2.path.unshift(_pathItem3);
1056
1017
  } else {
@@ -1059,9 +1020,9 @@
1059
1020
  (_issues7 = issues) === null || _issues7 === void 0 || _issues7.push(_issue2);
1060
1021
  }
1061
1022
  } catch (err) {
1062
- _iterator17.e(err);
1023
+ _iterator18.e(err);
1063
1024
  } finally {
1064
- _iterator17.f();
1025
+ _iterator18.f();
1065
1026
  }
1066
1027
  if (!issues) {
1067
1028
  issues = _result3.issues;
@@ -1074,14 +1035,14 @@
1074
1035
  if (!_result3.typed) {
1075
1036
  typed = false;
1076
1037
  }
1077
- if (_result3.output !== void 0 || _key3 in input) {
1078
- output[_key3] = _result3.output;
1038
+ if (_result3.output !== void 0 || _key in input) {
1039
+ output[_key] = _result3.output;
1079
1040
  }
1080
1041
  }
1081
1042
  } catch (err) {
1082
- _iterator15.e(err);
1043
+ _iterator16.e(err);
1083
1044
  } finally {
1084
- _iterator15.f();
1045
+ _iterator16.f();
1085
1046
  }
1086
1047
  if (this.rest && !(config !== null && config !== void 0 && config.abortEarly && issues)) {
1087
1048
  for (var key in input) {
@@ -1096,12 +1057,12 @@
1096
1057
  key: key,
1097
1058
  value: value2
1098
1059
  };
1099
- var _iterator16 = _createForOfIteratorHelper(result.issues),
1100
- _step16;
1060
+ var _iterator17 = _createForOfIteratorHelper(result.issues),
1061
+ _step17;
1101
1062
  try {
1102
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1063
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1103
1064
  var _issues6;
1104
- var issue = _step16.value;
1065
+ var issue = _step17.value;
1105
1066
  if (issue.path) {
1106
1067
  issue.path.unshift(pathItem);
1107
1068
  } else {
@@ -1110,9 +1071,9 @@
1110
1071
  (_issues6 = issues) === null || _issues6 === void 0 || _issues6.push(issue);
1111
1072
  }
1112
1073
  } catch (err) {
1113
- _iterator16.e(err);
1074
+ _iterator17.e(err);
1114
1075
  } finally {
1115
- _iterator16.f();
1076
+ _iterator17.f();
1116
1077
  }
1117
1078
  if (!issues) {
1118
1079
  issues = result.issues;
@@ -1162,10 +1123,10 @@
1162
1123
 
1163
1124
  // src/schemas/string/string.ts
1164
1125
  function string(arg1, arg2) {
1165
- var _defaultArgs39 = defaultArgs(arg1, arg2),
1166
- _defaultArgs40 = _slicedToArray(_defaultArgs39, 2),
1167
- message = _defaultArgs40[0],
1168
- pipe = _defaultArgs40[1];
1126
+ var _defaultArgs41 = defaultArgs(arg1, arg2),
1127
+ _defaultArgs42 = _slicedToArray(_defaultArgs41, 2),
1128
+ message = _defaultArgs42[0],
1129
+ pipe = _defaultArgs42[1];
1169
1130
  return {
1170
1131
  type: "string",
1171
1132
  expects: "string",
@@ -1184,16 +1145,16 @@
1184
1145
  // src/schemas/record/utils/recordArgs/recordArgs.ts
1185
1146
  function recordArgs(arg1, arg2, arg3, arg4) {
1186
1147
  if (_typeof(arg2) === "object" && !Array.isArray(arg2)) {
1187
- var _defaultArgs43 = defaultArgs(arg3, arg4),
1188
- _defaultArgs44 = _slicedToArray(_defaultArgs43, 2),
1189
- message2 = _defaultArgs44[0],
1190
- pipe2 = _defaultArgs44[1];
1148
+ var _defaultArgs45 = defaultArgs(arg3, arg4),
1149
+ _defaultArgs46 = _slicedToArray(_defaultArgs45, 2),
1150
+ message2 = _defaultArgs46[0],
1151
+ pipe2 = _defaultArgs46[1];
1191
1152
  return [arg1, arg2, message2, pipe2];
1192
1153
  }
1193
- var _defaultArgs45 = defaultArgs(arg2, arg3),
1194
- _defaultArgs46 = _slicedToArray(_defaultArgs45, 2),
1195
- message = _defaultArgs46[0],
1196
- pipe = _defaultArgs46[1];
1154
+ var _defaultArgs47 = defaultArgs(arg2, arg3),
1155
+ _defaultArgs48 = _slicedToArray(_defaultArgs47, 2),
1156
+ message = _defaultArgs48[0],
1157
+ pipe = _defaultArgs48[1];
1197
1158
  return [string(), arg1, message, pipe];
1198
1159
  }
1199
1160
 
@@ -1236,19 +1197,19 @@
1236
1197
  key: inputKey,
1237
1198
  value: inputValue
1238
1199
  };
1239
- var _iterator20 = _createForOfIteratorHelper(keyResult.issues),
1240
- _step20;
1200
+ var _iterator21 = _createForOfIteratorHelper(keyResult.issues),
1201
+ _step21;
1241
1202
  try {
1242
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1203
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1243
1204
  var _issues10;
1244
- var issue = _step20.value;
1205
+ var issue = _step21.value;
1245
1206
  issue.path = [pathItem];
1246
1207
  (_issues10 = issues) === null || _issues10 === void 0 || _issues10.push(issue);
1247
1208
  }
1248
1209
  } catch (err) {
1249
- _iterator20.e(err);
1210
+ _iterator21.e(err);
1250
1211
  } finally {
1251
- _iterator20.f();
1212
+ _iterator21.f();
1252
1213
  }
1253
1214
  if (!issues) {
1254
1215
  issues = keyResult.issues;
@@ -1268,12 +1229,12 @@
1268
1229
  key: inputKey,
1269
1230
  value: inputValue
1270
1231
  };
1271
- var _iterator21 = _createForOfIteratorHelper(valueResult.issues),
1272
- _step21;
1232
+ var _iterator22 = _createForOfIteratorHelper(valueResult.issues),
1233
+ _step22;
1273
1234
  try {
1274
- for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1235
+ for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
1275
1236
  var _issues11;
1276
- var _issue3 = _step21.value;
1237
+ var _issue3 = _step22.value;
1277
1238
  if (_issue3.path) {
1278
1239
  _issue3.path.unshift(pathItem);
1279
1240
  } else {
@@ -1282,9 +1243,9 @@
1282
1243
  (_issues11 = issues) === null || _issues11 === void 0 || _issues11.push(_issue3);
1283
1244
  }
1284
1245
  } catch (err) {
1285
- _iterator21.e(err);
1246
+ _iterator22.e(err);
1286
1247
  } finally {
1287
- _iterator21.f();
1248
+ _iterator22.f();
1288
1249
  }
1289
1250
  if (!issues) {
1290
1251
  issues = valueResult.issues;
@@ -1316,32 +1277,32 @@
1316
1277
  function subissues(results) {
1317
1278
  var issues;
1318
1279
  if (results) {
1319
- var _iterator30 = _createForOfIteratorHelper(results),
1320
- _step30;
1280
+ var _iterator31 = _createForOfIteratorHelper(results),
1281
+ _step31;
1321
1282
  try {
1322
- for (_iterator30.s(); !(_step30 = _iterator30.n()).done;) {
1323
- var result = _step30.value;
1283
+ for (_iterator31.s(); !(_step31 = _iterator31.n()).done;) {
1284
+ var result = _step31.value;
1324
1285
  if (issues) {
1325
- var _iterator31 = _createForOfIteratorHelper(result.issues),
1326
- _step31;
1286
+ var _iterator32 = _createForOfIteratorHelper(result.issues),
1287
+ _step32;
1327
1288
  try {
1328
- for (_iterator31.s(); !(_step31 = _iterator31.n()).done;) {
1329
- var issue = _step31.value;
1289
+ for (_iterator32.s(); !(_step32 = _iterator32.n()).done;) {
1290
+ var issue = _step32.value;
1330
1291
  issues.push(issue);
1331
1292
  }
1332
1293
  } catch (err) {
1333
- _iterator31.e(err);
1294
+ _iterator32.e(err);
1334
1295
  } finally {
1335
- _iterator31.f();
1296
+ _iterator32.f();
1336
1297
  }
1337
1298
  } else {
1338
1299
  issues = result.issues;
1339
1300
  }
1340
1301
  }
1341
1302
  } catch (err) {
1342
- _iterator30.e(err);
1303
+ _iterator31.e(err);
1343
1304
  } finally {
1344
- _iterator30.f();
1305
+ _iterator31.f();
1345
1306
  }
1346
1307
  }
1347
1308
  return issues;
@@ -1349,10 +1310,10 @@
1349
1310
 
1350
1311
  // src/schemas/union/union.ts
1351
1312
  function union(options, arg2, arg3) {
1352
- var _defaultArgs55 = defaultArgs(arg2, arg3),
1353
- _defaultArgs56 = _slicedToArray(_defaultArgs55, 2),
1354
- message = _defaultArgs56[0],
1355
- pipe = _defaultArgs56[1];
1313
+ var _defaultArgs57 = defaultArgs(arg2, arg3),
1314
+ _defaultArgs58 = _slicedToArray(_defaultArgs57, 2),
1315
+ message = _defaultArgs58[0],
1316
+ pipe = _defaultArgs58[1];
1356
1317
  return {
1357
1318
  type: "union",
1358
1319
  expects: _toConsumableArray(new Set(options.map(function (option) {
@@ -1367,11 +1328,11 @@
1367
1328
  var validResult;
1368
1329
  var untypedResults;
1369
1330
  var typedResults;
1370
- var _iterator32 = _createForOfIteratorHelper(this.options),
1371
- _step32;
1331
+ var _iterator33 = _createForOfIteratorHelper(this.options),
1332
+ _step33;
1372
1333
  try {
1373
- for (_iterator32.s(); !(_step32 = _iterator32.n()).done;) {
1374
- var schema = _step32.value;
1334
+ for (_iterator33.s(); !(_step33 = _iterator33.n()).done;) {
1335
+ var schema = _step33.value;
1375
1336
  var result = schema._parse(input, config);
1376
1337
  if (result.typed) {
1377
1338
  if (!result.issues) {
@@ -1385,9 +1346,9 @@
1385
1346
  }
1386
1347
  }
1387
1348
  } catch (err) {
1388
- _iterator32.e(err);
1349
+ _iterator33.e(err);
1389
1350
  } finally {
1390
- _iterator32.f();
1351
+ _iterator33.f();
1391
1352
  }
1392
1353
  if (validResult) {
1393
1354
  return pipeResult(this, validResult.output, config);
@@ -1433,10 +1394,10 @@
1433
1394
  rest = _restAndDefaultArgs14[0],
1434
1395
  message = _restAndDefaultArgs14[1],
1435
1396
  pipe = _restAndDefaultArgs14[2];
1436
- return object(Object.entries(schema.entries).reduce(function (entries, _ref28) {
1437
- var _ref29 = _slicedToArray(_ref28, 2),
1438
- key = _ref29[0],
1439
- schema2 = _ref29[1];
1397
+ return object(Object.entries(schema.entries).reduce(function (entries, _ref33) {
1398
+ var _ref34 = _slicedToArray(_ref33, 2),
1399
+ key = _ref34[0],
1400
+ schema2 = _ref34[1];
1440
1401
  return keys.includes(key) ? entries : _objectSpread2(_objectSpread2({}, entries), {}, _defineProperty({}, key, schema2));
1441
1402
  }, {}), rest, message, pipe);
1442
1403
  }
@@ -1456,9 +1417,7 @@
1456
1417
  return {
1457
1418
  typed: result.typed,
1458
1419
  success: !result.issues,
1459
- data: result.output,
1460
1420
  output: result.output,
1461
- error: result.issues && new ValiError(result.issues),
1462
1421
  issues: result.issues
1463
1422
  };
1464
1423
  }
@@ -1920,7 +1879,10 @@
1920
1879
  };
1921
1880
  const getDefaultCommand = (vpos) => {
1922
1881
  nicoScripts.default = nicoScripts.default.filter((item) => !item.long || item.start + item.long >= vpos);
1923
- let color = undefined, size = undefined, font = undefined, loc = undefined;
1882
+ let color = undefined;
1883
+ let size = undefined;
1884
+ let font = undefined;
1885
+ let loc = undefined;
1924
1886
  for (const item of nicoScripts.default) {
1925
1887
  if (item.loc) {
1926
1888
  loc = item.loc;
@@ -1959,10 +1921,18 @@
1959
1921
  else {
1960
1922
  comment.content = item.replace;
1961
1923
  }
1962
- item.loc && (commands.loc = item.loc);
1963
- item.color && (commands.color = item.color);
1964
- item.size && (commands.size = item.size);
1965
- item.font && (commands.font = item.font);
1924
+ if (item.loc) {
1925
+ commands.loc = item.loc;
1926
+ }
1927
+ if (item.color) {
1928
+ commands.color = item.color;
1929
+ }
1930
+ if (item.size) {
1931
+ commands.size = item.size;
1932
+ }
1933
+ if (item.font) {
1934
+ commands.font = item.font;
1935
+ }
1966
1936
  }
1967
1937
  };
1968
1938
  const parseCommandAndNicoScript = (comment) => {
@@ -1991,8 +1961,11 @@
1991
1961
  };
1992
1962
  };
1993
1963
  const parseBrackets = (input) => {
1994
- const content = input.split(""), result = [];
1995
- let quote = "", lastChar = "", string = "";
1964
+ const content = input.split("");
1965
+ const result = [];
1966
+ let quote = "";
1967
+ let lastChar = "";
1968
+ let string = "";
1996
1969
  for (const i of content) {
1997
1970
  if (RegExp(/^["'\u300c]$/).exec(i) && quote === "") {
1998
1971
  quote = i;
@@ -2169,7 +2142,8 @@
2169
2142
  };
2170
2143
  };
2171
2144
  const parseCommands = (comment) => {
2172
- const commands = comment.mail, isFlash = isFlashComment(comment);
2145
+ const commands = comment.mail;
2146
+ const isFlash = isFlashComment(comment);
2173
2147
  const result = {
2174
2148
  loc: undefined,
2175
2149
  size: undefined,
@@ -2247,7 +2221,7 @@
2247
2221
  if (typeGuard.comment.color(value)) {
2248
2222
  return colors[value];
2249
2223
  }
2250
- else if (typeGuard.comment.colorCodeAllowAlpha(value)) {
2224
+ if (typeGuard.comment.colorCodeAllowAlpha(value)) {
2251
2225
  return value;
2252
2226
  }
2253
2227
  return;
@@ -2281,6 +2255,8 @@
2281
2255
  const posY = lazy ? -1 : getFixedPosY(comment, collision);
2282
2256
  for (let j = 0; j < comment.long; j++) {
2283
2257
  const vpos = comment.vpos + j;
2258
+ if (timeline[vpos]?.includes(comment))
2259
+ continue;
2284
2260
  arrayPush(timeline, vpos, comment);
2285
2261
  if (j > comment.long - 20)
2286
2262
  continue;
@@ -2295,7 +2271,7 @@
2295
2271
  const vpos = comment.vpos + j;
2296
2272
  const leftPos = getPosX(comment.comment, vpos);
2297
2273
  if (timeline[vpos]?.includes(comment))
2298
- break;
2274
+ continue;
2299
2275
  arrayPush(timeline, vpos, comment);
2300
2276
  if (leftPos + comment.width + config.collisionPadding >=
2301
2277
  config.collisionRange.right &&
@@ -2311,7 +2287,9 @@
2311
2287
  comment.posY = posY;
2312
2288
  };
2313
2289
  const getFixedPosY = (comment, collision) => {
2314
- let posY = 0, isChanged = true, count = 0;
2290
+ let posY = 0;
2291
+ let isChanged = true;
2292
+ let count = 0;
2315
2293
  while (isChanged && count < 10) {
2316
2294
  isChanged = false;
2317
2295
  count++;
@@ -2365,10 +2343,12 @@
2365
2343
  }
2366
2344
  return posY;
2367
2345
  };
2368
- const getPosY = (currentPos, targetComment, collision, isChanged = false) => {
2346
+ const getPosY = (_currentPos, targetComment, collision, _isChanged = false) => {
2369
2347
  let isBreak = false;
2370
2348
  if (!collision)
2371
- return { currentPos, isChanged, isBreak };
2349
+ return { currentPos: _currentPos, isChanged: _isChanged, isBreak };
2350
+ let currentPos = _currentPos;
2351
+ let isChanged = _isChanged;
2372
2352
  for (const collisionItem of collision) {
2373
2353
  if (collisionItem.index === targetComment.index || collisionItem.posY < 0)
2374
2354
  continue;
@@ -2463,7 +2443,8 @@
2463
2443
  const key = `${comment.content}@@${[...comment.mail]
2464
2444
  .sort((a, b) => a.localeCompare(b))
2465
2445
  .filter((e) => !RegExp(/@[\d.]+|184|device:.+|patissier|ca/).exec(e))
2466
- .join("")}`, lastComment = index[key];
2446
+ .join("")}`;
2447
+ const lastComment = index[key];
2467
2448
  if (lastComment === undefined) {
2468
2449
  index[key] = comment;
2469
2450
  return true;
@@ -2541,12 +2522,10 @@
2541
2522
  if (getter(a) > getter(b)) {
2542
2523
  return 1;
2543
2524
  }
2544
- else if (getter(a) < getter(b)) {
2525
+ if (getter(a) < getter(b)) {
2545
2526
  return -1;
2546
2527
  }
2547
- else {
2548
- return 0;
2549
- }
2528
+ return 0;
2550
2529
  };
2551
2530
  };
2552
2531
 
@@ -2558,17 +2537,20 @@
2558
2537
  gothic: new RegExp(config.flashChar.gothic),
2559
2538
  };
2560
2539
  const index = [];
2561
- let match;
2562
- if ((match = regex.simsunStrong.exec(part)) !== null) {
2540
+ let match = regex.simsunStrong.exec(part);
2541
+ if (match !== null) {
2563
2542
  index.push({ font: "simsunStrong", index: match.index });
2564
2543
  }
2565
- if ((match = regex.simsunWeak.exec(part)) !== null) {
2544
+ match = regex.simsunWeak.exec(part);
2545
+ if (match !== null) {
2566
2546
  index.push({ font: "simsunWeak", index: match.index });
2567
2547
  }
2568
- if ((match = regex.gulim.exec(part)) !== null) {
2548
+ match = regex.gulim.exec(part);
2549
+ if (match !== null) {
2569
2550
  index.push({ font: "gulim", index: match.index });
2570
2551
  }
2571
- if ((match = regex.gothic.exec(part)) !== null) {
2552
+ match = regex.gothic.exec(part);
2553
+ if (match !== null) {
2572
2554
  index.push({ font: "gothic", index: match.index });
2573
2555
  }
2574
2556
  return index;
@@ -2668,7 +2650,8 @@
2668
2650
  if (config.flashMode === "xp") {
2669
2651
  let offset = 0;
2670
2652
  for (let i = 1, n = index.length; i < n; i++) {
2671
- const currentVal = index[i], lastVal = index[i - 1];
2653
+ const currentVal = index[i];
2654
+ const lastVal = index[i - 1];
2672
2655
  if (currentVal === undefined || lastVal === undefined)
2673
2656
  continue;
2674
2657
  const content = part.slice(offset, currentVal.index);
@@ -2682,7 +2665,8 @@
2682
2665
  }
2683
2666
  return;
2684
2667
  }
2685
- const firstVal = index[0], secondVal = index[1];
2668
+ const firstVal = index[0];
2669
+ const secondVal = index[1];
2686
2670
  if (!firstVal || !secondVal) {
2687
2671
  addPartToResult(lineContent, part);
2688
2672
  return;
@@ -2707,7 +2691,9 @@
2707
2691
  comment.fontSize *
2708
2692
  comment.lineHeight *
2709
2693
  config.flashCommentYOffset[comment.size][offsetKey];
2710
- let leftOffset = 0, lineCount = 0, isLastButton = false;
2694
+ let leftOffset = 0;
2695
+ let lineCount = 0;
2696
+ let isLastButton = false;
2711
2697
  for (const item of comment.content) {
2712
2698
  if (item.type === "spacer") {
2713
2699
  leftOffset += item.count * comment.fontSize * item.charWidth;
@@ -2811,7 +2797,10 @@
2811
2797
  TypeGuardError.prototype.name = "TypeGuardError";
2812
2798
 
2813
2799
  const getLineHeight = (fontSize, isFlash, resized = false) => {
2814
- const lineCounts = getConfig(config.html5LineCounts, isFlash), commentStageSize = getConfig(config.commentStageSize, isFlash), lineHeight = commentStageSize.height / lineCounts.doubleResized[fontSize], defaultLineCount = lineCounts.default[fontSize];
2800
+ const lineCounts = getConfig(config.html5LineCounts, isFlash);
2801
+ const commentStageSize = getConfig(config.commentStageSize, isFlash);
2802
+ const lineHeight = commentStageSize.height / lineCounts.doubleResized[fontSize];
2803
+ const defaultLineCount = lineCounts.default[fontSize];
2815
2804
  if (resized) {
2816
2805
  const resizedLineCount = lineCounts.resized[fontSize];
2817
2806
  return ((commentStageSize.height -
@@ -2821,7 +2810,8 @@
2821
2810
  return (commentStageSize.height - lineHeight) / (defaultLineCount - 1);
2822
2811
  };
2823
2812
  const getCharSize = (fontSize, isFlash) => {
2824
- const lineCounts = getConfig(config.html5LineCounts, isFlash), commentStageSize = getConfig(config.commentStageSize, isFlash);
2813
+ const lineCounts = getConfig(config.html5LineCounts, isFlash);
2814
+ const commentStageSize = getConfig(config.commentStageSize, isFlash);
2825
2815
  return commentStageSize.height / lineCounts.doubleResized[fontSize];
2826
2816
  };
2827
2817
  const measure = (comment, renderer) => {
@@ -2831,10 +2821,10 @@
2831
2821
  height: comment.lineHeight * (comment.lineCount - 1) + comment.charSize,
2832
2822
  };
2833
2823
  };
2834
- const addHTML5PartToResult = (lineContent, part, font) => {
2824
+ const addHTML5PartToResult = (lineContent, part, _font) => {
2835
2825
  if (part === "")
2836
2826
  return;
2837
- font ??= "defont";
2827
+ const font = _font ?? "defont";
2838
2828
  for (const key of Object.keys(config.compatSpacer.html5)) {
2839
2829
  const spacerWidth = config.compatSpacer.html5[key]?.[font];
2840
2830
  if (!spacerWidth)
@@ -2862,7 +2852,9 @@
2862
2852
  });
2863
2853
  };
2864
2854
  const measureWidth = (comment, renderer) => {
2865
- const { fontSize, scale } = getFontSizeAndScale(comment.charSize), lineWidth = [], itemWidth = [];
2855
+ const { fontSize, scale } = getFontSizeAndScale(comment.charSize);
2856
+ const lineWidth = [];
2857
+ const itemWidth = [];
2866
2858
  renderer.setFont(parseFont(comment.font, fontSize));
2867
2859
  let currentWidth = 0;
2868
2860
  for (const item of comment.content) {
@@ -2896,7 +2888,8 @@
2896
2888
  itemWidth,
2897
2889
  };
2898
2890
  };
2899
- const getFontSizeAndScale = (charSize) => {
2891
+ const getFontSizeAndScale = (_charSize) => {
2892
+ let charSize = _charSize;
2900
2893
  charSize *= 0.8;
2901
2894
  if (charSize < config.html5MinFontSize) {
2902
2895
  if (charSize >= 1)
@@ -3099,7 +3092,7 @@
3099
3092
  if (cache) {
3100
3093
  this.image = cache.image;
3101
3094
  window.setTimeout(() => {
3102
- delete this.image;
3095
+ this.image = undefined;
3103
3096
  }, this.comment.long * 10 + config.cacheAge);
3104
3097
  clearTimeout(cache.timeout);
3105
3098
  cache.timeout = window.setTimeout(() => {
@@ -3121,7 +3114,7 @@
3121
3114
  _cacheImage(image) {
3122
3115
  this.image = image;
3123
3116
  window.setTimeout(() => {
3124
- delete this.image;
3117
+ this.image = undefined;
3125
3118
  }, this.comment.long * 10 + config.cacheAge);
3126
3119
  imageCache[this.cacheKey] = {
3127
3120
  timeout: window.setTimeout(() => {
@@ -3139,9 +3132,11 @@
3139
3132
  throw new NotImplementedError(this.pluginName, "getButtonImage");
3140
3133
  }
3141
3134
  getCacheKey() {
3142
- return (JSON.stringify(this.comment.content) +
3143
- `@@${this.pluginName}@@` +
3144
- [...this.comment.mail].sort((a, b) => a.localeCompare(b)).join(","));
3135
+ return `${JSON.stringify(this.comment.content)}@@${this.pluginName}@@${[
3136
+ ...this.comment.mail,
3137
+ ]
3138
+ .sort((a, b) => a.localeCompare(b))
3139
+ .join(",")}`;
3145
3140
  }
3146
3141
  }
3147
3142
 
@@ -3205,7 +3200,7 @@
3205
3200
  }
3206
3201
  this.comment = this.getCommentSize(comment);
3207
3202
  this.cacheKey = this.getCacheKey();
3208
- delete this.image;
3203
+ this.image = undefined;
3209
3204
  }
3210
3205
  convertComment(comment) {
3211
3206
  this._globalScale = getConfig(config.commentScale, true);
@@ -3295,7 +3290,9 @@
3295
3290
  };
3296
3291
  }
3297
3292
  measureText(comment) {
3298
- const configLineHeight = getConfig(config.lineHeight, true), configFontSize = getConfig(config.fontSize, true)[comment.size], configStageSize = getConfig(config.commentStageSize, true);
3293
+ const configLineHeight = getConfig(config.lineHeight, true);
3294
+ const configFontSize = getConfig(config.fontSize, true)[comment.size];
3295
+ const configStageSize = getConfig(config.commentStageSize, true);
3299
3296
  const defaultFontSize = configFontSize.default;
3300
3297
  comment.lineHeight ??= configLineHeight[comment.size].default;
3301
3298
  const widthLimit = configStageSize[comment.full ? "fullWidth" : "width"];
@@ -3370,8 +3367,10 @@
3370
3367
  return widthLimit < width;
3371
3368
  }
3372
3369
  _measureContent(comment) {
3373
- const widthArr = [], spacedWidthArr = [];
3374
- let currentWidth = 0, spacedWidth = 0;
3370
+ const widthArr = [];
3371
+ const spacedWidthArr = [];
3372
+ let currentWidth = 0;
3373
+ let spacedWidth = 0;
3375
3374
  for (const item of comment.content) {
3376
3375
  if (item.type === "spacer") {
3377
3376
  spacedWidth +=
@@ -3406,8 +3405,9 @@
3406
3405
  spacedWidthArr.push(spacedWidth);
3407
3406
  item.width = widths;
3408
3407
  }
3409
- const leadLine = (function () {
3410
- let max = 0, index = -1;
3408
+ const leadLine = (() => {
3409
+ let max = 0;
3410
+ let index = -1;
3411
3411
  spacedWidthArr.forEach((val, i) => {
3412
3412
  if (max < val) {
3413
3413
  max = val;
@@ -3432,7 +3432,7 @@
3432
3432
  const linePosY = ((i + 1) * (this.comment.fontSize * this.comment.lineHeight) +
3433
3433
  config.flashCommentYPaddingTop[this.comment.resizedY ? "resized" : "default"]) *
3434
3434
  this.comment.scale;
3435
- this.renderer.setStrokeStyle(`rgba(255,255,0,0.25)`);
3435
+ this.renderer.setStrokeStyle("rgba(255,255,0,0.25)");
3436
3436
  this.renderer.strokeRect(posX, posY + linePosY * this._globalScale, this.comment.width, this.comment.fontSize *
3437
3437
  this.comment.lineHeight *
3438
3438
  -1 *
@@ -3454,7 +3454,10 @@
3454
3454
  this.comment.fontSize *
3455
3455
  this.comment.lineHeight *
3456
3456
  config.flashCommentYOffset[this.comment.size][offsetKey];
3457
- let lastFont = this.comment.font, leftOffset = 0, lineCount = 0, isLastButton = false;
3457
+ let lastFont = this.comment.font;
3458
+ let leftOffset = 0;
3459
+ let lineCount = 0;
3460
+ let isLastButton = false;
3458
3461
  for (const item of this.comment.content) {
3459
3462
  if (item.type === "spacer") {
3460
3463
  leftOffset += item.count * item.charWidth * this.comment.fontSize;
@@ -3585,7 +3588,7 @@
3585
3588
  };
3586
3589
  this.comment = this.getCommentSize(comment);
3587
3590
  this.cacheKey = this.getCacheKey();
3588
- delete this.image;
3591
+ this.image = undefined;
3589
3592
  }
3590
3593
  convertComment(comment) {
3591
3594
  return this.getCommentSize(this.parseCommandAndNicoscript(comment));
@@ -3656,7 +3659,9 @@
3656
3659
  }
3657
3660
  measureText(comment) {
3658
3661
  const scale = getConfig(config.commentScale, false);
3659
- const configFontSize = getConfig(config.fontSize, false), lineHeight = getLineHeight(comment.size, false), charSize = getCharSize(comment.size, false);
3662
+ const configFontSize = getConfig(config.fontSize, false);
3663
+ const lineHeight = getLineHeight(comment.size, false);
3664
+ const charSize = getCharSize(comment.size, false);
3660
3665
  if (!comment.lineHeight)
3661
3666
  comment.lineHeight = lineHeight;
3662
3667
  if (!comment.charSize)
@@ -3974,19 +3979,25 @@
3974
3979
  });
3975
3980
 
3976
3981
  const initConfig = () => {
3977
- const platform = (function (ua) {
3978
- if (RegExp(/windows nt 6\.[12]/i).exec(ua))
3982
+ const platform = ((ua) => {
3983
+ if (RegExp(/windows nt 6\.[12]/i).exec(ua)) {
3979
3984
  return "win7";
3980
- else if (RegExp(/windows nt (6\.3|10\.\d+)|win32/i).exec(ua))
3985
+ }
3986
+ if (RegExp(/windows nt (6\.3|10\.\d+)|win32/i).exec(ua)) {
3981
3987
  return "win8_1";
3982
- else if (RegExp(/windows nt/i).exec(ua))
3988
+ }
3989
+ if (RegExp(/windows nt/i).exec(ua)) {
3983
3990
  return "win";
3984
- else if (RegExp(/mac os x 10(.|_)(9|10)/i).exec(ua))
3991
+ }
3992
+ if (RegExp(/mac os x 10(.|_)(9|10)/i).exec(ua)) {
3985
3993
  return "mac10_9";
3986
- else if (RegExp(/mac os x 10(.|_)\d{2}|darwin/i).exec(ua))
3994
+ }
3995
+ if (RegExp(/mac os x 10(.|_)\d{2}|darwin/i).exec(ua)) {
3987
3996
  return "mac10_11";
3988
- else if (RegExp(/mac os x/i).exec(ua))
3997
+ }
3998
+ if (RegExp(/mac os x/i).exec(ua)) {
3989
3999
  return "mac";
4000
+ }
3990
4001
  return "other";
3991
4002
  })(typeof navigator !== "undefined" ? navigator.userAgent : process.platform);
3992
4003
  const defaultConfig = {
@@ -4224,7 +4235,8 @@
4224
4235
  if (handlerCounts.commentDisable < 1 && handlerCounts.commentEnable < 1)
4225
4236
  return;
4226
4237
  for (const range of nicoScripts.ban) {
4227
- const vposInRange = range.start < vpos && vpos < range.end, lastVposInRange = range.start < lastVpos && lastVpos < range.end;
4238
+ const vposInRange = range.start < vpos && vpos < range.end;
4239
+ const lastVposInRange = range.start < lastVpos && lastVpos < range.end;
4228
4240
  if (vposInRange && !lastVposInRange) {
4229
4241
  executeEvents("commentDisable", {
4230
4242
  type: "commentDisable",
@@ -4245,7 +4257,8 @@
4245
4257
  if (handlerCounts.seekDisable < 1 && handlerCounts.seekEnable < 1)
4246
4258
  return;
4247
4259
  for (const range of nicoScripts.seekDisable) {
4248
- const vposInRange = range.start < vpos && vpos < range.end, lastVposInRange = range.start < lastVpos && lastVpos < range.end;
4260
+ const vposInRange = range.start < vpos && vpos < range.end;
4261
+ const lastVposInRange = range.start < lastVpos && lastVpos < range.end;
4249
4262
  if (vposInRange && !lastVposInRange) {
4250
4263
  executeEvents("seekDisable", {
4251
4264
  type: "seekDisable",
@@ -4266,7 +4279,8 @@
4266
4279
  if (handlerCounts.jump < 1)
4267
4280
  return;
4268
4281
  for (const range of nicoScripts.jump) {
4269
- const vposInRange = range.start < vpos && (!range.end || vpos < range.end), lastVposInRange = range.start < lastVpos && (!range.end || lastVpos < range.end);
4282
+ const vposInRange = range.start < vpos && (!range.end || vpos < range.end);
4283
+ const lastVposInRange = range.start < lastVpos && (!range.end || lastVpos < range.end);
4270
4284
  if (vposInRange && !lastVposInRange) {
4271
4285
  executeEvents("jump", {
4272
4286
  type: "jump",
@@ -4314,7 +4328,8 @@
4314
4328
  },
4315
4329
  };
4316
4330
  const fromLegacy = (data) => {
4317
- const data_ = [], userList = [];
4331
+ const data_ = [];
4332
+ const userList = [];
4318
4333
  for (const _val of data) {
4319
4334
  const val = safeParse(ZApiChat, _val.chat);
4320
4335
  if (!val.success)
@@ -4363,7 +4378,8 @@
4363
4378
  },
4364
4379
  };
4365
4380
  const fromLegacyOwner = (data) => {
4366
- const data_ = [], comments = data.split("\n");
4381
+ const data_ = [];
4382
+ const comments = data.split("\n");
4367
4383
  for (let i = 0, n = comments.length; i < n; i++) {
4368
4384
  const value = comments[i];
4369
4385
  if (!value)
@@ -4372,7 +4388,7 @@
4372
4388
  if (commentData.length < 3) {
4373
4389
  continue;
4374
4390
  }
4375
- else if (commentData.length > 3) {
4391
+ if (commentData.length > 3) {
4376
4392
  for (let j = 3, n = commentData.length; j < n; j++) {
4377
4393
  commentData[2] += `:${commentData[j]}`;
4378
4394
  }
@@ -4443,16 +4459,15 @@
4443
4459
  time[2] !== undefined &&
4444
4460
  time[3] !== undefined) {
4445
4461
  return ((Number(time[1]) * 60 + Number(time[2])) * 100 +
4446
- Number(time[3]) / Math.pow(10, time[3].length - 2));
4462
+ Number(time[3]) / 10 ** (time[3].length - 2));
4447
4463
  }
4448
- else if (time[4] !== undefined && time[5] !== undefined) {
4464
+ if (time[4] !== undefined && time[5] !== undefined) {
4449
4465
  return (Number(time[4]) * 60 + Number(time[5])) * 100;
4450
4466
  }
4451
- else if (time[6] !== undefined && time[7] !== undefined) {
4452
- return (Number(time[6]) * 100 +
4453
- Number(time[7]) / Math.pow(10, time[7].length - 2));
4467
+ if (time[6] !== undefined && time[7] !== undefined) {
4468
+ return (Number(time[6]) * 100 + Number(time[7]) / 10 ** (time[7].length - 2));
4454
4469
  }
4455
- else if (time[8] !== undefined) {
4470
+ if (time[8] !== undefined) {
4456
4471
  return Number(time[8]) * 100;
4457
4472
  }
4458
4473
  }
@@ -4466,9 +4481,11 @@
4466
4481
  },
4467
4482
  };
4468
4483
  const fromV1 = (data) => {
4469
- const data_ = [], userList = [];
4484
+ const data_ = [];
4485
+ const userList = [];
4470
4486
  for (const item of data) {
4471
- const val = item.comments, forkName = item.fork;
4487
+ const val = item.comments;
4488
+ const forkName = item.fork;
4472
4489
  for (const value of val) {
4473
4490
  const tmpParam = {
4474
4491
  id: value.no,
@@ -4508,7 +4525,8 @@
4508
4525
  },
4509
4526
  };
4510
4527
  const fromXml2js = (data) => {
4511
- const data_ = [], userList = [];
4528
+ const data_ = [];
4529
+ const userList = [];
4512
4530
  let index = data.packet.chat.length;
4513
4531
  for (const item of data.packet.chat) {
4514
4532
  const tmpParam = {
@@ -4550,7 +4568,8 @@
4550
4568
  },
4551
4569
  };
4552
4570
  const parseXMLDocument = (data) => {
4553
- const data_ = [], userList = [];
4571
+ const data_ = [];
4572
+ const userList = [];
4554
4573
  let index = Array.from(data.documentElement.children).length;
4555
4574
  for (const item of Array.from(data.documentElement.children)) {
4556
4575
  if (item.nodeName !== "chat")
@@ -4646,14 +4665,16 @@
4646
4665
  drawVideo(enableLegacyPip) {
4647
4666
  if (this.video) {
4648
4667
  let scale;
4649
- const height = this.canvas.height / this.video.videoHeight, width = this.canvas.width / this.video.videoWidth;
4668
+ const height = this.canvas.height / this.video.videoHeight;
4669
+ const width = this.canvas.width / this.video.videoWidth;
4650
4670
  if (enableLegacyPip ? height > width : height < width) {
4651
4671
  scale = width;
4652
4672
  }
4653
4673
  else {
4654
4674
  scale = height;
4655
4675
  }
4656
- const offsetX = (this.canvas.width - this.video.videoWidth * scale) * 0.5, offsetY = (this.canvas.height - this.video.videoHeight * scale) * 0.5;
4676
+ const offsetX = (this.canvas.width - this.video.videoWidth * scale) * 0.5;
4677
+ const offsetY = (this.canvas.height - this.video.videoHeight * scale) * 0.5;
4657
4678
  this.context.drawImage(this.video, offsetX, offsetY, this.video.videoWidth * scale, this.video.videoHeight * scale);
4658
4679
  }
4659
4680
  }
@@ -4801,7 +4822,7 @@
4801
4822
  class: FlashComment,
4802
4823
  };
4803
4824
  static internal = internal;
4804
- constructor(renderer, data, initOptions = {}) {
4825
+ constructor(_renderer, data, initOptions = {}) {
4805
4826
  const constructorStart = performance.now();
4806
4827
  initConfig();
4807
4828
  if (!typeGuard.config.initOptions(initOptions))
@@ -4811,6 +4832,7 @@
4811
4832
  setIsDebug(options.debug);
4812
4833
  resetImageCache();
4813
4834
  resetNicoScripts();
4835
+ let renderer = _renderer;
4814
4836
  if (renderer instanceof HTMLCanvasElement) {
4815
4837
  renderer = new CanvasRenderer(renderer, options.video);
4816
4838
  }
@@ -4847,11 +4869,12 @@
4847
4869
  right: [],
4848
4870
  };
4849
4871
  this.lastVpos = -1;
4850
- this.processedCommentIndex = 0;
4872
+ this.processedCommentIndex = -1;
4851
4873
  this.comments = this.preRendering(parsedData);
4852
4874
  logger(`constructor complete: ${performance.now() - constructorStart}ms`);
4853
4875
  }
4854
- preRendering(rawData) {
4876
+ preRendering(_rawData) {
4877
+ let rawData = _rawData;
4855
4878
  const preRenderingStart = performance.now();
4856
4879
  if (options.keepCA) {
4857
4880
  rawData = changeCALayer(rawData);
@@ -4887,7 +4910,7 @@
4887
4910
  const getCommentPosStart = performance.now();
4888
4911
  if (this.processedCommentIndex + 1 >= end)
4889
4912
  return;
4890
- for (const comment of data.slice(this.processedCommentIndex, end)) {
4913
+ for (const comment of data.slice(this.processedCommentIndex + 1, end)) {
4891
4914
  if (comment.invisible || (comment.posY > -1 && !lazy))
4892
4915
  continue;
4893
4916
  if (comment.loc === "naka") {
@@ -4909,7 +4932,8 @@
4909
4932
  const item = this.timeline[Number(vpos)];
4910
4933
  if (!item)
4911
4934
  continue;
4912
- const owner = [], user = [];
4935
+ const owner = [];
4936
+ const user = [];
4913
4937
  for (const comment of item) {
4914
4938
  if (comment?.owner) {
4915
4939
  owner.push(comment);
@@ -4958,7 +4982,8 @@
4958
4982
  timelineRange?.filter((item) => item.loc === "naka").length === 0 &&
4959
4983
  this.timeline[this.lastVposInt]?.filter((item) => item.loc === "naka")
4960
4984
  ?.length === 0) {
4961
- const current = timelineRange.filter((item) => item.loc !== "naka"), last = this.timeline[this.lastVposInt]?.filter((item) => item.loc !== "naka") ?? [];
4985
+ const current = timelineRange.filter((item) => item.loc !== "naka");
4986
+ const last = this.timeline[this.lastVposInt]?.filter((item) => item.loc !== "naka") ?? [];
4962
4987
  if (arrayEqual(current, last))
4963
4988
  return false;
4964
4989
  }
@@ -4971,7 +4996,7 @@
4971
4996
  this.renderer.drawImage(plugin.canvas, 0, 0);
4972
4997
  }
4973
4998
  catch (e) {
4974
- console.error(`Failed to draw comments`, e);
4999
+ console.error("Failed to draw comments", e);
4975
5000
  }
4976
5001
  }
4977
5002
  this._drawCollision(vposInt);
@@ -5007,7 +5032,8 @@
5007
5032
  _drawCollision(vpos) {
5008
5033
  if (this.showCollision) {
5009
5034
  this.renderer.save();
5010
- const leftCollision = this.collision.left[vpos], rightCollision = this.collision.right[vpos];
5035
+ const leftCollision = this.collision.left[vpos];
5036
+ const rightCollision = this.collision.right[vpos];
5011
5037
  this.renderer.setFillStyle("red");
5012
5038
  if (leftCollision) {
5013
5039
  for (const comment of leftCollision) {