@brndts/brndts-ads 1.1.5 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -499,22 +499,22 @@ var require_events = __commonJS({
499
499
  var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value2) {
500
500
  return value2 !== value2;
501
501
  };
502
- function EventEmitter6() {
503
- EventEmitter6.init.call(this);
502
+ function EventEmitter7() {
503
+ EventEmitter7.init.call(this);
504
504
  }
505
- module2.exports = EventEmitter6;
505
+ module2.exports = EventEmitter7;
506
506
  module2.exports.once = once;
507
- EventEmitter6.EventEmitter = EventEmitter6;
508
- EventEmitter6.prototype._events = void 0;
509
- EventEmitter6.prototype._eventsCount = 0;
510
- EventEmitter6.prototype._maxListeners = void 0;
507
+ EventEmitter7.EventEmitter = EventEmitter7;
508
+ EventEmitter7.prototype._events = void 0;
509
+ EventEmitter7.prototype._eventsCount = 0;
510
+ EventEmitter7.prototype._maxListeners = void 0;
511
511
  var defaultMaxListeners = 10;
512
512
  function checkListener(listener2) {
513
513
  if (typeof listener2 !== "function") {
514
514
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + (typeof listener2 === "undefined" ? "undefined" : _type_of(listener2)));
515
515
  }
516
516
  }
517
- Object.defineProperty(EventEmitter6, "defaultMaxListeners", {
517
+ Object.defineProperty(EventEmitter7, "defaultMaxListeners", {
518
518
  enumerable: true,
519
519
  get: function get() {
520
520
  return defaultMaxListeners;
@@ -526,14 +526,14 @@ var require_events = __commonJS({
526
526
  defaultMaxListeners = arg;
527
527
  }
528
528
  });
529
- EventEmitter6.init = function() {
529
+ EventEmitter7.init = function() {
530
530
  if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
531
531
  this._events = /* @__PURE__ */ Object.create(null);
532
532
  this._eventsCount = 0;
533
533
  }
534
534
  this._maxListeners = this._maxListeners || void 0;
535
535
  };
536
- EventEmitter6.prototype.setMaxListeners = function setMaxListeners(n) {
536
+ EventEmitter7.prototype.setMaxListeners = function setMaxListeners(n) {
537
537
  if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
538
538
  throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
539
539
  }
@@ -541,13 +541,13 @@ var require_events = __commonJS({
541
541
  return this;
542
542
  };
543
543
  function _getMaxListeners(that) {
544
- if (that._maxListeners === void 0) return EventEmitter6.defaultMaxListeners;
544
+ if (that._maxListeners === void 0) return EventEmitter7.defaultMaxListeners;
545
545
  return that._maxListeners;
546
546
  }
547
- EventEmitter6.prototype.getMaxListeners = function getMaxListeners() {
547
+ EventEmitter7.prototype.getMaxListeners = function getMaxListeners() {
548
548
  return _getMaxListeners(this);
549
549
  };
550
- EventEmitter6.prototype.emit = function emit(type) {
550
+ EventEmitter7.prototype.emit = function emit(type) {
551
551
  var args = [];
552
552
  for(var i = 1; i < arguments.length; i++)args.push(arguments[i]);
553
553
  var doError = type === "error";
@@ -621,11 +621,11 @@ var require_events = __commonJS({
621
621
  }
622
622
  return target;
623
623
  }
624
- EventEmitter6.prototype.addListener = function addListener(type, listener2) {
624
+ EventEmitter7.prototype.addListener = function addListener(type, listener2) {
625
625
  return _addListener(this, type, listener2, false);
626
626
  };
627
- EventEmitter6.prototype.on = EventEmitter6.prototype.addListener;
628
- EventEmitter6.prototype.prependListener = function prependListener(type, listener2) {
627
+ EventEmitter7.prototype.on = EventEmitter7.prototype.addListener;
628
+ EventEmitter7.prototype.prependListener = function prependListener(type, listener2) {
629
629
  return _addListener(this, type, listener2, true);
630
630
  };
631
631
  function onceWrapper() {
@@ -649,17 +649,17 @@ var require_events = __commonJS({
649
649
  state.wrapFn = wrapped;
650
650
  return wrapped;
651
651
  }
652
- EventEmitter6.prototype.once = function once2(type, listener2) {
652
+ EventEmitter7.prototype.once = function once2(type, listener2) {
653
653
  checkListener(listener2);
654
654
  this.on(type, _onceWrap(this, type, listener2));
655
655
  return this;
656
656
  };
657
- EventEmitter6.prototype.prependOnceListener = function prependOnceListener(type, listener2) {
657
+ EventEmitter7.prototype.prependOnceListener = function prependOnceListener(type, listener2) {
658
658
  checkListener(listener2);
659
659
  this.prependListener(type, _onceWrap(this, type, listener2));
660
660
  return this;
661
661
  };
662
- EventEmitter6.prototype.removeListener = function removeListener(type, listener2) {
662
+ EventEmitter7.prototype.removeListener = function removeListener(type, listener2) {
663
663
  var list, events, position, i, originalListener;
664
664
  checkListener(listener2);
665
665
  events = this._events;
@@ -691,8 +691,8 @@ var require_events = __commonJS({
691
691
  }
692
692
  return this;
693
693
  };
694
- EventEmitter6.prototype.off = EventEmitter6.prototype.removeListener;
695
- EventEmitter6.prototype.removeAllListeners = function removeAllListeners(type) {
694
+ EventEmitter7.prototype.off = EventEmitter7.prototype.removeListener;
695
+ EventEmitter7.prototype.removeAllListeners = function removeAllListeners(type) {
696
696
  var listeners, events, i;
697
697
  events = this._events;
698
698
  if (events === void 0) return this;
@@ -741,20 +741,20 @@ var require_events = __commonJS({
741
741
  ];
742
742
  return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
743
743
  }
744
- EventEmitter6.prototype.listeners = function listeners(type) {
744
+ EventEmitter7.prototype.listeners = function listeners(type) {
745
745
  return _listeners(this, type, true);
746
746
  };
747
- EventEmitter6.prototype.rawListeners = function rawListeners(type) {
747
+ EventEmitter7.prototype.rawListeners = function rawListeners(type) {
748
748
  return _listeners(this, type, false);
749
749
  };
750
- EventEmitter6.listenerCount = function(emitter, type) {
750
+ EventEmitter7.listenerCount = function(emitter, type) {
751
751
  if (typeof emitter.listenerCount === "function") {
752
752
  return emitter.listenerCount(type);
753
753
  } else {
754
754
  return listenerCount.call(emitter, type);
755
755
  }
756
756
  };
757
- EventEmitter6.prototype.listenerCount = listenerCount;
757
+ EventEmitter7.prototype.listenerCount = listenerCount;
758
758
  function listenerCount(type) {
759
759
  var events = this._events;
760
760
  if (events !== void 0) {
@@ -767,7 +767,7 @@ var require_events = __commonJS({
767
767
  }
768
768
  return 0;
769
769
  }
770
- EventEmitter6.prototype.eventNames = function eventNames() {
770
+ EventEmitter7.prototype.eventNames = function eventNames() {
771
771
  return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
772
772
  };
773
773
  function arrayClone(arr, n) {
@@ -19029,12 +19029,8 @@ function _getGeneralInfo() {
19029
19029
  var info;
19030
19030
  return _ts_generator(this, function(_state) {
19031
19031
  info = {};
19032
- try {
19033
- info.ua = navigator.userAgent;
19034
- info.domain = window.location.hostname;
19035
- } catch (error) {
19036
- console.log("Error getting info", error);
19037
- }
19032
+ info.ua = navigator.userAgent;
19033
+ info.domain = window.location.hostname;
19038
19034
  return [
19039
19035
  2,
19040
19036
  info
@@ -19215,8 +19211,8 @@ var defaults = {
19215
19211
  enabled: true,
19216
19212
  useLocalCache: false,
19217
19213
  presentation: {
19218
- duration: 2,
19219
- cooldown: 10
19214
+ duration: 3,
19215
+ cooldown: 3
19220
19216
  },
19221
19217
  regions: {
19222
19218
  useCache: true,
@@ -19822,41 +19818,70 @@ var MappedCollection = /*#__PURE__*/ function() {
19822
19818
  ]);
19823
19819
  return MappedCollection;
19824
19820
  }();
19825
- // src/Ads/Regions/Region.ts
19826
- var Plane = /*#__PURE__*/ function() {
19821
+ // src/Ads/Regions/RegionComponents.ts
19822
+ var import_events = __toESM(require_events());
19823
+ var RegionContours = /*#__PURE__*/ function(_import_events_default) {
19827
19824
  "use strict";
19828
- function Plane(descriptor) {
19829
- _class_call_check(this, Plane);
19830
- this.size = _object_spread({
19831
- width: 0,
19832
- height: 0
19833
- }, descriptor || {});
19825
+ _inherits(_RegionContours, _import_events_default);
19826
+ function _RegionContours(contours) {
19827
+ _class_call_check(this, _RegionContours);
19828
+ var _this;
19829
+ _this = _call_super(this, _RegionContours);
19830
+ _this.points = _to_consumable_array(contours || []);
19831
+ return _this;
19834
19832
  }
19835
- _create_class(Plane, [
19833
+ _create_class(_RegionContours, [
19834
+ {
19835
+ key: "isEqual",
19836
+ value: function isEqual(points) {
19837
+ return _RegionContours.isEqual(this.points, points);
19838
+ }
19839
+ },
19836
19840
  {
19837
19841
  key: "update",
19838
- value: function update(descriptor) {
19839
- this.size = _object_spread({
19840
- width: 0,
19841
- height: 0
19842
- }, descriptor || {});
19842
+ value: function update(contours) {
19843
+ this.points = _to_consumable_array(contours);
19844
+ this.emit("update");
19845
+ }
19846
+ }
19847
+ ], [
19848
+ {
19849
+ key: "isEqual",
19850
+ value: function isEqual(contoursA, contoursB) {
19851
+ return contoursA.every(function(v, i) {
19852
+ return v.x === contoursB[i].x && v.y === contoursB[i].y;
19853
+ });
19843
19854
  }
19844
19855
  }
19845
19856
  ]);
19846
- return Plane;
19847
- }();
19848
- var RegionBox = /*#__PURE__*/ function() {
19857
+ return _RegionContours;
19858
+ }(import_events.default);
19859
+ var RegionBox = /*#__PURE__*/ function(_import_events_default) {
19849
19860
  "use strict";
19861
+ _inherits(_RegionBox, _import_events_default);
19850
19862
  function _RegionBox(coords) {
19851
19863
  _class_call_check(this, _RegionBox);
19852
- this.coords = _object_spread({
19864
+ var _this;
19865
+ _this = _call_super(this, _RegionBox);
19866
+ _this.coords = _object_spread({
19853
19867
  x1: 0,
19854
19868
  x2: 0,
19855
19869
  y1: 0,
19856
19870
  y2: 0
19857
19871
  }, coords || {});
19872
+ return _this;
19858
19873
  }
19859
19874
  _create_class(_RegionBox, [
19875
+ {
19876
+ key: "update",
19877
+ value: function update(coords) {
19878
+ if (_RegionBox.isEqual(this.coords, coords)) {
19879
+ return;
19880
+ }
19881
+ this.coords = _object_spread({}, coords);
19882
+ this.emit("update");
19883
+ }
19884
+ },
19860
19885
  {
19861
19886
  key: "isEqual",
19862
19887
  value: function isEqual(coordsB) {
@@ -19908,30 +19933,121 @@ var RegionBox = /*#__PURE__*/ function() {
19908
19933
  }
19909
19934
  ]);
19910
19935
  return _RegionBox;
19936
+ }(import_events.default);
19937
+ var Plane = /*#__PURE__*/ function(_import_events_default) {
19938
+ "use strict";
19939
+ _inherits(Plane, _import_events_default);
19940
+ function Plane(descriptor) {
19941
+ _class_call_check(this, Plane);
19942
+ var _this;
19943
+ _this = _call_super(this, Plane);
19944
+ _this.size = _object_spread({
19945
+ width: 0,
19946
+ height: 0
19947
+ }, descriptor || {});
19948
+ return _this;
19949
+ }
19950
+ _create_class(Plane, [
19951
+ {
19952
+ key: "update",
19953
+ value: function update(descriptor) {
19954
+ this.size = _object_spread({
19955
+ width: 0,
19956
+ height: 0
19957
+ }, descriptor || {});
19958
+ this.emit("update");
19959
+ }
19960
+ }
19961
+ ]);
19962
+ return Plane;
19963
+ }(import_events.default);
19964
+ var RegionContent = /*#__PURE__*/ function() {
19965
+ "use strict";
19966
+ function RegionContent(plane, box) {
19967
+ _class_call_check(this, RegionContent);
19968
+ this.plane = plane;
19969
+ this.box = box;
19970
+ this.container = document.createElement("div");
19971
+ this.container.classList.add("BRNDTS_RB");
19972
+ this.render();
19973
+ }
19974
+ _create_class(RegionContent, [
19975
+ {
19976
+ key: "view",
19977
+ get: function get() {
19978
+ return this.container;
19979
+ }
19980
+ },
19981
+ {
19982
+ key: "hasContent",
19983
+ get: function get() {
19984
+ return this.container.childNodes.length > 0;
19985
+ }
19986
+ },
19987
+ {
19988
+ key: "addContent",
19989
+ value: function addContent(content) {
19990
+ var _this = this;
19991
+ this.container.innerHTML = "";
19992
+ if (Array.isArray(content)) {
19993
+ content.forEach(function(element) {
19994
+ return _this.container.appendChild(element);
19995
+ });
19996
+ } else {
19997
+ this.container.appendChild(content);
19998
+ }
19999
+ this.render();
20000
+ }
20001
+ },
20002
+ {
20003
+ key: "render",
20004
+ value: function render() {
20005
+ this.container.style.width = "".concat(this.box.width(this.plane.size), "px");
20006
+ this.container.style.height = "".concat(this.box.height(this.plane.size), "px");
20007
+ this.container.style.visibility = this.box.area(this.plane.size) > 0 ? "visible" : "hidden";
20008
+ }
20009
+ },
20010
+ {
20011
+ key: "clear",
20012
+ value: function clear() {
20013
+ this.container.style.width = "0px";
20014
+ this.container.style.height = "0px";
20015
+ this.container.style.visibility = "hidden";
20016
+ }
20017
+ },
20018
+ {
20019
+ key: "destroy",
20020
+ value: function destroy() {
20021
+ this.container.innerHTML = "";
20022
+ this.clear();
20023
+ }
20024
+ }
20025
+ ]);
20026
+ return RegionContent;
19911
20027
  }();
20028
+ // src/Ads/Regions/Region.ts
19912
20029
  var Region = /*#__PURE__*/ function() {
19913
20030
  "use strict";
19914
20031
  function Region(id, regionDescriptor, planeDescriptor, deps) {
19915
20032
  var _this = this;
19916
20033
  _class_call_check(this, Region);
20034
+ this.onScreen = false;
19917
20035
  this.visible = false;
20036
+ this.plugins = [];
19918
20037
  this.id = id;
19919
20038
  this.regionDescriptor = regionDescriptor;
19920
- this.contours = [];
19921
- this.box = new RegionBox();
20039
+ this.contours = new RegionContours(regionDescriptor.contours);
20040
+ this.box = new RegionBox(regionDescriptor.box);
19922
20041
  this.plane = new Plane(planeDescriptor);
19923
20042
  this.deps = deps;
20043
+ this.plugins = _to_consumable_array(this.plugins).concat(_to_consumable_array(this.deps.plugins || []));
19924
20044
  this.container = document.createElement("div");
19925
20045
  this.container.id = this.id;
19926
20046
  this.container.classList.add("BRNDTS_R");
19927
20047
  this.container.style.position = "absolute";
19928
20048
  this.container.style.pointerEvents = "all";
19929
- this.boxView = document.createElement("div");
19930
- this.boxView.classList.add("BRNDTS_RB");
19931
- this.maskLayer = document.createElement("canvas");
19932
- this.maskLayer.classList.add("BRNDTS_RM");
19933
- this.container.appendChild(this.boxView);
19934
- this.container.appendChild(this.maskLayer);
20049
+ this.content = new RegionContent(this.plane, this.box);
20050
+ this.container.appendChild(this.content.view);
19935
20051
  this.handleClick = this.handleClick.bind(this);
19936
20052
  this.handleMouseEnter = this.handleMouseEnter.bind(this);
19937
20053
  this.handleMouseLeave = this.handleMouseLeave.bind(this);
@@ -19940,18 +20056,18 @@ var Region = /*#__PURE__*/ function() {
19940
20056
  this.container.addEventListener("mouseleave", this.handleMouseLeave);
19941
20057
  if (this.deps.provider) {
19942
20058
  this.deps.provider.onRefreshContents(function(contents) {
19943
- var _this_deps_recorder;
19944
- _this.boxView.innerHTML = "";
19945
- for(var index = 0; index < contents.length; index++){
19946
- _this.boxView.appendChild(contents[index]);
19947
- }
19948
- (_this_deps_recorder = _this.deps.recorder) === null || _this_deps_recorder === void 0 ? void 0 : _this_deps_recorder.presentationStateChanged(_this);
20059
+ _this.content.clear();
20060
+ _this.content.addContent(contents);
19949
20061
  });
20062
+ if (this.boxArea > 0) {
20063
+ this.requestContent();
20064
+ }
20065
+ {
20066
+ this.content.clear();
20067
+ this.content.addContent(this.deps.provider.contents());
20068
+ }
19950
20069
  }
19951
20070
  this.render(regionDescriptor.contours, regionDescriptor.box);
19952
- if (this.boxArea > 0) {
19953
- this.requestContent();
19954
- }
19955
20071
  }
19956
20072
  _create_class(Region, [
19957
20073
  {
@@ -19991,6 +20107,56 @@ var Region = /*#__PURE__*/ function() {
19991
20107
  this.isPresented && ((_this_deps_recorder = this.deps.recorder) === null || _this_deps_recorder === void 0 ? void 0 : _this_deps_recorder.mouseLeave(this));
19992
20108
  }
19993
20109
  },
20110
+ {
20111
+ key: "applyPlugins",
20112
+ value: function applyPlugins(key) {
20113
+ var _this = this;
20114
+ return _async_to_generator(function() {
20115
+ var index, _this_plugins_index_key, _this_plugins_index;
20116
+ return _ts_generator(this, function(_state) {
20117
+ switch(_state.label){
20118
+ case 0:
20119
+ index = 0;
20120
+ _state.label = 1;
20121
+ case 1:
20122
+ if (!(index < _this.plugins.length)) return [
20123
+ 3,
20124
+ 4
20125
+ ];
20126
+ return [
20127
+ 4,
20128
+ (_this_plugins_index_key = (_this_plugins_index = _this.plugins[index])[key]) === null || _this_plugins_index_key === void 0 ? void 0 : _this_plugins_index_key.call(_this_plugins_index, _this)
20129
+ ];
20130
+ case 2:
20131
+ _state.sent();
20132
+ _state.label = 3;
20133
+ case 3:
20134
+ index++;
20135
+ return [
20136
+ 3,
20137
+ 1
20138
+ ];
20139
+ case 4:
20140
+ return [
20141
+ 2
20142
+ ];
20143
+ }
20144
+ });
20145
+ })();
20146
+ }
20147
+ },
20148
+ {
20149
+ key: "shouldPresent",
20150
+ value: function shouldPresent() {
20151
+ return this.box.area(this.plane.size) > 0 && this.content.hasContent && !this.visible;
20152
+ }
20153
+ },
20154
+ {
20155
+ key: "shouldHide",
20156
+ value: function shouldHide() {
20157
+ return (this.box.area(this.plane.size) === 0 || !this.content.hasContent) && this.visible;
20158
+ }
20159
+ },
19994
20160
  {
19995
20161
  key: "updateRegion",
19996
20162
  value: function updateRegion(region) {
@@ -20005,7 +20171,13 @@ var Region = /*#__PURE__*/ function() {
20005
20171
  width: width,
20006
20172
  height: height
20007
20173
  });
20008
- this.render(this.contours, this.box.coords);
20174
+ this.render(this.contours.points, this.box.coords);
20175
+ }
20176
+ },
20177
+ {
20178
+ key: "regionContours",
20179
+ get: function get() {
20180
+ return this.contours;
20009
20181
  }
20010
20182
  },
20011
20183
  {
@@ -20053,7 +20225,7 @@ var Region = /*#__PURE__*/ function() {
20053
20225
  {
20054
20226
  key: "boxArea",
20055
20227
  get: function get() {
20056
- return this.boxHeight * this.boxWidth;
20228
+ return this.box.area(this.plane.size);
20057
20229
  }
20058
20230
  },
20059
20231
  {
@@ -20061,7 +20233,7 @@ var Region = /*#__PURE__*/ function() {
20061
20233
  get: function get() {
20062
20234
  var _this = this;
20063
20235
  var area = 0;
20064
- var mappedVertices = this.contours.map(function(v) {
20236
+ var mappedVertices = this.contours.points.map(function(v) {
20065
20237
  return {
20066
20238
  x: v.x * _this.plane.size.width,
20067
20239
  y: v.y * _this.plane.size.height
@@ -20079,26 +20251,26 @@ var Region = /*#__PURE__*/ function() {
20079
20251
  {
20080
20252
  key: "isPresented",
20081
20253
  get: function get() {
20082
- return this.boxWidth * this.boxHeight > 0;
20254
+ return this.box.area(this.plane.size) > 0;
20083
20255
  }
20084
20256
  },
20085
20257
  {
20086
20258
  key: "isVisible",
20087
20259
  get: function get() {
20088
- return this.visible;
20260
+ return this.onScreen;
20089
20261
  }
20090
20262
  },
20091
20263
  {
20092
20264
  key: "hasContent",
20093
20265
  get: function get() {
20094
- return this.boxView.children.length > 0;
20266
+ return this.content.hasContent;
20095
20267
  }
20096
20268
  },
20097
20269
  {
20098
20270
  key: "updateVisibility",
20099
20271
  value: function updateVisibility(value2) {
20100
20272
  var _this_deps_recorder;
20101
- this.visible = value2;
20273
+ this.onScreen = value2;
20102
20274
  (_this_deps_recorder = this.deps.recorder) === null || _this_deps_recorder === void 0 ? void 0 : _this_deps_recorder.displayStateChanged(this);
20103
20275
  }
20104
20276
  },
@@ -20106,61 +20278,81 @@ var Region = /*#__PURE__*/ function() {
20106
20278
  key: "render",
20107
20279
  value: function render(contours, box) {
20108
20280
  var _this = this;
20109
- var _this_deps_recorder;
20110
- this.contours = contours;
20111
- var newBox = new RegionBox(box);
20112
- if (!this.box.isEqual(newBox.coords) && newBox.area(this.plane.size) > 0) {
20113
- this.box = newBox;
20114
- this.requestContent();
20115
- }
20116
- this.box = newBox;
20117
- this.container.style.width = "".concat(this.boxWidth, "px");
20118
- this.container.style.height = "".concat(this.boxHeight, "px");
20119
- this.container.style.left = "".concat(this.boxLeft, "px");
20120
- this.container.style.top = "".concat(this.boxTop, "px");
20121
- this.boxView.style.width = "".concat(Math.floor(this.boxWidth), "px");
20122
- this.boxView.style.height = "".concat(Math.floor(this.boxHeight), "px");
20123
- if (this.maskLayer) {
20124
- this.maskLayer.width = this.boxWidth;
20125
- this.maskLayer.style.width = "".concat(this.boxWidth, "px");
20126
- this.maskLayer.height = this.boxHeight;
20127
- this.maskLayer.style.height = "".concat(this.boxHeight, "px");
20128
- var ctx = this.maskLayer.getContext("2d");
20129
- if (!ctx) {
20130
- return;
20131
- }
20132
- if (this.contours.length === 0) {
20133
- ctx.clearRect(0, 0, this.boxWidth, this.boxHeight);
20134
- ctx.fillStyle = "white";
20135
- ctx.fill();
20136
- ctx.fillStyle = "black";
20137
- ctx.strokeStyle = "black";
20138
- ctx.lineWidth = 2;
20139
- } else {
20140
- ctx.beginPath();
20141
- ctx.moveTo(this.contours[0].x * this.plane.size.width - this.boxLeft, this.contours[0].y * this.plane.size.height - this.boxTop);
20142
- this.contours.forEach(function(point) {
20143
- return ctx.lineTo(point.x * _this.plane.size.width - _this.boxLeft, point.y * _this.plane.size.height - _this.boxTop);
20144
- });
20145
- ctx.closePath();
20146
- ctx.stroke();
20147
- ctx.filter = "blur(1px)";
20148
- ctx.fillStyle = "black";
20149
- ctx.fill();
20150
- }
20151
- var maskUrl = "url(" + this.maskLayer.toDataURL() + ")";
20152
- if (this.boxView) {
20153
- this.boxView.style.maskImage = maskUrl;
20154
- }
20155
- }
20156
- (_this_deps_recorder = this.deps.recorder) === null || _this_deps_recorder === void 0 ? void 0 : _this_deps_recorder.presentationStateChanged(this);
20281
+ return _async_to_generator(function() {
20282
+ var _this_deps_recorder, newBox;
20283
+ return _ts_generator(this, function(_state) {
20284
+ switch(_state.label){
20285
+ case 0:
20286
+ _this.applyPlugins("beforeRender");
20287
+ newBox = new RegionBox(box);
20288
+ if (!_this.box.isEqual(newBox.coords) && newBox.area(_this.plane.size) > 0) {
20289
+ _this.requestContent();
20290
+ }
20291
+ _this.box.update(box);
20292
+ _this.contours.update(contours);
20293
+ if (!_this.shouldPresent()) return [
20294
+ 3,
20295
+ 1
20296
+ ];
20297
+ _this.applyPlugins("beforeShow");
20298
+ _this.container.style.width = "".concat(_this.box.width(_this.plane.size), "px");
20299
+ _this.container.style.height = "".concat(_this.box.height(_this.plane.size), "px");
20300
+ _this.container.style.left = "".concat(_this.boxLeft, "px");
20301
+ _this.container.style.top = "".concat(_this.boxTop, "px");
20302
+ _this.content.render();
20303
+ _this.applyPlugins("afterShow");
20304
+ _this.visible = true;
20305
+ return [
20306
+ 3,
20307
+ 4
20308
+ ];
20309
+ case 1:
20310
+ if (!_this.shouldHide()) return [
20311
+ 3,
20312
+ 3
20313
+ ];
20314
+ return [
20315
+ 4,
20316
+ _this.applyPlugins("beforeHide")
20317
+ ];
20318
+ case 2:
20319
+ _state.sent();
20320
+ _this.container.style.width = "0px";
20321
+ _this.container.style.height = "0px";
20322
+ _this.container.style.left = "0px";
20323
+ _this.container.style.top = "0px";
20324
+ _this.content.render();
20325
+ _this.applyPlugins("afterHide");
20326
+ _this.visible = false;
20327
+ return [
20328
+ 3,
20329
+ 4
20330
+ ];
20331
+ case 3:
20332
+ if (_this.visible) {
20333
+ _this.container.style.width = "".concat(_this.box.width(_this.plane.size), "px");
20334
+ _this.container.style.height = "".concat(_this.box.height(_this.plane.size), "px");
20335
+ _this.container.style.left = "".concat(_this.boxLeft, "px");
20336
+ _this.container.style.top = "".concat(_this.boxTop, "px");
20337
+ _this.content.render();
20338
+ }
20339
+ _state.label = 4;
20340
+ case 4:
20341
+ _this.applyPlugins("afterRender");
20342
+ (_this_deps_recorder = _this.deps.recorder) === null || _this_deps_recorder === void 0 ? void 0 : _this_deps_recorder.presentationStateChanged(_this);
20343
+ return [
20344
+ 2
20345
+ ];
20346
+ }
20347
+ });
20348
+ })();
20157
20349
  }
20158
20350
  },
20159
20351
  {
20160
20352
  key: "clear",
20161
20353
  value: function clear() {
20162
20354
  this.updateRegion({
20163
- id: 0,
20355
+ id: this.regionDescriptor.id,
20164
20356
  box: {
20165
20357
  x1: 0,
20166
20358
  x2: 0,
@@ -20208,6 +20400,211 @@ var AdRegion = /*#__PURE__*/ function(Region) {
20208
20400
  ]);
20209
20401
  return AdRegion;
20210
20402
  }(Region);
20403
+ // src/Ads/Regions/Plugins/Animation/RegionAnimationPlugin.ts
20404
+ var RegionAnimationPlugin = /*#__PURE__*/ function() {
20405
+ "use strict";
20406
+ function RegionAnimationPlugin() {
20407
+ _class_call_check(this, RegionAnimationPlugin);
20408
+ }
20409
+ _create_class(RegionAnimationPlugin, [
20410
+ {
20411
+ key: "getBoxPosition",
20412
+ value: function getBoxPosition(plane, box) {
20413
+ var planeWidth = plane.size.width;
20414
+ var planeHeight = plane.size.height;
20415
+ var coords = {
20416
+ x1: box.coords.x1 * planeWidth,
20417
+ y1: box.coords.y1 * planeHeight,
20418
+ x2: box.coords.x2 * planeWidth,
20419
+ y2: box.coords.y2 * planeHeight
20420
+ };
20421
+ var centerX = (coords.x1 + coords.x2) / 2;
20422
+ var centerY = (coords.y1 + coords.y2) / 2;
20423
+ var isTop = centerY < planeHeight / 2;
20424
+ var isBottom = centerY >= planeHeight / 2;
20425
+ var isLeft = centerX < planeWidth / 3;
20426
+ var isCenter = centerX >= planeWidth / 3 && centerX < 2 * planeWidth / 3;
20427
+ var isRight = centerX >= 2 * planeWidth / 3;
20428
+ if (isTop && isLeft) return "TOP_LEFT";
20429
+ if (isTop && isCenter) return "TOP_CENTER";
20430
+ if (isTop && isRight) return "TOP_RIGHT";
20431
+ if (isBottom && isRight) return "BOTTOM_RIGHT";
20432
+ }
20433
+ },
20434
+ {
20435
+ key: "getAnimationForEntrance",
20436
+ value: function getAnimationForEntrance(region) {
20437
+ var position = this.getBoxPosition(region.referencePlane, region.boundingBox);
20438
+ if (!position) {
20439
+ return;
20440
+ }
20441
+ return "SLIDE_IN_".concat(position);
20442
+ }
20443
+ },
20444
+ {
20445
+ key: "animateEntrance",
20446
+ value: function animateEntrance(region) {
20447
+ var position = this.getBoxPosition(region.referencePlane, region.boundingBox);
20448
+ if (!position) {
20449
+ return;
20450
+ }
20451
+ region.position = position;
20452
+ region.content.view.classList.remove("SLIDE_OUT_".concat(position));
20453
+ region.content.view.classList.add("SLIDE_IN_".concat(position));
20454
+ }
20455
+ },
20456
+ {
20457
+ key: "animateExit",
20458
+ value: function animateExit(region) {
20459
+ var position = region.position || this.getBoxPosition(region.referencePlane, region.boundingBox);
20460
+ if (!position) {
20461
+ return;
20462
+ }
20463
+ region.position = void 0;
20464
+ region.content.view.classList.remove("SLIDE_IN_".concat(position));
20465
+ region.content.view.classList.add("SLIDE_OUT_".concat(position));
20466
+ }
20467
+ },
20468
+ {
20469
+ key: "beforeRender",
20470
+ value: function beforeRender(region) {
20471
+ region.content.view.classList.add("ANIMATE");
20472
+ return Promise.resolve();
20473
+ }
20474
+ },
20475
+ {
20476
+ key: "afterShow",
20477
+ value: function afterShow(region) {
20478
+ this.animateEntrance(region);
20479
+ return Promise.resolve();
20480
+ }
20481
+ },
20482
+ {
20483
+ key: "beforeHide",
20484
+ value: function beforeHide(region) {
20485
+ this.animateExit(region);
20486
+ return new Promise(function(resolve) {
20487
+ return setTimeout(resolve, 1e3);
20488
+ });
20489
+ }
20490
+ }
20491
+ ]);
20492
+ return RegionAnimationPlugin;
20493
+ }();
20494
+ // src/Ads/Regions/Plugins/Mask/RegionMaskPlugin.ts
20495
+ var RegionMask = /*#__PURE__*/ function() {
20496
+ "use strict";
20497
+ function RegionMask() {
20498
+ _class_call_check(this, RegionMask);
20499
+ this.width = 0;
20500
+ this.height = 0;
20501
+ this.mask = document.createElement("canvas");
20502
+ this.mask.classList.add("BRNDTS_RM");
20503
+ }
20504
+ _create_class(RegionMask, [
20505
+ {
20506
+ key: "view",
20507
+ get: function get() {
20508
+ return this.mask;
20509
+ }
20510
+ },
20511
+ {
20512
+ key: "maskUrl",
20513
+ get: function get() {
20514
+ return "url(" + this.mask.toDataURL() + ")";
20515
+ }
20516
+ },
20517
+ {
20518
+ key: "render",
20519
+ value: function render(plane, box, contours) {
20520
+ this.width = box.width(plane.size);
20521
+ this.height = box.height(plane.size);
20522
+ this.mask.width = box.width(plane.size);
20523
+ this.mask.style.width = "".concat(box.width(plane.size), "px");
20524
+ this.mask.height = box.height(plane.size);
20525
+ this.mask.style.height = "".concat(box.height(plane.size), "px");
20526
+ if (contours.length === 0) {
20527
+ this.clear();
20528
+ } else {
20529
+ var ctx = this.mask.getContext("2d");
20530
+ if (!ctx) {
20531
+ return;
20532
+ }
20533
+ ctx.beginPath();
20534
+ ctx.moveTo(contours[0].x * plane.size.width - box.coords.x1 * plane.size.width, contours[0].y * plane.size.height - box.coords.y1 * plane.size.height);
20535
+ contours.forEach(function(point) {
20536
+ return ctx.lineTo(point.x * plane.size.width - box.coords.x1 * plane.size.width, point.y * plane.size.height - box.coords.y1 * plane.size.height);
20537
+ });
20538
+ ctx.closePath();
20539
+ ctx.stroke();
20540
+ ctx.filter = "blur(1px)";
20541
+ ctx.fillStyle = "black";
20542
+ ctx.fill();
20543
+ }
20544
+ }
20545
+ },
20546
+ {
20547
+ key: "clear",
20548
+ value: function clear() {
20549
+ var ctx = this.mask.getContext("2d");
20550
+ if (!ctx) {
20551
+ return;
20552
+ }
20553
+ ctx.clearRect(0, 0, this.width, this.height);
20554
+ ctx.fillStyle = "white";
20555
+ ctx.fill();
20556
+ ctx.fillStyle = "black";
20557
+ ctx.strokeStyle = "black";
20558
+ ctx.lineWidth = 2;
20559
+ }
20560
+ }
20561
+ ]);
20562
+ return RegionMask;
20563
+ }();
20564
+ var RegionMaskPlugin = /*#__PURE__*/ function() {
20565
+ "use strict";
20566
+ function RegionMaskPlugin() {
20567
+ _class_call_check(this, RegionMaskPlugin);
20568
+ this.countours = new RegionContours();
20569
+ this.mask = new RegionMask();
20570
+ }
20571
+ _create_class(RegionMaskPlugin, [
20572
+ {
20573
+ key: "afterRender",
20574
+ value: function afterRender(region) {
20575
+ this.countours.update(region.regionContours.points);
20576
+ this.mask.render(region.referencePlane, region.boundingBox, this.countours.points);
20577
+ region.content.view.style.maskImage = this.mask.maskUrl;
20578
+ return Promise.resolve();
20579
+ }
20580
+ }
20581
+ ]);
20582
+ return RegionMaskPlugin;
20583
+ }();
20584
+ // src/Ads/Regions/Plugins/Border/RegionBorderPlugin.ts
20585
+ var RegionBorderPlugin = /*#__PURE__*/ function() {
20586
+ "use strict";
20587
+ function RegionBorderPlugin() {
20588
+ _class_call_check(this, RegionBorderPlugin);
20589
+ }
20590
+ _create_class(RegionBorderPlugin, [
20591
+ {
20592
+ key: "beforeShow",
20593
+ value: function beforeShow(region) {
20594
+ region.content.view.classList.toggle("BRNDTS_R_B", true);
20595
+ return Promise.resolve();
20596
+ }
20597
+ },
20598
+ {
20599
+ key: "afterHide",
20600
+ value: function afterHide(region) {
20601
+ region.content.view.classList.toggle("BRNDTS_R_B", false);
20602
+ return Promise.resolve();
20603
+ }
20604
+ }
20605
+ ]);
20606
+ return RegionBorderPlugin;
20607
+ }();
20211
20608
  // src/Ads/Regions/RegionFactory.ts
20212
20609
  var RegionFactory = /*#__PURE__*/ function() {
20213
20610
  "use strict";
@@ -20217,11 +20614,35 @@ var RegionFactory = /*#__PURE__*/ function() {
20217
20614
  this.deps = deps;
20218
20615
  }
20219
20616
  _create_class(RegionFactory, [
20617
+ {
20618
+ key: "getPluginForStrategy",
20619
+ value: function getPluginForStrategy() {
20620
+ var _this_deps;
20621
+ if (!((_this_deps = this.deps) === null || _this_deps === void 0 ? void 0 : _this_deps.strategy)) {
20622
+ return [
20623
+ new RegionMaskPlugin()
20624
+ ];
20625
+ }
20626
+ if (this.deps.strategy === "blend") {
20627
+ return [
20628
+ new RegionMaskPlugin()
20629
+ ];
20630
+ }
20631
+ if (this.deps.strategy === "banner" || this.deps.strategy === "bannerv2" || this.deps.strategy === "bannerv2_ocr" || this.deps.strategy === "test") {
20632
+ return [
20633
+ new RegionBorderPlugin(),
20634
+ new RegionAnimationPlugin()
20635
+ ];
20636
+ }
20637
+ }
20638
+ },
20220
20639
  {
20221
20640
  key: "get",
20222
20641
  value: function get(regionDescriptor, planeDescriptor) {
20223
20642
  if (regionDescriptor && planeDescriptor) {
20224
- return new AdRegion(regionDescriptor, planeDescriptor, this.deps || {});
20643
+ return new AdRegion(regionDescriptor, planeDescriptor, _object_spread_props(_object_spread({}, this.deps || {}), {
20644
+ plugins: this.getPluginForStrategy()
20645
+ }));
20225
20646
  }
20226
20647
  throw new InternalError("Unable to create region with provided properties!");
20227
20648
  }
@@ -20333,7 +20754,8 @@ var RegionRenderer = /*#__PURE__*/ function() {
20333
20754
  this.regionsContainerView = new RegionsContainerView(width, height);
20334
20755
  this.regionFactory = new RegionFactory({
20335
20756
  recorder: this.options.recorder,
20336
- provider: this.options.provider
20757
+ provider: this.options.provider,
20758
+ strategy: this.options.strategy
20337
20759
  });
20338
20760
  var initialRegion = this.regionFactory.get({
20339
20761
  id: 0,
@@ -20422,10 +20844,8 @@ var RegionRenderer = /*#__PURE__*/ function() {
20422
20844
  {
20423
20845
  key: "clear",
20424
20846
  value: function clear() {
20425
- var _this = this;
20426
20847
  this.regionsData = [];
20427
20848
  this.regionsObjects.forEach(function(region) {
20428
- _this.intersectionObserver.unobserve(region.view);
20429
20849
  region.clear();
20430
20850
  });
20431
20851
  }
@@ -20433,10 +20853,12 @@ var RegionRenderer = /*#__PURE__*/ function() {
20433
20853
  {
20434
20854
  key: "destroy",
20435
20855
  value: function destroy() {
20436
- this.clear();
20437
20856
  while(this.regionsObjects.length){
20438
- var _this_regionsObjects_pop;
20439
- (_this_regionsObjects_pop = this.regionsObjects.pop()) === null || _this_regionsObjects_pop === void 0 ? void 0 : _this_regionsObjects_pop.destroy();
20857
+ var region = this.regionsObjects.pop();
20858
+ if (region) {
20859
+ this.intersectionObserver.unobserve(region.view);
20860
+ region.destroy();
20861
+ }
20440
20862
  }
20441
20863
  this.regionsContainerView.destroy();
20442
20864
  }
@@ -20445,16 +20867,16 @@ var RegionRenderer = /*#__PURE__*/ function() {
20445
20867
  return RegionRenderer;
20446
20868
  }();
20447
20869
  // src/Ads/PresentationStrategy/AbstractPresentation.ts
20448
- var import_events = __toESM(require_events());
20449
- var AbstractPresentation = /*#__PURE__*/ function(_import_events_default) {
20870
+ var import_events2 = __toESM(require_events());
20871
+ var AbstractPresentation = /*#__PURE__*/ function(_import_events2_default) {
20450
20872
  "use strict";
20451
- _inherits(AbstractPresentation, _import_events_default);
20873
+ _inherits(AbstractPresentation, _import_events2_default);
20452
20874
  function AbstractPresentation() {
20453
20875
  _class_call_check(this, AbstractPresentation);
20454
20876
  return _call_super(this, AbstractPresentation);
20455
20877
  }
20456
20878
  return AbstractPresentation;
20457
- }(import_events.default);
20879
+ }(import_events2.default);
20458
20880
  // src/Ads/PresentationStrategy/CooldownPresentation.ts
20459
20881
  var CooldownPresentation = /*#__PURE__*/ function(AbstractPresentation) {
20460
20882
  "use strict";
@@ -20752,6 +21174,7 @@ var AdsTerraProvider = /*#__PURE__*/ function(ContentProvider) {
20752
21174
  return AdsTerraProvider;
20753
21175
  }(ContentProvider);
20754
21176
  // src/Ads/Providers/BRNDTSDefault/BRNDTSDefaultProvider.ts
21177
+ var icon = '\n<?xml version="1.0" encoding="UTF-8"?>\n<svg id="Camada_1" data-name="Camada 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 875 245">\n <defs>\n <style>\n .cls-1 {\n fill: #fff;\n }\n </style>\n </defs>\n <g>\n <path class="cls-1" d="M279.16,182.12v-116.12h48.13c12.5,0,21.49,2.76,26.96,8.28,5.47,5.52,8.2,13.08,8.2,22.66,0,4.48-.6,8.41-1.8,11.8-1.2,3.39-2.97,6.2-5.31,8.44-2.34,2.24-5.29,3.78-8.83,4.61,2.71.73,5.26,1.82,7.66,3.28,2.4,1.46,4.48,3.39,6.25,5.78,1.77,2.4,3.15,5.21,4.14,8.44.99,3.23,1.48,6.88,1.48,10.94,0,7.61-1.36,13.75-4.06,18.44-2.71,4.69-6.77,8.1-12.19,10.24-5.42,2.14-12.14,3.2-20.16,3.2h-50.48ZM309.48,111.64h17.5c2.29,0,3.98-.88,5.08-2.66,1.09-1.77,1.64-3.96,1.64-6.56,0-3.54-.7-5.96-2.11-7.27-1.41-1.3-2.94-1.95-4.61-1.95h-17.5v18.44ZM309.48,154.93h19.22c1.88,0,3.44-.42,4.69-1.25,1.25-.83,2.21-2,2.89-3.52.68-1.51,1.02-3.31,1.02-5.39s-.34-3.88-1.02-5.39c-.68-1.51-1.64-2.68-2.89-3.52-1.25-.83-2.81-1.25-4.69-1.25h-19.22v20.32Z"/>\n <path class="cls-1" d="M379.65,182.12v-116.12h49.54c5.1,0,9.79.63,14.07,1.88,4.27,1.25,7.97,3.36,11.1,6.33,3.13,2.97,5.55,6.95,7.27,11.96s2.58,11.31,2.58,18.91c0,4.79-.42,8.96-1.25,12.5-.84,3.54-1.95,6.54-3.36,8.99-1.41,2.45-3.07,4.51-5,6.17-1.93,1.67-3.99,3.13-6.17,4.38l20.16,45.01h-30.79l-16.25-40.01h-11.57v40.01h-30.32ZM409.97,118.05h13.75c1.67,0,3.13-.23,4.38-.7s2.32-1.22,3.2-2.27c.88-1.04,1.54-2.37,1.95-3.98.41-1.61.62-3.57.62-5.86s-.21-4.22-.62-5.78c-.42-1.56-1.07-2.79-1.95-3.67-.89-.88-1.95-1.54-3.2-1.95-1.25-.42-2.71-.62-4.38-.62h-13.75v24.85Z"/>\n <path class="cls-1" d="M479.67,182.12v-116.12h24.07l40.79,64.7v-64.7h30.32v116.12h-24.07l-40.79-64.7v64.7h-30.32Z"/>\n <path class="cls-1" d="M592.03,182.12v-116.12h51.26c8.44,0,15.37,1.48,20.79,4.45,5.42,2.97,9.69,7.11,12.81,12.42,3.13,5.31,5.31,11.49,6.56,18.52,1.25,7.03,1.88,14.61,1.88,22.74,0,13.65-1.54,24.72-4.61,33.21-3.07,8.49-7.71,14.74-13.91,18.75-6.2,4.01-14.04,6.02-23.52,6.02h-51.26ZM622.35,154.93h17.82c3.85,0,6.85-1.04,8.99-3.13,2.13-2.08,3.65-5.39,4.53-9.92.88-4.53,1.33-10.44,1.33-17.74,0-6.88-.34-12.37-1.02-16.49-.68-4.11-1.67-7.21-2.97-9.3-1.3-2.08-2.87-3.46-4.69-4.14-1.82-.68-3.88-1.02-6.17-1.02h-17.82v61.73Z"/>\n <path class="cls-1" d="M721.9,182.12v-88.92h-29.22v-27.19h88.77v27.19h-29.22v88.92h-30.32Z"/>\n <path class="cls-1" d="M828.95,183.06c-3.44,0-6.8-.11-10.08-.31-3.28-.21-6.51-.52-9.69-.94-3.18-.42-6.23-.88-9.14-1.41-2.92-.52-5.73-1.15-8.44-1.88v-24.07c3.54.31,7.37.57,11.49.78,4.11.21,8.28.37,12.5.47,4.22.1,8.15.16,11.8.16,3.44,0,6.3-.26,8.6-.78,2.29-.52,4.01-1.35,5.16-2.5,1.15-1.15,1.72-2.71,1.72-4.69v-1.88c0-2.29-.81-4.01-2.42-5.16-1.62-1.15-3.52-1.72-5.7-1.72h-8.28c-12.09,0-21.25-2.66-27.51-7.97-6.25-5.31-9.38-14.22-9.38-26.72v-5.16c0-11.46,3.44-20.03,10.31-25.71,6.88-5.68,16.77-8.52,29.69-8.52,4.9,0,9.51.23,13.83.7,4.32.47,8.39,1.04,12.19,1.72,3.8.68,7.21,1.38,10.24,2.11v24.07c-4.79-.42-10.18-.75-16.17-1.02-5.99-.26-11.44-.39-16.33-.39-2.92,0-5.52.21-7.81.63-2.29.42-4.06,1.25-5.31,2.5-1.25,1.25-1.88,3.07-1.88,5.47v1.56c0,2.61.83,4.59,2.5,5.94,1.67,1.36,4.22,2.03,7.66,2.03h10.31c7.29,0,13.36,1.38,18.21,4.14,4.84,2.76,8.49,6.51,10.94,11.25,2.45,4.74,3.67,10.13,3.67,16.17v5.16c0,9.9-1.72,17.45-5.16,22.66-3.44,5.21-8.34,8.73-14.69,10.55-6.36,1.82-13.96,2.74-22.82,2.74Z"/>\n </g>\n <path class="cls-1" d="M193.77,2.19H53.62C25.87,2.19,3.39,24.68,3.39,52.42v140.15c0,27.75,22.49,50.23,50.23,50.23h140.15c27.75,0,50.23-22.49,50.23-50.23V52.42c0-27.74-22.49-50.23-50.23-50.23ZM127.13,65.24c0-9.25,7.5-16.74,16.74-16.74h53.45v53.45c0,9.25-7.5,16.74-16.74,16.74h-53.45v-53.45ZM120.23,179.77c0,9.25-7.5,16.74-16.74,16.74h-36.71c-9.25,0-16.74-7.5-16.74-16.74v-114.53c0-9.25,7.5-16.74,16.74-16.74h36.71c9.25,0,16.74,7.5,16.74,16.74v114.53ZM197.33,162.19c-.55,18.26-16.3,33.95-34.45,34.31-17.61.35-33.5-12.89-35.21-30.88-1.15-12.1-.22-24.4-.22-38.93,14.98,0,27.35-.98,39.49.23,18.36,1.83,30.93,17.24,30.38,35.27Z"/>\n</svg>';
20755
21178
  var BRNDTSDefaultProvider = /*#__PURE__*/ function(ContentProvider) {
20756
21179
  "use strict";
20757
21180
  _inherits(BRNDTSDefaultProvider, ContentProvider);
@@ -20768,28 +21191,28 @@ var BRNDTSDefaultProvider = /*#__PURE__*/ function(ContentProvider) {
20768
21191
  container.style.height = "100%";
20769
21192
  var box = document.createElement("div");
20770
21193
  box.classList.add("box");
21194
+ var iconBox = document.createElement("div");
21195
+ iconBox.classList.add("icon");
21196
+ iconBox.innerHTML = icon;
21197
+ box.appendChild(iconBox);
20771
21198
  container.appendChild(box);
20772
- container.appendChild(_this.createText("BRNDTS"));
20773
21199
  _this.content.push(container);
20774
21200
  return _this;
20775
21201
  }
20776
21202
  _create_class(BRNDTSDefaultProvider, [
20777
21203
  {
20778
- key: "createText",
20779
- value: function createText(text2) {
20780
- var textElement = document.createElement("div");
20781
- textElement.classList.add("text");
20782
- textElement.textContent = text2;
20783
- return textElement;
21204
+ key: "contents",
21205
+ value: function contents() {
21206
+ return this.content.map(function(v) {
21207
+ return v.cloneNode(true);
21208
+ });
20784
21209
  }
20785
21210
  },
20786
21211
  {
20787
21212
  key: "request",
20788
21213
  value: function request() {
20789
- var _this = this;
20790
21214
  return _async_to_generator(function() {
20791
21215
  return _ts_generator(this, function(_state) {
20792
- _this.notify();
20793
21216
  return [
20794
21217
  2
20795
21218
  ];
@@ -72641,9 +73064,6 @@ var SmartyadsProvider = /*#__PURE__*/ function(ContentProvider) {
72641
73064
  return _ts_generator(this, function(_state) {
72642
73065
  switch(_state.label){
72643
73066
  case 0:
72644
- if (!params || params.size.width === void 0 || params.size.width === 0 || params.size.height === void 0 || params.size.height === 0) {
72645
- throw new InternalError("No Params!");
72646
- }
72647
73067
  placementInfo = _this.getPlacement((_params_params = params.params) === null || _params_params === void 0 ? void 0 : _params_params.regionId);
72648
73068
  return [
72649
73069
  4,
@@ -73013,7 +73433,8 @@ var Ads = /*#__PURE__*/ function() {
73013
73433
  this.regionsRenderer = new RegionRenderer(this.context.media.viewWidth, this.context.media.viewHeight, {
73014
73434
  debug: this.context.config.get("debug"),
73015
73435
  recorder: this.context.recorder,
73016
- provider: ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider)
73436
+ provider: ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider),
73437
+ strategy: this.context.config.get("ads").regions.strategy
73017
73438
  });
73018
73439
  } catch (e2) {
73019
73440
  if (_instanceof(e2, Error)) {
@@ -73084,7 +73505,6 @@ var Ads = /*#__PURE__*/ function() {
73084
73505
  }
73085
73506
  }).on("cooldown", function() {
73086
73507
  var _this_regionsRenderer;
73087
- _this.context.logger.log("cooldown");
73088
73508
  (_this_regionsRenderer = _this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
73089
73509
  });
73090
73510
  (_this_context_media = this.context.media) === null || _this_context_media === void 0 ? void 0 : _this_context_media.on("SEEKED", function() {
@@ -73118,7 +73538,7 @@ var Ads = /*#__PURE__*/ function() {
73118
73538
  // src/Ads/index.ts
73119
73539
  var Ads_default = Ads;
73120
73540
  // src/UI/Interface.ts
73121
- var import_events3 = __toESM(require_events());
73541
+ var import_events4 = __toESM(require_events());
73122
73542
  // src/Common/utils/elements.ts
73123
73543
  function wrap(elements2, wrapper) {
73124
73544
  var targets = elements2.length ? elements2 : [
@@ -73324,16 +73744,16 @@ var elements = {
73324
73744
  };
73325
73745
  var elements_default = elements;
73326
73746
  // src/UI/Controls/ControlEvents.ts
73327
- var import_events2 = __toESM(require_events());
73328
- var ControlsEvents = /*#__PURE__*/ function(_import_events2_default) {
73747
+ var import_events3 = __toESM(require_events());
73748
+ var ControlsEvents = /*#__PURE__*/ function(_import_events3_default) {
73329
73749
  "use strict";
73330
- _inherits(ControlsEvents, _import_events2_default);
73750
+ _inherits(ControlsEvents, _import_events3_default);
73331
73751
  function ControlsEvents() {
73332
73752
  _class_call_check(this, ControlsEvents);
73333
73753
  return _call_super(this, ControlsEvents, arguments);
73334
73754
  }
73335
73755
  return ControlsEvents;
73336
- }(import_events2.default);
73756
+ }(import_events3.default);
73337
73757
  // node_modules/@fortawesome/fontawesome-svg-core/index.mjs
73338
73758
  var noop2 = function() {};
73339
73759
  var _WINDOW = {};
@@ -74121,12 +74541,12 @@ function codePointAt(string, index) {
74121
74541
  }
74122
74542
  function normalizeIcons(icons) {
74123
74543
  return Object.keys(icons).reduce(function(acc, iconName) {
74124
- var icon2 = icons[iconName];
74125
- var expanded = !!icon2.icon;
74544
+ var icon3 = icons[iconName];
74545
+ var expanded = !!icon3.icon;
74126
74546
  if (expanded) {
74127
- acc[icon2.iconName] = icon2.icon;
74547
+ acc[icon3.iconName] = icon3.icon;
74128
74548
  } else {
74129
- acc[iconName] = icon2;
74549
+ acc[iconName] = icon3;
74130
74550
  }
74131
74551
  return acc;
74132
74552
  }, {});
@@ -74175,12 +74595,12 @@ var build = function() {
74175
74595
  return o$$1;
74176
74596
  }, {});
74177
74597
  };
74178
- _byUnicode = lookup3(function(acc, icon2, iconName) {
74179
- if (icon2[3]) {
74180
- acc[icon2[3]] = iconName;
74598
+ _byUnicode = lookup3(function(acc, icon3, iconName) {
74599
+ if (icon3[3]) {
74600
+ acc[icon3[3]] = iconName;
74181
74601
  }
74182
- if (icon2[2]) {
74183
- var aliases = icon2[2].filter(function(a$$1) {
74602
+ if (icon3[2]) {
74603
+ var aliases = icon3[2].filter(function(a$$1) {
74184
74604
  return typeof a$$1 === "number";
74185
74605
  });
74186
74606
  aliases.forEach(function(alias) {
@@ -74189,10 +74609,10 @@ var build = function() {
74189
74609
  }
74190
74610
  return acc;
74191
74611
  });
74192
- _byLigature = lookup3(function(acc, icon2, iconName) {
74612
+ _byLigature = lookup3(function(acc, icon3, iconName) {
74193
74613
  acc[iconName] = iconName;
74194
- if (icon2[2]) {
74195
- var aliases = icon2[2].filter(function(a$$1) {
74614
+ if (icon3[2]) {
74615
+ var aliases = icon3[2].filter(function(a$$1) {
74196
74616
  return typeof a$$1 === "string";
74197
74617
  });
74198
74618
  aliases.forEach(function(alias) {
@@ -74201,8 +74621,8 @@ var build = function() {
74201
74621
  }
74202
74622
  return acc;
74203
74623
  });
74204
- _byAlias = lookup3(function(acc, icon2, iconName) {
74205
- var aliases = icon2[2];
74624
+ _byAlias = lookup3(function(acc, icon3, iconName) {
74625
+ var aliases = icon3[2];
74206
74626
  acc[iconName] = iconName;
74207
74627
  aliases.forEach(function(alias) {
74208
74628
  acc[alias] = iconName;
@@ -74398,17 +74818,17 @@ var Library = /*#__PURE__*/ function() {
74398
74818
  0: definition
74399
74819
  } : definition;
74400
74820
  Object.keys(normalized).map(function(key) {
74401
- var _normalized_key = normalized[key], prefix = _normalized_key.prefix, iconName = _normalized_key.iconName, icon2 = _normalized_key.icon;
74402
- var aliases = icon2[2];
74821
+ var _normalized_key = normalized[key], prefix = _normalized_key.prefix, iconName = _normalized_key.iconName, icon3 = _normalized_key.icon;
74822
+ var aliases = icon3[2];
74403
74823
  if (!additions[prefix]) additions[prefix] = {};
74404
74824
  if (aliases.length > 0) {
74405
74825
  aliases.forEach(function(alias) {
74406
74826
  if (typeof alias === "string") {
74407
- additions[prefix][alias] = icon2;
74827
+ additions[prefix][alias] = icon3;
74408
74828
  }
74409
74829
  });
74410
74830
  }
74411
- additions[prefix][iconName] = icon2;
74831
+ additions[prefix][iconName] = icon3;
74412
74832
  });
74413
74833
  return additions;
74414
74834
  }
@@ -74529,26 +74949,26 @@ var dom = {
74529
74949
  }
74530
74950
  };
74531
74951
  var parse = {
74532
- icon: function(icon2) {
74533
- if (icon2 === null) {
74952
+ icon: function(icon3) {
74953
+ if (icon3 === null) {
74534
74954
  return null;
74535
74955
  }
74536
- if ((typeof icon2 === "undefined" ? "undefined" : _type_of(icon2)) === "object" && icon2.prefix && icon2.iconName) {
74956
+ if ((typeof icon3 === "undefined" ? "undefined" : _type_of(icon3)) === "object" && icon3.prefix && icon3.iconName) {
74537
74957
  return {
74538
- prefix: icon2.prefix,
74539
- iconName: byAlias(icon2.prefix, icon2.iconName) || icon2.iconName
74958
+ prefix: icon3.prefix,
74959
+ iconName: byAlias(icon3.prefix, icon3.iconName) || icon3.iconName
74540
74960
  };
74541
74961
  }
74542
- if (Array.isArray(icon2) && icon2.length === 2) {
74543
- var iconName = icon2[1].indexOf("fa-") === 0 ? icon2[1].slice(3) : icon2[1];
74544
- var prefix = getCanonicalPrefix(icon2[0]);
74962
+ if (Array.isArray(icon3) && icon3.length === 2) {
74963
+ var iconName = icon3[1].indexOf("fa-") === 0 ? icon3[1].slice(3) : icon3[1];
74964
+ var prefix = getCanonicalPrefix(icon3[0]);
74545
74965
  return {
74546
74966
  prefix: prefix,
74547
74967
  iconName: byAlias(prefix, iconName) || iconName
74548
74968
  };
74549
74969
  }
74550
- if (typeof icon2 === "string" && (icon2.indexOf("".concat(config.cssPrefix, "-")) > -1 || icon2.match(ICON_SELECTION_SYNTAX_PATTERN))) {
74551
- var canonicalIcon = getCanonicalIcon(icon2.split(" "), {
74970
+ if (typeof icon3 === "string" && (icon3.indexOf("".concat(config.cssPrefix, "-")) > -1 || icon3.match(ICON_SELECTION_SYNTAX_PATTERN))) {
74971
+ var canonicalIcon = getCanonicalIcon(icon3.split(" "), {
74552
74972
  skipLookups: true
74553
74973
  });
74554
74974
  return {
@@ -74556,11 +74976,11 @@ var parse = {
74556
74976
  iconName: byAlias(canonicalIcon.prefix, canonicalIcon.iconName) || canonicalIcon.iconName
74557
74977
  };
74558
74978
  }
74559
- if (typeof icon2 === "string") {
74979
+ if (typeof icon3 === "string") {
74560
74980
  var prefix1 = getDefaultUsablePrefix();
74561
74981
  return {
74562
74982
  prefix: prefix1,
74563
- iconName: byAlias(prefix1, icon2) || icon2
74983
+ iconName: byAlias(prefix1, icon3) || icon3
74564
74984
  };
74565
74985
  }
74566
74986
  }
@@ -74787,10 +75207,10 @@ function makeLayersCounterAbstract(params) {
74787
75207
  return val;
74788
75208
  }
74789
75209
  var styles$1 = namespace.styles;
74790
- function asFoundIcon(icon2) {
74791
- var width = icon2[0];
74792
- var height = icon2[1];
74793
- var _icon2_slice = _sliced_to_array(icon2.slice(4), 1), vectorData = _icon2_slice[0];
75210
+ function asFoundIcon(icon3) {
75211
+ var width = icon3[0];
75212
+ var height = icon3[1];
75213
+ var _icon3_slice = _sliced_to_array(icon3.slice(4), 1), vectorData = _icon3_slice[0];
74794
75214
  var element = null;
74795
75215
  if (Array.isArray(vectorData)) {
74796
75216
  element = {
@@ -74855,8 +75275,8 @@ function findIcon(iconName, prefix) {
74855
75275
  prefix = shim.prefix || prefix;
74856
75276
  }
74857
75277
  if (iconName && prefix && styles$1[prefix] && styles$1[prefix][iconName]) {
74858
- var icon2 = styles$1[prefix][iconName];
74859
- return resolve(asFoundIcon(icon2));
75278
+ var icon3 = styles$1[prefix][iconName];
75279
+ return resolve(asFoundIcon(icon3));
74860
75280
  }
74861
75281
  maybeNotifyMissing(iconName, prefix);
74862
75282
  resolve(_object_spread_props(_object_spread({}, missingIconResolutionMixin), {
@@ -74891,8 +75311,8 @@ function isWatched(node) {
74891
75311
  }
74892
75312
  function hasPrefixAndIcon(node) {
74893
75313
  var prefix = node.getAttribute ? node.getAttribute(DATA_PREFIX) : null;
74894
- var icon2 = node.getAttribute ? node.getAttribute(DATA_ICON) : null;
74895
- return prefix && icon2;
75314
+ var icon3 = node.getAttribute ? node.getAttribute(DATA_ICON) : null;
75315
+ return prefix && icon3;
74896
75316
  }
74897
75317
  function hasBeenReplaced(node) {
74898
75318
  return node && node.classList && node.classList.contains && node.classList.contains(config.replacementClass);
@@ -75274,7 +75694,7 @@ var render = function render(iconDefinition) {
75274
75694
  var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
75275
75695
  var _params_transform = params.transform, transform = _params_transform === void 0 ? meaninglessTransform : _params_transform, _params_symbol = params.symbol, symbol = _params_symbol === void 0 ? false : _params_symbol, _params_mask = params.mask, mask = _params_mask === void 0 ? null : _params_mask, _params_maskId = params.maskId, maskId = _params_maskId === void 0 ? null : _params_maskId, _params_title = params.title, title = _params_title === void 0 ? null : _params_title, _params_titleId = params.titleId, titleId = _params_titleId === void 0 ? null : _params_titleId, _params_classes = params.classes, classes = _params_classes === void 0 ? [] : _params_classes, _params_attributes = params.attributes, attributes = _params_attributes === void 0 ? {} : _params_attributes, tmp = params.styles, styles2 = tmp === void 0 ? {} : tmp;
75276
75696
  if (!iconDefinition) return;
75277
- var prefix = iconDefinition.prefix, iconName = iconDefinition.iconName, icon2 = iconDefinition.icon;
75697
+ var prefix = iconDefinition.prefix, iconName = iconDefinition.iconName, icon3 = iconDefinition.icon;
75278
75698
  return domVariants(_object_spread({
75279
75699
  type: "icon"
75280
75700
  }, iconDefinition), function() {
@@ -75292,7 +75712,7 @@ var render = function render(iconDefinition) {
75292
75712
  }
75293
75713
  return makeInlineSvgAbstract({
75294
75714
  icons: {
75295
- main: asFoundIcon(icon2),
75715
+ main: asFoundIcon(icon3),
75296
75716
  mask: mask ? asFoundIcon(mask.icon) : {
75297
75717
  found: false,
75298
75718
  width: null,
@@ -76055,7 +76475,7 @@ var dom$1 = api.dom;
76055
76475
  var parse$1 = api.parse;
76056
76476
  var findIconDefinition$1 = api.findIconDefinition;
76057
76477
  var toHtml$1 = api.toHtml;
76058
- var icon = api.icon;
76478
+ var icon2 = api.icon;
76059
76479
  var layer = api.layer;
76060
76480
  var text = api.text;
76061
76481
  var counter = api.counter;
@@ -76088,11 +76508,11 @@ var faUpRightAndDownLeftFromCenter = {
76088
76508
  };
76089
76509
  // src/Common/utils/Icons.ts
76090
76510
  library$1.add(faUpRightAndDownLeftFromCenter, faDownLeftAndUpRightToCenter);
76091
- var expand = icon({
76511
+ var expand = icon2({
76092
76512
  prefix: "fas",
76093
76513
  iconName: "up-right-and-down-left-from-center"
76094
76514
  }).html;
76095
- var compress = icon({
76515
+ var compress = icon2({
76096
76516
  prefix: "fas",
76097
76517
  iconName: "down-left-and-up-right-to-center"
76098
76518
  }).html;
@@ -76392,9 +76812,9 @@ var Controls = /*#__PURE__*/ function() {
76392
76812
  return Controls;
76393
76813
  }();
76394
76814
  // src/UI/Interface.ts
76395
- var Interface = /*#__PURE__*/ function(_import_events3_default) {
76815
+ var Interface = /*#__PURE__*/ function(_import_events4_default) {
76396
76816
  "use strict";
76397
- _inherits(Interface, _import_events3_default);
76817
+ _inherits(Interface, _import_events4_default);
76398
76818
  function Interface(context) {
76399
76819
  _class_call_check(this, Interface);
76400
76820
  var _this;
@@ -76553,7 +76973,7 @@ var Interface = /*#__PURE__*/ function(_import_events3_default) {
76553
76973
  }
76554
76974
  ]);
76555
76975
  return Interface;
76556
- }(import_events3.default);
76976
+ }(import_events4.default);
76557
76977
  // src/State/Store.ts
76558
76978
  function reducer(state, action) {
76559
76979
  switch(action.type){
@@ -77044,7 +77464,7 @@ var InteractionLog = /*#__PURE__*/ function() {
77044
77464
  return InteractionLog;
77045
77465
  }();
77046
77466
  // src/BRNDTSService.ts
77047
- var import_events4 = __toESM(require_events());
77467
+ var import_events5 = __toESM(require_events());
77048
77468
  // node_modules/engine.io-parser/build/esm/commons.js
77049
77469
  var PACKET_TYPES = /* @__PURE__ */ Object.create(null);
77050
77470
  PACKET_TYPES["open"] = "0";
@@ -80908,9 +81328,9 @@ Object.assign(lookup2, {
80908
81328
  connect: lookup2
80909
81329
  });
80910
81330
  // src/BRNDTSService.ts
80911
- var BRNDTSService = /*#__PURE__*/ function(_import_events4_default) {
81331
+ var BRNDTSService = /*#__PURE__*/ function(_import_events5_default) {
80912
81332
  "use strict";
80913
- _inherits(BRNDTSService, _import_events4_default);
81333
+ _inherits(BRNDTSService, _import_events5_default);
80914
81334
  function BRNDTSService(deps, options) {
80915
81335
  _class_call_check(this, BRNDTSService);
80916
81336
  var _this;
@@ -80994,12 +81414,12 @@ var BRNDTSService = /*#__PURE__*/ function(_import_events4_default) {
80994
81414
  }
80995
81415
  ]);
80996
81416
  return BRNDTSService;
80997
- }(import_events4.default);
81417
+ }(import_events5.default);
80998
81418
  // src/Media/GenericMediaElement.ts
80999
- var import_events5 = __toESM(require_events());
81000
- var GenericMediaElement = /*#__PURE__*/ function(_import_events5_default) {
81419
+ var import_events6 = __toESM(require_events());
81420
+ var GenericMediaElement = /*#__PURE__*/ function(_import_events6_default) {
81001
81421
  "use strict";
81002
- _inherits(GenericMediaElement, _import_events5_default);
81422
+ _inherits(GenericMediaElement, _import_events6_default);
81003
81423
  function GenericMediaElement(context) {
81004
81424
  _class_call_check(this, GenericMediaElement);
81005
81425
  var _this;
@@ -81163,7 +81583,7 @@ var GenericMediaElement = /*#__PURE__*/ function(_import_events5_default) {
81163
81583
  }
81164
81584
  ]);
81165
81585
  return GenericMediaElement;
81166
- }(import_events5.default);
81586
+ }(import_events6.default);
81167
81587
  // src/Media/YoutubeMediaElements.ts
81168
81588
  var import_loadjs = __toESM(require_loadjs_umd());
81169
81589
  var DEFAULT_SEEK_INTERVAL = 10;