pervert-monkey 1.0.9 → 1.0.11

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 (67) hide show
  1. package/dist/core/pervertmonkey.core.es.d.ts +126 -59
  2. package/dist/core/pervertmonkey.core.es.js +1051 -366
  3. package/dist/core/pervertmonkey.core.es.js.map +1 -1
  4. package/dist/core/pervertmonkey.core.umd.js +1051 -366
  5. package/dist/core/pervertmonkey.core.umd.js.map +1 -1
  6. package/dist/userscripts/3hentai.user.js +14 -8
  7. package/dist/userscripts/camgirlfinder.user.js +1 -1
  8. package/dist/userscripts/camwhores.user.js +15 -9
  9. package/dist/userscripts/e-hentai.user.js +12 -6
  10. package/dist/userscripts/ebalka.user.js +11 -5
  11. package/dist/userscripts/eporner.user.js +15 -10
  12. package/dist/userscripts/erome.user.js +11 -10
  13. package/dist/userscripts/eroprofile.user.js +9 -5
  14. package/dist/userscripts/javhdporn.user.js +9 -5
  15. package/dist/userscripts/missav.user.js +10 -6
  16. package/dist/userscripts/motherless.user.js +11 -7
  17. package/dist/userscripts/namethatporn.user.js +17 -13
  18. package/dist/userscripts/nhentai.user.js +12 -6
  19. package/dist/userscripts/obmenvsem.user.js +14 -18
  20. package/dist/userscripts/pornhub.user.js +14 -10
  21. package/dist/userscripts/spankbang.user.js +10 -6
  22. package/dist/userscripts/thisvid.user.js +27 -21
  23. package/dist/userscripts/xhamster.user.js +26 -26
  24. package/dist/userscripts/xvideos.user.js +19 -17
  25. package/package.json +6 -3
  26. package/src/core/{data-control → data-handler}/data-filter.ts +3 -8
  27. package/src/core/{data-control → data-handler}/data-manager.ts +8 -7
  28. package/src/core/data-handler/index.ts +2 -0
  29. package/src/core/index.ts +4 -4
  30. package/src/core/infinite-scroll/index.ts +29 -38
  31. package/src/core/parsers/index.ts +4 -0
  32. package/src/core/{pagination-parsing → parsers/pagination-parser}/index.ts +3 -0
  33. package/src/core/{pagination-parsing → parsers/pagination-parser}/pagination-strategies/PaginationStrategy.ts +1 -1
  34. package/src/core/{pagination-parsing → parsers/pagination-parser}/pagination-strategies/PaginationStrategyDataParams.ts +1 -1
  35. package/src/core/{pagination-parsing → parsers/pagination-parser}/pagination-strategies/PaginationStrategyPathnameParams.ts +2 -1
  36. package/src/core/{pagination-parsing → parsers/pagination-parser}/pagination-utils/index.ts +1 -4
  37. package/src/core/parsers/thumb-data-parser.ts +115 -0
  38. package/src/core/parsers/thumb-img-parser.ts +65 -0
  39. package/src/core/parsers/thumbs-parser.ts +29 -0
  40. package/src/core/rules/index.ts +39 -207
  41. package/src/userscripts/index.ts +1 -1
  42. package/src/userscripts/scripts/3hentai.ts +15 -7
  43. package/src/userscripts/scripts/camwhores.ts +18 -13
  44. package/src/userscripts/scripts/e-hentai.ts +12 -7
  45. package/src/userscripts/scripts/ebalka.ts +11 -5
  46. package/src/userscripts/scripts/eporner.ts +16 -10
  47. package/src/userscripts/scripts/erome.ts +11 -10
  48. package/src/userscripts/scripts/eroprofile.ts +10 -6
  49. package/src/userscripts/scripts/javhdporn.ts +9 -5
  50. package/src/userscripts/scripts/missav.ts +10 -6
  51. package/src/userscripts/scripts/motherless.ts +12 -8
  52. package/src/userscripts/scripts/namethatporn.ts +20 -15
  53. package/src/userscripts/scripts/nhentai.ts +13 -8
  54. package/src/userscripts/scripts/obmenvsem.ts +31 -15
  55. package/src/userscripts/scripts/pornhub.ts +21 -21
  56. package/src/userscripts/scripts/spankbang.ts +11 -43
  57. package/src/userscripts/scripts/thisvid.ts +31 -25
  58. package/src/userscripts/scripts/xhamster.ts +31 -32
  59. package/src/userscripts/scripts/xvideos.ts +18 -16
  60. package/src/utils/index.ts +7 -19
  61. package/src/utils/observers/index.ts +8 -4
  62. package/src/utils/parsers/index.ts +4 -0
  63. package/src/utils/parsers/time-parser.ts +2 -2
  64. package/src/utils/strings/index.ts +2 -0
  65. package/src/core/data-control/index.ts +0 -2
  66. /package/src/core/{pagination-parsing → parsers/pagination-parser}/pagination-strategies/PaginationStrategySearchParams.ts +0 -0
  67. /package/src/core/{pagination-parsing → parsers/pagination-parser}/pagination-strategies/index.ts +0 -0
@@ -28,6 +28,51 @@ function range(size, start = 1, step = 1) {
28
28
  function wait(milliseconds) {
29
29
  return new Promise((resolve) => setTimeout(resolve, milliseconds));
30
30
  }
31
+ function memoize(fn2) {
32
+ const cache = /* @__PURE__ */ new Map();
33
+ const memoizedFunction = ((...args) => {
34
+ const key = JSON.stringify(args);
35
+ if (cache.has(key)) {
36
+ return cache.get(key);
37
+ }
38
+ const result = fn2(...args);
39
+ cache.set(key, result);
40
+ return result;
41
+ });
42
+ return memoizedFunction;
43
+ }
44
+ function objectToFormData(obj) {
45
+ const formData = new FormData();
46
+ Object.entries(obj).forEach(([k2, v2]) => {
47
+ formData.append(k2, v2);
48
+ });
49
+ return formData;
50
+ }
51
+ class RegexFilter {
52
+ constructor(str, flags = "gi") {
53
+ __publicField(this, "regexes");
54
+ this.regexes = memoize(this.compileSearchRegex)(str, flags);
55
+ }
56
+ // 'dog,bog,f:girl' or r:dog|bog... => [r/dog/i, r/bog/i, r/(^|\ )girl($|\ )/i]
57
+ compileSearchRegex(str, flags) {
58
+ try {
59
+ if (str.startsWith("r:")) return [new RegExp(str.slice(2), flags)];
60
+ const regexes = splitWith(str).map(
61
+ (s) => s.replace(/f:(\w+)/g, (_2, w2) => `(^|\\ |,)${w2}($|\\ |,)`)
62
+ // full word
63
+ ).map((_2) => new RegExp(_2, flags));
64
+ return regexes;
65
+ } catch (_2) {
66
+ return [];
67
+ }
68
+ }
69
+ hasEvery(str) {
70
+ return this.regexes.every((r) => r.test(str));
71
+ }
72
+ hasNone(str) {
73
+ return this.regexes.every((r) => !r.test(str));
74
+ }
75
+ }
31
76
  function splitWith(s, c = ",") {
32
77
  return s.split(c).map((s2) => s2.trim()).filter(Boolean);
33
78
  }
@@ -45,9 +90,9 @@ function waitForElementToAppear(parent, selector, callback) {
45
90
  observer.observe(document.body, { childList: true, subtree: true });
46
91
  return observer;
47
92
  }
48
- function waitForElementToDisappear(observable, callback) {
93
+ function waitForElementToDisappear(observable2, callback) {
49
94
  const observer = new MutationObserver((_mutations) => {
50
- if (!observable.isConnected) {
95
+ if (!observable2.isConnected) {
51
96
  observer.disconnect();
52
97
  callback();
53
98
  }
@@ -279,26 +324,6 @@ const fetchText = (input) => fetchWith(input, { type: "text" });
279
324
  function circularShift(n, c = 6, s = 1) {
280
325
  return (n + s) % c || c;
281
326
  }
282
- function memoize(fn2) {
283
- const cache = /* @__PURE__ */ new Map();
284
- const memoizedFunction = ((...args) => {
285
- const key = JSON.stringify(args);
286
- if (cache.has(key)) {
287
- return cache.get(key);
288
- }
289
- const result = fn2(...args);
290
- cache.set(key, result);
291
- return result;
292
- });
293
- return memoizedFunction;
294
- }
295
- function objectToFormData(obj) {
296
- const formData = new FormData();
297
- Object.entries(obj).forEach(([k2, v2]) => {
298
- formData.append(k2, v2);
299
- });
300
- return formData;
301
- }
302
327
  class LazyImgLoader {
303
328
  constructor(shouldDelazify) {
304
329
  __publicField(this, "lazyImgObserver");
@@ -347,26 +372,33 @@ class Observer {
347
372
  this.observer.disconnect();
348
373
  }
349
374
  static observeWhile(target, callback, throttleTime) {
350
- const observer_ = new Observer(async (target2) => {
375
+ const observer = new Observer(async (target2) => {
351
376
  const condition = await callback();
352
- if (condition) observer_.throttle(target2, throttleTime);
377
+ if (condition) {
378
+ observer.throttle(target2, throttleTime);
379
+ } else {
380
+ observer.dispose();
381
+ }
353
382
  });
354
- observer_.observe(target);
355
- return observer_;
383
+ observer.observe(target);
384
+ return observer;
356
385
  }
357
386
  }
358
387
  function formatTimeToHHMMSS(timeStr) {
359
388
  var _a3, _b2, _c2;
360
389
  const pad = (num) => num.toString().padStart(2, "0");
361
390
  const h = ((_a3 = timeStr.match(/(\d+)\s*h/)) == null ? void 0 : _a3[1]) || "0";
362
- const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n/)) == null ? void 0 : _b2[1]) || "0";
363
- const s = ((_c2 = timeStr.match(/(\d+)\s*sec/)) == null ? void 0 : _c2[1]) || "0";
391
+ const m = ((_b2 = timeStr.match(/(\d+)\s*mi?n?/)) == null ? void 0 : _b2[1]) || "0";
392
+ const s = ((_c2 = timeStr.match(/(\d+)\s*se?c?/)) == null ? void 0 : _c2[1]) || "0";
364
393
  return `${pad(+h)}:${pad(+m)}:${pad(+s)}`;
365
394
  }
366
395
  function timeToSeconds(timeStr) {
367
396
  const normalized = /[a-zA-Z]/.test(timeStr) ? formatTimeToHHMMSS(timeStr) : timeStr;
368
397
  return normalized.split(":").reverse().reduce((total, unit, index) => total + parseInt(unit, 10) * 60 ** index, 0);
369
398
  }
399
+ function parseUrl(s) {
400
+ return new URL(typeof s === "string" ? s : s.href);
401
+ }
370
402
  function parseIntegerOr(n, or2) {
371
403
  const num = Number(n);
372
404
  return Number.isSafeInteger(num) ? num : or2;
@@ -392,31 +424,6 @@ function parseDataParams(str) {
392
424
  function parseCssUrl(s) {
393
425
  return s.replace(/url\("|"\).*/g, "");
394
426
  }
395
- class RegexFilter {
396
- constructor(str, flags = "gi") {
397
- __publicField(this, "regexes");
398
- this.regexes = memoize(this.compileSearchRegex)(str, flags);
399
- }
400
- // 'dog,bog,f:girl' or r:dog|bog... => [r/dog/i, r/bog/i, r/(^|\ )girl($|\ )/i]
401
- compileSearchRegex(str, flags) {
402
- try {
403
- if (str.startsWith("r:")) return [new RegExp(str.slice(2), flags)];
404
- const regexes = splitWith(str).map(
405
- (s) => s.replace(/f:(\w+)/g, (_2, w2) => `(^|\\ |,)${w2}($|\\ |,)`)
406
- // full word
407
- ).map((_2) => new RegExp(_2, flags));
408
- return regexes;
409
- } catch (_2) {
410
- return [];
411
- }
412
- }
413
- hasEvery(str) {
414
- return this.regexes.every((r) => r.test(str));
415
- }
416
- hasNone(str) {
417
- return this.regexes.every((r) => !r.test(str));
418
- }
419
- }
420
427
  const _DataFilter = class _DataFilter {
421
428
  constructor(rules) {
422
429
  __publicField(this, "filters", /* @__PURE__ */ new Map());
@@ -432,11 +439,7 @@ const _DataFilter = class _DataFilter {
432
439
  applyCSSFilters(wrapper) {
433
440
  this.filters.forEach((_2, name) => {
434
441
  const cssRule = `.filter-${name} { display: none !important; }`;
435
- if (wrapper) {
436
- GM_addStyle(wrapper(cssRule));
437
- } else {
438
- GM_addStyle(cssRule);
439
- }
442
+ GM_addStyle(wrapper ? wrapper(cssRule) : cssRule);
440
443
  });
441
444
  }
442
445
  registerFilters(customFilters) {
@@ -521,7 +524,7 @@ __publicField(_DataFilter, "customDataSelectorFnsDefault", {
521
524
  });
522
525
  let DataFilter = _DataFilter;
523
526
  class DataManager {
524
- constructor(rules) {
527
+ constructor(rules, parseDataParentHomogenity) {
525
528
  __publicField(this, "data", /* @__PURE__ */ new Map());
526
529
  __publicField(this, "lazyImgLoader", new LazyImgLoader(
527
530
  (target) => !DataFilter.isFiltered(target)
@@ -567,9 +570,8 @@ class DataManager {
567
570
  );
568
571
  await this.applyFilters(filters, offset);
569
572
  });
570
- __publicField(this, "parseDataParentHomogenity");
571
573
  __publicField(this, "parseData", (html, container, removeDuplicates = false, shouldLazify = true) => {
572
- const thumbs = this.rules.getThumbs(html);
574
+ const thumbs = this.rules.thumbsParser.getThumbs(html);
573
575
  const dataOffset = this.data.size;
574
576
  const fragment = document.createDocumentFragment();
575
577
  const parent = container || this.rules.container;
@@ -584,10 +586,10 @@ class DataManager {
584
586
  if (removeDuplicates) thumbElement.remove();
585
587
  continue;
586
588
  }
587
- const data = this.rules.getThumbData(thumbElement);
589
+ const data = this.rules.thumbDataParser.getThumbData(thumbElement);
588
590
  this.data.set(url, { element: thumbElement, ...data });
589
591
  if (shouldLazify) {
590
- const { img, imgSrc } = this.rules.getThumbImgData(thumbElement);
592
+ const { img, imgSrc } = this.rules.thumbImgParser.getImgData(thumbElement);
591
593
  this.lazyImgLoader.lazify(thumbElement, img, imgSrc);
592
594
  }
593
595
  fragment.append(thumbElement);
@@ -599,6 +601,7 @@ class DataManager {
599
601
  });
600
602
  });
601
603
  this.rules = rules;
604
+ this.parseDataParentHomogenity = parseDataParentHomogenity;
602
605
  this.dataFilter = new DataFilter(this.rules);
603
606
  }
604
607
  sortBy(key, direction = true) {
@@ -615,25 +618,675 @@ class DataManager {
615
618
  container.style.visibility = "visible";
616
619
  }
617
620
  }
621
+ var extendStatics = function(d2, b2) {
622
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
623
+ d3.__proto__ = b3;
624
+ } || function(d3, b3) {
625
+ for (var p in b3) if (Object.prototype.hasOwnProperty.call(b3, p)) d3[p] = b3[p];
626
+ };
627
+ return extendStatics(d2, b2);
628
+ };
629
+ function __extends(d2, b2) {
630
+ if (typeof b2 !== "function" && b2 !== null)
631
+ throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
632
+ extendStatics(d2, b2);
633
+ function __() {
634
+ this.constructor = d2;
635
+ }
636
+ d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
637
+ }
638
+ function __values(o) {
639
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
640
+ if (m) return m.call(o);
641
+ if (o && typeof o.length === "number") return {
642
+ next: function() {
643
+ if (o && i >= o.length) o = void 0;
644
+ return { value: o && o[i++], done: !o };
645
+ }
646
+ };
647
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
648
+ }
649
+ function __read(o, n) {
650
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
651
+ if (!m) return o;
652
+ var i = m.call(o), r, ar2 = [], e;
653
+ try {
654
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar2.push(r.value);
655
+ } catch (error) {
656
+ e = { error };
657
+ } finally {
658
+ try {
659
+ if (r && !r.done && (m = i["return"])) m.call(i);
660
+ } finally {
661
+ if (e) throw e.error;
662
+ }
663
+ }
664
+ return ar2;
665
+ }
666
+ function __spreadArray(to2, from, pack) {
667
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar2; i < l; i++) {
668
+ if (ar2 || !(i in from)) {
669
+ if (!ar2) ar2 = Array.prototype.slice.call(from, 0, i);
670
+ ar2[i] = from[i];
671
+ }
672
+ }
673
+ return to2.concat(ar2 || Array.prototype.slice.call(from));
674
+ }
675
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
676
+ var e = new Error(message);
677
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
678
+ };
679
+ function isFunction(value) {
680
+ return typeof value === "function";
681
+ }
682
+ function createErrorClass(createImpl) {
683
+ var _super = function(instance) {
684
+ Error.call(instance);
685
+ instance.stack = new Error().stack;
686
+ };
687
+ var ctorFunc = createImpl(_super);
688
+ ctorFunc.prototype = Object.create(Error.prototype);
689
+ ctorFunc.prototype.constructor = ctorFunc;
690
+ return ctorFunc;
691
+ }
692
+ var UnsubscriptionError = createErrorClass(function(_super) {
693
+ return function UnsubscriptionErrorImpl(errors) {
694
+ _super(this);
695
+ this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
696
+ return i + 1 + ") " + err.toString();
697
+ }).join("\n ") : "";
698
+ this.name = "UnsubscriptionError";
699
+ this.errors = errors;
700
+ };
701
+ });
702
+ function arrRemove(arr, item) {
703
+ if (arr) {
704
+ var index = arr.indexOf(item);
705
+ 0 <= index && arr.splice(index, 1);
706
+ }
707
+ }
708
+ var Subscription = (function() {
709
+ function Subscription2(initialTeardown) {
710
+ this.initialTeardown = initialTeardown;
711
+ this.closed = false;
712
+ this._parentage = null;
713
+ this._finalizers = null;
714
+ }
715
+ Subscription2.prototype.unsubscribe = function() {
716
+ var e_1, _a3, e_2, _b2;
717
+ var errors;
718
+ if (!this.closed) {
719
+ this.closed = true;
720
+ var _parentage = this._parentage;
721
+ if (_parentage) {
722
+ this._parentage = null;
723
+ if (Array.isArray(_parentage)) {
724
+ try {
725
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
726
+ var parent_1 = _parentage_1_1.value;
727
+ parent_1.remove(this);
728
+ }
729
+ } catch (e_1_1) {
730
+ e_1 = { error: e_1_1 };
731
+ } finally {
732
+ try {
733
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a3 = _parentage_1.return)) _a3.call(_parentage_1);
734
+ } finally {
735
+ if (e_1) throw e_1.error;
736
+ }
737
+ }
738
+ } else {
739
+ _parentage.remove(this);
740
+ }
741
+ }
742
+ var initialFinalizer = this.initialTeardown;
743
+ if (isFunction(initialFinalizer)) {
744
+ try {
745
+ initialFinalizer();
746
+ } catch (e) {
747
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
748
+ }
749
+ }
750
+ var _finalizers = this._finalizers;
751
+ if (_finalizers) {
752
+ this._finalizers = null;
753
+ try {
754
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
755
+ var finalizer = _finalizers_1_1.value;
756
+ try {
757
+ execFinalizer(finalizer);
758
+ } catch (err) {
759
+ errors = errors !== null && errors !== void 0 ? errors : [];
760
+ if (err instanceof UnsubscriptionError) {
761
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
762
+ } else {
763
+ errors.push(err);
764
+ }
765
+ }
766
+ }
767
+ } catch (e_2_1) {
768
+ e_2 = { error: e_2_1 };
769
+ } finally {
770
+ try {
771
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b2 = _finalizers_1.return)) _b2.call(_finalizers_1);
772
+ } finally {
773
+ if (e_2) throw e_2.error;
774
+ }
775
+ }
776
+ }
777
+ if (errors) {
778
+ throw new UnsubscriptionError(errors);
779
+ }
780
+ }
781
+ };
782
+ Subscription2.prototype.add = function(teardown) {
783
+ var _a3;
784
+ if (teardown && teardown !== this) {
785
+ if (this.closed) {
786
+ execFinalizer(teardown);
787
+ } else {
788
+ if (teardown instanceof Subscription2) {
789
+ if (teardown.closed || teardown._hasParent(this)) {
790
+ return;
791
+ }
792
+ teardown._addParent(this);
793
+ }
794
+ (this._finalizers = (_a3 = this._finalizers) !== null && _a3 !== void 0 ? _a3 : []).push(teardown);
795
+ }
796
+ }
797
+ };
798
+ Subscription2.prototype._hasParent = function(parent) {
799
+ var _parentage = this._parentage;
800
+ return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
801
+ };
802
+ Subscription2.prototype._addParent = function(parent) {
803
+ var _parentage = this._parentage;
804
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
805
+ };
806
+ Subscription2.prototype._removeParent = function(parent) {
807
+ var _parentage = this._parentage;
808
+ if (_parentage === parent) {
809
+ this._parentage = null;
810
+ } else if (Array.isArray(_parentage)) {
811
+ arrRemove(_parentage, parent);
812
+ }
813
+ };
814
+ Subscription2.prototype.remove = function(teardown) {
815
+ var _finalizers = this._finalizers;
816
+ _finalizers && arrRemove(_finalizers, teardown);
817
+ if (teardown instanceof Subscription2) {
818
+ teardown._removeParent(this);
819
+ }
820
+ };
821
+ Subscription2.EMPTY = (function() {
822
+ var empty = new Subscription2();
823
+ empty.closed = true;
824
+ return empty;
825
+ })();
826
+ return Subscription2;
827
+ })();
828
+ var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
829
+ function isSubscription(value) {
830
+ return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
831
+ }
832
+ function execFinalizer(finalizer) {
833
+ if (isFunction(finalizer)) {
834
+ finalizer();
835
+ } else {
836
+ finalizer.unsubscribe();
837
+ }
838
+ }
839
+ var config = {
840
+ Promise: void 0
841
+ };
842
+ var timeoutProvider = {
843
+ setTimeout: function(handler, timeout) {
844
+ var args = [];
845
+ for (var _i4 = 2; _i4 < arguments.length; _i4++) {
846
+ args[_i4 - 2] = arguments[_i4];
847
+ }
848
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
849
+ },
850
+ clearTimeout: function(handle) {
851
+ return clearTimeout(handle);
852
+ },
853
+ delegate: void 0
854
+ };
855
+ function reportUnhandledError(err) {
856
+ timeoutProvider.setTimeout(function() {
857
+ {
858
+ throw err;
859
+ }
860
+ });
861
+ }
862
+ function noop() {
863
+ }
864
+ function errorContext(cb) {
865
+ {
866
+ cb();
867
+ }
868
+ }
869
+ var Subscriber = (function(_super) {
870
+ __extends(Subscriber2, _super);
871
+ function Subscriber2(destination) {
872
+ var _this = _super.call(this) || this;
873
+ _this.isStopped = false;
874
+ if (destination) {
875
+ _this.destination = destination;
876
+ if (isSubscription(destination)) {
877
+ destination.add(_this);
878
+ }
879
+ } else {
880
+ _this.destination = EMPTY_OBSERVER;
881
+ }
882
+ return _this;
883
+ }
884
+ Subscriber2.create = function(next, error, complete) {
885
+ return new SafeSubscriber(next, error, complete);
886
+ };
887
+ Subscriber2.prototype.next = function(value) {
888
+ if (this.isStopped) ;
889
+ else {
890
+ this._next(value);
891
+ }
892
+ };
893
+ Subscriber2.prototype.error = function(err) {
894
+ if (this.isStopped) ;
895
+ else {
896
+ this.isStopped = true;
897
+ this._error(err);
898
+ }
899
+ };
900
+ Subscriber2.prototype.complete = function() {
901
+ if (this.isStopped) ;
902
+ else {
903
+ this.isStopped = true;
904
+ this._complete();
905
+ }
906
+ };
907
+ Subscriber2.prototype.unsubscribe = function() {
908
+ if (!this.closed) {
909
+ this.isStopped = true;
910
+ _super.prototype.unsubscribe.call(this);
911
+ this.destination = null;
912
+ }
913
+ };
914
+ Subscriber2.prototype._next = function(value) {
915
+ this.destination.next(value);
916
+ };
917
+ Subscriber2.prototype._error = function(err) {
918
+ try {
919
+ this.destination.error(err);
920
+ } finally {
921
+ this.unsubscribe();
922
+ }
923
+ };
924
+ Subscriber2.prototype._complete = function() {
925
+ try {
926
+ this.destination.complete();
927
+ } finally {
928
+ this.unsubscribe();
929
+ }
930
+ };
931
+ return Subscriber2;
932
+ })(Subscription);
933
+ var ConsumerObserver = (function() {
934
+ function ConsumerObserver2(partialObserver) {
935
+ this.partialObserver = partialObserver;
936
+ }
937
+ ConsumerObserver2.prototype.next = function(value) {
938
+ var partialObserver = this.partialObserver;
939
+ if (partialObserver.next) {
940
+ try {
941
+ partialObserver.next(value);
942
+ } catch (error) {
943
+ handleUnhandledError(error);
944
+ }
945
+ }
946
+ };
947
+ ConsumerObserver2.prototype.error = function(err) {
948
+ var partialObserver = this.partialObserver;
949
+ if (partialObserver.error) {
950
+ try {
951
+ partialObserver.error(err);
952
+ } catch (error) {
953
+ handleUnhandledError(error);
954
+ }
955
+ } else {
956
+ handleUnhandledError(err);
957
+ }
958
+ };
959
+ ConsumerObserver2.prototype.complete = function() {
960
+ var partialObserver = this.partialObserver;
961
+ if (partialObserver.complete) {
962
+ try {
963
+ partialObserver.complete();
964
+ } catch (error) {
965
+ handleUnhandledError(error);
966
+ }
967
+ }
968
+ };
969
+ return ConsumerObserver2;
970
+ })();
971
+ var SafeSubscriber = (function(_super) {
972
+ __extends(SafeSubscriber2, _super);
973
+ function SafeSubscriber2(observerOrNext, error, complete) {
974
+ var _this = _super.call(this) || this;
975
+ var partialObserver;
976
+ if (isFunction(observerOrNext) || !observerOrNext) {
977
+ partialObserver = {
978
+ next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
979
+ error: error !== null && error !== void 0 ? error : void 0,
980
+ complete: complete !== null && complete !== void 0 ? complete : void 0
981
+ };
982
+ } else {
983
+ {
984
+ partialObserver = observerOrNext;
985
+ }
986
+ }
987
+ _this.destination = new ConsumerObserver(partialObserver);
988
+ return _this;
989
+ }
990
+ return SafeSubscriber2;
991
+ })(Subscriber);
992
+ function handleUnhandledError(error) {
993
+ {
994
+ reportUnhandledError(error);
995
+ }
996
+ }
997
+ function defaultErrorHandler(err) {
998
+ throw err;
999
+ }
1000
+ var EMPTY_OBSERVER = {
1001
+ closed: true,
1002
+ next: noop,
1003
+ error: defaultErrorHandler,
1004
+ complete: noop
1005
+ };
1006
+ var observable = (function() {
1007
+ return typeof Symbol === "function" && Symbol.observable || "@@observable";
1008
+ })();
1009
+ function identity(x2) {
1010
+ return x2;
1011
+ }
1012
+ function pipeFromArray(fns) {
1013
+ if (fns.length === 0) {
1014
+ return identity;
1015
+ }
1016
+ if (fns.length === 1) {
1017
+ return fns[0];
1018
+ }
1019
+ return function piped(input) {
1020
+ return fns.reduce(function(prev, fn2) {
1021
+ return fn2(prev);
1022
+ }, input);
1023
+ };
1024
+ }
1025
+ var Observable = (function() {
1026
+ function Observable2(subscribe) {
1027
+ if (subscribe) {
1028
+ this._subscribe = subscribe;
1029
+ }
1030
+ }
1031
+ Observable2.prototype.lift = function(operator) {
1032
+ var observable2 = new Observable2();
1033
+ observable2.source = this;
1034
+ observable2.operator = operator;
1035
+ return observable2;
1036
+ };
1037
+ Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
1038
+ var _this = this;
1039
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
1040
+ errorContext(function() {
1041
+ var _a3 = _this, operator = _a3.operator, source = _a3.source;
1042
+ subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
1043
+ });
1044
+ return subscriber;
1045
+ };
1046
+ Observable2.prototype._trySubscribe = function(sink) {
1047
+ try {
1048
+ return this._subscribe(sink);
1049
+ } catch (err) {
1050
+ sink.error(err);
1051
+ }
1052
+ };
1053
+ Observable2.prototype.forEach = function(next, promiseCtor) {
1054
+ var _this = this;
1055
+ promiseCtor = getPromiseCtor(promiseCtor);
1056
+ return new promiseCtor(function(resolve, reject) {
1057
+ var subscriber = new SafeSubscriber({
1058
+ next: function(value) {
1059
+ try {
1060
+ next(value);
1061
+ } catch (err) {
1062
+ reject(err);
1063
+ subscriber.unsubscribe();
1064
+ }
1065
+ },
1066
+ error: reject,
1067
+ complete: resolve
1068
+ });
1069
+ _this.subscribe(subscriber);
1070
+ });
1071
+ };
1072
+ Observable2.prototype._subscribe = function(subscriber) {
1073
+ var _a3;
1074
+ return (_a3 = this.source) === null || _a3 === void 0 ? void 0 : _a3.subscribe(subscriber);
1075
+ };
1076
+ Observable2.prototype[observable] = function() {
1077
+ return this;
1078
+ };
1079
+ Observable2.prototype.pipe = function() {
1080
+ var operations = [];
1081
+ for (var _i4 = 0; _i4 < arguments.length; _i4++) {
1082
+ operations[_i4] = arguments[_i4];
1083
+ }
1084
+ return pipeFromArray(operations)(this);
1085
+ };
1086
+ Observable2.prototype.toPromise = function(promiseCtor) {
1087
+ var _this = this;
1088
+ promiseCtor = getPromiseCtor(promiseCtor);
1089
+ return new promiseCtor(function(resolve, reject) {
1090
+ var value;
1091
+ _this.subscribe(function(x2) {
1092
+ return value = x2;
1093
+ }, function(err) {
1094
+ return reject(err);
1095
+ }, function() {
1096
+ return resolve(value);
1097
+ });
1098
+ });
1099
+ };
1100
+ Observable2.create = function(subscribe) {
1101
+ return new Observable2(subscribe);
1102
+ };
1103
+ return Observable2;
1104
+ })();
1105
+ function getPromiseCtor(promiseCtor) {
1106
+ var _a3;
1107
+ return (_a3 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a3 !== void 0 ? _a3 : Promise;
1108
+ }
1109
+ function isObserver(value) {
1110
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
1111
+ }
1112
+ function isSubscriber(value) {
1113
+ return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
1114
+ }
1115
+ var ObjectUnsubscribedError = createErrorClass(function(_super) {
1116
+ return function ObjectUnsubscribedErrorImpl() {
1117
+ _super(this);
1118
+ this.name = "ObjectUnsubscribedError";
1119
+ this.message = "object unsubscribed";
1120
+ };
1121
+ });
1122
+ var Subject = (function(_super) {
1123
+ __extends(Subject2, _super);
1124
+ function Subject2() {
1125
+ var _this = _super.call(this) || this;
1126
+ _this.closed = false;
1127
+ _this.currentObservers = null;
1128
+ _this.observers = [];
1129
+ _this.isStopped = false;
1130
+ _this.hasError = false;
1131
+ _this.thrownError = null;
1132
+ return _this;
1133
+ }
1134
+ Subject2.prototype.lift = function(operator) {
1135
+ var subject = new AnonymousSubject(this, this);
1136
+ subject.operator = operator;
1137
+ return subject;
1138
+ };
1139
+ Subject2.prototype._throwIfClosed = function() {
1140
+ if (this.closed) {
1141
+ throw new ObjectUnsubscribedError();
1142
+ }
1143
+ };
1144
+ Subject2.prototype.next = function(value) {
1145
+ var _this = this;
1146
+ errorContext(function() {
1147
+ var e_1, _a3;
1148
+ _this._throwIfClosed();
1149
+ if (!_this.isStopped) {
1150
+ if (!_this.currentObservers) {
1151
+ _this.currentObservers = Array.from(_this.observers);
1152
+ }
1153
+ try {
1154
+ for (var _b2 = __values(_this.currentObservers), _c2 = _b2.next(); !_c2.done; _c2 = _b2.next()) {
1155
+ var observer = _c2.value;
1156
+ observer.next(value);
1157
+ }
1158
+ } catch (e_1_1) {
1159
+ e_1 = { error: e_1_1 };
1160
+ } finally {
1161
+ try {
1162
+ if (_c2 && !_c2.done && (_a3 = _b2.return)) _a3.call(_b2);
1163
+ } finally {
1164
+ if (e_1) throw e_1.error;
1165
+ }
1166
+ }
1167
+ }
1168
+ });
1169
+ };
1170
+ Subject2.prototype.error = function(err) {
1171
+ var _this = this;
1172
+ errorContext(function() {
1173
+ _this._throwIfClosed();
1174
+ if (!_this.isStopped) {
1175
+ _this.hasError = _this.isStopped = true;
1176
+ _this.thrownError = err;
1177
+ var observers = _this.observers;
1178
+ while (observers.length) {
1179
+ observers.shift().error(err);
1180
+ }
1181
+ }
1182
+ });
1183
+ };
1184
+ Subject2.prototype.complete = function() {
1185
+ var _this = this;
1186
+ errorContext(function() {
1187
+ _this._throwIfClosed();
1188
+ if (!_this.isStopped) {
1189
+ _this.isStopped = true;
1190
+ var observers = _this.observers;
1191
+ while (observers.length) {
1192
+ observers.shift().complete();
1193
+ }
1194
+ }
1195
+ });
1196
+ };
1197
+ Subject2.prototype.unsubscribe = function() {
1198
+ this.isStopped = this.closed = true;
1199
+ this.observers = this.currentObservers = null;
1200
+ };
1201
+ Object.defineProperty(Subject2.prototype, "observed", {
1202
+ get: function() {
1203
+ var _a3;
1204
+ return ((_a3 = this.observers) === null || _a3 === void 0 ? void 0 : _a3.length) > 0;
1205
+ },
1206
+ enumerable: false,
1207
+ configurable: true
1208
+ });
1209
+ Subject2.prototype._trySubscribe = function(subscriber) {
1210
+ this._throwIfClosed();
1211
+ return _super.prototype._trySubscribe.call(this, subscriber);
1212
+ };
1213
+ Subject2.prototype._subscribe = function(subscriber) {
1214
+ this._throwIfClosed();
1215
+ this._checkFinalizedStatuses(subscriber);
1216
+ return this._innerSubscribe(subscriber);
1217
+ };
1218
+ Subject2.prototype._innerSubscribe = function(subscriber) {
1219
+ var _this = this;
1220
+ var _a3 = this, hasError = _a3.hasError, isStopped = _a3.isStopped, observers = _a3.observers;
1221
+ if (hasError || isStopped) {
1222
+ return EMPTY_SUBSCRIPTION;
1223
+ }
1224
+ this.currentObservers = null;
1225
+ observers.push(subscriber);
1226
+ return new Subscription(function() {
1227
+ _this.currentObservers = null;
1228
+ arrRemove(observers, subscriber);
1229
+ });
1230
+ };
1231
+ Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
1232
+ var _a3 = this, hasError = _a3.hasError, thrownError = _a3.thrownError, isStopped = _a3.isStopped;
1233
+ if (hasError) {
1234
+ subscriber.error(thrownError);
1235
+ } else if (isStopped) {
1236
+ subscriber.complete();
1237
+ }
1238
+ };
1239
+ Subject2.prototype.asObservable = function() {
1240
+ var observable2 = new Observable();
1241
+ observable2.source = this;
1242
+ return observable2;
1243
+ };
1244
+ Subject2.create = function(destination, source) {
1245
+ return new AnonymousSubject(destination, source);
1246
+ };
1247
+ return Subject2;
1248
+ })(Observable);
1249
+ var AnonymousSubject = (function(_super) {
1250
+ __extends(AnonymousSubject2, _super);
1251
+ function AnonymousSubject2(destination, source) {
1252
+ var _this = _super.call(this) || this;
1253
+ _this.destination = destination;
1254
+ _this.source = source;
1255
+ return _this;
1256
+ }
1257
+ AnonymousSubject2.prototype.next = function(value) {
1258
+ var _a3, _b2;
1259
+ (_b2 = (_a3 = this.destination) === null || _a3 === void 0 ? void 0 : _a3.next) === null || _b2 === void 0 ? void 0 : _b2.call(_a3, value);
1260
+ };
1261
+ AnonymousSubject2.prototype.error = function(err) {
1262
+ var _a3, _b2;
1263
+ (_b2 = (_a3 = this.destination) === null || _a3 === void 0 ? void 0 : _a3.error) === null || _b2 === void 0 ? void 0 : _b2.call(_a3, err);
1264
+ };
1265
+ AnonymousSubject2.prototype.complete = function() {
1266
+ var _a3, _b2;
1267
+ (_b2 = (_a3 = this.destination) === null || _a3 === void 0 ? void 0 : _a3.complete) === null || _b2 === void 0 ? void 0 : _b2.call(_a3);
1268
+ };
1269
+ AnonymousSubject2.prototype._subscribe = function(subscriber) {
1270
+ var _a3, _b2;
1271
+ return (_b2 = (_a3 = this.source) === null || _a3 === void 0 ? void 0 : _a3.subscribe(subscriber)) !== null && _b2 !== void 0 ? _b2 : EMPTY_SUBSCRIPTION;
1272
+ };
1273
+ return AnonymousSubject2;
1274
+ })(Subject);
618
1275
  class InfiniteScroller {
619
1276
  constructor(options) {
620
1277
  __publicField(this, "enabled", true);
621
1278
  __publicField(this, "paginationOffset", 1);
622
- __publicField(this, "parseData");
623
1279
  __publicField(this, "rules");
624
1280
  __publicField(this, "observer");
625
1281
  __publicField(this, "paginationGenerator");
626
- __publicField(this, "onScrollCBs", []);
1282
+ __publicField(this, "subject", new Subject());
627
1283
  __publicField(this, "generatorConsumer", async () => {
628
1284
  if (!this.enabled) return false;
629
- const {
630
- value: { url, offset },
631
- done
632
- } = await this.paginationGenerator.next();
633
- if (!done && url) {
634
- await this.doScroll(url, offset);
635
- }
636
- return !done;
1285
+ const { value, done } = await this.paginationGenerator.next();
1286
+ if (done) return false;
1287
+ const { url, offset } = value;
1288
+ await this.doScroll(url, offset);
1289
+ return true;
637
1290
  });
638
1291
  this.rules = options.rules;
639
1292
  this.paginationOffset = this.rules.paginationStrategy.getPaginationOffset();
@@ -648,79 +1301,162 @@ class InfiniteScroller {
648
1301
  dispose() {
649
1302
  if (this.observer) this.observer.dispose();
650
1303
  }
651
- setObserver(observable) {
1304
+ setObserver(observable2) {
652
1305
  if (this.observer) this.observer.dispose();
653
1306
  this.observer = Observer.observeWhile(
654
- observable,
1307
+ observable2,
655
1308
  this.generatorConsumer,
656
1309
  this.rules.store.state.delay
657
1310
  );
658
1311
  return this;
659
1312
  }
660
- onScroll(callback, initCall = false) {
661
- if (initCall) callback(this);
662
- this.onScrollCBs.push(callback);
663
- return this;
664
- }
665
- _onScroll() {
666
- this.onScrollCBs.forEach((cb) => {
667
- cb(this);
668
- });
669
- }
670
1313
  setAutoScroll() {
671
1314
  const autoScrollWrapper = async () => {
672
1315
  if (this.rules.store.state.autoScroll) {
673
1316
  await wait(this.rules.store.state.delay);
674
- await this.generatorConsumer();
1317
+ const res = await this.generatorConsumer();
1318
+ if (!res) return;
675
1319
  await autoScrollWrapper();
676
1320
  }
677
1321
  };
678
- autoScrollWrapper();
679
- this.rules.store.stateSubject.subscribe((type) => {
680
- if (type == null ? void 0 : type.autoScroll) {
681
- autoScrollWrapper();
682
- }
1322
+ autoScrollWrapper();
1323
+ this.rules.store.stateSubject.subscribe((type) => {
1324
+ if (type == null ? void 0 : type.autoScroll) {
1325
+ autoScrollWrapper();
1326
+ }
1327
+ });
1328
+ }
1329
+ async getPaginationData(url) {
1330
+ return await fetchHtml(url);
1331
+ }
1332
+ async doScroll(url, offset) {
1333
+ const page = await this.getPaginationData(url);
1334
+ const prevScrollPos = document.documentElement.scrollTop;
1335
+ this.paginationOffset = Math.max(this.paginationOffset, offset);
1336
+ this.subject.next({ type: "scroll", scroller: this, page });
1337
+ window.scrollTo(0, prevScrollPos);
1338
+ if (this.rules.store.state.writeHistory) {
1339
+ history.replaceState({}, "", url);
1340
+ }
1341
+ }
1342
+ static async *generatorForPaginationStrategy(pstrategy) {
1343
+ const _offset = pstrategy.getPaginationOffset();
1344
+ const end = pstrategy.getPaginationLast();
1345
+ const urlGenerator = pstrategy.getPaginationUrlGenerator();
1346
+ for (let offset = _offset; offset <= end; offset++) {
1347
+ const url = await urlGenerator(offset);
1348
+ yield { url, offset };
1349
+ }
1350
+ }
1351
+ static create(rules) {
1352
+ const enabled = rules.store.state.infiniteScrollEnabled;
1353
+ rules.store.state.$paginationLast = rules.paginationStrategy.getPaginationLast();
1354
+ const infiniteScroller = new InfiniteScroller({ enabled, rules });
1355
+ rules.store.state.$paginationOffset = infiniteScroller.paginationOffset;
1356
+ infiniteScroller.subject.subscribe((x2) => {
1357
+ if (x2.type === "scroll") {
1358
+ rules.store.state.$paginationOffset = x2.scroller.paginationOffset;
1359
+ rules.dataManager.parseData(x2.page);
1360
+ }
1361
+ });
1362
+ rules.store.stateSubject.subscribe(() => {
1363
+ infiniteScroller.enabled = rules.store.state.infiniteScrollEnabled;
1364
+ });
1365
+ return infiniteScroller;
1366
+ }
1367
+ }
1368
+ class PaginationStrategy {
1369
+ constructor(options) {
1370
+ __publicField(this, "doc", document);
1371
+ __publicField(this, "url");
1372
+ __publicField(this, "paginationSelector", ".pagination");
1373
+ __publicField(this, "searchParamSelector", "page");
1374
+ __publicField(this, "pathnameSelector", /\/(\d+)\/?$/);
1375
+ __publicField(this, "dataparamSelector", "[data-parameters *= from]");
1376
+ __publicField(this, "overwritePaginationLast");
1377
+ __publicField(this, "offsetMin", 1);
1378
+ if (options) {
1379
+ Object.entries(options).forEach(([k2, v2]) => {
1380
+ Object.assign(this, { [k2]: v2 });
1381
+ });
1382
+ }
1383
+ this.url = parseUrl((options == null ? void 0 : options.url) || this.doc.URL);
1384
+ }
1385
+ getPaginationElement() {
1386
+ return this.doc.querySelector(this.paginationSelector);
1387
+ }
1388
+ get hasPagination() {
1389
+ return !!this.getPaginationElement();
1390
+ }
1391
+ getPaginationOffset() {
1392
+ return this.offsetMin;
1393
+ }
1394
+ getPaginationLast() {
1395
+ if (this.overwritePaginationLast) return this.overwritePaginationLast(1);
1396
+ return 1;
1397
+ }
1398
+ getPaginationUrlGenerator() {
1399
+ return (_2) => this.url.href;
1400
+ }
1401
+ }
1402
+ __publicField(PaginationStrategy, "_pathnameSelector", /\/(page\/)?\d+\/?$/);
1403
+ class PaginationStrategyDataParams extends PaginationStrategy {
1404
+ getPaginationLast() {
1405
+ var _a3;
1406
+ const links = (_a3 = this.getPaginationElement()) == null ? void 0 : _a3.querySelectorAll(this.dataparamSelector);
1407
+ const pages = Array.from(links || [], (l) => {
1408
+ var _a4;
1409
+ const p = l.getAttribute("data-parameters");
1410
+ const v2 = ((_a4 = p == null ? void 0 : p.match(/from\w*:(\d+)/)) == null ? void 0 : _a4[1]) || this.offsetMin.toString();
1411
+ return parseInt(v2);
1412
+ });
1413
+ const lastPage = Math.max(...pages, this.offsetMin);
1414
+ if (this.overwritePaginationLast) return this.overwritePaginationLast(lastPage);
1415
+ return lastPage;
1416
+ }
1417
+ getPaginationOffset() {
1418
+ var _a3, _b2;
1419
+ const link = (_a3 = this.getPaginationElement()) == null ? void 0 : _a3.querySelector(
1420
+ ".prev[data-parameters *= from], .prev [data-parameters *= from]"
1421
+ );
1422
+ if (!link) return this.offsetMin;
1423
+ const p = link.getAttribute("data-parameters");
1424
+ const v2 = ((_b2 = p == null ? void 0 : p.match(/from\w*:(\d+)/)) == null ? void 0 : _b2[1]) || this.offsetMin.toString();
1425
+ return parseInt(v2);
1426
+ }
1427
+ getPaginationUrlGenerator() {
1428
+ var _a3;
1429
+ const url = new URL(this.url.href);
1430
+ const parametersElement = (_a3 = this.getPaginationElement()) == null ? void 0 : _a3.querySelector(
1431
+ "a[data-block-id][data-parameters]"
1432
+ );
1433
+ const block_id = (parametersElement == null ? void 0 : parametersElement.getAttribute("data-block-id")) || "";
1434
+ const parameters = parseDataParams(
1435
+ (parametersElement == null ? void 0 : parametersElement.getAttribute("data-parameters")) || ""
1436
+ );
1437
+ const attrs = {
1438
+ block_id,
1439
+ function: "get_block",
1440
+ mode: "async",
1441
+ ...parameters
1442
+ };
1443
+ Object.keys(attrs).forEach((k2) => {
1444
+ url.searchParams.set(k2, attrs[k2]);
683
1445
  });
1446
+ const paginationUrlGenerator = (n) => {
1447
+ Object.keys(attrs).forEach((k2) => {
1448
+ k2.includes("from") && url.searchParams.set(k2, n.toString());
1449
+ });
1450
+ url.searchParams.set("_", Date.now().toString());
1451
+ return url.href;
1452
+ };
1453
+ return paginationUrlGenerator;
684
1454
  }
685
- // consume api strategy
686
- async getPaginationData(url) {
687
- return await fetchHtml(url);
688
- }
689
- async doScroll(url, offset) {
690
- var _a3;
691
- const nextPageHtml = await this.getPaginationData(url);
692
- const prevScrollPos = document.documentElement.scrollTop;
693
- this.paginationOffset = Math.max(this.paginationOffset, offset);
694
- (_a3 = this.parseData) == null ? void 0 : _a3.call(this, nextPageHtml);
695
- this._onScroll();
696
- window.scrollTo(0, prevScrollPos);
697
- if (this.rules.store.state.writeHistory) {
698
- history.replaceState({}, "", url);
699
- }
700
- }
701
- static async *generatorForPaginationStrategy(pstrategy) {
702
- const _offset = pstrategy.getPaginationOffset();
703
- const end = pstrategy.getPaginationLast();
704
- const urlGenerator = pstrategy.getPaginationUrlGenerator();
705
- for (let offset = _offset; offset <= end; offset++) {
706
- const url = await urlGenerator(offset);
707
- yield { url, offset };
708
- }
709
- }
710
- static create(rules) {
711
- const enabled = rules.store.state.infiniteScrollEnabled;
712
- rules.store.state.$paginationLast = rules.paginationStrategy.getPaginationLast();
713
- const infiniteScroller = new InfiniteScroller({
714
- enabled,
715
- parseData: rules.dataManager.parseData,
716
- rules
717
- }).onScroll(({ paginationOffset }) => {
718
- rules.store.state.$paginationOffset = paginationOffset;
719
- }, true);
720
- rules.store.stateSubject.subscribe(() => {
721
- infiniteScroller.enabled = rules.store.state.infiniteScrollEnabled;
722
- });
723
- return infiniteScroller;
1455
+ static testLinks(doc = document) {
1456
+ const dataParamLinks = Array.from(
1457
+ doc.querySelectorAll("[data-parameters *= from]")
1458
+ );
1459
+ return dataParamLinks.length > 0;
724
1460
  }
725
1461
  }
726
1462
  var Pe$1 = Object.defineProperty;
@@ -1469,9 +2205,6 @@ var Y = (_b = class {
1469
2205
  }
1470
2206
  }, _i3 = new WeakMap(), _n3 = new WeakMap(), _t2 = new WeakMap(), _e3 = new WeakMap(), _s3 = new WeakMap(), _l3 = new WeakMap(), _b);
1471
2207
  a(Y, "URLPattern");
1472
- function parseUrl(s) {
1473
- return new URL(typeof s === "string" ? s : s.href);
1474
- }
1475
2208
  function depaginatePathname(url, pathnamePaginationSelector = /\/(page\/)?\d+\/?$/) {
1476
2209
  const newUrl = new URL(url.toString());
1477
2210
  newUrl.pathname = newUrl.pathname.replace(pathnamePaginationSelector, "/");
@@ -1500,100 +2233,6 @@ function upgradePathname(curr, links, pathnamePaginationSelector = /\/(page\/)?\
1500
2233
  if (last.pathname !== curr.pathname) curr.pathname = last.pathname;
1501
2234
  return curr;
1502
2235
  }
1503
- class PaginationStrategy {
1504
- constructor(options) {
1505
- __publicField(this, "doc", document);
1506
- __publicField(this, "url");
1507
- __publicField(this, "paginationSelector", ".pagination");
1508
- __publicField(this, "searchParamSelector", "page");
1509
- __publicField(this, "pathnameSelector", /\/(\d+)\/?$/);
1510
- __publicField(this, "dataparamSelector", "[data-parameters *= from]");
1511
- __publicField(this, "overwritePaginationLast");
1512
- __publicField(this, "offsetMin", 1);
1513
- if (options) {
1514
- Object.entries(options).forEach(([k2, v2]) => {
1515
- Object.assign(this, { [k2]: v2 });
1516
- });
1517
- }
1518
- this.url = parseUrl((options == null ? void 0 : options.url) || this.doc.URL);
1519
- }
1520
- getPaginationElement() {
1521
- return this.doc.querySelector(this.paginationSelector);
1522
- }
1523
- get hasPagination() {
1524
- return !!this.getPaginationElement();
1525
- }
1526
- getPaginationOffset() {
1527
- return this.offsetMin;
1528
- }
1529
- getPaginationLast() {
1530
- if (this.overwritePaginationLast) return this.overwritePaginationLast(1);
1531
- return 1;
1532
- }
1533
- getPaginationUrlGenerator() {
1534
- return (_2) => this.url.href;
1535
- }
1536
- }
1537
- __publicField(PaginationStrategy, "_pathnameSelector", /\/(page\/)?\d+\/?$/);
1538
- class PaginationStrategyDataParams extends PaginationStrategy {
1539
- getPaginationLast() {
1540
- var _a3;
1541
- const links = (_a3 = this.getPaginationElement()) == null ? void 0 : _a3.querySelectorAll(this.dataparamSelector);
1542
- const pages = Array.from(links || [], (l) => {
1543
- var _a4;
1544
- const p = l.getAttribute("data-parameters");
1545
- const v2 = ((_a4 = p == null ? void 0 : p.match(/from\w*:(\d+)/)) == null ? void 0 : _a4[1]) || this.offsetMin.toString();
1546
- return parseInt(v2);
1547
- });
1548
- const lastPage = Math.max(...pages, this.offsetMin);
1549
- if (this.overwritePaginationLast) return this.overwritePaginationLast(lastPage);
1550
- return lastPage;
1551
- }
1552
- getPaginationOffset() {
1553
- var _a3, _b2;
1554
- const link = (_a3 = this.getPaginationElement()) == null ? void 0 : _a3.querySelector(
1555
- ".prev[data-parameters *= from], .prev [data-parameters *= from]"
1556
- );
1557
- if (!link) return this.offsetMin;
1558
- const p = link.getAttribute("data-parameters");
1559
- const v2 = ((_b2 = p == null ? void 0 : p.match(/from\w*:(\d+)/)) == null ? void 0 : _b2[1]) || this.offsetMin.toString();
1560
- return parseInt(v2);
1561
- }
1562
- getPaginationUrlGenerator() {
1563
- var _a3;
1564
- const url = new URL(this.url.href);
1565
- const parametersElement = (_a3 = this.getPaginationElement()) == null ? void 0 : _a3.querySelector(
1566
- "a[data-block-id][data-parameters]"
1567
- );
1568
- const block_id = (parametersElement == null ? void 0 : parametersElement.getAttribute("data-block-id")) || "";
1569
- const parameters = parseDataParams(
1570
- (parametersElement == null ? void 0 : parametersElement.getAttribute("data-parameters")) || ""
1571
- );
1572
- const attrs = {
1573
- block_id,
1574
- function: "get_block",
1575
- mode: "async",
1576
- ...parameters
1577
- };
1578
- Object.keys(attrs).forEach((k2) => {
1579
- url.searchParams.set(k2, attrs[k2]);
1580
- });
1581
- const paginationUrlGenerator = (n) => {
1582
- Object.keys(attrs).forEach((k2) => {
1583
- k2.includes("from") && url.searchParams.set(k2, n.toString());
1584
- });
1585
- url.searchParams.set("_", Date.now().toString());
1586
- return url.href;
1587
- };
1588
- return paginationUrlGenerator;
1589
- }
1590
- static testLinks(doc = document) {
1591
- const dataParamLinks = Array.from(
1592
- doc.querySelectorAll("[data-parameters *= from]")
1593
- );
1594
- return dataParamLinks.length > 0;
1595
- }
1596
- }
1597
2236
  class PaginationStrategyPathnameParams extends PaginationStrategy {
1598
2237
  constructor() {
1599
2238
  super(...arguments);
@@ -1733,6 +2372,156 @@ function getPaginationStrategy(options) {
1733
2372
  const paginationStrategy = new PaginationStrategyConstructor(options);
1734
2373
  return paginationStrategy;
1735
2374
  }
2375
+ class ThumbDataParser {
2376
+ constructor(strategy = "manual", selectors = {}, callback, stringsMeltInTitle = true) {
2377
+ __publicField(this, "thumbDataSelectors", []);
2378
+ __publicField(this, "defaultThumbDataSelectors", [
2379
+ { name: "title", type: "string", selector: "[class *= title],[title]" },
2380
+ {
2381
+ name: "uploader",
2382
+ type: "string",
2383
+ selector: "[class *= uploader], [class *= user], [class *= name]"
2384
+ },
2385
+ { name: "duration", type: "duration", selector: "[class *= duration]" }
2386
+ ]);
2387
+ this.strategy = strategy;
2388
+ this.selectors = selectors;
2389
+ this.callback = callback;
2390
+ this.stringsMeltInTitle = stringsMeltInTitle;
2391
+ this.preprocessCustomThumbDataSelectors();
2392
+ }
2393
+ autoParseText(thumb) {
2394
+ var _a3;
2395
+ const title = sanitizeStr(thumb.innerText);
2396
+ const duration = timeToSeconds(((_a3 = title.match(/\d+m|\d+:\d+/)) == null ? void 0 : _a3[0]) || "");
2397
+ return { title, duration };
2398
+ }
2399
+ preprocessCustomThumbDataSelectors() {
2400
+ if (!this.selectors) return;
2401
+ Object.entries(this.selectors).forEach(([key, value]) => {
2402
+ if (typeof value === "string") {
2403
+ const defaultSelector = this.defaultThumbDataSelectors.find((e) => e.name === key);
2404
+ if (!defaultSelector) {
2405
+ this.thumbDataSelectors.push({ name: key, selector: value, type: "string" });
2406
+ } else {
2407
+ defaultSelector.selector = value;
2408
+ this.thumbDataSelectors.push(defaultSelector);
2409
+ }
2410
+ } else {
2411
+ this.thumbDataSelectors.push({ name: key, ...value });
2412
+ }
2413
+ });
2414
+ }
2415
+ getThumbDataWith(thumb, { type, selector }) {
2416
+ var _a3;
2417
+ if (type === "boolean") {
2418
+ return !!thumb.querySelector(selector);
2419
+ }
2420
+ if (type === "string") {
2421
+ return sanitizeStr(((_a3 = querySelectorLast(thumb, selector)) == null ? void 0 : _a3.innerText) || "");
2422
+ }
2423
+ if (type === "duration") {
2424
+ return timeToSeconds(querySelectorText(thumb, selector));
2425
+ }
2426
+ return Number.parseInt(querySelectorText(thumb, selector));
2427
+ }
2428
+ static create(o = {}) {
2429
+ return new ThumbDataParser(o.strategy, o.selectors, o.callback, o.stringsMeltInTitle);
2430
+ }
2431
+ getThumbData(thumb) {
2432
+ var _a3;
2433
+ if (this.strategy === "auto-text") {
2434
+ return this.autoParseText(thumb);
2435
+ }
2436
+ if (this.strategy === "auto-select") {
2437
+ this.thumbDataSelectors = this.defaultThumbDataSelectors;
2438
+ }
2439
+ const thumbData = Object.fromEntries(
2440
+ this.thumbDataSelectors.map((s) => [s.name, this.getThumbDataWith(thumb, s)])
2441
+ );
2442
+ if (this.stringsMeltInTitle) {
2443
+ Object.entries(thumbData).forEach(([k2, v2]) => {
2444
+ if (typeof v2 === "string" && k2 !== "title") {
2445
+ thumbData.title = `${thumbData.title} ${k2}:${v2}`;
2446
+ delete thumbData[k2];
2447
+ }
2448
+ });
2449
+ }
2450
+ (_a3 = this.callback) == null ? void 0 : _a3.call(this, thumb, thumbData);
2451
+ return thumbData;
2452
+ }
2453
+ }
2454
+ class ThumbImgParser {
2455
+ constructor() {
2456
+ __publicField(this, "selector");
2457
+ __publicField(this, "remove");
2458
+ __publicField(this, "strategy", "default");
2459
+ }
2460
+ static create(options = {}) {
2461
+ return Object.assign(new ThumbImgParser(), options);
2462
+ }
2463
+ removeAttrs(img) {
2464
+ if (!this.remove) return;
2465
+ if (this.remove === "auto") {
2466
+ removeClassesAndDataAttributes(img, "lazy");
2467
+ } else {
2468
+ if (this.remove.startsWith(".")) {
2469
+ img.classList.remove(this.remove.slice(1));
2470
+ } else {
2471
+ img.removeAttribute(this.remove);
2472
+ }
2473
+ }
2474
+ }
2475
+ getImgSrc(img) {
2476
+ const possibleAttrs = this.selector ? [this.selector].flat() : ["data-src", "src"];
2477
+ for (const attr of possibleAttrs) {
2478
+ const imgSrc = img.getAttribute(attr);
2479
+ if (imgSrc) {
2480
+ return imgSrc;
2481
+ }
2482
+ }
2483
+ return "";
2484
+ }
2485
+ getImgData(thumb) {
2486
+ if (this.strategy === "default" && !this.selector) return {};
2487
+ const img = thumb.querySelector("img");
2488
+ if (!img) return {};
2489
+ const imgSrc = typeof this.selector === "function" ? this.selector(img) : this.getImgSrc(img);
2490
+ this.removeAttrs(img);
2491
+ if (img.src.includes("data:image")) {
2492
+ img.src = "";
2493
+ }
2494
+ if (img.complete && img.naturalWidth > 0) {
2495
+ return {};
2496
+ }
2497
+ return { img, imgSrc };
2498
+ }
2499
+ }
2500
+ class ThumbsParser {
2501
+ constructor(containerSelector) {
2502
+ __publicField(this, "selector", ".thumb");
2503
+ __publicField(this, "strategy", "default");
2504
+ __publicField(this, "transform");
2505
+ this.containerSelector = containerSelector;
2506
+ }
2507
+ static create(options = {}, containerSelector) {
2508
+ return Object.assign(new ThumbsParser(containerSelector), options);
2509
+ }
2510
+ getThumbs(html) {
2511
+ if (!html) return [];
2512
+ let thumbs;
2513
+ if (this.strategy === "auto") {
2514
+ if (typeof this.selector !== "string") return [];
2515
+ const container = html.querySelector(this.containerSelector);
2516
+ thumbs = [...(container == null ? void 0 : container.children) || []];
2517
+ }
2518
+ thumbs = Array.from(html.querySelectorAll(this.selector));
2519
+ if (typeof this.transform === "function") {
2520
+ thumbs.forEach(this.transform);
2521
+ }
2522
+ return thumbs;
2523
+ }
2524
+ }
1736
2525
  var xi = {};
1737
2526
  // @__NO_SIDE_EFFECTS__
1738
2527
  function oe(t) {
@@ -8286,27 +9075,21 @@ const StoreStateDefault = {
8286
9075
  $paginationLast: 1,
8287
9076
  $paginationOffset: 1
8288
9077
  };
8289
- class RulesGlobal {
9078
+ class Rules {
8290
9079
  constructor(options) {
8291
- __publicField(this, "delay");
8292
- __publicField(this, "customGenerator");
8293
- __publicField(this, "titleSelector");
8294
- __publicField(this, "uploaderSelector");
8295
- __publicField(this, "durationSelector");
8296
- __publicField(this, "customThumbDataSelectors");
8297
- __publicField(this, "getThumbDataStrategy", "default");
8298
- __publicField(this, "getThumbDataCallback");
8299
- __publicField(this, "getThumbImgDataAttrSelector");
8300
- __publicField(this, "getThumbImgDataAttrDelete");
8301
- __publicField(this, "getThumbImgDataStrategy", "default");
9080
+ __publicField(this, "thumb", {});
9081
+ __publicField(this, "thumbDataParser");
9082
+ __publicField(this, "thumbImg", {});
9083
+ __publicField(this, "thumbImgParser");
9084
+ __publicField(this, "thumbs", {});
9085
+ __publicField(this, "thumbsParser");
8302
9086
  __publicField(this, "containerSelector", ".container");
8303
9087
  __publicField(this, "containerSelectorLast");
8304
9088
  __publicField(this, "intersectionObservableSelector");
8305
- __publicField(this, "thumbsSelector", ".thumb");
8306
- __publicField(this, "getThumbsStrategy", "default");
8307
- __publicField(this, "getThumbsTransform");
8308
9089
  __publicField(this, "paginationStrategyOptions", {});
8309
9090
  __publicField(this, "paginationStrategy");
9091
+ __publicField(this, "dataManager");
9092
+ __publicField(this, "dataHomogenity");
8310
9093
  __publicField(this, "customDataSelectorFns", [
8311
9094
  "filterInclude",
8312
9095
  "filterExclude",
@@ -8317,121 +9100,27 @@ class RulesGlobal {
8317
9100
  __publicField(this, "schemeOptions", []);
8318
9101
  __publicField(this, "store");
8319
9102
  __publicField(this, "gui");
8320
- __publicField(this, "dataManager");
9103
+ __publicField(this, "customGenerator");
8321
9104
  __publicField(this, "infiniteScroller");
8322
9105
  __publicField(this, "getPaginationData");
8323
9106
  __publicField(this, "gropeStrategy", "all-in-one");
8324
- __publicField(this, "dataManagerOptions", {});
8325
9107
  __publicField(this, "mutationObservers", []);
8326
9108
  __publicField(this, "resetOnPaginationOrContainerDeath", true);
8327
9109
  __publicField(this, "onResetCallback");
8328
9110
  if (this.isEmbedded) throw Error("Embedded is not supported");
8329
9111
  Object.assign(this, options);
9112
+ this.thumbDataParser = ThumbDataParser.create(this.thumb);
9113
+ this.thumbImgParser = ThumbImgParser.create(this.thumbImg);
9114
+ this.thumbsParser = ThumbsParser.create(this.thumbs, this.containerSelector);
8330
9115
  this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
8331
9116
  this.store = this.createStore();
8332
9117
  this.gui = this.createGui();
8333
- this.dataManager = this.setupDataManager();
9118
+ this.dataManager = new DataManager(this, this.dataHomogenity);
8334
9119
  this.reset();
8335
9120
  }
8336
9121
  getThumbUrl(thumb) {
8337
9122
  return (thumb.querySelector("a[href]") || thumb).href;
8338
9123
  }
8339
- getThumbData(thumb) {
8340
- var _a3, _b2;
8341
- let { titleSelector, uploaderSelector, durationSelector } = this;
8342
- const thumbData = { title: "" };
8343
- if (this.getThumbDataStrategy === "auto-text") {
8344
- const text = sanitizeStr(thumb.innerText);
8345
- thumbData.title = text;
8346
- thumbData.duration = timeToSeconds(((_a3 = text.match(/\d+m|\d+:\d+/)) == null ? void 0 : _a3[0]) || "");
8347
- return thumbData;
8348
- }
8349
- if (this.getThumbDataStrategy === "auto-select") {
8350
- titleSelector = "[class *= title],[title]";
8351
- durationSelector = "[class *= duration]";
8352
- uploaderSelector = "[class *= uploader], [class *= user], [class *= name]";
8353
- }
8354
- if (this.getThumbDataStrategy === "auto-select") {
8355
- const selected = querySelectorLast(thumb, titleSelector);
8356
- if (selected) {
8357
- thumbData.title = sanitizeStr(selected.innerText);
8358
- } else {
8359
- thumbData.title = sanitizeStr(thumb.innerText);
8360
- }
8361
- } else {
8362
- thumbData.title = querySelectorText(thumb, titleSelector);
8363
- }
8364
- if (uploaderSelector) {
8365
- const uploader = querySelectorText(thumb, uploaderSelector);
8366
- thumbData.title = `${thumbData.title} user:${uploader}`;
8367
- }
8368
- if (durationSelector) {
8369
- const duration = timeToSeconds(querySelectorText(thumb, durationSelector));
8370
- thumbData.duration = duration;
8371
- }
8372
- (_b2 = this.getThumbDataCallback) == null ? void 0 : _b2.call(this, thumb, thumbData);
8373
- function getCustomThumbData(selector, type) {
8374
- if (type === "boolean") {
8375
- return !!thumb.querySelector(selector);
8376
- }
8377
- if (type === "string") {
8378
- return querySelectorText(thumb, selector);
8379
- }
8380
- return Number.parseInt(querySelectorText(thumb, selector));
8381
- }
8382
- if (this.customThumbDataSelectors) {
8383
- Object.entries(this.customThumbDataSelectors).forEach(([name, x2]) => {
8384
- const data = getCustomThumbData(x2.selector, x2.type);
8385
- Object.assign(thumbData, { [name]: data });
8386
- });
8387
- }
8388
- return thumbData;
8389
- }
8390
- getThumbImgData(thumb) {
8391
- const result = {};
8392
- if (this.getThumbImgDataStrategy === "auto") {
8393
- const img = thumb.querySelector("img");
8394
- if (!img) return {};
8395
- result.img = img;
8396
- if (typeof this.getThumbImgDataAttrSelector === "function") {
8397
- result.imgSrc = this.getThumbImgDataAttrSelector(img);
8398
- } else {
8399
- const possibleAttrs = this.getThumbImgDataAttrSelector ? [this.getThumbImgDataAttrSelector].flat() : ["data-src", "src"];
8400
- for (const attr of possibleAttrs) {
8401
- const imgSrc = img.getAttribute(attr);
8402
- if (imgSrc) {
8403
- result.imgSrc = imgSrc;
8404
- img.removeAttribute(attr);
8405
- break;
8406
- }
8407
- }
8408
- }
8409
- if (this.getThumbImgDataAttrDelete) {
8410
- if (this.getThumbImgDataAttrDelete === "auto") {
8411
- removeClassesAndDataAttributes(img, "lazy");
8412
- } else {
8413
- if (this.getThumbImgDataAttrDelete.startsWith(".")) {
8414
- img.classList.remove(this.getThumbImgDataAttrDelete.slice(1));
8415
- } else {
8416
- img.removeAttribute(this.getThumbImgDataAttrDelete);
8417
- }
8418
- }
8419
- if (img.src.includes("data:image")) {
8420
- result.img.src = "";
8421
- }
8422
- if (img.complete && img.naturalWidth > 0) {
8423
- return {};
8424
- }
8425
- }
8426
- }
8427
- return result;
8428
- }
8429
- get intersectionObservable() {
8430
- return this.intersectionObservableSelector && document.querySelector(this.intersectionObservableSelector);
8431
- }
8432
- get observable() {
8433
- return this.intersectionObservable || this.paginationStrategy.getPaginationElement();
8434
- }
8435
9124
  get container() {
8436
9125
  if (typeof this.containerSelectorLast === "string") {
8437
9126
  return querySelectorLast(document, this.containerSelectorLast);
@@ -8441,23 +9130,15 @@ class RulesGlobal {
8441
9130
  }
8442
9131
  return this.containerSelector();
8443
9132
  }
8444
- getThumbs(html) {
8445
- if (!html) return [];
8446
- let thumbs;
8447
- if (this.getThumbsStrategy === "auto") {
8448
- if (typeof this.containerSelector !== "string") return [];
8449
- const container = html.querySelector(this.containerSelector);
8450
- thumbs = [...(container == null ? void 0 : container.children) || []];
8451
- }
8452
- thumbs = Array.from(html.querySelectorAll(this.thumbsSelector));
8453
- if (typeof this.getThumbsTransform === "function") {
8454
- thumbs.forEach(this.getThumbsTransform);
8455
- }
8456
- return thumbs;
9133
+ get intersectionObservable() {
9134
+ return this.intersectionObservableSelector && document.querySelector(this.intersectionObservableSelector);
9135
+ }
9136
+ get observable() {
9137
+ return this.intersectionObservable || this.paginationStrategy.getPaginationElement();
8457
9138
  }
8458
9139
  createStore() {
8459
- const config = { ...StoreStateDefault, ...this.storeOptions };
8460
- this.store = new Up(config);
9140
+ const config2 = { ...StoreStateDefault, ...this.storeOptions };
9141
+ this.store = new Up(config2);
8461
9142
  return this.store;
8462
9143
  }
8463
9144
  createGui() {
@@ -8481,7 +9162,7 @@ class RulesGlobal {
8481
9162
  (_a3 = this.dataManager) == null ? void 0 : _a3.parseData(this.container, this.container);
8482
9163
  }
8483
9164
  if (this.gropeStrategy === "all-in-all") {
8484
- getCommonParents(this.getThumbs(document.body)).forEach((c) => {
9165
+ getCommonParents(this.thumbsParser.getThumbs(document.body)).forEach((c) => {
8485
9166
  this.dataManager.parseData(c, c, true);
8486
9167
  });
8487
9168
  }
@@ -8513,13 +9194,6 @@ class RulesGlobal {
8513
9194
  this.dataManager.applyFilters(a2);
8514
9195
  });
8515
9196
  }
8516
- setupDataManager() {
8517
- this.dataManager = new DataManager(this);
8518
- if (this.dataManagerOptions) {
8519
- Object.assign(this.dataManager, this.dataManagerOptions);
8520
- }
8521
- return this.dataManager;
8522
- }
8523
9197
  resetOn() {
8524
9198
  if (!this.resetOnPaginationOrContainerDeath) return;
8525
9199
  const observables = [
@@ -8541,7 +9215,7 @@ class RulesGlobal {
8541
9215
  });
8542
9216
  this.mutationObservers = [];
8543
9217
  this.paginationStrategy = getPaginationStrategy(this.paginationStrategyOptions);
8544
- this.setupDataManager();
9218
+ this.dataManager = new DataManager(this, this.dataHomogenity);
8545
9219
  this.setupStoreListeners();
8546
9220
  this.resetInfiniteScroller();
8547
9221
  this.container && ((_a3 = this.animatePreview) == null ? void 0 : _a3.call(this, this.container));
@@ -8551,13 +9225,22 @@ class RulesGlobal {
8551
9225
  }
8552
9226
  }
8553
9227
  export {
9228
+ DataFilter,
8554
9229
  DataManager,
8555
9230
  InfiniteScroller,
8556
9231
  LazyImgLoader,
9232
+ MOBILE_UA,
8557
9233
  Observer,
8558
9234
  OnHover,
9235
+ PaginationStrategy,
9236
+ PaginationStrategyDataParams,
9237
+ PaginationStrategyPathnameParams,
9238
+ PaginationStrategySearchParams,
8559
9239
  RegexFilter,
8560
- RulesGlobal,
9240
+ Rules,
9241
+ ThumbDataParser,
9242
+ ThumbImgParser,
9243
+ ThumbsParser,
8561
9244
  Tick,
8562
9245
  checkHomogenity,
8563
9246
  chunks,
@@ -8570,6 +9253,7 @@ export {
8570
9253
  fetchText,
8571
9254
  fetchWith,
8572
9255
  findNextSibling,
9256
+ formatTimeToHHMMSS,
8573
9257
  getCommonParents,
8574
9258
  getPaginationStrategy,
8575
9259
  instantiateTemplate,
@@ -8579,6 +9263,7 @@ export {
8579
9263
  parseDataParams,
8580
9264
  parseHtml,
8581
9265
  parseIntegerOr,
9266
+ parseUrl,
8582
9267
  querySelectorLast,
8583
9268
  querySelectorLastNumber,
8584
9269
  querySelectorText,